@quillmark/svelte 0.27.0 → 0.28.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 (95) hide show
  1. package/NOTICE +4 -4
  2. package/README.md +26 -8
  3. package/THEMING.md +10 -8
  4. package/dist/core/address.d.ts +35 -64
  5. package/dist/core/address.js +35 -55
  6. package/dist/core/bloom.d.ts +4 -10
  7. package/dist/core/bloom.js +14 -27
  8. package/dist/core/codec/blocks.d.ts +41 -43
  9. package/dist/core/codec/blocks.js +97 -130
  10. package/dist/core/codec/code.d.ts +7 -10
  11. package/dist/core/codec/code.js +37 -46
  12. package/dist/core/codec/decode.d.ts +19 -23
  13. package/dist/core/codec/decode.js +76 -111
  14. package/dist/core/codec/encode.d.ts +11 -15
  15. package/dist/core/codec/encode.js +60 -67
  16. package/dist/core/codec/field.d.ts +62 -95
  17. package/dist/core/codec/field.js +107 -179
  18. package/dist/core/codec/islands.d.ts +33 -41
  19. package/dist/core/codec/islands.js +76 -86
  20. package/dist/core/codec/lists.d.ts +17 -26
  21. package/dist/core/codec/lists.js +117 -157
  22. package/dist/core/codec/marks.d.ts +4 -3
  23. package/dist/core/codec/marks.js +8 -3
  24. package/dist/core/codec/prose.css +84 -46
  25. package/dist/core/codec/schema.d.ts +18 -23
  26. package/dist/core/codec/schema.js +84 -76
  27. package/dist/core/codec/slash.d.ts +42 -48
  28. package/dist/core/codec/slash.js +0 -0
  29. package/dist/core/codec/table-copy.d.ts +4 -3
  30. package/dist/core/codec/table-copy.js +25 -7
  31. package/dist/core/codec/table-view.d.ts +12 -12
  32. package/dist/core/codec/table-view.js +460 -383
  33. package/dist/core/codec/table.d.ts +94 -61
  34. package/dist/core/codec/table.js +331 -83
  35. package/dist/core/codec/tasks.d.ts +6 -0
  36. package/dist/core/codec/tasks.js +30 -3
  37. package/dist/core/errors.d.ts +15 -30
  38. package/dist/core/errors.js +2 -6
  39. package/dist/core/index.js +7 -12
  40. package/dist/core/lifecycle.d.ts +7 -16
  41. package/dist/core/lifecycle.js +10 -21
  42. package/dist/core/rebind.svelte.d.ts +10 -20
  43. package/dist/core/rebind.svelte.js +15 -27
  44. package/dist/core/rungs.d.ts +14 -11
  45. package/dist/core/rungs.js +17 -19
  46. package/dist/core/teardown.d.ts +4 -6
  47. package/dist/core/teardown.js +7 -10
  48. package/dist/core/theme.css +74 -54
  49. package/dist/index.js +3 -8
  50. package/dist/preset/app.css +3 -1
  51. package/dist/preset/index.css +6 -8
  52. package/dist/preset/recipes.css +12 -15
  53. package/dist/preset/scale.css +18 -17
  54. package/dist/preset/shell.css +10 -0
  55. package/dist/preview/bridge.d.ts +18 -22
  56. package/dist/preview/bridge.js +29 -58
  57. package/dist/preview/controller.d.ts +21 -29
  58. package/dist/preview/controller.js +14 -39
  59. package/dist/preview/geometry.d.ts +13 -34
  60. package/dist/preview/geometry.js +13 -34
  61. package/dist/preview/index.js +4 -16
  62. package/dist/preview/paint.d.ts +3 -3
  63. package/dist/preview/paint.js +28 -68
  64. package/dist/preview/strings.d.ts +1 -1
  65. package/dist/preview/strings.js +2 -14
  66. package/dist/preview/zoom.d.ts +18 -23
  67. package/dist/preview/zoom.js +28 -27
  68. package/dist/visual/ArrayField.svelte +77 -16
  69. package/dist/visual/BooleanField.svelte +27 -14
  70. package/dist/visual/Card.svelte +61 -48
  71. package/dist/visual/CardControls.svelte +5 -11
  72. package/dist/visual/DateField.svelte +20 -4
  73. package/dist/visual/EnumField.svelte +3 -0
  74. package/dist/visual/FieldHint.svelte +2 -1
  75. package/dist/visual/FormatPopover.svelte +82 -15
  76. package/dist/visual/FormatPopover.svelte.d.ts +4 -0
  77. package/dist/visual/MatrixAdd.svelte +30 -12
  78. package/dist/visual/MatrixField.svelte +24 -16
  79. package/dist/visual/NumberField.svelte +7 -0
  80. package/dist/visual/ObjectField.svelte +4 -4
  81. package/dist/visual/ProseField.svelte +0 -5
  82. package/dist/visual/TipsCard.svelte +11 -10
  83. package/dist/visual/VariantField.svelte +3 -1
  84. package/dist/visual/VisualEditorInner.svelte +19 -3
  85. package/dist/visual/controls.css +7 -2
  86. package/dist/visual/fonts.d.ts +18 -0
  87. package/dist/visual/fonts.js +59 -0
  88. package/dist/visual/icons/nodes.d.ts +0 -5
  89. package/dist/visual/icons/nodes.js +0 -4
  90. package/dist/visual/props.d.ts +14 -1
  91. package/dist/visual/strings.d.ts +7 -0
  92. package/dist/visual/strings.js +5 -2
  93. package/dist/visual/structure.d.ts +43 -87
  94. package/dist/visual/structure.js +42 -83
  95. package/package.json +2 -2
