@quillmark/svelte 0.36.0 → 0.37.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.
Files changed (71) 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 +14 -10
  6. package/dist/core/codec/field.js +34 -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 +20 -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 +44 -17
  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 +262 -145
  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 +22 -13
  34. package/dist/visual/FieldLabel.svelte +6 -42
  35. package/dist/visual/FieldLabel.svelte.d.ts +0 -3
  36. package/dist/visual/FormatPopover.svelte +53 -20
  37. package/dist/visual/MatrixAdd.svelte +9 -10
  38. package/dist/visual/MatrixField.svelte +114 -18
  39. package/dist/visual/NumberField.svelte +21 -5
  40. package/dist/visual/ObjectField.svelte +6 -2
  41. package/dist/visual/ProseField.svelte +6 -3
  42. package/dist/visual/ProseField.svelte.d.ts +2 -1
  43. package/dist/visual/ProseValue.svelte +13 -6
  44. package/dist/visual/ProseValue.svelte.d.ts +4 -1
  45. package/dist/visual/ReviewCard.svelte +93 -33
  46. package/dist/visual/ReviewCard.svelte.d.ts +2 -1
  47. package/dist/visual/ReviewProposal.svelte +0 -6
  48. package/dist/visual/TipsCard.svelte +1 -1
  49. package/dist/visual/VariantField.svelte +1 -0
  50. package/dist/visual/VisualEditor.svelte +12 -6
  51. package/dist/visual/VisualEditor.svelte.d.ts +5 -1
  52. package/dist/visual/VisualEditorInner.svelte +218 -302
  53. package/dist/visual/VisualEditorInner.svelte.d.ts +5 -1
  54. package/dist/visual/controls.css +2 -2
  55. package/dist/visual/guidance.d.ts +0 -2
  56. package/dist/visual/guidance.js +0 -10
  57. package/dist/visual/index.d.ts +2 -2
  58. package/dist/visual/proposals.d.ts +14 -4
  59. package/dist/visual/proposals.js +28 -5
  60. package/dist/visual/props.d.ts +1 -1
  61. package/dist/visual/review-order.d.ts +51 -0
  62. package/dist/visual/review-order.js +87 -0
  63. package/dist/visual/review.d.ts +27 -1
  64. package/dist/visual/review.js +1 -1
  65. package/dist/visual/review.svelte.d.ts +34 -17
  66. package/dist/visual/review.svelte.js +187 -44
  67. package/dist/visual/strings.d.ts +38 -19
  68. package/dist/visual/strings.js +81 -24
  69. package/dist/visual/structure.d.ts +17 -3
  70. package/dist/visual/structure.js +71 -5
  71. package/package.json +2 -2
@@ -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
@@ -37,22 +37,23 @@
37
37
  container or a block prose cell.
38
38
 
39
39
  The row's controls are inside the element: a slab over the end of the element's own
40
- box, taking its two end-side corners: the remove. An `object` row'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
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, 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
- everything that line has unfolded. A table's row carries the remove alone, in its last
45
- track and pinned to the end edge of the box the table scrolls in, so the one control
46
- the row draws never needs a scroll to reach. A table's row and a line carry no handle:
47
- their reorder is the key's alone.
45
+ everything that line has unfolded. A table's row carries the handle in its first track
46
+ and the remove in its last, each pinned to its edge of the box the table scrolls in, so
47
+ neither control the row draws ever needs a scroll to reach. The standing row is no
48
+ element and carries no handle.
48
49
 
49
50
  Keys carry the list without the mouse: Enter inserts a sibling below and takes the
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
- the record around a nested one, and on an `object` row is the twin of the handle's drag. A move is one splice of the ids
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
57
58
  its id for life and no prose leaf inside it remounts; the open row stays open across
58
59
  its own move, and `animate:reorder` holds the moving row as it holds a card.
@@ -89,7 +90,7 @@
89
90
  -->
90
91
  <script lang="ts">
91
92
  import { SvelteSet } from 'svelte/reactivity';
92
- import { wording } from './strings.js';
93
+ import { keycap, wording } from './strings.js';
93
94
  import { structuralUndo } from './undo.svelte.js';
94
95
 
95
96
  // The surface's words, ambient from the editor root; the package's English
@@ -107,7 +108,9 @@
107
108
  firstShortText,
108
109
  declaredContent,
109
110
  fieldTitle,
111
+ linesOnly,
110
112
  literalText,
113
+ oneLine,
111
114
  renderedBoolean,
112
115
  schemaAt,
113
116
  textCap,
@@ -219,8 +222,25 @@
219
222
  // `contentAt` whatever the element rests as. An array declaring no `items`
220
223
  // has text elements.
221
224
  const control = $derived(items ? controlKind(items) : 'text');
225
+ /** A prose element whose `items` declares a `shape`: its own lines, which Enter breaks and
226
+ * ⌘/Ctrl+Enter leaves for a sibling. */
227
+ const multiline = $derived(control === 'prose' && items != null && !oneLine(items));
222
228
  const table = $derived(layout === 'table' && control === 'object');
223
229
  const columns = $derived(Object.entries(items?.properties ?? {}));
