@quillmark/svelte 0.29.3 → 0.31.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 (63) hide show
  1. package/README.md +3 -3
  2. package/dist/core/address.d.ts +3 -3
  3. package/dist/core/address.js +1 -1
  4. package/dist/core/codec/decode.d.ts +4 -5
  5. package/dist/core/codec/decode.js +151 -208
  6. package/dist/core/codec/encode.d.ts +13 -35
  7. package/dist/core/codec/encode.js +127 -408
  8. package/dist/core/codec/field.d.ts +11 -10
  9. package/dist/core/codec/field.js +190 -92
  10. package/dist/core/codec/index.d.ts +2 -2
  11. package/dist/core/codec/index.js +4 -4
  12. package/dist/core/codec/islands.d.ts +13 -9
  13. package/dist/core/codec/islands.js +54 -49
  14. package/dist/core/codec/marks.d.ts +12 -18
  15. package/dist/core/codec/marks.js +16 -26
  16. package/dist/core/codec/positions.d.ts +25 -7
  17. package/dist/core/codec/positions.js +43 -50
  18. package/dist/core/codec/prose.css +0 -8
  19. package/dist/core/codec/schema.d.ts +3 -3
  20. package/dist/core/codec/schema.js +29 -11
  21. package/dist/core/codec/slash.d.ts +4 -2
  22. package/dist/core/codec/slash.js +13 -3
  23. package/dist/core/codec/table-copy.d.ts +3 -3
  24. package/dist/core/codec/table-copy.js +6 -4
  25. package/dist/core/codec/table-paste.js +13 -9
  26. package/dist/core/codec/table-view.js +19 -12
  27. package/dist/core/codec/table.d.ts +77 -43
  28. package/dist/core/codec/table.js +157 -48
  29. package/dist/core/index.d.ts +1 -0
  30. package/dist/core/theme.css +14 -6
  31. package/dist/visual/ArrayField.svelte +168 -83
  32. package/dist/visual/BooleanField.svelte +2 -2
  33. package/dist/visual/Card.svelte +65 -44
  34. package/dist/visual/DateField.svelte +16 -1
  35. package/dist/visual/DiagnosticList.svelte +34 -2
  36. package/dist/visual/EnumField.svelte +58 -44
  37. package/dist/visual/Field.svelte +13 -3
  38. package/dist/visual/Field.svelte.d.ts +3 -1
  39. package/dist/visual/FieldHint.svelte +10 -3
  40. package/dist/visual/FormatPopover.svelte +1 -1
  41. package/dist/visual/MatrixAdd.svelte +3 -18
  42. package/dist/visual/MatrixField.svelte +20 -12
  43. package/dist/visual/ObjectField.svelte +164 -145
  44. package/dist/visual/ProseField.svelte +6 -1
  45. package/dist/visual/ProseValue.svelte +8 -8
  46. package/dist/visual/SlashMenu.svelte +24 -12
  47. package/dist/visual/SlashMenu.svelte.d.ts +2 -0
  48. package/dist/visual/VisualEditor.svelte +1 -1
  49. package/dist/visual/VisualEditor.svelte.d.ts +1 -1
  50. package/dist/visual/VisualEditorInner.svelte +159 -18
  51. package/dist/visual/VisualEditorInner.svelte.d.ts +1 -1
  52. package/dist/visual/controls.css +42 -4
  53. package/dist/visual/leaves.d.ts +1 -1
  54. package/dist/visual/leaves.js +1 -1
  55. package/dist/visual/strings.d.ts +27 -10
  56. package/dist/visual/strings.js +40 -6
  57. package/dist/visual/structure.d.ts +17 -9
  58. package/dist/visual/structure.js +20 -26
  59. package/dist/visual/undo.svelte.d.ts +36 -0
  60. package/dist/visual/undo.svelte.js +119 -0
  61. package/package.json +2 -2
  62. package/dist/visual/hold.d.ts +0 -17
  63. package/dist/visual/hold.js +0 -39
@@ -18,13 +18,15 @@ export interface SlashState {
18
18
  anchor: RangeAnchor;
19
19
  }
