@quillmark/svelte 0.30.0 → 0.32.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 +5 -5
  2. package/dist/core/address.d.ts +1 -1
  3. package/dist/core/address.js +1 -1
  4. package/dist/core/codec/atoms.js +1 -1
  5. package/dist/core/codec/breaks.js +3 -2
  6. package/dist/core/codec/decode.d.ts +4 -3
  7. package/dist/core/codec/decode.js +17 -13
  8. package/dist/core/codec/field.d.ts +5 -4
  9. package/dist/core/codec/field.js +139 -49
  10. package/dist/core/codec/index.d.ts +2 -0
  11. package/dist/core/codec/index.js +5 -1
  12. package/dist/core/codec/inputrules.js +3 -3
  13. package/dist/core/codec/islands.d.ts +1 -1
  14. package/dist/core/codec/islands.js +3 -3
  15. package/dist/core/codec/keymap.d.ts +1 -1
  16. package/dist/core/codec/keymap.js +3 -2
  17. package/dist/core/codec/list-move.js +2 -1
  18. package/dist/core/codec/list-paste.js +1 -1
  19. package/dist/core/codec/lists.d.ts +1 -1
  20. package/dist/core/codec/lists.js +7 -6
  21. package/dist/core/codec/markdown-paste.js +2 -2
  22. package/dist/core/codec/positions.d.ts +12 -1
  23. package/dist/core/codec/prose.css +3 -11
  24. package/dist/core/codec/schema.d.ts +3 -3
  25. package/dist/core/codec/schema.js +6 -6
  26. package/dist/core/codec/shortcuts.d.ts +91 -0
  27. package/dist/core/codec/shortcuts.js +135 -0
  28. package/dist/core/codec/slash.d.ts +4 -2
  29. package/dist/core/codec/slash.js +11 -1
  30. package/dist/core/codec/table-paste.js +1 -1
  31. package/dist/core/codec/table-view.d.ts +1 -1
  32. package/dist/core/codec/table-view.js +27 -37
  33. package/dist/core/codec/tasks.js +1 -1
  34. package/dist/core/index.d.ts +1 -0
  35. package/dist/core/theme.css +16 -8
  36. package/dist/preset/scale.css +1 -1
  37. package/dist/preview/Preview.svelte +2 -3
  38. package/dist/preview/bridge.js +2 -2
  39. package/dist/preview/geometry.d.ts +2 -2
  40. package/dist/preview/geometry.js +2 -2
  41. package/dist/preview/paint.js +1 -1
  42. package/dist/visual/ArrayField.svelte +172 -87
  43. package/dist/visual/BooleanField.svelte +3 -3
  44. package/dist/visual/Card.svelte +68 -47
  45. package/dist/visual/CardControls.svelte +1 -1
  46. package/dist/visual/DateField.svelte +17 -2
  47. package/dist/visual/DiagnosticList.svelte +35 -3
  48. package/dist/visual/EnumField.svelte +59 -45
  49. package/dist/visual/Field.svelte +16 -6
  50. package/dist/visual/Field.svelte.d.ts +3 -1
  51. package/dist/visual/FieldHint.svelte +10 -3
  52. package/dist/visual/FormatPopover.svelte +9 -3
  53. package/dist/visual/MatrixAdd.svelte +4 -19
  54. package/dist/visual/MatrixField.svelte +21 -13
  55. package/dist/visual/NumberField.svelte +2 -3
  56. package/dist/visual/ObjectField.svelte +166 -147
  57. package/dist/visual/ProseField.svelte +8 -3
  58. package/dist/visual/SlashMenu.svelte +24 -12
  59. package/dist/visual/SlashMenu.svelte.d.ts +2 -0
  60. package/dist/visual/TextField.svelte +1 -1
  61. package/dist/visual/VariantField.svelte +1 -1
  62. package/dist/visual/VisualEditor.svelte +1 -1
  63. package/dist/visual/VisualEditor.svelte.d.ts +1 -1
  64. package/dist/visual/VisualEditorInner.svelte +159 -24
  65. package/dist/visual/VisualEditorInner.svelte.d.ts +1 -1
  66. package/dist/visual/controls.css +43 -5
  67. package/dist/visual/diagnostics.d.ts +2 -2
  68. package/dist/visual/diagnostics.js +2 -2
  69. package/dist/visual/index.d.ts +2 -0
  70. package/dist/visual/index.js +3 -0
  71. package/dist/visual/leaves.js +1 -1
  72. package/dist/visual/props.d.ts +2 -2
  73. package/dist/visual/strings.d.ts +33 -15
  74. package/dist/visual/strings.js +42 -7
  75. package/dist/visual/structure.d.ts +27 -18
  76. package/dist/visual/structure.js +32 -28
  77. package/dist/visual/tips.js +1 -1
  78. package/dist/visual/undo.svelte.d.ts +36 -0
  79. package/dist/visual/undo.svelte.js +119 -0
  80. package/package.json +2 -2
  81. package/dist/visual/hold.d.ts +0 -17
  82. package/dist/visual/hold.js +0 -39
