@quillmark/svelte 0.34.0 → 0.35.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.
@@ -1,15 +1,14 @@
1
1
  <!--
2
2
  The review items a container hands to one of its places, drawn under that place's control:
3
- a proposal as the value that would go and the value that would come with its two answers, an
4
- accepted one as the line a changed field's control carries along its foot. An item naming a
5
- place deeper than the control under which it is drawn, which no control of its own draws,
6
- leads with where it is: the cells and members between, by name and number.
3
+ each a proposal, as the value that would go and the value that would come with its two
4
+ answers. An item naming a place deeper than the control under which it is drawn, which no
5
+ control of its own draws, leads with where it is: the cells and members between, by name and
6
+ number.
7
7
  -->
8
8
  <script lang="ts">
9
9
  import type { PathStep } from '@quillmark/wasm';
10
10
  import ReviewProposal from './ReviewProposal.svelte';
11
- import { isChange, valueIn, type DeepReview } from './review.js';
12
- import { review } from './review.svelte.js';
11
+ import { valueIn, type DeepReview } from './review.js';
13
12
  import { wording } from './strings.js';
14
13
  import { humanize } from './structure.js';
15
14
 
@@ -23,7 +22,6 @@
23
22
  let { entries, value, member = false }: Props = $props();
24
23
 
25
24
  const t = wording();
26
- const reviewing = review();
27
25
 
28
26
  const where = (steps: readonly PathStep[]): string | undefined =>
29
27
  steps.length
@@ -36,33 +34,10 @@
36
34
  </script>
37
35
 
