@quillmark/wasm 0.112.0 → 0.114.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 +1612 -0
- package/README.md +91 -66
- package/core/wasm.d.ts +153 -183
- package/core/wasm.js +283 -391
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +6 -11
- package/package.json +2 -2
- package/{backends/pdfform → render}/wasm.d.ts +204 -265
- package/{backends/pdfform → render}/wasm.js +364 -450
- package/{backends/typst → render}/wasm_bg.wasm +0 -0
- package/{backends/typst → render}/wasm_bg.wasm.d.ts +8 -15
- package/runtime/runtime.d.ts +88 -179
- package/runtime/runtime.js +144 -585
- 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
package/core/wasm.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type PayloadItem =
|
|
|
17
17
|
/**
|
|
18
18
|
* Paths to `!must_fill` markers nested *inside* `value` (the `value`
|
|
19
19
|
* projection itself is fill-free). Absent when the field has no nested
|
|
20
|
-
* placeholders. Preserved across `insertCard
|
|
20
|
+
* placeholders. Preserved across `insertCard`.
|
|
21
21
|
*/
|
|
22
22
|
nestedFills?: PathStep[][];
|
|
23
23
|
}
|
|
@@ -72,11 +72,10 @@ export interface Content {
|
|
|
72
72
|
islands: ContentIsland[];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
/** One `\n`-separated segment of `Content.text`, in order. `kind` is
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* `attrs.level`/`attrs.lang` behind a check of the arm you want. */
|
|
75
|
+
/** One `\n`-separated segment of `Content.text`, in order. `kind` is a closed
|
|
76
|
+
* set: a role outside it is refused wherever content is decoded. Every role
|
|
77
|
+
* spells its payload in `attrs`, so `kind === "heading"` narrows `attrs` to
|
|
78
|
+
* `{ level: number }` with no guard. */
|
|
80
79
|
export type ContentLine = {
|
|
81
80
|
containers: ContentContainer[];
|
|
82
81
|
/** A within-block hard line break rather than a new block. Omitted (false) in the common case. */
|
|
@@ -89,57 +88,50 @@ export type ContentLineKind =
|
|
|
89
88
|
| { kind: "heading"; attrs: { level: number } }
|
|
90
89
|
| { kind: "code"; attrs?: { lang?: string } }
|
|
91
90
|
| { kind: "island" }
|
|
92
|
-
| { kind: "rule" }
|
|
93
|
-
| { kind: string; attrs?: unknown };
|
|
91
|
+
| { kind: "rule" };
|
|
94
92
|
|
|
95
|
-
/** An ancestor block a line nests inside, outermost first.
|
|
96
|
-
* `ContentLine.kind
|
|
97
|
-
* and renders transparently (its lines sit at the enclosing level).
|
|
93
|
+
/** An ancestor block a line nests inside, outermost first. Closed like
|
|
94
|
+
* `ContentLine.kind`.
|
|
98
95
|
*
|
|
99
96
|
* Two adjacent lines sit in the same container iff their whole path matches, so
|
|
100
97
|
* `instance` is what tells one container from an adjacent sibling of identical
|
|
101
98
|
* shape — two consecutive quotes, two consecutive lists — which contiguity
|
|
102
99
|
* alone reads as one.
|
|
103
100
|
*
|
|
104
|
-
* **A writer owes a distinct value per adjacent sibling run
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* distinct pair works; a write is canonicalized to `0`/`1`.
|
|
101
|
+
* **A writer owes a distinct value per adjacent sibling run.** Runs of one shape
|
|
102
|
+
* sharing one arrive as one: a second list's items come back as continuation
|
|
103
|
+
* paragraphs of the first, markers gone. Nothing reports that — an omitted field
|
|
104
|
+
* and a `0` stamped on both are the same write — so a codec flattening a tree
|
|
105
|
+
* takes them from `assignInstances` in `@quillmark/wasm` rather than by hand.
|
|
106
|
+
* Any distinct pair works; a write is canonicalized to `0`/`1`.
|
|
111
107
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* first number.
|
|
118
|
-
*
|
|
119
|
-
* Content parsed from a stored document is the one shape that arrives without
|
|
120
|
-
* it — storage omits a zero — and needs a cast. */
|
|
108
|
+
* Absent is `0`, and a read omits it there, so a container with nothing adjacent
|
|
109
|
+
* to be told apart from carries no key. A read does spell one on pairs no writer
|
|
110
|
+
* had to: `1.` beside a list starting at `3` differs by `start`, so those runs
|
|
111
|
+
* arrive apart with nothing written, and the canonical form spends a
|
|
112
|
+
* discriminator anyway because Markdown reads only a list's first number. */
|
|
121
113
|
export type ContentContainer =
|
|
122
114
|
| {
|
|
123
115
|
container: "list_item";
|
|
124
116
|
attrs: { ordered: boolean; start: number; ordinal: number };
|
|
125
|
-
instance
|
|
117
|
+
instance?: number;
|
|
126
118
|
}
|
|
127
|
-
| { container: "quote"; instance
|
|
128
|
-
| { container: string; attrs?: unknown; instance: number };
|
|
119
|
+
| { container: "quote"; instance?: number };
|
|
129
120
|
|
|
130
|
-
/** A mark over char range `[start, end)` into `Content.text`.
|
|
131
|
-
*
|
|
132
|
-
* guard
|
|
133
|
-
* `@quillmark/wasm/runtime`. An `anchor`'s `id` is a caller-supplied opaque
|
|
121
|
+
/** A mark over char range `[start, end)` into `Content.text`. `type` is a
|
|
122
|
+
* closed set, so `type === "link"` narrows `attrs` to `{ url: string }` with no
|
|
123
|
+
* guard. An `anchor`'s `id` is a caller-supplied opaque
|
|
134
124
|
* handle, unique per `Content` and invariant while the mark lives (positions
|
|
135
125
|
* rebase, the id never does); it has no markdown projection and survives only
|
|
136
126
|
* through the edit lane. */
|
|
137
|
-
export type ContentMark = { start: number; end: number } &
|
|
127
|
+
export type ContentMark = { start: number; end: number } & ContentMarkKind;
|
|
128
|
+
|
|
129
|
+
/** A mark's type with its payload, shared by `ContentMark` and a `MarkOp`'s
|
|
130
|
+
* `add` / `remove`. */
|
|
131
|
+
export type ContentMarkKind =
|
|
138
132
|
| { type: "strong" | "emph" | "underline" | "strike" | "code" }
|
|
139
133
|
| { type: "link"; attrs: { url: string } }
|
|
140
|
-
| { type: "anchor"; attrs: { id: string } }
|
|
141
|
-
| { type: string; attrs?: unknown }
|
|
142
|
-
);
|
|
134
|
+
| { type: "anchor"; attrs: { id: string } };
|
|
143
135
|
|
|
144
136
|
/** A cell in a `TableProps`. `marks` rides the prose `ContentMark` shape, but
|
|
145
137
|
* each mark's `start`/`end` are USV offsets into this cell's `text`, not into
|
|
@@ -158,28 +150,25 @@ export interface TableProps {
|
|
|
158
150
|
aligns: ("none" | "left" | "center" | "right")[];
|
|
159
151
|
}
|
|
160
152
|
|
|
161
|
-
/** `props` of a `type: "image"` island.
|
|
153
|
+
/** `props` of a `type: "image"` island. Stores and round-trips; no backend
|
|
154
|
+
* typesets one, and a render that holds one warns `backend::declined_construct`,
|
|
155
|
+
* because what `url` names is undecided. */
|
|
162
156
|
export interface ImageProps {
|
|
163
157
|
url: string;
|
|
164
158
|
alt: string;
|
|
165
159
|
}
|
|
166
160
|
|
|
167
|
-
/** How faithfully the markdown projection can carry an island.
|
|
168
|
-
|
|
169
|
-
export type ContentLossClass = "lossless" | "degraded" | "unrepresentable" | (string & {});
|
|
161
|
+
/** How faithfully the markdown projection can carry an island. */
|
|
162
|
+
export type ContentLossClass = "lossless" | "degraded" | "unrepresentable";
|
|
170
163
|
|
|
171
|
-
/** A structured object occupying one island slot in `Content.text`. `type` is
|
|
172
|
-
*
|
|
173
|
-
* and any other type round-trips with opaque `props`. The open arm blocks
|
|
174
|
-
* narrowing, so read `props` behind the `isTableIsland` / `isImageIsland`
|
|
175
|
-
* guards (from `@quillmark/wasm/runtime`). */
|
|
164
|
+
/** A structured object occupying one island slot in `Content.text`. `type` is a
|
|
165
|
+
* closed set, so `type === "table"` narrows `props` to `TableProps`. */
|
|
176
166
|
export type ContentIsland = {
|
|
177
167
|
id: string;
|
|
178
168
|
loss: ContentLossClass;
|
|
179
169
|
} & (
|
|
180
170
|
| { type: "table"; props: TableProps }
|
|
181
171
|
| { type: "image"; props: ImageProps }
|
|
182
|
-
| { type: string; props: unknown }
|
|
183
172
|
);
|
|
184
173
|
|
|
185
174
|
/**
|
|
@@ -219,6 +208,10 @@ export interface CardAddr {
|
|
|
219
208
|
* A text-splice change set over the USV content (CodeMirror `ChangeSet`
|
|
220
209
|
* semantics), returned by `revise` and by the `rebase` codec. Map a stored
|
|
221
210
|
* position through it with `mapPos`.
|
|
211
|
+
*
|
|
212
|
+
* Applying one admits an `insert` string rather than storing it verbatim: `\r`
|
|
213
|
+
* and the Unicode bidi controls drop, and a line separator — VT, FF, NEL,
|
|
214
|
+
* U+2028, U+2029 — becomes a space. Nothing reports the substitution.
|
|
222
215
|
*/
|
|
223
216
|
export interface Delta {
|
|
224
217
|
ops: ({ retain: number } | { insert: string } | { delete: number })[];
|
|
@@ -229,24 +222,25 @@ export type Assoc = "before" | "after";
|
|
|
229
222
|
|
|
230
223
|
/**
|
|
231
224
|
* A mark edit in final-text coordinates (post-delta, post-line-op). `add` /
|
|
232
|
-
* `remove`
|
|
233
|
-
* anchor by id. An `add` of an `anchor`
|
|
234
|
-
* live in the field; a collision or the
|
|
225
|
+
* `remove` are a `ContentMark` under an op, so a held mark spreads in whole;
|
|
226
|
+
* `removeAnchor` drops one identity anchor by id. An `add` of an `anchor`
|
|
227
|
+
* requires a non-empty `id` not already live in the field; a collision or the
|
|
228
|
+
* empty id throws.
|
|
235
229
|
*/
|
|
236
230
|
export type MarkOp =
|
|
237
|
-
| ({ op: "add" | "remove"
|
|
238
|
-
| { type: "strong" | "emph" | "underline" | "strike" | "code" }
|
|
239
|
-
| { type: "link"; url: string }
|
|
240
|
-
| { type: "anchor"; id: string }
|
|
241
|
-
| { type: string; attrs: unknown }
|
|
242
|
-
))
|
|
231
|
+
| ({ op: "add" | "remove" } & ContentMark)
|
|
243
232
|
| { op: "removeAnchor"; id: string };
|
|
244
233
|
|
|
245
234
|
/**
|
|
246
235
|
* A line/block edit. `split`/`join` splice `\n` in post-`delta`,
|
|
247
236
|
* post-`islandOps` coordinates; `setKind`/`setContainers`/`setContinues` touch
|
|
248
237
|
* metadata. `setContinues` sets or clears a line's within-block hard-break flag
|
|
249
|
-
* (`ContentLine.continues`); `continues: true` on line 0
|
|
238
|
+
* (`ContentLine.continues`); `continues: true` lands as `false` on line 0, which
|
|
239
|
+
* nothing precedes, on a line whose containers differ from the line above, and
|
|
240
|
+
* on one following a heading, island or rule, each a block of one line.
|
|
241
|
+
* `setKind` lands a kind the line's text contradicts — `island` or `rule` over
|
|
242
|
+
* prose, `code` over a slot — as `para`, which is what re-importing the line's
|
|
243
|
+
* own markdown yields. Read the content back to see where an op settled.
|
|
250
244
|
*/
|
|
251
245
|
export type LineOp =
|
|
252
246
|
| { op: "split"; at: number }
|
|
@@ -277,11 +271,19 @@ export type LineOp =
|
|
|
277
271
|
* A `set` stores the `loss` it is given; nothing re-derives the class from the
|
|
278
272
|
* new `props`.
|
|
279
273
|
*
|
|
280
|
-
* An island is *inline* (a slot inside a paragraph)
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
274
|
+
* An island is *inline* (a slot inside a paragraph) or a **block** (that slot
|
|
275
|
+
* alone on a line under `kind: "island"`), and for a slot alone on a line the
|
|
276
|
+
* type settles which: markdown writes a `table` as a block and an image inline,
|
|
277
|
+
* so the line's `kind` is read off the type and a `setKind` spelling it
|
|
278
|
+
* otherwise does not survive. Landing a block island is one bundle of all three
|
|
279
|
+
* channels, in the order they apply: `delta` inserts the `\n` that opens the
|
|
280
|
+
* line, `islandOps` inserts the slot, `lineOps` tags the line
|
|
281
|
+
* `{ op: "setKind", kind: "island" }`. `{ op: "split" }` cannot open that line,
|
|
282
|
+
* since line ops run after island ops.
|
|
283
|
+
*
|
|
284
|
+
* A `table` has no inline placement: markdown writes it as a block, so an
|
|
285
|
+
* `insert` whose `at` is not an empty line throws, as does a `set` retyping an
|
|
286
|
+
* inline island into one.
|
|
285
287
|
*/
|
|
286
288
|
export type IslandOp =
|
|
287
289
|
| ({ op: "set" } & ContentIsland)
|
|
@@ -395,6 +397,11 @@ export interface QuillFieldUi {
|
|
|
395
397
|
/** Label for an `enum`'s blank option. Absent, the consumer supplies a
|
|
396
398
|
* conventional label of its own. */
|
|
397
399
|
blank_title?: string;
|
|
400
|
+
/** The control the field asks for, where the shape admits more than one.
|
|
401
|
+
* A request, not a contract: a consumer that cannot draw it falls back to
|
|
402
|
+
* its own choice for the type. `"table"` is valid only on an `array`
|
|
403
|
+
* whose `items` is an `object`. */
|
|
404
|
+
layout?: "table";
|
|
398
405
|
}
|
|
399
406
|
|
|
400
407
|
/** One entry in a card's `ui.groups` registry: a display-label override for the
|
|
@@ -446,7 +453,7 @@ export interface QuillCardBody {
|
|
|
446
453
|
* gates render: an absent field blank-fills.
|
|
447
454
|
*/
|
|
448
455
|
export interface QuillFieldSchema {
|
|
449
|
-
type: "string" | "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "richtext" | "plaintext" | "enum";
|
|
456
|
+
type: "string" | "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "richtext" | "plaintext" | "enum" | "matrix";
|
|
450
457
|
description?: string;
|
|
451
458
|
default?: unknown;
|
|
452
459
|
example?: unknown;
|
|
@@ -458,14 +465,30 @@ export interface QuillFieldSchema {
|
|
|
458
465
|
* member. Declaring it makes the field rest as a container,
|
|
459
466
|
* `{value: <member>, …that member's fields}`, rather than a bare string. */
|
|
460
467
|
variants?: Record<string, Record<string, QuillFieldSchema>>;
|
|
468
|
+
/** The roster of a `type: "matrix"` field, required there and valid
|
|
469
|
+
* nowhere else: the closed vocabulary a document ticks, in display order.
|
|
470
|
+
* Each member is an object of `held` plus the field's `properties`
|
|
471
|
+
* (the columns), addressed as `<field>.<member id>.held`. */
|
|
472
|
+
members?: QuillMatrixGroup[];
|
|
461
473
|
ui?: QuillFieldUi;
|
|
462
474
|
properties?: Record<string, QuillFieldSchema>;
|
|
463
475
|
items?: QuillFieldSchema;
|
|
476
|
+
/** The element count past which an `array` overflows the page it is laid
|
|
477
|
+
* out on. Valid only on an `array`. Never gates render: a document over
|
|
478
|
+
* the cap warns `validation::cardinality` and renders. */
|
|
479
|
+
max?: number;
|
|
464
480
|
/** `true` on a `richtext` or `plaintext` field declared `inline`: the
|
|
465
481
|
* single-paragraph, container-free, island-free constraint. */
|
|
466
482
|
inline?: boolean;
|
|
467
483
|
}
|
|
468
484
|
|
|
485
|
+
/** One block of a `type: "matrix"` roster: an optional display heading and the
|
|
486
|
+
* members under it, member id to display title. Key order is display order. */
|
|
487
|
+
export interface QuillMatrixGroup {
|
|
488
|
+
group?: string;
|
|
489
|
+
values: Record<string, string>;
|
|
490
|
+
}
|
|
491
|
+
|
|
469
492
|
/** Schema entry for the main card or a named card kind. */
|
|
470
493
|
export interface QuillCardSchema {
|
|
471
494
|
description?: string;
|
|
@@ -499,9 +522,6 @@ export interface QuillMetadata {
|
|
|
499
522
|
}
|
|
500
523
|
|
|
501
524
|
|
|
502
|
-
/**
|
|
503
|
-
* Diagnostic message (error or warning)
|
|
504
|
-
*/
|
|
505
525
|
export interface Diagnostic {
|
|
506
526
|
severity: Severity;
|
|
507
527
|
code?: string;
|
|
@@ -521,12 +541,8 @@ export interface Diagnostic {
|
|
|
521
541
|
* `skip_serializing_if`, so an omitted field would be declared required.
|
|
522
542
|
*/
|
|
523
543
|
args?: Record<string, unknown>;
|
|
524
|
-
sourceChain?: string[];
|
|
525
544
|
}
|
|
526
545
|
|
|
527
|
-
/**
|
|
528
|
-
* Source location for errors and warnings
|
|
529
|
-
*/
|
|
530
546
|
export interface Location {
|
|
531
547
|
file: string;
|
|
532
548
|
line: number;
|
|
@@ -536,9 +552,6 @@ export interface Location {
|
|
|
536
552
|
export type Severity = "error" | "warning";
|
|
537
553
|
|
|
538
554
|
|
|
539
|
-
/**
|
|
540
|
-
* Typed in-memory Quillmark document.
|
|
541
|
-
*/
|
|
542
555
|
export class Document {
|
|
543
556
|
free(): void;
|
|
544
557
|
[Symbol.dispose](): void;
|
|
@@ -560,8 +573,8 @@ export class Document {
|
|
|
560
573
|
*/
|
|
561
574
|
applyChange(addr: Addr | string, bundle: ChangeBundle): void;
|
|
562
575
|
/**
|
|
563
|
-
*
|
|
564
|
-
*
|
|
576
|
+
* A blueprint's fill obligation for the given `quillName`, re-exposed from
|
|
577
|
+
* core. Carries no tool name: pair it with your own next-step directive.
|
|
565
578
|
*/
|
|
566
579
|
static blueprintInstruction(quill_name: string): string;
|
|
567
580
|
/**
|
|
@@ -574,12 +587,6 @@ export class Document {
|
|
|
574
587
|
* which interprets by declared type. An out-of-range `addr.card` throws.
|
|
575
588
|
*/
|
|
576
589
|
bodyMarkdown(addr?: CardAddr): string;
|
|
577
|
-
/**
|
|
578
|
-
* A single composable card by index, so reading one need not materialize
|
|
579
|
-
* every card via [`cards`](Self::cards). An out-of-range `index` throws
|
|
580
|
-
* `edit::index_out_of_range`.
|
|
581
|
-
*/
|
|
582
|
-
card(index: number): Card;
|
|
583
590
|
/**
|
|
584
591
|
* The composable card's own path, `cards.<kind>[index]`: the root
|
|
585
592
|
* [`pathFor`](Self::path_for) extends, for anchoring the card rather than
|
|
@@ -587,9 +594,15 @@ export class Document {
|
|
|
587
594
|
* `cards[index]`.
|
|
588
595
|
*/
|
|
589
596
|
cardPath(index: number): string;
|
|
597
|
+
/**
|
|
598
|
+
* A single composable card by index, so reading one need not materialize
|
|
599
|
+
* every card via [`cards`](Self::cards). An out-of-range `index` throws
|
|
600
|
+
* `edit::index_out_of_range`.
|
|
601
|
+
*/
|
|
602
|
+
card(index: number): Card;
|
|
590
603
|
clone(): Document;
|
|
591
604
|
/**
|
|
592
|
-
* Storage version this build writes via [`
|
|
605
|
+
* Storage version this build writes via [`toStored`](Document::to_stored). The
|
|
593
606
|
* tag advances only when the wire format changes, not on every release.
|
|
594
607
|
*/
|
|
595
608
|
static currentStorageVersion(): string;
|
|
@@ -597,27 +610,22 @@ export class Document {
|
|
|
597
610
|
* Structural equality, excluding parse-time `warnings`.
|
|
598
611
|
*/
|
|
599
612
|
equals(other: Document): boolean;
|
|
600
|
-
/**
|
|
601
|
-
* Render a Diagnostic as the canonical pretty-printed text, so it looks
|
|
602
|
-
* identical whichever consumer surfaces it.
|
|
603
|
-
*/
|
|
604
|
-
static formatDiagnostic(diag: Diagnostic): string;
|
|
605
613
|
/**
|
|
606
614
|
* Authoring-format rules for the card-yaml markdown surface, re-exposed from
|
|
607
615
|
* core. Constant across calls; read once and cache.
|
|
608
616
|
*/
|
|
609
617
|
static formatRules(): string;
|
|
618
|
+
/**
|
|
619
|
+
* Parse markdown into a typed Document. Throws on parse errors.
|
|
620
|
+
*/
|
|
621
|
+
static fromMarkdown(markdown: string): Document;
|
|
610
622
|
/**
|
|
611
623
|
* Reconstruct a `Document` from a versioned storage DTO string produced by
|
|
612
|
-
* [`
|
|
624
|
+
* [`toStored`](Document::to_stored). The result carries no parse-time warnings.
|
|
613
625
|
* Throws if `json` is not a valid storage DTO (malformed JSON, unknown
|
|
614
626
|
* `schema`, missing fields, or unparseable quill reference).
|
|
615
627
|
*/
|
|
616
|
-
static
|
|
617
|
-
/**
|
|
618
|
-
* Parse markdown into a typed Document. Throws on parse errors.
|
|
619
|
-
*/
|
|
620
|
-
static fromMarkdown(markdown: string): Document;
|
|
628
|
+
static fromStored(json: string): Document;
|
|
621
629
|
/**
|
|
622
630
|
* The whole `$ext` map at `addr` (a card address, absent `card` = main), or
|
|
623
631
|
* `undefined` when the card carries none: the `$ext` read that avoids
|
|
@@ -625,12 +633,6 @@ export class Document {
|
|
|
625
633
|
* out-of-range card.
|
|
626
634
|
*/
|
|
627
635
|
getExt(addr?: CardAddr): Record<string, unknown> | undefined;
|
|
628
|
-
/**
|
|
629
|
-
* The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
|
|
630
|
-
* = main), or `undefined`. Throws on a present `field` or an out-of-range
|
|
631
|
-
* card.
|
|
632
|
-
*/
|
|
633
|
-
getExtNamespace(addr: CardAddr, ns: string): unknown;
|
|
634
636
|
/**
|
|
635
637
|
* Read the **verbatim stored value** at `addr`: a field's raw payload value,
|
|
636
638
|
* or the body content when `addr.field` is absent. A bare string is `Addr`
|
|
@@ -647,9 +649,8 @@ export class Document {
|
|
|
647
649
|
* conformed, and this read reports what is there. For the `Content` either
|
|
648
650
|
* way use `reader.getContent`.
|
|
649
651
|
*
|
|
650
|
-
* The body arm is typed `Content
|
|
651
|
-
*
|
|
652
|
-
* which omit a zero: verbatim is the contract, and is why it is `unknown`.
|
|
652
|
+
* The body arm is typed `Content`; a field arm echoes the stored bytes
|
|
653
|
+
* unread, which is the contract and why it is `unknown`.
|
|
653
654
|
*/
|
|
654
655
|
getStored(addr: Addr | string): unknown;
|
|
655
656
|
/**
|
|
@@ -667,26 +668,12 @@ export class Document {
|
|
|
667
668
|
isFill(addr: Addr | string): boolean;
|
|
668
669
|
/**
|
|
669
670
|
* Replace this document's contents **in place** from a versioned storage DTO
|
|
670
|
-
* string: the mutating twin of [`
|
|
671
|
-
* `warnings` are cleared. Throws on an invalid DTO, leaving the
|
|
672
|
-
* unchanged.
|
|
673
|
-
*
|
|
674
|
-
* The cross-WASM-memory `Document` bridge: mutate a document on a
|
|
675
|
-
* backend-memory clone, then write the state back into the caller's
|
|
676
|
-
* canonical document, without the caller re-binding its variable.
|
|
671
|
+
* string: the mutating twin of [`fromStored`](Document::from_stored).
|
|
672
|
+
* Parse-time `warnings` are cleared. Throws on an invalid DTO, leaving the
|
|
673
|
+
* document unchanged. A caller holding the document need not re-bind its
|
|
674
|
+
* variable.
|
|
677
675
|
*/
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Build a fresh `Card` from a kind and a flat field map: the ergonomic
|
|
681
|
-
* constructor for `insertCard`, which also takes any `Card` object
|
|
682
|
-
* directly. Each `fields` entry becomes a card field in insertion order;
|
|
683
|
-
* `body` defaults to `""`.
|
|
684
|
-
*
|
|
685
|
-
* Checks only what a detached card can decide alone: field-name grammar and
|
|
686
|
-
* value depth. Kind validity is positional, so `insertCard` is its gate and
|
|
687
|
-
* any kind string is accepted here.
|
|
688
|
-
*/
|
|
689
|
-
static makeCard(kind: string, fields?: Record<string, unknown>, body?: string): Card;
|
|
676
|
+
loadStored(json: string): void;
|
|
690
677
|
/**
|
|
691
678
|
* Move the card at `from` to position `to`. `from == to` is a no-op.
|
|
692
679
|
*/
|
|
@@ -735,17 +722,10 @@ export class Document {
|
|
|
735
722
|
removeCard(index: number): Card | undefined;
|
|
736
723
|
/**
|
|
737
724
|
* Remove the `$ext` map on the card `addr` targets entirely, returning the
|
|
738
|
-
* previous map or `undefined`. Discards every namespace at once
|
|
739
|
-
*
|
|
725
|
+
* previous map or `undefined`. Discards every namespace at once. Throws on
|
|
726
|
+
* a present `field` or an out-of-range card.
|
|
740
727
|
*/
|
|
741
728
|
removeExt(addr?: CardAddr): Record<string, unknown> | undefined;
|
|
742
|
-
/**
|
|
743
|
-
* Remove `$ext[ns]` on the card `addr` targets, returning its value or
|
|
744
|
-
* `undefined`; drops `$ext` once empty. `addr` is a card address (absent =
|
|
745
|
-
* main). Preserves sibling namespaces. Throws on a present `field` or an
|
|
746
|
-
* out-of-range card.
|
|
747
|
-
*/
|
|
748
|
-
removeExtNamespace(addr: CardAddr, ns: string): any;
|
|
749
729
|
/**
|
|
750
730
|
* Remove a field at `addr`, returning the removed value or `undefined`. A
|
|
751
731
|
* bare string is `Addr` shorthand for `{ field }`. A body address throws, as
|
|
@@ -775,12 +755,6 @@ export class Document {
|
|
|
775
755
|
* and keeps `seedCard` pure: the quill never reads the document.
|
|
776
756
|
*/
|
|
777
757
|
seedOverlay(kind: string): Record<string, unknown> | undefined;
|
|
778
|
-
/**
|
|
779
|
-
* Replace the kind of the card at `index`. Payload and body are untouched;
|
|
780
|
-
* schema-aware migration is the caller's responsibility.
|
|
781
|
-
* Throws if `index` is out of range or `newKind` is invalid.
|
|
782
|
-
*/
|
|
783
|
-
setCardKind(index: number, new_kind: string): void;
|
|
784
758
|
/**
|
|
785
759
|
* Replace the QUILL reference string. Throws if `ref_str` is invalid.
|
|
786
760
|
*/
|
|
@@ -788,7 +762,7 @@ export class Document {
|
|
|
788
762
|
/**
|
|
789
763
|
* Read the storage version tag from a raw storage DTO string without a full
|
|
790
764
|
* parse, or `undefined`. Unknown future versions come back as-is, which
|
|
791
|
-
* distinguishes "build too old" from "payload corrupt" when `
|
|
765
|
+
* distinguishes "build too old" from "payload corrupt" when `fromStored`
|
|
792
766
|
* throws. This is the storage version, not a field schema, though the JSON
|
|
793
767
|
* key is spelled `"schema"`: that is the DTO's serde tag.
|
|
794
768
|
*/
|
|
@@ -796,16 +770,12 @@ export class Document {
|
|
|
796
770
|
/**
|
|
797
771
|
* Replace the opaque `$ext` map on the card `addr` targets (absent `card` =
|
|
798
772
|
* main). `value` must be a plain object. `$ext` carries out-of-band consumer
|
|
799
|
-
* state and never reaches the rendered output.
|
|
800
|
-
*
|
|
773
|
+
* state and never reaches the rendered output. The whole map is the write,
|
|
774
|
+
* so a consumer holding one namespace merges the rest:
|
|
775
|
+
* `{...doc.getExt(addr), [ns]: v}`. Throws on a present `field` or an
|
|
776
|
+
* out-of-range card.
|
|
801
777
|
*/
|
|
802
778
|
storeExt(addr: CardAddr, value: any): void;
|
|
803
|
-
/**
|
|
804
|
-
* Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
|
|
805
|
-
* sibling namespaces: the recommended `$ext` write. Throws on a present
|
|
806
|
-
* `field` or an out-of-range card.
|
|
807
|
-
*/
|
|
808
|
-
storeExtNamespace(addr: CardAddr, ns: string, value: any): void;
|
|
809
779
|
/**
|
|
810
780
|
* Store a field verbatim at `addr`, deferring coercion to render; the typed
|
|
811
781
|
* write is [`commitField`](Document::commit_field). A bare string is `Addr`
|
|
@@ -835,24 +805,18 @@ export class Document {
|
|
|
835
805
|
* with. Throws if `overlay` cannot be serialized or nests too deep.
|
|
836
806
|
*/
|
|
837
807
|
storeSeedOverlay(card_kind: string, overlay: any): void;
|
|
838
|
-
/**
|
|
839
|
-
* Serialize this document to a versioned storage DTO string. Prefer it over
|
|
840
|
-
* `toMarkdown` for persistence: the wire format is frozen per `schema`
|
|
841
|
-
* version and the output is byte-deterministic within one, so equal
|
|
842
|
-
* documents hash equal. Parse-time `warnings` are excluded.
|
|
843
|
-
*/
|
|
844
|
-
toJson(): string;
|
|
845
808
|
/**
|
|
846
809
|
* Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
|
|
847
810
|
* result produces a `Document` equal to `self` by value and by type.
|
|
848
811
|
*/
|
|
849
812
|
toMarkdown(): string;
|
|
850
813
|
/**
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
814
|
+
* Serialize this document to a versioned storage DTO string. Prefer it over
|
|
815
|
+
* `toMarkdown` for persistence: the wire format is frozen per `schema`
|
|
816
|
+
* version and the output is byte-deterministic within one, so equal
|
|
817
|
+
* documents hash equal. Parse-time `warnings` are excluded.
|
|
854
818
|
*/
|
|
855
|
-
|
|
819
|
+
toStored(): string;
|
|
856
820
|
/**
|
|
857
821
|
* Number of composable cards, excluding the main card.
|
|
858
822
|
*/
|
|
@@ -867,7 +831,7 @@ export class Document {
|
|
|
867
831
|
* The non-fatal diagnostics of the load that produced this document: parse
|
|
868
832
|
* warnings, plus `conform::*` warnings when it came through `quill.parse`.
|
|
869
833
|
* Session state, not document value: `equals` and the storage DTO exclude
|
|
870
|
-
* it, and `
|
|
834
|
+
* it, and `fromStored` / `loadStored` clear it.
|
|
871
835
|
*/
|
|
872
836
|
readonly warnings: Diagnostic[];
|
|
873
837
|
}
|
|
@@ -880,7 +844,7 @@ export class Quill {
|
|
|
880
844
|
* Land `doc`'s declared content fields at their canonical rest **in
|
|
881
845
|
* place**, returning the `conform::*` diagnostics for values that would not
|
|
882
846
|
* commit. The read-repair verb for a document that arrived through the
|
|
883
|
-
* transport door (`fromMarkdown`, `
|
|
847
|
+
* transport door (`fromMarkdown`, `fromStored`, a stored row).
|
|
884
848
|
*
|
|
885
849
|
* Idempotent: an equal value is not rewritten, so YAML comments and stored
|
|
886
850
|
* bytes survive. A `!must_fill` marker anywhere in a field's value skips
|
|
@@ -908,14 +872,6 @@ export class Quill {
|
|
|
908
872
|
* is stale, use `Document.fromMarkdown`, `setQuillRef`, then `quill.conform`.
|
|
909
873
|
*/
|
|
910
874
|
parse(markdown: string): Document;
|
|
911
|
-
/**
|
|
912
|
-
* The resolved-value view of `doc`: for every declared field, the value the
|
|
913
|
-
* render projection would use and the `FieldSource` rung it came from
|
|
914
|
-
* (`"authored" | "default" | "blank"`). The card body is a `body` sibling on
|
|
915
|
-
* its card, never a row in `fields`, and `null` when the kind enables no
|
|
916
|
-
* body. Value and provenance only; completeness stays `validate`'s.
|
|
917
|
-
*/
|
|
918
|
-
resolve(doc: Document): Resolved;
|
|
919
875
|
/**
|
|
920
876
|
* Seed a starter composable `Card` of the given kind (carries `$kind`),
|
|
921
877
|
* layering an optional per-kind seed `overlay` over the schema-example base
|
|
@@ -945,8 +901,8 @@ export class Quill {
|
|
|
945
901
|
*
|
|
946
902
|
* This is how a quill crosses a WASM linear-memory boundary as data: a
|
|
947
903
|
* `Quill` built in one build cannot be passed to an engine in another, so
|
|
948
|
-
* `@quillmark/wasm
|
|
949
|
-
* `Quill.fromTree` on demand.
|
|
904
|
+
* the `@quillmark/wasm` runtime layer re-feeds this tree to the backend
|
|
905
|
+
* build's `Quill.fromTree` on demand.
|
|
950
906
|
*/
|
|
951
907
|
toTree(): Map<string, Uint8Array>;
|
|
952
908
|
/**
|
|
@@ -963,9 +919,9 @@ export class Quill {
|
|
|
963
919
|
readonly backendId: string;
|
|
964
920
|
readonly blueprint: string;
|
|
965
921
|
/**
|
|
966
|
-
* Identity snapshot of the `quill:` section of `Quill.yaml
|
|
967
|
-
*
|
|
968
|
-
*
|
|
922
|
+
* Identity snapshot of the `quill:` section of `Quill.yaml`. Pure config:
|
|
923
|
+
* output formats are a resolved-backend capability read from
|
|
924
|
+
* `Quillmark.supportedFormats`, not part of this.
|
|
969
925
|
*/
|
|
970
926
|
readonly metadata: QuillMetadata;
|
|
971
927
|
/**
|
|
@@ -974,6 +930,12 @@ export class Quill {
|
|
|
974
930
|
* ordering contract.
|
|
975
931
|
*/
|
|
976
932
|
readonly schema: QuillSchema;
|
|
933
|
+
/**
|
|
934
|
+
* The advisory diagnostics of the load that produced this quill: what is
|
|
935
|
+
* wrong with it short of refusing it. A quill that loads clean answers
|
|
936
|
+
* `[]`.
|
|
937
|
+
*/
|
|
938
|
+
readonly warnings: Diagnostic[];
|
|
977
939
|
}
|
|
978
940
|
|
|
979
941
|
/**
|
|
@@ -982,6 +944,19 @@ export class Quill {
|
|
|
982
944
|
*/
|
|
983
945
|
export function exportMarkdown(rt: Content): string;
|
|
984
946
|
|
|
947
|
+
/**
|
|
948
|
+
* Render a diagnostic as the CLI and Python's `str(diagnostic)` render it:
|
|
949
|
+
* the severity tag and the message, the code parenthesised after them, then
|
|
950
|
+
* location, path and hint each on an indented line of its own. The engine
|
|
951
|
+
* owns the one printer, so a consumer surfacing diagnostics reads it here
|
|
952
|
+
* rather than keeping a copy of the layout that drifts from the CLI's.
|
|
953
|
+
*
|
|
954
|
+
* Takes the `Diagnostic` shape every read hands back. Throws on a value that
|
|
955
|
+
* is not one — a missing `severity` or `message`, or a `severity` outside the
|
|
956
|
+
* two-value ladder.
|
|
957
|
+
*/
|
|
958
|
+
export function formatDiagnostic(diagnostic: Diagnostic): string;
|
|
959
|
+
|
|
985
960
|
/**
|
|
986
961
|
* Serialize structured [`DocPathSeg`] segments back to the canonical path
|
|
987
962
|
* string: the inverse of `parseDocPath`. Throws on a segment array the
|
|
@@ -1070,18 +1045,15 @@ export interface InitOutput {
|
|
|
1070
1045
|
readonly document_clone: (a: number) => number;
|
|
1071
1046
|
readonly document_currentStorageVersion: (a: number) => void;
|
|
1072
1047
|
readonly document_equals: (a: number, b: number) => number;
|
|
1073
|
-
readonly document_formatDiagnostic: (a: number, b: number) => void;
|
|
1074
1048
|
readonly document_formatRules: (a: number) => void;
|
|
1075
|
-
readonly document_fromJson: (a: number, b: number, c: number) => void;
|
|
1076
1049
|
readonly document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
1050
|
+
readonly document_fromStored: (a: number, b: number, c: number) => void;
|
|
1077
1051
|
readonly document_getExt: (a: number, b: number, c: number) => void;
|
|
1078
|
-
readonly document_getExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1079
1052
|
readonly document_getStored: (a: number, b: number, c: number) => void;
|
|
1080
1053
|
readonly document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
1081
1054
|
readonly document_isFill: (a: number, b: number, c: number) => void;
|
|
1082
|
-
readonly
|
|
1055
|
+
readonly document_loadStored: (a: number, b: number, c: number, d: number) => void;
|
|
1083
1056
|
readonly document_main: (a: number, b: number) => void;
|
|
1084
|
-
readonly document_makeCard: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1085
1057
|
readonly document_moveCard: (a: number, b: number, c: number, d: number) => void;
|
|
1086
1058
|
readonly document_new: (a: number, b: number, c: number) => void;
|
|
1087
1059
|
readonly document_overwrite: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1090,43 +1062,41 @@ export interface InitOutput {
|
|
|
1090
1062
|
readonly document_quillRefHint: (a: number) => void;
|
|
1091
1063
|
readonly document_removeCard: (a: number, b: number, c: number) => void;
|
|
1092
1064
|
readonly document_removeExt: (a: number, b: number, c: number) => void;
|
|
1093
|
-
readonly document_removeExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1094
1065
|
readonly document_removeField: (a: number, b: number, c: number) => void;
|
|
1095
1066
|
readonly document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
1096
1067
|
readonly document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1097
1068
|
readonly document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
1098
|
-
readonly document_setCardKind: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1099
1069
|
readonly document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
1100
1070
|
readonly document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
1101
1071
|
readonly document_storeExt: (a: number, b: number, c: number, d: number) => void;
|
|
1102
|
-
readonly document_storeExtNamespace: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1103
1072
|
readonly document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
1104
1073
|
readonly document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
1105
1074
|
readonly document_storeFill: (a: number, b: number, c: number, d: number) => void;
|
|
1106
1075
|
readonly document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1107
|
-
readonly document_toJson: (a: number, b: number) => void;
|
|
1108
1076
|
readonly document_toMarkdown: (a: number, b: number) => void;
|
|
1109
|
-
readonly
|
|
1077
|
+
readonly document_toStored: (a: number, b: number) => void;
|
|
1110
1078
|
readonly document_warnings: (a: number, b: number) => void;
|
|
1111
1079
|
readonly exportMarkdown: (a: number, b: number) => void;
|
|
1080
|
+
readonly formatDiagnostic: (a: number, b: number) => void;
|
|
1112
1081
|
readonly formatDocPath: (a: number, b: number) => void;
|
|
1113
1082
|
readonly importMarkdown: (a: number, b: number, c: number) => void;
|
|
1114
1083
|
readonly mapMarks: (a: number, b: number, c: number) => void;
|
|
1115
1084
|
readonly mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
1116
1085
|
readonly parseDocPath: (a: number, b: number, c: number) => void;
|
|
1086
|
+
readonly quill__resolve: (a: number, b: number, c: number) => void;
|
|
1117
1087
|
readonly quill_backendId: (a: number, b: number) => void;
|
|
1118
1088
|
readonly quill_blueprint: (a: number, b: number) => void;
|
|
1119
1089
|
readonly quill_conform: (a: number, b: number, c: number) => void;
|
|
1120
1090
|
readonly quill_fromTree: (a: number, b: number) => void;
|
|
1121
1091
|
readonly quill_metadata: (a: number, b: number) => void;
|
|
1122
1092
|
readonly quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
1123
|
-
readonly quill_resolve: (a: number, b: number, c: number) => void;
|
|
1124
1093
|
readonly quill_schema: (a: number, b: number) => void;
|
|
1125
1094
|
readonly quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1126
1095
|
readonly quill_seedDocument: (a: number) => number;
|
|
1127
1096
|
readonly quill_seedMain: (a: number, b: number) => void;
|
|
1128
1097
|
readonly quill_toTree: (a: number) => number;
|
|
1129
1098
|
readonly quill_validate: (a: number, b: number, c: number) => void;
|
|
1099
|
+
readonly quill_warnings: (a: number, b: number) => void;
|
|
1130
1100
|
readonly rebase: (a: number, b: number, c: number, d: number) => void;
|
|
1131
1101
|
readonly start: () => void;
|
|
1132
1102
|
readonly __wbindgen_export: (a: number, b: number) => number;
|