@quillmark/svelte 0.35.1 → 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 (82) hide show
  1. package/README.md +30 -18
  2. package/THEMING.md +1 -1
  3. package/dist/core/address.d.ts +5 -0
  4. package/dist/core/address.js +14 -0
  5. package/dist/core/codec/decode.d.ts +4 -2
  6. package/dist/core/codec/decode.js +5 -2
  7. package/dist/core/codec/field.d.ts +42 -16
  8. package/dist/core/codec/field.js +97 -28
  9. package/dist/core/codec/index.d.ts +8 -5
  10. package/dist/core/codec/index.js +4 -5
  11. package/dist/core/codec/prose.css +25 -81
  12. package/dist/core/codec/review.d.ts +31 -26
  13. package/dist/core/codec/review.js +93 -169
  14. package/dist/core/codec/schema.d.ts +12 -2
  15. package/dist/core/codec/schema.js +27 -5
  16. package/dist/core/codec/shortcuts.d.ts +5 -4
  17. package/dist/core/codec/shortcuts.js +9 -8
  18. package/dist/core/codec/table-view.js +15 -3
  19. package/dist/core/codec/value-diff.d.ts +21 -0
  20. package/dist/core/codec/value-diff.js +83 -0
  21. package/dist/core/codec/value-plan.d.ts +29 -0
  22. package/dist/core/codec/value-plan.js +157 -0
  23. package/dist/core/theme.css +46 -15
  24. package/dist/core/tooltip.css +49 -0
  25. package/dist/core/tooltip.d.ts +6 -0
  26. package/dist/core/tooltip.js +176 -0
  27. package/dist/preview/Preview.svelte +22 -1
  28. package/dist/preview/controller.js +38 -0
  29. package/dist/preview/strings.d.ts +2 -0
  30. package/dist/preview/strings.js +1 -0
  31. package/dist/visual/ArrayField.svelte +374 -96
  32. package/dist/visual/Card.svelte +33 -12
  33. package/dist/visual/Card.svelte.d.ts +3 -0
  34. package/dist/visual/CardControls.svelte +3 -3
  35. package/dist/visual/DateField.svelte +47 -5
  36. package/dist/visual/DiagnosticList.svelte +3 -2
  37. package/dist/visual/EnumField.svelte +20 -5
  38. package/dist/visual/EnumField.svelte.d.ts +5 -0
  39. package/dist/visual/Field.svelte +56 -47
  40. package/dist/visual/FieldHint.svelte +20 -8
  41. package/dist/visual/FormatPopover.svelte +54 -20
  42. package/dist/visual/MatrixField.svelte +48 -6
  43. package/dist/visual/MatrixField.svelte.d.ts +5 -0
  44. package/dist/visual/NumberField.svelte +131 -6
  45. package/dist/visual/NumberField.svelte.d.ts +5 -0
  46. package/dist/visual/ObjectField.svelte +60 -18
  47. package/dist/visual/ProseField.svelte +21 -5
  48. package/dist/visual/ProseField.svelte.d.ts +5 -1
  49. package/dist/visual/ProseValue.svelte +49 -8
  50. package/dist/visual/ProseValue.svelte.d.ts +7 -1
  51. package/dist/visual/ReviewCard.svelte +400 -0
  52. package/dist/visual/ReviewCard.svelte.d.ts +20 -0
  53. package/dist/visual/ReviewProposal.svelte +98 -138
  54. package/dist/visual/ReviewProposal.svelte.d.ts +3 -6
  55. package/dist/visual/ReviewRows.svelte +6 -25
  56. package/dist/visual/ReviewRows.svelte.d.ts +1 -3
  57. package/dist/visual/SlashMenu.svelte +1 -0
  58. package/dist/visual/TipsCard.svelte +1 -1
  59. package/dist/visual/VariantField.svelte +45 -4
  60. package/dist/visual/VariantField.svelte.d.ts +5 -0
  61. package/dist/visual/VisualEditor.svelte +24 -9
  62. package/dist/visual/VisualEditor.svelte.d.ts +8 -1
  63. package/dist/visual/VisualEditorInner.svelte +917 -280
  64. package/dist/visual/VisualEditorInner.svelte.d.ts +8 -1
  65. package/dist/visual/controls.css +2 -2
  66. package/dist/visual/index.d.ts +2 -2
  67. package/dist/visual/proposals.d.ts +25 -24
  68. package/dist/visual/proposals.js +92 -32
  69. package/dist/visual/props.d.ts +18 -18
  70. package/dist/visual/review-order.d.ts +51 -0
  71. package/dist/visual/review-order.js +87 -0
  72. package/dist/visual/review.d.ts +94 -3
  73. package/dist/visual/review.js +37 -2
  74. package/dist/visual/review.svelte.d.ts +77 -20
  75. package/dist/visual/review.svelte.js +306 -49
  76. package/dist/visual/strings.d.ts +59 -25
  77. package/dist/visual/strings.js +90 -29
  78. package/dist/visual/structure.d.ts +17 -3
  79. package/dist/visual/structure.js +71 -5
  80. package/dist/visual/undo.svelte.d.ts +3 -1
  81. package/dist/visual/undo.svelte.js +7 -3
  82. package/package.json +2 -2