230
+ /** A column's track. A cell that fills its width takes a share of what the field has
231
+ * spare, a control of one width (an enum, a date, a number) rests at its content,
232
+ * and a switch at its mark; every track's base is what its cells cannot shrink
233
+ * below, so a field too narrow for the floors scrolls sideways. */
234
+ const tracks = $derived(
235
+ columns
236
+ .map(([, sub]) => {
237
+ const kind = controlKind(sub);
238
+ if (kind === 'boolean') return 'auto';
239
+ if (kind === 'prose' || kind === 'text') return 'minmax(min-content, 1fr)';
240
+ return 'minmax(min-content, max-content)';
241
+ })
242
+ .join(' ')
243
+ );
224
244
  const defaulted = $derived(value == null && (fallback?.length ?? 0) > 0);
225
245
  // A bare value is the one-element list the render floor wraps it into (quillmark/INVARIANTS
226
246
  // §"Coercion is the type predicate"), and the reader answers no element of it.
@@ -285,17 +305,15 @@
285
305
  const text = rowWorded(k);
286
306
  return text ? rowKept(k).filter((e) => e.item.id !== text.id) : rowKept(k);
287
307
  };
288
- /** What a row taken out carries: its item's id, the current one lit, and the pointer naming
289
- * it, so the row is where the answer card stands. */
308
+ /** What a row taken out carries: its item's id and the current one lit, so the row is where
309
+ * the answer card stands. */
290
310
  const removedRow = (k: number) => {
291
311
  const gone = removal(k);
292
312
  return gone
293
313
  ? {
294
314
  'data-qm-review': gone.id,
295
315
  'data-qm-removed': '',
296
- 'data-qm-removed-lit': reviewing.lit === gone.id ? '' : undefined,
297
- onpointerenter: () => reviewing.point(gone.id, 'pointer'),
298
- onpointerleave: () => reviewing.point(undefined, 'pointer')
316
+ 'data-qm-removed-lit': reviewing.lit === gone.id ? '' : undefined
299
317
  }
300
318
  : {};
301
319
  };
@@ -883,6 +901,7 @@
883
901
  return;
884
902
  }
885
903
  if (e.key === 'Enter') {
904
+ if (multiline && !(e.ctrlKey || e.metaKey)) return;
886
905
  e.preventDefault();
887
906
  insertAfter(k, column);
888
907
  } else if (e.key === 'Backspace' && !e.repeat && elementEmpty(k, e.target, column)) {
@@ -921,26 +940,31 @@
921
940
  move: (k, to) => {
922
941
  const id = ids[k];
923
942
  move(k, to);
924
- // The row's summary takes the focus, so the keys that move it or take the move
925
- // back act on the row the pointer just moved.
943
+ // The row takes the focus, its summary or else its first control, so the keys
944
+ // that move it or take the move back act on the row the pointer just moved.
926
945
  void (async () => {
927
946
  if (!(await span.resumes(tick()))) return;
928
- const summary = rowEls[id]?.querySelector<HTMLElement>('.qm-element-summary');
929
- if (summary && !rowEls[id]?.contains(document.activeElement))
930
- summary.focus({ preventScroll: true });
947
+ const row = rowEls[id];
948
+ if (!row || row.contains(document.activeElement)) return;
949
+ const summary = row.querySelector<HTMLElement>('.qm-element-summary');
950
+ if (summary) summary.focus({ preventScroll: true });
951
+ else if (table) cellEls[id]?.focus();
952
+ else focusRow(id);
931
953
  })();
932
954
  }
933
955
  });
934
956
  onDestroy(drag.release);
935
957
 
936
958
  /** Whether cells stand past the table scroller's end edge, under the pinned remove,
937
- * which is what the fade before the remove draws on. */
959
+ * and past its start edge, under the pinned handle: what the fade beside each draws on. */
938
960
  let tableOverflow = $state(false);
961
+ let tableScrolled = $state(false);
939
962
  /** The head row spans every track, so its box is the content width a new row or a
940
963
  * longer cell changes. */
