@quillmark/svelte 0.36.0 → 0.37.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.
Files changed (66) hide show
  1. package/README.md +18 -14
  2. package/THEMING.md +1 -1
  3. package/dist/core/codec/decode.d.ts +4 -2
  4. package/dist/core/codec/decode.js +5 -2
  5. package/dist/core/codec/field.d.ts +13 -10
  6. package/dist/core/codec/field.js +30 -24
  7. package/dist/core/codec/index.d.ts +3 -3
  8. package/dist/core/codec/index.js +2 -2
  9. package/dist/core/codec/prose.css +14 -4
  10. package/dist/core/codec/review.d.ts +4 -5
  11. package/dist/core/codec/review.js +6 -21
  12. package/dist/core/codec/schema.d.ts +12 -2
  13. package/dist/core/codec/schema.js +27 -5
  14. package/dist/core/codec/shortcuts.d.ts +3 -2
  15. package/dist/core/codec/shortcuts.js +3 -2
  16. package/dist/core/codec/table-view.js +15 -3
  17. package/dist/core/theme.css +39 -13
  18. package/dist/core/tooltip.css +49 -0
  19. package/dist/core/tooltip.d.ts +6 -0
  20. package/dist/core/tooltip.js +176 -0
  21. package/dist/preview/Preview.svelte +22 -1
  22. package/dist/preview/controller.js +38 -0
  23. package/dist/preview/strings.d.ts +2 -0
  24. package/dist/preview/strings.js +1 -0
  25. package/dist/visual/ArrayField.svelte +190 -86
  26. package/dist/visual/Card.svelte +21 -11
  27. package/dist/visual/CardControls.svelte +3 -3
  28. package/dist/visual/DateField.svelte +47 -5
  29. package/dist/visual/DiagnosticList.svelte +3 -2
  30. package/dist/visual/EnumField.svelte +6 -1
  31. package/dist/visual/EnumField.svelte.d.ts +2 -0
  32. package/dist/visual/Field.svelte +3 -3
  33. package/dist/visual/FieldHint.svelte +19 -8
  34. package/dist/visual/FormatPopover.svelte +53 -20
  35. package/dist/visual/MatrixField.svelte +7 -3
  36. package/dist/visual/NumberField.svelte +21 -5
  37. package/dist/visual/ObjectField.svelte +6 -2
  38. package/dist/visual/ProseField.svelte +6 -3
  39. package/dist/visual/ProseField.svelte.d.ts +2 -1
  40. package/dist/visual/ProseValue.svelte +11 -6
  41. package/dist/visual/ProseValue.svelte.d.ts +4 -1
  42. package/dist/visual/ReviewCard.svelte +85 -32
  43. package/dist/visual/ReviewCard.svelte.d.ts +2 -1
  44. package/dist/visual/ReviewProposal.svelte +0 -6
  45. package/dist/visual/TipsCard.svelte +1 -1
  46. package/dist/visual/VariantField.svelte +1 -0
  47. package/dist/visual/VisualEditor.svelte +12 -6
  48. package/dist/visual/VisualEditor.svelte.d.ts +5 -1
  49. package/dist/visual/VisualEditorInner.svelte +187 -275
  50. package/dist/visual/VisualEditorInner.svelte.d.ts +5 -1
  51. package/dist/visual/controls.css +2 -2
  52. package/dist/visual/index.d.ts +2 -2
  53. package/dist/visual/proposals.d.ts +14 -4
  54. package/dist/visual/proposals.js +28 -5
  55. package/dist/visual/props.d.ts +1 -1
  56. package/dist/visual/review-order.d.ts +51 -0
  57. package/dist/visual/review-order.js +87 -0
  58. package/dist/visual/review.d.ts +27 -1
  59. package/dist/visual/review.js +1 -1
  60. package/dist/visual/review.svelte.d.ts +34 -17
  61. package/dist/visual/review.svelte.js +187 -44
  62. package/dist/visual/strings.d.ts +36 -19
  63. package/dist/visual/strings.js +80 -24
  64. package/dist/visual/structure.d.ts +17 -3
  65. package/dist/visual/structure.js +71 -5
  66. package/package.json +2 -2