@@ -252,8 +252,8 @@
252
252
 
253
253
  It takes no fill either: the surface itself opens on hover.
254
254
 
255
- At rest it recedes to the idle rung, a card describing every field otherwise
256
- standing a mark beside each label before anything is touched. It lifts with the
255
+ At rest it is absent, a card describing every field otherwise standing a mark
256
+ beside each label before anything is touched. It arrives with the
257
257
  scope that owns its row (the field, the property, the array or matrix, the table
258
258
  its column heads, the section a lone field is named by), each reached by child
259
259
  steps so a nested field's marker stays at rest under its container's hover, and
@@ -266,7 +266,7 @@
266
266
  cursor: help;
267
267
  padding: 0;
268
268
  background: none;
269
- opacity: var(--_qm-opacity-idle);
269
+ opacity: 0;
270
270
  transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
271
271
  }
272
272
  :global(:is(.qm-field, .qm-object-prop):is(:hover, :focus-within) > .qm-field-label-row)
@@ -281,6 +281,13 @@
281
281
  .qm-field-hint[aria-expanded='true'] {
282
282
  opacity: 1;
283
283
  }
284
+ /* Without a hover there is no lift to wait for, and a tap is the glyph's only door, so
285
+ it rests drawn at the rung a live glyph control rests at. */
286
+ @media (hover: none) {
287
+ .qm-field-hint {
288
+ opacity: var(--_qm-opacity-rest);
289
+ }
290
+ }
284
291
  /* The lift, the translucency, the blur and the scale-in come from
285
292
  `.qm-popover-surface` (controls.css). This surface's own is a measure: guidance
286
293
  is prose, and prose past ~40 characters a line stops being scannable; plus the
@@ -1,5 +1,5 @@
1
1
  <!--
2
- The formatting selection popover (VISUAL_EDITOR §Chrome). One popover,
2
+ The formatting selection popover (INVARIANTS §Chrome). One popover,
3
3
  shell-owned, observing the active leaf through
4
4
  `getActiveLeaf`: the VisualEditor's accessor over its `leaves` registry, and
5
5
  the whole of what this surface knows about the editor. The active leaf is a
@@ -77,7 +77,13 @@
77
77
  import { Popover } from 'bits-ui';
78
78
  import Icon from './icons/Icon.svelte';
79
79
  import type { IconName } from './icons/nodes.js';
80
- import { hasMarks, rangeAnchor, toggleList, type RangeAnchor } from '../core/codec/index.js';
80
+ import {
81
+ FIELD_KEYS,
82
+ hasMarks,
83
+ rangeAnchor,
84
+ toggleList,
85
+ type RangeAnchor
86
+ } from '../core/codec/index.js';
81
87
  import type { ActiveProse } from './leaves.js';
82
88
  import { clearLink, hrefInSelection, normalizeHref, setLink } from './links.js';
83
89
  import { familyInSelection, setFamily } from './fonts.js';
@@ -359,7 +365,7 @@
359
365
  }
360
366
 
361
367
  const linkKey = keydownHandler({
362
- 'Mod-k': (_state, _dispatch, view) => !!view && raiseLink(view)
368
+ [FIELD_KEYS.link]: (_state, _dispatch, view) => !!view && raiseLink(view)
363
369
  });
364
370
 
365
371
  function onKeyDown(e: KeyboardEvent): void {
@@ -1,5 +1,5 @@
1
1
  <!--
2
- An open matrix's add box (VISUAL_EDITOR §"The matrix"): a plain text input. Enter adds
2
+ An open matrix's add box (INVARIANTS §"The matrix"): a plain text input. Enter adds
3
3
  what was typed, trimmed, and clears the box; Escape clears it. It is drawn as the item
4
4
  it adds, unwritten: the plus in the tick's column and the words in the title's.
5
5
  -->
@@ -75,18 +75,9 @@
75
75
  height: var(--_qm-glyph-control);
76
76
  color: var(--_qm-ink-label);
77
77
  }
78
- /* At rest the box is the add chip it stands in for: no well, its words at the label
79
- ink, and the line at the chip's idle rung. The line comes up under the pointer with
80
- the well, and both stay while the box holds the focus or typed words. */
81
- .qm-matrix-add-field {
82
- opacity: var(--_qm-opacity-idle);
83
- transition: opacity var(--_qm-duration-fast) var(--_qm-ease-reverse);
84
- }
85
- .qm-matrix-add-field:hover,
86
- .qm-matrix-add-field:focus-within,
87
- .qm-matrix-add-field:has(.qm-input:not(:placeholder-shown)) {
88
- opacity: 1;
89
- }
78
+ /* At rest the box is the add chip it stands in for: no well, and its words at the
79
+ label ink in full, as the add chip's are: words take the text floor, not the rest rung
80
+ a glyph control rests at. */
90
81
  .qm-matrix-add-field .qm-input {
91
82
  flex: 1;
92
83
  min-width: 0;
@@ -100,10 +91,4 @@
100
91
  .qm-matrix-add-field:hover .qm-input:placeholder-shown:not(:focus) {
101
92
  background: var(--_qm-surface-hover);
102
93
  }
103
- /* No hover to come up on: the line stands at the muted rung, as the chip does. */
104
- @media (hover: none) {
105
- .qm-matrix-add-field {
106
- opacity: var(--_qm-opacity-muted);
107
- }
108
- }
109
94
  </style>
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  A `matrix` field → ticks over the roster, columns unfolding under a held member
3
- (VISUAL_EDITOR §"The matrix", canon `SCHEMAS.md` §Matrix). The roster is one flat
3
+ (INVARIANTS §"The matrix", quillmark `docs/quills/quill-yaml-reference.md` §Matrix). The roster is one flat
4
4
  list, one member to a row, or abreast on the section's track ladder under
5
5
  `ui.compact`; each member is a real checkbox whose checked state is the member's
6
6
  presence, with its title as the `<label for>`, an unheld member reading at the label
@@ -36,6 +36,7 @@
36
36
  MATRIX_TITLE,
37
37
  addedId,
38
38
  addedItems,
39
+ titleText,
39
40
  baseType,
40
41
  commitMember,
41
42
  declaredContent,
@@ -185,7 +186,7 @@
185
186
  }