@@ -8,110 +8,143 @@ export declare const ALIGNS: readonly TableAlign[];
8
8
  /** The zero cell: empty text, no marks. */
9
9
  export declare function emptyCell(): TableCell;
10
10
  /**
11
- * The row index space the chrome and the ops share: **0 is the header**, 1…n the body
12
- * rows. The split is how a table is stored, not a rank the ops answer to: a row op
13
- * works {@link allRows} and whichever row lands at index 0 is the header afterwards,
14
- * so index 0 moves and deletes like any other. The one row the model refuses is the
15
- * last, there being no table under it.
11
+ * The row index space the chrome and the ops share: **0 is the header**, 1…n the body rows. A row
12
+ * op works {@link allRows}, and whichever row lands at index 0 is the header afterwards. The one
13
+ * row the model refuses is the last, there being no table under it.
16
14
  */
17
15
  export declare function rowCount(props: TableProps): number;
18
16
  /** The cells of row `r` in that space. */
19
17
  export declare function rowCells(props: TableProps, r: number): TableCell[];
20
- /** Whether a row holds no text, which is what tells a row on offer from one taken up
21
- * (`table-view.ts` §`step`). Text alone: a mark over none is nothing a writer can see. */
18
+ /**
19
+ * Whether a row holds no text, telling a row on offer from one taken up (`table-view.ts` §`step`).
20
+ * Text alone: a mark over none is invisible.
21
+ */
22
22
  export declare function rowEmpty(props: TableProps, r: number): boolean;
23
23
  /** The cell at `(row, column)`, or the zero cell where the rectangle does not reach. */
24
24
  export declare function cellAt(props: TableProps, r: number, c: number): TableCell;
25
25
  /** The table's column count: the one number `header`, every row and `aligns` share. */
26
26
  export declare function columnCount(props: TableProps): number;
27
27
  /**
28
- * The rectangularizing constructor: one column count across `header`, every row,
29
- * `aligns` and `widths`, padding with empty cells, `none` and auto-fit. The column
30
- * count is the widest thing present, so a caller that appended to one axis alone still
31
- * gets a rectangle back, and a table is never narrower than one column. The layout
32
- * keys ride through, each absent at its default as the store writes it.
28
+ * The rectangularizing constructor: one column count (the widest thing present, at least one)
29
+ * across `header`, every row, `aligns` and `widths`, padding with empty cells, `none` and auto-fit.
30
+ * The layout keys ride through, each absent at its default as the store writes it.
33
31
  */
34
32
  export declare function normalizeTable(props: TableProps): TableProps;
33
+ /** How many rows from the top draw as header rows, absent being one. */
34
+ export declare function headRows(props: TableProps): number;
35
+ /** The columns and rows a drawn cell spans. */
36
+ export interface Span {
37
+ colspan: number;
38
+ rowspan: number;
39
+ }
40
+ /** {@link spansOf} over a table's rows, header first. */
41
+ export declare function spanGrid(props: TableProps): (Span | null)[][];
42
+ /**
43
+ * The drawn cell whose span covers `(r, c)`; the slot itself where nothing covers it or it lies
44
+ * outside the grid.
45
+ */
46
+ export declare function anchorAt(grid: (Span | null)[][], r: number, c: number): {
47
+ r: number;
48
+ c: number;
49
+ span: Span;
50
+ };
35
51
  /**
36
- * The rows as one list, header first: the space a row op works in. `header` is a
37
- * separate field because a table always has one and `header: []` is not a table — a
38
- * storage shape, not a rank a row op has to know about. Reading it as one list is what
39
- * lets move and delete treat every row alike, and {@link fromRows} splits it back.
52
+ * The rows as one list, header first: the space a row op works in, so move and delete treat every
53
+ * row alike. `header` is a separate field because a table always has one; {@link fromRows} splits
54
+ * it back.
40
55
  */