941
964
  function trackOverflow(el: HTMLElement): () => void {
942
965
  const measure = () => {
943
966
  tableOverflow = el.scrollWidth - el.clientWidth - Math.abs(el.scrollLeft) > 1;
967
+ tableScrolled = Math.abs(el.scrollLeft) > 1;
944
968
  };
945
969
  measure();
946
970
  el.addEventListener('scroll', measure, { passive: true });
@@ -979,9 +1003,10 @@
979
1003
  type="button"
980
1004
  class="qm-add-el qm-chip qm-focus-ring qm-tap-floor"
981
1005
  bind:this={addEl}
1006
+ aria-label={t.strings.arrayAdd}
982
1007
  aria-describedby={max != null ? countId : undefined}
983
1008
  disabled={atCap}
984
- onclick={add}>{t.strings.arrayAdd}</button
1009
+ onclick={add}>{`+ ${t.strings.arrayAdd}`}</button
985
1010
  >
986
1011
  </span>
987
1012
  </div>
@@ -996,7 +1021,9 @@
996
1021
  <div
997
1022
  class="qm-array-table-scroller"
998
1023
  data-overflow={tableOverflow ? '' : undefined}
1024
+ data-scrolled={tableScrolled ? '' : undefined}
999
1025
  style:--table-cols={columns.length}
1026
+ style:--table-tracks={tracks}
1000
1027
  {@attach trackOverflow}
1001
1028
  >
1002
1029
  <!-- The header names the columns, so a cell carries no label of its own: its
@@ -1004,6 +1031,7 @@
1004
1031
  guidance affordance rides the header, being the column's rather than any
1005
1032
  one cell's. -->
1006
1033
  <div class="qm-array-table-head">
1034
+ <span class="qm-array-table-head-start"></span>
1007
1035
  {#each columns as [key, sub] (key)}
1008
1036
  <div
1009
1037
  class={[
@@ -1015,7 +1043,6 @@
1015
1043
  label={fieldTitle(key, sub)}
1016
1044
  descriptionId={idBase != null ? propertyDomIds(idBase, key).description : undefined}
1017
1045
  description={sub.description}
1018
- brief={false}
1019
1046
  />
1020
1047
  </div>
1021
1048
  {/each}
@@ -1024,12 +1051,14 @@
1024
1051
  {#each ids as id, k (id)}
1025
1052
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1026
1053
  <div
1027
- class="qm-array-row qm-array-table-row qm-wash"
1054
+ class={['qm-array-row qm-array-table-row qm-wash', { lifted: drag.lifted(k) }]}
1055
+ data-drop={drag.dropSide(k)}
1028
1056
  data-qm-index={k}
1029
1057
  bind:this={rowEls[id]}
1030
1058
  onkeydown={(e) => onRowKey(e, k)}
1031
1059
  {...removedRow(k)}
1032
1060
  >
1061
+ {@render handle(k)}
1033
1062
  <ObjectField
1034
1063
  bare
1035
1064
  bind:this={cellEls[id]}
@@ -1090,9 +1119,10 @@
1090
1119
  screen, where this unfolds in place. Same glyph, same rotation and
1091
1120
  same rung as a panel header's, so the surface has one disclosure. -->
1092
1121
  <Icon name="chevron-right" class="qm-el-chevron" size={CHEVRON} />
1093
- <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1094
1122
  {#if !open.has(id) && preview(k)}
1095
1123
  <span class="qm-element-preview">{preview(k)}</span>
1124
+ {:else}
1125
+ <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1096
1126
  {/if}
1097
1127
  {#if removal(k)}
1098
1128
  <span class="qm-review-tag">{t.strings.reviewRemoveCard}</span>
@@ -1134,12 +1164,14 @@
1134
1164
  {#each rowIds as id, k (id)}
1135
1165
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1136
1166
  <div
1137
- class={['qm-array-row qm-wash', { standing: id === standingId }]}
1167
+ class={['qm-array-row qm-wash', { standing: id === standingId, lifted: drag.lifted(k) }]}
1168
+ data-drop={drag.dropSide(k)}
1138
1169
  data-qm-index={k}
1139
1170
  {...removedRow(k)}
1140
1171
  bind:this={rowEls[id]}
1141
1172
  onkeydown={(e) => onRowKey(e, k)}
1142
1173
  >
1174
+ {#if id !== standingId}{@render handle(k)}{/if}
1143
1175
  {#if control === 'prose'}
1144
1176
  <ProseValue
1145
1177
  bind:this={els[id]}
@@ -1147,15 +1179,19 @@
1147
1179
  value={arr[k]}
1148
1180
  proposed={rowText(k)}
1149
1181
  plaintext={items != null && literalText(items)}
1182
+ block={multiline}
1183
+ paragraphs={items != null && linesOnly(items)}
1150
1184
  cap={textCap(items)}
1151
1185
  label={rowName(k)}
1152
1186
  placeholder={id === standingId ? t.strings.arrayStanding : undefined}
1153
1187
  onChange={(rt) => commitElement(k, rt)}
1154
- lines={{
1155
- room: () => (max == null ? Infinity : max - Math.max(arr.length, 1)),
1156
- onLines: (rt, below, caret) => spill(k, rt, below, caret),
1157
- onJoin: (dir) => join(dir < 0 ? k - 1 : k)
1158
- }}
1188
+ lines={multiline
1189
+ ? undefined
1190
+ : {
1191
+ room: () => (max == null ? Infinity : max - Math.max(arr.length, 1)),
1192
+ onLines: (rt, below, caret) => spill(k, rt, below, caret),
1193
+ onJoin: (dir) => join(dir < 0 ? k - 1 : k)
1194
+ }}
1159
1195
  onKey={(e) => onElementKey(e, k)}
1160
1196
  />
1161
1197
  {:else if control === 'number'}
@@ -1237,8 +1273,6 @@
1237
1273
  data-qm-review={item.id}
1238
1274
  role="group"
1239
1275
  aria-label={t.strings.reviewNewItem}
1240
- onpointerenter={() => reviewing.point(item.id, 'pointer')}
1241
- onpointerleave={() => reviewing.point(undefined, 'pointer')}
1242
1276
  >
1243
1277
  <div class="qm-review-added-box" inert>
1244
1278
  {#if table}
@@ -1255,11 +1289,12 @@
1255
1289
  <span class="qm-row-handle" aria-hidden="true"></span>
1256
1290
  <span class="qm-control-box qm-element-summary">
1257
1291
  <Icon name="chevron-right" class="qm-el-chevron" size={CHEVRON} />
1258
- <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1259
1292
  {#if firstShortText(items?.properties, (after ?? {}) as Record<string, unknown>)}
1260
1293
  <span class="qm-element-preview"
1261
1294
  >{firstShortText(items?.properties, (after ?? {}) as Record<string, unknown>)}</span
1262
1295
  >
1296
+ {:else}
1297
+ <span class="qm-element-title">{t.strings.elementItem(k + 1)}</span>
1263
1298
  {/if}
1264
1299
  </span>
1265
1300
  </div>
@@ -1268,6 +1303,8 @@
1268
1303
  content={() => asContent(after)}
1269
1304
  value={after}
1270
1305
  plaintext={items != null && literalText(items)}
1306
+ block={multiline}
1307
+ paragraphs={items != null && linesOnly(items)}
1271
1308
  label={rowName(k)}
1272
1309
  onChange={() => {}}
1273
1310
  />
@@ -1311,7 +1348,7 @@
1311
1348
  <button
1312
1349
  type="button"
1313
1350
  class="qm-icon-btn qm-row-btn qm-remove qm-focus-ring"
1314
- title={t.strings.arrayRemove}
1351
+ data-qm-tip={t.strings.arrayRemove}
1315
1352
  aria-label={rowAction(t.strings.arrayRemove, k)}
1316
1353
  aria-keyshortcuts={control === 'object' && !table ? undefined : 'Alt+ArrowUp Alt+ArrowDown'}
1317
1354
  tabindex={stop ? undefined : -1}
@@ -1319,23 +1356,28 @@
1319
1356
  >
1320
1357
  {/snippet}
1321
1358
 
1322
- <!-- An `object` row's drag handle, a table grip's twin hung off the row's start edge.
1323
- Pointer-only and out of the accessibility tree: a press on it does nothing, so a
1324
- button there would be one a screen reader activates to no effect. Its twin is
1325
- Alt+↑/↓ from anywhere in the row, which the summary announces, as a table's or a
1326
- line's remove does for its own row. -->
1359
+ <!-- An element's drag handle, a table grip's twin hung off the row's start edge, or in a
1360
+ table's row its first track. Pointer-only and out of the accessibility tree: a press
1361
+ on it does nothing, so a button there would be one a screen reader activates to no
1362
+ effect. Its twin is Alt+↑/↓ from anywhere in the row, which a record's summary
1363
+ announces, as a table's or a line's remove does for its own row. -->
1327
1364
  {#snippet handle(k: number)}
1328
- <span
1329
- class="qm-row-handle"
1330
- aria-hidden="true"
1331
- title={t.strings.arrayDrag}
1332
- onpointerdown={(e) => drag.down(e, k)}
1333
- onpointermove={drag.move}
1334
- onpointerup={drag.up}
1335
- onpointercancel={drag.up}
1336
- onlostpointercapture={drag.up}
1337
- ><span class="qm-row-handle-bar"><Icon name="grip-vertical" /></span></span
1338
- >
1365
+ {#if ids.length < 2}
1366
+ <span class="qm-row-handle" aria-hidden="true"></span>
1367
+ {:else}
1368
+ <span
1369
+ class="qm-row-handle"
1370
+ aria-hidden="true"
1371
+ data-qm-tip={t.strings.arrayDrag}
1372
+ data-qm-tip-keys={keycap('Alt-↑/↓')}
1373
+ onpointerdown={(e) => drag.down(e, k)}
1374
+ onpointermove={drag.move}
1375
+ onpointerup={drag.up}
1376
+ onpointercancel={drag.up}
1377
+ onlostpointercapture={drag.up}
1378
+ ><span class="qm-row-handle-bar"><Icon name="grip-vertical" /></span></span
1379
+ >
1380
+ {/if}
1339
1381
  {/snippet}
1340
1382
 
1341
1383
  <style>
@@ -1354,11 +1396,6 @@
1354
1396
  justify-content: space-between;
1355
1397
  gap: var(--_qm-space-2);
1356
1398
  }
1357
- /* Under a label that carries its description in flow, the chip keeps the label's
1358
- line rather than centring on the two. */
1359
- .qm-array-header:has(> :global(.qm-field-label-row.briefed)) {
1360
- align-items: baseline;
1361
- }
1362
1399
  .qm-array-add-slot {
1363
1400
  display: inline-flex;
1364
1401
  align-items: center;
@@ -1446,16 +1483,18 @@
1446
1483
  `.qm-icon-btn`'s radius, which is the same rung the box draws; a slab standing before
1447
1484
  another gives up its corners on both sides.
1448
1485
 
1449
- It comes up on its own row rather than on the field: a destructive control is offered
1450
- by the row the pointer is on, not by every row at once. Hover is where the remove says destructive, ink with fill, a
1451
- tint alone being a wash under a label-toned glyph. */
1486
+ It waits for its row as the handle does (INVARIANTS §"A field's own chrome waits for
1487
+ the field"): a destructive control is offered by the row the pointer is on or the
1488
+ focus is in, not by every row at once, holding its box meanwhile and arriving by
1489
+ opacity, and resting drawn where nothing hovers. Hover is where the remove says
1490
+ destructive, ink with fill, a tint alone being a wash under a label-toned glyph. */
1452
1491
  .qm-row-actions {
1453
1492
  position: absolute;
1454
1493
  inset-block: 0;
1455
1494
  inset-inline-end: 0;
1456
1495
  display: flex;
1457
1496
  color: var(--_qm-ink-label);
1458
- opacity: var(--_qm-opacity-rest);
1497
+ opacity: 0;
1459
1498
  transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
1460
1499
  }
1461
1500
  .qm-row-btn {
@@ -1479,17 +1518,23 @@
1479
1518
  .qm-array-row:focus-within > .qm-element-head > .qm-row-actions {
1480
1519
  opacity: 1;
1481
1520
  }
1521
+ @media (hover: none) {
1522
+ .qm-row-actions {
1523
+ opacity: 1;
1524
+ }
1525
+ }
1482
1526
  .qm-remove:hover:not(:disabled) {
1483
1527
  background: var(--_qm-danger-tint);
1484
1528
  color: var(--_qm-danger);
1485
1529
  }
1486
1530
  /* The handle is a table grip's twin (prose.css §"One grip per line"): a pill carrying
1487
1531
  the grip's marks, hung off the row's start edge in the `--_qm-nest` every row stands
1488
- in from the stroke outside it, which a group's panel clips at. It rests
1489
- at nothing, where the remove rests faint, and comes up with the row the pointer is
1490
- on, staying up through the drag it carries; a band flush with the row keeps the
1532
+ in from the stroke outside it, which a group's panel clips at. The pill rests
1533
+ at nothing, as the remove does, and comes up with the row the pointer is
1534
+ 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
1491
1535
  pointer on the row all the way to it. The pointer owns the gesture, not the page's
1492
- scroll. */
1536
+ scroll. A record's pill centres on its summary; a line's and a table row's stand on
1537
+ the first line, which a wrapping cell grows away from. */
1493
1538
  .qm-row-handle {
1494
1539
  position: absolute;
1495
1540
  inset-block: 0;
@@ -1501,8 +1546,9 @@
1501
1546
  color: var(--_qm-ink-label);
1502
1547
  cursor: grab;
1503
1548
  touch-action: none;
1504
- opacity: 0;
1505
- transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
1549
+ }
1550
+ .qm-row-handle:empty {
1551
+ cursor: auto;
1506
1552
  }
1507
1553
  .qm-row-handle-bar {
1508
1554
  display: flex;
@@ -1512,25 +1558,39 @@
1512
1558
  height: var(--_qm-tap-min);
1513
1559
  border-radius: var(--_qm-radius-pill);
1514
1560
  background: var(--_qm-surface-band);
1561
+ opacity: 0;
1562
+ transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
1563
+ }
1564
+ .qm-array-row > .qm-row-handle {
1565
+ align-items: start;
1566
+ }
1567
+ .qm-array-row > .qm-row-handle > .qm-row-handle-bar {
1568
+ margin-block-start: calc((var(--_qm-box-line) - var(--_qm-tap-min)) / 2);
1515
1569
  }
1516
1570
  .qm-row-handle-bar :global(svg) {
1517
1571
  width: var(--_qm-space-3);
1518
1572
  height: var(--_qm-space-3);
1519
1573
  }
1520
- .qm-array-row:hover > .qm-element-head > .qm-row-handle,
1521
- .qm-element.lifted > .qm-element-head > .qm-row-handle {
1574
+ .qm-array-row:hover > .qm-row-handle > .qm-row-handle-bar,
1575
+ .qm-array-row:focus-within > .qm-row-handle > .qm-row-handle-bar,
1576
+ .qm-array-row:hover > .qm-element-head > .qm-row-handle > .qm-row-handle-bar,
1577
+ .qm-array-row:focus-within > .qm-element-head > .qm-row-handle > .qm-row-handle-bar,
1578
+ .qm-array-row.lifted > .qm-row-handle > .qm-row-handle-bar,
1579
+ .qm-element.lifted > .qm-element-head > .qm-row-handle > .qm-row-handle-bar {
1522
1580
  opacity: 1;
1523
1581
  }
1582
+ .qm-array-row.lifted > .qm-row-handle,
1524
1583
  .qm-element.lifted > .qm-element-head > .qm-row-handle {
1525
1584
  cursor: grabbing;
1526
1585
  }
1527
1586
  /* The lifted row is a tone, and the drop is one rule on the edge it would land
1528
1587
  against, drawn out of flow so nothing reflows under the drag: the table island's
1529
1588
  own pair. */
1530
- .qm-element.lifted > .qm-element-head > .qm-element-summary {
1589
+ .qm-element.lifted > .qm-element-head > .qm-element-summary,
1590
+ .qm-array-row.lifted:not(.qm-element) > :global(:not(.qm-row-handle, .qm-remove)) {
1531
1591
  opacity: var(--_qm-opacity-muted);
1532
1592
  }
1533
- .qm-element[data-drop]::before {
1593
+ .qm-array-row[data-drop]::before {
1534
1594
  content: '';
1535
1595
  position: absolute;
1536
1596
  inset-inline: 0;
@@ -1539,10 +1599,10 @@
1539
1599
  border-radius: var(--_qm-radius-pill);
1540
1600
  pointer-events: none;
1541
1601
  }
1542
- .qm-element[data-drop='before']::before {
1602
+ .qm-array-row[data-drop='before']::before {
1543
1603
  top: calc(-0.5 * (var(--_qm-space) + var(--_qm-ring-width)));
1544
1604
  }
1545
- .qm-element[data-drop='after']::before {
1605
+ .qm-array-row[data-drop='after']::before {
1546
1606
  bottom: calc(-0.5 * (var(--_qm-space) + var(--_qm-ring-width)));
1547
1607
  }
1548
1608
  /* ── An object element ──────────────────────────────────────────────────────
@@ -1619,17 +1679,23 @@
1619
1679
  .qm-element.open > .qm-element-head :global(.qm-el-chevron) {
1620
1680
  transform: rotate(90deg);
1621
1681
  }
1622
- /* The title is the row's name, at the ink as a card's is, on one line however long
1623
- the label runs. */
1624
- .qm-element-title {
1682
+ /* The title is the row's name, and the words a closed record shows in its place, at
1683
+ the ink as a card's is, on one line however long they run. */
1684
+ .qm-element-title,
1685
+ .qm-element-preview {
1625
1686
  overflow: hidden;
1626
1687
  text-overflow: ellipsis;
1627
1688
  white-space: nowrap;
1628
1689
  color: var(--_qm-ink);
1690
+ }
1691
+ .qm-element-title {
1629
1692
  font-variant-numeric: tabular-nums;
1630
1693
  }
1631
- /* What the closed record holds, after its name and a rung under it: the label ink,
1632
- on the line's remainder, and the first to give way where the line runs short. */
1694
+ .qm-element-preview {
1695
+ flex: 1 1 0;
1696
+ min-width: 0;
1697
+ text-align: start;
1698
+ }
1633
1699
  .qm-review-tag {
1634
1700
  flex: none;
1635
1701
  margin-inline-start: auto;
@@ -1637,18 +1703,6 @@
1637
1703
  font-weight: var(--_qm-weight-mid);
1638
1704
  color: var(--_qm-ink-label);
1639
1705
  }
1640
- .qm-element-preview {
1641
- flex: 1 1 0;
1642
- min-width: 0;
1643
- overflow: hidden;
1644
- text-overflow: ellipsis;
1645
- white-space: nowrap;
1646
- text-align: start;
1647
- color: var(--_qm-ink-label);
1648
- }
1649
- .qm-element-summary:has(.qm-element-preview) > .qm-element-title {
1650
- flex-shrink: 0;
1651
- }
1652
1706
  /* ── A table ────────────────────────────────────────────────────────────────
1653
1707
  Every row of it is open, so it stands where an open row's subform stands: a rung
1654
1708
  inside the field, behind the subform's vertical and between its caps (`ObjectField`,
@@ -1657,45 +1711,59 @@
1657
1711
  over boxes are the figure a row of compact fields draws. A corner reads square at a
1658
1712
  stroke, so the wash takes none here.
1659
1713
 
1660
- The grid is a box inside the stroke, and the one that scrolls: the stroke and the
1661
- inset hold still while the columns move, and the clip is the inset's edge rather than
1662
- the stroke's. One grid over the header and every row: a column per property, then a
1663
- track for the row's remove. The header and each row subgrid onto it, so a
1664
- cell's edge is its column's whatever the row above it holds. The row packs at the
1665
- start rather than sharing the field's leftover width between the columns: a table
1666
- carries its own rhythm, and stretching four short cells across a field sets them
1667
- apart by the width the card happens to have.
1714
+ The grid is a box inside the stroke, and the one that scrolls: the stroke holds still
1715
+ while the columns move, and the clip is the grid's edge rather than the stroke's.
1716
+ The stroke is drawn over the grid, whose pad reaches back across it, so the plane
1717
+ the pinned handle stands on never paints it out. One
1718
+ grid over the header and every row: a track for the row's handle, a column per
1719
+ property, then a track for the row's remove. The header and each row subgrid onto
1720
+ it, so a cell's edge is its column's whatever the row above it holds. The handle's
1721
+ track is the nest the stroke keeps from the cells less the gutter after it, so the
1722
+ cells stand a nest in from the stroke as an open row's do.
1668
1723
 
1669
- A track rests at what its cells cannot shrink below and grows no further than its
1670
- widest, so a field too narrow for them all overflows the grid's box and scrolls
1671
- sideways. A fixed floor as the track's base would instead hand each column a share of
1672
- the width and leave a control that does not shrink — a date's segments — painting
1673
- over the column beside it; the floor rides the header cell, which every column has.
1724
+ A column's track is the component's (`tracks`): a cell that fills its width shares
1725
+ what the field has spare with every other such column, so a table of text fills the
1726
+ field as one text field does, while a control of one width rests at its content and
1727
+ a short cell never stands a field's width from its neighbour. Every track's base is
1728
+ what its cells cannot shrink below, so a field too narrow for them all overflows the
1729
+ grid's box and scrolls sideways. A fixed floor as the track's base would instead hand
1730
+ each column a share of the width and leave a control that does not shrink — a date's
1731
+ segments — painting over the column beside it; the floor rides the header cell, which
1732
+ every column has.
1674
1733
 
1675
1734
  The pad is the clip box's, the ring on a cell at that box's own edge reaching past
1676
- its content; the margin takes the same distance back, so the tracks stand a nest in
1677
- from the label row above them and the caps keep their rung. The box keeps the
1678
- remove's track clear of the scrolls it makes itself, so a cell scrolled into view
1679
- lands beside the pinned button rather than under it.
1735
+ its content; the margin takes the same distance back. The box keeps the pinned
1736
+ tracks clear of the scrolls it makes itself, so a cell scrolled into view lands
1737
+ beside a pinned button rather than under it. The box is a container, so a header
1738
+ cell can state its floor as a share of the width the columns have.
1680
1739
 
1681
1740
  The names are the array's own: `.qm-table` is the codec's island (`prose.css`), an
1682
1741
  unscoped stylesheet in this package, and a box wearing that name takes the island's
1683
1742
  hairline whatever this block says. */
1684
1743
  .qm-array-rows.qm-array-table {
1685
- border-inline-start: var(--_qm-vertical-width) solid var(--_qm-border);
1686
- padding-inline-start: var(--_qm-nest);
1744
+ padding-inline-start: var(--_qm-vertical-width);
1687
1745
  padding-block: var(--_qm-space);
1688
1746
  border-radius: 0;
1689
1747
  }
1748
+ .qm-array-rows.qm-array-table::before {
1749
+ content: '';
1750
+ position: absolute;
1751
+ inset-block: 0;
1752
+ inset-inline-start: 0;
1753
+ width: var(--_qm-vertical-width);
1754
+ background: var(--_qm-border);
1755
+ z-index: 2;
1756
+ }
1690
1757
  .qm-array-table-scroller {
1758
+ --_grip-track: calc(var(--_qm-nest) - var(--_qm-space));
1691
1759
  display: grid;
1692
- grid-template-columns:
1693
- repeat(var(--table-cols), minmax(min-content, max-content))
1694
- auto;
1760
+ grid-template-columns: var(--_grip-track) var(--table-tracks) auto;
1695
1761
  justify-content: start;
1696
1762
  gap: var(--_qm-space);
1697
1763
  overflow-x: auto;
1698
- scroll-padding-inline-end: calc(var(--_qm-tap-min) + var(--_qm-space));
1764
+ container-type: inline-size;
1765
+ scroll-padding-inline: calc(var(--_qm-nest) + var(--_qm-ring-reach))
1766
+ calc(var(--_qm-tap-min) + var(--_qm-space));
1699
1767
  padding: var(--_qm-ring-reach);
1700
1768
  margin: calc(-1 * var(--_qm-ring-reach));
1701
1769
  }
@@ -1719,7 +1787,11 @@
1719
1787
  sooner. Without it the column rests at its header's own width, its cells still
1720
1788
  clearing the mark, which no track can shrink below. It is the table's to state
1721
1789
  because the table is where a column is a width of its own; in a section's grid and
1722
- in a subform's, a boolean stands in a track its neighbours share. */
1790
+ in a subform's, a boolean stands in a track its neighbours share.
1791
+
1792
+ A prose column's floor is its share of the width the columns have, between the two
1793
+ floors: the wide one while the field holds every column at it, so a cell wraps no
1794
+ sooner than it must, then down to the narrow one before the table scrolls. */
1723
1795
  .qm-array-table-col {
1724
1796
  min-width: var(--_qm-track-min);
1725
1797
  }
@@ -1727,50 +1799,92 @@
1727
1799
  min-width: 0;
1728
1800
  }
1729
1801
  .qm-array-table-col.prose {
1730
- min-width: var(--_qm-track-prose);
1731
- }
1732
- /* The remove is the row's last track, pinned to the end edge of the box the table
1733
- scrolls in: sticky, so it rests in its track while the table fits and rides over
1734
- the cells once the box scrolls, on the card's plane so what passes under it is
1735
- hidden rather than overprinted, and stretched to the row so no cell shows above or
1736
- below it. Always drawn: a table's rows are many and the eye finds the control by
1737
- its column. The header's end cell pins with it, or the labels would scroll under
1738
- nothing while the cells scroll under a plane.
1802
+ min-width: clamp(
1803
+ var(--_qm-track-min),
1804
+ (100cqi - var(--_qm-nest) - var(--_qm-tap-min)) / var(--table-cols) - var(--_qm-space),
1805
+ var(--_qm-track-prose)
1806
+ );
1807
+ }
1808
+ /* The handle is the row's first track and the remove its last, each pinned to its
1809
+ edge of the box the table scrolls in: sticky, so it rests in its track while the
1810
+ table fits and rides over the cells once the box scrolls, on the card's plane so what
1811
+ passes under it is hidden rather than overprinted, and stretched to the row so no cell
1812
+ shows above or below it. The remove is always drawn: a table's rows are many and the
1813
+ eye finds the control by its column. The header's end cells pin with them, or the
1814
+ labels would scroll under nothing while the cells scroll under a plane.
1739
1815
 
1740
1816
  The inset is the content box's, so the ring's reach fits inside the clip; the plane
1741
1817
  spread over that same reach hides the sliver of cell the pad would show past the
1742
- button, and the ring paints over it.
1818
+ button, and the ring paints over it. The handle's pill reaches over the gutter after
1819
+ its track, where the plane stops short of the cell beside it.
1743
1820
 
1744
1821
  The slab's grammar goes with the slab: a button on the row's own plane takes the
1745
1822
  icon family's radius at all four corners, where one cut into a box takes that box's
1746
1823
  end-side pair and squares the rest. */
1747
1824
  .qm-array-table-row > .qm-remove,
1748
- .qm-array-table-head-end {
1825
+ .qm-array-table-head-end,
1826
+ .qm-array-table-row > .qm-row-handle,
1827
+ .qm-array-table-head-start {
1749
1828
  position: sticky;
1750
- inset-inline-end: 0;
1829
+ z-index: 1;
1751
1830
  background: var(--_qm-surface);
1752
1831
  box-shadow: 0 0 0 var(--_qm-ring-reach) var(--_qm-surface);
1753
1832
  }
1754
- /* While cells stand past the end edge, the slab fades them in over a step before it
1755
- rather than cutting them at its edge: the column the cut hides is still there. */
1833
+ .qm-array-table-row > .qm-remove,
1834
+ .qm-array-table-head-end {
1835
+ inset-inline-end: 0;
1836
+ }
1837
+ .qm-array-table-row > .qm-row-handle,
1838
+ .qm-array-table-head-start {
1839
+ inset-inline-start: 0;
1840
+ }
1841
+ .qm-array-table-row > .qm-row-handle {
1842
+ inset-block: auto;
1843
+ inset-inline-end: auto;
1844
+ width: auto;
1845
+ align-self: stretch;
1846
+ justify-content: start;
1847
+ }
1848
+ .qm-array-table-row > .qm-row-handle > .qm-row-handle-bar {
1849
+ flex: none;
1850
+ width: var(--_qm-nest);
1851
+ }
1852
+ /* While cells stand past an edge, the slab beside it fades them in over a step rather
1853
+ than cutting them at its edge: the column the cut hides is still there. */
1756
1854
  .qm-array-table-row > .qm-remove::before,
1757
- .qm-array-table-head-end::before {
1855
+ .qm-array-table-head-end::before,
1856
+ .qm-array-table-row > .qm-row-handle::before,
1857
+ .qm-array-table-head-start::before {
1758
1858
  content: '';
1759
1859
  position: absolute;
1760
1860
  inset-block: calc(-1 * var(--_qm-ring-reach));
1761
- inset-inline-end: calc(100% + var(--_qm-ring-reach));
1762
1861
  width: var(--_qm-space-3);
1763
- background: linear-gradient(to right, transparent, var(--_qm-surface));
1764
1862
  pointer-events: none;
1765
1863
  opacity: 0;
1766
1864
  transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
1767
1865
  }
1866
+ .qm-array-table-row > .qm-remove::before,
1867
+ .qm-array-table-head-end::before {
1868
+ inset-inline-end: calc(100% + var(--_qm-ring-reach));
1869
+ background: linear-gradient(to right, transparent, var(--_qm-surface));
1870
+ }
1871
+ .qm-array-table-row > .qm-row-handle::before,
1872
+ .qm-array-table-head-start::before {
1873
+ inset-inline-start: calc(100% + var(--_qm-ring-reach));
1874
+ background: linear-gradient(to left, transparent, var(--_qm-surface));
1875
+ }
1768
1876
  .qm-array-table-row > .qm-remove:dir(rtl)::before,
1769
1877
  .qm-array-table-head-end:dir(rtl)::before {
1770
1878
  background: linear-gradient(to left, transparent, var(--_qm-surface));
1771
1879
  }
1880
+ .qm-array-table-row > .qm-row-handle:dir(rtl)::before,
1881
+ .qm-array-table-head-start:dir(rtl)::before {
1882
+ background: linear-gradient(to right, transparent, var(--_qm-surface));
1883
+ }
1772
1884
  .qm-array-table-scroller[data-overflow] > .qm-array-table-row > .qm-remove::before,
1773
- .qm-array-table-scroller[data-overflow] .qm-array-table-head-end::before {
1885
+ .qm-array-table-scroller[data-overflow] .qm-array-table-head-end::before,
1886
+ .qm-array-table-scroller[data-scrolled] > .qm-array-table-row > .qm-row-handle::before,
1887
+ .qm-array-table-scroller[data-scrolled] .qm-array-table-head-start::before {
1774
1888
  opacity: 1;
1775
1889
  }
1776
1890
  /* The glyph stands on the row's first line with the cells, however far the slab
@@ -1783,17 +1897,26 @@
1783
1897
  border-radius: var(--_qm-radius-inner);
1784
1898
  color: var(--_qm-ink-label);
1785
1899
  }
1786
- /* The pad past the slab, flat: the plane's spread above rounds with the slab's
1900
+ /* The pad past each slab, flat: the plane's spread above rounds with the slab's
1787
1901
  corners, and a cell scrolled under them shows through at the clip. */
1788
1902
  .qm-array-table-row > .qm-remove::after,
1789
- .qm-array-table-head-end::after {
1903
+ .qm-array-table-head-end::after,
1904
+ .qm-array-table-row > .qm-row-handle::after,
1905
+ .qm-array-table-head-start::after {
1790
1906
  content: '';
1791
1907
  position: absolute;
1792
1908
  inset-block: calc(-1 * var(--_qm-ring-reach));
1793
- inset-inline-start: 100%;
1794
1909
  width: var(--_qm-ring-reach);
1795
1910
  background: var(--_qm-surface);
1796
1911
  }
1912
+ .qm-array-table-row > .qm-remove::after,
1913
+ .qm-array-table-head-end::after {
1914
+ inset-inline-start: 100%;
1915
+ }
1916
+ .qm-array-table-row > .qm-row-handle::after,
1917
+ .qm-array-table-head-start::after {
1918
+ inset-inline-end: 100%;
1919
+ }
1797
1920
  /* The label line's own type: size, weight and leading are `.qm-field-label`'s, so
1798
1921
  the two read as one register. Inner radius: the chip family is the card's, and this
1799
1922
  box is a line of type. The chip's tap floor is given back (`.qm-tap-floor`),
@@ -1815,10 +1938,4 @@
1815
1938
  .qm-add-el:disabled {
1816
1939
  opacity: var(--_qm-opacity-idle);
1817
1940
  }
1818
- /* No hover to come up on: the handle stands with the controls, already at rest. */
1819
- @media (hover: none) {
1820
- .qm-row-handle {
1821
- opacity: 1;
1822
- }
1823
- }
1824
1941
  </style>