@quillmark/svelte 0.31.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 (67) hide show
  1. package/README.md +3 -3
  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 +1 -1
  7. package/dist/core/codec/decode.js +2 -2
  8. package/dist/core/codec/field.d.ts +3 -3
  9. package/dist/core/codec/field.js +21 -20
  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/prose.css +3 -3
  23. package/dist/core/codec/schema.d.ts +1 -1
  24. package/dist/core/codec/schema.js +3 -3
  25. package/dist/core/codec/shortcuts.d.ts +91 -0
  26. package/dist/core/codec/shortcuts.js +135 -0
  27. package/dist/core/codec/table-paste.js +1 -1
  28. package/dist/core/codec/table-view.d.ts +1 -1
  29. package/dist/core/codec/table-view.js +27 -37
  30. package/dist/core/codec/tasks.js +1 -1
  31. package/dist/core/theme.css +2 -2
  32. package/dist/preset/scale.css +1 -1
  33. package/dist/preview/Preview.svelte +2 -3
  34. package/dist/preview/bridge.js +2 -2
  35. package/dist/preview/geometry.d.ts +2 -2
  36. package/dist/preview/geometry.js +2 -2
  37. package/dist/preview/paint.js +1 -1
  38. package/dist/visual/ArrayField.svelte +5 -5
  39. package/dist/visual/BooleanField.svelte +1 -1
  40. package/dist/visual/Card.svelte +4 -4
  41. package/dist/visual/CardControls.svelte +1 -1
  42. package/dist/visual/DateField.svelte +1 -1
  43. package/dist/visual/DiagnosticList.svelte +1 -1
  44. package/dist/visual/EnumField.svelte +1 -1
  45. package/dist/visual/Field.svelte +3 -3
  46. package/dist/visual/FormatPopover.svelte +9 -3
  47. package/dist/visual/MatrixAdd.svelte +1 -1
  48. package/dist/visual/MatrixField.svelte +1 -1
  49. package/dist/visual/NumberField.svelte +2 -3
  50. package/dist/visual/ObjectField.svelte +2 -2
  51. package/dist/visual/ProseField.svelte +2 -2
  52. package/dist/visual/TextField.svelte +1 -1
  53. package/dist/visual/VariantField.svelte +1 -1
  54. package/dist/visual/VisualEditorInner.svelte +15 -15
  55. package/dist/visual/controls.css +2 -2
  56. package/dist/visual/diagnostics.d.ts +2 -2
  57. package/dist/visual/diagnostics.js +2 -2
  58. package/dist/visual/index.d.ts +2 -0
  59. package/dist/visual/index.js +3 -0
  60. package/dist/visual/leaves.js +1 -1
  61. package/dist/visual/props.d.ts +2 -2
  62. package/dist/visual/strings.d.ts +6 -5
  63. package/dist/visual/strings.js +2 -1
  64. package/dist/visual/structure.d.ts +10 -9
  65. package/dist/visual/structure.js +13 -12
  66. package/dist/visual/tips.js +1 -1
  67. package/package.json +1 -1