38
36
  {#each entries ?? [] as { steps, item } (item.id)}
39
- {#if !isChange(item)}
40
- <ReviewProposal
41
- {item}
42
- value={valueIn(value, steps)}
43
- label={where(steps)}
44
- removes={item.after === undefined &&
45
- (steps.length ? typeof steps.at(-1) === 'number' : member)}
46
- />
47
- {:else}
48
- <!-- svelte-ignore a11y_no_static_element_interactions -->
49
- <div
50
- class={['qm-review-line', { 'qm-review-lit': reviewing.lit === item.id }]}
51
- data-qm-review={item.id}
52
- onpointerenter={() => reviewing.point(item.id, 'pointer')}
53
- onpointerleave={() => reviewing.point(undefined, 'pointer')}
54
- ></div>
55
- {/if}
37
+ <ReviewProposal
38
+ {item}
39
+ value={valueIn(value, steps)}
40
+ label={where(steps)}
41
+ removes={item.after === undefined && (steps.length ? typeof steps.at(-1) === 'number' : member)}
42
+ />
56
43
  {/each}
57
-
58
- <style>
59
- /* The line a changed control carries along its foot (`Field.svelte`), under the place it
60
- changed, at the vertical width the surface draws a stroke at. */
61
- .qm-review-line {
62
- height: var(--_qm-vertical-width);
63
- background: var(--_qm-review-line);
64
- }
65
- .qm-review-line.qm-review-lit {
66
- box-shadow: 0 0 0 var(--_qm-vertical-width) var(--_qm-review-tint);
67
- }
68
- </style>
@@ -107,17 +107,16 @@
107
107
  inner?.applyCardOps(ops);
108
108
  }
109
109
  /** Bring the review item `id` to the reader: its panel opened, scrolled to the middle of
110
- * the view, lit, its card raised. The focus stays put unless `focus` sends the caret into
110
+ * the view, lit. The focus stays put unless `focus` sends the caret into
111
111
  * the item, where its chords answer. False for an item not drawn. */
112
112
  export async function revealReview(id: string, opts?: { focus?: boolean }): Promise<boolean> {
113
113
  return (await inner?.revealReview(id, opts)) ?? false;
114
114
  }
115
115
  /** Answer items as their buttons would, in document order (`'all'`: every item drawn),
116
- * moving neither the focus nor the caret and raising no toast; `'reopen'` takes back
117
- * accepted proposals. Returns the ids answered. */
116
+ * moving neither the focus nor the caret and raising no toast. Returns the ids answered. */
118
117
  export function answerReview(
119
118
  ids: readonly string[] | 'all',
120
- action: 'accept' | 'dismiss' | 'reopen'
119
+ action: 'accept' | 'dismiss'
121
120
  ): string[] {
122
121
  return inner?.answerReview(ids, action) ?? [];
123
122
  }
@@ -16,7 +16,7 @@ declare const VisualEditor: import("svelte").Component<VisualEditorProps, {
16
16
  revealReview: (id: string, opts?: {
17
17
  focus?: boolean;
18
18
  }) => Promise<boolean>;
19
- answerReview: (ids: readonly string[] | "all", action: "accept" | "dismiss" | "reopen") => string[];
19
+ answerReview: (ids: readonly string[] | "all", action: "accept" | "dismiss") => string[];
20
20
  stepReview: (dir: 1 | -1, opts?: {
21
21
  focus?: boolean;
22
22
  }) => Promise<string | undefined>;
@@ -30,6 +30,7 @@
30
30
  import { isQuillmarkError, MAIN_CARD_ADDR } from '@quillmark/wasm';
31
31
  import {
32
32
  addrForFieldPath,
33
+ cardMoved,
33
34
  nearestAddrForFieldPath,
34
35
  cardPath,
35
36
  nestedAddrForFieldPath,
@@ -60,24 +61,14 @@
60
61
  import { createReview, setReview } from './review.svelte.js';
61
62
  import {
62
63
  byBlocks,
63
- isChange,
64
64
  onField,
65
- sameValue,
66
65
  valueIn,
67
66
  valueWith,
68
- valueWithInserted,
69
- besideOf,
70
- type FieldChange,
71
67
  type FieldProposal,
72
68
  type ReviewDrawn
73
69
  } from './review.js';
74
70
  import type { CardId, CardOp, ChangeSource } from './signals.js';
75
- import {
76
- markAnchor,
77
- REVIEW_KEYS,
78
- type FieldController,
79
- type LeafViews
80
- } from '../core/codec/index.js';
71
+ import { REVIEW_KEYS, type FieldController, type LeafViews } from '../core/codec/index.js';
81
72
  import {
82
73
  IdSeq,
83
74
  controlKind,
@@ -116,7 +107,6 @@
116
107
  import Card from './Card.svelte';
117
108
  import TipsCard from './TipsCard.svelte';
118
109
  import FormatPopover from './FormatPopover.svelte';
119
- import ReviewPopover, { type ReviewTarget } from './ReviewPopover.svelte';
120
110
  // The add trigger and the kind menu draw shared recipes; a component carrying a
121
111
  // shared class without also pulling its rule ships unstyled (controls.css).
122
112
  import './controls.css';
@@ -174,6 +164,19 @@
174
164
  // Session ids, one per composable card, reordered in lockstep with structure ops.
175
165
  // svelte-ignore state_referenced_locally
176
166
  let cardIds = $state<string[]>(seq.take(doc.cardCount));
167
+ /** The card keys as they stood when the host set its review list: an item names its card by
168
+ * index into these, so it stays on that card through every card op since. */
169
+ let listed: { list: VisualEditorProps['review']; cards: readonly string[] } | undefined;
170
+ function cardsListed(): readonly string[] {
171
+ const held = listed;
172
+ if (held && held.list === review) return held.cards;
173
+ listed = { list: review, cards: cardIds };
174
+ return cardIds;
175
+ }
176
+ function setCards(next: string[]): void {
177
+ cardsListed();
178
+ cardIds = next;
179
+ }
177
180
 
178
181
  // Local commit-error diagnostics (INVARIANTS §Diagnostics, producer #2),
179
182
  // id-keyed rather than positional so an error stays pinned to its field across a
@@ -314,31 +317,23 @@
314
317
  const addr = nearestAddrForFieldPath(path);
315
318
  return addr && declaredField(addr) ? resolveCardKey(addr, cardIds) : undefined;
316
319
  };
317
- /** The field proposals accepted here: the change each made, the leaf it is at, the write
318
- * back, and whether the value is still the one written. */
319
- const taken = new SvelteMap<
320
- string,
321
- { change: FieldChange; leaf: string; back: () => void; holds: () => boolean }
322
- >();
323
- const takenChanges = $derived(new Map([...taken].map(([id, t]) => [id, t.change])));
324
320
  /** Take a field's answer back: the value it replaced written back, if any, and the item
325
321
  * reopened. */
326
322
  const giveBack = (id: string, leaf: string, back?: () => void): void => {
327
323
  back?.();
328
324
  reviewing.heard(id, 'reopen', leaf);
329
325
  };
326
+ /** The host's list with each card it names by index moved to where that card stands now. */
327
+ const reviewItems = $derived.by(() => {
328
+ const was = cardsListed();
329
+ if (!review?.length || was === cardIds) return review;
330
+ return review.map((item) => {
331
+ const field = cardMoved(item.field, was, cardIds);
332
+ return field === item.field ? item : { ...item, field };
333
+ });
334
+ });
330
335
  const reviewing = createReview({
331
- items: () => review,
332
- taken: () => takenChanges,
333
- putBack(id) {
334
- const field = taken.get(id);
335
- if (field) {
336
- giveBack(id, field.leaf, field.back);
337
- return true;
338
- }
339
- const key = reviewing.keyOf(id);
340
- return key !== undefined && !!leaves.prose(key)?.answerReview(id, 'reopen');
341
- },
336
+ items: () => reviewItems,
342
337
  keyFor: (path) => {
343
338
  const key = reviewed(path);
344
339
  return key && fieldKeyToString(key);
@@ -378,15 +373,9 @@
378
373
  },
379
374
  answer(id, item, action, key) {
380
375
  let back: (() => void) | undefined;
381
- if (action === 'reopen') taken.delete(id);
382
- if (action === 'accept' && item && !isChange(item) && onField(item)) {
383
- const took = takeField(item);
384
- if (!took) return false;
385
- back = took.back;
386
- taken.set(id, {
387
- ...took,
388
- change: { id, state: 'changed', field: item.field, before: took.before }
389
- });
376
+ if (action === 'accept' && item && onField(item)) {
377
+ back = takeField(item);
378
+ if (!back) return false;
390
379
  }
391
380
  onReview?.({ id, action });
392
381
  if (action !== 'accept' && action !== 'dismiss') return true;
@@ -424,8 +413,6 @@
424
413
  let writing = 0;
425
414
  function settled(): void {
426
415
  if (writing) return;
427
- // A field set to another value since it was accepted no longer shows that change.
428
- for (const [id, field] of taken) if (!field.holds()) taken.delete(id);
429
416
  journal = [];
430
417
  journalOffer = undefined;
431
418
  undo.settle();
@@ -466,14 +453,13 @@
466
453
 
467
454
  /**
468
455
  * Take a field's proposal: its value down the lane the field's own control commits by, so
469
- * the writer checks it and `onChange` reports it. A text leaf re-reads what was written.
470
- * Returns the value it replaced, the write back to it, and whether the field still holds
471
- * what was written, or `undefined` where the writer refused the value, which the field then
472
- * says as it says any refused commit.
456
+ * the writer checks it and `onChange` reports it. A text leaf re-reads what was written. A
457
+ * place inside the field is written as the whole value with that place alone changed, down
458
+ * the lane an edit of the place takes. Returns the write back to the value it replaced,
459
+ * which the journal runs before any older answer's, or `undefined` where the writer refused
460
+ * the value, which the field then says as it says any refused commit.
473
461
  */
474
- function takeField(
475
- item: FieldProposal
476
- ): { leaf: string; before: unknown; back: () => void; holds: () => boolean } | undefined {
462
+ function takeField(item: FieldProposal): (() => void) | undefined {
477
463
  const key = reviewed(item.field);
478
464
  if (!key?.field || typeof key.card === 'number') return undefined;
479
465
  const isMain = key.card === undefined;
@@ -489,16 +475,15 @@
489
475
  };
490
476
  writing++;
491
477
  try {
492
- if (!addrForFieldPath(item.field)) return takeInside(item, leaf, write);
493
478
  const before = doc.getStored(addr);
494
- if (!write(item.after)) return undefined;
495
- const written = JSON.stringify(doc.getStored(addr));
496
- return {
497
- leaf,
498
- before,
499
- back: () => void write(before),
500
- holds: () => JSON.stringify(doc.getStored(addr)) === written
501
- };
479
+ let after = item.after;
480
+ if (!addrForFieldPath(item.field)) {
481
+ const steps = reviewing.at(leaf).nested?.find((e) => e.item.id === item.id)?.steps;
482
+ if (!steps) return undefined;
483
+ after = valueWith(current(), steps, item.after);
484
+ }
485
+ if (!write(after)) return undefined;
486
+ return () => void write(before);
502
487
  } finally {
503
488
  writing--;
504
489
  }
@@ -509,40 +494,6 @@
509
494
  if (at < 0) return undefined;
510
495
  return fieldValues((isMain ? doc.main : doc.card(at)).payloadItems)[name];
511
496
  }
512
- /**
513
- * A proposal for a place inside the field: the whole value written with that place
514
- * changed, down the lane an edit of the place takes, and taken back by writing that
515
- * place alone back, so another place accepted since keeps its change.
516
- */
517
- function takeInside(
518
- item: FieldProposal,
519
- leaf: string,
520
- write: (value: unknown) => boolean
521
- ): { leaf: string; before: unknown; back: () => void; holds: () => boolean } | undefined {
522
- const steps = reviewing.at(leaf).nested?.find((e) => e.item.id === item.id)?.steps;
523
- if (!steps) return undefined;
524
- const value = current();
525
- const last = steps.at(-1);
526
- const list = typeof last === 'number' ? valueIn(value, steps.slice(0, -1)) : undefined;
527
- const length = Array.isArray(list) ? list.length : 0;
528
- const adds = typeof last === 'number' && last >= length && item.after !== undefined;
529
- const removes = typeof last === 'number' && !adds && item.after === undefined;
530
- const landed = adds ? [...steps.slice(0, -1), length] : steps;
531
- const before = valueIn(value, steps);
532
- const beside = removes ? besideOf(value, steps) : {};
533
- if (!write(valueWith(value, steps, item.after))) return undefined;
534
- return {
535
- leaf,
536
- before,
537
- back: () =>
538
- void write(
539
- removes
540
- ? valueWithInserted(current(), steps, before, beside)
541
- : valueWith(current(), landed, adds ? undefined : before)
542
- ),
543
- holds: () => removes || sameValue(valueIn(current(), landed), item.after)
544
- };
545
- }
546
497
  }
547
498
  setReview(reviewing);
548
499
  span.onEnd(reviewing.dispose);
@@ -593,12 +544,10 @@
593
544
  if (!reported.has(item.id) && !why.has(item.id)) {
594
545
  if (byBlocks(item)) why.set(item.id, 'block');
595
546
  }
596
- const order = reviewOrder();
547
+ const open = reviewOrder();
597
548
  return {
598
- order,
599
- accepted: order.filter((id) => reviewing.accepted.has(id)),
600
- open: order.filter((id) => !reviewing.accepted.has(id)),
601
- outdated: order.filter((id) => outdated.has(id) && !reviewing.accepted.has(id)),
549
+ open,
550
+ outdated: open.filter((id) => outdated.has(id)),
602
551
  undrawn: reviewing.items.flatMap((item) => {
603
552
  const reason = why.get(item.id);
604
553
  return reason ? [{ id: item.id, reason }] : [];
@@ -607,18 +556,11 @@
607
556
  }
608
557
  // The report, to a host counting its own list: each change, read once the leaves the change
609
558
  // mounted have drawn, so a list just handed over is not reported as anchored nowhere.
610
- const NO_REPORT = JSON.stringify({
611
- order: [],
612
- accepted: [],
613
- open: [],
614
- outdated: [],
615
- undrawn: []
616
- } satisfies ReviewDrawn);
559
+ const NO_REPORT = JSON.stringify({ open: [], outdated: [], undrawn: [] } satisfies ReviewDrawn);
617
560
  let drewReport = NO_REPORT;
618
561
  let drewOrder: readonly string[] = [];
619
562
  $effect(() => {
620
563
  void reviewing.items;
621
- void reviewing.accepted;
622
564
  void reviewing.fieldUndrawn;
623
565
  for (const id of reviewing.fieldOutdated) void id;
624
566
  for (const report of reviewing.reports.values()) void report;
@@ -626,7 +568,7 @@
626
568
  void tick().then(() => {
627
569
  if (!live || !span.alive) return;
628
570
  const report = reviewReport();
629
- drewOrder = report.order;
571
+ drewOrder = report.open;
630
572
  const joined = JSON.stringify(report);
631
573
  if (joined === drewReport) return;
632
574
  drewReport = joined;
@@ -675,24 +617,6 @@
675
617
  e.preventDefault();
676
618
  e.stopPropagation();
677
619
  }
678
- /** Where item `id` is drawn, for the card that hangs off it. */
679
- function reviewTarget(id: string): ReviewTarget | undefined {
680
- const key = reviewing.keyOf(id);
681
- if (key === undefined) return undefined;
682
- const prose = leaves.prose(key);
683
- const mark = prose?.reviewElements(id)[0];
684
- if (prose && mark)
685
- return {
686
- anchor: markAnchor(prose.el, () => prose.reviewElements(id)[0]),
687
- removed: mark.classList.contains('qm-review-gone')
688
- };
689
- const control = leaves.control(key);
690
- const own = [...(control?.el.querySelectorAll<HTMLElement>('[data-qm-review]') ?? [])].find(
691
- (el) => el.getAttribute('data-qm-review') === id
692
- );
693
- return control && { anchor: own ?? control.el, removed: false };
694
- }
695
-
696
620
  // Card handles, for `setCaret`'s reveal hop: the one thing a leaf's own controller
697
621
  // cannot do, since which group is open is the card's state (Card §revealLeaf).
698
622
  type CardHandle = {
@@ -919,7 +843,7 @@
919
843
  undo.withdraw();
920
844
  const id = seq.next();
921
845
  arm.arm();
922
- cardIds = [...cardIds.slice(0, atIndex), id, ...cardIds.slice(atIndex)];
846
+ setCards([...cardIds.slice(0, atIndex), id, ...cardIds.slice(atIndex)]);
923
847
  bump('structure', id, atIndex, { op: 'insert', at: atIndex });
924
848
  // Centred: the new card is the subject, and the neighbours it landed between
925
849
  // are what say where it went.
@@ -985,7 +909,7 @@
985
909
  const w = cardIds.slice();
986
910
  const [x] = w.splice(from, 1);
987
911
  w.splice(to, 0, x);
988
- cardIds = w;
912
+ setCards(w);
989
913
  bump('structure', id, to, { op: 'move', from, to });
990
914
  if (held) void keepFocus(focused);
991
915
  // `nearest`: the card was already in view and only needs to stay there, so one
@@ -1015,7 +939,7 @@
1015
939
  const gone = removed.remove(id, card, cardIds, i);
1016
940
  doc.removeCard(i);
1017
941
  arm.arm();
1018
- cardIds = cardIds.filter((_, k) => k !== i);
942
+ setCards(cardIds.filter((_, k) => k !== i));
1019
943
  forget(id);
1020
944
  // No addr: the removed card has none left and every survivor's shifted. The
1021
945
  // stack changed, not a leaf, and the id is the only handle the removal leaves.
@@ -1053,7 +977,7 @@
1053
977
  const id = seq.next();
1054
978
  removed.restored(gone, id);
1055
979
  arm.arm();
1056
- cardIds = [...cardIds.slice(0, i), id, ...cardIds.slice(i)];
980
+ setCards([...cardIds.slice(0, i), id, ...cardIds.slice(i)]);
1057
981
  bump('structure', id, i, { op: 'insert', at: i });
1058
982
  void (async () => {
1059
983
  if (!(await scrollCardIntoView(id, 'nearest'))) return;
@@ -1462,7 +1386,7 @@
1462
1386
  else if (op.op === 'remove') forget(ids.splice(op.at, 1)[0]);
1463
1387
  else ids.splice(op.to, 0, ...ids.splice(op.from, 1));
1464
1388
  }
1465
- cardIds = ids;
1389
+ setCards(ids);
1466
1390
  rederive();
1467
1391
  }
1468
1392
 
@@ -1470,10 +1394,9 @@
1470
1394
 
1471
1395
  /**
1472
1396
  * Bring the review item `id` to the reader: open the panel holding it, scroll it to the
1473
- * middle of the view, light it, and raise its card where it has one. The focus stays
1474
- * where it is, the reader having asked to look, unless `focus` asks for it: the caret
1475
- * then goes into the item, or the focus to its field, so the chords answer it. False for
1476
- * an item the editor does not draw.
1397
+ * middle of the view, and light it. The focus stays where it is, the reader having asked
1398
+ * to look, unless `focus` asks for it: the caret then goes into the item, or the focus to
1399
+ * its field, so the chords answer it. False for an item the editor does not draw.
1477
1400
  */
1478
1401
  export function revealReview(id: string, opts: { focus?: boolean } = {}): Promise<boolean> {
1479
1402
  return reveal(id, opts.focus ?? false, false);
@@ -1508,33 +1431,26 @@
1508
1431
 
1509
1432
  /**
1510
1433
  * Answer items as their buttons would, in document order: `'all'` is every item drawn. An
1511
- * accept or a dismissal passes over a change, which has neither button, and over a proposal
1512
- * already accepted, and an item that cannot be answered (a proposal that no longer writes, a
1513
- * value the field's writer refuses) stands. `'reopen'` takes back each accepted proposal
1514
- * named, as its card's Undo does. `onReview` hears each answer, and neither the focus nor the
1515
- * caret moves. The batch raises no toast, the host's to word if it wants one, and ⌘Z takes
1516
- * it back whole. Returns the ids answered.
1434
+ * item that cannot be answered (a proposal that no longer writes, a value the field's writer
1435
+ * refuses) stands. `onReview` hears each answer, and neither the focus nor the caret moves.
1436
+ * The batch raises no toast, the host's to word if it wants one, and ⌘Z takes it back whole.
1437
+ * Returns the ids answered.
1517
1438
  */
1518
1439
  export function answerReview(
1519
1440
  ids: readonly string[] | 'all',
1520
- action: 'accept' | 'dismiss' | 'reopen'
1441
+ action: 'accept' | 'dismiss'
1521
1442
  ): string[] {
1522
1443
  if (!span.alive) return [];
1523
1444
  const order = reviewOrder();
1524
1445
  const asked = ids === 'all' ? order : order.filter((id) => ids.includes(id));
1525
1446
  const out: string[] = [];
1526
- if (action === 'reopen') {
1527
- for (const id of asked)
1528
- if (reviewing.accepted.has(id) && reviewing.act(id, 'reopen')) out.push(id);
1529
- return out;
1530
- }
1531
1447
  const entry: Answered = { ids: [], inverses: [] };
1532
1448
  batching = entry;
1533
1449
  writing++;
1534
1450
  try {
1535
1451
  for (const id of asked) {
1536
1452
  const item = reviewing.items.find((it) => it.id === id);
1537
- if (!item || reviewing.accepted.has(id)) continue;
1453
+ if (!item) continue;
1538
1454
  const key = reviewing.keyOf(id);
1539
1455
  // Each one is planned against the document the one before it left.
1540
1456
  const answered = !onField(item)
@@ -1739,7 +1655,6 @@
1739
1655
  </div>
1740
1656
 
1741
1657
  <FormatPopover {getActiveLeaf} families={fontFamilies} {fontLabels} />
1742
- <ReviewPopover review={reviewing} targetFor={reviewTarget} />
1743
1658
 
1744
1659
  <!-- The add affordance is gated on the schema declaring `card_kinds`, there being
1745
1660
  nothing to seed otherwise. Cards render regardless: a kind with no schema degrades to
@@ -18,7 +18,7 @@ declare const VisualEditorInner: import("svelte").Component<VisualEditorProps, {
18
18
  revealReview: (id: string, opts?: {
19
19
  focus?: boolean;
20
20
  }) => Promise<boolean>;
21
- answerReview: (ids: readonly string[] | "all", action: "accept" | "dismiss" | "reopen") => string[];
21
+ answerReview: (ids: readonly string[] | "all", action: "accept" | "dismiss") => string[];
22
22
  stepReview: (dir: 1 | -1, opts?: {
23
23
  focus?: boolean;
24
24
  }) => Promise<string | undefined>;
@@ -111,23 +111,24 @@ export interface VisualEditorProps {
111
111
  /**
112
112
  * What someone other than the reader proposes, for the editor to draw where each item sits
113
113
  * ({@link ReviewItem}): a proposal as a word-level edit of its own blocks with Accept and
114
- * Dismiss at its end, a field's proposed value under its control, and one accepted as the
115
- * change it made with a card holding what it replaced. Declarative: the host sets the list
116
- * once and clears it once, and the editor draws every answer while the list holds the
117
- * item.
114
+ * Dismiss at its end, and a field's proposed value under its control. Declarative: the host
115
+ * sets the list once and clears it once, and the editor draws every answer while the list
116
+ * holds the item: an answered item is drawn no more, and an accepted one is plain text. A
117
+ * card an item names by index is read against the cards as they stood when the list was
118
+ * set, so the item stays on its card through `applyCardOps` and the reader's own card
119
+ * edits; an item whose card is gone draws nothing.
118
120
  */
119
121
  review?: readonly ReviewItem[];
120
122
  /**
121
123
  * A reader answered an item: a button on it, `Mod-Enter` / `Mod-.` with the caret or the
122
- * focus in it, or a host's `answerReview`; or undid an answer, with ⌘Z or an accepted
123
- * change's Undo, `reopen`. The editor has made every write an answer asks for and draws it,
124
+ * focus in it, or a host's `answerReview`; or undid an answer with ⌘Z, `reopen`. The editor has made every write an answer asks for and draws it,
124
125
  * so the host leaves `review` as it set it.
125
126
  */
126
127
  onReview?: (event: ReviewEvent) => void;
127
128
  /**
128
- * What the editor draws of `review`, on each change once the leaves have drawn: the items
129
- * in document order, the accepted proposals among them drawn as changes, the proposals the
130
- * reader has written past since, and every listed item it does not draw with why. What a
129
+ * What the editor draws of `review`, on each change once the leaves have drawn: the open
130
+ * items in document order, the proposals the reader has written past since, and every
131
+ * listed item it does not draw with why. What a
131
132
  * host counts and steps its own list by.
132
133
  */
133
134
  onReviewDrawn?: (drawn: ReviewDrawn) => void;
@@ -19,9 +19,8 @@ import { type BlockPlace, type ReviewAction } from '../core/codec/index.js';
19
19
  * list names that place: a cell, or a member by its index, which `after` absent takes out
20
20
  * and an index past the last appends.
21
21
  *
22
- * An item whose place the editor does not hold draws nothing. A dismissed item is drawn no more,
23
- * and an accepted proposal the list still holds is drawn as the change it made, with the card
24
- * that takes it back, until the list lets it go.
22
+ * An item whose place the editor does not hold draws nothing. An answered item is drawn no
23
+ * more: a dismissed one wrote nothing, and an accepted one is plain text in the document.
25
24
  */
26
25
  export type ReviewItem = FieldProposal | BlockProposal;
27
26
  /** A proposal over blocks of a rich text field, by their ids. */
@@ -39,15 +38,15 @@ export type BlockProposal = {
39
38
  };
40
39
  /** Whether an item names blocks of a rich text field, which its prose leaf draws. */
41
40
  export declare const byBlocks: (item: object) => item is BlockProposal;
42
- /** Whether an item is a field's own, drawn on its control: a proposal, or one accepted there. */
43
- export declare const onField: (item: object) => item is FieldChange | FieldProposal;
41
+ /** Whether an item is a field's own, drawn under its control. */
42
+ export declare const onField: (item: object) => item is FieldProposal;
44
43
  /**
45
44
  * A reader's answer to an item.
46
45
  *
47
46
  * - `accept`: a proposal taken. The editor has written it by now, as an edit of the reader's.
48
47
  * - `dismiss`: a proposal turned down. Nothing is written.
49
- * - `reopen`: an accept or a dismissal undone. The editor has taken back what an accept wrote,
50
- * and the item is open again.
48
+ * - `reopen`: an accept or a dismissal undone by ⌘Z. The editor has taken back what an accept
49
+ * wrote, and the item is open again.
51
50
  */
52
51
  export interface ReviewEvent {
53
52
  id: string;
@@ -66,12 +65,8 @@ export interface ReviewEvent {
66
65
  export type ReviewUndrawn = 'block' | 'field' | 'parse' | 'taken' | 'applied';
67
66
  /** What the editor draws of the host's list. */
68
67
  export interface ReviewDrawn {
69
- /** The proposals the editor draws, in document order: the open ones and the accepted ones. */
70
- order: readonly string[];
71
- /** The proposals accepted and still listed, which the editor draws as the changes they made. */
72
- accepted: readonly string[];
73
- /** The drawn items still waiting for an answer, in document order: the rest of `order`. A
74
- * review is answered when it is empty. */
68
+ /** The proposals the editor draws, in document order, each waiting for an answer. A review
69
+ * is answered when it is empty. */
75
70
  open: readonly string[];
76
71
  /** Drawn proposals the reader's own writing meets: words both changed, a block one names
77
72
  * gone or no longer what its writer read, or a field no longer holding its `before`. */
@@ -82,18 +77,6 @@ export interface ReviewDrawn {
82
77
  reason: ReviewUndrawn;
83
78
  }[];
84
79
  }
85
- /** A field proposal accepted, as the change it made over its control, `before` the value it
86
- * replaced. The editor's own, tagged as it takes the accept; a host lists proposals alone. */
87
- export type FieldChange = {
88
- id: string;
89
- state: 'changed';
90
- field: DocPath;
91
- before?: unknown;
92
- };
93
- /** Whether an item is an accepted proposal the editor holds, rather than one the host lists. */
94
- export declare const isChange: <T extends object>(item: T) => item is Extract<T, {
95
- state: "changed";
96
- }>;
97
80
  /** A proposal under a field's control. */
98
81
  export type FieldProposal = {
99
82
  id: string;
@@ -105,7 +88,7 @@ export type FieldProposal = {
105
88
  * value it names, a member of a list by its index, a cell of a record by its key. */
106
89
  export interface DeepReview {
107
90
  steps: readonly PathStep[];
108
- item: FieldProposal | FieldChange;
91
+ item: FieldProposal;
109
92
  }
110
93
  /** One rung of a nested item's walk: the items naming this rung's own value, and the rest by
111
94
  * the step they take next, that step consumed. */
@@ -118,31 +101,13 @@ export declare function valueIn(value: unknown, steps: readonly PathStep[]): unk
118
101
  /** `value` with what `steps` reach set to `to`: a list's member past its end appended, and one
119
102
  * set to nothing taken out; a record's cell set to nothing left out. Copies on the way down. */
120
103
  export declare function valueWith(value: unknown, steps: readonly PathStep[], to: unknown): unknown;
121
- /** The members that stood either side of the one `steps` reach in `value`, which put it back. */
122
- export interface Beside {
123
- before?: {
124
- member: unknown;
125
- };
126
- after?: {
127
- member: unknown;
128
- };
129
- }
130
- /** The members either side of the one `steps` reach in `value`. */
131
- export declare function besideOf(value: unknown, steps: readonly PathStep[]): Beside;
132
- /**
133
- * `value` with a member put back at `steps`, the ones from it on moving down one: after the
134
- * member that stood before it, else before the one that stood after it, the nearest of each to
135
- * the index, so members put back in any order land where they stood; at the index where
136
- * neither stands.
137
- */
138
- export declare function valueWithInserted(value: unknown, steps: readonly PathStep[], member: unknown, beside?: Beside): unknown;
139
104
  /**
140
105
  * Where a field proposal's steps land in `value` as it stands. A list's member is found by its
141
106
  * index where it holds `before`, else as the nearest member holding `before` that `claimed`
142
107
  * does not already hold, so one member taken out does not move another's proposal onto the
143
108
  * wrong row. `found` is false where the proposal has a `before` nothing holds.
144
109
  */
145
- export declare function locate(value: unknown, steps: readonly PathStep[], item: FieldProposal | FieldChange, claimed: Set<string>): {
110
+ export declare function locate(value: unknown, steps: readonly PathStep[], item: FieldProposal, claimed: Set<string>): {
146
111
  steps: readonly PathStep[];
147
112
  found: boolean;
148
113
  };