@quillmark/wasm 0.114.0 → 0.116.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 +377 -0
- package/README.md +50 -49
- package/core/wasm.d.ts +93 -118
- package/core/wasm.js +114 -102
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +5 -5
- package/package.json +1 -1
- package/render/wasm.d.ts +119 -185
- package/render/wasm.js +138 -144
- package/render/wasm_bg.wasm +0 -0
- package/render/wasm_bg.wasm.d.ts +7 -7
- package/runtime/runtime.d.ts +52 -66
- package/runtime/runtime.js +25 -13
package/render/wasm.d.ts
CHANGED
|
@@ -13,13 +13,6 @@ export type PayloadItem =
|
|
|
13
13
|
type: "field";
|
|
14
14
|
key: string;
|
|
15
15
|
value: unknown;
|
|
16
|
-
fill?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Paths to `!must_fill` markers nested *inside* `value` (the `value`
|
|
19
|
-
* projection itself is fill-free). Absent when the field has no nested
|
|
20
|
-
* placeholders. Preserved across `insertCard`.
|
|
21
|
-
*/
|
|
22
|
-
nestedFills?: PathStep[][];
|
|
23
16
|
}
|
|
24
17
|
| { type: "comment"; text: string; inline?: boolean };
|
|
25
18
|
|
|
@@ -27,9 +20,9 @@ export type PayloadItem =
|
|
|
27
20
|
* A single card block, as read back from a document. Every `Card` is a valid
|
|
28
21
|
* `CardInput`, so a card read from one document pushes straight into another.
|
|
29
22
|
*
|
|
30
|
-
* `$` system entries are hoisted to named fields: `kind` (the `$kind
|
|
31
|
-
*
|
|
32
|
-
*
|
|
23
|
+
* `$` system entries are hoisted to named fields: `kind` (the `$kind`),
|
|
24
|
+
* `quill` (`$quill` `name@version`, main card only), `ext` (`$ext`), and
|
|
25
|
+
* `seed` (the `$seed` per-kind overlay map, main card only).
|
|
33
26
|
* `payloadItems` carries user fields and comments in order.
|
|
34
27
|
*/
|
|
35
28
|
export interface Card {
|
|
@@ -73,9 +66,9 @@ export interface Content {
|
|
|
73
66
|
}
|
|
74
67
|
|
|
75
68
|
/** One `\n`-separated segment of `Content.text`, in order. `kind` is a closed
|
|
76
|
-
* set:
|
|
77
|
-
* spells its payload in `attrs`, so
|
|
78
|
-
* `{ level: number }` with no guard. */
|
|
69
|
+
* set: `island` reads as `para`, and any other role outside it is refused
|
|
70
|
+
* wherever content is decoded. Every role spells its payload in `attrs`, so
|
|
71
|
+
* `kind === "heading"` narrows `attrs` to `{ level: number }` with no guard. */
|
|
79
72
|
export type ContentLine = {
|
|
80
73
|
containers: ContentContainer[];
|
|
81
74
|
/** A within-block hard line break rather than a new block. Omitted (false) in the common case. */
|
|
@@ -87,7 +80,6 @@ export type ContentLineKind =
|
|
|
87
80
|
| { kind: "para" }
|
|
88
81
|
| { kind: "heading"; attrs: { level: number } }
|
|
89
82
|
| { kind: "code"; attrs?: { lang?: string } }
|
|
90
|
-
| { kind: "island" }
|
|
91
83
|
| { kind: "rule" };
|
|
92
84
|
|
|
93
85
|
/** An ancestor block a line nests inside, outermost first. Closed like
|
|
@@ -158,14 +150,10 @@ export interface ImageProps {
|
|
|
158
150
|
alt: string;
|
|
159
151
|
}
|
|
160
152
|
|
|
161
|
-
/** How faithfully the markdown projection can carry an island. */
|
|
162
|
-
export type ContentLossClass = "lossless" | "degraded" | "unrepresentable";
|
|
163
|
-
|
|
164
153
|
/** A structured object occupying one island slot in `Content.text`. `type` is a
|
|
165
154
|
* closed set, so `type === "table"` narrows `props` to `TableProps`. */
|
|
166
155
|
export type ContentIsland = {
|
|
167
156
|
id: string;
|
|
168
|
-
loss: ContentLossClass;
|
|
169
157
|
} & (
|
|
170
158
|
| { type: "table"; props: TableProps }
|
|
171
159
|
| { type: "image"; props: ImageProps }
|
|
@@ -237,10 +225,12 @@ export type MarkOp =
|
|
|
237
225
|
* metadata. `setContinues` sets or clears a line's within-block hard-break flag
|
|
238
226
|
* (`ContentLine.continues`); `continues: true` lands as `false` on line 0, which
|
|
239
227
|
* nothing precedes, on a line whose containers differ from the line above, and
|
|
240
|
-
* on one following a heading,
|
|
241
|
-
* `setKind` lands a kind the line's text contradicts — `
|
|
228
|
+
* on one following a heading, a rule or a block island's line, each a block of
|
|
229
|
+
* one line. `setKind` lands a kind the line's text contradicts — `rule` over
|
|
242
230
|
* prose, `code` over a slot — as `para`, which is what re-importing the line's
|
|
243
|
-
* own markdown yields
|
|
231
|
+
* own markdown yields, and reads an `island` the union does not offer as the
|
|
232
|
+
* `para` that spelling projects. Read the content back to see where an op
|
|
233
|
+
* settled.
|
|
244
234
|
*/
|
|
245
235
|
export type LineOp =
|
|
246
236
|
| { op: "split"; at: number }
|
|
@@ -264,22 +254,16 @@ export type LineOp =
|
|
|
264
254
|
* one `insert` per slot.
|
|
265
255
|
*
|
|
266
256
|
* Deleting an island needs no op: a `delta` that removes its slot drops the
|
|
267
|
-
* island whole
|
|
268
|
-
*
|
|
269
|
-
* island mints a fresh one.
|
|
270
|
-
*
|
|
271
|
-
* A `set` stores the `loss` it is given; nothing re-derives the class from the
|
|
272
|
-
* new `props`.
|
|
257
|
+
* island whole. Re-landing it is an `insert` of the full island under its
|
|
258
|
+
* original id; a pasted copy of a live island mints a fresh one.
|
|
273
259
|
*
|
|
274
260
|
* An island is *inline* (a slot inside a paragraph) or a **block** (that slot
|
|
275
|
-
* alone on
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
* `{ op: "setKind", kind: "island" }`. `{ op: "split" }` cannot open that line,
|
|
282
|
-
* since line ops run after island ops.
|
|
261
|
+
* alone on its own line), and the type settles which: markdown writes a `table`
|
|
262
|
+
* as a block and an image inline. Both lines read `kind: "para"` — the block is
|
|
263
|
+
* the slot's markup, not a role the line carries — so landing a block island is
|
|
264
|
+
* two channels: `delta` inserts the `\n` that opens the line, `islandOps`
|
|
265
|
+
* inserts the slot. `{ op: "split" }` cannot open that line, since line ops run
|
|
266
|
+
* after island ops.
|
|
283
267
|
*
|
|
284
268
|
* A `table` has no inline placement: markdown writes it as a block, so an
|
|
285
269
|
* `insert` whose `at` is not an empty line throws, as does a `set` retyping an
|
|
@@ -335,58 +319,14 @@ export type DocPathSeg =
|
|
|
335
319
|
|
|
336
320
|
|
|
337
321
|
/**
|
|
338
|
-
* Page dimensions in points (1 pt = 1/72 inch).
|
|
339
|
-
*
|
|
340
|
-
* page geometry up-front, e.g. to lay out a scrollable list of canvases.
|
|
322
|
+
* Page dimensions in points (1 pt = 1/72 inch). `pageSize` is for callers that
|
|
323
|
+
* need page geometry up-front, e.g. to lay out a scrollable list of canvases.
|
|
341
324
|
*/
|
|
342
325
|
export interface PageSize {
|
|
343
326
|
widthPt: number;
|
|
344
327
|
heightPt: number;
|
|
345
328
|
}
|
|
346
329
|
|
|
347
|
-
/**
|
|
348
|
-
* Inputs to `LiveSession.paint`. Both default to `1`, must be finite and `> 0`,
|
|
349
|
-
* and multiply to the effective rasterization scale.
|
|
350
|
-
*
|
|
351
|
-
* - `layoutScale`: layout-space pixels per point — CSS pixels per pt for an
|
|
352
|
-
* on-screen canvas — surfaced back as `layoutWidth` / `layoutHeight`.
|
|
353
|
-
* - `densityScale`: backing-store density. Fold `window.devicePixelRatio`,
|
|
354
|
-
* in-app zoom, and `visualViewport.scale` into this one value; the default
|
|
355
|
-
* `1` produces a non-retina backing store.
|
|
356
|
-
*/
|
|
357
|
-
export interface PaintOptions {
|
|
358
|
-
layoutScale?: number;
|
|
359
|
-
densityScale?: number;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Returned by `LiveSession.paint`.
|
|
364
|
-
*
|
|
365
|
-
* - `layoutWidth` / `layoutHeight`: the display box, in CSS pixels for an
|
|
366
|
-
* on-screen canvas, to drive `canvas.style.*`. Independent of `densityScale`.
|
|
367
|
-
* - `pixelWidth` / `pixelHeight`: the backing store the painter wrote to
|
|
368
|
-
* `canvas.width` / `canvas.height`, `round(layout * densityScale)` unless the
|
|
369
|
-
* request exceeded 16384 px per side and `densityScale` was clamped to fit.
|
|
370
|
-
* - `clamped`: `true` when that clamp fired, so the page renders soft at the
|
|
371
|
-
* same `canvas.style` size.
|
|
372
|
-
* - `effectiveDensityScale`: the `densityScale` actually applied.
|
|
373
|
-
*
|
|
374
|
-
* The painter owns `canvas.width` / `canvas.height` and never touches
|
|
375
|
-
* `canvas.style.*`. The write is a whole-backing-store `putImageData`, which
|
|
376
|
-
* bypasses the 2D context transform, `globalAlpha`, and clip: give each visible
|
|
377
|
-
* page its own `<canvas>`, since no compositing, sub-rect, or transform reaches
|
|
378
|
-
* through `paint`. Under `OffscreenCanvasRenderingContext2D` the layout
|
|
379
|
-
* dimensions are informational — there is no CSS box to apply them to.
|
|
380
|
-
*/
|
|
381
|
-
export interface PaintResult {
|
|
382
|
-
layoutWidth: number;
|
|
383
|
-
layoutHeight: number;
|
|
384
|
-
pixelWidth: number;
|
|
385
|
-
pixelHeight: number;
|
|
386
|
-
clamped: boolean;
|
|
387
|
-
effectiveDensityScale: number;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
330
|
|
|
391
331
|
|
|
392
332
|
/**
|
|
@@ -421,11 +361,11 @@ export interface ResolvedMain {
|
|
|
421
361
|
|
|
422
362
|
/**
|
|
423
363
|
* One composable card's resolved rows in declaration order, with its authored
|
|
424
|
-
* `kind` (
|
|
364
|
+
* `kind` (an undeclared one included), its document-array `index`, and its
|
|
425
365
|
* body row: `null` when the kind enables no body.
|
|
426
366
|
*/
|
|
427
367
|
export interface ResolvedCard {
|
|
428
|
-
kind: string
|
|
368
|
+
kind: string;
|
|
429
369
|
index: number;
|
|
430
370
|
fields: ResolvedField[];
|
|
431
371
|
body: ResolvedField | null;
|
|
@@ -433,7 +373,7 @@ export interface ResolvedCard {
|
|
|
433
373
|
|
|
434
374
|
/**
|
|
435
375
|
* The resolved-value view (`Quill.resolve`): the main card and every composable
|
|
436
|
-
* card. Value and provenance only;
|
|
376
|
+
* card. Value and provenance only; diagnostics stay `Quill.validate`'s.
|
|
437
377
|
*/
|
|
438
378
|
export interface Resolved {
|
|
439
379
|
main: ResolvedMain;
|
|
@@ -445,7 +385,6 @@ export interface Resolved {
|
|
|
445
385
|
/** UI layout hints for a single field. Display order is not a hint: key order
|
|
446
386
|
* in the schema's `fields`/`properties` objects is the ordering contract. */
|
|
447
387
|
export interface QuillFieldUi {
|
|
448
|
-
title?: string;
|
|
449
388
|
group?: string;
|
|
450
389
|
compact?: boolean;
|
|
451
390
|
multiline?: boolean;
|
|
@@ -453,9 +392,10 @@ export interface QuillFieldUi {
|
|
|
453
392
|
* conventional label of its own. */
|
|
454
393
|
blank_title?: string;
|
|
455
394
|
/** The control the field asks for, where the shape admits more than one.
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
395
|
+
* `"table"` is valid only on an `array` whose `items` is an `object`.
|
|
396
|
+
* Every column is a leaf, a contract refused at load as
|
|
397
|
+
* `quill::table_column_not_flat`. Drawing the grid is a request: a
|
|
398
|
+
* consumer that cannot falls back to its own choice for the type. */
|
|
459
399
|
layout?: "table";
|
|
460
400
|
}
|
|
461
401
|
|
|
@@ -468,63 +408,52 @@ export interface QuillGroupUi {
|
|
|
468
408
|
|
|
469
409
|
/** UI layout hints for a card (main or named card kind). */
|
|
470
410
|
export interface QuillCardUi {
|
|
471
|
-
title?: string;
|
|
472
411
|
/** The groups a field's `ui.group` may reference, keyed by group id. Key
|
|
473
412
|
* order is the display-order contract, as with `fields`. Absent when the
|
|
474
413
|
* card declares no groups. */
|
|
475
414
|
groups?: Record<string, QuillGroupUi>;
|
|
476
415
|
}
|
|
477
416
|
|
|
478
|
-
/** A block construct a body can hold. `paragraph` is the floor and cannot be
|
|
479
|
-
* declined, so it is absent. */
|
|
480
|
-
export type QuillBlockConstruct =
|
|
481
|
-
| "heading"
|
|
482
|
-
| "rule"
|
|
483
|
-
| "code"
|
|
484
|
-
| "list"
|
|
485
|
-
| "quote"
|
|
486
|
-
| "table"
|
|
487
|
-
| "image";
|
|
488
|
-
|
|
489
417
|
/** Body namespace for a card (main or named card kind). */
|
|
490
418
|
export interface QuillCardBody {
|
|
491
419
|
/** When false, consumers must not accept or store body content for this card kind. Defaults to true. */
|
|
492
420
|
enabled?: boolean;
|
|
493
|
-
/** Example body content
|
|
421
|
+
/** Example body content, shown on the blueprint's `# body e.g.` line above the body. */
|
|
494
422
|
example?: string;
|
|
495
|
-
/** Block constructs this quill's plate does not typeset in this body;
|
|
496
|
-
* absent or empty declines nothing. A body that holds one anyway draws a
|
|
497
|
-
* non-fatal `plate::unsupported_construct` warning. Nothing verifies the
|
|
498
|
-
* claim: absence from this list is not a promise the plate typesets it. */
|
|
499
|
-
unsupported?: QuillBlockConstruct[];
|
|
500
423
|
}
|
|
501
424
|
|
|
425
|
+
export type QuillFieldType = "string" | "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "richtext" | "plaintext" | "enum" | "matrix";
|
|
426
|
+
|
|
502
427
|
/** Schema entry for a single field declared in a quill's `Quill.yaml`.
|
|
503
428
|
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
* declared a value for carries a `!must_fill` marker in the blueprint and warns
|
|
507
|
-
* `validation::must_fill` while the document leaves it unauthored. Neither
|
|
508
|
-
* gates render: an absent field blank-fills.
|
|
429
|
+
* `default` is the value an unanswered cell renders; `example` documents shape
|
|
430
|
+
* and never renders. An absent field without a `default` blank-fills.
|
|
509
431
|
*/
|
|
510
432
|
export interface QuillFieldSchema {
|
|
511
|
-
|
|
433
|
+
/** A trailing `?` marks the cell optional: unanswered, it renders `none`
|
|
434
|
+
* rather than its type's blank, and it never carries a `default`. A
|
|
435
|
+
* consumer offers a way back to unanswered (`removeField`) on such a cell. */
|
|
436
|
+
type: QuillFieldType | `${Exclude<QuillFieldType, "object" | "matrix">}?`;
|
|
437
|
+
/** The field's label, a literal. Absent, the consumer humanizes the key
|
|
438
|
+
* (`memo_for` → "Memo For"). Never present on an array's `items`. */
|
|
439
|
+
title?: string;
|
|
512
440
|
description?: string;
|
|
513
441
|
default?: unknown;
|
|
514
442
|
example?: unknown;
|
|
515
443
|
/** The closed set of allowed values. Required on `type: "enum"`, and valid
|
|
516
444
|
* nowhere else. */
|
|
517
445
|
values?: string[];
|
|
518
|
-
/** Per-member field sets on a
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* `{value: <member>, …that member's
|
|
446
|
+
/** Per-member field sets on a `type: "enum"` field that is a card's own
|
|
447
|
+
* field or a typed dictionary's property, keyed by member: the fields that
|
|
448
|
+
* exist only where the discriminant holds that member. Declaring it makes
|
|
449
|
+
* the field rest as a container, `{value: <member>, …that member's
|
|
450
|
+
* fields}`, rather than a bare string. */
|
|
522
451
|
variants?: Record<string, Record<string, QuillFieldSchema>>;
|
|
523
452
|
/** The roster of a `type: "matrix"` field, required there and valid
|
|
524
|
-
* nowhere else:
|
|
453
|
+
* nowhere else: member id to display title, key order the display order.
|
|
525
454
|
* Each member is an object of `held` plus the field's `properties`
|
|
526
455
|
* (the columns), addressed as `<field>.<member id>.held`. */
|
|
527
|
-
members?:
|
|
456
|
+
members?: Record<string, string>;
|
|
528
457
|
ui?: QuillFieldUi;
|
|
529
458
|
properties?: Record<string, QuillFieldSchema>;
|
|
530
459
|
items?: QuillFieldSchema;
|
|
@@ -537,15 +466,11 @@ export interface QuillFieldSchema {
|
|
|
537
466
|
inline?: boolean;
|
|
538
467
|
}
|
|
539
468
|
|
|
540
|
-
/** One block of a `type: "matrix"` roster: an optional display heading and the
|
|
541
|
-
* members under it, member id to display title. Key order is display order. */
|
|
542
|
-
export interface QuillMatrixGroup {
|
|
543
|
-
group?: string;
|
|
544
|
-
values: Record<string, string>;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
469
|
/** Schema entry for the main card or a named card kind. */
|
|
548
470
|
export interface QuillCardSchema {
|
|
471
|
+
/** The kind's label, a literal. Absent, the consumer humanizes the kind
|
|
472
|
+
* name. An instance takes its label from its own values. */
|
|
473
|
+
title?: string;
|
|
549
474
|
description?: string;
|
|
550
475
|
fields: Record<string, QuillFieldSchema>;
|
|
551
476
|
ui?: QuillCardUi;
|
|
@@ -736,11 +661,6 @@ export class Document {
|
|
|
736
661
|
* building `markOps` need not predict it.
|
|
737
662
|
*/
|
|
738
663
|
applyChange(addr: Addr | string, bundle: ChangeBundle): void;
|
|
739
|
-
/**
|
|
740
|
-
* A blueprint's fill obligation for the given `quillName`, re-exposed from
|
|
741
|
-
* core. Carries no tool name: pair it with your own next-step directive.
|
|
742
|
-
*/
|
|
743
|
-
static blueprintInstruction(quill_name: string): string;
|
|
744
664
|
/**
|
|
745
665
|
* The **body** markdown projection: an on-demand, lossy export (content-only
|
|
746
666
|
* marks do not survive markdown). A body's type is a format fact, not a
|
|
@@ -774,11 +694,6 @@ export class Document {
|
|
|
774
694
|
* Structural equality, excluding parse-time `warnings`.
|
|
775
695
|
*/
|
|
776
696
|
equals(other: Document): boolean;
|
|
777
|
-
/**
|
|
778
|
-
* Authoring-format rules for the card-yaml markdown surface, re-exposed from
|
|
779
|
-
* core. Constant across calls; read once and cache.
|
|
780
|
-
*/
|
|
781
|
-
static formatRules(): string;
|
|
782
697
|
/**
|
|
783
698
|
* Parse markdown into a typed Document. Throws on parse errors.
|
|
784
699
|
*/
|
|
@@ -824,12 +739,6 @@ export class Document {
|
|
|
824
739
|
* `at` is out of range.
|
|
825
740
|
*/
|
|
826
741
|
insertCard(card: CardInput, at?: number): void;
|
|
827
|
-
/**
|
|
828
|
-
* Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
|
|
829
|
-
* shorthand for `{ field }`. `false` for an absent field and for a body
|
|
830
|
-
* address; only an out-of-range `addr.card` throws.
|
|
831
|
-
*/
|
|
832
|
-
isFill(addr: Addr | string): boolean;
|
|
833
742
|
/**
|
|
834
743
|
* Replace this document's contents **in place** from a versioned storage DTO
|
|
835
744
|
* string: the mutating twin of [`fromStored`](Document::from_stored).
|
|
@@ -838,6 +747,11 @@ export class Document {
|
|
|
838
747
|
* variable.
|
|
839
748
|
*/
|
|
840
749
|
loadStored(json: string): void;
|
|
750
|
+
/**
|
|
751
|
+
* The Quillmark Markdown rules, re-exposed from core. Constant across
|
|
752
|
+
* calls; read once and cache.
|
|
753
|
+
*/
|
|
754
|
+
static markdownRules(): string;
|
|
841
755
|
/**
|
|
842
756
|
* Move the card at `from` to position `to`. `from == to` is a no-op.
|
|
843
757
|
*/
|
|
@@ -846,8 +760,8 @@ export class Document {
|
|
|
846
760
|
* A blank document: a main card carrying only `$quill`, an empty body, and
|
|
847
761
|
* no composable cards. Absent fields resolve at render time (`default`, else
|
|
848
762
|
* the field's blank), so nothing the caller did not set reaches the output.
|
|
849
|
-
* For
|
|
850
|
-
* invalid quill reference.
|
|
763
|
+
* For one instance of every card kind use `Quill.seedDocument()`. Throws on
|
|
764
|
+
* an invalid quill reference.
|
|
851
765
|
*/
|
|
852
766
|
constructor(quill_ref: string);
|
|
853
767
|
/**
|
|
@@ -944,7 +858,7 @@ export class Document {
|
|
|
944
858
|
* Store a field verbatim at `addr`, deferring coercion to render; the typed
|
|
945
859
|
* write is [`commitField`](Document::commit_field). A bare string is `Addr`
|
|
946
860
|
* shorthand for `{ field }`; `{ card: 2, field: "qty" }` targets a
|
|
947
|
-
* composable card.
|
|
861
|
+
* composable card. A body address throws:
|
|
948
862
|
* write a body with `revise` / `overwrite`. Throws on an out-of-range card
|
|
949
863
|
* or a malformed name.
|
|
950
864
|
*/
|
|
@@ -957,11 +871,6 @@ export class Document {
|
|
|
957
871
|
* one entry per offending field. Throws on an out-of-range card.
|
|
958
872
|
*/
|
|
959
873
|
storeFields(addr: CardAddr, fields: Record<string, unknown>): void;
|
|
960
|
-
/**
|
|
961
|
-
* Store a field verbatim at `addr` and mark it `!must_fill`. A body address
|
|
962
|
-
* throws; same validation as [`storeField`](Document::store_field).
|
|
963
|
-
*/
|
|
964
|
-
storeFill(addr: Addr | string, value: any): void;
|
|
965
874
|
/**
|
|
966
875
|
* Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
|
|
967
876
|
* under `cardKind`, preserving sibling kinds; `$seed` is main-only, so this
|
|
@@ -1018,15 +927,17 @@ export class LiveSession {
|
|
|
1018
927
|
* The schema field whose content is under a point on `page`: the `DocPath`
|
|
1019
928
|
* address to focus in the editor, or `undefined` off any field's ink.
|
|
1020
929
|
* `x`/`y` are PDF points with a **bottom-left** origin, the same space as
|
|
1021
|
-
* `FieldRegion.rect
|
|
1022
|
-
*
|
|
930
|
+
* `FieldRegion.rect`. A pointer event reports CSS pixels, so divide by the
|
|
931
|
+
* CSS px per point the page is shown at, `k = canvas.clientWidth /
|
|
932
|
+
* pageWidthPt`, not by `paint`'s `scale`, which carries `devicePixelRatio`:
|
|
933
|
+
* `x = e.offsetX / k`, `y = pageHeightPt - e.offsetY / k`.
|
|
1023
934
|
* Unlike `regions()`, *every* placement answers, not just the first.
|
|
1024
935
|
*
|
|
1025
936
|
* `tolPt` is how far off the ink a click still counts, in the same points,
|
|
1026
937
|
* and defaults to `0` — exact. Convert the pointer slack a surface wants
|
|
1027
|
-
* from CSS pixels
|
|
1028
|
-
*
|
|
1029
|
-
*
|
|
938
|
+
* from CSS pixels by the same `k` (`slackPx / k`), so it stays the same
|
|
939
|
+
* size under the cursor as the page zooms. The nearest placement answers,
|
|
940
|
+
* so raising it only fills a miss.
|
|
1030
941
|
*/
|
|
1031
942
|
fieldAt(page: number, x: number, y: number, tol_pt?: number | null): string | undefined;
|
|
1032
943
|
/**
|
|
@@ -1051,21 +962,20 @@ export class LiveSession {
|
|
|
1051
962
|
pageSize(page: number): PageSize;
|
|
1052
963
|
/**
|
|
1053
964
|
* Paint `page` into a `CanvasRenderingContext2D` or
|
|
1054
|
-
* `OffscreenCanvasRenderingContext2D
|
|
1055
|
-
*
|
|
1056
|
-
* `
|
|
1057
|
-
*
|
|
965
|
+
* `OffscreenCanvasRenderingContext2D` at `scale` backing-store pixels per
|
|
966
|
+
* point, reduced where it must be to keep both sides within
|
|
967
|
+
* `MAX_RASTER_SIDE` (16384 px). The painter owns `canvas.width`/`height`;
|
|
968
|
+
* consumers own `canvas.style.*`.
|
|
1058
969
|
*
|
|
1059
970
|
* `put_image_data` writes the whole backing store, bypassing the 2D
|
|
1060
971
|
* context's transform, `globalAlpha`, and clip, so each visible page needs
|
|
1061
972
|
* its own `<canvas>`: no compositing, sub-rect, or transform reaches through
|
|
1062
973
|
* this call.
|
|
1063
974
|
*
|
|
1064
|
-
* Throws if `page` is out of range, `ctx` is the wrong type,
|
|
1065
|
-
*
|
|
1066
|
-
* scale (`backend::invalid_raster_scale`).
|
|
975
|
+
* Throws if `page` is out of range, `ctx` is the wrong type, or `scale` is
|
|
976
|
+
* not finite and positive (`backend::invalid_raster_scale`).
|
|
1067
977
|
*/
|
|
1068
|
-
paint(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, page: number,
|
|
978
|
+
paint(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, page: number, scale: number): void;
|
|
1069
979
|
/**
|
|
1070
980
|
* A point → **content position**: the field *and* a USV offset into its
|
|
1071
981
|
* `Content`, for placing a caret or mapping a selection into the content
|
|
@@ -1123,12 +1033,19 @@ export class Quill {
|
|
|
1123
1033
|
* transport door (`fromMarkdown`, `fromStored`, a stored row).
|
|
1124
1034
|
*
|
|
1125
1035
|
* Idempotent: an equal value is not rewritten, so YAML comments and stored
|
|
1126
|
-
* bytes survive. A
|
|
1127
|
-
* that field, and a value the strict write refuses stays as authored with a
|
|
1036
|
+
* bytes survive. A value the strict write refuses stays as authored with a
|
|
1128
1037
|
* diagnostic. Throws when `doc` declares a different `$quill`, before any
|
|
1129
1038
|
* mutation.
|
|
1130
1039
|
*/
|
|
1131
1040
|
conform(doc: Document): Diagnostic[];
|
|
1041
|
+
/**
|
|
1042
|
+
* The empty document: a main card carrying this quill's `$quill` and
|
|
1043
|
+
* `$kind: main`, no field committed, no composable card, no body. The
|
|
1044
|
+
* type-minimal valid input, and the document a plate is bound to render
|
|
1045
|
+
* (the quill authoring contract). `new Document(ref)` is the same document
|
|
1046
|
+
* reached by spelling the reference.
|
|
1047
|
+
*/
|
|
1048
|
+
emptyDocument(): Document;
|
|
1132
1049
|
/**
|
|
1133
1050
|
* Build a quill from a file tree. Pure: the declared backend is resolved
|
|
1134
1051
|
* later, at render time. Accepts a `Map<string, Uint8Array>` or a plain
|
|
@@ -1150,9 +1067,9 @@ export class Quill {
|
|
|
1150
1067
|
parse(markdown: string): Document;
|
|
1151
1068
|
/**
|
|
1152
1069
|
* Seed a starter composable `Card` of the given kind (carries `$kind`),
|
|
1153
|
-
*
|
|
1154
|
-
* (`overlay ›
|
|
1155
|
-
* declared in this quill's schema.
|
|
1070
|
+
* committing an optional per-kind seed `overlay`'s fields and `$body`
|
|
1071
|
+
* (`overlay › absent`, body `overlay › empty`). `undefined` when
|
|
1072
|
+
* `cardKind` is not declared in this quill's schema.
|
|
1156
1073
|
*
|
|
1157
1074
|
* Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
|
|
1158
1075
|
* template-derived document inherits its curated starting values; omit it
|
|
@@ -1161,9 +1078,9 @@ export class Quill {
|
|
|
1161
1078
|
seedCard(card_kind: string, overlay: Record<string, unknown> | undefined): Card | undefined;
|
|
1162
1079
|
/**
|
|
1163
1080
|
* Seed a starter `Document` from the schema: the main card plus one instance
|
|
1164
|
-
* of each composable card kind, each
|
|
1165
|
-
*
|
|
1166
|
-
* `
|
|
1081
|
+
* of each composable card kind, each body empty and every field absent
|
|
1082
|
+
* (interpolated at render as `default:`, else the field's blank). No
|
|
1083
|
+
* `example:` is committed (a field's or `body.example`).
|
|
1167
1084
|
*/
|
|
1168
1085
|
seedDocument(): Document;
|
|
1169
1086
|
/**
|
|
@@ -1184,8 +1101,7 @@ export class Quill {
|
|
|
1184
1101
|
/**
|
|
1185
1102
|
* Validate `doc` against this quill's schema, returning every diagnostic
|
|
1186
1103
|
* (empty when the document is valid). Forwards the canonical
|
|
1187
|
-
* `validation::*` diagnostics the engine emits
|
|
1188
|
-
* `validation::must_fill` warning per `!must_fill` marker left behind.
|
|
1104
|
+
* `validation::*` diagnostics the engine emits.
|
|
1189
1105
|
*/
|
|
1190
1106
|
validate(doc: Document): Diagnostic[];
|
|
1191
1107
|
/**
|
|
@@ -1223,15 +1139,17 @@ export class Quillmark {
|
|
|
1223
1139
|
[Symbol.dispose](): void;
|
|
1224
1140
|
constructor();
|
|
1225
1141
|
/**
|
|
1226
|
-
* Open a live render session for `doc` against `quill`'s backend
|
|
1142
|
+
* Open a live render session for `doc` against `quill`'s backend, on the
|
|
1143
|
+
* render date `today` (`YYYY-MM-DD`, default the local date).
|
|
1227
1144
|
*/
|
|
1228
|
-
open(quill: Quill, doc: Document): LiveSession;
|
|
1145
|
+
open(quill: Quill, doc: Document, today?: string | null): LiveSession;
|
|
1229
1146
|
/**
|
|
1230
|
-
* Render `doc` against `quill` in one shot
|
|
1231
|
-
* `
|
|
1232
|
-
*
|
|
1147
|
+
* Render `doc` against `quill` in one shot: `open` + `LiveSession.render`,
|
|
1148
|
+
* with `doc.warnings`, then every `quill.validate` warning, ahead of the
|
|
1149
|
+
* compile's in `warnings`. An unset `output_format` falls back to the
|
|
1150
|
+
* backend's first supported format. `today` reads as on `open`.
|
|
1233
1151
|
*/
|
|
1234
|
-
render(quill: Quill, doc: Document, opts?: RenderOptions | null): RenderResult;
|
|
1152
|
+
render(quill: Quill, doc: Document, opts?: RenderOptions | null, today?: string | null): RenderResult;
|
|
1235
1153
|
/**
|
|
1236
1154
|
* The output formats `quill`'s backend can emit; resolves the backend but
|
|
1237
1155
|
* compiles nothing. Throws `engine::backend_not_found` when no registered
|
|
@@ -1273,6 +1191,22 @@ export function formatDocPath(segs: DocPathSeg[]): string;
|
|
|
1273
1191
|
*/
|
|
1274
1192
|
export function importMarkdown(markdown: string): Content;
|
|
1275
1193
|
|
|
1194
|
+
/**
|
|
1195
|
+
* Whether `content` satisfies the `inline` constraint of `richtext` and
|
|
1196
|
+
* `plaintext`: one `Para` line, in no container, with no islands. Judged on
|
|
1197
|
+
* the normalized content, which is what a write stores. Throws if `content` is
|
|
1198
|
+
* not canonical content.
|
|
1199
|
+
*/
|
|
1200
|
+
export function isInline(content: Content): boolean;
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Whether `content` satisfies the `plaintext` constraint: no marks, no
|
|
1204
|
+
* islands, every line a `Para` in no container. Judged on the normalized
|
|
1205
|
+
* content, which is what a write stores. Throws if `content` is not canonical
|
|
1206
|
+
* content.
|
|
1207
|
+
*/
|
|
1208
|
+
export function isPlain(content: Content): boolean;
|
|
1209
|
+
|
|
1276
1210
|
/**
|
|
1277
1211
|
* Where `bundle`'s text-moving channels (`delta`, then `islandOps`, then
|
|
1278
1212
|
* `lineOps`) leave `content`'s marks: the final-text coordinates the bundle's
|
|
@@ -1340,7 +1274,6 @@ export interface InitOutput {
|
|
|
1340
1274
|
readonly document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1341
1275
|
readonly document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1342
1276
|
readonly document_applyChange: (a: number, b: number, c: number, d: number) => void;
|
|
1343
|
-
readonly document_blueprintInstruction: (a: number, b: number, c: number) => void;
|
|
1344
1277
|
readonly document_bodyMarkdown: (a: number, b: number, c: number) => void;
|
|
1345
1278
|
readonly document_card: (a: number, b: number, c: number) => void;
|
|
1346
1279
|
readonly document_cardCount: (a: number) => number;
|
|
@@ -1349,15 +1282,14 @@ export interface InitOutput {
|
|
|
1349
1282
|
readonly document_clone: (a: number) => number;
|
|
1350
1283
|
readonly document_currentStorageVersion: (a: number) => void;
|
|
1351
1284
|
readonly document_equals: (a: number, b: number) => number;
|
|
1352
|
-
readonly document_formatRules: (a: number) => void;
|
|
1353
1285
|
readonly document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
1354
1286
|
readonly document_fromStored: (a: number, b: number, c: number) => void;
|
|
1355
1287
|
readonly document_getExt: (a: number, b: number, c: number) => void;
|
|
1356
1288
|
readonly document_getStored: (a: number, b: number, c: number) => void;
|
|
1357
1289
|
readonly document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
1358
|
-
readonly document_isFill: (a: number, b: number, c: number) => void;
|
|
1359
1290
|
readonly document_loadStored: (a: number, b: number, c: number, d: number) => void;
|
|
1360
1291
|
readonly document_main: (a: number, b: number) => void;
|
|
1292
|
+
readonly document_markdownRules: (a: number) => void;
|
|
1361
1293
|
readonly document_moveCard: (a: number, b: number, c: number, d: number) => void;
|
|
1362
1294
|
readonly document_new: (a: number, b: number, c: number) => void;
|
|
1363
1295
|
readonly document_overwrite: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1375,7 +1307,6 @@ export interface InitOutput {
|
|
|
1375
1307
|
readonly document_storeExt: (a: number, b: number, c: number, d: number) => void;
|
|
1376
1308
|
readonly document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
1377
1309
|
readonly document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
1378
|
-
readonly document_storeFill: (a: number, b: number, c: number, d: number) => void;
|
|
1379
1310
|
readonly document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1380
1311
|
readonly document_toMarkdown: (a: number, b: number) => void;
|
|
1381
1312
|
readonly document_toStored: (a: number, b: number) => void;
|
|
@@ -1384,6 +1315,8 @@ export interface InitOutput {
|
|
|
1384
1315
|
readonly formatDiagnostic: (a: number, b: number) => void;
|
|
1385
1316
|
readonly formatDocPath: (a: number, b: number) => void;
|
|
1386
1317
|
readonly importMarkdown: (a: number, b: number, c: number) => void;
|
|
1318
|
+
readonly isInline: (a: number, b: number) => void;
|
|
1319
|
+
readonly isPlain: (a: number, b: number) => void;
|
|
1387
1320
|
readonly livesession_backendId: (a: number, b: number) => void;
|
|
1388
1321
|
readonly livesession_fieldAt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1389
1322
|
readonly livesession_fieldBoxes: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1399,10 +1332,11 @@ export interface InitOutput {
|
|
|
1399
1332
|
readonly mapMarks: (a: number, b: number, c: number) => void;
|
|
1400
1333
|
readonly mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
1401
1334
|
readonly parseDocPath: (a: number, b: number, c: number) => void;
|
|
1402
|
-
readonly quill__resolve: (a: number, b: number, c: number) => void;
|
|
1335
|
+
readonly quill__resolve: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1403
1336
|
readonly quill_backendId: (a: number, b: number) => void;
|
|
1404
1337
|
readonly quill_blueprint: (a: number, b: number) => void;
|
|
1405
1338
|
readonly quill_conform: (a: number, b: number, c: number) => void;
|
|
1339
|
+
readonly quill_emptyDocument: (a: number) => number;
|
|
1406
1340
|
readonly quill_fromTree: (a: number, b: number) => void;
|
|
1407
1341
|
readonly quill_metadata: (a: number, b: number) => void;
|
|
1408
1342
|
readonly quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1414,8 +1348,8 @@ export interface InitOutput {
|
|
|
1414
1348
|
readonly quill_validate: (a: number, b: number, c: number) => void;
|
|
1415
1349
|
readonly quill_warnings: (a: number, b: number) => void;
|
|
1416
1350
|
readonly quillmark_new: () => number;
|
|
1417
|
-
readonly quillmark_open: (a: number, b: number, c: number, d: number) => void;
|
|
1418
|
-
readonly quillmark_render: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1351
|
+
readonly quillmark_open: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1352
|
+
readonly quillmark_render: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1419
1353
|
readonly quillmark_supportedFormats: (a: number, b: number, c: number) => void;
|
|
1420
1354
|
readonly rebase: (a: number, b: number, c: number, d: number) => void;
|
|
1421
1355
|
readonly start: () => void;
|