41
56
  export declare function allRows(props: TableProps): TableCell[][];
42
- /** A fresh table: a header plus `bodyRows` empty rows, every column unaligned.
43
- * Growth is cheap (Tab at the last cell appends a row), so the default is small. */
57
+ /** A fresh table: a header plus `bodyRows` empty rows, every column unaligned. */
44
58
  export declare function newTable(cols?: number, bodyRows?: number): TableProps;
45
59
  /** `props` with the cell at `(r, c)` replaced. */
46
60
  export declare function withCell(props: TableProps, r: number, c: number, cell: TableCell): TableProps;
47
61
  /** A new empty body row below row `r` (row 0, the header, opens the first body row). */
48
62
  export declare function insertRow(props: TableProps, r: number): TableProps;
49
- /** Drop row `r`, the header included: the row left at index 0 is the header, which is
50
- * how a table whose first row went still has one. A no-op at the last row, that being
51
- * the removal of the table rather than of a row, and the island's own to answer. */
63
+ /**
64
+ * Drop row `r`, the header included: the row left at index 0 becomes the header. A no-op at the
65
+ * last row, which is the removal of the table and the island's to answer.
66
+ */
52
67
  export declare function deleteRow(props: TableProps, r: number): TableProps;
53
68
  /** A new empty column after column `c`. */
54
69
  export declare function insertColumn(props: TableProps, c: number): TableProps;
55
70
  /** Drop column `c`; a no-op at one column (a table has at least one). */
56
71
  export declare function deleteColumn(props: TableProps, c: number): TableProps;
57
- /** Row `r` moved by `by` places, clamped: a drag that leaves the rectangle is a no-op
58
- * rather than an error, since the drop target is geometry and geometry runs past the
59
- * last row. The header travels like any other row, and so does the row that displaces
60
- * it: being the header is holding index 0, which a move is free to hand over. */
72
+ /**
73
+ * Row `r` moved by `by` places, clamped: a drag past the rectangle is a no-op, not an error. The
74
+ * header travels like any other row; being the header is holding index 0.
75
+ */
61
76
  export declare function moveRow(props: TableProps, r: number, by: number): TableProps;
62
- /** Column `c` moved by `by` places, clamped. `aligns` and `widths` travel with the
63
- * column: each is the column's property, so a move that left it behind would retint
64
- * or resize the column that took the index. */
77
+ /**
78
+ * Column `c` moved by `by` places, clamped. `aligns` and `widths` travel with the column, being its
79
+ * properties.
80
+ */
65
81
  export declare function moveColumn(props: TableProps, c: number, by: number): TableProps;
66
82
  /**
67
- * Every cell in the inclusive rectangle emptied, alignment kept: what a delete gesture
68
- * means over a block of cells that covers no whole rank. A rectangle spanning one axis
69
- * covers ranks and deletes them, and one spanning both is the table itself, so what
70
- * reaches here is a proper sub-rectangle and the shape it leaves is the shape it found.
71
- *
72
- * A cell keeps its own alignment, and a column its alignment and width: what a clear
73
- * empties is text.
83
+ * Every cell in the inclusive rectangle emptied, alignment kept (a cell its own, a column its
84
+ * alignment and width): a delete over a block covering no whole rank. A rectangle spanning one axis
85
+ * deletes ranks and one spanning both is the table, so what reaches here is a proper sub-rectangle.
74
86
  */
75
87
  export declare function clearCells(props: TableProps, r0: number, c0: number, r1: number, c1: number): TableProps;
76
- /** Set column `c`'s alignment and clear its cells' own `align`, which would outrank it:
77
- * what the held column's cluster and Shift+arrow write (`table-view.ts`). */
88
+ /**
89
+ * Set column `c`'s alignment and clear its cells' own `align`, which would outrank it
90
+ * (`table-view.ts`).
91
+ */
78
92
  export declare function setAlign(props: TableProps, c: number, align: TableAlign): TableProps;
