@quillmark/wasm 0.111.0 → 0.113.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.
@@ -22,18 +22,15 @@ export const document_cards: (a: number, b: number) => void;
22
22
  export const document_clone: (a: number) => number;
23
23
  export const document_currentStorageVersion: (a: number) => void;
24
24
  export const document_equals: (a: number, b: number) => number;
25
- export const document_formatDiagnostic: (a: number, b: number) => void;
26
25
  export const document_formatRules: (a: number) => void;
27
- export const document_fromJson: (a: number, b: number, c: number) => void;
28
26
  export const document_fromMarkdown: (a: number, b: number, c: number) => void;
27
+ export const document_fromStored: (a: number, b: number, c: number) => void;
29
28
  export const document_getExt: (a: number, b: number, c: number) => void;
30
- export const document_getExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
31
29
  export const document_getStored: (a: number, b: number, c: number) => void;
32
30
  export const document_insertCard: (a: number, b: number, c: number, d: number) => void;
33
31
  export const document_isFill: (a: number, b: number, c: number) => void;
34
- export const document_loadJson: (a: number, b: number, c: number, d: number) => void;
32
+ export const document_loadStored: (a: number, b: number, c: number, d: number) => void;
35
33
  export const document_main: (a: number, b: number) => void;
36
- export const document_makeCard: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
37
34
  export const document_moveCard: (a: number, b: number, c: number, d: number) => void;
38
35
  export const document_new: (a: number, b: number, c: number) => void;
39
36
  export const document_overwrite: (a: number, b: number, c: number, d: number) => void;
@@ -42,61 +39,56 @@ export const document_quillRef: (a: number, b: number) => void;
42
39
  export const document_quillRefHint: (a: number) => void;
43
40
  export const document_removeCard: (a: number, b: number, c: number) => void;
44
41
  export const document_removeExt: (a: number, b: number, c: number) => void;
45
- export const document_removeExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
46
42
  export const document_removeField: (a: number, b: number, c: number) => void;
47
43
  export const document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
48
44
  export const document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
49
45
  export const document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
50
- export const document_setCardKind: (a: number, b: number, c: number, d: number, e: number) => void;
51
46
  export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
52
47
  export const document_storageVersionOf: (a: number, b: number, c: number) => void;
53
48
  export const document_storeExt: (a: number, b: number, c: number, d: number) => void;
54
- export const document_storeExtNamespace: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
55
49
  export const document_storeField: (a: number, b: number, c: number, d: number) => void;
56
50
  export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
57
51
  export const document_storeFill: (a: number, b: number, c: number, d: number) => void;
58
52
  export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
59
- export const document_toJson: (a: number, b: number) => void;
60
53
  export const document_toMarkdown: (a: number, b: number) => void;
61
- export const document_tryFromJson: (a: number, b: number) => number;
54
+ export const document_toStored: (a: number, b: number) => void;
62
55
  export const document_warnings: (a: number, b: number) => void;
63
56
  export const exportMarkdown: (a: number, b: number) => void;
64
57
  export const formatDocPath: (a: number, b: number) => void;
65
58
  export const importMarkdown: (a: number, b: number, c: number) => void;
66
59
  export const livesession_backendId: (a: number, b: number) => void;
67
- export const livesession_fieldAt: (a: number, b: number, c: number, d: number, e: number) => void;
60
+ export const livesession_fieldAt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
68
61
  export const livesession_fieldBoxes: (a: number, b: number, c: number, d: number) => void;
69
- export const livesession_locate: (a: number, b: number, c: number, d: number) => number;
62
+ export const livesession_locate: (a: number, b: number, c: number, d: number, e: number) => void;
70
63
  export const livesession_pageCount: (a: number) => number;
71
64
  export const livesession_pageSize: (a: number, b: number, c: number) => void;
72
65
  export const livesession_paint: (a: number, b: number, c: number, d: number, e: number) => void;
