@quillmark/svelte 0.37.0 → 0.38.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 (45) hide show
  1. package/dist/core/codec/field.d.ts +6 -5
  2. package/dist/core/codec/field.js +15 -21
  3. package/dist/core/codec/index.d.ts +1 -1
  4. package/dist/core/codec/index.js +1 -1
  5. package/dist/core/codec/prose.css +6 -0
  6. package/dist/core/codec/review.js +8 -4
  7. package/dist/core/codec/value-diff.d.ts +4 -3
  8. package/dist/core/codec/value-diff.js +12 -7
  9. package/dist/core/codec/value-plan.d.ts +9 -0
  10. package/dist/core/codec/value-plan.js +110 -0
  11. package/dist/core/theme.css +5 -4
  12. package/dist/visual/ArrayField.svelte +143 -78
  13. package/dist/visual/Card.svelte +4 -3
  14. package/dist/visual/Card.svelte.d.ts +3 -2
  15. package/dist/visual/Field.svelte +12 -10
  16. package/dist/visual/Field.svelte.d.ts +3 -3
  17. package/dist/visual/FieldHint.svelte +3 -5
  18. package/dist/visual/FieldLabel.svelte +6 -42
  19. package/dist/visual/FieldLabel.svelte.d.ts +0 -3
  20. package/dist/visual/MatrixAdd.svelte +9 -10
  21. package/dist/visual/MatrixField.svelte +107 -15
  22. package/dist/visual/ObjectField.svelte +24 -12
  23. package/dist/visual/ObjectField.svelte.d.ts +5 -0
  24. package/dist/visual/ProseField.svelte +16 -8
  25. package/dist/visual/ProseField.svelte.d.ts +3 -2
  26. package/dist/visual/ProseValue.svelte +25 -23
  27. package/dist/visual/ProseValue.svelte.d.ts +3 -2
  28. package/dist/visual/ReviewCard.svelte +11 -4
  29. package/dist/visual/VisualEditorInner.svelte +63 -38
  30. package/dist/visual/guidance.d.ts +0 -2
  31. package/dist/visual/guidance.js +0 -10
  32. package/dist/visual/proposals.d.ts +14 -11
  33. package/dist/visual/proposals.js +44 -28
  34. package/dist/visual/props.d.ts +6 -4
  35. package/dist/visual/review-order.d.ts +1 -0
  36. package/dist/visual/review-order.js +4 -3
  37. package/dist/visual/review.d.ts +15 -2
  38. package/dist/visual/review.js +29 -1
  39. package/dist/visual/review.svelte.d.ts +6 -1
  40. package/dist/visual/review.svelte.js +37 -10
  41. package/dist/visual/strings.d.ts +2 -0
  42. package/dist/visual/strings.js +1 -0
  43. package/dist/visual/structure.d.ts +17 -9
  44. package/dist/visual/structure.js +20 -17
  45. package/package.json +1 -1
@@ -12,12 +12,12 @@
12
12
  draws the count beside it: a disabled button takes no focus, so a `title` reaches
13
13
  neither a screen reader nor a touch user, and the count is the carrier.
14
14
 
15
- An `object` element collapses: the row is its own summary — a box titled `Item` and
16
- its 1-based number, whatever the record holds — and opens onto {@link ObjectField}.
17
- Collapsed, the summary draws the words of the record's first one-line text cell after
18
- the title, at the label ink: what tells one closed row from the next, and no part of
19
- the row's name.
20
- Open, the summary keeps its words, its chevron and its remove where they stood, and
15
+ An `object` element collapses: the row is its own summary, a box that opens onto
16
+ {@link ObjectField}. Collapsed, the summary draws the words of the record's first
17
+ one-line text cell, what tells one closed row from the next; a record with none, and
18
+ every open one, is titled `Item` and its 1-based number. The words are no part of the
19
+ row's name, which keeps the number.
20
+ Open, the summary keeps its chevron and its remove where they stood, and
21
21
  lets its box go: a line at the tap rung over the subform, so the one thing a press
22
22
  on it moves is the chevron. Each row opens and closes on its own: a
23
23
  press on a summary toggles that row, and opening one leaves every other where it
@@ -38,7 +38,8 @@
38
38
 
39
39
  The row's controls are inside the element: a slab over the end of the element's own
40
40
  box, taking its two end-side corners: the remove. Every element's drag handle hangs
