@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
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)
|
|
@@ -499,9 +501,6 @@ export interface QuillMetadata {
|
|
|
499
501
|
}
|
|
500
502
|
|
|
501
503
|
|
|
502
|
-
/**
|
|
503
|
-
* Diagnostic message (error or warning)
|
|
504
|
-
*/
|
|
505
504
|
export interface Diagnostic {
|
|
506
505
|
severity: Severity;
|
|
507
506
|
code?: string;
|
|
@@ -521,12 +520,8 @@ export interface Diagnostic {
|
|
|
521
520
|
* `skip_serializing_if`, so an omitted field would be declared required.
|
|
522
521
|
*/
|
|
523
522
|
args?: Record<string, unknown>;
|
|
524
|
-
sourceChain?: string[];
|
|
525
523
|
}
|
|
526
524
|
|
|
527
|
-
/**
|
|
528
|
-
* Source location for errors and warnings
|
|
529
|
-
*/
|
|
530
525
|
export interface Location {
|
|
531
526
|
file: string;
|
|
532
527
|
line: number;
|
|
@@ -536,9 +531,6 @@ export interface Location {
|
|
|
536
531
|
export type Severity = "error" | "warning";
|
|
537
532
|
|
|
538
533
|
|
|
539
|
-
/**
|
|
540
|
-
* Typed in-memory Quillmark document.
|
|
541
|
-
*/
|
|
542
534
|
export class Document {
|
|
543
535
|
free(): void;
|
|
544
536
|
[Symbol.dispose](): void;
|
|
@@ -560,8 +552,8 @@ export class Document {
|
|
|
560
552
|
*/
|
|
561
553
|
applyChange(addr: Addr | string, bundle: ChangeBundle): void;
|
|
562
554
|
/**
|
|
563
|
-
*
|
|
564
|
-
*
|
|
555
|
+
* A blueprint's fill obligation for the given `quillName`, re-exposed from
|
|
556
|
+
* core. Carries no tool name: pair it with your own next-step directive.
|
|
565
557
|
*/
|
|
566
558
|
static blueprintInstruction(quill_name: string): string;
|
|
567
559
|
/**
|
|
@@ -574,12 +566,6 @@ export class Document {
|
|
|
574
566
|
* which interprets by declared type. An out-of-range `addr.card` throws.
|
|
575
567
|
*/
|
|
576
568
|
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
569
|
/**
|
|
584
570
|
* The composable card's own path, `cards.<kind>[index]`: the root
|
|
585
571
|
* [`pathFor`](Self::path_for) extends, for anchoring the card rather than
|
|
@@ -587,9 +573,15 @@ export class Document {
|
|
|
587
573
|
* `cards[index]`.
|
|
588
574
|
*/
|
|
589
575
|
cardPath(index: number): string;
|
|
576
|
+
/**
|
|
577
|
+
* A single composable card by index, so reading one need not materialize
|
|
578
|
+
* every card via [`cards`](Self::cards). An out-of-range `index` throws
|
|
579
|
+
* `edit::index_out_of_range`.
|
|
580
|
+
*/
|
|
581
|
+
card(index: number): Card;
|
|
590
582
|
clone(): Document;
|
|
591
583
|
/**
|
|
592
|
-
* Storage version this build writes via [`
|
|
584
|
+
* Storage version this build writes via [`toStored`](Document::to_stored). The
|
|
593
585
|
* tag advances only when the wire format changes, not on every release.
|
|
594
586
|
*/
|
|
595
587
|
static currentStorageVersion(): string;
|
|
@@ -597,27 +589,22 @@ export class Document {
|
|
|
597
589
|
* Structural equality, excluding parse-time `warnings`.
|
|
598
590
|
*/
|
|
599
591
|
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
592
|
/**
|
|
606
593
|
* Authoring-format rules for the card-yaml markdown surface, re-exposed from
|
|
607
594
|
* core. Constant across calls; read once and cache.
|
|
608
595
|
*/
|
|
609
596
|
static formatRules(): string;
|
|
597
|
+
/**
|
|
598
|
+
* Parse markdown into a typed Document. Throws on parse errors.
|
|
599
|
+
*/
|
|
600
|
+
static fromMarkdown(markdown: string): Document;
|
|
610
601
|
/**
|
|
611
602
|
* Reconstruct a `Document` from a versioned storage DTO string produced by
|
|
612
|
-
* [`
|
|
603
|
+
* [`toStored`](Document::to_stored). The result carries no parse-time warnings.
|
|
613
604
|
* Throws if `json` is not a valid storage DTO (malformed JSON, unknown
|
|
614
605
|
* `schema`, missing fields, or unparseable quill reference).
|
|
615
606
|
*/
|
|
616
|
-
static
|
|
617
|
-
/**
|
|
618
|
-
* Parse markdown into a typed Document. Throws on parse errors.
|
|
619
|
-
*/
|
|
620
|
-
static fromMarkdown(markdown: string): Document;
|
|
607
|
+
static fromStored(json: string): Document;
|
|
621
608
|
/**
|
|
622
609
|
* The whole `$ext` map at `addr` (a card address, absent `card` = main), or
|
|
623
610
|
* `undefined` when the card carries none: the `$ext` read that avoids
|
|
@@ -625,12 +612,6 @@ export class Document {
|
|
|
625
612
|
* out-of-range card.
|
|
626
613
|
*/
|
|
627
614
|
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
615
|
/**
|
|
635
616
|
* Read the **verbatim stored value** at `addr`: a field's raw payload value,
|
|
636
617
|
* or the body content when `addr.field` is absent. A bare string is `Addr`
|
|
@@ -647,9 +628,8 @@ export class Document {
|
|
|
647
628
|
* conformed, and this read reports what is there. For the `Content` either
|
|
648
629
|
* way use `reader.getContent`.
|
|
649
630
|
*
|
|
650
|
-
* The body arm is typed `Content
|
|
651
|
-
*
|
|
652
|
-
* which omit a zero: verbatim is the contract, and is why it is `unknown`.
|
|
631
|
+
* The body arm is typed `Content`; a field arm echoes the stored bytes
|
|
632
|
+
* unread, which is the contract and why it is `unknown`.
|
|
653
633
|
*/
|
|
654
634
|
getStored(addr: Addr | string): unknown;
|
|
655
635
|
/**
|
|
@@ -667,26 +647,12 @@ export class Document {
|
|
|
667
647
|
isFill(addr: Addr | string): boolean;
|
|
668
648
|
/**
|
|
669
649
|
* 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.
|
|
677
|
-
*/
|
|
678
|
-
loadJson(json: string): void;
|
|
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.
|
|
650
|
+
* string: the mutating twin of [`fromStored`](Document::from_stored).
|
|
651
|
+
* Parse-time `warnings` are cleared. Throws on an invalid DTO, leaving the
|
|
652
|
+
* document unchanged. A caller holding the document need not re-bind its
|
|
653
|
+
* variable.
|
|
688
654
|
*/
|
|
689
|
-
|
|
655
|
+
loadStored(json: string): void;
|
|
690
656
|
/**
|
|
691
657
|
* Move the card at `from` to position `to`. `from == to` is a no-op.
|
|
692
658
|
*/
|
|
@@ -735,17 +701,10 @@ export class Document {
|
|
|
735
701
|
removeCard(index: number): Card | undefined;
|
|
736
702
|
/**
|
|
737
703
|
* Remove the `$ext` map on the card `addr` targets entirely, returning the
|
|
738
|
-
* previous map or `undefined`. Discards every namespace at once
|
|
739
|
-
*
|
|
704
|
+
* previous map or `undefined`. Discards every namespace at once. Throws on
|
|
705
|
+
* a present `field` or an out-of-range card.
|
|
740
706
|
*/
|
|
741
707
|
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
708
|
/**
|
|
750
709
|
* Remove a field at `addr`, returning the removed value or `undefined`. A
|
|
751
710
|
* bare string is `Addr` shorthand for `{ field }`. A body address throws, as
|
|
@@ -775,12 +734,6 @@ export class Document {
|
|
|
775
734
|
* and keeps `seedCard` pure: the quill never reads the document.
|
|
776
735
|
*/
|
|
777
736
|
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
737
|
/**
|
|
785
738
|
* Replace the QUILL reference string. Throws if `ref_str` is invalid.
|
|
786
739
|
*/
|
|
@@ -788,7 +741,7 @@ export class Document {
|
|
|
788
741
|
/**
|
|
789
742
|
* Read the storage version tag from a raw storage DTO string without a full
|
|
790
743
|
* parse, or `undefined`. Unknown future versions come back as-is, which
|
|
791
|
-
* distinguishes "build too old" from "payload corrupt" when `
|
|
744
|
+
* distinguishes "build too old" from "payload corrupt" when `fromStored`
|
|
792
745
|
* throws. This is the storage version, not a field schema, though the JSON
|
|
793
746
|
* key is spelled `"schema"`: that is the DTO's serde tag.
|
|
794
747
|
*/
|
|
@@ -796,16 +749,12 @@ export class Document {
|
|
|
796
749
|
/**
|
|
797
750
|
* Replace the opaque `$ext` map on the card `addr` targets (absent `card` =
|
|
798
751
|
* main). `value` must be a plain object. `$ext` carries out-of-band consumer
|
|
799
|
-
* state and never reaches the rendered output.
|
|
800
|
-
*
|
|
752
|
+
* state and never reaches the rendered output. The whole map is the write,
|
|
753
|
+
* so a consumer holding one namespace merges the rest:
|
|
754
|
+
* `{...doc.getExt(addr), [ns]: v}`. Throws on a present `field` or an
|
|
755
|
+
* out-of-range card.
|
|
801
756
|
*/
|
|
802
757
|
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
758
|
/**
|
|
810
759
|
* Store a field verbatim at `addr`, deferring coercion to render; the typed
|
|
811
760
|
* write is [`commitField`](Document::commit_field). A bare string is `Addr`
|
|
@@ -835,24 +784,18 @@ export class Document {
|
|
|
835
784
|
* with. Throws if `overlay` cannot be serialized or nests too deep.
|
|
836
785
|
*/
|
|
837
786
|
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
787
|
/**
|
|
846
788
|
* Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
|
|
847
789
|
* result produces a `Document` equal to `self` by value and by type.
|
|
848
790
|
*/
|
|
849
791
|
toMarkdown(): string;
|
|
850
792
|
/**
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
793
|
+
* Serialize this document to a versioned storage DTO string. Prefer it over
|
|
794
|
+
* `toMarkdown` for persistence: the wire format is frozen per `schema`
|
|
795
|
+
* version and the output is byte-deterministic within one, so equal
|
|
796
|
+
* documents hash equal. Parse-time `warnings` are excluded.
|
|
854
797
|
*/
|
|
855
|
-
|
|
798
|
+
toStored(): string;
|
|
856
799
|
/**
|
|
857
800
|
* Number of composable cards, excluding the main card.
|
|
858
801
|
*/
|
|
@@ -867,7 +810,7 @@ export class Document {
|
|
|
867
810
|
* The non-fatal diagnostics of the load that produced this document: parse
|
|
868
811
|
* warnings, plus `conform::*` warnings when it came through `quill.parse`.
|
|
869
812
|
* Session state, not document value: `equals` and the storage DTO exclude
|
|
870
|
-
* it, and `
|
|
813
|
+
* it, and `fromStored` / `loadStored` clear it.
|
|
871
814
|
*/
|
|
872
815
|
readonly warnings: Diagnostic[];
|
|
873
816
|
}
|
|
@@ -880,7 +823,7 @@ export class Quill {
|
|
|
880
823
|
* Land `doc`'s declared content fields at their canonical rest **in
|
|
881
824
|
* place**, returning the `conform::*` diagnostics for values that would not
|
|
882
825
|
* commit. The read-repair verb for a document that arrived through the
|
|
883
|
-
* transport door (`fromMarkdown`, `
|
|
826
|
+
* transport door (`fromMarkdown`, `fromStored`, a stored row).
|
|
884
827
|
*
|
|
885
828
|
* Idempotent: an equal value is not rewritten, so YAML comments and stored
|
|
886
829
|
* bytes survive. A `!must_fill` marker anywhere in a field's value skips
|
|
@@ -908,14 +851,6 @@ export class Quill {
|
|
|
908
851
|
* is stale, use `Document.fromMarkdown`, `setQuillRef`, then `quill.conform`.
|
|
909
852
|
*/
|
|
910
853
|
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
854
|
/**
|
|
920
855
|
* Seed a starter composable `Card` of the given kind (carries `$kind`),
|
|
921
856
|
* layering an optional per-kind seed `overlay` over the schema-example base
|
|
@@ -945,8 +880,8 @@ export class Quill {
|
|
|
945
880
|
*
|
|
946
881
|
* This is how a quill crosses a WASM linear-memory boundary as data: a
|
|
947
882
|
* `Quill` built in one build cannot be passed to an engine in another, so
|
|
948
|
-
* `@quillmark/wasm
|
|
949
|
-
* `Quill.fromTree` on demand.
|
|
883
|
+
* the `@quillmark/wasm` runtime layer re-feeds this tree to the backend
|
|
884
|
+
* build's `Quill.fromTree` on demand.
|
|
950
885
|
*/
|
|
951
886
|
toTree(): Map<string, Uint8Array>;
|
|
952
887
|
/**
|
|
@@ -963,9 +898,9 @@ export class Quill {
|
|
|
963
898
|
readonly backendId: string;
|
|
964
899
|
readonly blueprint: string;
|
|
965
900
|
/**
|
|
966
|
-
* Identity snapshot of the `quill:` section of `Quill.yaml
|
|
967
|
-
*
|
|
968
|
-
*
|
|
901
|
+
* Identity snapshot of the `quill:` section of `Quill.yaml`. Pure config:
|
|
902
|
+
* output formats are a resolved-backend capability read from
|
|
903
|
+
* `Quillmark.supportedFormats`, not part of this.
|
|
969
904
|
*/
|
|
970
905
|
readonly metadata: QuillMetadata;
|
|
971
906
|
/**
|
|
@@ -974,6 +909,12 @@ export class Quill {
|
|
|
974
909
|
* ordering contract.
|
|
975
910
|
*/
|
|
976
911
|
readonly schema: QuillSchema;
|
|
912
|
+
/**
|
|
913
|
+
* The advisory diagnostics of the load that produced this quill: what is
|
|
914
|
+
* wrong with it short of refusing it. A quill that loads clean answers
|
|
915
|
+
* `[]`.
|
|
916
|
+
*/
|
|
917
|
+
readonly warnings: Diagnostic[];
|
|
977
918
|
}
|
|
978
919
|
|
|
979
920
|
/**
|
|
@@ -1070,18 +1011,15 @@ export interface InitOutput {
|
|
|
1070
1011
|
readonly document_clone: (a: number) => number;
|
|
1071
1012
|
readonly document_currentStorageVersion: (a: number) => void;
|
|
1072
1013
|
readonly document_equals: (a: number, b: number) => number;
|
|
1073
|
-
readonly document_formatDiagnostic: (a: number, b: number) => void;
|
|
1074
1014
|
readonly document_formatRules: (a: number) => void;
|
|
1075
|
-
readonly document_fromJson: (a: number, b: number, c: number) => void;
|
|
1076
1015
|
readonly document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
1016
|
+
readonly document_fromStored: (a: number, b: number, c: number) => void;
|
|
1077
1017
|
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
1018
|
readonly document_getStored: (a: number, b: number, c: number) => void;
|
|
1080
1019
|
readonly document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
1081
1020
|
readonly document_isFill: (a: number, b: number, c: number) => void;
|
|
1082
|
-
readonly
|
|
1021
|
+
readonly document_loadStored: (a: number, b: number, c: number, d: number) => void;
|
|
1083
1022
|
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
1023
|
readonly document_moveCard: (a: number, b: number, c: number, d: number) => void;
|
|
1086
1024
|
readonly document_new: (a: number, b: number, c: number) => void;
|
|
1087
1025
|
readonly document_overwrite: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1090,23 +1028,19 @@ export interface InitOutput {
|
|
|
1090
1028
|
readonly document_quillRefHint: (a: number) => void;
|
|
1091
1029
|
readonly document_removeCard: (a: number, b: number, c: number) => void;
|
|
1092
1030
|
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
1031
|
readonly document_removeField: (a: number, b: number, c: number) => void;
|
|
1095
1032
|
readonly document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
1096
1033
|
readonly document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1097
1034
|
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
1035
|
readonly document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
1100
1036
|
readonly document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
1101
1037
|
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
1038
|
readonly document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
1104
1039
|
readonly document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
1105
1040
|
readonly document_storeFill: (a: number, b: number, c: number, d: number) => void;
|
|
1106
1041
|
readonly document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1107
|
-
readonly document_toJson: (a: number, b: number) => void;
|
|
1108
1042
|
readonly document_toMarkdown: (a: number, b: number) => void;
|
|
1109
|
-
readonly
|
|
1043
|
+
readonly document_toStored: (a: number, b: number) => void;
|
|
1110
1044
|
readonly document_warnings: (a: number, b: number) => void;
|
|
1111
1045
|
readonly exportMarkdown: (a: number, b: number) => void;
|
|
1112
1046
|
readonly formatDocPath: (a: number, b: number) => void;
|
|
@@ -1114,19 +1048,20 @@ export interface InitOutput {
|
|
|
1114
1048
|
readonly mapMarks: (a: number, b: number, c: number) => void;
|
|
1115
1049
|
readonly mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
1116
1050
|
readonly parseDocPath: (a: number, b: number, c: number) => void;
|
|
1051
|
+
readonly quill__resolve: (a: number, b: number, c: number) => void;
|
|
1117
1052
|
readonly quill_backendId: (a: number, b: number) => void;
|
|
1118
1053
|
readonly quill_blueprint: (a: number, b: number) => void;
|
|
1119
1054
|
readonly quill_conform: (a: number, b: number, c: number) => void;
|
|
1120
1055
|
readonly quill_fromTree: (a: number, b: number) => void;
|
|
1121
1056
|
readonly quill_metadata: (a: number, b: number) => void;
|
|
1122
1057
|
readonly quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
1123
|
-
readonly quill_resolve: (a: number, b: number, c: number) => void;
|
|
1124
1058
|
readonly quill_schema: (a: number, b: number) => void;
|
|
1125
1059
|
readonly quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1126
1060
|
readonly quill_seedDocument: (a: number) => number;
|
|
1127
1061
|
readonly quill_seedMain: (a: number, b: number) => void;
|
|
1128
1062
|
readonly quill_toTree: (a: number) => number;
|
|
1129
1063
|
readonly quill_validate: (a: number, b: number, c: number) => void;
|
|
1064
|
+
readonly quill_warnings: (a: number, b: number) => void;
|
|
1130
1065
|
readonly rebase: (a: number, b: number, c: number, d: number) => void;
|
|
1131
1066
|
readonly start: () => void;
|
|
1132
1067
|
readonly __wbindgen_export: (a: number, b: number) => number;
|