@quillmark/wasm 0.133.0 → 0.134.1

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/core/wasm.js CHANGED
@@ -100,9 +100,9 @@ export class Document {
100
100
  /**
101
101
  * Batched twin of [`commitField`](Document::commit_field): typed-commit
102
102
  * several fields on the card `addr` targets atomically. `addr` is a **card
103
- * address** (absent = main; a present `field` throws). Same per-field
104
- * diagnostic contract as [`storeFields`](Document::store_fields) — nothing
105
- * applied on error, one `diagnostics` entry per offending field, including
103
+ * address** (absent = main; a present `field` throws). Nothing is
104
+ * applied on error, and the thrown error carries one `diagnostics` entry per
105
+ * offending field, including
106
106
  * `edit::unknown_field` for undeclared names. Throws on an out-of-range
107
107
  * card. Returns [`commitField`](Document::commit_field)'s warnings for
108
108
  * every field, in batch order.
@@ -127,6 +127,73 @@ export class Document {
127
127
  wasm.__wbindgen_add_to_stack_pointer(16);
128
128
  }
129
129
  }
130
+ /**
131
+ * The ABI under `writer.hashAt`: the body's hash, or a field's through its
132
+ * schema (a `richtext` field its content however it rests, a `text` field
133
+ * its literal text, any other type its stored value), the `baseHash` the
134
+ * writer's `reviseBody` / `reviseField` check. An undeclared name throws
135
+ * `edit::unknown_field`, an out-of-range card throws.
136
+ * @param {Quill} quill
137
+ * @param {Addr | string} addr
138
+ * @returns {string}
139
+ */
140
+ _hashAt(quill, addr) {
141
+ let deferred2_0;
142
+ let deferred2_1;
143
+ try {
144
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
145
+ _assertClass(quill, Quill);
146
+ wasm.document__hashAt(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr));
147
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
148
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
149
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
150
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
151
+ var ptr1 = r0;
152
+ var len1 = r1;
153
+ if (r3) {
154
+ ptr1 = 0; len1 = 0;
155
+ throw takeObject(r2);
156
+ }
157
+ deferred2_0 = ptr1;
158
+ deferred2_1 = len1;
159
+ return getStringFromWasm0(ptr1, len1);
160
+ } finally {
161
+ wasm.__wbindgen_add_to_stack_pointer(16);
162
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
163
+ }
164
+ }
165
+ /**
166
+ * The ABI under `writer.hash`: the hash of the document as `quill`
167
+ * conforms it, the `baseHash` `writer.reviseDocument` checks. Throws when
168
+ * the document declares a `$quill` this quill does not answer to.
169
+ * @param {Quill} quill
170
+ * @returns {string}
171
+ */
172
+ _hash(quill) {
173
+ let deferred2_0;
174
+ let deferred2_1;
175
+ try {
176
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
177
+ _assertClass(quill, Quill);
178
+ wasm.document__hash(retptr, this.__wbg_ptr, quill.__wbg_ptr);
179
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
180
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
181
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
182
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
183
+ var ptr1 = r0;
184
+ var len1 = r1;
185
+ if (r3) {
186
+ ptr1 = 0; len1 = 0;
187
+ throw takeObject(r2);
188
+ }
189
+ deferred2_0 = ptr1;
190
+ deferred2_1 = len1;
191
+ return getStringFromWasm0(ptr1, len1);
192
+ } finally {
193
+ wasm.__wbindgen_add_to_stack_pointer(16);
194
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
195
+ }
196
+ }
130
197
  /**
131
198
  * Interpreted **`Content`** read of a value nested inside the composite
132
199
  * field at `addr`: the stable ABI under the runtime `reader.getContentAt`,
@@ -249,15 +316,16 @@ export class Document {
249
316
  * does not answer to, before any mutation.
250
317
  * @param {Quill} quill
251
318
  * @param {string} markdown
319
+ * @param {any} opts
252
320
  * @returns {DocumentRevised}
253
321
  */