41
- off its start edge instead, as a table grip does. So a row's box is the element's box, and an array's rows end where
41
+ off its start edge instead, as a table grip does, once the list holds a second element
42
+ to move it past; a lone element's handle is an empty track. So a row's box is the element's box, and an array's rows end where
42
43
  every other field's control does. On an object element that box is the summary rather
43
44
  than the open row: a destructive control belongs to the line it sits on, not to
44
45
  everything that line has unfolded. A table's row carries the handle in its first track
@@ -50,7 +51,7 @@
50
51
  caret there, and short of a prose line's end splits the line there, as a bulleted list
51
52
  does; a paste of several lines into a prose row opens a row per line; Backspace at a
52
53
  prose line's start joins it onto the line above and Delete at its end joins the next
53
- onto it, each one commit; Backspace on an empty element removes it and hands focus back up the list, Alt+↑/↓
54
+ onto it, each one commit. A prose element whose `items` declares a `shape` holds lines of its own, so Enter breaks a line inside it and ⌘/Ctrl+Enter inserts the sibling, and a paste stays in the element. Backspace on an empty element removes it and hands focus back up the list, Alt+↑/↓
54
55
  anywhere in a row of the list moves it, the nearest row answering and never
55
56
  the record around a nested one: the twin of the handle's drag. A move is one splice of the ids
56
57
  and of the values together, the mechanism insert and remove use, so an element keeps
@@ -107,7 +108,7 @@
107
108
  firstShortText,
108
109
  declaredContent,
109
110
  fieldTitle,
110
- literalText,
111
+ leafFlags,
111
112
  renderedBoolean,
112
113
  schemaAt,
113
114
  textCap,
@@ -115,7 +116,8 @@
115
116
  } from './structure.js';
116
117
  import {
117
118
  numberProposal,
118
- textProposal,
119
+ putsIn,
120
+ textsOf,
119
121
  type TextProposal,
120
122
  splitReview,
121
123
  valueIn,
@@ -219,6 +221,9 @@
219
221
  // `contentAt` whatever the element rests as. An array declaring no `items`
220
222
  // has text elements.
221
223
  const control = $derived(items ? controlKind(items) : 'text');
224
+ /** A prose element whose `items` declares a `shape`: its own lines, which Enter breaks and
225
+ * ⌘/Ctrl+Enter leaves for a sibling. */
226
+ const multiline = $derived(control === 'prose' && !leafFlags(items).inline);
222
227
  const table = $derived(layout === 'table' && control === 'object');
223
228
  const columns = $derived(Object.entries(items?.properties ?? {}));
224
229
  /** A column's track. A cell that fills its width takes a share of what the field has
@@ -259,9 +264,21 @@
259
264
  unrouted(routed, (step) => typeof step === 'number' && step >= 0 && step < arr.length)
260
265
  );
261
266
  const reviewed = $derived(splitReview(review));
267
+ /** An item on a row that adds members in front of it, which the row does not draw. */
268
+ const inserting = (e: DeepReview): boolean => !e.steps.length && putsIn(e.item);
262
269
  /** A row's review items: the member's own, and those inside it. */
263
270
  const rowReview = (k: number): DeepReview[] =>
264
- k < arr.length ? (reviewed.below.get(k) ?? []) : [];
271
+ k < arr.length ? (reviewed.below.get(k) ?? []).filter((e) => !inserting(e)) : [];
272
+ /** The members a review would put in front of row `k`, each with the item that adds it. */
273
+ const insertedAt = (k: number): { item: FieldProposal; after: unknown }[] =>
274
+ k < arr.length
275
+ ? (reviewed.below.get(k) ?? []).filter(inserting).flatMap(({ item }) =>
276
+ (Array.isArray(item.after) ? item.after : [item.after]).map((after) => ({
277
+ item,
278
+ after
279
+ }))
280
+ )
281
+ : [];
265
282
  const ownReview = (k: number): DeepReview[] => rowReview(k).filter((e) => !e.steps.length);
266
283
  /** A row's own removal: the proposal that takes the member out, drawn on the whole row. */
267
284
  const removal = (k: number): FieldProposal | undefined =>
@@ -278,11 +295,17 @@
278
295
  scalar || control === 'prose'
279
296
  ? ownReview(k).find((e) => e.item.after !== undefined)?.item
280
297
  : undefined;
281
- const rowText = (k: number): TextProposal | undefined =>
282
- control === 'prose' ? textProposal(rowOwn(k)) : undefined;
298
+ const rowText = (k: number): TextProposal[] | undefined =>
299
+ control === 'prose'
300
+ ? textsOf(
301
+ ownReview(k)
302
+ .filter((e) => e.item.after !== undefined)
303
+ .map((e) => e.item)
304
+ )
305
+ : undefined;
283
306
  const rowNumber = (k: number): { id: string; after: string } | undefined =>
284
307
  control === 'number' ? numberProposal(rowOwn(k)) : undefined;
285
- const rowWorded = (k: number): { id: string } | undefined => rowText(k) ?? rowNumber(k);
308
+ const rowWorded = (k: number): { id: string } | undefined => rowText(k)?.[0] ?? rowNumber(k);
286
309
  const rowShown = (k: number): unknown => {
287
310
  const own = rowWorded(k) ? undefined : rowOwn(k);
288
311
  return own ? own.after : arr[k];
@@ -296,8 +319,8 @@
296
319
  };
297
320
  /** A row's marks: its proposals less the one its control draws as words. */
298
321
  const rowMarks = (k: number): DeepReview[] => {
299
- const text = rowWorded(k);
300
- return text ? rowKept(k).filter((e) => e.item.id !== text.id) : rowKept(k);
322
+ const drawn = new Set([...(rowText(k) ?? []), rowNumber(k)].map((p) => p?.id));
323
+ return rowKept(k).filter((e) => !drawn.has(e.item.id));
301
324
  };
302
325
  /** What a row taken out carries: its item's id and the current one lit, so the row is where
303
326
  * the answer card stands. */
@@ -318,7 +341,9 @@
318
341
  ...[...reviewed.below].flatMap(([step, list]) => {
319
342
  const held = typeof step === 'number' && step >= 0 && step < arr.length;
320
343
  return list
321
- .filter((e) => !held || (table && !e.steps.length && e.item.after !== undefined))
344
+ .filter(
345
+ (e) => !held || (table && !inserting(e) && !e.steps.length && e.item.after !== undefined)
346
+ )
322
347
  .map((e) => ({ steps: [step, ...e.steps], item: e.item }));
323
348
  })
324
349
  ]);