@@ -43,6 +43,7 @@
43
43
  fieldModels,
44
44
  fieldTitle,
45
45
  isContainer,
46
+ linesOnly,
46
47
  literalText,
47
48
  mountKey,
48
49
  optionalCell,
@@ -54,7 +55,16 @@
54
55
  textCap
55
56
  } from './structure.js';
56
57
  import { splitDeep, unrouted, type DeepDiagnostic } from './diagnostics.js';
57
- import { splitReview, type DeepReview } from './review.js';
58
+ import {
59
+ numberProposal,
60
+ shownValue,
61
+ splitReview,
62
+ textProposal,
63
+ type DeepReview,
64
+ type FieldProposal
65
+ } from './review.js';
66
+ import { review as reviewState } from './review.svelte.js';
67
+ import { asContent } from '../core/codec/index.js';
58
68
  import ReviewRows from './ReviewRows.svelte';
59
69
  import type { LandingBox } from './leaves.js';
60
70
  import { isEmptyContent } from '../core/codec/index.js';
@@ -266,6 +276,13 @@
266
276
  return !!el;
267
277
  }
268
278
 
279
+ const reviewing = reviewState();
280
+ /** A commit on a cell that shows one value answers the proposal on it: the proposed value
281
+ * accepts it, any other dismisses it. */
282
+ function answerOrCommit(item: FieldProposal | undefined, key: string, v: unknown): void {
283
+ if (item && reviewing.answerWith(item.id, v)) return;
284
+ commitProp(key, v);
285
+ }
269
286
  function commitProp(key: string, v: unknown): void {
270
287
  if (v === undefined) {
271
288
  // A nested control cleared (the unset rung): drop the key so the property
@@ -298,7 +315,17 @@
298
315
  sub.description && idBase ? propertyDomIds(idBase, key).description : undefined}
299
316
  {@const deep = routed.below.get(key)}
300
317
  {@const reviewHere = reviewed.below.get(key)}
301
- {@const handsDown = kind === 'object' || kind === 'array'}
318
+ {@const handsDown = isContainer(kind)}
319
+ {@const ownItem = handsDown ? undefined : reviewHere?.find((e) => !e.steps.length)?.item}
320
+ {@const textOwn =
321
+ kind === 'prose' && (shortCell(sub) || literalText(sub))
322
+ ? textProposal(ownItem, contentDefault(sub))
323
+ : undefined}
324
+ {@const numberOwn = kind === 'number' ? numberProposal(ownItem) : undefined}
325
+ {@const worded = textOwn ?? numberOwn}
326
+ {@const shownItem = worded ? undefined : ownItem}
327
+ {@const shown = shownValue(shownItem, obj[key])}
328
+ {@const commitCell = (v: unknown) => answerOrCommit(shownItem, key, v)}
302
329
  {@const own = isContainer(kind) ? undefined : deep?.map((d) => d.diagnostic)}
303
330
  <!-- `for` reaches the labelable controls, a variant through its discriminant; the
304
331
  date field's focus lives on a segment and a prose cell is a `contenteditable`,
@@ -349,20 +376,23 @@
349
376
  <EnumField
350
377
  label={named}
351
378
  id={ids?.control}
379
+ labelledBy={ids?.label}
352
380
  describedBy={describes}
353
- value={obj[key] as string | undefined}
381
+ value={shown as string | undefined}
354
382
  values={sub.values ?? []}
355
383
  fallback={sub.default as string | undefined}
356
384
  blankTitle={sub.ui?.blank_title}
357
385
  optional={optionalCell(sub)}
358
- onCommit={(v) => commitProp(key, v)}
386
+ onCommit={commitCell}
387
+ proposing={!!shownItem}
359
388
  />
360
389
  {:else if kind === 'number'}
361
390
  <NumberField
362
391
  label={named}
363
392
  id={ids?.control}
364
393
  describedBy={describes}
365
- value={obj[key] as number | undefined}
394
+ value={shown as number | undefined}
395
+ proposed={numberOwn}
366
396
  integer={baseType(sub) === 'integer'}
367
397
  fallback={textDefault(sub)}
368
398
  placeholder={noneOf(key, sub)}
@@ -373,27 +403,27 @@
373
403
  label={named}
374
404
  id={ids?.control}
375
405
  describedBy={describes}
376
- value={renderedBoolean(obj[key])}
406
+ value={renderedBoolean(shown)}
377
407
  fallback={sub.default as boolean | undefined}
378
408
  optional={optionalCell(sub)}
379
- onCommit={(v) => commitProp(key, v)}
409
+ onCommit={commitCell}
380
410
  />
381
411
  {:else if kind === 'date'}
382
412
  <DateField
383
413
  label={named}
384
414
  labelledBy={ids?.label}
385
415
  describedBy={describes}
386
- value={obj[key] as string | undefined}
416
+ value={shown as string | undefined}
387
417
  fallback={sub.default != null ? String(sub.default) : undefined}
388
418
  datetime={baseType(sub) === 'datetime'}
389
- onCommit={(v) => commitProp(key, v)}
419
+ onCommit={commitCell}
390
420
  />
391
421
  {:else if kind === 'text'}
392
422
  <TextField
393
423
  label={named}
394
424
  id={ids?.control}
395
425
  describedBy={describes}
396
- value={obj[key] as string | undefined}
426
+ value={shown as string | undefined}
397
427
  fallback={textDefault(sub)}
398
428
  placeholder={noneOf(key, sub)}
399
429
  onCommit={(v) => commitProp(key, v)}
@@ -404,19 +434,26 @@
404
434
  leaves the leaf mounted and the caret in it. -->
405
435
  <ProseValue
406
436
  bind:this={proseEls[key]}
407
- content={() => contentAt([key])}
408
- value={obj[key]}
437
+ content={() =>
438
+ shownItem
439
+ ? shownItem.after === undefined
440
+ ? undefined
441
+ : asContent(shownItem.after)
442
+ : contentAt([key])}
443
+ value={shown}
409
444
  fallback={contentDefault(sub)}
410
445
  plaintext={literalText(sub)}
411
- placeholder={noneOf(key, sub)}
446
+ paragraphs={linesOnly(sub)}
447
+ placeholder={ownItem ? undefined : noneOf(key, sub)}
412
448
  {block}
413
449
  label={named}
414
450
  labelledBy={ids?.label}
415
451
  describedBy={countId ? [describes, countId].filter(Boolean).join(' ') : describes}
416
452
  cap={cap && { ...cap, onCount: (n) => (counts[key] = n) }}
417
453
  onChange={(rt) =>
418
- commitProp(key, optionalCell(sub) && isEmptyContent(rt) ? undefined : rt)}
454
+ commitCell(optionalCell(sub) && isEmptyContent(rt) ? undefined : rt)}
419
455
  onKey={onCellKey ? (e) => onCellKey(e, key) : undefined}