@@ -0,0 +1,135 @@
1
+ // The chords the prose leaf binds, named once: every keymap that binds one of these reads
2
+ // its key from here, and `editorShortcuts` describes them from the same tables, so a rebinding
3
+ // is one edit that moves the binding and the host's shortcut list together.
4
+ //
5
+ // A key a surface takes only to decline, hold or pass on (Backspace at a block edge, the
6
+ // body's Tab hold, a code fence's Tab) is not a shortcut a writer looks up, and stays a
7
+ // literal in its keymap.
8
+ import { toggleMark } from 'prosemirror-commands';
9
+ /** Every prose leaf, a table cell included: history and the marks. `link` binds in the
10
+ * formatting popover, which is the surface that prompts for the URL. */
11
+ export const FIELD_KEYS = {
12
+ undo: 'Mod-z',
13
+ redo: 'Mod-Shift-z',
14
+ redoAlt: 'Mod-y',
15
+ bold: 'Mod-b',
16
+ italic: 'Mod-i',
17
+ underline: 'Mod-u',
18
+ strike: 'Mod-Shift-x',
19
+ code: 'Mod-e',
20
+ link: 'Mod-k'
21
+ };
22
+ /** A multi-block body, outside any surface nested in it. */
23
+ export const BODY_KEYS = {
24
+ lineBreak: 'Shift-Enter',
25
+ leave: 'Escape'
26
+ };
27
+ /** A list item (`lists.ts`, `list-move.ts`). */
28
+ export const LIST_KEYS = {
29
+ numbered: 'Mod-Shift-7',
30
+ bulleted: 'Mod-Shift-8',
31
+ indent: 'Tab',
32
+ outdent: 'Shift-Tab',
33
+ task: 'Mod-Enter',
34
+ moveUp: 'Alt-ArrowUp',
35
+ moveDown: 'Alt-ArrowDown'
36
+ };
37
+ /** A table island's cell (`table-view.ts`). */
38
+ export const TABLE_KEYS = {
39
+ next: 'Tab',
40
+ previous: 'Shift-Tab',
41
+ nextRow: 'Enter',
42
+ select: 'Escape',
43
+ selectAll: 'Mod-a',
44
+ moveUp: 'Alt-ArrowUp',
45
+ moveDown: 'Alt-ArrowDown',
46
+ moveLeft: 'Alt-ArrowLeft',
47
+ moveRight: 'Alt-ArrowRight',
48
+ alignLeft: 'Shift-ArrowLeft',
49
+ alignRight: 'Shift-ArrowRight',
50
+ erase: 'Backspace',
51
+ eraseAlt: 'Delete'
52
+ };
53
+ /** The mark toggles, each bound only where the schema declares its mark. */
54
+ export function markKeymap(schema) {
55
+ const map = {};
56
+ if (schema.marks.strong)
57
+ map[FIELD_KEYS.bold] = toggleMark(schema.marks.strong);
58
+ if (schema.marks.em)
59
+ map[FIELD_KEYS.italic] = toggleMark(schema.marks.em);
60
+ if (schema.marks.underline)
61
+ map[FIELD_KEYS.underline] = toggleMark(schema.marks.underline);
62
+ if (schema.marks.strike)
63
+ map[FIELD_KEYS.strike] = toggleMark(schema.marks.strike);
64
+ if (schema.marks.code)
65
+ map[FIELD_KEYS.code] = toggleMark(schema.marks.code);
66
+ return map;
67
+ }
68
+ export const DEFAULT_SHORTCUT_STRINGS = {
69
+ shortcutUndo: 'Undo',
70
+ shortcutRedo: 'Redo',
71
+ shortcutBold: 'Bold',
72
+ shortcutItalic: 'Italic',
73
+ shortcutUnderline: 'Underline',
74
+ shortcutStrikethrough: 'Strikethrough',
75
+ shortcutCode: 'Code',
76
+ shortcutLink: 'Link',
77
+ shortcutLineBreak: 'Line break within a paragraph',
78
+ shortcutLeave: 'Leave the editor',
79
+ shortcutNumberedList: 'Numbered list',
80
+ shortcutBulletedList: 'Bulleted list',
81
+ shortcutIndent: 'Nest under the item above',
82
+ shortcutOutdent: 'Move back up a level',
83
+ shortcutTask: 'Check or uncheck a task',
84
+ shortcutMoveItem: 'Move the item up or down',
85
+ shortcutNextCell: 'Next cell, adding a row past the last',
86
+ shortcutPreviousCell: 'Previous cell',
87
+ shortcutNextRow: 'Next row, adding one past the last',
88
+ shortcutSelectCells: "Select the cell's text, then its row, then the table",
89
+ shortcutSelectRow: 'Select the row, then the table',
90
+ shortcutMoveLine: 'Move a selected row or column',
91
+ shortcutAlignColumn: 'Align a selected column',
92
+ shortcutDeleteCells: 'Delete the selected cells, rows or columns'
93
+ };
94
+ const F = FIELD_KEYS;
95
+ const L = LIST_KEYS;
96
+ const T = TABLE_KEYS;
97
+ /** The described shortcuts, in the order a host lists them. */
98
+ const SHORTCUTS = [
99
+ { scope: 'field', label: 'shortcutUndo', keys: [F.undo] },
100
+ { scope: 'field', label: 'shortcutRedo', keys: [F.redo, F.redoAlt] },
101
+ { scope: 'field', label: 'shortcutBold', keys: [F.bold] },
102
+ { scope: 'field', label: 'shortcutItalic', keys: [F.italic] },
103
+ { scope: 'field', label: 'shortcutUnderline', keys: [F.underline] },
104
+ { scope: 'field', label: 'shortcutStrikethrough', keys: [F.strike] },
105
+ { scope: 'field', label: 'shortcutCode', keys: [F.code] },
106
+ { scope: 'field', label: 'shortcutLink', keys: [F.link] },
107
+ { scope: 'body', label: 'shortcutLineBreak', keys: [BODY_KEYS.lineBreak] },
108
+ { scope: 'body', label: 'shortcutLeave', keys: [BODY_KEYS.leave] },
109
+ { scope: 'list', label: 'shortcutNumberedList', keys: [L.numbered] },
110
+ { scope: 'list', label: 'shortcutBulletedList', keys: [L.bulleted] },
111
+ { scope: 'list', label: 'shortcutIndent', keys: [L.indent] },
112
+ { scope: 'list', label: 'shortcutOutdent', keys: [L.outdent] },
113
+ { scope: 'list', label: 'shortcutTask', keys: [L.task] },
114
+ { scope: 'list', label: 'shortcutMoveItem', keys: [L.moveUp, L.moveDown] },
115
+ { scope: 'table', label: 'shortcutNextCell', keys: [T.next] },
116
+ { scope: 'table', label: 'shortcutPreviousCell', keys: [T.previous] },
117
+ { scope: 'table', label: 'shortcutNextRow', keys: [T.nextRow] },
118
+ { scope: 'table', label: 'shortcutSelectCells', keys: [T.selectAll] },
119
+ { scope: 'table', label: 'shortcutSelectRow', keys: [T.select] },
120
+ {
121
+ scope: 'table',
122
+ label: 'shortcutMoveLine',
123
+ keys: [T.moveUp, T.moveDown, T.moveLeft, T.moveRight]
124
+ },
125
+ { scope: 'table', label: 'shortcutAlignColumn', keys: [T.alignLeft, T.alignRight] },
126
+ { scope: 'table', label: 'shortcutDeleteCells', keys: [T.erase, T.eraseAlt] }
127
+ ];
128
+ /**
129
+ * The rich editor's shortcuts, worded by `strings` (the package's English where a key is unset),
130
+ * so a host's shortcut list is read off the bindings rather than copied from them.
131
+ */
132
+ export function editorShortcuts(strings = {}) {
133
+ const words = { ...DEFAULT_SHORTCUT_STRINGS, ...strings };
134
+ return SHORTCUTS.map(({ keys, label, scope }) => ({ keys, label: words[label], scope }));
135
+ }
@@ -1,4 +1,4 @@
1
- // A table on the clipboard lands as a table island (CODEC §"Markdown at the edges"). Two
1
+ // A table on the clipboard lands as a table island (INVARIANTS §"Markdown at the edges"). Two
2
2
  // spellings carry one: an HTML `<table>`, and the tab-separated text a spreadsheet writes