@@ -329,6 +354,7 @@
329
354
  e.steps.length === 1 &&
330
355
  typeof e.steps[0] === 'number' &&
331
356
  e.steps[0] >= arr.length &&
357
+ !putsIn(e.item) &&
332
358
  e.item.after !== undefined
333
359
  )
334
360
  );
@@ -895,6 +921,7 @@
895
921
  return;
896
922
  }
897
923
  if (e.key === 'Enter') {
924
+ if (multiline && !(e.ctrlKey || e.metaKey)) return;
898
925
  e.preventDefault();
899
926
  insertAfter(k, column);
900
927
  } else if (e.key === 'Backspace' && !e.repeat && elementEmpty(k, e.target, column)) {
@@ -1036,13 +1063,17 @@
1036
1063
  label={fieldTitle(key, sub)}
1037
1064
  descriptionId={idBase != null ? propertyDomIds(idBase, key).description : undefined}
1038
1065
  description={sub.description}
1039
- brief={false}
1040
1066
  />
1041
1067
  </div>
1042
1068
  {/each}
1043
1069
  <span class="qm-array-table-head-end"></span>
1044
1070
  </div>
1045
1071
  {#each ids as id, k (id)}
1072
+ {#each insertedAt(k) as { item, after }, n (`${item.id}:${n}`)}{@render addedRow(
1073
+ item,
1074
+ after,
1075
+ k
1076
+ )}{/each}
1046
1077
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1047
1078
  <div
1048
1079
  class={['qm-array-row qm-array-table-row qm-wash', { lifted: drag.lifted(k) }]}
@@ -1069,7 +1100,11 @@
1069
1100
  {@render removeButton(k, true)}
1070
1101
  </div>
1071
1102
  {/each}
1072
- {#each added as { item }, n (item.id)}{@render addedRow(item, arr.length + n)}{/each}
1103
+ {#each added as { item }, n (item.id)}{@render addedRow(
1104
+ item,
1105
+ item.after,
1106
+ arr.length + n
1107
+ )}{/each}
1073
1108
  </div>
1074
1109
  </div>
1075
1110
  {:else if control === 'object'}
@@ -1078,6 +1113,8 @@
1078
1113
  data-default={defaulted ? '' : undefined}
1079
1114
  bind:this={rowsEl}
1080
1115
  >
1116
+ <!-- A row animates its moves, so it is its keyed block's only child, and a member a review
1117
+ puts in front of it is drawn after the rows and set in place by its flex order. -->
1081
1118
  {#each ids as id, k (id)}
1082
1119
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1083
1120
  <!-- The handler catches a key from the controls inside the row and adds no
@@ -1087,6 +1124,7 @@
1087
1124
  'qm-array-row qm-element qm-wash',
1088
1125
  { open: open.has(id), lifted: drag.lifted(k) }
1089
1126
  ]}