186
187
  function itemTitle(id: string): string {
187
188
  const stored = own(map, id) as Record<string, unknown> | undefined;
188
- return String(stored?.[MATRIX_TITLE] ?? '');
189
+ return titleText(stored?.[MATRIX_TITLE]);
189
190
  }
190
191
  function retitle(id: string, title: string): void {
191
192
  commit(commitMember(map, id, memberWrite(matrixColumns(own(map, id)), title)));
@@ -444,9 +445,11 @@
444
445
  width: var(--_qm-glyph-control);
445
446
  height: var(--_qm-glyph-control);
446
447
  }
447
- /* The box is the switch's track (`BooleanField.svelte`): a fill and nothing else,
448
- which held swaps for the accent, so the surface's two marks for one boolean decode
449
- alike. */
448
+ /* Unticked is an outline, ticked a fill: a box drawn only as a tone over the card is
449
+ a step of about 1.3:1, under WCAG 1.4.11's 3:1 for a control's boundary, and an empty
450
+ box is the one figure every platform's checkbox shares. The edge is the label rung,
451
+ which clears 3:1 over the card in both themes; ticking fills the box with the accent
452
+ and the edge goes with the fill. */
450
453
  .qm-tick-input {
451
454
  appearance: none;
452
455
  margin: 0;
@@ -454,17 +457,27 @@
454
457
  height: 100%;
455
458
  border: none;
456
459
  border-radius: var(--_qm-radius-inner);
457
- background: var(--_qm-surface-band);
460
+ background: transparent;
461
+ box-shadow: inset 0 0 0 calc(2 * var(--_qm-border-width)) var(--_qm-ink-label);
458
462
  cursor: pointer;
459
- transition: background-color var(--_qm-duration-fast) var(--_qm-ease-reverse);
463
+ transition:
464
+ background-color var(--_qm-duration-fast) var(--_qm-ease-reverse),
465
+ box-shadow var(--_qm-duration-fast) var(--_qm-ease-reverse);
460
466
  }