@@ -9,6 +9,7 @@ declare const VisualEditorInner: import("svelte").Component<VisualEditorProps, {
9
9
  setCaret: (at: Landing) => Promise<void>;
10
10
  getActiveLeaf: () => ActiveProse | undefined;
11
11
  focusField: (field: DocPath) => Promise<void>;
12
+ revealField: (field: DocPath) => Promise<void>;
12
13
  washField: (field: DocPath) => void;
13
14
  insertCard: (kind: string, at?: number) => CardId | undefined;
14
15
  removeCard: (cardId: CardId) => void;
@@ -20,10 +21,13 @@ declare const VisualEditorInner: import("svelte").Component<VisualEditorProps, {
20
21
  revealReview: (id: string, opts?: {
21
22
  focus?: boolean;
22
23
  }) => Promise<boolean>;
23
- answerReview: (ids: readonly string[] | "all", action: "accept" | "dismiss") => string[];
24
+ answerReview: (ids: readonly string[] | "all" | {
25
+ group: string;
26
+ }, action: "accept" | "dismiss") => string[];
24
27
  projectReview: (target: Document) => ReviewProjection;
25
28
  stepReview: (dir: 1 | -1, opts?: {
26
29
  focus?: boolean;
30
+ group?: string;
27
31
  }) => Promise<string | undefined>;
28
32
  }, "">;
29
33
  type VisualEditorInner = ReturnType<typeof VisualEditorInner>;
@@ -240,8 +240,8 @@
240
240
  :where(.qm-chip) {
241
241
  color: var(--_qm-ink-label);
242
242
  }
243
- :where(.qm-add-affordance:hover),
244
- :where(.qm-chip:hover) {
243
+ :where(.qm-add-affordance:hover:not(:disabled)),
244
+ :where(.qm-chip:hover:not(:disabled, [aria-disabled='true'])) {
245
245
  color: var(--_qm-ink);
246
246
  }
247
247
  :where(.qm-chip svg),
@@ -7,10 +7,10 @@ export type { VisualStrings, VisualStringsInput, FormatDiagnostic } from './stri
7
7
  export type { BodyPlaceholder, BodyPlaceholderContext } from './structure.js';
8
8
  export { editorShortcuts } from '../core/codec/index.js';
9
9
  export type { EditorShortcut, ShortcutScope } from '../core/codec/index.js';
10
- export type { BlockProposal, CardProposal, FieldProposal, ReviewDrawn, ReviewEvent, ReviewItem, ReviewProjection, ReviewUndrawn } from './review.js';
10
+ export type { BlockProposal, CardProposal, FieldProposal, ReviewDrawn, ReviewEvent, ReviewItem, ReviewLabel, ReviewProjection, ReviewUndrawn } from './review.js';
11
11
  export type { BlockPlace } from '../core/codec/index.js';
12
12
  export { proposalsBetween } from './proposals.js';
13
- export type { Proposed } from './proposals.js';
13
+ export type { Proposed, ProposalsOpts } from './proposals.js';
14
14
  export type { ReviewAction } from '../core/codec/index.js';
15
15
  export { REVIEW_KEYS } from '../core/codec/index.js';
16
16
  export { patchEditorExt } from './ext.js';
@@ -1,5 +1,5 @@
1
1
  import type { Document, Quill } from '@quillmark/wasm';
2
- import { type ReviewItem } from './review.js';
2
+ import { type ReviewItem, type ReviewLabel } from './review.js';
3
3
  /** The review an answer makes: the items the editor draws, the cards it adds or takes out
4
4
  * among them. */
5
5
  export interface Proposed {
@@ -25,7 +25,17 @@ export interface Proposed {
25
25
  *
26
26
  * A card the answer adds is an `add` item after the nearest card before it that the answer
27
27
  * keeps, so cards it adds in a run stand in list order; one it takes out is a `remove` item.
28
- * Paths and card indexes are `base`'s. A card the answer retypes is listed as taken out and
29
- * added; one it moves is not listed. `mint` names each item, and by default names it uniquely for the page.
28
+ * Paths and card indexes are `base`'s, and an item on a card, after one or taking one out names
29
+ * it by its `$id` too where it has one. A card the answer retypes is listed as taken out and
30
+ * added; one it moves is not listed.
31
+ *
32
+ * `mint`, or `opts.mint`, names each item, and by default names it uniquely for the page.
33
+ * `opts.label` is handed each item once the list is made and returns its `note` and `group`,
34
+ * from what the host knows of the edit that made it: a block id or a field path it wrote.
30
35
  */
31
- export declare function proposalsBetween(quill: Quill, base: Document, answer: Document, mint?: () => string): Proposed;
36
+ export declare function proposalsBetween(quill: Quill, base: Document, answer: Document, opts?: (() => string) | ProposalsOpts): Proposed;
37
+ /** How `proposalsBetween` names and labels the items it makes. */
38
+ export interface ProposalsOpts {
39
+ mint?: () => string;
40
+ label?: (item: Readonly<ReviewItem>) => ReviewLabel | undefined;
41
+ }
@@ -22,10 +22,16 @@ let minted = 0;
22
22
  *
23
23
  * A card the answer adds is an `add` item after the nearest card before it that the answer
24
24
  * keeps, so cards it adds in a run stand in list order; one it takes out is a `remove` item.
25
- * Paths and card indexes are `base`'s. A card the answer retypes is listed as taken out and
26
- * added; one it moves is not listed. `mint` names each item, and by default names it uniquely for the page.
25
+ * Paths and card indexes are `base`'s, and an item on a card, after one or taking one out names
26
+ * it by its `$id` too where it has one. A card the answer retypes is listed as taken out and
27
+ * added; one it moves is not listed.
28
+ *
29
+ * `mint`, or `opts.mint`, names each item, and by default names it uniquely for the page.
30
+ * `opts.label` is handed each item once the list is made and returns its `note` and `group`,
31
+ * from what the host knows of the edit that made it: a block id or a field path it wrote.
27
32
  */
28
- export function proposalsBetween(quill, base, answer, mint = () => `review-${minted++}`) {
33
+ export function proposalsBetween(quill, base, answer, opts = {}) {
34
+ const { mint = () => `review-${minted++}`, label } = typeof opts === 'function' ? { mint: opts } : opts;
29
35
  const items = [];
30
36
  const kinds = Array.from({ length: base.cardCount }, (_, i) => base.card(i).kind);
31
37
  const baseIds = Array.from({ length: base.cardCount }, (_, i) => base.card(i).id ?? '');
@@ -169,7 +175,11 @@ export function proposalsBetween(quill, base, answer, mint = () => `review-${min
169
175
  continue;
170
176
  }
171
177
  kept.set(answerAt, at);
178
+ const first = items.length;
172
179
  diffCard(quill.schema.card_kinds?.[was.kind], at, was, now, answerAt);
180
+ if (id)
181
+ for (const item of items.slice(first))
182
+ Object.assign(item, { card: id });
173
183
  }
174
184
  for (const at of answerIds.keys()) {
175
185
  if (kept.has(at))
@@ -178,10 +188,23 @@ export function proposalsBetween(quill, base, answer, mint = () => `review-${min
178
188
  while (lead >= 0 && !kept.has(lead))
179
189
  lead--;
180
190
  const after = kept.get(lead);
181
- items.push({ id: mint(), add: answer.card(at), ...(after !== undefined && { after }) });
191
+ items.push({
192
+ id: mint(),
193
+ add: answer.card(at),
194
+ ...(after !== undefined && { after }),
195
+ ...(after !== undefined && baseIds[after] && { afterCard: baseIds[after] })
196
+ });
182
197
  }
183
198
  for (const at of removed)
184
- items.push({ id: mint(), remove: at });
199
+ items.push({ id: mint(), remove: at, ...(baseIds[at] && { card: baseIds[at] }) });
200
+ if (label)
201
+ for (const item of items) {
202
+ const { note, group } = label(item) ?? {};
203
+ if (note !== undefined)
204
+ item.note = note;
205
+ if (group !== undefined)
206
+ item.group = group;
207
+ }
185
208
  return { items };
186
209
  }
187
210
  const addrOf = (card, field) => ({
@@ -121,7 +121,7 @@ export interface VisualEditorProps {
121
121
  */
122
122
  review?: readonly ReviewItem[];
123
123
  /**
124
- * A reader answered an item: the answer card, `Mod-Enter` / `Mod-.` on the current change,
124
+ * A reader answered an item: the answer card, the `REVIEW_KEYS` on the current change,
125
125
  * or a host's `answerReview`; or undid an answer with ⌘Z, `reopen`. The editor has made every
126
126
  * write an answer asks for, a card's included, and draws it, so the host leaves `review` as
127
127
  * it set it.
@@ -0,0 +1,51 @@
1
+ import type { QuillFieldSchema } from '@quillmark/wasm';
2
+ import type { ReviewReport } from '../core/codec/index.js';
3
+ import { type CardModel } from './structure.js';
4
+ import type { DeepReview, FieldProposal } from './review.js';
5
+ /** A leaf as its card draws it: its key, and for a field its name, and the schema and the value
6
+ * it holds, which place what is drawn inside it. */
7
+ export interface LeafLayout {
8
+ key: string;
9
+ name?: string;
10
+ schema?: QuillFieldSchema;
11
+ value?: unknown;
12
+ }
13
+ /** A card as the page stands it: its session key, and its leaves in the order it draws them. */
14
+ export interface CardLayout {
15
+ key: string;
16
+ leaves: readonly LeafLayout[];
17
+ }
18
+ /** The leaves of `card` in the order it draws them: its ungrouped sections, its panels, then
19
+ * its body. */
20
+ export declare function cardLayout(card: CardModel): CardLayout;
21
+ export interface Drawn {
22
+ /** The main card, then each card of the stack. */
23
+ layout: readonly CardLayout[];
24
+ /** The cards proposed new after each card, by its key, `head` and `end` at either end. */
25
+ adds: ReadonlyMap<string, readonly {
26
+ id: string;
27
+ }[]>;
28
+ /** The removal marking each card, by its key. */
29
+ removes: ReadonlyMap<string, {
30
+ id: string;
31
+ }>;
32
+ /** The field items over the leaf at `key`. */
33
+ at(key: string): {
34
+ proposed?: FieldProposal;
35
+ nested?: readonly DeepReview[];
36
+ };
37
+ /** What each prose leaf draws, by leaf key, its ids in the leaf's order. */
38
+ reports: ReadonlyMap<string, ReviewReport>;
39
+ /** The field items no control draws. */
40
+ undrawn: ReadonlySet<string>;
41
+ }
42
+ /** The ids drawn, in the page's order. */
43
+ export declare function orderOf(drawn: Drawn): string[];
44
+ /** The open item an answer to `id` moves on to: the next one after it in `order`, as it stood
45
+ * before the answer, round from the end. `undefined` where none is left. */
46
+ export declare function nextOpen(order: readonly string[], id: string, open: ReadonlySet<string>): string | undefined;
47
+ /** Where a step in `dir` lands in `order`, round from either end: from `from` where the order
48
+ * holds it, else from the place `stepped` held when it was last stepped to, which a later item
49
+ * has taken, else from the nearer end. With `keep`, the step passes over every item it refuses.
50
+ * `undefined` where no item is left to land on. */
51
+ export declare function stepIn(order: readonly string[], dir: 1 | -1, from: string | undefined, stepped?: number, keep?: (id: string) => boolean): number | undefined;
@@ -0,0 +1,87 @@
1
+ import { rankAt } from './structure.js';
2
+ /** The leaves of `card` in the order it draws them: its ungrouped sections, its panels, then
3
+ * its body. */
4
+ export function cardLayout(card) {
5
+ const leaves = [];
6
+ if (!card.unschemable) {
7
+ const ungrouped = card.sections.filter((s) => s.group == null);
8
+ const grouped = card.sections.filter((s) => s.group != null);
9
+ for (const section of [...ungrouped, ...grouped])
10
+ for (const field of section.fields)
11
+ leaves.push({
12
+ key: `${card.id}:${field.name}`,
13
+ name: field.name,
14
+ schema: field.schema,
15
+ value: card.values[field.name]
16
+ });
17
+ if (card.hasBody)
18
+ leaves.push({ key: `${card.id}:$body` });
19
+ }
20
+ return { key: card.id, leaves };
21
+ }
22
+ const byRank = (a, b) => {
23
+ for (let i = 0; i < Math.min(a.length, b.length); i++)
24
+ if (a[i] !== b[i])
25
+ return a[i] - b[i];
26
+ return a.length - b.length;
27
+ };
28
+ /** The ids drawn, in the page's order. */
29
+ export function orderOf(drawn) {
30
+ const out = [];
31
+ const seen = new Set();
32
+ const take = (id) => {
33
+ if (seen.has(id))
34
+ return;
35
+ seen.add(id);
36
+ out.push(id);
37
+ };
38
+ const leaf = ({ key, schema, value }) => {
39
+ const { proposed, nested } = drawn.at(key);
40
+ if (proposed && !drawn.undrawn.has(proposed.id))
41
+ take(proposed.id);
42
+ const inside = (nested ?? [])
43
+ .filter((e) => !drawn.undrawn.has(e.item.id))
44
+ .map((e) => ({ id: e.item.id, rank: schema ? rankAt(schema, e.steps, value) : [] }));
45
+ for (const { id } of inside.sort((a, b) => byRank(a.rank, b.rank)))
46
+ take(id);
47
+ for (const id of drawn.reports.get(key)?.ids ?? [])
48
+ take(id);
49
+ };
50
+ const adds = (lead) => {
51
+ for (const item of drawn.adds.get(lead) ?? [])
52
+ take(item.id);
53
+ };
54
+ drawn.layout.forEach((card, n) => {
55
+ const removal = drawn.removes.get(card.key);
56
+ if (removal)
57
+ take(removal.id);
58
+ for (const at of card.leaves)
59
+ leaf(at);
60
+ adds(n === 0 ? 'head' : card.key);
61
+ });
62
+ adds('end');
63
+ return out;
64
+ }
65
+ /** The open item an answer to `id` moves on to: the next one after it in `order`, as it stood
66
+ * before the answer, round from the end. `undefined` where none is left. */
67
+ export function nextOpen(order, id, open) {
68
+ const at = order.indexOf(id);
69
+ return [...order.slice(at + 1), ...order.slice(0, Math.max(at, 0))].find((n) => open.has(n));
70
+ }
71
+ /** Where a step in `dir` lands in `order`, round from either end: from `from` where the order
72
+ * holds it, else from the place `stepped` held when it was last stepped to, which a later item
73
+ * has taken, else from the nearer end. With `keep`, the step passes over every item it refuses.
74
+ * `undefined` where no item is left to land on. */
75
+ export function stepIn(order, dir, from, stepped, keep = () => true) {
76
+ const n = order.length;
77
+ if (!n)
78
+ return undefined;
79
+ const at = from === undefined ? -1 : order.indexOf(from);
80
+ const first = at >= 0 ? at + dir : dir > 0 ? (stepped ?? 0) : (stepped ?? 0) - 1;
81
+ for (let k = 0; k < n; k++) {
82
+ const index = (((first + dir * k) % n) + n) % n;
83
+ if (keep(order[index]))
84
+ return index;
85
+ }
86
+ return undefined;
87
+ }
@@ -20,10 +20,28 @@ import { type BlockPlace, type ReviewAction } from '../core/codec/index.js';
20
20
  * and an index past the last appends.
21
21
  * - `add` or `remove`: a whole card, proposed new or proposed taken out (`CardProposal`).
22
22
  *
23
+ * A `field` on a card names the card by its index, read against the cards as they stood when
24
+ * the list was set. `card` beside it names the card by its `$id` instead, wherever it stands
25
+ * now: the path's index is then not read, and an id no card holds is a place the editor does
26
+ * not hold.
27
+ *
23
28
  * An item whose place the editor does not hold draws nothing. An answered item is drawn no
24
29
  * more: a dismissed one wrote nothing, and an accepted one is plain text in the document.
30
+ *
31
+ * Every item may carry `note` and `group` (`ReviewLabel`).
25
32
  */
26
- export type ReviewItem = FieldProposal | BlockProposal | CardProposal;
33
+ export type ReviewItem = (FieldProposal | BlockProposal | CardProposal) & ReviewLabel;
34
+ /**
35
+ * What the proposal's writer says of an item, beside where it stands.
36
+ *
37
+ * - `note`: why, in one line. The answer card shows it above its answers, cut to one line.
38
+ * - `group`: the kind of change it is, a name of the host's. `stepReview` and `answerReview`
39
+ * take a group to step through or answer its items alone.
40
+ */
41
+ export interface ReviewLabel {
42
+ note?: string;
43
+ group?: string;
44
+ }
27
45
  /**
28
46
  * A card proposed new or taken out, naming cards by their index into the composable cards as they
29
47
  * stood when the list was set, as a path does.
@@ -33,14 +51,19 @@ export type ReviewItem = FieldProposal | BlockProposal | CardProposal;
33
51
  * after one card stand in list order. Taken, it is written with its `$id` where no card holds
34
52
  * that one.
35
53
  * - `remove`: the card at that index, marked whole where it stands.
54
+ *
55
+ * `afterCard` and `card` name that card by its `$id` instead, wherever it stands now, and the
56
+ * index beside one is then not read: an id no card holds is the card gone.
36
57
  */
37
58
  export type CardProposal = {
38
59
  id: string;
39
60
  add: Card;
40
61
  after?: number;
62
+ afterCard?: string;
41
63
  } | {
42
64
  id: string;
43
65
  remove: number;
66
+ card?: string;
44
67
  };
45
68
  /** Whether an item proposes a whole card. */
46
69
  export declare const byCard: (item: object) => item is CardProposal;
@@ -48,12 +71,14 @@ export declare const byCard: (item: object) => item is CardProposal;
48
71
  export type BlockProposal = {
49
72
  id: string;
50
73
  field: DocPath;
74
+ card?: string;
51
75
  replace: readonly string[];
52
76
  before?: string;
53
77
  after: string;
54
78
  } | {
55
79
  id: string;
56
80
  field: DocPath;
81
+ card?: string;
57
82
  insert: BlockPlace;
58
83
  after: string;
59
84
  };
@@ -124,6 +149,7 @@ export declare const NO_PROJECTION: ReviewProjection;
124
149
  export type FieldProposal = {
125
150
  id: string;
126
151
  field: DocPath;
152
+ card?: string;
127
153
  before?: unknown;
128
154
  after?: unknown;
129
155
  };
@@ -87,7 +87,7 @@ export function locate(value, steps, item, claimed) {
87
87
  const free = (i) => sameValue(list[i], before) && !claimed.has(JSON.stringify([...head, i]));
88
88
  if (free(at))
89
89
  return { steps: claim(steps), found: true };
90
- for (let d = 1; d < list.length; d++)
90
+ for (let d = 1; d <= Math.max(at, list.length - 1 - at); d++)
91
91
  for (const i of [at - d, at + d])
92
92
  if (i >= 0 && i < list.length && free(i))
93
93
  return { steps: claim([...head, i]), found: true };
@@ -1,10 +1,10 @@
1
1
  import type { PathStep } from '@quillmark/wasm';
2
2
  import type { DocPath } from '../core/address.js';
3
- import type { ReviewAction, ReviewReport, ReviewVia, TextReview } from '../core/codec/index.js';
3
+ import type { ReviewAction, ReviewReport, TextReview } from '../core/codec/index.js';
4
4
  import { type ValueState } from '../core/codec/index.js';
5
- import { type CardProposal, type DeepReview, type FieldProposal, type ReviewItem, type ReviewUndrawn } from './review.js';
6
- /** How long the pointer rests on an item before it is current, in ms. */
7
- export declare const DWELL_MS = 160;
5
+ import { type CardProposal, type DeepReview, type FieldProposal, type ReviewDrawn, type ReviewItem, type ReviewUndrawn } from './review.js';
6
+ import { type CardLayout } from './review-order.js';
7
+ import type { StructuralUndo } from './undo.svelte.js';
8
8
  /** A card proposed new, drawn after the card it follows. */
9
9
  export type CardAdd = Extract<CardProposal, {
10
10
  add: unknown;
@@ -34,6 +34,10 @@ export interface Review {
34
34
  }[];
35
35
  /** The field proposals whose field no longer holds the value their `before` says was read. */
36
36
  readonly fieldOutdated: ReadonlySet<string>;
37
+ /** The open items drawn, in the page's order. */
38
+ readonly order: readonly string[];
39
+ /** What the editor draws of the host's list, and why it draws what it does not. */
40
+ readonly report: ReviewDrawn;
37
41
  /** The current item: open, drawn, and what the answer card and the review keys answer. */
38
42
  readonly lit: string | undefined;
39
43
  /** Where the open card items draw. */
@@ -52,11 +56,18 @@ export interface Review {
52
56
  keyOf(id: string): string | undefined;
53
57
  /** A prose leaf's report of what it draws. */
54
58
  drew(key: string, report: ReviewReport): void;
55
- /** The item the pointer or the caret is in, `undefined` where it left one: the caret
56
- * arriving names it at once, the pointer once it has rested, and leaving names nothing. */
57
- point(id: string | undefined, via: ReviewVia): void;
59
+ /** The item the caret is in, `undefined` where it left one: arriving names it at once, and
60
+ * leaving names nothing. */
61
+ point(id: string | undefined): void;
58
62
  /** A reader's answer. False where it could not be made. */
59
63
  act(id: string, action: ReviewAction): boolean;
64
+ /** Answer items as the answer card would, in the page's order: `'all'` is every item drawn,
65
+ * less on Accept the outdated ones, each of which would write over the reader. Each is
66
+ * planned against the document the one before it left, and one that cannot be answered
67
+ * stands. ⌘Z takes the call back whole. Returns the ids answered. */
68
+ answer(ids: readonly string[] | 'all', action: 'accept' | 'dismiss'): string[];
69
+ /** An edit landed that is no answer's: the answers before it can no longer be taken back. */
70
+ settled(): void;
60
71
  /** A reader's commit of `value` on a control that shows one value, under the proposal `id`:
61
72
  * the proposed value accepts it, any other is written and dismisses it, both one answer.
62
73
  * False where it could not be made, and the commit is the caller's. */
@@ -76,8 +87,6 @@ export interface Review {
76
87
  writing(on: boolean): void;
77
88
  /** Make `id` current at once: a step, a reveal, or a click or tap on it. */
78
89
  reveal(id: string): void;
79
- /** The pointer is over the answer card, which holds the current item where it is. */
80
- hoverCard(on: boolean): void;
81
90
  }
82
91
  export interface ReviewSource {
83
92
  items(): readonly ReviewItem[] | undefined;
@@ -99,21 +108,29 @@ export interface ReviewSource {
99
108
  leafFor(path: DocPath): string | undefined;
100
109
  /** A reader's answer, to make and to pass on: `item` where the list holds it, `key` the
101
110
  * leaf that gave it where one did, `write` the value a dismissal made by an edit writes.
102
- * `false` where it could not be made, and the item stands. */
111
+ * `false` where it could not be made, and the item stands; a function is the way back, which
112
+ * takes back what the answer wrote and reopens the item. */
103
113
  answer(id: string, item: ReviewItem | undefined, action: ReviewAction, key?: string, write?: {
104
114
  value: unknown;
105
- }): boolean;
115
+ }): boolean | (() => void);
116
+ /** Answer the item the prose leaf at `key` draws, as its answer card would. False where the
117
+ * leaf could not. */
118
+ answerProse(key: string, id: string, action: 'accept' | 'dismiss'): boolean;
119
+ /** The editor's undo, which holds the newest journal entry for the key. */
120
+ undo: StructuralUndo;
121
+ /** The main card, then each card of the stack, each with its leaves as it draws them. */
122
+ layout(): readonly CardLayout[];
106
123
  /** The session keys of the cards as they stood when the list was set, by index. */
107
124
  listedCards(): readonly string[];
108
125
  /** The session keys of the cards as they stand. */
109
126
  liveCards(): readonly string[];
110
- /** An accept or a dismissal, once it is made, `current` where the item was the current one. */
111
- answered?(id: string, current: boolean): void;
112
- writing?(on: boolean): void;
127
+ /** The session key of the card holding `$id` `id`, `undefined` where none does. */
128
+ cardFor(id: string): string | undefined;
129
+ /** The current item was answered: move on from it, in `order` where a batch of answers gives
130
+ * the order it stood in before them. */
131
+ answered?(id: string, order?: readonly string[]): void;
113
132
  }
114
- export declare function createReview(source: ReviewSource): Review & {
115
- dispose(): void;
116
- };
133
+ export declare function createReview(source: ReviewSource): Review;
117
134
  export declare function setReview(review: Review): void;
118
135
  /** The editor's review state, or {@link NO_REVIEW} off-tree. */
119
136
  export declare function review(): Review;