79
- /** Draw the first row as a header or as a body row: what the header toggle writes
80
- * (`table-view.ts`). */
81
- export declare function setHeadless(props: TableProps, headless: boolean): TableProps;
82
- /** Set or clear the column weights: what a border drag and its double-click write
83
- * (`table-view.ts`). `undefined` returns every column to auto-fit. */
93
+ /** Draw the top `head` rows as header rows (`table-view.ts`). */
94
+ export declare function setHead(props: TableProps, head: number): TableProps;
95
+ /** An inclusive block of cells, in the row space {@link rowCount} names. */
96
+ export interface CellBlock {
97
+ r0: number;
98
+ c0: number;
99
+ r1: number;
100
+ c1: number;
101
+ }
102
+ /** `block` grown until every drawn cell it touches lies wholly inside it. */
103
+ export declare function closeBlock(props: TableProps, block: CellBlock): CellBlock;
104
+ /**
105
+ * Whether `block` can be one cell: more than one drawn cell, inside the header rows or the body.
106
+ */
107
+ export declare function canMerge(props: TableProps, block: CellBlock): boolean;
108
+ /**
109
+ * The block's cells as one, at its top-left: the text of each drawn cell holding any, in reading
110
+ * order, a line apiece, every other slot an empty one the span covers, alignment kept. The top-left
111
+ * cell's alignment is the merged cell's. A block {@link canMerge} refuses comes back as it was.
112
+ */
113
+ export declare function mergeCells(props: TableProps, block: CellBlock): TableProps;
114
+ /**
115
+ * The merged cell covering `(r, c)` back to the cells under it: its text stays top-left, the rest
116
+ * are the empty cells it covered.
117
+ */
118
+ export declare function splitCell(props: TableProps, r: number, c: number): TableProps;
119
+ /**
120
+ * Set or clear the column weights (`table-view.ts`); `undefined` returns every column to auto-fit.
121
+ */
84
122
  export declare function setWidths(props: TableProps, widths: (number | null)[] | undefined): TableProps;
85
123
  /**
86
- * Each column's share of the table's width, summing to 1, or `undefined` for a table
87
- * that auto-fits throughout. An auto-fit column beside weighted ones takes the mean
88
- * weight: the page sizes it to its content, which the editor's grid, laid out fixed so
89
- * the weights hold, cannot ask.
124
+ * Each column's share of the table's width, summing to 1, or `undefined` for a table that auto-fits
125
+ * throughout. An auto-fit column beside weighted ones takes the mean weight, since the editor's
126
+ * fixed-layout grid cannot size it to content as the page does.
90
127
  */
91
128
  export declare function columnShares(props: TableProps): number[] | undefined;
92
129
  /**
93
- * A cell as a one-paragraph `Content`: what `decode` takes under `cellSchema`. Each
94
- * `\n` in the text opens a `continues` line, which is the hard break it decodes to and
95
- * the one USV `pmToContent` projects a break back to. The cell's marks are that
96
- * content's marks, both being offsets into the same text.
130
+ * A cell as a one-paragraph `Content` for `decode` under `cellSchema`: each `\n` opens a
131
+ * `continues` line, the hard break it decodes to. The cell's marks are that content's marks.
97
132
  */
98
133
  export declare function cellContent(cell: TableCell): Content;
99
134
  /**
100
135
  * The cell a nested PM doc projects, carrying `prior`'s identity anchors through.
101
136
  *
102
- * Anchors inside a cell are **preserved verbatim, never minted**: they are not in
103
- * the field plugin's coordinate space (the field's position map holds one `atom`
104
- * run for the whole table), so nothing here can mint one and the popover withholds
105
- * its `anchor` button while the caret is in a cell. Preserving them still means
106
- * rebasing: a cell edit is a splice like any other, so `mapMarks` carries each held
107
- * anchor through the cell's own delta by the rule the store applies to a field's,
108
- * and a mark the splice deleted through lands where the splice left it rather than
109
- * pointing past the text.
137
+ * Anchors inside a cell are preserved verbatim, never minted: they are not in the field plugin's
138
+ * coordinate space (its position map holds one `atom` run for the whole table), so the popover
139
+ * withholds its `anchor` button in a cell. Preserving still means rebasing: `mapMarks` carries each
140
+ * held anchor through the cell's delta by the store's rule, and a mark the splice deleted through
141
+ * lands where the splice left it.
110
142
  */
111
143
  export declare function cellFromDoc(doc: PMNode, prior: TableCell): TableCell;
112
- /** Whether two cells are the same value: what tells an own edit (the projection the
113
- * view just produced) from an external one (an undo, a re-hydrate) without a flag.
114
- * The marks structurally, for the reason `reconcile.ts` states. */
144
+ /**
145
+ * Whether two cells are the same value, telling an own edit from an external one (an undo, a
146
+ * re-hydrate) without a flag. Marks compare structurally, as `reconcile.ts` states.
147
+ */
115
148
  export declare function cellEqual(a: TableCell, b: TableCell): boolean;
116
149
  /** Whether two tables have the same rectangle, alignment, header and widths: the
117
150
  * change that forces a rebuild rather than a per-cell reseed. */