456
+ proposed={textOwn}
420
457
  />
421
458
  {:else if kind === 'array'}
422
459
  <!-- The repeater owns its label row, the add chip sharing it (`Field` skips
@@ -468,6 +505,7 @@
468
505
  contentAt={(path) => contentAt([key, ...path])}
469
506
  onCommit={(v) => commitProp(key, v)}
470
507
  diagnostics={deep}
508
+ review={reviewHere}
471
509
  />
472
510
  {:else if kind === 'variant'}
473
511
  <VariantField
@@ -482,6 +520,7 @@
482
520
  contentAt={(path) => contentAt([key, ...path])}
483
521
  onCommit={(v) => commitProp(key, v)}
484
522
  diagnostics={deep}
523
+ review={reviewHere}
485
524
  />
486
525
  {:else}
487
526
  <TextField
@@ -494,14 +533,16 @@
494
533
  {/if}
495
534
  <DiagnosticList diagnostics={own} />
496
535
  {#if !handsDown}
497
- <ReviewRows entries={reviewHere} value={obj[key]} />
536
+ <ReviewRows
537
+ entries={worded ? reviewHere?.filter((e) => e.item !== ownItem) : reviewHere}
538
+ />
498
539
  {/if}
499
540
  </div>
500
541
  </div>
501
542
  {/each}
502
543
  </div>
503
544
  <DiagnosticList diagnostics={foot} />
504
- <ReviewRows entries={reviewFoot} {value} />
545
+ <ReviewRows entries={reviewFoot} />
505
546
  </div>
506
547
 
507
548
  <style>
@@ -607,11 +648,12 @@
607
648
  subgrid onto the row that holds them, so a cell's edge is the column's. No
608
649
  vertical, no inset, no capacity of its own, and one row per cell, the label having
609
650
  moved up to the header. `.qm-array-row` is the row (`ArrayField`), which spends
610
- the last track on the row's remove; this box takes the rest. */
651
+ the first track on the row's handle and the last on its remove; this box takes the
652
+ rest. */
611
653
  .qm-object-bare {
612
654
  display: grid;
613
655
  grid-template-columns: subgrid;
614
- grid-column: 1 / -2;
656
+ grid-column: 2 / -2;
615
657
  }
616
658
  .qm-object-bare > .qm-object-grid {
617
659
  grid-template-columns: subgrid;
@@ -16,6 +16,7 @@
16
16
  import SlashMenu from './SlashMenu.svelte';
17
17
  import { wording } from './strings.js';
18
18
  import { review } from './review.svelte.js';
19
+ import type { TextProposal } from './review.js';
19
20
  import './controls.css';
20
21
  import type { Document, Quill, Addr, Content, Diagnostic } from '@quillmark/wasm';
21
22
  import type { EditorErrorHandler } from '../core/errors.js';
@@ -28,9 +29,10 @@
28
29
  addr: Addr;
29
30
  inline?: boolean;
30
31
  plaintext?: boolean;
32
+ paragraphs?: boolean;
31
33
  /**
32
34
  * Draw no box: the card body's leaf, and nothing else. Not `block`, which is a
33
- * different predicate: a `richtext` field declaring `multiline: true` is block
35
+ * different predicate: a `richtext` field declaring `shape: blocks` is block
34
36
  * prose and still a control in a row of controls, so only the caller knows what
35
37
  * is paper.
36
38
  */
@@ -61,6 +63,8 @@
61
63
  cap?: TextCap;
62
64
  /** Registry identity, stamped on the DOM node so a remount is visible as one. */
63
65
  leafKey: string;
66
+ /** A whole proposed value for a leaf of lines, drawn over its text as a word diff. */
67
+ proposed?: TextProposal;
64
68
  onFocus?: (addr: Addr) => void;
65
69
  onCaretMove?: (addr: Addr, pos: number) => void;
66
70
  /** A commit landed on this leaf: the prose change lane. */
@@ -80,6 +84,7 @@
80
84
  addr,
81
85
  inline,
82
86
  plaintext,
87
+ paragraphs,
83
88
  unframed,
84
89
  label,
85
90
  labelledBy,
@@ -91,6 +96,7 @@
91
96
  emptyUnsets,
92
97
  cap,
93
98
  leafKey,
99
+ proposed,
94
100
  onFocus,
95
101
  onCaretMove,
96
102
  onChange,
@@ -137,6 +143,7 @@
137
143
  container,
138
144
  inline,
139
145
  plaintext,
146
+ paragraphs,
140
147
  label,
141
148
  labelledBy,
142
149
  describedBy,
@@ -152,11 +159,11 @@
152
159
  onSlash: (next) => {
153
160
  slash = next;
154
161
  },
155
- reviewStrings: () => t.strings,
156
- onReview: (id, action, chord) => reviewing.heard(id, action, leafKey, chord),
157
- onReviewPoint: (id, via) => reviewing.point(id, via, leafKey),
162
+ onReview: (id, action) => reviewing.heard(id, action, leafKey),
163
+ onReviewPoint: (id) => reviewing.point(id),
158
164
  onReviewWriting: (on) => reviewing.writing(on),
159
165
  onReviewDrawn: (report) => reviewing.drew(leafKey, report),
166
+ onValuePlanned: (id, state) => reviewing.planned(id, state),
160
167
  onFocus,
161
168
  onCaretMove,
162
169
  onChange,
@@ -189,6 +196,15 @@
189
196
  $effect(() => {
190
197
  controller?.setReview(reviewing.textAt(leafKey), reviewing.lit);
191
198
  });
199
+ $effect(() => {
200
+ controller?.setValueProposal(proposed && { ...proposed, lit: reviewing.lit === proposed.id });
201
+ });
202
+ $effect(() => {
203
+ const id = proposed?.id;
204
+ return () => {
205
+ if (id !== undefined) reviewing.planned(id, undefined);
206
+ };
207
+ });
192
208
 
193
209
  // Only a narrowed or a plain leaf holds by what a re-validation says, so only one of them asks.
194
210
  $effect(() => {
@@ -228,7 +244,7 @@
228
244
  .qm-prose-block :global(.ProseMirror) {
229
245
  min-height: calc(1em * var(--_qm-leading-body));
230
246
  }
231
- /* Paper, and the withheld box is what says so. Not `block` alone: `multiline` is the
247
+ /* Paper, and the withheld box is what says so. Not `block` alone: `shape` is the
232
248
  quill's to declare, so a schema spelling it on a richtext field puts a block leaf in
233
249
  a field row, where this rung would break the height agreement above. */
234
250
  .qm-prose-block:not(.qm-control-box) {
@@ -1,5 +1,6 @@
1
1
  import { type TextCap } from '../core/codec/index.js';
2
2
  import type { LeafRegistry } from './leaves.js';
3
+ import type { TextProposal } from './review.js';
3
4
  import type { Document, Quill, Addr, Content, Diagnostic } from '@quillmark/wasm';
4
5
  import type { EditorErrorHandler } from '../core/errors.js';
5
6
  interface Props {
@@ -10,9 +11,10 @@ interface Props {
10
11
  addr: Addr;
11
12
  inline?: boolean;
12
13
  plaintext?: boolean;
14
+ paragraphs?: boolean;
13
15
  /**
14
16
  * Draw no box: the card body's leaf, and nothing else. Not `block`, which is a
15
- * different predicate: a `richtext` field declaring `multiline: true` is block
17
+ * different predicate: a `richtext` field declaring `shape: blocks` is block
16
18
  * prose and still a control in a row of controls, so only the caller knows what
17
19
  * is paper.
18
20
  */
@@ -43,6 +45,8 @@ interface Props {
43
45
  cap?: TextCap;
44
46
  /** Registry identity, stamped on the DOM node so a remount is visible as one. */
45
47
  leafKey: string;
48
+ /** A whole proposed value for a leaf of lines, drawn over its text as a word diff. */
49
+ proposed?: TextProposal;
46
50
  onFocus?: (addr: Addr) => void;
47
51
  onCaretMove?: (addr: Addr, pos: number) => void;
48
52
  /** A commit landed on this leaf: the prose change lane. */
@@ -28,8 +28,9 @@
28
28
  it, so the echo replaces nothing and the caret and the history stay.
29
29
 
30
30
  The schema is the declared type's where the parent has room for it: a subform cell
31
- declaring `multiline: true` takes the full row ({@link ObjectField}), a `richtext` one
32
- on the block schema and a `text` one on the plain schema, paragraphs and hard breaks.
31
+ declaring a `shape` takes the full row ({@link ObjectField}), a `richtext` of blocks
32
+ on the block schema, a `richtext` of lines on the lines schema and a `text` one on the
33
+ plain schema, paragraphs and hard breaks.
33
34
  An array element is one textblock whatever it declares, since Enter there is the
34
35
  repeater's, and a paste or a drop of several lines into one is a row per line, as Enter
35
36
  would open them, up to the array's `max:`, the last row taking what is left joined and
@@ -66,10 +67,14 @@
66
67
  pmToOffset,
67
68
  offsetToPM,
68
69
  valueEqual,
70
+ valueDiffPlugin,
71
+ type ValueProposal,
69
72
  type LeafViews,
70
73
  type TextCap
71
74
  } from '../core/codec/index.js';
72
75
  import { valueLeafSeat } from './leaves.js';
76
+ import { review } from './review.svelte.js';
77
+ import type { TextProposal } from './review.js';
73
78
  import { wording } from './strings.js';
74
79
  import './controls.css';
75
80
  import type { Content } from '@quillmark/wasm';
@@ -91,8 +96,11 @@
91
96
  * as the field of that type mounts. */
92
97
  plaintext?: boolean;
93
98
  /** A multi-block schema, for a cell the parent draws at full width: the block
94
- * schema, or the plain one with `plaintext`. Absent, the leaf is one textblock. */
99
+ * schema, the plain one with `plaintext`, or the lines one with `paragraphs`.
100
+ * Absent, the leaf is one textblock. */
95
101
  block?: boolean;
102
+ /** A `richtext` cell of `shape: lines`: formatted paragraphs and hard breaks. */
103
+ paragraphs?: boolean;
96
104
  /** Accessible name for the editable region, where nothing else names it: an
97
105
  * array has no per-element label. A cell with a label element takes
98
106
  * `labelledBy`. */
@@ -128,6 +136,8 @@
128
136
  * array repeater's Enter/Backspace (`ArrayField`). Fires before the view's own
129
137
  * keymap, so the state it reads is the one this keystroke has yet to change. */
130
138
  onKey?: (e: KeyboardEvent) => void;
139
+ /** A whole proposed value for a leaf of lines, drawn over its text as a word diff. */
140
+ proposed?: TextProposal;
131
141
  }
132
142
  let {
133
143
  content,
@@ -135,6 +145,7 @@
135
145
  fallback,
136
146
  plaintext = false,
137
147
  block = false,
148
+ paragraphs = false,
138
149
  label,
139
150
  labelledBy,
140
151
  describedBy,
@@ -142,9 +153,28 @@
142
153
  cap,
143
154
  onChange,
144
155
  lines,
145
- onKey
156
+ onKey,
157
+ proposed
146
158
  }: Props = $props();
147
159
 
160
+ const reviewing = review();
161
+ /** The proposal the value-diff plugin reads, and the view it redraws. */
162
+ let drawnProposal: ValueProposal | undefined;
163
+ let redraw: (() => void) | undefined;
164
+ $effect(() => {
165
+ drawnProposal =
166
+ proposed && (!block || plaintext)
167
+ ? { ...proposed, lit: reviewing.lit === proposed.id }
168
+ : undefined;
169
+ redraw?.();
170
+ });
171
+ $effect(() => {
172
+ const id = proposed?.id;
173
+ return () => {
174
+ if (id !== undefined) reviewing.planned(id, undefined);
175
+ };
176
+ });
177
+
148
178
  const t = wording();
149
179
  const seat = valueLeafSeat();
150
180
  const uid = $props.id();
@@ -218,7 +248,7 @@
218
248
  function mountView(mount: HTMLDivElement): () => void {
219
249
  return untrack(() => {
220
250
  const inline = !block;
221
- const leaf = { inline, plaintext, islands: false };
251
+ const leaf = { inline, plaintext, paragraphs, islands: false };
222
252
  // Read per attribute pass, not captured: an element's name carries its index,
223
253
  // which a remove above it moves.
224
254
  const names = () => drawn;
@@ -248,13 +278,13 @@
248
278
  // Which of `aria-label` / `aria-labelledby` wins is the codec's one answer
249
279
  // (`proseAttributes`), so a cell carrying a label element and a row carrying
250
280
  // none cannot name their regions by different rules.
251
- const plainNamed = () => proseAttributes(names()) ?? {};
281
+ const plainNamed = () => proseAttributes(names(), !inline);
252
282
  const heldNamed = () => heldAttributes(names(), heldId);
253
283
  const build = (rt: Content): EditorState => {
254
284
  // The same keymap and plugin stack a `createField` leaf mounts (shared
255
285
  // `proseLeafPlugins`), minus the anchor-position plugin: anchors are dropped on
256
286
  // the parent's value write, per the header.
257
- const schema = held ? blockSchema : leafSchema({ plaintext, inline });
287
+ const schema = held ? blockSchema : leafSchema({ plaintext, inline, paragraphs });
258
288
  return EditorState.create({
259
289
  doc: decode(rt, schema),
260
290
  plugins: held
@@ -263,7 +293,16 @@
263
293
  inline,
264
294
  placeholder: () => drawn.placeholder,
265
295
  leaveStrings: () => t.strings,
266
- cap
296
+ cap,
297
+ afterHistory:
298
+ inline || plaintext
299
+ ? [
300
+ valueDiffPlugin(
301
+ () => drawnProposal,
302
+ (id, state) => reviewing.planned(id, state)
303
+ )
304
+ ]
305
+ : []
267
306
  })
268
307
  });
269
308
  };
@@ -360,6 +399,7 @@
360
399
  }
361
400
  }
362
401
  );
402
+ redraw = () => mounted.setProps({});
363
403
  const views: LeafViews = {
364
404
  view: mounted,
365
405
  focusedView: () => mounted,
@@ -392,6 +432,7 @@
392
432
  seat?.release(views);
393
433
  follow = undefined;
394
434
  view = undefined;
435
+ redraw = undefined;
395
436
  mounted.destroy();
396
437
  };
397
438
  });
@@ -1,4 +1,5 @@
1
1
  import { type TextCap } from '../core/codec/index.js';
2
+ import type { TextProposal } from './review.js';
2
3
  import type { Content } from '@quillmark/wasm';
3
4
  interface Props {
4
5
  /** This leaf's content (the parent's boundary read), `undefined` where nothing is
@@ -17,8 +18,11 @@ interface Props {
17
18
  * as the field of that type mounts. */
18
19
  plaintext?: boolean;
19
20
  /** A multi-block schema, for a cell the parent draws at full width: the block
20
- * schema, or the plain one with `plaintext`. Absent, the leaf is one textblock. */
21
+ * schema, the plain one with `plaintext`, or the lines one with `paragraphs`.
22
+ * Absent, the leaf is one textblock. */
21
23
  block?: boolean;
24
+ /** A `richtext` cell of `shape: lines`: formatted paragraphs and hard breaks. */
25
+ paragraphs?: boolean;
22
26
  /** Accessible name for the editable region, where nothing else names it: an
23
27
  * array has no per-element label. A cell with a label element takes
24
28
  * `labelledBy`. */
@@ -54,6 +58,8 @@ interface Props {
54
58
  * array repeater's Enter/Backspace (`ArrayField`). Fires before the view's own
55
59
  * keymap, so the state it reads is the one this keystroke has yet to change. */
56
60
  onKey?: (e: KeyboardEvent) => void;
61
+ /** A whole proposed value for a leaf of lines, drawn over its text as a word diff. */
62
+ proposed?: TextProposal;
57
63
  }
58
64
  declare const ProseValue: import("svelte").Component<Props, {
59
65
  focus: () => void;