73
- export const livesession_positionAt: (a: number, b: number, c: number, d: number) => number;
66
+ export const livesession_positionAt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
74
67
  export const livesession_regions: (a: number, b: number) => void;
75
68
  export const livesession_render: (a: number, b: number, c: number) => void;
76
- export const livesession_supportsCanvas: (a: number) => number;
77
69
  export const livesession_update: (a: number, b: number, c: number) => void;
78
70
  export const livesession_warnings: (a: number, b: number) => void;
79
71
  export const mapMarks: (a: number, b: number, c: number) => void;
80
72
  export const mapPos: (a: number, b: number, c: number, d: number) => void;
81
73
  export const parseDocPath: (a: number, b: number, c: number) => void;
74
+ export const quill__resolve: (a: number, b: number, c: number) => void;
82
75
  export const quill_backendId: (a: number, b: number) => void;
83
76
  export const quill_blueprint: (a: number, b: number) => void;
84
77
  export const quill_conform: (a: number, b: number, c: number) => void;
85
78
  export const quill_fromTree: (a: number, b: number) => void;
86
79
  export const quill_metadata: (a: number, b: number) => void;
87
80
  export const quill_parse: (a: number, b: number, c: number, d: number) => void;
88
- export const quill_resolve: (a: number, b: number, c: number) => void;
89
81
  export const quill_schema: (a: number, b: number) => void;
90
82
  export const quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
91
83
  export const quill_seedDocument: (a: number) => number;
92
84
  export const quill_seedMain: (a: number, b: number) => void;
93
85
  export const quill_toTree: (a: number) => number;
94
86
  export const quill_validate: (a: number, b: number, c: number) => void;
87
+ export const quill_warnings: (a: number, b: number) => void;
95
88
  export const quillmark_new: () => number;
96
89
  export const quillmark_open: (a: number, b: number, c: number, d: number) => void;
97
90
  export const quillmark_render: (a: number, b: number, c: number, d: number, e: number) => void;
98
91
  export const quillmark_supportedFormats: (a: number, b: number, c: number) => void;
99
- export const quillmark_supportsCanvas: (a: number, b: number) => number;
100
92
  export const rebase: (a: number, b: number, c: number, d: number) => void;
101
93
  export const start: () => void;
102
94
  export const __wbindgen_export: (a: number, b: number) => number;
@@ -1,9 +1,5 @@
1
- // @quillmark/wasm/runtime: canonical consumer API.
2
- //
3
- // The render-side types are defined HERE as the backend-neutral render contract,
4
- // not sourced from any one private backend build; `runtime.types.test-d.ts`
5
- // asserts they stay mutually assignable with the Typst backend's generated
6
- // declarations.
1
+ // The canonical consumer API, and the package's sole export: `@quillmark/wasm`
2
+ // resolves here.
7
3
  //
8
4
  // The `Quill`/`Document` `init` resolves to ARE the core build's classes, never
9
5
  // wrappers. Two copies of this package are two WASM linear memories and two
