@quillmark/wasm 0.112.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.
- package/CHANGELOG.md +1487 -0
- package/README.md +91 -66
- package/core/wasm.d.ts +117 -182
- package/core/wasm.js +245 -391
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +5 -11
- package/package.json +2 -2
- package/{backends/pdfform → render}/wasm.d.ts +168 -264
- package/{backends/pdfform → render}/wasm.js +326 -450
- package/{backends/typst → render}/wasm_bg.wasm +0 -0
- package/{backends/typst → render}/wasm_bg.wasm.d.ts +7 -15
- package/runtime/runtime.d.ts +84 -178
- package/runtime/runtime.js +141 -583
- package/backends/pdfform/wasm_bg.wasm +0 -0
- package/backends/pdfform/wasm_bg.wasm.d.ts +0 -107
- package/backends/typst/wasm.d.ts +0 -1511
- package/backends/typst/wasm.js +0 -3008
|
Binary file
|
|
@@ -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
|
|
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,23 +39,19 @@ 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
|
|
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;
|
|
@@ -66,37 +59,36 @@ export const importMarkdown: (a: number, b: number, c: number) => void;
|
|
|
66
59
|
export const livesession_backendId: (a: number, b: number) => void;
|
|
67
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) =>
|
|
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, e: 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;
|
package/runtime/runtime.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
//
|
|
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
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
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
|
|
154
|
-
// + source rung per declared field
|
|
155
|
-
// never a row in `fields`)
|
|
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,97 +177,12 @@ export interface QuillmarkError extends Error {
|
|
|
193
177
|
*/
|
|
194
178
|
export declare function isQuillmarkError(e: unknown): e is QuillmarkError;
|
|
195
179
|
|
|
196
|
-
|
|
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.
|
|
202
|
-
|
|
203
|
-
import type {
|
|
204
|
-
ContentIsland,
|
|
205
|
-
TableProps,
|
|
206
|
-
ImageProps,
|
|
207
|
-
ContentMark,
|
|
208
|
-
ContentLine,
|
|
209
|
-
ContentContainer
|
|
210
|
-
} from '../core/wasm.js';
|
|
180
|
+
import type { ContentContainer } from '../core/wasm.js';
|
|
211
181
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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 `attrs.url`). */
|
|
223
|
-
export declare function isLinkMark(
|
|
224
|
-
mark: ContentMark
|
|
225
|
-
): mark is ContentMark & { type: 'link'; attrs: { url: string } };
|
|
226
|
-
|
|
227
|
-
/** Narrow a {@link ContentMark} to the `anchor` arm (carries `attrs.id`). */
|
|
228
|
-
export declare function isAnchorMark(
|
|
229
|
-
mark: ContentMark
|
|
230
|
-
): mark is ContentMark & { type: 'anchor'; attrs: { id: string } };
|
|
231
|
-
|
|
232
|
-
/** Narrow a {@link ContentLine} to the `heading` arm (carries `attrs.level`). */
|
|
233
|
-
export declare function isHeadingLine(
|
|
234
|
-
line: ContentLine
|
|
235
|
-
): line is ContentLine & { kind: 'heading'; attrs: { level: number } };
|
|
236
|
-
|
|
237
|
-
/** Narrow a {@link ContentLine} to the `code` arm (carries `attrs.lang`). */
|
|
238
|
-
export declare function isCodeLine(
|
|
239
|
-
line: ContentLine
|
|
240
|
-
): line is ContentLine & { kind: 'code'; attrs?: { 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
|
-
attrs: { ordered: boolean; start: number; ordinal: number };
|
|
248
|
-
instance: number;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
// The guards above answer "is this arm X". These four answer "is this a value
|
|
252
|
-
// this build knows?", the question a read-modify-write consumer must ask: an
|
|
253
|
-
// edit restates every line's kind and containers, so a construct the consumer
|
|
254
|
-
// cannot hold is gone on write-back unless carried inertly, and enumerating the
|
|
255
|
-
// built-in names by hand re-couples to a closed set.
|
|
256
|
-
//
|
|
257
|
-
// They classify unknown TAGS, not unknown payloads on known tags: a future
|
|
258
|
-
// `kind: "footnote"` carrying an `attrs.ref` loses `ref` at any consumer that
|
|
259
|
-
// predates it, with or without these. The spelling needs no classifying: a
|
|
260
|
-
// payload rides `attrs` whether or not this build knows the name.
|
|
261
|
-
|
|
262
|
-
/** True when this build does not know `line.kind`: the open arm, carrying opaque `attrs`. */
|
|
263
|
-
export declare function isUnknownLine(
|
|
264
|
-
line: ContentLine
|
|
265
|
-
): line is ContentLine & { kind: string; attrs: unknown };
|
|
266
|
-
|
|
267
|
-
/** True when this build does not know `container.container`. See {@link isUnknownLine}. */
|
|
268
|
-
export declare function isUnknownContainer(
|
|
269
|
-
container: ContentContainer
|
|
270
|
-
): container is ContentContainer & { container: string; attrs: unknown };
|
|
271
|
-
|
|
272
|
-
/** True when this build does not know `mark.type`. See {@link isUnknownLine}. */
|
|
273
|
-
export declare function isUnknownMark(
|
|
274
|
-
mark: ContentMark
|
|
275
|
-
): mark is ContentMark & { type: string; attrs: unknown };
|
|
276
|
-
|
|
277
|
-
/** True when this build does not know `island.type` (its payload rides `props`, not `attrs`). */
|
|
278
|
-
export declare function isUnknownIsland(
|
|
279
|
-
island: ContentIsland
|
|
280
|
-
): island is ContentIsland & { type: string; props: unknown };
|
|
281
|
-
|
|
282
|
-
// `ContentContainer.instance` is required, so a checker reports an omission; it
|
|
283
|
-
// cannot report a `0` stamped on every run, which is the same write. Adjacent
|
|
284
|
-
// runs of one shape sharing a value arrive welded, and nothing reports that
|
|
285
|
-
// either: the flat `containers` form cannot tell it from one container spanning
|
|
286
|
-
// 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.
|
|
287
186
|
|
|
288
187
|
/**
|
|
289
188
|
* Stamp `instance` across one parent's blocks at one depth, in document order,
|
|
@@ -296,8 +195,9 @@ export declare function isUnknownIsland(
|
|
|
296
195
|
* `instance` held.
|
|
297
196
|
*
|
|
298
197
|
* The `instance` it stamps is canonical, so a document reads back the value it
|
|
299
|
-
* was written
|
|
300
|
-
*
|
|
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.
|
|
301
201
|
*
|
|
302
202
|
* Which fields decide a weld is coarser than equality for a list: CommonMark
|
|
303
203
|
* reads only a list's first number, so `1. a` beside `3. b` welds despite the
|
|
@@ -316,8 +216,8 @@ export declare function assignInstances(
|
|
|
316
216
|
|
|
317
217
|
// The backend-neutral render contract, defined here rather than re-exported from
|
|
318
218
|
// one private backend because no single backend owns the canonical API's types.
|
|
319
|
-
//
|
|
320
|
-
// them from diverging from the generated `pkg/
|
|
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`.
|
|
321
221
|
|
|
322
222
|
import type { Quill, Document, Card } from '../core/wasm.js';
|
|
323
223
|
import type { Diagnostic } from '../core/wasm.js';
|
|
@@ -332,9 +232,14 @@ export interface Artifact {
|
|
|
332
232
|
/** Options for one render. */
|
|
333
233
|
export interface RenderOptions {
|
|
334
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
|
+
*/
|
|
335
241
|
ppi?: number;
|
|
336
242
|
pages?: number[];
|
|
337
|
-
producer?: string;
|
|
338
243
|
/**
|
|
339
244
|
* Populate {@link RenderResult.regions} with schema-field geometry, for
|
|
340
245
|
* consumers without a live session. Defaults to `false`.
|
|
@@ -379,26 +284,17 @@ export interface ContentHit {
|
|
|
379
284
|
* direction use {@link LiveSession.fieldAt}, which resolves a point on *any*
|
|
380
285
|
* placement, not just the first one surfaced here.
|
|
381
286
|
*
|
|
382
|
-
* COORDINATE TRANSFORM. `rect` is in PDF points with a **bottom-left** origin
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* percentages of the page, so they track the displayed size across DPI and pane
|
|
386
|
-
* resize for free; only the Y axis flips:
|
|
387
|
-
*
|
|
388
|
-
* ```js
|
|
389
|
-
* const [x0, y0, x1, y1] = region.rect; // PDF pt, bottom-left origin
|
|
390
|
-
* const left = (x0 / pageWidthPt) * 100; // % of page (from PageSize.widthPt)
|
|
391
|
-
* const top = (1 - y1 / pageHeightPt) * 100; // %: flip Y (from PageSize.heightPt)
|
|
392
|
-
* const width = ((x1 - x0) / pageWidthPt) * 100;
|
|
393
|
-
* const height = ((y1 - y0) / pageHeightPt) * 100;
|
|
394
|
-
* ```
|
|
395
|
-
*
|
|
396
|
-
* For painting **into a raster** at `renderScale` (= `layoutScale × densityScale`),
|
|
397
|
-
* 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`:
|
|
398
290
|
*
|
|
399
291
|
* ```js
|
|
400
|
-
* const
|
|
401
|
-
*
|
|
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;
|
|
402
298
|
* ```
|
|
403
299
|
*/
|
|
404
300
|
export interface FieldRegion {
|
|
@@ -429,7 +325,6 @@ export interface RenderResult {
|
|
|
429
325
|
artifacts: Artifact[];
|
|
430
326
|
warnings: Diagnostic[];
|
|
431
327
|
outputFormat: OutputFormat;
|
|
432
|
-
renderTimeMs: number;
|
|
433
328
|
/**
|
|
434
329
|
* Schema-field geometry, populated only when {@link RenderOptions.regions}
|
|
435
330
|
* asked for it. Page indices are document-space even under a `pages` subset.
|
|
@@ -448,7 +343,13 @@ export interface PageSize {
|
|
|
448
343
|
|
|
449
344
|
/** Inputs to `paint`. */
|
|
450
345
|
export interface PaintOptions {
|
|
346
|
+
/** How big the page is on screen, in CSS px per point. Default 1. */
|
|
451
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
|
+
*/
|
|
452
353
|
densityScale?: number;
|
|
453
354
|
}
|
|
454
355
|
|
|
@@ -482,25 +383,24 @@ export interface ChangeSet {
|
|
|
482
383
|
|
|
483
384
|
/**
|
|
484
385
|
* A backend registry entry. `load` is the lazy thunk returning the
|
|
485
|
-
* dynamically-imported backend build module; `formats
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
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(...)`.
|
|
489
390
|
*/
|
|
490
391
|
export interface BackendDescriptor {
|
|
491
392
|
load: () => Promise<unknown>;
|
|
492
393
|
formats: OutputFormat[];
|
|
493
|
-
canvas: boolean;
|
|
494
394
|
}
|
|
495
395
|
|
|
496
396
|
export interface EngineOptions {
|
|
497
397
|
/**
|
|
498
398
|
* Extra or overriding backend descriptors, merged over the built-ins. Keys are
|
|
499
399
|
* backend ids (as declared by `Quill.yaml`'s `backend:` and reported by
|
|
500
|
-
* `Quill.backendId`). Each value is a `BackendDescriptor`: `formats
|
|
501
|
-
*
|
|
400
|
+
* `Quill.backendId`). Each value is a `BackendDescriptor`: `formats` is
|
|
401
|
+
* required, so the format probe is ALWAYS free (no binary load, no quill
|
|
502
402
|
* clone). Malformed entries throw at construction. The default registry maps
|
|
503
|
-
* `"typst"` to the bundled
|
|
403
|
+
* `"typst"` and `"acroform"` to the bundled render build.
|
|
504
404
|
*/
|
|
505
405
|
backends?: Record<string, BackendDescriptor>;
|
|
506
406
|
}
|
|
@@ -510,6 +410,10 @@ export interface EngineOptions {
|
|
|
510
410
|
* `quill.backendId`, lazily loads that backend build, clones the quill and
|
|
511
411
|
* document into the backend's WASM memory on demand, renders, and frees the
|
|
512
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.
|
|
513
417
|
*/
|
|
514
418
|
export declare class Engine {
|
|
515
419
|
constructor(options?: EngineOptions);
|
|
@@ -518,6 +422,12 @@ export declare class Engine {
|
|
|
518
422
|
* Render `doc` against `quill` in one shot. Both handles are read
|
|
519
423
|
* synchronously before the first await, so the caller may `free()` them as
|
|
520
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.
|
|
521
431
|
*/
|
|
522
432
|
render(quill: Quill, doc: Document, options?: RenderOptions): Promise<RenderResult>;
|
|
523
433
|
|
|
@@ -535,17 +445,6 @@ export declare class Engine {
|
|
|
535
445
|
* backend binary or cloning the quill. Async for API stability.
|
|
536
446
|
*/
|
|
537
447
|
supportedFormats(quill: Quill): Promise<OutputFormat[]>;
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Whether `quill`'s backend can paint sessions to a canvas: a pre-session
|
|
541
|
-
* estimate, not a fact about any particular compile, answered from the
|
|
542
|
-
* descriptor's `canvas` manifest like `supportedFormats`. A specific compile
|
|
543
|
-
* can still refuse to paint (a 0-page document, say), so this can answer
|
|
544
|
-
* `true` while the resulting {@link LiveSession.supportsCanvas} answers
|
|
545
|
-
* `false`. Gate mounting a canvas UI on this, and the `paint` call itself on
|
|
546
|
-
* the session's getter.
|
|
547
|
-
*/
|
|
548
|
-
supportsCanvas(quill: Quill): Promise<boolean>;
|
|
549
448
|
}
|
|
550
449
|
|
|
551
450
|
/**
|
|
@@ -553,23 +452,19 @@ export declare class Engine {
|
|
|
553
452
|
*
|
|
554
453
|
* CANVAS PAINT IS COMPLETE: {@link LiveSession.paint} writes a whole page
|
|
555
454
|
* raster, every piece of page content already visible in the painted pixels,
|
|
556
|
-
* with no compositing required by the caller —
|
|
557
|
-
*
|
|
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}
|
|
558
457
|
* carries schema-field geometry for overlays drawn on top; it is never needed to
|
|
559
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.
|
|
560
463
|
*/
|
|
561
464
|
export declare class LiveSession {
|
|
562
465
|
private constructor();
|
|
563
466
|
readonly pageCount: number;
|
|
564
467
|
readonly backendId: string;
|
|
565
|
-
/**
|
|
566
|
-
* `true` iff `paint`/`pageSize` will succeed for THIS compile: the
|
|
567
|
-
* authoritative answer, which can be `false` even where
|
|
568
|
-
* {@link Engine.supportsCanvas} answered `true` for the same `quill` (a
|
|
569
|
-
* canvas-capable backend compiled to a 0-page document has nothing to paint).
|
|
570
|
-
* Re-check it after `open()` rather than relying on the engine hint.
|
|
571
|
-
*/
|
|
572
|
-
readonly supportsCanvas: boolean;
|
|
573
468
|
readonly warnings: Diagnostic[];
|
|
574
469
|
/**
|
|
575
470
|
* Recompile the session against `doc`: the edit verb of a live preview.
|
|
@@ -659,8 +554,6 @@ export declare class LiveSession {
|
|
|
659
554
|
free(): void;
|
|
660
555
|
}
|
|
661
556
|
|
|
662
|
-
// ── Typed writer: the schema-bound front door ───────────────────────────────
|
|
663
|
-
|
|
664
557
|
// `quill.writer(doc)` is patched onto the re-exported `Quill` prototype (the
|
|
665
558
|
// class is re-exported verbatim, so the method is declared by merging into the
|
|
666
559
|
// core module's `Quill` rather than redeclaring the class).
|
|
@@ -673,13 +566,14 @@ declare module '../core/wasm.js' {
|
|
|
673
566
|
*/
|
|
674
567
|
writer(doc: Document): DocumentWriter;
|
|
675
568
|
/**
|
|
676
|
-
* Bind this quill's schema to `doc` for
|
|
569
|
+
* Bind this quill's schema to `doc` for schema-bound reads: the read twin of
|
|
677
570
|
* {@link Quill.writer}, mirroring core's `quill.reader(&doc)`. Each field is
|
|
678
|
-
* read
|
|
679
|
-
*
|
|
680
|
-
* throws rather than reading back `undefined
|
|
681
|
-
*
|
|
682
|
-
*
|
|
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.
|
|
683
577
|
*/
|
|
684
578
|
reader(doc: Document): DocumentReader;
|
|
685
579
|
}
|
|
@@ -824,6 +718,10 @@ export declare class DocumentReader {
|
|
|
824
718
|
* schema's `items` / `properties` / `variants`, so the element's storage
|
|
825
719
|
* form is not the caller's business. The empty path is {@link getContent}.
|
|
826
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
|
+
*
|
|
827
725
|
* `undefined` for an absent field and for a path that names nothing in the
|
|
828
726
|
* stored value: a repeater's row index goes stale between derive and read,
|
|
829
727
|
* so absence there is a read, not a fault. Throws `UnknownField` for an
|
|
@@ -834,6 +732,14 @@ export declare class DocumentReader {
|
|
|
834
732
|
getContentAt(addr: Addr | string, path: PathStep[]): Content | undefined;
|
|
835
733
|
/** The main body's markdown: the quill-free body read. Equals `get({})`. */
|
|
836
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;
|
|
837
743
|
/**
|
|
838
744
|
* A {@link CardReader} for the composable card at `index`. Index validity is
|
|
839
745
|
* checked lazily at read time, so an out-of-range index does not throw here.
|