1127
+ style:order={2 * k + 1}
1090
1128
  data-drop={drag.dropSide(k)}
1091
1129
  data-qm-index={k}
1092
1130
  bind:this={rowEls[id]}
@@ -1113,9 +1151,10 @@
1113
1151
  screen, where this unfolds in place. Same glyph, same rotation and
1114
1152
  same rung as a panel header's, so the surface has one disclosure. -->
1115
1153
  <Icon name="chevron-right" class="qm-el-chevron" size={CHEVRON} />
1116
- <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1117
1154
  {#if !open.has(id) && preview(k)}
1118
1155
  <span class="qm-element-preview">{preview(k)}</span>
1156
+ {:else}
1157
+ <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1119
1158
  {/if}
1120
1159
  {#if removal(k)}
1121
1160
  <span class="qm-review-tag">{t.strings.reviewRemoveCard}</span>
@@ -1146,7 +1185,18 @@
1146
1185
  {/if}
1147
1186
  </div>
1148
1187
  {/each}
1149
- {#each added as { item }, n (item.id)}{@render addedRow(item, arr.length + n)}{/each}
1188
+ {#each ids as _, k (k)}{#each insertedAt(k) as { item, after }, n (`${item.id}:${n}`)}{@render addedRow(
1189
+ item,
1190
+ after,
1191
+ k,
1192
+ 2 * k
1193
+ )}{/each}{/each}
1194
+ {#each added as { item }, n (item.id)}{@render addedRow(
1195
+ item,
1196
+ item.after,
1197
+ arr.length + n,
1198
+ 2 * arr.length + 1
1199
+ )}{/each}
1150
1200
  </div>
1151
1201
  {:else}
1152
1202
  <div
@@ -1155,6 +1205,11 @@
1155
1205
  bind:this={rowsEl}
1156
1206
  >
1157
1207
  {#each rowIds as id, k (id)}
1208
+ {#each insertedAt(k) as { item, after }, n (`${item.id}:${n}`)}{@render addedRow(
1209
+ item,
1210
+ after,
1211
+ k
1212
+ )}{/each}
1158
1213
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1159
1214
  <div
1160
1215
  class={['qm-array-row qm-wash', { standing: id === standingId, lifted: drag.lifted(k) }]}
@@ -1171,16 +1226,20 @@
1171
1226
  content={() => readAt([k])}
1172
1227
  value={arr[k]}
1173
1228
  proposed={rowText(k)}
1174
- plaintext={items != null && literalText(items)}
1229
+ plaintext={leafFlags(items).plaintext}
1230
+ block={multiline}
1231
+ paragraphs={leafFlags(items).paragraphs}
1175
1232
  cap={textCap(items)}
1176
1233
  label={rowName(k)}
1177
1234
  placeholder={id === standingId ? t.strings.arrayStanding : undefined}
1178
1235
  onChange={(rt) => commitElement(k, rt)}
1179
- lines={{
1180
- room: () => (max == null ? Infinity : max - Math.max(arr.length, 1)),
1181
- onLines: (rt, below, caret) => spill(k, rt, below, caret),
1182
- onJoin: (dir) => join(dir < 0 ? k - 1 : k)
1183
- }}
1236
+ lines={multiline
1237
+ ? undefined
1238
+ : {
1239
+ room: () => (max == null ? Infinity : max - Math.max(arr.length, 1)),
1240
+ onLines: (rt, below, caret) => spill(k, rt, below, caret),
1241
+ onJoin: (dir) => join(dir < 0 ? k - 1 : k)
1242
+ }}
1184
1243
  onKey={(e) => onElementKey(e, k)}
1185
1244
  />
1186
1245
  {:else if control === 'number'}
@@ -1236,7 +1295,11 @@
1236
1295
  <ReviewRows entries={rowMarks(k)} member />
1237
1296
  </div>
1238
1297
  {/each}
1239
- {#each added as { item }, n (item.id)}{@render addedRow(item, arr.length + n)}{/each}
1298
+ {#each added as { item }, n (item.id)}{@render addedRow(
1299
+ item,
1300
+ item.after,
1301
+ arr.length + n
1302
+ )}{/each}
1240
1303
  </div>
1241
1304
  {/if}
1242
1305
  <DiagnosticList diagnostics={foot} />
@@ -1247,8 +1310,7 @@
1247
1310
  the value, tinted and inert: a table's as a row of its cells under the same headers, a record
1248
1311
  list's collapsed to its summary. The row, not the control, hears the pointer and carries the
1249
1312
  item, so a press on it names the item and the answer card stands on it. -->
1250
- {#snippet addedRow(item: FieldProposal, k: number)}
1251
- {@const after = item.after}
1313
+ {#snippet addedRow(item: FieldProposal, after: unknown, k: number, order?: number)}
1252
1314
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1253
1315
  <div
1254
1316
  class={[
@@ -1259,6 +1321,7 @@
1259
1321
  'qm-review-lit': reviewing.lit === item.id
1260
1322
  }
1261
1323
  ]}
1324
+ style:order
1262
1325
  data-qm-review={item.id}
1263
1326
  role="group"
1264
1327
  aria-label={t.strings.reviewNewItem}
@@ -1278,11 +1341,12 @@
1278
1341
  <span class="qm-row-handle" aria-hidden="true"></span>
1279
1342
  <span class="qm-control-box qm-element-summary">
1280
1343
  <Icon name="chevron-right" class="qm-el-chevron" size={CHEVRON} />
1281
- <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1282
1344
  {#if firstShortText(items?.properties, (after ?? {}) as Record<string, unknown>)}
1283
1345
  <span class="qm-element-preview"
1284
1346
  >{firstShortText(items?.properties, (after ?? {}) as Record<string, unknown>)}</span
1285
1347
  >
1348
+ {:else}
1349
+ <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1286
1350
  {/if}
1287
1351
  </span>
1288
1352
  </div>
@@ -1290,7 +1354,9 @@
1290
1354
  <ProseValue
1291
1355
  content={() => asContent(after)}
1292
1356
  value={after}
1293
- plaintext={items != null && literalText(items)}
1357
+ plaintext={leafFlags(items).plaintext}
1358
+ block={multiline}
1359
+ paragraphs={leafFlags(items).paragraphs}
1294
1360
  label={rowName(k)}
1295
1361
  onChange={() => {}}
1296
1362
  />
@@ -1348,18 +1414,22 @@
1348
1414
  effect. Its twin is Alt+↑/↓ from anywhere in the row, which a record's summary
1349
1415
  announces, as a table's or a line's remove does for its own row. -->
1350
1416
  {#snippet handle(k: number)}
1351
- <span
1352
- class="qm-row-handle"
1353
- aria-hidden="true"
1354
- data-qm-tip={t.strings.arrayDrag}
1355
- data-qm-tip-keys={keycap('Alt-↑/↓')}
1356
- onpointerdown={(e) => drag.down(e, k)}
1357
- onpointermove={drag.move}
1358
- onpointerup={drag.up}
1359
- onpointercancel={drag.up}
1360
- onlostpointercapture={drag.up}
1361
- ><span class="qm-row-handle-bar"><Icon name="grip-vertical" /></span></span
1362
- >
1417
+ {#if ids.length < 2}
1418
+ <span class="qm-row-handle" aria-hidden="true"></span>
1419
+ {:else}
1420
+ <span
1421
+ class="qm-row-handle"
1422
+ aria-hidden="true"
1423
+ data-qm-tip={t.strings.arrayDrag}
1424
+ data-qm-tip-keys={keycap('Alt-↑/↓')}
1425
+ onpointerdown={(e) => drag.down(e, k)}
1426
+ onpointermove={drag.move}
1427
+ onpointerup={drag.up}
1428
+ onpointercancel={drag.up}
1429
+ onlostpointercapture={drag.up}
1430
+ ><span class="qm-row-handle-bar"><Icon name="grip-vertical" /></span></span
1431
+ >
1432
+ {/if}
1363
1433
  {/snippet}
1364
1434
 
1365
1435
  <style>
@@ -1378,11 +1448,6 @@
1378
1448
  justify-content: space-between;
1379
1449
  gap: var(--_qm-space-2);
1380
1450
  }
1381
- /* Under a label that carries its description in flow, the chip keeps the label's
1382
- line rather than centring on the two. */
1383
- .qm-array-header:has(> :global(.qm-field-label-row.briefed)) {
1384
- align-items: baseline;
1385
- }
1386
1451
  .qm-array-add-slot {
1387
1452
  display: inline-flex;
1388
1453
  align-items: center;
@@ -1470,16 +1535,18 @@
1470
1535
  `.qm-icon-btn`'s radius, which is the same rung the box draws; a slab standing before
1471
1536
  another gives up its corners on both sides.
1472
1537
 
1473
- It comes up on its own row rather than on the field: a destructive control is offered
1474
- by the row the pointer is on, not by every row at once. Hover is where the remove says destructive, ink with fill, a
1475
- tint alone being a wash under a label-toned glyph. */
1538
+ It waits for its row as the handle does (INVARIANTS §"A field's own chrome waits for
1539
+ the field"): a destructive control is offered by the row the pointer is on or the
1540
+ focus is in, not by every row at once, holding its box meanwhile and arriving by
1541
+ opacity, and resting drawn where nothing hovers. Hover is where the remove says
1542
+ destructive, ink with fill, a tint alone being a wash under a label-toned glyph. */
1476
1543
  .qm-row-actions {
1477
1544
  position: absolute;
1478
1545
  inset-block: 0;
1479
1546
  inset-inline-end: 0;
1480
1547
  display: flex;
1481
1548
  color: var(--_qm-ink-label);
1482
- opacity: var(--_qm-opacity-rest);
1549
+ opacity: 0;
1483
1550
  transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
1484
1551
  }
1485
1552
  .qm-row-btn {
@@ -1503,6 +1570,11 @@
1503
1570
  .qm-array-row:focus-within > .qm-element-head > .qm-row-actions {
1504
1571
  opacity: 1;
1505
1572
  }
1573
+ @media (hover: none) {
1574
+ .qm-row-actions {
1575
+ opacity: 1;
1576
+ }
1577
+ }
1506
1578
  .qm-remove:hover:not(:disabled) {
1507
1579
  background: var(--_qm-danger-tint);
1508
1580
  color: var(--_qm-danger);
@@ -1510,8 +1582,8 @@
1510
1582
  /* The handle is a table grip's twin (prose.css §"One grip per line"): a pill carrying
1511
1583
  the grip's marks, hung off the row's start edge in the `--_qm-nest` every row stands
1512
1584
  in from the stroke outside it, which a group's panel clips at. The pill rests
1513
- at nothing, where the remove rests faint, and comes up with the row the pointer is
1514
- on, staying up through the drag it carries; a band flush with the row keeps the
1585
+ at nothing, as the remove does, and comes up with the row the pointer is
1586
+ on or the focus is in, staying up through the drag it carries; with no hover, the row the focus is in alone; a band flush with the row keeps the
1515
1587
  pointer on the row all the way to it. The pointer owns the gesture, not the page's
1516
1588
  scroll. A record's pill centres on its summary; a line's and a table row's stand on
1517
1589
  the first line, which a wrapping cell grows away from. */
@@ -1527,6 +1599,9 @@
1527
1599
  cursor: grab;
1528
1600
  touch-action: none;
1529
1601
  }
1602
+ .qm-row-handle:empty {
1603
+ cursor: auto;
1604
+ }
1530
1605
  .qm-row-handle-bar {
1531
1606
  display: flex;
1532
1607
  align-items: center;
@@ -1549,7 +1624,9 @@
1549
1624
  height: var(--_qm-space-3);
1550
1625
  }
1551
1626
  .qm-array-row:hover > .qm-row-handle > .qm-row-handle-bar,
1627
+ .qm-array-row:focus-within > .qm-row-handle > .qm-row-handle-bar,
1552
1628
  .qm-array-row:hover > .qm-element-head > .qm-row-handle > .qm-row-handle-bar,
1629
+ .qm-array-row:focus-within > .qm-element-head > .qm-row-handle > .qm-row-handle-bar,
1553
1630
  .qm-array-row.lifted > .qm-row-handle > .qm-row-handle-bar,
1554
1631
  .qm-element.lifted > .qm-element-head > .qm-row-handle > .qm-row-handle-bar {
1555
1632
  opacity: 1;
@@ -1654,17 +1731,23 @@
1654
1731
  .qm-element.open > .qm-element-head :global(.qm-el-chevron) {
1655
1732
  transform: rotate(90deg);
1656
1733
  }
1657
- /* The title is the row's name, at the ink as a card's is, on one line however long
1658
- the label runs. */
1659
- .qm-element-title {
1734
+ /* The title is the row's name, and the words a closed record shows in its place, at
1735
+ the ink as a card's is, on one line however long they run. */
1736
+ .qm-element-title,
1737
+ .qm-element-preview {
1660
1738
  overflow: hidden;
1661
1739
  text-overflow: ellipsis;
1662
1740
  white-space: nowrap;
1663
1741
  color: var(--_qm-ink);
1742
+ }
1743
+ .qm-element-title {
1664
1744
  font-variant-numeric: tabular-nums;
1665
1745
  }
1666
- /* What the closed record holds, after its name and a rung under it: the label ink,
1667
- on the line's remainder, and the first to give way where the line runs short. */
1746
+ .qm-element-preview {
1747
+ flex: 1 1 0;
1748
+ min-width: 0;
1749
+ text-align: start;
1750
+ }
1668
1751
  .qm-review-tag {
1669
1752
  flex: none;
1670
1753
  margin-inline-start: auto;
@@ -1672,18 +1755,6 @@
1672
1755
  font-weight: var(--_qm-weight-mid);
1673
1756
  color: var(--_qm-ink-label);
1674
1757
  }
1675
- .qm-element-preview {
1676
- flex: 1 1 0;
1677
- min-width: 0;
1678
- overflow: hidden;
1679
- text-overflow: ellipsis;
1680
- white-space: nowrap;
1681
- text-align: start;
1682
- color: var(--_qm-ink-label);
1683
- }
1684
- .qm-element-summary:has(.qm-element-preview) > .qm-element-title {
1685
- flex-shrink: 0;
1686
- }
1687
1758
  /* ── A table ────────────────────────────────────────────────────────────────
1688
1759
  Every row of it is open, so it stands where an open row's subform stands: a rung
1689
1760
  inside the field, behind the subform's vertical and between its caps (`ObjectField`,
@@ -1919,10 +1990,4 @@
1919
1990
  .qm-add-el:disabled {
1920
1991
  opacity: var(--_qm-opacity-idle);
1921
1992
  }
1922
- /* No hover to come up on: the handle stands with the controls, already at rest. */
1923
- @media (hover: none) {
1924
- .qm-row-handle-bar {
1925
- opacity: 1;
1926
- }
1927
- }
1928
1993
  </style>
@@ -38,8 +38,9 @@
38
38
  retype: (kind: string) => void;
39
39
  rename: (title: string) => void;
40
40
  diagFor: (field?: string) => Diagnostic[] | undefined;
41
- /** Consumer enum-option policy for a field; true when no hook set. */
42
- enumAllowed: (field: string, value: string) => boolean;
41
+ /** Consumer enum-option policy for a field, or for an enum `steps` down inside it;
42
+ * true when no hook set. */
43
+ enumAllowed: (field: string, value: string, steps?: readonly PathStep[]) => boolean;
43
44
  }
44
45
 
45
46
  interface Props {
@@ -400,7 +401,7 @@
400
401
  leafKey={ops.leafKey(f.name)}
401
402
  domIds={ops.domIds(f.name)}
402
403
  onCommitScalar={(v) => ops.commit(f.name, v)}
403
- optionAllowed={(v) => ops.enumAllowed(f.name, v)}
404
+ optionAllowed={(v, steps) => ops.enumAllowed(f.name, v, steps)}
404
405
  {enumDisallowed}
405
406
  {onFocus}
406
407
  {onCaretMove}
@@ -15,8 +15,9 @@ interface CardOps {
15
15
  retype: (kind: string) => void;
16
16
  rename: (title: string) => void;
17
17
  diagFor: (field?: string) => Diagnostic[] | undefined;
18
- /** Consumer enum-option policy for a field; true when no hook set. */
19
- enumAllowed: (field: string, value: string) => boolean;
18
+ /** Consumer enum-option policy for a field, or for an enum `steps` down inside it;
19
+ * true when no hook set. */
20
+ enumAllowed: (field: string, value: string, steps?: readonly PathStep[]) => boolean;
20
21
  }
21
22
  interface Props {
22
23
  card: CardModel;
@@ -60,7 +60,7 @@
60
60
  import ReviewProposal from './ReviewProposal.svelte';
61
61
  import ReviewRows from './ReviewRows.svelte';
62
62
  import { review } from './review.svelte.js';
63
- import { numberProposal, shownValue, textProposal } from './review.js';
63
+ import { numberProposal, shownValue, textsOf } from './review.js';
64
64
 
65
65
  interface Props {
66
66
  field: FieldModel;
@@ -83,9 +83,9 @@
83
83
  * the label and the control find each other. */
84
84
  domIds: FieldDomIds;
85
85
  onCommitScalar: (value: unknown) => void;
86
- /** Enum-option policy: `false` marks that option unavailable. Only the enum
87
- * control reads this pair. */
88
- optionAllowed?: (value: string) => boolean;
86
+ /** Enum-option policy: `false` marks that option unavailable, on the field's own
87
+ * enum control (`steps` absent) or on an enum `steps` down its object subform. */
88
+ optionAllowed?: (value: string, steps?: readonly PathStep[]) => boolean;
89
89
  /** How a refused option draws: greyed (default) or left out. */
90
90
  enumDisallowed?: 'hide' | 'disable';
91
91
  /** A focus inside the field: its address, and the steps down to the cell holding
@@ -323,16 +323,16 @@
323
323
  * rather than counted twice.
324
324
  */
325
325
  // ── Review: this field's own items (`review.svelte.ts`) ──────────────────────
326
- /** A whole proposed value drawn as words over the control's own: a leaf of lines' as a word
327
- * diff, carried onto what the reader wrote since its writer read it, a number's as the struck
328
- * and the proposed figures. */
326
+ /** A proposed value drawn as words over the control's own: a text field's as a word diff,
327
+ * whatever its kind, a whole value or each run of one answer, carried onto what the reader
328
+ * wrote since its writer read it; a number's as the struck and the proposed figures. */
329
329
  const texted = $derived(
330
- field.control === 'prose' && (field.inline || field.plaintext)
331
- ? textProposal(proposed, printed ? (ghost as Content) : undefined)
330
+ field.control === 'prose' && proposed
331
+ ? textsOf([proposed, ...(reviewed.more ?? [])], printed ? (ghost as Content) : undefined)
332
332
  : undefined
333
333
  );
334
334
  const numbered = $derived(field.control === 'number' ? numberProposal(proposed) : undefined);
335
- const worded = $derived(texted ?? numbered);
335
+ const worded = $derived(texted?.[0] ?? numbered);
336
336
  /** What a control that cannot draw a proposal as words shows while one stands: the value
337
337
  * Accept would write, tinted (`ReviewProposal`), or its default or empty face where Accept
338
338
  * clears it. */
@@ -495,6 +495,8 @@
495
495
  bind:this={objectEl}
496
496
  value={value as Record<string, unknown> | undefined}
497
497
  properties={field.schema.properties}
498
+ {optionAllowed}
499
+ {enumDisallowed}
498
500
  {flat}
499
501
  placed
500
502
  label={field.label}
@@ -24,9 +24,9 @@ interface Props {
24
24
  * the label and the control find each other. */
25
25
  domIds: FieldDomIds;
26
26
  onCommitScalar: (value: unknown) => void;
27
- /** Enum-option policy: `false` marks that option unavailable. Only the enum
28
- * control reads this pair. */
29
- optionAllowed?: (value: string) => boolean;
27
+ /** Enum-option policy: `false` marks that option unavailable, on the field's own
28
+ * enum control (`steps` absent) or on an enum `steps` down its object subform. */
29
+ optionAllowed?: (value: string, steps?: readonly PathStep[]) => boolean;
30
30
  /** How a refused option draws: greyed (default) or left out. */
31
31
  enumDisallowed?: 'hide' | 'disable';
32
32
  /** A focus inside the field: its address, and the steps down to the cell holding
@@ -9,11 +9,9 @@
9
9
  on touch, which leaves guidance the reference quill puts on nearly every field
10
10
  reachable on a tablet only through a screen reader.
11
11
 
12
- Floating, for a description past a line or so (`isBrief`): the reference quill's
13
- descriptions run to a median of ~110 characters and past 250 at the tail, and
14
- permanently in flow that is several wrapped lines under every field, which is the
15
- density the card is built to avoid. A short one stands under its label instead
16
- ({@link FieldLabel}) and raises no marker.
12
+ Floating, for every description: the reference quill's descriptions run to a median
13
+ of ~110 characters and past 250 at the tail, and permanently in flow that is several
14
+ wrapped lines under every field, which is the density the card is built to avoid.
17
15
 
18
16
  The popover is chrome, not the announcement. Its content is `aria-hidden`: the
19
17
  description reaches assistive tech through the always-present parked node