@@ -115,24 +111,18 @@ export type {
115
111
 
116
112
  // Content edit vocabulary: the op-grained content model `Document`'s methods
117
113
  // speak (`applyChange(addr, bundle)`, `overwrite(addr, rt)`, `revise(…) => Delta`).
118
- // Declared in the core build; re-exported here so the single public entry point
119
- // names every type its own re-exported surface already references: `Card.body`
120
- // is a `Content`, `PayloadItem.nestedFills` a `PathStep[][]`, `CardInput.body` a
121
- // `Content | string`: rather than forcing consumers to derive them structurally
122
- // off the `Document` handle. The content write path (a ProseMirror↔content codec)
123
- // must name all of them; they are its correctness core, not edge types.
124
- // `ContentLineKind` is the shared half of `ContentLine` and `setKind`, so lifting
125
- // a line's kind whole (destructure off `containers`/`continues`, spread the rest
126
- // into the op) is the version-proof spelling of building a `setKind`. Naming it
127
- // is what makes that spelling type-check without a cast. The alternative, an
128
- // arm-by-arm switch, means guessing at the open arm's shape and re-editing on
129
- // every arm added.
114
+ // `ContentLineKind` is the shared half of `ContentLine` and `setKind`, and
115
+ // `ContentMarkKind` of `ContentMark` and a mark op's `add` / `remove`: lifting a
116
+ // read value's kind whole destructure off the envelope, spread the rest into
117
+ // the op is the version-proof spelling of the op, and naming the type is what
118
+ // makes that spelling type-check without a cast.
130
119
  export type {
131
120
  Content,
132
121
  ContentLine,
133
122
  ContentLineKind,
134
123
  ContentContainer,
135
124
  ContentMark,
125
+ ContentMarkKind,
136
126
  ContentIsland,
137
127
  TableProps,
138
128
  ImageProps,
@@ -150,13 +140,9 @@ export type {
150
140
  DocPathSeg
151
141
  } from '../core/wasm.js';
152
142
 
153
- // The resolved-value view: the return shape of `quill.resolve(doc)`. Value
154
- // + source rung per declared field (the body is a `body` sibling on its card,
155
- // never a row in `fields`); diagnostics stay `quill.validate`, guidance stays
156
- // `quill.schema`.
157
- // Declared in the core build's generated `.d.ts` via a
158
- // `typescript_custom_section`; re-exported here so the single public entry
159
- // point names them.
143
+ // The schema-bound whole-document read on `quill.reader(doc)`: the resolved
144
+ // view (`reader.resolve()`, value + source rung per declared field, the body a
145
+ // `body` sibling on its card and never a row in `fields`).
160
146
  export type {
161
147
  FieldSource,
162
148
  ResolvedField,
@@ -165,8 +151,6 @@ export type {
165
151
  Resolved
166
152
  } from '../core/wasm.js';
167
153
 
168
- // ── Error contract ──────────────────────────────────────────────────────────
169
-
170
154
  /**
171
155
  * The error every fallible method in this package throws: parse
172
156
  * (`Document.fromMarkdown`), document mutation, validation
@@ -193,98 +177,12 @@ export interface QuillmarkError extends Error {
193
177
  */
194
178
  export declare function isQuillmarkError(e: unknown): e is QuillmarkError;
195
179
 
196
- // `ContentIsland.type`, `ContentMark.type`, `ContentLine.kind`, and
197
- // `ContentContainer.container` are open sets: each union has a residual
198
- // `{ …: string; … }` arm, so a bare discriminant check never narrows the payload
199
- // (TS keeps the residual arm live, since a `string` can equal the literal).
200
- // These guards are the checked narrowing path for the pinned arms; only the
201
- // payload-carrying arms get one, since the rest narrow to nothing.
180
+ import type { ContentContainer } from '../core/wasm.js';
202
181
 
203
- import type {
204
- ContentIsland,
205
- TableProps,
206
- ImageProps,
207
- ContentMark,
208
- ContentLine,
209
- ContentContainer
210
- } from '../core/wasm.js';
211
-
212
- /** Narrow a {@link ContentIsland} to the pinned `table` arm (`props: TableProps`). */
213
- export declare function isTableIsland(
214
- island: ContentIsland
215
- ): island is ContentIsland & { type: 'table'; props: TableProps };
216
-
217
- /** Narrow a {@link ContentIsland} to the pinned `image` arm (`props: ImageProps`). */
218
- export declare function isImageIsland(
219
- island: ContentIsland
220
- ): island is ContentIsland & { type: 'image'; props: ImageProps };
221
-
222
- /** Narrow a {@link ContentMark} to the `link` arm (carries `url`). */
223
- export declare function isLinkMark(
224
- mark: ContentMark
225
- ): mark is ContentMark & { type: 'link'; url: string };
226
-
227
- /** Narrow a {@link ContentMark} to the `anchor` arm (carries `id`). */
228
- export declare function isAnchorMark(
229
- mark: ContentMark
230
- ): mark is ContentMark & { type: 'anchor'; id: string };
231
-
232
- /** Narrow a {@link ContentLine} to the `heading` arm (carries `level`). */
233
- export declare function isHeadingLine(
234
- line: ContentLine
235
- ): line is ContentLine & { kind: 'heading'; level: number };
236
-
237
- /** Narrow a {@link ContentLine} to the `code` arm (carries `lang`). */
238
- export declare function isCodeLine(
239
- line: ContentLine
240
- ): line is ContentLine & { kind: 'code'; lang?: string };
241
-
242
- /** Narrow a {@link ContentContainer} to the `list_item` arm (carries its shape). */
243
- export declare function isListItemContainer(
244
- container: ContentContainer
245
- ): container is ContentContainer & {
246
- container: 'list_item';
247
- ordered: boolean;
248
- start: number;
249
- ordinal: number;
250
- instance: number;
251
- };
252
-
253
- // The guards above answer "is this arm X". These four answer "is this a value
254
- // this build knows?", the question a read-modify-write consumer must ask: an
255
- // edit restates every line's kind and containers, so a construct the consumer
256
- // cannot hold is gone on write-back unless carried inertly, and enumerating the
257
- // built-in names by hand re-couples to a closed set.
258
- //
259
- // They classify unknown TAGS, not unknown payloads on known tags: a future
260
- // `kind: "footnote"` carrying a sibling `ref` loses `ref` at any consumer that
261
- // predates it, with or without these.
262
-
263
- /** True when this build does not know `line.kind`: the open arm, carrying opaque `attrs`. */
264
- export declare function isUnknownLine(
265
- line: ContentLine
266
- ): line is ContentLine & { kind: string; attrs: unknown };
267
-
268
- /** True when this build does not know `container.container`. See {@link isUnknownLine}. */
269
- export declare function isUnknownContainer(
270
- container: ContentContainer
271
- ): container is ContentContainer & { container: string; attrs: unknown };
272
-
273
- /** True when this build does not know `mark.type`. See {@link isUnknownLine}. */
274
- export declare function isUnknownMark(
275
- mark: ContentMark
276
- ): mark is ContentMark & { type: string; attrs: unknown };
277
-
278
- /** True when this build does not know `island.type` (its payload rides `props`, not `attrs`). */
279
- export declare function isUnknownIsland(
280
- island: ContentIsland
281
- ): island is ContentIsland & { type: string; props: unknown };
282
-
283
- // `ContentContainer.instance` is required, so a checker reports an omission; it
284
- // cannot report a `0` stamped on every run, which is the same write. Adjacent
285
- // runs of one shape sharing a value arrive welded, and nothing reports that
286
- // either: the flat `containers` form cannot tell it from one container spanning
287
- // two paragraphs. This carries the rule a codec would otherwise re-derive.
182
+ // `ContentIsland.type`, `ContentMark.type`, `ContentLine.kind`,
183
+ // `ContentContainer.container` and an island's `loss` are closed sets, so a
184
+ // bare discriminant check narrows the payload on its own:
185
+ // `line.kind === 'heading'` reaches `line.attrs.level`, with no guard to call.
288
186
 
289
187
  /**
290
188
  * Stamp `instance` across one parent's blocks at one depth, in document order,
@@ -297,8 +195,9 @@ export declare function isUnknownIsland(
297
195
  * `instance` held.
298
196
  *
299
197
  * The `instance` it stamps is canonical, so a document reads back the value it
300
- * was written. `ordinal` stays the caller's, and a write is renumbered to a
301
- * gapless index within its run.
198
+ * was written — a `0` as an absent key, which decodes to the same value.
199
+ * `ordinal` stays the caller's, and a write is renumbered to a gapless index
200
+ * within its run.
302
201
  *
303
202
  * Which fields decide a weld is coarser than equality for a list: CommonMark
304
203
  * reads only a list's first number, so `1. a` beside `3. b` welds despite the
@@ -317,8 +216,8 @@ export declare function assignInstances(
317
216
 
318
217
  // The backend-neutral render contract, defined here rather than re-exported from
319
218
  // one private backend because no single backend owns the canonical API's types.
320
- // Every backend build must satisfy these shapes; `runtime.types.test-d.ts` keeps
321
- // them from diverging from the generated `pkg/backends/typst/wasm.d.ts`.
219
+ // The render build must satisfy these shapes; `runtime.types.test-d.ts` keeps
220
+ // them from diverging from the generated `pkg/render/wasm.d.ts`.
322
221
 
323
222
  import type { Quill, Document, Card } from '../core/wasm.js';
324
223
  import type { Diagnostic } from '../core/wasm.js';
@@ -333,9 +232,14 @@ export interface Artifact {
333
232
  /** Options for one render. */
334
233
  export interface RenderOptions {
335
234
  format?: OutputFormat;
235
+ /**
236
+ * Pixels per inch for raster formats (PNG); ignored by PDF and SVG.
237
+ * Defaults to 144. Must be finite, above 0, and small enough to keep every
238
+ * rendered page under 268435456 pixels — anything else throws
239
+ * `backend::invalid_raster_scale`.
240
+ */
336
241
  ppi?: number;
337
242
  pages?: number[];
338
- producer?: string;
339
243
  /**
340
244
  * Populate {@link RenderResult.regions} with schema-field geometry, for
341
245
  * consumers without a live session. Defaults to `false`.
@@ -380,26 +284,17 @@ export interface ContentHit {
380
284
  * direction use {@link LiveSession.fieldAt}, which resolves a point on *any*
381
285
  * placement, not just the first one surfaced here.
382
286
  *
383
- * COORDINATE TRANSFORM. `rect` is in PDF points with a **bottom-left** origin.
384
- *
385
- * For an **HTML/CSS overlay** on a `width:100%` canvas, position hotspots as
386
- * percentages of the page, so they track the displayed size across DPI and pane
387
- * resize for free; only the Y axis flips:
388
- *
389
- * ```js
390
- * const [x0, y0, x1, y1] = region.rect; // PDF pt, bottom-left origin
391
- * const left = (x0 / pageWidthPt) * 100; // % of page (from PageSize.widthPt)
392
- * const top = (1 - y1 / pageHeightPt) * 100; // %: flip Y (from PageSize.heightPt)
393
- * const width = ((x1 - x0) / pageWidthPt) * 100;
394
- * const height = ((y1 - y0) / pageHeightPt) * 100;
395
- * ```
396
- *
397
- * For painting **into a raster** at `renderScale` (= `layoutScale × densityScale`),
398
- * use the device-pixel form instead:
287
+ * COORDINATE TRANSFORM. `rect` is in PDF points with a **bottom-left** origin
288
+ * where a canvas or CSS overlay is top-left, so only the Y axis flips, off `y1`
289
+ * the rect's *upper* edge and never off `y0`:
399
290
  *
400
291
  * ```js
401
- * const left = x0 * renderScale;
402
- * const top = (pageHeightPt - y1) * renderScale; // flip Y
292
+ * const [x0, y0, x1, y1] = region.rect;
293
+ * // Into a raster painted at renderScale (= layoutScale × densityScale):
294
+ * const left = x0 * renderScale, top = (pageHeightPt - y1) * renderScale;
295
+ * // Or, for an HTML overlay on a width:100% canvas, as % of the page, which
296
+ * // tracks the displayed size across DPI and pane resize with no scale to thread:
297
+ * const leftPct = (x0 / pageWidthPt) * 100, topPct = (1 - y1 / pageHeightPt) * 100;
403
298
  * ```
404
299
  */
405
300
  export interface FieldRegion {
@@ -430,7 +325,6 @@ export interface RenderResult {
430
325
  artifacts: Artifact[];
431
326
  warnings: Diagnostic[];
432
327
  outputFormat: OutputFormat;
433
- renderTimeMs: number;
434
328
  /**
435
329
  * Schema-field geometry, populated only when {@link RenderOptions.regions}
436
330
  * asked for it. Page indices are document-space even under a `pages` subset.
@@ -449,7 +343,13 @@ export interface PageSize {
449
343
 
450
344
  /** Inputs to `paint`. */
451
345
  export interface PaintOptions {
346
+ /** How big the page is on screen, in CSS px per point. Default 1. */
452
347
  layoutScale?: number;
348
+ /**
349
+ * How sharp it is: `window.devicePixelRatio`, in-app zoom and
350
+ * `visualViewport.scale` folded into one number. Default 1, because the
351
+ * painter cannot see any of them (SSR, tests, off-screen).
352
+ */
453
353
  densityScale?: number;
454
354
  }
455
355
 
@@ -483,25 +383,24 @@ export interface ChangeSet {
483
383
 
484
384
  /**
485
385
  * A backend registry entry. `load` is the lazy thunk returning the
486
- * dynamically-imported backend build module; `formats`/`canvas` are the required
487
- * static capability manifest, which is what makes `Engine.supportedFormats` and
488
- * `Engine.supportsCanvas` free: they answer from it without loading a backend
489
- * binary or cloning a quill. A malformed descriptor throws at `new Engine(...)`.
386
+ * dynamically-imported backend build module; `formats` is the required static
387
+ * capability manifest, which is what makes `Engine.supportedFormats` free: it
388
+ * answers from it without loading a backend binary or cloning a quill. A
389
+ * malformed descriptor throws at `new Engine(...)`.
490
390
  */
491
391
  export interface BackendDescriptor {
492
392
  load: () => Promise<unknown>;
493
393
  formats: OutputFormat[];
494
- canvas: boolean;
495
394
  }
496
395
 
497
396
  export interface EngineOptions {
498
397
  /**
499
398
  * Extra or overriding backend descriptors, merged over the built-ins. Keys are
500
399
  * backend ids (as declared by `Quill.yaml`'s `backend:` and reported by
501
- * `Quill.backendId`). Each value is a `BackendDescriptor`: `formats`/`canvas`
502
- * are required, so capability probes are ALWAYS free (no binary load, no quill
400
+ * `Quill.backendId`). Each value is a `BackendDescriptor`: `formats` is
401
+ * required, so the format probe is ALWAYS free (no binary load, no quill
503
402
  * clone). Malformed entries throw at construction. The default registry maps
504
- * `"typst"` to the bundled Typst build.
403
+ * `"typst"` and `"acroform"` to the bundled render build.
505
404
  */
506
405
  backends?: Record<string, BackendDescriptor>;
507
406
  }
@@ -511,6 +410,10 @@ export interface EngineOptions {
511
410
  * `quill.backendId`, lazily loads that backend build, clones the quill and
512
411
  * document into the backend's WASM memory on demand, renders, and frees the
513
412
  * clones. The cross-memory crossing is invisible to callers.
413
+ *
414
+ * A `quill.backendId` outside the registry rejects with
415
+ * `engine::backend_not_found`, the capability probes included. The diagnostic's
416
+ * `hint` names the registered ids.
514
417
  */
515
418
  export declare class Engine {
516
419
  constructor(options?: EngineOptions);
@@ -519,6 +422,12 @@ export declare class Engine {
519
422
  * Render `doc` against `quill` in one shot. Both handles are read
520
423
  * synchronously before the first await, so the caller may `free()` them as
521
424
  * soon as this call returns.
425
+ *
426
+ * This is the surface that merges the two warning halves:
427
+ * {@link RenderResult.warnings} carries `doc.warnings` (parse, `conform::*`,
428
+ * `plate::unsupported_construct`) ahead of the compile's own. A
429
+ * {@link LiveSession} outlives the document it opened from, so
430
+ * {@link LiveSession.render} carries the compile half alone.
522
431
  */
523
432
  render(quill: Quill, doc: Document, options?: RenderOptions): Promise<RenderResult>;
524
433
 
@@ -536,17 +445,6 @@ export declare class Engine {
536
445
  * backend binary or cloning the quill. Async for API stability.
537
446
  */
538
447
  supportedFormats(quill: Quill): Promise<OutputFormat[]>;
539
-
540
- /**
541
- * Whether `quill`'s backend can paint sessions to a canvas: a pre-session
542
- * estimate, not a fact about any particular compile, answered from the
543
- * descriptor's `canvas` manifest like `supportedFormats`. A specific compile
544
- * can still refuse to paint (a 0-page document, say), so this can answer
545
- * `true` while the resulting {@link LiveSession.supportsCanvas} answers
546
- * `false`. Gate mounting a canvas UI on this, and the `paint` call itself on
547
- * the session's getter.
548
- */
549
- supportsCanvas(quill: Quill): Promise<boolean>;
550
448
  }
551
449
 
552
450
  /**
@@ -554,23 +452,19 @@ export declare class Engine {
554
452
  *
555
453
  * CANVAS PAINT IS COMPLETE: {@link LiveSession.paint} writes a whole page
556
454
  * raster, every piece of page content already visible in the painted pixels,
557
- * with no compositing required by the caller — pdfform pre-flattens bound field
558
- * values into the page content to satisfy this. {@link LiveSession.regions}
455
+ * with no compositing required by the caller — acroform bakes each bound field
456
+ * value into the widget's appearance stream to satisfy this. {@link LiveSession.regions}
559
457
  * carries schema-field geometry for overlays drawn on top; it is never needed to
560
458
  * complete the picture.
459
+ *
460
+ * A compile with no pages throws from {@link LiveSession.pageSize} and
461
+ * {@link LiveSession.paint}, naming the page index and the `pageCount` that
462
+ * excludes it. Every backend paints, so that is the only refusal either owes.
561
463
  */
562
464
  export declare class LiveSession {
563
465
  private constructor();
564
466
  readonly pageCount: number;
565
467
  readonly backendId: string;
566
- /**
567
- * `true` iff `paint`/`pageSize` will succeed for THIS compile: the
568
- * authoritative answer, which can be `false` even where
569
- * {@link Engine.supportsCanvas} answered `true` for the same `quill` (a
570
- * canvas-capable backend compiled to a 0-page document has nothing to paint).
571
- * Re-check it after `open()` rather than relying on the engine hint.
572
- */
573
- readonly supportsCanvas: boolean;
574
468
  readonly warnings: Diagnostic[];
575
469
  /**
576
470
  * Recompile the session against `doc`: the edit verb of a live preview.
@@ -612,13 +506,24 @@ export declare class LiveSession {
612
506
  * transform documented there: `x = clickPx.x / renderScale`,
613
507
  * `y = pageHeightPt - clickPx.y / renderScale`. Unlike {@link regions},
614
508
  * *every* placement answers, not just the first.
509
+ *
510
+ * `tolPt` is how far off the ink a click still counts, in the same points,
511
+ * and defaults to `0` — exact. It is pointer slack, so derive it from the
512
+ * scale the page was drawn at (`slackPx / renderScale`) rather than fixing a
513
+ * value in points, which shrinks under the cursor as the page zooms out. The
514
+ * nearest placement answers and containment is distance zero, so raising
515
+ * `tolPt` only ever fills a miss.
615
516
  */
616
- fieldAt(page: number, x: number, y: number): string | undefined;
517
+ fieldAt(page: number, x: number, y: number, tolPt?: number): string | undefined;
617
518
  /**
618
519
  * Fine-grained click → content position (caret placement). Same PDF-point
619
- * space as {@link fieldAt}; `undefined` off all content ink.
520
+ * space as {@link fieldAt}; `undefined` past `tolPt` from all content ink.
521
+ *
522
+ * `tolPt` buys the most here: the leading between two lines lies inside a
523
+ * paragraph and on no glyph, and under `tolPt` a point there takes the line
524
+ * it is nearer.
620
525
  */
621
- positionAt(page: number, x: number, y: number): ContentHit | undefined;
526
+ positionAt(page: number, x: number, y: number, tolPt?: number): ContentHit | undefined;
622
527
  /**
623
528
  * Content position → caret rect: reverse of {@link positionAt}. `field` is a
624
529
  * canonical `DocPath` address (`parseDocPath`-routable), as {@link regions} keys.
@@ -649,8 +554,6 @@ export declare class LiveSession {
649
554
  free(): void;
650
555
  }
651
556
 
652
- // ── Typed writer: the schema-bound front door ───────────────────────────────
653
-
654
557
  // `quill.writer(doc)` is patched onto the re-exported `Quill` prototype (the
655
558
  // class is re-exported verbatim, so the method is declared by merging into the
656
559
  // core module's `Quill` rather than redeclaring the class).
@@ -663,13 +566,14 @@ declare module '../core/wasm.js' {
663
566
  */
664
567
  writer(doc: Document): DocumentWriter;
665
568
  /**
666
- * Bind this quill's schema to `doc` for interpreted reads: the read twin of
569
+ * Bind this quill's schema to `doc` for schema-bound reads: the read twin of
667
570
  * {@link Quill.writer}, mirroring core's `quill.reader(&doc)`. Each field is
668
- * read by its declared type (a richtext field to markdown, every other type
669
- * verbatim) with schema authority, so a name the schema does not declare
670
- * throws rather than reading back `undefined`. Holds both handles by
671
- * reference and owns neither (nothing to `free()`); ephemeral by convention:
672
- * bind, read, discard.
571
+ * read in the values form (every content leaf as its codec's text, every
572
+ * other value as stored) with schema authority, so a name the schema does
573
+ * not declare throws rather than reading back `undefined`; the render
574
+ * view reads through `resolve()`. Holds both handles by reference and
575
+ * owns neither (nothing
576
+ * to `free()`); ephemeral by convention: bind, read, discard.
673
577
  */
674
578
  reader(doc: Document): DocumentReader;
675
579
  }
@@ -814,6 +718,10 @@ export declare class DocumentReader {
814
718
  * schema's `items` / `properties` / `variants`, so the element's storage
815
719
  * form is not the caller's business. The empty path is {@link getContent}.
816
720
  *
721
+ * The `Content` is a write input, so this is the read a round-trip takes:
722
+ * an anchor and an island `id` have no markdown projection, and survive an
723
+ * edit only by riding this read back through `writer.set` of the field.
724
+ *
817
725
  * `undefined` for an absent field and for a path that names nothing in the
818
726
  * stored value: a repeater's row index goes stale between derive and read,
819
727
  * so absence there is a read, not a fault. Throws `UnknownField` for an
@@ -824,6 +732,14 @@ export declare class DocumentReader {
824
732
  getContentAt(addr: Addr | string, path: PathStep[]): Content | undefined;
825
733
  /** The main body's markdown: the quill-free body read. Equals `get({})`. */
826
734
  bodyMarkdown(): string;
735
+ /**
736
+ * The resolved-value view: for every declared field, the value the render
737
+ * projection would use and the rung it came from (`authored` / `default` /
738
+ * `blank`). The one read that blank-fills and coerces; {@link get} reports
739
+ * what the document carries. Value and provenance only; completeness stays
740
+ * `quill.validate`'s.
741
+ */
742
+ resolve(): Resolved;
827
743
  /**
828
744
  * A {@link CardReader} for the composable card at `index`. Index validity is
829
745
  * checked lazily at read time, so an out-of-range index does not throw here.