461
467
  .qm-tick-input:checked,
462
468
  .qm-tick-fixed {
463
469
  background: var(--_qm-accent);
470
+ box-shadow: none;
464
471
  }
465
472
  .qm-tick-fixed {
466
473
  cursor: default;
467
474
  }
475
+ /* Forced colours drop the inset shadow the outline is drawn with. */
476
+ @media (forced-colors: active) {
477
+ .qm-tick-input {
478
+ border: calc(2 * var(--_qm-border-width)) solid CanvasText;
479
+ }
480
+ }
468
481
  /* The mark rides over the input and takes no press of its own; it is drawn by the
469
482
  input's state, in the ink the surface reads over the accent. */
470
483
  .qm-tick :global(.qm-tick-mark) {
@@ -517,7 +530,7 @@
517
530
  .qm-member-remove {
518
531
  flex-shrink: 0;
519
532
  color: var(--_qm-ink-label);
520
- opacity: var(--_qm-opacity-idle);
533
+ opacity: var(--_qm-opacity-rest);
521
534
  transition:
522
535
  opacity var(--_qm-duration-fast) var(--_qm-ease-reverse),
523
536
  background-color var(--_qm-duration-fast) var(--_qm-ease-reverse),
@@ -531,11 +544,6 @@
531
544
  background: var(--_qm-danger-tint);
532
545
  color: var(--_qm-danger);
533
546
  }
534
- @media (hover: none) {
535
- .qm-member-remove {
536
- opacity: var(--_qm-opacity-muted);
537
- }
538
- }
539
547
  /* The default's set is what prints and nothing written: its titles, its ticks and
540
548
  every value its columns draw take the default rung (theme.css), and the first
541
549
  gesture, writing it, takes it off. */
@@ -9,7 +9,7 @@
9
9
 
10
10
  An unset field holds its resolved `default:` as its text, at the default rung
11
11
  (theme.css), and an edit that settles writes it as authored, as `TextField` takes
12
- its default. A number has no empty answer (canon `SCHEMAS.md` §"Native validation"),
12
+ its default. A number has no empty answer (quillmark/INVARIANTS §"A blank is a property of the field"),
13
13
  so a blank entry commits `undefined`, the unset rung: the parent removes the field,
14
14
  the engine renders the default, and the input holds it again.
15
15
 
@@ -25,8 +25,7 @@
25
25
 
26
26
  A settled entry in the grammar commits as a number. Anything else forwards the raw
27
27
  string to `onCommit`: the boundary's `writer.set` coercion is the judge (throws a
28
- `QuillmarkError` the parent turns into a field diagnostic, VISUAL_EDITOR
29
- §Diagnostics). `Number()` alone is no gate: it reads `0x1F` and `Infinity` as
28
+ `QuillmarkError` the parent turns into a field diagnostic, INVARIANTS §Diagnostics). `Number()` alone is no gate: it reads `0x1F` and `Infinity` as
30
29
  numbers, and `1.000` as a whole one.
31
30
  -->
32
31
  <script lang="ts">
@@ -10,7 +10,7 @@
10
10
 
11
11
  The nesting is a vertical at `--_qm-border`, the ladder's last stroke: an open section's
12
12
  vertical one `--_qm-nest` in from the card's edge where the field is in one, this one a
13
- rung further, the properties a rung inside it (ARCHITECTURE §"A plane is a tone").
13
+ rung further, the properties a rung inside it (INVARIANTS §"A plane is a tone").
14
14
 
15
15
  One figure wherever it mounts, and where its stroke lands is the stacker's. A
16
16
  variant's cells and a matrix member's columns sit at the depth a field-level subform
@@ -141,10 +141,10 @@
141
141
  const entries = $derived(Object.entries(properties ?? {}));