254
- _reviseDocument(quill, markdown) {
322
+ _reviseDocument(quill, markdown, opts) {
255
323
  try {
256
324
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
257
325
  _assertClass(quill, Quill);
258
326
  const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
259
327
  const len0 = WASM_VECTOR_LEN;
260
- wasm.document__reviseDocument(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0);
328
+ wasm.document__reviseDocument(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0, addHeapObject(opts));
261
329
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
262
330
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
263
331
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -284,15 +352,16 @@ export class Document {
284
352
  * @param {Quill} quill
285
353
  * @param {Addr | string} addr
286
354
  * @param {string} text
355
+ * @param {any} opts
287
356
  * @returns {Revised}
288
357
  */
289
- _reviseField(quill, addr, text) {
358
+ _reviseField(quill, addr, text, opts) {
290
359
  try {
291
360
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
292
361
  _assertClass(quill, Quill);
293
362
  const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
294
363
  const len0 = WASM_VECTOR_LEN;
295
- wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0);
364
+ wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0, addHeapObject(opts));
296
365
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
297
366
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
298
367
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -305,32 +374,166 @@ export class Document {
305
374
  }
306
375
  }
307
376
  /**
308
- * **Apply** a committed content edit `bundle` at `addr`, the editor splice:
309
- * text delta first, then island ops, then line ops, then mark ops (mark
310
- * ranges in final-text coordinates), all-or-nothing. An absent `addr.field`
311
- * targets the body, an absent `addr.card` the main card. The island channel
312
- * moves an island alone, so anchors elsewhere in the field survive an edit
313
- * `overwrite` would clear.
377
+ * The ABI under `writer.reviseBody`: **revise** the richtext value at
378
+ * `addr` from a markdown string. Imports the markdown, diffs it against the current
379
+ * value, rebases surviving identity anchors, and returns the `Revised`
380
+ * receipt: the text `delta` an editor bridge maps its own positions through,
381
+ * and a `parse::dropped_construct` warning per construct the
382
+ * import dropped, its `path` the address written. An absent `addr.field`
383
+ * targets the body, an absent `addr.card` the main card; an absent field
384
+ * cold-imports from empty.
314
385
  *
315
- * Throws on an out-of-range card, a field that is not richtext, a malformed
316
- * bundle, or an op that applies out of bounds; the value is unchanged on a
317
- * failed apply.
386
+ * `opts` names what the writer read (`BaseOptions`): a stale `baseHash`
387
+ * throws `edit::stale_base`, and a `baseMarkdown` the value has moved on
388
+ * from merges, throwing `edit::rebase_conflict` where both changed a line.
318
389
  *
319
- * Each text-moving channel rebases the marks already in the field, by the
320
- * rule on `ChangeBundle`; `mapMarks` answers where they land, so a caller
321
- * building `markOps` need not predict it.
390
+ * Throws on an out-of-range card, a malformed field name, a present
391
+ * non-content field value, or an over-nested markdown input.
322
392
  * @param {Addr | string} addr
323
- * @param {ChangeBundle} bundle
393
+ * @param {string} markdown
394
+ * @param {BaseOptions} [opts]
395
+ * @returns {Revised}
324
396
  */
325
- applyChange(addr, bundle) {
397
+ _revise(addr, markdown, opts) {
326
398
  try {
327
399
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
328
- wasm.document_applyChange(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(bundle));
400
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
401
+ const len0 = WASM_VECTOR_LEN;
402
+ wasm.document__revise(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0, addHeapObject(opts));
329
403
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
330
404
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
331
- if (r1) {
332
- throw takeObject(r0);
405
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
406
+ if (r2) {
407
+ throw takeObject(r1);
408
+ }
409
+ return takeObject(r0);
410
+ } finally {
411
+ wasm.__wbindgen_add_to_stack_pointer(16);
412
+ }
413
+ }
414
+ /**
415
+ * The context of the anchor `id`, or `undefined` where no body or
416
+ * content value holds one.
417
+ * @param {string} id
418
+ * @returns {AnchorContext | undefined}
419
+ */
420
+ anchorContext(id) {
421
+ try {
422
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
423
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
424
+ const len0 = WASM_VECTOR_LEN;
425
+ wasm.document_anchorContext(retptr, this.__wbg_ptr, ptr0, len0);
426
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
427
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
428
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
429
+ if (r2) {
430
+ throw takeObject(r1);
431
+ }
432
+ return takeObject(r0);
433
+ } finally {
434
+ wasm.__wbindgen_add_to_stack_pointer(16);
435
+ }
436
+ }
437
+ /**
438
+ * Every anchor of every body and content value with its context, a table
439
+ * cell's or a note's included, in the order `toAnnotatedMarkdown` lists
440
+ * anchors: the selector a host stores beside a comment thread and hands
441
+ * back to `reattach`.
442
+ * @returns {AnchorContext[]}
443
+ */
444
+ anchorContexts() {
445
+ try {
446
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
447
+ wasm.document_anchorContexts(retptr, this.__wbg_ptr);
448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
451
+ if (r2) {
452
+ throw takeObject(r1);
453
+ }
454
+ return takeObject(r0);
455
+ } finally {
456
+ wasm.__wbindgen_add_to_stack_pointer(16);
457
+ }
458
+ }
459
+ /**
460
+ * The annotated read of the body or richtext field at `addr` alone: the
461
+ * scoped twin of `toAnnotatedMarkdown`, what a revise at `addr` reads
462
+ * back and the `baseMarkdown` it merges against. Each anchor names `addr`'s
463
+ * path. An absent field reads as the empty content. Throws as `hashAt`.
464
+ * @param {Addr | string} addr
465
+ * @returns {AnnotatedMarkdown}
466
+ */
467
+ annotatedAt(addr) {
468
+ try {
469
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
470
+ wasm.document_annotatedAt(retptr, this.__wbg_ptr, addHeapObject(addr));
471
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
472
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
473
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
474
+ if (r2) {
475
+ throw takeObject(r1);
333
476
  }
477
+ return takeObject(r0);
478
+ } finally {
479
+ wasm.__wbindgen_add_to_stack_pointer(16);
480
+ }
481
+ }
482
+ /**
483
+ * The markdown at `addr` with a `qm-*` tag for each anchor and island id
484
+ * its lines can hold: what `revise` reads back. Throws as `read`.
485
+ * @param {Addr | string} addr
486
+ * @returns {string}
487
+ */
488
+ annotated(addr) {
489
+ let deferred2_0;
490
+ let deferred2_1;
491
+ try {
492
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
493
+ wasm.document_annotated(retptr, this.__wbg_ptr, addHeapObject(addr));
494
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
495
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
496
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
497
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
498
+ var ptr1 = r0;
499
+ var len1 = r1;
500
+ if (r3) {
501
+ ptr1 = 0; len1 = 0;
502
+ throw takeObject(r2);
503
+ }
504
+ deferred2_0 = ptr1;
505
+ deferred2_1 = len1;
506
+ return getStringFromWasm0(ptr1, len1);
507
+ } finally {
508
+ wasm.__wbindgen_add_to_stack_pointer(16);
509
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
510
+ }
511
+ }
512
+ /**
513
+ * **Apply** `change` to the value at `addr`, all its steps or none, and
514
+ * answer the `Receipt`. `opts.base` is the hash the writer read
515
+ * (`hash(addr)`), and the change's offsets are into the value it names:
516
+ * one the value has moved on from rebases the change over the change
517
+ * since, throwing `edit::rebase_conflict` where they touch the same text or
518
+ * record and `edit::stale_base` where the document no longer holds the change
519
+ * since. A refused change throws `edit::content_apply` and writes
520
+ * nothing.
521
+ * @param {Addr | string} addr
522
+ * @param {Change} change
523
+ * @param {WriteOptions} [opts]
524
+ * @returns {Receipt}
525
+ */
526
+ apply(addr, change, opts) {
527
+ try {
528
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
529
+ wasm.document_apply(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(change), addHeapObject(opts));
530
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
531
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
532
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
533
+ if (r2) {
534
+ throw takeObject(r1);
535
+ }
536
+ return takeObject(r0);
334
537
  } finally {
335
538
  wasm.__wbindgen_add_to_stack_pointer(16);
336
539
  }
@@ -442,11 +645,10 @@ export class Document {
442
645
  }
443
646
  /**
444
647
  * The newest storage version this build writes via
445
- * [`toStored`](Document::to_stored): a document spelling a font mark, a
446
- * `table` element, a merged table cell or a table head 0.130 cannot draw
447
- * carries it, every other the tag before it, which a 0.130 build reads.
448
- * The tag advances only when the wire format changes, not on every
449
- * release.
648
+ * [`toStored`](Document::to_stored): a document holding a composable
649
+ * card, each carrying its `$id`, carries it. A document of the main card
650
+ * alone carries the oldest tag that holds its content. The tag advances
651
+ * only when the wire format changes, not on every release.
450
652
  * @returns {string}
451
653
  */
452
654
  static currentStorageVersion() {
@@ -499,7 +701,7 @@ export class Document {
499
701
  }
500
702
  /**
501
703
  * Reconstruct a `Document` from a versioned storage DTO string produced by
502
- * [`toStored`](Document::to_stored). The result carries no parse-time warnings.
704
+ * [`toStored`](Document::to_stored), with no `warnings`.
503
705
  * Throws if `json` is not a valid storage DTO (malformed JSON, unknown
504
706
  * `schema`, missing fields, or unparseable quill reference).
505
707
  * @param {string} json
@@ -582,41 +784,85 @@ export class Document {
582
784
  }
583
785
  }
584
786
  /**
585
- * Insert a card: `at` absent appends, a number inserts at that index (in
586
- * `0..=cards.length`). Accepts any `CardInput`, including a card read back
587
- * out of a document. Throws if `card.kind` is not a valid kind name, if
588
- * `at` is out of range, or `edit::too_many_cards` if the document holds
589
- * 1,000 cards.
590
- * @param {CardInput} card
591
- * @param {number} [at]
787
+ * The hash of the body or richtext field at `addr`, the `baseHash` a
788
+ * revise at `addr` checks: the hash of its content, an absent field the
789
+ * empty content. An absent `addr.field` reads the body, an absent
790
+ * `addr.card` the main card. Richtext only; the
791
+ * typed `writer.hashAt` reads a field of any type through its schema.
792
+ * Throws on an out-of-range card, a malformed field name, or a present
793
+ * non-content field value.
794
+ * @param {Addr | string} addr
795
+ * @returns {string}
592
796
  */
593
- insertCard(card, at) {
797
+ hashAt(addr) {
798
+ let deferred2_0;
799
+ let deferred2_1;
594
800
  try {
595
801
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
596
- wasm.document_insertCard(retptr, this.__wbg_ptr, addHeapObject(card), isLikeNone(at) ? Number.MAX_SAFE_INTEGER : (at) >>> 0);
802
+ wasm.document_hashAt(retptr, this.__wbg_ptr, addHeapObject(addr));
597
803
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
598
804
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
599
- if (r1) {
600
- throw takeObject(r0);
805
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
806
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
807
+ var ptr1 = r0;
808
+ var len1 = r1;
809
+ if (r3) {
810
+ ptr1 = 0; len1 = 0;
811
+ throw takeObject(r2);
601
812
  }
813
+ deferred2_0 = ptr1;
814
+ deferred2_1 = len1;
815
+ return getStringFromWasm0(ptr1, len1);
602
816
  } finally {
603
817
  wasm.__wbindgen_add_to_stack_pointer(16);
818
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
604
819
  }
605
820
  }
606
821
  /**
607
- * Replace this document's contents **in place** from a versioned storage DTO
608
- * string: the mutating twin of [`fromStored`](Document::from_stored).
609
- * Parse-time `warnings` are cleared. Throws on an invalid DTO, leaving the
610
- * document unchanged. A caller holding the document need not re-bind its
611
- * variable.
612
- * @param {string} json
822
+ * With no `addr`, the hash of the document's stored form, the quill-free
823
+ * twin of `writer.hash()`: equal documents hash alike, whatever order a
824
+ * store kept their keys in. With one, the hash of the `Content` at
825
+ * `addr`, the `base` a write to it names. Throws as `read`.
826
+ * @param {Addr | string} [addr]
827
+ * @returns {string}
613
828
  */
614
- loadStored(json) {
829
+ hash(addr) {
830
+ let deferred2_0;
831
+ let deferred2_1;
615
832
  try {
616
833
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
617
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
618
- const len0 = WASM_VECTOR_LEN;
619
- wasm.document_loadStored(retptr, this.__wbg_ptr, ptr0, len0);
834
+ wasm.document_hash(retptr, this.__wbg_ptr, addHeapObject(addr));
835
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
836
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
837
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
838
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
839
+ var ptr1 = r0;
840
+ var len1 = r1;
841
+ if (r3) {
842
+ ptr1 = 0; len1 = 0;
843
+ throw takeObject(r2);
844
+ }
845
+ deferred2_0 = ptr1;
846
+ deferred2_1 = len1;
847
+ return getStringFromWasm0(ptr1, len1);
848
+ } finally {
849
+ wasm.__wbindgen_add_to_stack_pointer(16);
850
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
851
+ }
852
+ }
853
+ /**
854
+ * Insert a card: `at` absent appends, a number inserts at that index (in
855
+ * `0..=cards.length`). Accepts any `CardInput`, including a card read back
856
+ * out of a document. Throws if `card.kind` is not a valid kind name, if
857
+ * `at` is out of range, or `edit::too_many_cards` if the document holds
858
+ * 1,000 cards.
859
+ * @param {CardInput} card
860
+ * @param {number} [at]
861
+ */
862
+ insertCard(card, at) {
863
+ try {
864
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
865
+ wasm.document_insertCard(retptr, this.__wbg_ptr, addHeapObject(card), isLikeNone(at) ? Number.MAX_SAFE_INTEGER : (at) >>> 0);
620
866
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
621
867
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
622
868
  if (r1) {
@@ -645,27 +891,6 @@ export class Document {
645
891
  wasm.__wbindgen_add_to_stack_pointer(16);
646
892
  }
647
893
  }
648
- /**
649
- * The Quillmark Markdown rules, re-exposed from core. Constant across
650
- * calls; read once and cache.
651
- * @returns {string}
652
- */
653
- static markdownRules() {
654
- let deferred1_0;
655
- let deferred1_1;
656
- try {
657
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
658
- wasm.document_markdownRules(retptr);
659
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
660
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
661
- deferred1_0 = r0;
662
- deferred1_1 = r1;
663
- return getStringFromWasm0(r0, r1);
664
- } finally {
665
- wasm.__wbindgen_add_to_stack_pointer(16);
666
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
667
- }
668
- }
669
894
  /**
670
895
  * Move the card at `from` to position `to`. `from == to` is a no-op.
671
896
  * @param {number} from
@@ -711,32 +936,6 @@ export class Document {
711
936
  wasm.__wbindgen_add_to_stack_pointer(16);
712
937
  }
713
938
  }
714
- /**
715
- * **Overwrite** the content value at `addr` with exactly `rt`: value
716
- * semantics, so the identity anchors of any previous value are gone. By
717
- * anchor fate `overwrite` destroys, [`revise`](Document::revise) and
718
- * [`reviseContent`](Document::revise_content) rebase, and
719
- * [`applyChange`](Document::apply_change) preserves. An absent
720
- * `addr.field` targets the body, an absent `addr.card` the main card.
721
- *
722
- * Throws on an out-of-range card, a malformed field name, or an `rt` that is
723
- * not a canonical content object.
724
- * @param {Addr | string} addr
725
- * @param {Content} rt
726
- */
727
- overwrite(addr, rt) {
728
- try {
729
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
730
- wasm.document_overwrite(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(rt));
731
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
732
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
733
- if (r1) {
734
- throw takeObject(r0);
735
- }
736
- } finally {
737
- wasm.__wbindgen_add_to_stack_pointer(16);
738
- }
739
- }
740
939
  /**
741
940
  * `addr`'s canonical `DocPath` string, the anchor `Diagnostic.path` carries:
742
941
  * `pathFor()` is `main.body`, `pathFor("intro")` `main.intro`,
@@ -750,7 +949,7 @@ export class Document {
750
949
  * **Total on the index axis**, unlike the `Addr` reads, which throw there:
751
950
  * an out-of-range `{card: 7, field: "from"}` renders `cards[7].from`, which
752
951
  * parses back and resolves to nothing rather than mis-targeting. Only a
753
- * malformed address throws.
952
+ * malformed address throws, or a card id no card holds.
754
953
  * @param {Addr | string} addr
755
954
  * @returns {string}
756
955
  */
@@ -819,6 +1018,65 @@ export class Document {
819
1018
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
820
1019
  }
821
1020
  }
1021
+ /**
1022
+ * The `Content` at `addr`: an absent `addr.field` reads the body, an
1023
+ * absent `addr.card` the main card, and an absent field the empty
1024
+ * content. Throws on an out-of-range card, a malformed field name, or a
1025
+ * present field value that is not content.
1026
+ * @param {Addr | string} addr
1027
+ * @returns {Content}
1028
+ */
1029
+ read(addr) {
1030
+ try {
1031
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1032
+ wasm.document_read(retptr, this.__wbg_ptr, addHeapObject(addr));
1033
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1034
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1035
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1036
+ if (r2) {
1037
+ throw takeObject(r1);
1038
+ }
1039
+ return takeObject(r0);
1040
+ } finally {
1041
+ wasm.__wbindgen_add_to_stack_pointer(16);
1042
+ }
1043
+ }
1044
+ /**
1045
+ * Re-add anchors a write dropped, each at the `path` its selector names,
1046
+ * where its `quote` is found exactly once with its context agreeing: four
1047
+ * scalar values of quote or more, or a table's slot alone, eight of
1048
+ * context on each side or the whole context where the value's edge cut
1049
+ * it, and an empty quote a point where the two meet. Never a nearest match. Returns the `Reattached`
1050
+ * receipt.
1051
+ *
1052
+ * A path naming no body or content value orphans its selector, and
1053
+ * nothing remaps a card index. An id live anywhere in the document, a
1054
+ * table cell's included, is answered as reattached and not written. Each
1055
+ * id is answered once, by its first selector. `deltas` maps a path to the
1056
+ * `delta` of the revise that dropped its anchors, and a match there must
1057
+ * overlap text that revise inserted.
1058
+ *
1059
+ * Throws on a selector or delta that is not one, or a `path` that does
1060
+ * not parse.
1061
+ * @param {AnchorContext[]} selectors
1062
+ * @param {Record<string, Delta>} [deltas]
1063
+ * @returns {Reattached}
1064
+ */
1065
+ reattach(selectors, deltas) {
1066
+ try {
1067
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1068
+ wasm.document_reattach(retptr, this.__wbg_ptr, addHeapObject(selectors), addHeapObject(deltas));
1069
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1070
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1071
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1072
+ if (r2) {
1073
+ throw takeObject(r1);
1074
+ }
1075
+ return takeObject(r0);
1076
+ } finally {
1077
+ wasm.__wbindgen_add_to_stack_pointer(16);
1078
+ }
1079
+ }
822
1080
  /**
823
1081
  * @param {number} index
824
1082
  * @returns {Card | undefined}
@@ -906,28 +1164,19 @@ export class Document {
906
1164
  }
907
1165
  }
908
1166
  /**
909
- * **Revise** the richtext value at `addr` to `rt`, keeping each stored prose
910
- * anchor whose id `rt` does not hold: the content twin of
911
- * [`revise`](Document::revise), for a value built elsewhere such as a
912
- * merge's projection. Diffs `rt` against the current value, carries those
913
- * anchors through the diff, and returns the
914
- * `Revised` receipt, whose `delta` an editor bridge maps its own positions
915
- * through and whose `warnings` is empty. `rt`'s own anchors and island ids
916
- * land as they are. An absent `addr.field` targets the body, an absent
917
- * `addr.card` the main card; an absent field diffs from empty. Richtext
918
- * only: a `text` field takes `overwrite`.
919
- *
920
- * Throws on an out-of-range card, a malformed field name, a present
921
- * non-content field value, or an `rt` that is not a canonical content
922
- * object.
1167
+ * Write `content` over the value at `addr`, carrying each anchor it does
1168
+ * not name where a diff keeps its text and reporting the rest in
1169
+ * `droppedAnchors`. Throws as `apply`, and on a `content` that is not a
1170
+ * `Content`.
923
1171
  * @param {Addr | string} addr
924
- * @param {Content} rt
925
- * @returns {Revised}
1172
+ * @param {Content} content
1173
+ * @param {WriteOptions} [opts]
1174
+ * @returns {Receipt}
926
1175
  */
927
- reviseContent(addr, rt) {
1176
+ replace(addr, content, opts) {
928
1177
  try {
929
1178
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
930
- wasm.document_reviseContent(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(rt));
1179
+ wasm.document_replace(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(content), addHeapObject(opts));
931
1180
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
932
1181
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
933
1182
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -940,27 +1189,22 @@ export class Document {
940
1189
  }
941
1190
  }
942
1191
  /**
943
- * **Revise** the richtext value at `addr` from a markdown string: the
944
- * default write path. Imports the markdown, diffs it against the current
945
- * value, rebases surviving identity anchors, and returns the `Revised`
946
- * receipt: the text `delta` an editor bridge maps its own positions through
947
- * (`mapPos`), and a `parse::dropped_construct` warning per construct the
948
- * import dropped, its `path` the address written. An absent `addr.field`
949
- * targets the body, an absent `addr.card` the main card; an absent field
950
- * cold-imports from empty.
951
- *
952
- * Throws on an out-of-range card, a malformed field name, a present
953
- * non-content field value, or an over-nested markdown input.
1192
+ * Rewrite the value at `addr` as `markdown`: the anchors and islands
1193
+ * whose `qm-*` tags it keeps (`annotated(addr)` spells them) stay put,
1194
+ * and the rest keeps what a word-aligned diff keeps. Answers the
1195
+ * `Receipt`, its `warnings` the import's. Throws as `apply`, and on an
1196
+ * over-nested markdown input.
954
1197
  * @param {Addr | string} addr
955
1198
  * @param {string} markdown
956
- * @returns {Revised}
1199
+ * @param {WriteOptions} [opts]
1200
+ * @returns {Receipt}
957
1201
  */
958
- revise(addr, markdown) {
1202
+ revise(addr, markdown, opts) {
959
1203
  try {
960
1204
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
961
1205
  const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
962
1206
  const len0 = WASM_VECTOR_LEN;
963
- wasm.document_revise(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
1207
+ wasm.document_revise(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0, addHeapObject(opts));
964
1208
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
965
1209
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
966
1210
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1070,7 +1314,7 @@ export class Document {
1070
1314
  * write is [`commitField`](Document::commit_field). A bare string is `Addr`
1071
1315
  * shorthand for `{ field }`; `{ card: 2, field: "qty" }` targets a
1072
1316
  * composable card. A body address throws:
1073
- * write a body with `revise` / `overwrite`. Throws on an out-of-range card
1317
+ * write a body with `writer.reviseBody` / `replace`. Throws on an out-of-range card
1074
1318
  * or a malformed name.
1075
1319
  * @param {Addr | string} addr
1076
1320
  * @param {any} value
@@ -1088,28 +1332,6 @@ export class Document {
1088
1332
  wasm.__wbindgen_add_to_stack_pointer(16);
1089
1333
  }
1090
1334
  }
1091
- /**
1092
- * Store several fields verbatim and atomically on the card `addr` targets.
1093
- * `addr` is a **card address** (`{ card }`, absent = main) and comes first
1094
- * because `card` is itself a legal field name; a present `field` throws.
1095
- * Nothing is applied on error, and the thrown error's `diagnostics` carry
1096
- * one entry per offending field. Throws on an out-of-range card.
1097
- * @param {CardAddr} addr
1098
- * @param {Record<string, unknown>} fields
1099
- */
1100
- storeFields(addr, fields) {
1101
- try {
1102
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1103
- wasm.document_storeFields(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
1104
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1105
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1106
- if (r1) {
1107
- throw takeObject(r0);
1108
- }
1109
- } finally {
1110
- wasm.__wbindgen_add_to_stack_pointer(16);
1111
- }
1112
- }
1113
1335
  /**
1114
1336
  * Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
1115
1337
  * under `cardKind`, preserving sibling kinds; `$seed` is main-only, so this
@@ -1135,10 +1357,11 @@ export class Document {
1135
1357
  }
1136
1358
  /**
1137
1359
  * `toMarkdown` with each prose anchor of every body and content field
1138
- * spelled read-only at its start where its line can hold the tag, and
1139
- * listed with its field's path and line either way. An import drops every
1140
- * tag, so `writer.reviseDocument` with the markdown keeps the anchors it keeps
1141
- * with `toMarkdown`'s.
1360
+ * spelled at its start where its line can hold the tag, every anchor,
1361
+ * a cell's too, listed with its field's path and line, and each island whose markdown
1362
+ * does not read back spelled as its token. `writer.reviseDocument` reads
1363
+ * both back: a kept tag pins its anchor, and a token keeps its island as
1364
+ * stored.
1142
1365
  * @returns {AnnotatedMarkdown}
1143
1366
  */
1144
1367
  toAnnotatedMarkdown() {
@@ -1206,7 +1429,8 @@ export class Document {
1206
1429
  * The non-fatal diagnostics of the load that produced this document: parse
1207
1430
  * warnings, plus `conform::*` warnings when it came through `quill.parse`.
1208
1431
  * Session state, not document value: `equals` and the storage DTO exclude
1209
- * it, and `fromStored` / `loadStored` / `writer.reviseDocument` clear it.
1432
+ * it. `fromStored` sets it to the stored value's anchor id
1433
+ * collisions, and `writer.reviseDocument` clears it.
1210
1434
  * @returns {Diagnostic[]}
1211
1435
  */
1212
1436
  get warnings() {
@@ -1555,26 +1779,6 @@ export class Quill {
1555
1779
  const ret = wasm.quill_seedDocument(this.__wbg_ptr);
1556
1780
  return Document.__wrap(ret);
1557
1781
  }
1558
- /**
1559
- * Seed a starter main `Card` (carries `$quill`) from the schema: the
1560
- * `$kind: main` card of [`seedDocument`](Self::seed_document) alone.
1561
- * @returns {Card}
1562
- */
1563
- seedMain() {
1564
- try {
1565
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1566
- wasm.quill_seedMain(retptr, this.__wbg_ptr);
1567
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1568
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1569
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1570
- if (r2) {
1571
- throw takeObject(r1);
1572
- }
1573
- return takeObject(r0);
1574
- } finally {
1575
- wasm.__wbindgen_add_to_stack_pointer(16);
1576
- }
1577
- }
1578
1782
  /**
1579
1783
  * `doc` as an authoring document: every field in the values form (each
1580
1784
  * content leaf its codec's text), every body as Markdown, each card
@@ -1684,6 +1888,55 @@ export class Quill {
1684
1888
  }
1685
1889
  if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
1686
1890
 
1891
+ /**
1892
+ * Deleting `[start, end)`: the splice, and where the range runs from a
1893
+ * block's start into a later block, the `setBlock` giving the block that
1894
+ * keeps the text the shape of the block the range ends in.
1895
+ * @param {Content} content
1896
+ * @param {number} start
1897
+ * @param {number} end
1898
+ * @returns {Change}
1899
+ */
1900
+ export function deleteRange(content, start, end) {
1901
+ try {
1902
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1903
+ wasm.deleteRange(retptr, addHeapObject(content), start, end);
1904
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1905
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1906
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1907
+ if (r2) {
1908
+ throw takeObject(r1);
1909
+ }
1910
+ return takeObject(r0);
1911
+ } finally {
1912
+ wasm.__wbindgen_add_to_stack_pointer(16);
1913
+ }
1914
+ }
1915
+
1916
+ /**
1917
+ * A change taking `before` to `after`, word-aligned, for a writer with no
1918
+ * steps of its own. Throws `edit::content_apply` where `after` is not a
1919
+ * valid value.
1920
+ * @param {Content} before
1921
+ * @param {Content} after
1922
+ * @returns {Change}
1923
+ */
1924
+ export function diff(before, after) {
1925
+ try {
1926
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1927
+ wasm.diff(retptr, addHeapObject(before), addHeapObject(after));
1928
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1929
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1930
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1931
+ if (r2) {
1932
+ throw takeObject(r1);
1933
+ }
1934
+ return takeObject(r0);
1935
+ } finally {
1936
+ wasm.__wbindgen_add_to_stack_pointer(16);
1937
+ }
1938
+ }
1939
+
1687
1940
  /**
1688
1941
  * Export canonical `Content` to its markdown projection. Throws if `rt` is not
1689
1942
  * canonical content.
@@ -1786,10 +2039,10 @@ export function formatDocPath(segs) {
1786
2039
  }
1787
2040
 
1788
2041
  /**
1789
- * Import a markdown string: the pure, document-free codec. Returns the
2042
+ * Import a markdown string: the markdown codec's import, pure and document-free. Returns the
1790
2043
  * canonical `content` and a `parse::dropped_construct` warning per construct
1791
- * the import dropped, with no `path`. `overwrite(addr, importMarkdown(md).content)`
1792
- * spells the cold, anchor-losing write; prefer `revise` for edit semantics.
2044
+ * the import dropped, with no `path`. `replace(addr, importMarkdown(md).content)`
2045
+ * spells the cold write; prefer `revise` for edit semantics.
1793
2046
  * Throws on an over-nested input.
1794
2047
  * @param {string} markdown
1795
2048
  * @returns {Imported}
@@ -1812,6 +2065,83 @@ export function importMarkdown(markdown) {
1812
2065
  }
1813
2066
  }
1814
2067
 
2068
+ /**
2069
+ * Tab over the blocks `first` to `last` (`first` alone when absent): the
2070
+ * change nesting their items under the item before them. Throws
2071
+ * `edit::content_apply` where `first` is in no item, the range leaves its
2072
+ * list, or its first item is the list's first.
2073
+ * @param {Content} content
2074
+ * @param {string} first
2075
+ * @param {string | null} [last]
2076
+ * @returns {Change}
2077
+ */
2078
+ export function indent(content, first, last) {
2079
+ try {
2080
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2081
+ const ptr0 = passStringToWasm0(first, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2082
+ const len0 = WASM_VECTOR_LEN;
2083
+ var ptr1 = isLikeNone(last) ? 0 : passStringToWasm0(last, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2084
+ var len1 = WASM_VECTOR_LEN;
2085
+ wasm.indent(retptr, addHeapObject(content), ptr0, len0, ptr1, len1);
2086
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2087
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2088
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2089
+ if (r2) {
2090
+ throw takeObject(r1);
2091
+ }
2092
+ return takeObject(r0);
2093
+ } finally {
2094
+ wasm.__wbindgen_add_to_stack_pointer(16);
2095
+ }
2096
+ }
2097
+
2098
+ /**
2099
+ * Typing at `at`: the formatting the typed text carries, for a splice's
2100
+ * `marks`, in canonical order. Throws `edit::content_apply` where `at` is
2101
+ * past the text.
2102
+ * @param {Content} content
2103
+ * @param {number} at
2104
+ * @returns {ContentMarkKind[]}
2105
+ */
2106
+ export function inheritedMarks(content, at) {
2107
+ try {
2108
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2109
+ wasm.inheritedMarks(retptr, addHeapObject(content), at);
2110
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2111
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2112
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2113
+ if (r2) {
2114
+ throw takeObject(r1);
2115
+ }
2116
+ return takeObject(r0);
2117
+ } finally {
2118
+ wasm.__wbindgen_add_to_stack_pointer(16);
2119
+ }
2120
+ }
2121
+
2122
+ /**
2123
+ * The change that undoes `change` on `before`. Throws `edit::content_apply`
2124
+ * where `change` does not apply to `before`.
2125
+ * @param {Change} change
2126
+ * @param {Content} before
2127
+ * @returns {Change}
2128
+ */
2129
+ export function invert(change, before) {
2130
+ try {
2131
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2132
+ wasm.invert(retptr, addHeapObject(change), addHeapObject(before));
2133
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2134
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2135
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2136
+ if (r2) {
2137
+ throw takeObject(r1);
2138
+ }
2139
+ return takeObject(r0);
2140
+ } finally {
2141
+ wasm.__wbindgen_add_to_stack_pointer(16);
2142
+ }
2143
+ }
2144
+
1815
2145
  /**
1816
2146
  * Whether `content` satisfies the one-line constraint of `text` and
1817
2147
  * `richtext`: one `Para` line, in no container, with no islands. Judged on
@@ -1861,26 +2191,19 @@ export function isPlain(content) {
1861
2191
  }
1862
2192
 
1863
2193
  /**
1864
- * Where `bundle`'s text-moving channels (`delta`, then `islandOps`, then
1865
- * `lineOps`) leave `content`'s marks: the final-text coordinates the bundle's
1866
- * `markOps` are written in, under the rebase rule stated on `ChangeBundle`.
1867
- * The document-free read an editor diffs against to decide which `markOps` to
1868
- * emit, rather than reproducing that rule in its own language.
1869
- *
1870
- * `bundle.markOps` are ignored. The answer is normalized, as the store's is:
1871
- * marks a text move drops (out of range, zero-width formatting) are absent,
1872
- * and same-kind runs a move left adjacent arrive already unioned, so a bundle
1873
- * carrying no `markOps` names the marks the field will hold.
1874
- * Throws on a non-content `content`, a malformed bundle, or an op that applies
1875
- * out of bounds: `applyChange`'s errors on the same ops.
2194
+ * Backspace at the start of block `id`: the change joining it onto the block
2195
+ * before it, under that block's record. Throws `edit::content_apply` for the
2196
+ * first block or an id no block holds.
1876
2197
  * @param {Content} content
1877
- * @param {ChangeBundle} bundle
1878
- * @returns {ContentMark[]}
2198
+ * @param {string} id
2199
+ * @returns {Change}
1879
2200
  */
1880
- export function mapMarks(content, bundle) {
2201
+ export function joinBlocks(content, id) {
1881
2202
  try {
1882
2203
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1883
- wasm.mapMarks(retptr, addHeapObject(content), addHeapObject(bundle));
2204
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2205
+ const len0 = WASM_VECTOR_LEN;
2206
+ wasm.joinBlocks(retptr, addHeapObject(content), ptr0, len0);
1884
2207
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1885
2208
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1886
2209
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1894,39 +2217,35 @@ export function mapMarks(content, bundle) {
1894
2217
  }
1895
2218
 
1896
2219
  /**
1897
- * Map a base content position (a USV index into `Content.text`, not a UTF-16
1898
- * offset) through a `delta` to its new position, holding a caret stable across
1899
- * a `revise`. `assoc` decides the side of a same-position insertion (`"after"`
1900
- * moves past it). Throws on a malformed `delta`.
1901
- *
1902
- * This maps a position the *caller* holds. For the marks already in a field,
1903
- * `mapMarks` applies the store's own assoc rule across every channel of a
1904
- * `ChangeBundle`.
1905
- * @param {Delta} delta
1906
- * @param {number} pos
1907
- * @param {Assoc} assoc
1908
- * @returns {number}
2220
+ * Where `pos` lands after `change`, and what around it the change deleted;
2221
+ * `assoc` (`"after"` by default) picks the side of text inserted at it.
2222
+ * Throws `edit::content_apply` where a splice deletes an island and names
2223
+ * none in `removed`, as the receipt's `applied` always does.
2224
+ * @param {Change} change
2225
+ * @param {Pos} pos
2226
+ * @param {"before" | "after"} [assoc]
2227
+ * @returns {MapResult}
1909
2228
  */
1910
- export function mapPos(delta, pos, assoc) {
2229
+ export function mapPos(change, pos, assoc) {
1911
2230
  try {
1912
2231
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1913
- wasm.mapPos(retptr, addHeapObject(delta), pos, addHeapObject(assoc));
2232
+ wasm.mapPos(retptr, addHeapObject(change), addHeapObject(pos), addHeapObject(assoc));
1914
2233
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1915
2234
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1916
2235
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1917
2236
  if (r2) {
1918
2237
  throw takeObject(r1);
1919
2238
  }
1920
- return r0 >>> 0;
2239
+ return takeObject(r0);
1921
2240
  } finally {
1922
2241
  wasm.__wbindgen_add_to_stack_pointer(16);
1923
2242
  }
1924
2243
  }
1925
2244
 
1926
2245
  /**
1927
- * The canonical form of `rt`: the content `overwrite` stores from it, read
2246
+ * The canonical form of `rt`: the content `replace` stores from it, read
1928
2247
  * without a document. Normalizing rewrites structure, never the text, so the
1929
- * answer's `text` is `rt.text`. Throws where `overwrite` would, with the same
2248
+ * answer's `text` is `rt.text`. Throws where `replace` would, with the same
1930
2249
  * error under this verb's name.
1931
2250
  * @param {Content} rt
1932
2251
  * @returns {Content}
@@ -1947,6 +2266,36 @@ export function normalize(rt) {
1947
2266
  }
1948
2267
  }
1949
2268
 
2269
+ /**
2270
+ * Shift-Tab over the blocks `first` to `last` (`first` alone when absent):
2271
+ * the change lifting them out of the innermost item or quote holding
2272
+ * `first`. Throws `edit::content_apply` where `first` is in neither or the
2273
+ * range leaves it.
2274
+ * @param {Content} content
2275
+ * @param {string} first
2276
+ * @param {string | null} [last]
2277
+ * @returns {Change}
2278
+ */
2279
+ export function outdent(content, first, last) {
2280
+ try {
2281
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2282
+ const ptr0 = passStringToWasm0(first, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2283
+ const len0 = WASM_VECTOR_LEN;
2284
+ var ptr1 = isLikeNone(last) ? 0 : passStringToWasm0(last, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2285
+ var len1 = WASM_VECTOR_LEN;
2286
+ wasm.outdent(retptr, addHeapObject(content), ptr0, len0, ptr1, len1);
2287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2289
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2290
+ if (r2) {
2291
+ throw takeObject(r1);
2292
+ }
2293
+ return takeObject(r0);
2294
+ } finally {
2295
+ wasm.__wbindgen_add_to_stack_pointer(16);
2296
+ }
2297
+ }
2298
+
1950
2299
  /**
1951
2300
  * Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
1952
2301
  * `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
@@ -1974,21 +2323,43 @@ export function parseDocPath(path) {
1974
2323
  }
1975
2324
 
1976
2325
  /**
1977
- * Rebase `markdown` onto a `base` content: the document-free twin of `revise`,
1978
- * returning the new `content`, the text `delta` (offsets are USV indices into
1979
- * `Content.text`, surviving anchors rebased), and the import's
1980
- * `parse::dropped_construct` warnings, with no `path`. Throws on an
1981
- * over-nested markdown input or a non-content `base`.
1982
- * @param {Content} base
1983
- * @param {string} markdown
1984
- * @returns {{ content: Content; delta: Delta; warnings: Diagnostic[] }}
2326
+ * The valid value every peer holding the merged state `raw` reads, and what
2327
+ * was mended to reach it: total and deterministic, every id it mints derived
2328
+ * from the ids involved. Throws only on a `raw` not shaped as content.
2329
+ * @param {RawContent} raw
2330
+ * @returns {Repaired}
1985
2331
  */
1986
- export function rebase(base, markdown) {
2332
+ export function repair(raw) {
1987
2333
  try {
1988
2334
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1989
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2335
+ wasm.repair(retptr, addHeapObject(raw));
2336
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2337
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2338
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2339
+ if (r2) {
2340
+ throw takeObject(r1);
2341
+ }
2342
+ return takeObject(r0);
2343
+ } finally {
2344
+ wasm.__wbindgen_add_to_stack_pointer(16);
2345
+ }
2346
+ }
2347
+
2348
+ /**
2349
+ * Enter at `at`: the change splitting the block holding `at` there, the new
2350
+ * block `newId` and the text keeping its id. Throws `edit::content_apply`
2351
+ * where `at` is past the text.
2352
+ * @param {Content} content
2353
+ * @param {number} at
2354
+ * @param {string} newId
2355
+ * @returns {Change}
2356
+ */
2357
+ export function splitBlock(content, at, newId) {
2358
+ try {
2359
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2360
+ const ptr0 = passStringToWasm0(newId, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1990
2361
  const len0 = WASM_VECTOR_LEN;
1991
- wasm.rebase(retptr, addHeapObject(base), ptr0, len0);
2362
+ wasm.splitBlock(retptr, addHeapObject(content), at, ptr0, len0);
1992
2363
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1993
2364
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1994
2365
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2009,6 +2380,36 @@ export function rebase(base, markdown) {
2009
2380
  export function start() {
2010
2381
  wasm.start();
2011
2382
  }
2383
+
2384
+ /**
2385
+ * The change wrapping the blocks `first` to `last` in a quote or a list,
2386
+ * around the children of their innermost shared item or quote that the range
2387
+ * touches; a list the range sits in is wrapped whole.
2388
+ * @param {Content} content
2389
+ * @param {string} first
2390
+ * @param {string} last
2391
+ * @param {WrapKind} kind
2392
+ * @returns {Change}
2393
+ */
2394
+ export function wrap(content, first, last, kind) {
2395
+ try {
2396
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2397
+ const ptr0 = passStringToWasm0(first, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2398
+ const len0 = WASM_VECTOR_LEN;
2399
+ const ptr1 = passStringToWasm0(last, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2400
+ const len1 = WASM_VECTOR_LEN;
2401
+ wasm.wrap(retptr, addHeapObject(content), ptr0, len0, ptr1, len1, addHeapObject(kind));
2402
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2403
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2404
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2405
+ if (r2) {
2406
+ throw takeObject(r1);
2407
+ }
2408
+ return takeObject(r0);
2409
+ } finally {
2410
+ wasm.__wbindgen_add_to_stack_pointer(16);
2411
+ }
2412
+ }
2012
2413
  function __wbg_get_imports() {
2013
2414
  const import0 = {
2014
2415
  __proto__: null,
@@ -2146,6 +2547,10 @@ function __wbg_get_imports() {
2146
2547
  const ret = Reflect.getPrototypeOf(getObject(arg0));
2147
2548
  return addHeapObject(ret);
2148
2549
  }, arguments); },
2550
+ __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
2551
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
2552
+ return addHeapObject(ret);
2553
+ }, arguments); },
2149
2554
  __wbg_get_658f6698067d9515: function() { return handleError(function (arg0, arg1) {
2150
2555
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
2151
2556
  return addHeapObject(ret);
@@ -2162,6 +2567,10 @@ function __wbg_get_imports() {
2162
2567
  const ret = getObject(arg0)[getObject(arg1)];
2163
2568
  return addHeapObject(ret);
2164
2569
  },
2570
+ __wbg_has_5d6706e5209576c1: function() { return handleError(function (arg0, arg1) {
2571
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
2572
+ return ret;
2573
+ }, arguments); },
2165
2574
  __wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
2166
2575
  let result;
2167
2576
  try {