@quillmark/wasm 0.100.0 → 0.102.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 +124 -0
- package/README.md +68 -15
- package/backends/pdfform/wasm.d.ts +265 -67
- package/backends/pdfform/wasm.js +2980 -8
- package/backends/pdfform/wasm_bg.wasm +0 -0
- package/backends/pdfform/wasm_bg.wasm.d.ts +8 -8
- package/backends/typst/wasm.d.ts +265 -67
- package/backends/typst/wasm.js +3004 -8
- package/backends/typst/wasm_bg.wasm +0 -0
- package/backends/typst/wasm_bg.wasm.d.ts +8 -8
- package/core/wasm.d.ts +232 -58
- package/core/wasm.js +2471 -8
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +7 -7
- package/package.json +7 -4
- package/runtime/env-node.js +20 -0
- package/runtime/env-web.js +19 -0
- package/runtime/runtime.d.ts +61 -26
- package/runtime/runtime.js +200 -41
- package/runtime/uninit.js +57 -0
- package/backends/pdfform/wasm_bg.js +0 -2858
- package/backends/typst/wasm_bg.js +0 -2882
- package/core/wasm_bg.js +0 -2354
|
Binary file
|
|
@@ -13,11 +13,12 @@ export const document__readerGetContent: (a: number, b: number, c: number, d: nu
|
|
|
13
13
|
export const document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
14
14
|
export const document_applyChange: (a: number, b: number, c: number, d: number) => void;
|
|
15
15
|
export const document_blueprintInstruction: (a: number, b: number, c: number) => void;
|
|
16
|
+
export const document_bodyMarkdown: (a: number, b: number, c: number) => void;
|
|
16
17
|
export const document_card: (a: number, b: number, c: number) => void;
|
|
17
18
|
export const document_cardCount: (a: number) => number;
|
|
18
19
|
export const document_cards: (a: number, b: number) => void;
|
|
19
20
|
export const document_clone: (a: number) => number;
|
|
20
|
-
export const
|
|
21
|
+
export const document_currentStorageVersion: (a: number) => void;
|
|
21
22
|
export const document_equals: (a: number, b: number) => number;
|
|
22
23
|
export const document_formatDiagnostic: (a: number, b: number) => void;
|
|
23
24
|
export const document_formatRules: (a: number) => void;
|
|
@@ -25,34 +26,33 @@ export const document_fromJson: (a: number, b: number, c: number) => void;
|
|
|
25
26
|
export const document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
26
27
|
export const document_getExt: (a: number, b: number, c: number) => void;
|
|
27
28
|
export const document_getExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
28
|
-
export const document_getMarkdown: (a: number, b: number, c: number) => void;
|
|
29
29
|
export const document_getStored: (a: number, b: number, c: number) => void;
|
|
30
30
|
export const document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
-
export const document_install: (a: number, b: number, c: number, d: number) => void;
|
|
32
31
|
export const document_isFill: (a: number, b: number, c: number) => void;
|
|
33
32
|
export const document_loadJson: (a: number, b: number, c: number, d: number) => void;
|
|
34
33
|
export const document_main: (a: number, b: number) => void;
|
|
35
34
|
export const document_makeCard: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
36
35
|
export const document_moveCard: (a: number, b: number, c: number, d: number) => void;
|
|
37
36
|
export const document_new: (a: number, b: number, c: number) => void;
|
|
37
|
+
export const document_overwrite: (a: number, b: number, c: number, d: number) => void;
|
|
38
38
|
export const document_quillRef: (a: number, b: number) => void;
|
|
39
39
|
export const document_quillRefHint: (a: number) => void;
|
|
40
40
|
export const document_removeCard: (a: number, b: number, c: number) => void;
|
|
41
41
|
export const document_removeExt: (a: number, b: number, c: number) => void;
|
|
42
42
|
export const document_removeExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
43
43
|
export const document_removeField: (a: number, b: number, c: number) => void;
|
|
44
|
-
export const
|
|
44
|
+
export const document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
45
45
|
export const document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
46
|
-
export const document_schemaVersionOf: (a: number, b: number, c: number) => void;
|
|
47
46
|
export const document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
48
47
|
export const document_setCardKind: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
49
48
|
export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
49
|
+
export const document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
50
50
|
export const document_storeExt: (a: number, b: number, c: number, d: number) => void;
|
|
51
51
|
export const document_storeExtNamespace: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
52
52
|
export const document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
53
53
|
export const document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
54
54
|
export const document_storeFill: (a: number, b: number, c: number, d: number) => void;
|
|
55
|
-
export const
|
|
55
|
+
export const document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
56
56
|
export const document_toJson: (a: number, b: number) => void;
|
|
57
57
|
export const document_toMarkdown: (a: number, b: number) => void;
|
|
58
58
|
export const document_tryFromJson: (a: number, b: number) => number;
|
|
@@ -60,8 +60,6 @@ export const document_warnings: (a: number, b: number) => void;
|
|
|
60
60
|
export const exportMarkdown: (a: number, b: number) => void;
|
|
61
61
|
export const formatDocPath: (a: number, b: number) => void;
|
|
62
62
|
export const importMarkdown: (a: number, b: number, c: number) => void;
|
|
63
|
-
export const init: () => void;
|
|
64
|
-
export const livesession_apply: (a: number, b: number, c: number) => void;
|
|
65
63
|
export const livesession_backendId: (a: number, b: number) => void;
|
|
66
64
|
export const livesession_fieldAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
67
65
|
export const livesession_fieldBoxes: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -73,6 +71,7 @@ export const livesession_positionAt: (a: number, b: number, c: number, d: number
|
|
|
73
71
|
export const livesession_regions: (a: number, b: number) => void;
|
|
74
72
|
export const livesession_render: (a: number, b: number, c: number) => void;
|
|
75
73
|
export const livesession_supportsCanvas: (a: number) => number;
|
|
74
|
+
export const livesession_update: (a: number, b: number, c: number) => void;
|
|
76
75
|
export const livesession_warnings: (a: number, b: number) => void;
|
|
77
76
|
export const mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
78
77
|
export const parseDocPath: (a: number, b: number, c: number) => void;
|
|
@@ -95,6 +94,7 @@ export const quillmark_render: (a: number, b: number, c: number, d: number, e: n
|
|
|
95
94
|
export const quillmark_supportedFormats: (a: number, b: number, c: number) => void;
|
|
96
95
|
export const quillmark_supportsCanvas: (a: number, b: number) => number;
|
|
97
96
|
export const rebase: (a: number, b: number, c: number, d: number) => void;
|
|
97
|
+
export const start: () => void;
|
|
98
98
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
99
99
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
100
100
|
export const __wbindgen_export3: (a: number) => void;
|
package/core/wasm.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export interface Card {
|
|
|
46
46
|
* The card body as canonical `Content`: the source-of-truth content model.
|
|
47
47
|
* Always this content shape on read, never a markdown string. For the markdown
|
|
48
48
|
* projection call the codec `exportMarkdown(card.body)`. Write a body back
|
|
49
|
-
* with `doc.
|
|
49
|
+
* with `doc.overwrite(addr, rt)` / `doc.revise(addr, md)`, or via `CardInput.body`.
|
|
50
50
|
*/
|
|
51
51
|
body: Content;
|
|
52
52
|
}
|
|
@@ -227,11 +227,12 @@ export type MarkOp =
|
|
|
227
227
|
| { op: "removeAnchor"; id: string };
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
|
-
* A line/block edit. `split`/`join` splice `\n
|
|
231
|
-
* `setContinues` touch metadata.
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
230
|
+
* A line/block edit. `split`/`join` splice `\n` in post-`delta`, post-`islandOps`
|
|
231
|
+
* coordinates; `setKind`/`setContainers`/`setContinues` touch metadata.
|
|
232
|
+
* `setContinues` sets/clears a line's within-block hard-break flag
|
|
233
|
+
* (`ContentLine.continues`): the op-grained way to lower a Shift+Enter hard
|
|
234
|
+
* break or a new code-fence interior line; `continues: true` on line 0 is
|
|
235
|
+
* rejected (nothing precedes it to continue).
|
|
235
236
|
*/
|
|
236
237
|
export type LineOp =
|
|
237
238
|
| { op: "split"; at: number }
|
|
@@ -240,13 +241,60 @@ export type LineOp =
|
|
|
240
241
|
| { op: "setContainers"; line: number; containers: ContentContainer[] }
|
|
241
242
|
| { op: "setContinues"; line: number; continues: boolean };
|
|
242
243
|
|
|
244
|
+
/**
|
|
245
|
+
* An island edit: the only channel that reaches an island's payload, a table's
|
|
246
|
+
* cells or an image's url.
|
|
247
|
+
*
|
|
248
|
+
* Both ops move one island entry and leave the field's text and marks alone, so
|
|
249
|
+
* an island edit keeps every identity anchor in the field. That is why a table
|
|
250
|
+
* edit lowers to `applyChange` rather than `overwrite`, which drops them all.
|
|
251
|
+
*
|
|
252
|
+
* `set` addresses an existing island by `id`; an `id` no island carries throws
|
|
253
|
+
* rather than passing silently. `insert` places a new island's slot at `at`
|
|
254
|
+
* together with its entry, so a slot never exists without an island behind it;
|
|
255
|
+
* its `id` must be non-empty and unused. `at` is a position in the text the
|
|
256
|
+
* `delta` and this bundle's earlier island ops left: each insert splices its
|
|
257
|
+
* slot before the next op reads the text, so slots after `a` and `b` of `abc`
|
|
258
|
+
* go in at 1 and 3. A stale frame misplaces slots and never throws.
|
|
259
|
+
*
|
|
260
|
+
* A `delta` insert string may not carry a slot, which would orphan. A producer
|
|
261
|
+
* that computes one splice over the whole field text carries slots in it on any
|
|
262
|
+
* paste of an island or undo of a deletion; that splice splits into the
|
|
263
|
+
* slot-free `delta` plus one `insert` per slot.
|
|
264
|
+
*
|
|
265
|
+
* Deleting an island needs no op, and the drop is whole: a `delta` that removes
|
|
266
|
+
* its slot drops the island from the store. Re-landing it is an `insert` of the
|
|
267
|
+
* full island under its original id, and only the producer that deleted it
|
|
268
|
+
* still holds that value. A pasted copy of a live island is new and mints fresh
|
|
269
|
+
* (DOCUMENT_STORAGE § Island-id determinism). A block island's line demotes to
|
|
270
|
+
* `para` when its slot goes, so re-landing one re-tags the line too.
|
|
271
|
+
*
|
|
272
|
+
* A `set` stores the `loss` it is given: nothing re-derives the class from the
|
|
273
|
+
* new `props`, so a write that changes what markdown can carry must say so.
|
|
274
|
+
*
|
|
275
|
+
* An island is *inline* (a slot inside a paragraph) unless its line says
|
|
276
|
+
* otherwise. A **block** island is one bundle of all three channels, in the
|
|
277
|
+
* order they apply: `delta` inserts the `\n` that opens the line, `islandOps`
|
|
278
|
+
* inserts the slot, `lineOps` tags the line `{ op: "setKind", kind: "island" }`.
|
|
279
|
+
* `{ op: "split" }` cannot open that line, since line ops run after island ops.
|
|
280
|
+
*/
|
|
281
|
+
export type IslandOp =
|
|
282
|
+
| ({ op: "set" } & ContentIsland)
|
|
283
|
+
| ({ op: "insert"; at: number } & ContentIsland);
|
|
284
|
+
|
|
243
285
|
/**
|
|
244
286
|
* A committed content edit bundle for `applyChange`: a text `delta` (default no
|
|
245
|
-
* text change), then `lineOps`, then `markOps` (mark ranges
|
|
246
|
-
* coordinates). Every field is
|
|
287
|
+
* text change), then `islandOps`, then `lineOps`, then `markOps` (mark ranges
|
|
288
|
+
* are in final-text coordinates: every earlier channel applied). Every field is
|
|
289
|
+
* optional.
|
|
290
|
+
*
|
|
291
|
+
* Within each channel ops apply in sequence, each against the state the earlier
|
|
292
|
+
* ones left: an island `insert`'s `at` counts earlier ops' slots, and `lineOps`
|
|
293
|
+
* positions and indices renumber through earlier `split`/`join`.
|
|
247
294
|
*/
|
|
248
295
|
export interface ChangeBundle {
|
|
249
296
|
delta?: Delta;
|
|
297
|
+
islandOps?: IslandOp[];
|
|
250
298
|
lineOps?: LineOp[];
|
|
251
299
|
markOps?: MarkOp[];
|
|
252
300
|
}
|
|
@@ -470,11 +518,16 @@ export class Document {
|
|
|
470
518
|
free(): void;
|
|
471
519
|
[Symbol.dispose](): void;
|
|
472
520
|
/**
|
|
473
|
-
* **Apply** a committed content edit `bundle`
|
|
474
|
-
*
|
|
475
|
-
*
|
|
521
|
+
* **Apply** a committed content edit `bundle`
|
|
522
|
+
* (`{ delta?, islandOps?, lineOps?, markOps? }`) at `addr`, the editor
|
|
523
|
+
* splice: text delta first, then island ops, then line ops, then mark ops
|
|
524
|
+
* (mark ranges in final-text coordinates), each all-or-nothing. An absent
|
|
476
525
|
* `addr.field` targets the body, an absent `addr.card` the main card.
|
|
477
526
|
*
|
|
527
|
+
* The island channel keeps a table or image edit on the op path: it moves
|
|
528
|
+
* the island alone, so the anchors elsewhere in the field survive an edit
|
|
529
|
+
* `overwrite` would clear.
|
|
530
|
+
*
|
|
478
531
|
* Throws on an out-of-range card, a field that is not richtext, a malformed
|
|
479
532
|
* bundle, or an op that applies out of bounds (the value is unchanged on a
|
|
480
533
|
* failed apply).
|
|
@@ -487,6 +540,18 @@ export class Document {
|
|
|
487
540
|
* uniform.
|
|
488
541
|
*/
|
|
489
542
|
static blueprintInstruction(quill_name: string): string;
|
|
543
|
+
/**
|
|
544
|
+
* The **body** markdown projection (the main body, or a composable card's
|
|
545
|
+
* body (`{ card }`)) the on-demand, lossy export (content-only marks do not
|
|
546
|
+
* survive markdown). A body's type is a format fact, not a schema fact, so
|
|
547
|
+
* this read stays quill-free; a body is never absent.
|
|
548
|
+
*
|
|
549
|
+
* `addr` is an optional **card address** (`{ card }`, absent = main). A
|
|
550
|
+
* present `field` throws: a field's markdown is read through the
|
|
551
|
+
* schema-plane `quill.reader(doc).get(field)`, which interprets by declared
|
|
552
|
+
* type. An out-of-range `addr.card` throws.
|
|
553
|
+
*/
|
|
554
|
+
bodyMarkdown(addr?: CardAddr): string;
|
|
490
555
|
/**
|
|
491
556
|
* A single composable card by index: the whole `Card`, the card-indexed
|
|
492
557
|
* twin of the [`main`](Self::main) getter, so reading one card need not
|
|
@@ -497,11 +562,11 @@ export class Document {
|
|
|
497
562
|
card(index: number): Card;
|
|
498
563
|
clone(): Document;
|
|
499
564
|
/**
|
|
500
|
-
*
|
|
565
|
+
* Storage version this build writes via [`toJson`](Document::to_json).
|
|
501
566
|
* Tracks the `Document` model version (not the running crate version):
|
|
502
567
|
* the tag advances only when the wire format changes, not on every release.
|
|
503
568
|
*/
|
|
504
|
-
static
|
|
569
|
+
static currentStorageVersion(): string;
|
|
505
570
|
/**
|
|
506
571
|
* Structural equality (parse-time `warnings` excluded). Use to debounce
|
|
507
572
|
* upstream prop updates instead of re-parsing on every keystroke.
|
|
@@ -548,18 +613,6 @@ export class Document {
|
|
|
548
613
|
* `removeExtNamespace`). Throws on a present `field` or an out-of-range card.
|
|
549
614
|
*/
|
|
550
615
|
getExtNamespace(addr: CardAddr, ns: string): unknown;
|
|
551
|
-
/**
|
|
552
|
-
* The **body** markdown projection (the main body, or a composable card's
|
|
553
|
-
* body (`{ card }`)) the on-demand, lossy export (content-only marks do not
|
|
554
|
-
* survive markdown). A body's type is a format fact, not a schema fact, so
|
|
555
|
-
* this read stays quill-free; a body is never absent.
|
|
556
|
-
*
|
|
557
|
-
* `addr` is an optional **card address** (`{ card }`, absent = main). A
|
|
558
|
-
* present `field` throws: a field's markdown is read through the
|
|
559
|
-
* schema-plane `quill.reader(doc).get(field)`, which interprets by declared
|
|
560
|
-
* type. An out-of-range `addr.card` throws.
|
|
561
|
-
*/
|
|
562
|
-
getMarkdown(addr?: CardAddr): string;
|
|
563
616
|
/**
|
|
564
617
|
* Read the **verbatim stored value** at `addr`: the raw payload value of a
|
|
565
618
|
* field, or the **body content** when `addr.field` is absent. A bare
|
|
@@ -568,7 +621,7 @@ export class Document {
|
|
|
568
621
|
* throws `edit::index_out_of_range`. Needs no schema, so it lives on
|
|
569
622
|
* `Document`: the read echo of the verbatim `store*` write, distinct from
|
|
570
623
|
* the interpreted schema-plane [`reader.get`](Self::reader_get). For the
|
|
571
|
-
* markdown projection use [`
|
|
624
|
+
* markdown projection use [`bodyMarkdown`](Self::get_markdown) (body) or
|
|
572
625
|
* `reader.get` (a field's declared type).
|
|
573
626
|
*
|
|
574
627
|
* **A content field at rest has one stored form per codec**: a `richtext`
|
|
@@ -577,7 +630,7 @@ export class Document {
|
|
|
577
630
|
* `quill.conform`) is at rest, so this read no longer depends on which lane
|
|
578
631
|
* built it. A document that came through the transport door
|
|
579
632
|
* (`Document.fromMarkdown`, a legacy stored row) may rest as authored until
|
|
580
|
-
* it is conformed, and this read reports what is there. For the
|
|
633
|
+
* it is conformed, and this read reports what is there. For the `Content`
|
|
581
634
|
* either way, use the schema-plane `reader.getContent`, which decodes
|
|
582
635
|
* through the codec the field's declared type names.
|
|
583
636
|
*/
|
|
@@ -591,19 +644,6 @@ export class Document {
|
|
|
591
644
|
* not a valid kind name, or if `at` is out of range.
|
|
592
645
|
*/
|
|
593
646
|
insertCard(card: CardInput, at?: number): void;
|
|
594
|
-
/**
|
|
595
|
-
* **Install** a richtext value at `addr`: **value semantics**, content only.
|
|
596
|
-
* Stores exactly `rt` (a canonical `Content` content object); the identity
|
|
597
|
-
* anchors of any previous value are gone. An absent `addr.field` targets the
|
|
598
|
-
* body, an absent `addr.card` the main card. For "here's new markdown," use
|
|
599
|
-
* [`revise`](Document::revise); the cold-import path is spelled at the call
|
|
600
|
-
* site as `install(addr, importMarkdown(md))`, so anchor loss is visible in
|
|
601
|
-
* source.
|
|
602
|
-
*
|
|
603
|
-
* Throws on an out-of-range card, a malformed field name, or an `rt` that is
|
|
604
|
-
* not a canonical content object.
|
|
605
|
-
*/
|
|
606
|
-
install(addr: Addr | string, rt: Content): void;
|
|
607
647
|
/**
|
|
608
648
|
* Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
|
|
609
649
|
* shorthand for `{ field }`. `false` for an absent field (truthful: it isn't
|
|
@@ -652,6 +692,21 @@ export class Document {
|
|
|
652
692
|
* Throws on an invalid quill reference. Mirrors Python `Document(quill_ref)`.
|
|
653
693
|
*/
|
|
654
694
|
constructor(quill_ref: string);
|
|
695
|
+
/**
|
|
696
|
+
* **Overwrite** the content value at `addr`: **value semantics**, content
|
|
697
|
+
* only. Stores exactly `rt` (a canonical `Content` content object); the
|
|
698
|
+
* identity anchors of any previous value are gone. The bottom rung of the
|
|
699
|
+
* content lane's ladder by anchor fate: `overwrite` destroys,
|
|
700
|
+
* [`revise`](Document::revise) rebases,
|
|
701
|
+
* [`applyChange`](Document::apply_change) preserves. An absent `addr.field`
|
|
702
|
+
* targets the body, an absent `addr.card` the main card. Cold-importing
|
|
703
|
+
* markdown is spelled `overwrite(addr, importMarkdown(md))` at the call
|
|
704
|
+
* site, where the anchor loss is visible.
|
|
705
|
+
*
|
|
706
|
+
* Throws on an out-of-range card, a malformed field name, or an `rt` that is
|
|
707
|
+
* not a canonical content object.
|
|
708
|
+
*/
|
|
709
|
+
overwrite(addr: Addr | string, rt: Content): void;
|
|
655
710
|
/**
|
|
656
711
|
* The canonical `$quill` reference grammar as author-facing text. Core is
|
|
657
712
|
* the single source of truth: drive schema `describe` and validation
|
|
@@ -687,7 +742,7 @@ export class Document {
|
|
|
687
742
|
* overlay or `undefined`; drops `$seed` entirely once empty. Sibling kinds
|
|
688
743
|
* survive. `$seed` is main-only, so this takes no address.
|
|
689
744
|
*/
|
|
690
|
-
|
|
745
|
+
removeSeedOverlay(card_kind: string): any;
|
|
691
746
|
/**
|
|
692
747
|
* **Revise** the richtext value at `addr` from a markdown string: **edit
|
|
693
748
|
* semantics**, the default write path, returning the text `Delta`. Imports
|
|
@@ -700,13 +755,6 @@ export class Document {
|
|
|
700
755
|
* non-content field value, or an over-nested markdown input.
|
|
701
756
|
*/
|
|
702
757
|
revise(addr: Addr | string, markdown: string): Delta;
|
|
703
|
-
/**
|
|
704
|
-
* Read the `schema` version tag from a raw storage DTO string without a
|
|
705
|
-
* full parse, or `undefined`. Returns unknown future versions as-is:
|
|
706
|
-
* useful to distinguish "build too old" from "payload corrupt" when
|
|
707
|
-
* `fromJson` throws.
|
|
708
|
-
*/
|
|
709
|
-
static schemaVersionOf(json: string): string | undefined;
|
|
710
758
|
/**
|
|
711
759
|
* The main card's `$seed` overlay object for `kind` (the `$seed[kind]`
|
|
712
760
|
* entry), or `undefined` when absent. The cheap read that feeds
|
|
@@ -725,6 +773,18 @@ export class Document {
|
|
|
725
773
|
* Replace the QUILL reference string. Throws if `ref_str` is invalid.
|
|
726
774
|
*/
|
|
727
775
|
setQuillRef(ref_str: string): void;
|
|
776
|
+
/**
|
|
777
|
+
* Read the storage version tag from a raw storage DTO string without a
|
|
778
|
+
* full parse, or `undefined`. Returns unknown future versions as-is:
|
|
779
|
+
* useful to distinguish "build too old" from "payload corrupt" when
|
|
780
|
+
* `fromJson` throws.
|
|
781
|
+
*
|
|
782
|
+
* The storage version, not a field schema ([`schema`](Quill::schema) is the
|
|
783
|
+
* quill's field declarations). The JSON key is spelled `"schema"`: it is
|
|
784
|
+
* the DTO's serde tag, and retagging it would break the version dispatch
|
|
785
|
+
* it drives.
|
|
786
|
+
*/
|
|
787
|
+
static storageVersionOf(json: string): string | undefined;
|
|
728
788
|
/**
|
|
729
789
|
* Replace the opaque `$ext` map on the card `addr` targets (a card address,
|
|
730
790
|
* absent `card` = main). `value` must be a plain object. `$ext` carries
|
|
@@ -747,7 +807,7 @@ export class Document {
|
|
|
747
807
|
* shorthand for `{ field }`, so `doc.storeField("qty", 3)` reads as written;
|
|
748
808
|
* `{ card: 2, field: "qty" }` targets a composable card. Clears any
|
|
749
809
|
* `!must_fill` marker. A body address (no `field`) throws: a body is never
|
|
750
|
-
* opaque; write it with `revise` / `
|
|
810
|
+
* opaque; write it with `revise` / `overwrite` / `writer.reviseBody`. Throws on
|
|
751
811
|
* an out-of-range card or a malformed name.
|
|
752
812
|
*/
|
|
753
813
|
storeField(addr: Addr | string, value: any): void;
|
|
@@ -776,7 +836,7 @@ export class Document {
|
|
|
776
836
|
* cards of that kind spawn with. Quill-free and verbatim: an opaque `store`
|
|
777
837
|
* verb. Throws if `overlay` cannot be serialized or nests too deep.
|
|
778
838
|
*/
|
|
779
|
-
|
|
839
|
+
storeSeedOverlay(card_kind: string, overlay: any): void;
|
|
780
840
|
/**
|
|
781
841
|
* Serialize this document to a versioned storage DTO string.
|
|
782
842
|
*
|
|
@@ -857,8 +917,8 @@ export class Quill {
|
|
|
857
917
|
* ingestion path**, and the bound twin of the schema-free
|
|
858
918
|
* `Document.fromMarkdown`. The returned document rests at its canonical
|
|
859
919
|
* form (a `richtext` field as a content object, a `plaintext` field as its
|
|
860
|
-
* literal string), so `getStored`
|
|
861
|
-
*
|
|
920
|
+
* literal string), so `getStored` answers "content object or string?" by the
|
|
921
|
+
* field's declared codec rather than by how the document was built.
|
|
862
922
|
*
|
|
863
923
|
* Parse warnings and the `conform::*` diagnostics both land on
|
|
864
924
|
* `doc.warnings`. Throws on a parse failure, or when `markdown` declares a
|
|
@@ -975,17 +1035,12 @@ export function formatDocPath(segs: DocPathSeg[]): string;
|
|
|
975
1035
|
|
|
976
1036
|
/**
|
|
977
1037
|
* Import a markdown string to a canonical `Content` content: the pure,
|
|
978
|
-
* document-free codec. Pair with `
|
|
1038
|
+
* document-free codec. Pair with `overwrite(addr, importMarkdown(md))` to spell
|
|
979
1039
|
* the cold (anchor-losing) write at the call site; prefer `revise` for edit
|
|
980
1040
|
* semantics. Throws on an over-nested input.
|
|
981
1041
|
*/
|
|
982
1042
|
export function importMarkdown(markdown: string): Content;
|
|
983
1043
|
|
|
984
|
-
/**
|
|
985
|
-
* Initialize the WASM module with panic hooks for better error messages
|
|
986
|
-
*/
|
|
987
|
-
export function init(): void;
|
|
988
|
-
|
|
989
1044
|
/**
|
|
990
1045
|
* Map a base content position (a USV index into `Content.text`, not a UTF-16
|
|
991
1046
|
* offset) through a `delta` to its new USV position: the pure position-mapping
|
|
@@ -1013,3 +1068,122 @@ export function parseDocPath(path: string): DocPathSeg[];
|
|
|
1013
1068
|
* markdown input or a non-content `base`.
|
|
1014
1069
|
*/
|
|
1015
1070
|
export function rebase(base: Content, markdown: string): { content: Content; delta: Delta };
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Runs at instantiation (the wasm-bindgen start section): installs the panic
|
|
1074
|
+
* hook, so a Rust panic reaches the console as a stack trace rather than
|
|
1075
|
+
* `unreachable`.
|
|
1076
|
+
*
|
|
1077
|
+
* Not the package's `init`. That name belongs to the hand-written runtime,
|
|
1078
|
+
* which owns instantiation itself (`runtime/runtime.js`); this runs as part of
|
|
1079
|
+
* the instantiation it awaits.
|
|
1080
|
+
*/
|
|
1081
|
+
export function start(): void;
|
|
1082
|
+
|
|
1083
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
1084
|
+
|
|
1085
|
+
export interface InitOutput {
|
|
1086
|
+
readonly memory: WebAssembly.Memory;
|
|
1087
|
+
readonly __wbg_document_free: (a: number, b: number) => void;
|
|
1088
|
+
readonly __wbg_quill_free: (a: number, b: number) => void;
|
|
1089
|
+
readonly document__addCard: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
1090
|
+
readonly document__commitField: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1091
|
+
readonly document__commitFields: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1092
|
+
readonly document__readerGet: (a: number, b: number, c: number, d: number) => void;
|
|
1093
|
+
readonly document__readerGetContent: (a: number, b: number, c: number, d: number) => void;
|
|
1094
|
+
readonly document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1095
|
+
readonly document_applyChange: (a: number, b: number, c: number, d: number) => void;
|
|
1096
|
+
readonly document_blueprintInstruction: (a: number, b: number, c: number) => void;
|
|
1097
|
+
readonly document_bodyMarkdown: (a: number, b: number, c: number) => void;
|
|
1098
|
+
readonly document_card: (a: number, b: number, c: number) => void;
|
|
1099
|
+
readonly document_cardCount: (a: number) => number;
|
|
1100
|
+
readonly document_cards: (a: number, b: number) => void;
|
|
1101
|
+
readonly document_clone: (a: number) => number;
|
|
1102
|
+
readonly document_currentStorageVersion: (a: number) => void;
|
|
1103
|
+
readonly document_equals: (a: number, b: number) => number;
|
|
1104
|
+
readonly document_formatDiagnostic: (a: number, b: number) => void;
|
|
1105
|
+
readonly document_formatRules: (a: number) => void;
|
|
1106
|
+
readonly document_fromJson: (a: number, b: number, c: number) => void;
|
|
1107
|
+
readonly document_fromMarkdown: (a: number, b: number, c: number) => void;
|
|
1108
|
+
readonly document_getExt: (a: number, b: number, c: number) => void;
|
|
1109
|
+
readonly document_getExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1110
|
+
readonly document_getStored: (a: number, b: number, c: number) => void;
|
|
1111
|
+
readonly document_insertCard: (a: number, b: number, c: number, d: number) => void;
|
|
1112
|
+
readonly document_isFill: (a: number, b: number, c: number) => void;
|
|
1113
|
+
readonly document_loadJson: (a: number, b: number, c: number, d: number) => void;
|
|
1114
|
+
readonly document_main: (a: number, b: number) => void;
|
|
1115
|
+
readonly document_makeCard: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1116
|
+
readonly document_moveCard: (a: number, b: number, c: number, d: number) => void;
|
|
1117
|
+
readonly document_new: (a: number, b: number, c: number) => void;
|
|
1118
|
+
readonly document_overwrite: (a: number, b: number, c: number, d: number) => void;
|
|
1119
|
+
readonly document_quillRef: (a: number, b: number) => void;
|
|
1120
|
+
readonly document_quillRefHint: (a: number) => void;
|
|
1121
|
+
readonly document_removeCard: (a: number, b: number, c: number) => void;
|
|
1122
|
+
readonly document_removeExt: (a: number, b: number, c: number) => void;
|
|
1123
|
+
readonly document_removeExtNamespace: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1124
|
+
readonly document_removeField: (a: number, b: number, c: number) => void;
|
|
1125
|
+
readonly document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
1126
|
+
readonly document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1127
|
+
readonly document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
1128
|
+
readonly document_setCardKind: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1129
|
+
readonly document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
1130
|
+
readonly document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
1131
|
+
readonly document_storeExt: (a: number, b: number, c: number, d: number) => void;
|
|
1132
|
+
readonly document_storeExtNamespace: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1133
|
+
readonly document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
1134
|
+
readonly document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
1135
|
+
readonly document_storeFill: (a: number, b: number, c: number, d: number) => void;
|
|
1136
|
+
readonly document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1137
|
+
readonly document_toJson: (a: number, b: number) => void;
|
|
1138
|
+
readonly document_toMarkdown: (a: number, b: number) => void;
|
|
1139
|
+
readonly document_tryFromJson: (a: number, b: number) => number;
|
|
1140
|
+
readonly document_warnings: (a: number, b: number) => void;
|
|
1141
|
+
readonly exportMarkdown: (a: number, b: number) => void;
|
|
1142
|
+
readonly formatDocPath: (a: number, b: number) => void;
|
|
1143
|
+
readonly importMarkdown: (a: number, b: number, c: number) => void;
|
|
1144
|
+
readonly mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
1145
|
+
readonly parseDocPath: (a: number, b: number, c: number) => void;
|
|
1146
|
+
readonly quill_backendId: (a: number, b: number) => void;
|
|
1147
|
+
readonly quill_blueprint: (a: number, b: number) => void;
|
|
1148
|
+
readonly quill_conform: (a: number, b: number, c: number) => void;
|
|
1149
|
+
readonly quill_fromTree: (a: number, b: number) => void;
|
|
1150
|
+
readonly quill_metadata: (a: number, b: number) => void;
|
|
1151
|
+
readonly quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
1152
|
+
readonly quill_resolve: (a: number, b: number, c: number) => void;
|
|
1153
|
+
readonly quill_schema: (a: number, b: number) => void;
|
|
1154
|
+
readonly quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1155
|
+
readonly quill_seedDocument: (a: number) => number;
|
|
1156
|
+
readonly quill_seedMain: (a: number, b: number) => void;
|
|
1157
|
+
readonly quill_toTree: (a: number) => number;
|
|
1158
|
+
readonly quill_validate: (a: number, b: number, c: number) => void;
|
|
1159
|
+
readonly rebase: (a: number, b: number, c: number, d: number) => void;
|
|
1160
|
+
readonly start: () => void;
|
|
1161
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
1162
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
1163
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
1164
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
1165
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
1166
|
+
readonly __wbindgen_start: () => void;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
1173
|
+
* a precompiled `WebAssembly.Module`.
|
|
1174
|
+
*
|
|
1175
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
1176
|
+
*
|
|
1177
|
+
* @returns {InitOutput}
|
|
1178
|
+
*/
|
|
1179
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
1183
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
1184
|
+
*
|
|
1185
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
1186
|
+
*
|
|
1187
|
+
* @returns {Promise<InitOutput>}
|
|
1188
|
+
*/
|
|
1189
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|