3
3
  // beside it, which ProseMirror hands over only where the clipboard holds no HTML. Either
4
4
  // builds its props through `normalizeTable` and arrives with no id, which the paste's
@@ -1,7 +1,7 @@
1
1
  import { EditorView, type NodeViewConstructor } from 'prosemirror-view';
2
2
  /** Everything the island's chrome says. Accessible names, not decoration: every
3
3
  * control here is a bar, so an untranslated one reads the wrong language rather than
4
- * merely inconsistent (VISUAL_EDITOR §"What the surface says"). */
4
+ * merely inconsistent (INVARIANTS §"What the surface says"). */
5
5
  export interface TableChromeStrings {
6
6
  /** The island's own name, on the wrapper. */
7
7
  tableLabel: string;
@@ -1,20 +1,21 @@
1
- // The table island's NodeView (CODEC §"The table island"): vanilla DOM holding one nested
1
+ // The table island's NodeView (INVARIANTS §"The table island"): vanilla DOM holding one nested
2
2
  // `EditorView` per cell, each on its own schema (`table.ts`).
3
3
  //
4
4
  // A cell edit writes the projection back onto the node's `props` with `setNodeMarkup`, which the
5
- // field lowers to an `islandOps` `set` (CODEC §Encode), so every anchor stays in the field.
5
+ // field lowers to an `islandOps` `set` (INVARIANTS §Encode), so every anchor stays in the field.
6
6
  //
7
7
  // The nested views carry no history (Mod-z routes to the field's), no anchor plugin (an anchor in a
8
8
  // cell is preserved, never minted), and no placeholder.
9
9
  //
10
10
  // Every control is absolutely positioned out of the grid; `codec/prose.css` draws the band, the
11
11
  // clusters and the selection wash.
12
- import { baseKeymap, chainCommands, selectAll, toggleMark } from 'prosemirror-commands';
12
+ import { baseKeymap, chainCommands, selectAll } from 'prosemirror-commands';
13
13
  import { redo, undo } from 'prosemirror-history';
14
14
  import { keymap } from 'prosemirror-keymap';
15
15
  import { EditorState, NodeSelection, Selection, TextSelection } from 'prosemirror-state';
16
16
  import { EditorView } from 'prosemirror-view';
17
17
  import { decode } from './decode.js';
18
+ import { FIELD_KEYS, markKeymap, TABLE_KEYS as T } from './shortcuts.js';
18
19
  import { inputRulesPlugin, undoRuleKeymap } from './inputrules.js';
19
20
  import { linkPastePlugin } from './link-paste.js';
20
21
  import { tableOfNode } from './table.js';
@@ -305,7 +306,7 @@ class TableIslandView {
305
306
  }
306
307
  // ── The pointer ───────────────────────────────────────────────────────────
307
308
  /**
308
- * Route a press to its band (CODEC §"The table island"): inside the frame the nearest cell's
309
+ * Route a press to its band (INVARIANTS §"The table island"): inside the frame the nearest cell's
309
310
  * caret, outside it the document's, and a band control answers for itself.
310
311
  *
311
312
  * A press in a cell is a caret the nested view takes; only the promotion to a block is armed
@@ -455,7 +456,7 @@ class TableIslandView {
455
456
  }
456
457
  /**
457
458
  * The island as the selection: the Escape that climbs out of a cell or held rectangle.
458
- * Backspace there deletes the table, as over every island (CODEC §"The table island").
459
+ * Backspace there deletes the table, as over every island (INVARIANTS §"The table island").
459
460
  */
460
461
  selectIsland() {
461
462
  const pos = this.getPos();
@@ -549,7 +550,7 @@ class TableIslandView {
549
550
  : { floor: 0, limit: columnCount(props) - 1 };
550
551
  }
551
552
  /** Select a line, and land the caret on it. The line verbs bind in the cell
552
- * (CODEC §"The table island"), so the rectangle has to run through the caret for the
553
+ * (INVARIANTS §"The table island"), so the rectangle has to run through the caret for the
553
554
  * next key to read a line off it. The focus moves first and the paint follows: a cell
554
555
  * taking the focus retires whatever was held. */
555
556
  selectLine(line) {
@@ -693,7 +694,7 @@ class TableIslandView {
693
694
  this.write(props, { r: block.r0, c: block.c0 });
694
695
  }
695
696
  /**
696
- * What Backspace means over the selection (CODEC §"The table island"). Swept cells clear and
697
+ * What Backspace means over the selection (INVARIANTS §"The table island"). Swept cells clear and
697
698
  * keep their lines. Named lines go; every rank on both axes is the table, which goes as the
698
699
  * island.
699
700
  */
@@ -1455,21 +1456,10 @@ class TableIslandView {
1455
1456
  }
1456
1457
  /**
1457
1458
  * A cell's keys. Traversal binds on the nested view, since the outer keymap never sees a
1458
- * keystroke a cell handled (`stopEvent`; VISUAL_EDITOR §Chrome). Enter is the next row;
1459
+ * keystroke a cell handled (`stopEvent`; INVARIANTS §Chrome). Enter is the next row;
1459
1460
  * Shift-Enter is the body's line break (`breaks.ts`).
1460
1461
  */
1461
1462
  cellKeys(r, c) {
1462
- const marks = {};
1463
- if (cellSchema.marks.strong)
1464
- marks['Mod-b'] = toggleMark(cellSchema.marks.strong);
1465
- if (cellSchema.marks.em)
1466
- marks['Mod-i'] = toggleMark(cellSchema.marks.em);
1467
- if (cellSchema.marks.underline)
1468
- marks['Mod-u'] = toggleMark(cellSchema.marks.underline);
1469
- if (cellSchema.marks.strike)
1470
- marks['Mod-Shift-x'] = toggleMark(cellSchema.marks.strike);
1471
- if (cellSchema.marks.code)
1472
- marks['Mod-e'] = toggleMark(cellSchema.marks.code);
1473
1463
  // The arrows walk the grid, each leaving a cell only from the text's edge on its side. Up
1474
1464
  // and down clamp at the top and bottom; left and right follow reading order and stop at the
1475
1465
  // first and last cells. No arrow grows the table.
@@ -1575,28 +1565,28 @@ class TableIslandView {
1575
1565
  return true;
1576
1566
  };
1577
1567
  return {
1578
- ...marks,
1568
+ ...markKeymap(cellSchema),
1579
1569
  ...breakKeymap(cellSchema),
1580
1570
  // One undo stack per leaf: Mod-z unwinds a cell keystroke and a row op in order.
1581
- 'Mod-z': () => undo(this.outer.state, this.outer.dispatch),
1582
- 'Mod-y': () => redo(this.outer.state, this.outer.dispatch),
1583
- 'Shift-Mod-z': () => redo(this.outer.state, this.outer.dispatch),
1584
- Backspace: erase,
1585
- Delete: erase,
1571
+ [FIELD_KEYS.undo]: () => undo(this.outer.state, this.outer.dispatch),
1572
+ [FIELD_KEYS.redoAlt]: () => redo(this.outer.state, this.outer.dispatch),
1573
+ [FIELD_KEYS.redo]: () => redo(this.outer.state, this.outer.dispatch),
1574
+ [T.erase]: erase,
1575
+ [T.eraseAlt]: erase,
1586
1576
  ArrowUp: chainCommands(line('row', -1, false), walk('up')),
1587
1577
  ArrowDown: chainCommands(line('row', 1, false), walk('down')),
1588
1578
  ArrowLeft: chainCommands(line('column', -1, false), cross(-1)),
1589
1579
  ArrowRight: chainCommands(line('column', 1, false), cross(1)),
1590
- 'Alt-ArrowUp': line('row', -1, true),
1591
- 'Alt-ArrowDown': line('row', 1, true),
1592
- 'Alt-ArrowLeft': line('column', -1, true),
1593
- 'Alt-ArrowRight': line('column', 1, true),
1594
- 'Shift-ArrowLeft': slide(-1),
1595
- 'Shift-ArrowRight': slide(1),
1596
- 'Mod-a': grow,
1597
- Tab: () => this.step(r, c, 1),
1598
- 'Shift-Tab': () => this.step(r, c, -1),
1599
- Enter: () => {
1580
+ [T.moveUp]: line('row', -1, true),
1581
+ [T.moveDown]: line('row', 1, true),
1582
+ [T.moveLeft]: line('column', -1, true),
1583
+ [T.moveRight]: line('column', 1, true),
1584
+ [T.alignLeft]: slide(-1),
1585
+ [T.alignRight]: slide(1),
1586
+ [T.selectAll]: grow,
1587
+ [T.next]: () => this.step(r, c, 1),
1588
+ [T.previous]: () => this.step(r, c, -1),
1589
+ [T.nextRow]: () => {
1600
1590
  // Over a rectangle it hands the caret back: the caret never left the cell.
1601
1591
  if (this.selected) {
1602
1592
  this.clearSelection();
@@ -1617,8 +1607,8 @@ class TableIslandView {
1617
1607
  },
1618
1608
  // Escape climbs a rung a press: the caret's row (the keyboard's only route to a held
1619
1609
  // rectangle), then the island. What a press past the island means is the shell's
1620
- // (VISUAL_EDITOR §"Settled and open").
1621
- Escape: () => {
1610
+ // (INVARIANTS §Chrome).
1611
+ [T.select]: () => {
1622
1612
  if (this.selected)
1623
1613
  this.selectIsland();
1624
1614
  else
@@ -1,4 +1,4 @@
1
- // A task item is a `list_item` whose `checked` is a boolean (CODEC §"Task items"). Its
1
+ // A task item is a `list_item` whose `checked` is a boolean (INVARIANTS §"Task items"). Its
2
2
  // `toDOM` draws a checkbox ahead of the item's blocks, disabled, which is the drawing a
3
3
  // held leaf, a copy and `renderContent` take; a leaf that edits mounts the item through
4
4
  // `taskItemView`, whose checkbox toggles, as `Mod-Enter` does (`toggleTask`). A task item
@@ -108,7 +108,7 @@
108
108
 
109
109
  Planes are the half that does not read the ink pole, because what makes a
110
110
  card read as a card is that it is the brighter plane, in both schemes
111
- alike (ARCHITECTURE §Styling). A plane stepped toward the ink is right in
111
+ alike (INVARIANTS §Styling). A plane stepped toward the ink is right in
112
112
  dark and inverted in light, where it darkens the card below the page it
113
113
  floats on. So `sunken` and `well` step toward shadow and `raised` toward
114
114
  light, and the base plane — a card, the preview's paper — is the pole
@@ -220,7 +220,7 @@
220
220
 
221
221
  /* The tips card'S hue: the surface's one exit from the greyscale that is not
222
222
  a status, and what the amber and the typewriter face say together is
223
- draft (VISUAL_EDITOR §"Card operations"). A literal rather than a dial
223
+ draft (INVARIANTS §"Card operations"). A literal rather than a dial
224
224
  because there is nothing left to turn: the rungs under it mix over
225
225
  the surface and the ink a consumer already tuned, so the card follows a
226
226
  brand untold. The mixes are faint on purpose: a warmth, not a badge.
@@ -31,7 +31,7 @@
31
31
  the page sinks from it by the same ramp. That is what puts a host page and
32
32
  an editor's own column on one tone rather than a plane apart. Planes step by
33
33
  light and everything else by ink, which is the package's own split
34
- (ARCHITECTURE §Styling); the figures are its figures. */
34
+ (INVARIANTS §Styling); the figures are its figures. */
35
35
  --qmh-surface: var(--qm-bg, light-dark(#fff, #272729));
36
36
  --qmh-page: oklab(from var(--qmh-surface) calc(l - (0.04 + 0.0202 * (1 - l))) a b);
37
37
  --qmh-ink: var(--qm-fg, light-dark(#1c1c1c, #d7dadc));
@@ -109,7 +109,7 @@
109
109
  `touch-action` leaves a pinch to the viewport, which zooms the pages rather than
110
110
  the host's page.
111
111
 
112
- `:global(:where(…))` puts this promised class at zero rank (ARCHITECTURE §Styling). */
112
+ `:global(:where(…))` puts this promised class at zero rank (INVARIANTS §Styling). */
113
113
  :global(:where(.qm-preview)) {
114
114
  box-sizing: border-box;
115
115
  position: relative;
@@ -157,8 +157,7 @@
157
157
  margin-top: auto;
158
158
  }
159
159
 
160
- /* Floats over the desk, so it lifts the way a floating surface does (ARCHITECTURE
161
- §Styling), and says only the zoom: the label never changes. Tabular figures and a
160
+ /* Floats over the desk, so it lifts the way a floating surface does (INVARIANTS §Styling), and says only the zoom: the label never changes. Tabular figures and a
162
161
  floor as wide as `100%`, so a third digit never shifts its edge. It arrives at once and leaves on the reveal, so a glance at
163
162
  it after a gesture still finds it. */
164
163
  :global(:where(.qm-preview-zoom)) {
@@ -10,7 +10,7 @@ function hasBox(port) {
10
10
  const MIN_CLEARANCE = 8;
11
11
  /**
12
12
  * What a click may miss a field's ink by and still land on it, in CSS px of the page as drawn
13
- * (PREVIEW.md §"Click bridge").
13
+ * (INVARIANTS §"Click bridge").
14
14
  */
15
15
  const CLICK_SLACK_PX = 2;
16
16
  /**
@@ -29,7 +29,7 @@ export function clearOfTheFold(target, port) {
29
29
  export function createBridge(session, container, slots, onPick, held = {}) {
30
30
  const unlisten = [];
31
31
  // Two rungs: `positionAt` over span-tracked content, then `fieldAt` over every tracked
32
- // placement (PREVIEW.md §"Click bridge"). The second carries no `pos`: a fabricated `0` would
32
+ // placement (INVARIANTS §"Click bridge"). The second carries no `pos`: a fabricated `0` would
33
33
  // be an invented offset.
34
34
  if (onPick) {
35
35
  for (const { page, el } of slots) {
@@ -14,8 +14,8 @@ export interface PdfPoint {
14
14
  y: number;
15
15
  }
16
16
  /**
17
- * An address's boxes: `fieldBoxes`'s union, else every `regions()` rect at or under it
18
- * (PREVIEW.md §"Two responsibilities"). `fieldBoxes` answers `[]` for a scalar reference
17
+ * An address's boxes: `fieldBoxes`'s union, else every `regions()` rect at or under it.
18
+ * `fieldBoxes` answers `[]` for a scalar reference
19
19
  * the plate places without tracking its content and for an array itself; the fallback
20
20
  * takes the address and its descendants, matched at a path boundary (`.` or `[`):
21
21
  * `main.keywords` matches `main.keywords[0]`, not `main.keywords_note`.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * An address's boxes: `fieldBoxes`'s union, else every `regions()` rect at or under it
3
- * (PREVIEW.md §"Two responsibilities"). `fieldBoxes` answers `[]` for a scalar reference
2
+ * An address's boxes: `fieldBoxes`'s union, else every `regions()` rect at or under it.
3
+ * `fieldBoxes` answers `[]` for a scalar reference
4
4
  * the plate places without tracking its content and for an array itself; the fallback
5
5
  * takes the address and its descendants, matched at a path boundary (`.` or `[`):
6
6
  * `main.keywords` matches `main.keywords[0]`, not `main.keywords_note`.
@@ -37,7 +37,7 @@ onPaintError) {
37
37
  function makeSlot(page) {
38
38
  const size = session.pageSize(page);
39
39
  // The paper edge is where `--_qm-surface` meets the container's `--_qm-surface-sunken`; no
40
- // stroke is drawn (ARCHITECTURE §Styling).
40
+ // stroke is drawn (INVARIANTS §Styling).
41
41
  const el = document.createElement('div');
42
42
  // Not `.qm-page`: that is the preset's page baseline, whose `color-scheme` a slot must not
43
43
  // take inside a mounted root (`core/theme.css`).
@@ -23,7 +23,7 @@
23
23
  `focusPath` opens the row it is aimed at before it focuses, and hands the rest of the
24
24
  walk to that row's subform, which is how a row two closed boxes down is reached.
25
25
 
26
- The table (`layout: 'table'`, VISUAL_EDITOR §"Structure mirrors the schema") is the
26
+ The table (`layout: 'table'`, INVARIANTS §"Structure mirrors the schema") is the
27
27
  same row machine in another presentation: the same ids, the same splices, the same
28
28
  landing and the same cell keys, over rows that are always open, each cell the
29
29
  property's ordinary control on the track the header names ({@link ObjectField}
@@ -170,8 +170,8 @@
170
170
  const table = $derived(layout === 'table' && control === 'object');
171
171
  const columns = $derived(Object.entries(items?.properties ?? {}));
172
172
  const defaulted = $derived(value == null && (fallback?.length ?? 0) > 0);
173
- // A bare value is the one-element list the render floor wraps it into (canon
174
- // `SCHEMAS.md` §"Type coercion"), and the reader answers no element of it.
173
+ // A bare value is the one-element list the render floor wraps it into (quillmark/INVARIANTS
174
+ // §"Coercion is the type predicate"), and the reader answers no element of it.
175
175
  const bare = $derived(value != null && !Array.isArray(value));
176
176
  const arr = $derived(rowsOf(value));
177
177
  function rowsOf(v: unknown): unknown[] {
@@ -1108,7 +1108,7 @@
1108
1108
  summary that unfolded it, as a variant's cells hang at the discriminant's and a
1109
1109
  matrix's columns at the tick's. Every vertical hangs at the edge of the control it
1110
1110
  unfolds from, so a step in is one nesting distance wherever it is read, the
1111
- `--_qm-nest` the subform keeps from its own stroke (ARCHITECTURE §"A plane is a
1111
+ `--_qm-nest` the subform keeps from its own stroke (INVARIANTS §"A plane is a
1112
1112
  tone"); a second rung here read as a deeper level than the object the row holds. */
1113
1113
  /* The slabs measure the head, not the row: an open element is the head plus
1114
1114
  everything it unfolded, and the controls belong to the line they sit on rather than
@@ -1172,7 +1172,7 @@
1172
1172
  /* ── A table ────────────────────────────────────────────────────────────────
1173
1173
  Every row of it is open, so it stands where an open row's subform stands: a rung
1174
1174
  inside the field, behind the subform's vertical and between its caps (`ObjectField`,
1175
- ARCHITECTURE §"A plane is a tone"). The stroke is what says the header's labels are
1175
+ INVARIANTS §"A plane is a tone"). The stroke is what says the header's labels are
1176
1176
  the field's insides: on the field's own edge at the label's register, labels abreast
1177
1177
  over boxes are the figure a row of compact fields draws. A corner reads square at a
1178
1178
  stroke, so the wash takes none here.
@@ -106,7 +106,7 @@
106
106
  border-radius: var(--_qm-radius-pill);
107
107
  /* The track is a fill and nothing else: an edge around it would be a second
108
108
  statement of a shape the tone already draws, and the checked state swaps that
109
- one fill for the accent (ARCHITECTURE §Styling). The fill is the band, a
109
+ one fill for the accent (INVARIANTS §Styling). The fill is the band, a
110
110
  resting tone: on the hover rung an off switch read as a button under the
111
111
  pointer. */
112
112
  background: var(--_qm-surface-band);
@@ -435,7 +435,7 @@
435
435
 
436
436
  <style>
437
437
  /* An island: the card is the base plane and the column behind it the sunken one, and
438
- the step between the two tones is the whole of its edge (ARCHITECTURE §"A plane is a
438
+ the step between the two tones is the whole of its edge (INVARIANTS §"A plane is a
439
439
  tone"). The block half is the same rung as the gap: the payload stands that far off
440
440
  the card's edge and off the body below it. The header insets itself to the
441
441
  section-heading column (`.qm-card-header`). The inline half stands a step tighter
@@ -519,7 +519,7 @@
519
519
 
520
520
  The type is a rung over the group header's: the card holds its sections, so its name
521
521
  ranks above theirs, at the paper rung and at the header's weight: the size ramp ranks,
522
- and the weight stays the chrome's one (ARCHITECTURE §Styling). */
522
+ and the weight stays the chrome's one (INVARIANTS §Styling). */
523
523
  .qm-card-title-sizer {
524
524
  display: inline-grid;
525
525
  align-items: center;
@@ -591,7 +591,7 @@
591
591
  }
592
592
  /* The card's two horizontals, and ranking is the one thing a horizontal is for: they
593
593
  stand the payload against the title above it and the body below it, where saying what
594
- sits inside what is the verticals' (ARCHITECTURE §"A plane is a tone"). Each is
594
+ sits inside what is the verticals' (INVARIANTS §"A plane is a tone"). Each is
595
595
  conditional on what it ranks against: `main` is headerless, and a card with no body
596
596
  has nothing under the payload to divide it from.
597
597
 
@@ -641,7 +641,7 @@
641
641
  row-gap: var(--row-gap);
642
642
  }
643
643
  /* The nesting vertical, on the card's inset with the panel's fields one `--_qm-nest`
644
- off it (ARCHITECTURE §"A plane is a tone"). The end inset is the column's, so the
644
+ off it (INVARIANTS §"A plane is a tone"). The end inset is the column's, so the
645
645
  panel's wells end where a top-level field's do. `--_qm-border` and
646
646
  not `--_qm-accent`: the verticals and the rules beside them are one stroke at every
647
647
  depth, and a tone that changed as it went in would read as unrelated lines rather
@@ -2,7 +2,7 @@
2
2
  Card controls, composable cards only.
3
3
  Right-aligned in the header: a move-up/move-down chevron pair (each disabled at its
4
4
  edge), then delete, the row revealed while the pointer or the caret is in the card.
5
- Reorder is buttons, not drag (V1). All three are chips (controls.css): fill arrives
5
+ Reorder is buttons, not drag. All three are chips (controls.css): fill arrives
6
6
  on hover, and delete rests at the label ink beside them. The card scopes
7
7
  that reveal, so its condition lives in the parent's CSS; the row keeps the narrower
8
8
  guarantee here, that a focused control is a visible one.
@@ -5,7 +5,7 @@
5
5
  (the unset rung) where nothing is declared, the parent removing the field. The value-object a date field lowers to is a render-time
6
6
  concern: the editor only sees the stored string.
7
7
 
8
- `today` is the render date rather than a written one (canon `SCHEMAS.md`), so its
8
+ `today` is the render date rather than a written one (quillmark `docs/quills/quill-yaml-reference.md` §"Dated by the render"), so its
9
9
  digits take the default rung: they print, and nothing wrote them. The digits are
10
10
  the local date, which is what `resolve` and a session opened without a date both
11
11
  render. The Today toggle writes `today`, and pressed, writes those digits; `T` in a
@@ -1,5 +1,5 @@
1
1
  <!--
2
- Inline diagnostic display (VISUAL_EDITOR §Diagnostics). Errors only, non-gating:
2
+ Inline diagnostic display (INVARIANTS §Diagnostics). Errors only, non-gating:
3
3
  purely additive, never disables the field it sits under. Shared by `Field.svelte`
4
4
  (a scalar/prose field) and `Card.svelte` (the body leaf, which has no
5
5
  `Field.svelte` wrapper), so a card's body diagnostics render the same way a
@@ -134,7 +134,7 @@
134
134
  policy when it is the one selected: a listbox whose selected value
135
135
  has no row shows nothing for what the document says, and offers none
136
136
  for the primitive to mark, type-ahead to, or key onto
137
- (VISUAL_EDITOR §"Enum policy"). Off `local`, not `value`: the
137
+ (INVARIANTS §Enums). Off `local`, not `value`: the
138
138
  row that exists is the row the control has selected, through the
139
139
  window where an own pick has not reconciled back. -->
140
140
  {#each values as v (v)}
@@ -1,5 +1,5 @@
1
1
  <!--
2
- Type dispatch (VISUAL_EDITOR §"Structure mirrors the schema"). Given one projected
2
+ Type dispatch (INVARIANTS §"Structure mirrors the schema"). Given one projected
3
3
  {@link FieldModel} and its live value, render the label + the control the type
4
4
  maps to. Array and matrix controls own their label (paired with the add affordance in
5
5
  {@link ArrayField}, with the held count in {@link MatrixField}); other types render
@@ -12,7 +12,7 @@
12
12
 
13
13
  `diagnostics` is the routed `Diagnostic[]` for this field (VisualEditor's
14
14
  `diagByKey`, merging `quill.validate`, local commit errors, and the external
15
- `diagnostics` prop (VISUAL_EDITOR §Diagnostics)) rendered via the shared
15
+ `diagnostics` prop (INVARIANTS §Diagnostics)) rendered via the shared
16
16
  `DiagnosticList`, non-gating; each set also re-evaluates a prose leaf's hold
17
17
  (`ProseField`).
18
18
  -->
@@ -129,7 +129,7 @@
129
129
  // object-valued default has none. An array draws its declared literal instead,
130
130
  // which is what a take writes (`ArrayField`).
131
131
  // A default that prints stands in the control as the value it is, at the default
132
- // rung, and the first edit takes it (VISUAL_EDITOR §"The commitment ladder"). Where
132
+ // rung, and the first edit takes it (INVARIANTS §"The commitment ladder"). Where
133
133
  // nothing prints, a control draws words: the `none` an optional cell prints.
134
134
  const ghost = $derived(ghostDefault(provenance));
135
135
  const defaultStr = $derived(
@@ -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
  -->
@@ -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
@@ -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
@@ -484,7 +484,7 @@
484
484
  /* The vertical and the rung between it and the properties, `--_qm-nest` being the step
485
485
  the card and the section hold too.
486
486
 
487
- `--_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
488
488
  tone"), the one the section's vertical reads.
489
489
 
490
490
  `padding-block` is the stroke's end caps, the same rung and the same reason as a