20
20
  /**
21
- * The menu's wording: its accessible name and the empty line's hint. Offers are command names,
22
- * which are not translated.
21
+ * The menu's wording: its accessible name, the empty line's hint, and each row's name. The tokens
22
+ * a row shows beside its name are not translated: they are what is typed.
23
23
  */
24
24
  export interface SlashStrings {
25
25
  slashLabel: string;
26
26
  /** Drawn on the empty line a focused caret holds, naming the key that opens the menu. */
27
27
  slashHint: string;
28
+ /** A command's row name, by its token: `numbered-list` → `Numbered list`. */
29
+ slashName: (command: string) => string;
28
30
  }
29
31
  /** The package's English, beside the surface that draws it; the visual `strings` set extends it. */
30
32
  export declare const DEFAULT_SLASH_STRINGS: SlashStrings;
@@ -3,11 +3,21 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
3
3
  import { rangeAnchor } from './anchor.js';
4
4
  import { consuming, pickList, pickSubList, toCodeBlock, toHeading, wrapInQuote } from './blocks.js';
5
5
  import { mintIslandId } from './islands.js';
6
- import { newTable } from './table.js';
6
+ import { islandOf, newTable } from './table.js';
7
+ const SLASH_NAMES = {
8
+ heading: 'Heading',
9
+ list: 'Bulleted list',
10
+ 'numbered-list': 'Numbered list',
11
+ subparagraph: 'Subparagraph',
12
+ quote: 'Quote',
13
+ code: 'Code block',
14
+ table: 'Table'
15
+ };
7
16
  /** The package's English, beside the surface that draws it; the visual `strings` set extends it. */
8
17
  export const DEFAULT_SLASH_STRINGS = {
9
18
  slashLabel: 'Insert',
10
- slashHint: 'Type / to insert'
19
+ slashHint: 'Type / to insert',
20
+ slashName: (command) => SLASH_NAMES[command] ?? command.charAt(0).toUpperCase() + command.slice(1).replace(/-/g, ' ')
11
21
  };
12
22
  /**
13
23
  * The vocabulary a caret can run, in menu order, each name asked whether it would fire here: a row
@@ -312,6 +322,6 @@ const SLASH_COMMANDS = {
312
322
  table: insertBlock((state) => state.schema.nodes.island_block.create({
313
323
  id: mintIslandId(state.doc),
314
324
  islandType: 'table',
315
- props: newTable()
325
+ ...islandOf(newTable())
316
326
  }))
317
327
  };
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
- import type { TableProps } from '@quillmark/wasm';
2
+ import type { TableGrid } from './table.js';
3
3
  /** A block of cells, both corners inclusive, in the row space `table.ts` names. */