142
142
  const obj = $derived((value ?? {}) as Record<string, unknown>);
143
143
  const has = (key: string): boolean => Object.hasOwn(properties ?? {}, key);
144
- const spans = $derived(
144
+ const placements = $derived(
145
145
  placed
146
146
  ? new Map(
147
- placeFields(fieldModels({ fields: properties ?? {} })).map((p) => [p.field.name, p.span])
147
+ placeFields(fieldModels({ fields: properties ?? {} })).map((p) => [p.field.name, p])
148
148
  )
149
149
  : undefined
150
150
  );
@@ -303,10 +303,11 @@
303
303
  'qm-object-prop',
304
304
  {
305
305
  'qm-prop-full': isContainer(kind),
306
- 'qm-prop-wide': block || (!isContainer(kind) && spans?.get(key) === 'full')
306
+ 'qm-prop-wide': block || (!isContainer(kind) && placements?.get(key)?.span === 'full')
307
307
  }
308
308
  ]}
309
309
  data-qm-prop={key}
310
+ data-tail={placements?.get(key)?.tail}
310
311
  >
311
312
  {#if ids && kind !== 'array' && kind !== 'matrix'}
312
313
  <FieldLabel
@@ -322,152 +323,157 @@
322
323
  {countId}
323
324
  />
324
325
  {/if}
325
- {#if kind === 'enum'}
326
- <EnumField
327
- label={named}
328
- id={ids?.control}
329
- describedBy={describes}
330
- value={obj[key] as string | undefined}
331
- values={sub.values ?? []}
332
- fallback={sub.default as string | undefined}
333
- blankTitle={sub.ui?.blank_title}
334
- optional={optionalCell(sub)}
335
- onCommit={(v) => commitProp(key, v)}
336
- />
337
- {:else if kind === 'number'}
338
- <NumberField
339
- label={named}
340
- id={ids?.control}
341
- describedBy={describes}
342
- value={obj[key] as number | undefined}
343
- integer={baseType(sub) === 'integer'}
344
- fallback={textDefault(sub)}
345
- placeholder={noneOf(key, sub)}
346
- onCommit={(v) => commitProp(key, v)}
347
- />
348
- {:else if kind === 'boolean'}
349
- <BooleanField
350
- label={named}
351
- id={ids?.control}
352
- describedBy={describes}
353
- value={renderedBoolean(obj[key])}
354
- fallback={sub.default as boolean | undefined}
355
- optional={optionalCell(sub)}
356
- onCommit={(v) => commitProp(key, v)}
357
- />
358
- {:else if kind === 'date'}
359
- <DateField
360
- label={named}
361
- labelledBy={ids?.label}
362
- describedBy={describes}
363
- value={obj[key] as string | undefined}
364
- fallback={sub.default != null ? String(sub.default) : undefined}
365
- datetime={baseType(sub) === 'datetime'}
366
- onCommit={(v) => commitProp(key, v)}
367
- />
368
- {:else if kind === 'text'}
369
- <TextField
370
- label={named}
371
- id={ids?.control}
372
- describedBy={describes}
373
- value={obj[key] as string | undefined}
374
- fallback={textDefault(sub)}
375
- placeholder={noneOf(key, sub)}
376
- onCommit={(v) => commitProp(key, v)}
377
- onKey={onCellKey ? (e) => onCellKey(e, key) : undefined}
378
- />
379
- {:else if kind === 'prose'}
380
- <!-- Keyed by name, so a re-derive of the container this cell commits whole
326
+ <!-- The control and its diagnostics share the control's track, as `Field`'s stack
327
+ does: the property's subgrid holds two tracks, so a third child would land on
328
+ the control. -->
329
+ <div class="qm-prop-stack">
330
+ {#if kind === 'enum'}
331
+ <EnumField
332
+ label={named}
333
+ id={ids?.control}
334
+ describedBy={describes}
335
+ value={obj[key] as string | undefined}
336
+ values={sub.values ?? []}
337
+ fallback={sub.default as string | undefined}
338
+ blankTitle={sub.ui?.blank_title}
339
+ optional={optionalCell(sub)}
340
+ onCommit={(v) => commitProp(key, v)}
341
+ />
342
+ {:else if kind === 'number'}
343
+ <NumberField
344
+ label={named}
345
+ id={ids?.control}
346
+ describedBy={describes}
347
+ value={obj[key] as number | undefined}
348
+ integer={baseType(sub) === 'integer'}
349
+ fallback={textDefault(sub)}
350
+ placeholder={noneOf(key, sub)}
351
+ onCommit={(v) => commitProp(key, v)}
352
+ />
353
+ {:else if kind === 'boolean'}
354
+ <BooleanField
355
+ label={named}
356
+ id={ids?.control}
357
+ describedBy={describes}
358
+ value={renderedBoolean(obj[key])}
359
+ fallback={sub.default as boolean | undefined}
360
+ optional={optionalCell(sub)}
361
+ onCommit={(v) => commitProp(key, v)}
362
+ />
363
+ {:else if kind === 'date'}
364
+ <DateField
365
+ label={named}
366
+ labelledBy={ids?.label}
367
+ describedBy={describes}
368
+ value={obj[key] as string | undefined}
369
+ fallback={sub.default != null ? String(sub.default) : undefined}
370
+ datetime={baseType(sub) === 'datetime'}
371
+ onCommit={(v) => commitProp(key, v)}
372
+ />
373
+ {:else if kind === 'text'}
374
+ <TextField
375
+ label={named}
376
+ id={ids?.control}
377
+ describedBy={describes}
378
+ value={obj[key] as string | undefined}
379
+ fallback={textDefault(sub)}
380
+ placeholder={noneOf(key, sub)}
381
+ onCommit={(v) => commitProp(key, v)}
382
+ onKey={onCellKey ? (e) => onCellKey(e, key) : undefined}
383
+ />
384
+ {:else if kind === 'prose'}
385
+ <!-- Keyed by name, so a re-derive of the container this cell commits whole
381
386
  leaves the leaf mounted and the caret in it. -->
382
- <ProseValue
383
- bind:this={proseEls[key]}
384
- content={() => contentAt([key])}
385
- value={obj[key]}
386
- fallback={contentDefault(sub)}
387
- plaintext={literalText(sub)}
388
- placeholder={noneOf(key, sub)}
389
- {block}
390
- label={named}
391
- labelledBy={ids?.label}
392
- describedBy={countId ? [describes, countId].filter(Boolean).join(' ') : describes}
393
- cap={cap && { ...cap, onCount: (n) => (counts[key] = n) }}
394
- onChange={(rt) =>
395
- commitProp(key, optionalCell(sub) && isEmptyContent(rt) ? undefined : rt)}
396
- onKey={onCellKey ? (e) => onCellKey(e, key) : undefined}
397
- />
398
- {:else if kind === 'array'}
399
- <!-- The repeater owns its label row, the add chip sharing it (`Field` skips
387
+ <ProseValue
388
+ bind:this={proseEls[key]}
389
+ content={() => contentAt([key])}
390
+ value={obj[key]}
391
+ fallback={contentDefault(sub)}
392
+ plaintext={literalText(sub)}
393
+ placeholder={noneOf(key, sub)}
394
+ {block}
395
+ label={named}
396
+ labelledBy={ids?.label}
397
+ describedBy={countId ? [describes, countId].filter(Boolean).join(' ') : describes}
398
+ cap={cap && { ...cap, onCount: (n) => (counts[key] = n) }}
399
+ onChange={(rt) =>
400
+ commitProp(key, optionalCell(sub) && isEmptyContent(rt) ? undefined : rt)}
401
+ onKey={onCellKey ? (e) => onCellKey(e, key) : undefined}
402
+ />
403
+ {:else if kind === 'array'}
404
+ <!-- The repeater owns its label row, the add chip sharing it (`Field` skips
400
405
  its own label for one too), so the names are handed down rather than
401
406
  drawn here. Its rows are collapsed rows again: the depth an open row
402
407
  under an open row costs is two rungs of the ladder and one figure. -->
403
- <ArrayField
404
- bind:this={nestedEls[key]}
405
- value={obj[key]}
406
- fallback={Array.isArray(sub.default) ? sub.default : undefined}
407
- items={sub.items}
408
- layout={arrayLayout(sub)}
409
- max={sub.max}
410
- label={fieldTitle(key, sub)}
411
- description={sub.description}
412
- labelId={ids?.label}
413
- descriptionId={describes}
414
- idBase={ids?.control}
415
- contentAt={(path) => contentAt([key, ...path])}
416
- onCommit={(v) => commitProp(key, v)}
417
- diagnostics={deep}
418
- />
419
- {:else if kind === 'object'}
420
- <ObjectField
421
- bind:this={nestedEls[key]}
422
- value={obj[key] as Record<string, unknown> | undefined}
423
- properties={sub.properties}
424
- {placed}
425
- label={ids ? undefined : fallbackName(key, sub)}
426
- idBase={ids?.control}
427
- labelledBy={ids?.label}
428
- describedBy={describes}
429
- contentAt={(path) => contentAt([key, ...path])}
430
- onCommit={(v) => commitProp(key, v)}
431
- diagnostics={deep}
432
- />
433
- {:else if kind === 'matrix'}
434
- <MatrixField
435
- bind:this={nestedEls[key]}
436
- value={obj[key] as Record<string, unknown> | undefined}
437
- schema={sub}
438
- label={fieldTitle(key, sub)}
439
- description={sub.description}
440
- labelId={ids?.label}
441
- descriptionId={describes}
442
- idBase={ids?.control}
443
- contentAt={(path) => contentAt([key, ...path])}
444
- onCommit={(v) => commitProp(key, v)}
445
- diagnostics={deep}
446
- />
447
- {:else if kind === 'variant'}
448
- <VariantField
449
- bind:this={nestedEls[key]}
450
- value={obj[key] as Record<string, unknown> | undefined}
451
- schema={sub}
452
- ghostMember={sub.default as string | undefined}
453
- label={fieldTitle(key, sub)}
454
- id={ids?.control}
455
- labelledBy={ids?.label}
456
- describedBy={describes}
457
- contentAt={(path) => contentAt([key, ...path])}
458
- onCommit={(v) => commitProp(key, v)}
459
- diagnostics={deep}
460
- />
461
- {:else}
462
- <TextField
463
- label={named}
464
- id={ids?.control}
465
- describedBy={describes}
466
- value={obj[key] as string | undefined}
467
- onCommit={(v) => commitProp(key, v)}
468
- />
469
- {/if}
470
- <DiagnosticList diagnostics={own} />
408
+ <ArrayField
409
+ bind:this={nestedEls[key]}
410
+ value={obj[key]}
411
+ fallback={Array.isArray(sub.default) ? sub.default : undefined}
412
+ items={sub.items}
413
+ layout={arrayLayout(sub)}
414
+ max={sub.max}
415
+ label={fieldTitle(key, sub)}
416
+ description={sub.description}
417
+ labelId={ids?.label}
418
+ descriptionId={describes}
419
+ idBase={ids?.control}
420
+ contentAt={(path) => contentAt([key, ...path])}
421
+ onCommit={(v) => commitProp(key, v)}
422
+ diagnostics={deep}
423
+ />
424
+ {:else if kind === 'object'}
425
+ <ObjectField
426
+ bind:this={nestedEls[key]}
427
+ value={obj[key] as Record<string, unknown> | undefined}
428
+ properties={sub.properties}
429
+ {placed}
430
+ label={ids ? undefined : fallbackName(key, sub)}
431
+ idBase={ids?.control}
432
+ labelledBy={ids?.label}
433
+ describedBy={describes}
434
+ contentAt={(path) => contentAt([key, ...path])}
435
+ onCommit={(v) => commitProp(key, v)}
436
+ diagnostics={deep}
437
+ />
438
+ {:else if kind === 'matrix'}
439
+ <MatrixField
440
+ bind:this={nestedEls[key]}
441
+ value={obj[key] as Record<string, unknown> | undefined}
442
+ schema={sub}
443
+ label={fieldTitle(key, sub)}
444
+ description={sub.description}
445
+ labelId={ids?.label}
446
+ descriptionId={describes}
447
+ idBase={ids?.control}
448
+ contentAt={(path) => contentAt([key, ...path])}
449
+ onCommit={(v) => commitProp(key, v)}
450
+ diagnostics={deep}
451
+ />
452
+ {:else if kind === 'variant'}
453
+ <VariantField
454
+ bind:this={nestedEls[key]}
455
+ value={obj[key] as Record<string, unknown> | undefined}
456
+ schema={sub}
457
+ ghostMember={sub.default as string | undefined}
458
+ label={fieldTitle(key, sub)}
459
+ id={ids?.control}
460
+ labelledBy={ids?.label}
461
+ describedBy={describes}
462
+ contentAt={(path) => contentAt([key, ...path])}
463
+ onCommit={(v) => commitProp(key, v)}
464
+ diagnostics={deep}
465
+ />
466
+ {:else}
467
+ <TextField
468
+ label={named}
469
+ id={ids?.control}
470
+ describedBy={describes}
471
+ value={obj[key] as string | undefined}
472
+ onCommit={(v) => commitProp(key, v)}
473
+ />
474
+ {/if}
475
+ <DiagnosticList diagnostics={own} />
476
+ </div>
471
477
  </div>
472
478
  {/each}
473
479
  </div>
@@ -478,7 +484,7 @@
478
484
  /* The vertical and the rung between it and the properties, `--_qm-nest` being the step
479
485
  the card and the section hold too.
480
486
 
481
- `--_qm-border`: this is the stroke that structures (ARCHITECTURE §"A plane is a
487
+ `--_qm-border`: this is the stroke that structures (INVARIANTS §"A plane is a
482
488
  tone"), the one the section's vertical reads.
483
489
 
484
490
  `padding-block` is the stroke's end caps, the same rung and the same reason as a
@@ -535,6 +541,12 @@
535
541
  align-items: start;
536
542
  min-width: 0;
537
543
  }
544
+ .qm-prop-stack {
545
+ display: flex;
546
+ flex-direction: column;
547
+ gap: var(--_qm-space);
548
+ min-width: 0;
549
+ }
538
550
  /* A record of one cell takes half the capacity: at full capacity a single track reads
539
551
  as truncated, and there are no sibling properties for it to line up with. A placed
540
552
  property's span is `placeFields`', which strands a lone one to the whole row as it
@@ -545,6 +557,13 @@
545
557
  /* A block prose property holds paragraphs, so a track beside it stands in whitespace
546
558
  once it grows (`packable`); its label still rides the row above it. A placed
547
559
  property `placeFields` gives the whole row spans it the same way. */
560
+ /* A placed run's last cell where its capacity would leave it alone (`RunTail`). */
561
+ .qm-object-prop[data-tail='odd'] {
562
+ grid-column: var(--tail-odd);
563
+ }
564
+ .qm-object-prop[data-tail='lone'] {
565
+ grid-column: var(--tail-lone);
566
+ }
548
567
  .qm-object-prop.qm-prop-wide,
549
568
  .qm-object-prop.qm-prop-wide:only-child {
550
569
  grid-column: 1 / -1;
@@ -1,5 +1,5 @@
1
1
  <!--
2
- A Svelte mount of the codec's `createField` (VISUAL_EDITOR §Surface), which owns the
2
+ A Svelte mount of the codec's `createField` (INVARIANTS §Surface), which owns the
3
3
  PM state, the history and the per-keystroke commit, leaving this wrapper wiring and
4
4
  registration. `addr` is a live object the parent builds, so a card reorder re-targets
5
5
  this leaf's commits with the caret riding the untouched view.
@@ -103,7 +103,7 @@
103
103
  const t = wording();
104
104
 
105
105
  /** Pushed by the leaf's trigger plugin: the menu is the leaf's surface rather than
106
- * the shell's (VISUAL_EDITOR §Chrome). A constrained leaf never receives one, the
106
+ * the shell's (INVARIANTS §Chrome). A constrained leaf never receives one, the
107
107
  * trigger mounting on the block schema alone. */
108
108
  let slash: SlashState | undefined = $state();
109
109
 
@@ -189,7 +189,12 @@
189
189
  <span id={heldId} class="qm-prose-held-note">{t.strings.proseHeld}</span>
190
190
  {/if}
191
191
  </div>
192
- <SlashMenu menu={slash} leaf={() => controller} label={t.strings.slashLabel} />
192
+ <SlashMenu
193
+ menu={slash}
194
+ leaf={() => controller}
195
+ label={t.strings.slashLabel}
196
+ name={t.strings.slashName}
197
+ />
193
198
 
194
199
  <style>
195
200
  /* A leaf the inline schema does not constrain grows, and opens at one line box: the