4
4
  export interface CellRange {
5
5
  r0: number;
@@ -11,8 +11,8 @@ export interface CellRange {
11
11
  * holds them. The cells carry their marks, breaks and spans, a span cut to the range,
12
12
  * and nothing else of the table's layout. A slot a merged cell in the range covers
13
13
  * draws nothing; one whose cell starts outside the range draws empty. */
14
- export declare function tableElement(props: TableProps, range?: CellRange): HTMLTableElement;
14
+ export declare function tableElement(props: TableGrid, range?: CellRange): HTMLTableElement;
15
15
  /** The cells of `range` as tab-separated text, a line a row. */
16
- export declare function tableText(props: TableProps, range?: CellRange): string;
16
+ export declare function tableText(props: TableGrid, range?: CellRange): string;
17
17
  /** A block leaf's copy: a table in the slice writes as a table in both spellings. */
18
18
  export declare function tableCopyPlugin(): Plugin;
@@ -6,7 +6,8 @@
6
6
  import { DOMSerializer } from 'prosemirror-model';
7
7
  import { Plugin } from 'prosemirror-state';
8
8
  import { decode } from './decode.js';
9
- import { tablePropsOfNode } from './islands.js';
9
+ import { HARD_BREAK } from './islands.js';
10
+ import { tableOfNode } from './table.js';
10
11
  import { blockSchema, cellSchema } from './schema.js';
11
12
  import { anchorAt, cellAt, cellContent, columnCount, headRows, rowCount, spanGrid } from './table.js';
12
13
  const whole = (props) => ({
@@ -58,7 +59,8 @@ export function tableElement(props, range = whole(props)) {
58
59
  }
59
60
  /** A cell holding a tab, a line end or a quote goes in quotes with its quotes doubled,
60
61
  * as Excel and Sheets write one. */
61
- function tsvCell(text) {
62
+ function tsvCell(cell) {
63
+ const text = cell.replaceAll(HARD_BREAK, '\n');
62
64
  return /[\t\n"]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
63
65
  }
64
66
  /** The cells of `range` as tab-separated text, a line a row. */
@@ -78,7 +80,7 @@ const base = DOMSerializer.fromSchema(blockSchema);
78
80
  const islandSerializer = new DOMSerializer({
79
81
  ...base.nodes,
80
82
  island_block: (node) => {
81
- const props = tablePropsOfNode(node);
83
+ const props = tableOfNode(node);
82
84
  const dom = DOMSerializer.renderSpec(document, blockSchema.nodes.island_block.spec.toDOM(node)).dom;
83
85
  if (props)
84
86
  dom.replaceChildren(tableElement(props));
@@ -86,7 +88,7 @@ const islandSerializer = new DOMSerializer({
86
88
  }
87
89
  }, base.marks);
88
90
  function leafText(node) {
89
- const props = node.type === blockSchema.nodes.island_block ? tablePropsOfNode(node) : undefined;
91
+ const props = node.type === blockSchema.nodes.island_block ? tableOfNode(node) : undefined;
90
92
  if (props)
91
93
  return tableText(props);
92
94
  return node.type.spec.leafText?.(node) ?? '';
@@ -6,23 +6,24 @@
6
6
  // here, so a pasted table takes the document's face.
7
7
  import { DOMParser, Fragment, Slice } from 'prosemirror-model';
8
8
  import { Plugin } from 'prosemirror-state';
9
- import { usvLength } from './decode.js';
10
9
  import { pmToContent } from './encode.js';
11
10
  import { blockSchema } from './schema.js';
12
- import { emptyCell, normalizeTable } from './table.js';
11
+ import { HARD_BREAK } from './islands.js';
12
+ import { emptyCell, islandOf, normalizeTable } from './table.js';
13
13
  const schemaRules = DOMParser.fromSchema(blockSchema).rules;
14
14
  /** What a cell's markup is read with: the schema's rules less the islands', so an island
15
15
  * element inside a cell is the text it holds. */
16
16
  const cellParser = new DOMParser(blockSchema, schemaRules.filter((rule) => !('node' in rule && rule.node?.startsWith('island_'))));
17
- /** A `<td>` or `<th>` as a cell: its blocks are lines and a `<br>` a break, each one `\n`
17
+ /** A `<td>` or `<th>` as a cell: its blocks and each `<br>` are a break, one `U+2028`
18
18
  * in the text (`cellContent`), and its marks the ones the schema's rules read. Whitespace
19
19
  * at the cell's edges is dropped, which is where a source's empty paragraph lands. */
20
20
  function cellFromDOM(el) {
21
- const { text, marks } = pmToContent(cellParser.parse(el));
22
- // Every whitespace character is in the BMP, so `lead` counts USVs as well.
21
+ const parsed = pmToContent(cellParser.parse(el));
22
+ const text = parsed.text.replaceAll('\n', HARD_BREAK);
23
+ const marks = parsed.marks ?? [];
23
24
  const lead = text.length - text.trimStart().length;
24
25
  const kept = text.trim();
25
- const end = usvLength(kept);
26
+ const end = kept.length;
26
27
  return {
27
28
  text: kept,
28
29
  marks: marks.flatMap((m) => {
@@ -77,7 +78,7 @@ function tableFromText(text) {
77
78
  QUOTED.lastIndex = BARE.lastIndex = at;
78
79
  const quoted = QUOTED.exec(body);
79
80
  const cell = quoted
80
- ? quoted[1].replace(/""/g, '"').replace(/\r\n?/g, '\n')
81
+ ? quoted[1].replace(/""/g, '"').replace(/\r\n?|\n/g, HARD_BREAK)
81
82
  : BARE.exec(body)[0];
82
83
  lines.at(-1).push(cell);
83
84
  at = quoted ? QUOTED.lastIndex : BARE.lastIndex;
@@ -104,7 +105,7 @@ const clipboardParser = new DOMParser(blockSchema, [
104
105
  node: 'island_block',
105
106
  getAttrs: (el) => {
106
107
  const props = tableFromDOM(el);
107
- return props ? { islandType: 'table', props } : false;
108
+ return props ? { islandType: 'table', ...islandOf(props) } : false;
108
109
  }
109
110
  },
110
111
  ...schemaRules
@@ -124,7 +125,10 @@ export function tablePastePlugin() {
124
125
  const props = plain ? null : tableFromText(text);
125
126
  if (!props)
126
127
  return null;
127
- const island = blockSchema.nodes.island_block.create({ islandType: 'table', props });
128
+ const island = blockSchema.nodes.island_block.create({
129
+ islandType: 'table',
130
+ ...islandOf(props)
131
+ });
128
132
  return new Slice(Fragment.from(island), 0, 0);
129
133
  })
130
134
  }
@@ -17,12 +17,12 @@ import { EditorView } from 'prosemirror-view';
17
17
  import { decode } from './decode.js';
18
18
  import { inputRulesPlugin, undoRuleKeymap } from './inputrules.js';
19
19
  import { linkPastePlugin } from './link-paste.js';
20
- import { tablePropsOfNode } from './islands.js';
20
+ import { tableOfNode } from './table.js';
21
21
  import { tableElement, tableText } from './table-copy.js';
22
22
  import { breakKeymap } from './breaks.js';
23
23
  import { cellSchema } from './schema.js';
24
24
  import { revealProps } from './reveal.js';
25
- import { ALIGNS, canMerge, cellAt, closeBlock, cellContent, cellEqual, cellFromDoc, clearCells, columnCount, deleteColumn, deleteRow, insertColumn, insertRow, mergeCells, moveColumn, moveRow, normalizeTable, rowCells, rowCount, rowEmpty, setAlign, setHead, headRows, columnShares, setWidths, shapeEqual, spanGrid, splitCell, withCell } from './table.js';
25
+ import { ALIGNS, canMerge, cellAt, closeBlock, cellContent, cellEqual, cellFromDoc, clearCells, columnCount, deleteColumn, deleteRow, insertColumn, insertRow, mergeCells, moveColumn, moveRow, normalizeTable, rowCells, rowCount, rowEmpty, setAlign, setHead, headRows, columnShares, setWidths, shapeEqual, spanGrid, splitCell, withCell, islandOf } from './table.js';
26
26
  /**
27
27
  * The package's English for the island chrome. It lives beside the surface that draws it so a
28
28
  * consumer reaching `createField` directly gets wording; the visual `strings` set extends it.
@@ -174,11 +174,16 @@ const spanCells = (a, b) => ({
174
174
  */
175
175
  const mounted = new WeakMap();
176
176
  /**
177
- * Where the caret stood as each table value was written over, keyed by that value: an undo hands
178
- * back the `props` object the edit replaced, so the seat held against it is where the edit was made
179
- * from.
177
+ * Where the caret stood as each table value was written over, keyed by that value's `slots`, which
178
+ * every write replaces: an undo hands back the object the edit replaced, so the seat held against
179
+ * it is where the edit was made from.
180
180
  */
181
181
  const departures = new WeakMap();
182
+ /** The key {@link departures} holds a node's value under. */
183
+ const valueKey = (node) => {
184
+ const slots = node.attrs.slots;
185
+ return slots ?? undefined;
186
+ };
182
187
  class TableIslandView {
183
188
  node;
184
189
  outer;
@@ -238,7 +243,7 @@ class TableIslandView {
238
243
  return false;
239
244
  const before = this.rendered;
240
245
  this.node = node;
241
- const props = tablePropsOfNode(node);
246
+ const props = tableOfNode(node);
242
247
  if (!props || !before || !shapeEqual(before, props)) {
243
248
  this.render();
244
249
  return true;
@@ -248,7 +253,8 @@ class TableIslandView {
248
253
  // re-hydrate takes fresh state. Compared against `shown`, not a doc projection: this runs
249
254
  // every keystroke and projecting costs a `mapMarks` across WASM per anchored cell.
250
255
  this.rendered = props;
251
- const departure = departures.get(props);
256
+ const key = valueKey(node);
257
+ const departure = key && departures.get(key);
252
258
  for (const mounted of this.cells) {
253
259
  const stored = cellAt(props, mounted.r, mounted.c);
254
260
  if (cellEqual(stored, mounted.shown))
@@ -1055,8 +1061,9 @@ class TableIslandView {
1055
1061
  this.cellCluster = undefined;
1056
1062
  this.rails = [];
1057
1063
  this.dom.textContent = '';
1058
- const props = tablePropsOfNode(this.node);
1059
- const departure = props && departures.get(props);
1064
+ const props = tableOfNode(this.node);
1065
+ const key = valueKey(this.node);
1066
+ const departure = props && key && departures.get(key);
1060
1067
  this.rendered = props;
1061
1068
  if (props)
1062
1069
  mounted.set(this.dom, this);
@@ -1376,7 +1383,7 @@ class TableIslandView {
1376
1383
  // ── Ops ───────────────────────────────────────────────────────────────────
1377
1384
  /** The table this view is currently showing; the zero table if the node stopped being one. */
1378
1385
  props() {
1379
- return tablePropsOfNode(this.node) ?? normalizeTable({ header: [], rows: [], aligns: [] });
1386
+ return tableOfNode(this.node) ?? normalizeTable({ header: [], rows: [], aligns: [] });
1380
1387
  }
1381
1388
  /**
1382
1389
  * Commit a new rectangle onto the node. `setNodeMarkup` is an ordinary PM transaction, so the
@@ -1390,12 +1397,12 @@ class TableIslandView {
1390
1397
  const node = this.outer.state.doc.nodeAt(pos);
1391
1398
  if (!node || node.type !== this.node.type)
1392
1399
  return;
1393
- const left = tablePropsOfNode(node);
1400
+ const left = valueKey(node);
1394
1401
  if (left && from)
1395
1402
  departures.set(left, from);
1396
1403
  this.outer.dispatch(this.outer.state.tr.setNodeMarkup(pos, undefined, {
1397
1404
  ...node.attrs,
1398
- props: normalizeTable(next)
1405
+ ...islandOf(next)
1399
1406
  }));
1400
1407
  if (focus)
1401
1408
  this.focusCell(focus.r, focus.c);
@@ -1,44 +1,80 @@
1
- import type { Content, TableCell, TableProps } from '@quillmark/wasm';
1
+ import type { Content, ContentAnchor, ContentMark, TableProps } from '@quillmark/wasm';
2
2
  import type { Node as PMNode } from 'prosemirror-model';
3
- /** One column's alignment, read off the boundary rather than restated. */
4
- export type TableAlign = TableProps['aligns'][number];
3
+ /** One column's alignment, `none` where the store keys none. */
4
+ export type TableAlign = 'none' | NonNullable<TableProps['align']>;
5
5
  /** The alignments a column can take: the four the content declares, `none` first
6
6
  * because it is what a column arrives at and what a set is cleared back to. */
7
7
  export declare const ALIGNS: readonly TableAlign[];
8
+ /** A cell's own layout, as the store keys it by slot. */
9
+ type CellAttrs = NonNullable<TableProps['cell_attrs']>[string];
10
+ /** The ids a cell arrived under. */
11
+ export interface CellIds {
12
+ row: string;
13
+ column: string;
14
+ slot: string;
15
+ block: string;
16
+ }
17
+ /** One cell of the grid: its slot's text, marks and anchors, its own layout, its ids. */
18
+ export interface GridCell extends CellAttrs {
19
+ text: string;
20
+ marks: ContentMark[];
21
+ anchors?: ContentAnchor[];
22
+ ids?: CellIds;
23
+ }
24
+ /** A table by place: row 0 the header, `aligns` and `widths` one per column. */
25
+ export interface TableGrid {
26
+ header: GridCell[];
27
+ rows: GridCell[][];
28
+ aligns: TableAlign[];
29
+ widths?: (number | null)[];
30
+ align?: TableProps['align'];
31
+ head?: number;
32
+ /** The props keys the table names none of, riding through. */
33
+ extra?: Record<string, unknown>;
34
+ }
35
+ /** The grid a table island spells, each cell its slot's content and its ids. */
36
+ export declare function gridOf(props: TableProps, slots: Record<string, Content> | null): TableGrid;
37
+ /** A node's grid, or `undefined` for any other island and for a payload of the wrong shape. */
38
+ export declare function tableOfNode(node: PMNode): TableGrid | undefined;
39
+ /** The island a grid spells: its props and slots, each rank's id the first its cells carry. */
40
+ export declare function islandOf(grid: TableGrid): {
41
+ props: TableProps;
42
+ slots: Record<string, Content>;
43
+ };
8
44
  /** The zero cell: empty text, no marks. */
9
- export declare function emptyCell(): TableCell;
45
+ export declare function emptyCell(): GridCell;
10
46
  /**
11
47
  * The row index space the chrome and the ops share: **0 is the header**, 1…n the body rows. A row
12
48
  * op works {@link allRows}, and whichever row lands at index 0 is the header afterwards. The one
13
49
  * row the model refuses is the last, there being no table under it.
14
50
  */
15
- export declare function rowCount(props: TableProps): number;
51
+ export declare function rowCount(props: TableGrid): number;
16
52
  /** The cells of row `r` in that space. */
17
- export declare function rowCells(props: TableProps, r: number): TableCell[];
53
+ export declare function rowCells(props: TableGrid, r: number): GridCell[];
18
54
  /**
19
55
  * Whether a row holds no text, telling a row on offer from one taken up (`table-view.ts` §`step`).
20
56
  * Text alone: a mark over none is invisible.
21
57
  */
22
- export declare function rowEmpty(props: TableProps, r: number): boolean;
58
+ export declare function rowEmpty(props: TableGrid, r: number): boolean;
23
59
  /** The cell at `(row, column)`, or the zero cell where the rectangle does not reach. */
24
- export declare function cellAt(props: TableProps, r: number, c: number): TableCell;
60
+ export declare function cellAt(props: TableGrid, r: number, c: number): GridCell;
25
61
  /** The table's column count: the one number `header`, every row and `aligns` share. */
26
- export declare function columnCount(props: TableProps): number;
62
+ export declare function columnCount(props: TableGrid): number;
27
63
  /**
28
64
  * The rectangularizing constructor: one column count (the widest thing present, at least one)
29
65
  * across `header`, every row, `aligns` and `widths`, padding with empty cells, `none` and auto-fit.
30
66
  * The layout keys ride through, each absent at its default as the store writes it.
31
67
  */
32
- export declare function normalizeTable(props: TableProps): TableProps;
68
+ export declare function normalizeTable(props: TableGrid): TableGrid;
33
69
  /** How many rows from the top draw as header rows, absent being one. */
34
- export declare function headRows(props: TableProps): number;
70
+ export declare function headRows(props: TableGrid): number;
35
71
  /** The columns and rows a drawn cell spans. */
36
72
  export interface Span {
37
73
  colspan: number;
38
74
  rowspan: number;
39
75
  }
40
76
  /** {@link spansOf} over a table's rows, header first. */
41
- export declare function spanGrid(props: TableProps): (Span | null)[][];
77
+ export declare function spanGrid(props: TableGrid): (Span | null)[][];
42
78
  /**
43
79
  * The drawn cell whose span covers `(r, c)`; the slot itself where nothing covers it or it lies
44
80
  * outside the grid.
@@ -49,43 +85,43 @@ export declare function anchorAt(grid: (Span | null)[][], r: number, c: number):
49
85
  span: Span;
50
86
  };
51
87
  /** A fresh table: a header plus `bodyRows` empty rows, every column unaligned. */
52
- export declare function newTable(cols?: number, bodyRows?: number): TableProps;
88
+ export declare function newTable(cols?: number, bodyRows?: number): TableGrid;
53
89
  /** `props` with the cell at `(r, c)` replaced. */
54
- export declare function withCell(props: TableProps, r: number, c: number, cell: TableCell): TableProps;
90
+ export declare function withCell(props: TableGrid, r: number, c: number, cell: GridCell): TableGrid;
55
91
  /** A new empty body row below row `r` (row 0, the header, opens the first body row). */
56
- export declare function insertRow(props: TableProps, r: number): TableProps;
92
+ export declare function insertRow(props: TableGrid, r: number): TableGrid;
57
93
  /**
58
94
  * Drop row `r`, the header included: the row left at index 0 becomes the header. A no-op at the
59
95
  * last row, which is the removal of the table and the island's to answer.
60
96
  */
61
- export declare function deleteRow(props: TableProps, r: number): TableProps;
97
+ export declare function deleteRow(props: TableGrid, r: number): TableGrid;
62
98
  /** A new empty column after column `c`. */
63
- export declare function insertColumn(props: TableProps, c: number): TableProps;
99
+ export declare function insertColumn(props: TableGrid, c: number): TableGrid;
64
100
  /** Drop column `c`; a no-op at one column (a table has at least one). */
65
- export declare function deleteColumn(props: TableProps, c: number): TableProps;
101
+ export declare function deleteColumn(props: TableGrid, c: number): TableGrid;
66
102
  /**
67
103
  * Row `r` moved by `by` places, clamped: a drag past the rectangle is a no-op, not an error. The
68
104
  * header travels like any other row; being the header is holding index 0.
69
105
  */
70
- export declare function moveRow(props: TableProps, r: number, by: number): TableProps;
106
+ export declare function moveRow(props: TableGrid, r: number, by: number): TableGrid;
71
107
  /**
72
108
  * Column `c` moved by `by` places, clamped. `aligns` and `widths` travel with the column, being its
73
109
  * properties.
74
110
  */
75
- export declare function moveColumn(props: TableProps, c: number, by: number): TableProps;
111
+ export declare function moveColumn(props: TableGrid, c: number, by: number): TableGrid;
76
112
  /**
77
113
  * Every cell in the inclusive rectangle emptied, alignment kept (a cell its own, a column its
78
114
  * alignment and width): a delete over a block covering no whole rank. A rectangle spanning one axis
79
115
  * deletes ranks and one spanning both is the table, so what reaches here is a proper sub-rectangle.
80
116
  */
81
- export declare function clearCells(props: TableProps, r0: number, c0: number, r1: number, c1: number): TableProps;
117
+ export declare function clearCells(props: TableGrid, r0: number, c0: number, r1: number, c1: number): TableGrid;
82
118
  /**
83
119
  * Set column `c`'s alignment and clear its cells' own `align`, which would outrank it
84
120
  * (`table-view.ts`).
85
121
  */
86
- export declare function setAlign(props: TableProps, c: number, align: TableAlign): TableProps;
122
+ export declare function setAlign(props: TableGrid, c: number, align: TableAlign): TableGrid;
87
123
  /** Draw the top `head` rows as header rows (`table-view.ts`). */
88
- export declare function setHead(props: TableProps, head: number): TableProps;
124
+ export declare function setHead(props: TableGrid, head: number): TableGrid;
89
125
  /** An inclusive block of cells, in the row space {@link rowCount} names. */
90
126
  export interface CellBlock {
91
127
  r0: number;
@@ -94,52 +130,50 @@ export interface CellBlock {
94
130
  c1: number;
95
131
  }
96
132
  /** `block` grown until every drawn cell it touches lies wholly inside it. */
97
- export declare function closeBlock(props: TableProps, block: CellBlock): CellBlock;
133
+ export declare function closeBlock(props: TableGrid, block: CellBlock): CellBlock;
98
134
  /**
99
135
  * Whether `block` can be one cell: more than one drawn cell, inside the header rows or the body.
100
136
  */
101
- export declare function canMerge(props: TableProps, block: CellBlock): boolean;
137
+ export declare function canMerge(props: TableGrid, block: CellBlock): boolean;
102
138
  /**
103
139
  * The block's cells as one, at its top-left: the text of each drawn cell holding any, in reading
104
140
  * order, a line apiece, every other slot an empty one the span covers, alignment kept. The top-left
105
141
  * cell's alignment is the merged cell's. A block {@link canMerge} refuses comes back as it was.
106
142
  */
107
- export declare function mergeCells(props: TableProps, block: CellBlock): TableProps;
143
+ export declare function mergeCells(props: TableGrid, block: CellBlock): TableGrid;
108
144
  /**
109
145
  * The merged cell covering `(r, c)` back to the cells under it: its text stays top-left, the rest
110
146
  * are the empty cells it covered.
111
147
  */
112
- export declare function splitCell(props: TableProps, r: number, c: number): TableProps;
148
+ export declare function splitCell(props: TableGrid, r: number, c: number): TableGrid;
113
149
  /**
114
150
  * Set or clear the column weights (`table-view.ts`); `undefined` returns every column to auto-fit.
115
151
  */
116
- export declare function setWidths(props: TableProps, widths: (number | null)[] | undefined): TableProps;
152
+ export declare function setWidths(props: TableGrid, widths: (number | null)[] | undefined): TableGrid;
117
153
  /**
118
154
  * Each column's share of the table's width, summing to 1, or `undefined` for a table that auto-fits
119
155
  * throughout. An auto-fit column beside weighted ones takes the mean weight, since the editor's
120
156
  * fixed-layout grid cannot size it to content as the page does.
121
157
  */
122
- export declare function columnShares(props: TableProps): number[] | undefined;
123
- /**
124
- * A cell as a one-paragraph `Content` for `decode` under `cellSchema`: each `\n` opens a
125
- * `continues` line, the hard break it decodes to. The cell's marks are that content's marks.
126
- */
127
- export declare function cellContent(cell: TableCell): Content;
158
+ export declare function columnShares(props: TableGrid): number[] | undefined;
159
+ /** A cell as its slot: one paragraph, for `decode` under `cellSchema`. */
160
+ export declare function cellContent(cell: GridCell): Content;
128
161
  /**
129
- * The cell a nested PM doc projects, carrying `prior`'s identity anchors through.
162
+ * The cell a nested PM doc projects, carrying `prior`'s layout, ids and anchors through.
130
163
  *
131
- * Anchors inside a cell are preserved verbatim, never minted: they are not in the field plugin's
132
- * coordinate space (its position map holds one `atom` run for the whole table), so the popover
133
- * withholds its `anchor` button in a cell. Preserving still means rebasing: `mapMarks` carries each
134
- * held anchor through the cell's delta by the store's rule, and a mark the splice deleted through
135
- * lands where the splice left it.
164
+ * Anchors inside a cell are preserved, never minted: they are not in the field plugin's coordinate
165
+ * space (its position map holds one `atom` run for the whole table), so the popover withholds its
166
+ * `anchor` button in a cell. Preserving still means rebasing: each held anchor maps through the
167
+ * edit by the store's rule, a range's start after it and its end before, a point before, and a
168
+ * range the edit closes is dropped.
136
169
  */
137
- export declare function cellFromDoc(doc: PMNode, prior: TableCell): TableCell;
170
+ export declare function cellFromDoc(doc: PMNode, prior: GridCell): GridCell;
138
171
  /**
139
172
  * Whether two cells are the same value, telling an own edit from an external one (an undo, a
140
173
  * re-hydrate) without a flag. Marks compare structurally, as `reconcile.ts` states.
141
174
  */
142
- export declare function cellEqual(a: TableCell, b: TableCell): boolean;
175
+ export declare function cellEqual(a: GridCell, b: GridCell): boolean;
143
176
  /** Whether two tables have the same rectangle, alignment, header and widths: the
144
177
  * change that forces a rebuild rather than a per-cell reseed. */
145
- export declare function shapeEqual(a: TableProps, b: TableProps): boolean;
178
+ export declare function shapeEqual(a: TableGrid, b: TableGrid): boolean;
179
+ export {};