@estiva-app/ui 0.78.0 → 0.80.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.
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/EditorTableControls.d.ts +9 -1
- package/dist/EditorTableControls.d.ts.map +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +21 -2
- package/dist/editor.js.map +3 -3
- package/dist/index.js.map +1 -1
- package/dist/linked.d.ts +1 -1
- package/package.json +1 -1
- package/registry.json +21 -2
- package/src/CardUnder.tsx +1 -1
- package/src/CommentBox.mdx +2 -2
- package/src/CommentBox.stories.tsx +1 -1
- package/src/CommentBox.test.tsx +16 -2
- package/src/CommentBox.tsx +7 -3
- package/src/EditorTableControls.mdx +7 -2
- package/src/EditorTableControls.stories.tsx +16 -3
- package/src/EditorTableControls.test.tsx +40 -2
- package/src/EditorTableControls.tsx +25 -2
- package/src/editor.ts +1 -1
- package/src/linked.ts +1 -1
- package/src/registry/registry.test.ts +3 -3
package/dist/linked.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* widgets look nothing up, and keep nothing but what a reader does to them.
|
|
7
7
|
*
|
|
8
8
|
* The shape follows the prototype Miky approved (Widgets 2, 15 Oct; why:
|
|
9
|
-
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/
|
|
9
|
+
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md).
|
|
10
10
|
*/
|
|
11
11
|
import type { ThingKind } from './KindIcon';
|
|
12
12
|
/** What a link stands for, by its icon. `page` draws a page of text. */
|
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"kind": "package",
|
|
5
5
|
"repo": "estiva-ui",
|
|
6
6
|
"package": "@estiva-app/ui",
|
|
7
|
-
"packageVersion": "0.
|
|
8
|
-
"exports":
|
|
7
|
+
"packageVersion": "0.80.0",
|
|
8
|
+
"exports": 204,
|
|
9
9
|
"typeExports": 197,
|
|
10
10
|
"files": null
|
|
11
11
|
},
|
|
@@ -8702,6 +8702,25 @@
|
|
|
8702
8702
|
"bg-error-muted signal:bg-bg-inset signal:border signal:border-border-default signal:shadow-md leaf:bg-bg-inset leaf:border leaf:border-border-default leaf:shadow-md"
|
|
8703
8703
|
]
|
|
8704
8704
|
},
|
|
8705
|
+
{
|
|
8706
|
+
"name": "toggleTableHeaderRow",
|
|
8707
|
+
"repo": "estiva-ui",
|
|
8708
|
+
"kind": "helper",
|
|
8709
|
+
"importPath": "@estiva-app/ui/editor",
|
|
8710
|
+
"sourceFile": "src/EditorTableControls.tsx",
|
|
8711
|
+
"purpose": "The table's first row becomes its header row, or an ordinary row again: whichever cell of the table `cell` is.",
|
|
8712
|
+
"purposeFrom": "comment",
|
|
8713
|
+
"props": [],
|
|
8714
|
+
"variants": [],
|
|
8715
|
+
"ownsBehaviours": [],
|
|
8716
|
+
"status": "stable",
|
|
8717
|
+
"migrationStage": null,
|
|
8718
|
+
"docsId": "primitives-editortablecontrols--docs",
|
|
8719
|
+
"storyId": "primitives-editortablecontrols--default",
|
|
8720
|
+
"docPage": null,
|
|
8721
|
+
"app": null,
|
|
8722
|
+
"looks": []
|
|
8723
|
+
},
|
|
8705
8724
|
{
|
|
8706
8725
|
"name": "Toolbar",
|
|
8707
8726
|
"repo": "estiva-ui",
|
package/src/CardUnder.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The one card added under a piece of text, and the ✕ that removes it (why:
|
|
3
|
-
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/
|
|
3
|
+
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md).
|
|
4
4
|
*
|
|
5
5
|
* Under a box being written in, the ✕ always shows. Under text already sent
|
|
6
6
|
* (`revealOnHover`) it shows when the pointer is over the card or the ✕ has
|
package/src/CommentBox.mdx
CHANGED
|
@@ -68,14 +68,14 @@ It does these by itself. Write none of them around it.
|
|
|
68
68
|
| Holding the words until the answer, or showing the send at once | a sending state |
|
|
69
69
|
| A refusal: the words back, and a line under the box | a toast, or putting text back |
|
|
70
70
|
| The draft, written as you type and forgotten once sent | an update listener |
|
|
71
|
-
| Files: picking, pasting, dropping, uploading, failing; Send waits | a file list |
|
|
71
|
+
| Files: picking, pasting, dropping, uploading, failing; Send waits for an upload and holds on a failed file until its ✕ removes it | a file list |
|
|
72
72
|
| The read-only line | a disabled box |
|
|
73
73
|
|
|
74
74
|
## Keys
|
|
75
75
|
|
|
76
76
|
| Key | What it does |
|
|
77
77
|
|---|---|
|
|
78
|
-
| Enter | Sends; saves an edit. With a list open, picks the row. |
|
|
78
|
+
| Enter | Sends; saves an edit. With a list open, picks the row. Holds while a file is uploading or did not upload. |
|
|
79
79
|
| Ctrl/Cmd+Enter | Sends, as Enter does. |
|
|
80
80
|
| Shift+Enter | A new line; in a list, a new item. |
|
|
81
81
|
| Escape | Cancels an edit. With a list open, closes the list first. |
|
|
@@ -195,7 +195,7 @@ export const EditingRefused: Story = {
|
|
|
195
195
|
/** A file uploading: Send waits for it. */
|
|
196
196
|
export const FileUploading: Story = { render: () => <Live upload={uploads('never')} />, play: pickAFile }
|
|
197
197
|
|
|
198
|
-
/** A file that failed: it says why and
|
|
198
|
+
/** A file that failed: it says why, Send holds, and its ✕ removes it. */
|
|
199
199
|
export const FileFailed: Story = { render: () => <Live upload={uploads('failed')} />, play: pickAFile }
|
|
200
200
|
|
|
201
201
|
/** Read-only, archived: a line in the box's place. */
|
package/src/CommentBox.test.tsx
CHANGED
|
@@ -225,8 +225,9 @@ describe('files', () => {
|
|
|
225
225
|
expect(send.mock.calls[0][1]).toMatchObject([{ name: 'plan.pdf', state: 'ready', value: 'the-record' }])
|
|
226
226
|
})
|
|
227
227
|
|
|
228
|
-
it('a failed upload says why
|
|
229
|
-
|
|
228
|
+
it('a failed upload says why and holds Send and Enter until its ✕ takes it off', async () => {
|
|
229
|
+
const send = vi.fn<CommentBoxProps['send']>(async () => ({ accepted: true }))
|
|
230
|
+
render(<Box send={send} upload={async () => ({ accepted: false, reason: 'too large' })} />)
|
|
230
231
|
const input = document.querySelector('input[type=file]') as HTMLInputElement
|
|
231
232
|
await act(async () => {
|
|
232
233
|
fireEvent.change(input, { target: { files: [new File(['x'], 'big.mov', { type: 'video/quicktime' })] } })
|
|
@@ -234,6 +235,19 @@ describe('files', () => {
|
|
|
234
235
|
await settle()
|
|
235
236
|
expect(screen.getByText('too large')).toBeTruthy()
|
|
236
237
|
expect(screen.queryByText('Uploading… Send waits for the file.')).toBeNull()
|
|
238
|
+
await type('See this')
|
|
239
|
+
expect(screen.getByText('Remove the file that did not upload to send.')).toBeTruthy()
|
|
240
|
+
expect((screen.getByRole('button', { name: 'Send' }) as HTMLButtonElement).disabled).toBe(true)
|
|
241
|
+
await press('Enter')
|
|
242
|
+
expect(send).not.toHaveBeenCalled()
|
|
243
|
+
await act(async () => {
|
|
244
|
+
fireEvent.click(screen.getByRole('button', { name: 'Remove big.mov' }))
|
|
245
|
+
})
|
|
246
|
+
expect(screen.queryByText('Remove the file that did not upload to send.')).toBeNull()
|
|
247
|
+
await press('Enter')
|
|
248
|
+
expect(send).toHaveBeenCalledTimes(1)
|
|
249
|
+
expect(textOf(send.mock.calls[0][0])).toBe('See this')
|
|
250
|
+
expect(send.mock.calls[0][1]).toEqual([])
|
|
237
251
|
})
|
|
238
252
|
|
|
239
253
|
it('an upload that arrives after the box opened offers File in /', async () => {
|
package/src/CommentBox.tsx
CHANGED
|
@@ -306,6 +306,8 @@ export function CommentBox({
|
|
|
306
306
|
}, [upload, edit])
|
|
307
307
|
|
|
308
308
|
const uploading = files.some((f) => f.state === 'uploading')
|
|
309
|
+
// A file that did not upload holds Send until its ✕ takes it off, so it is never sent without it unnoticed.
|
|
310
|
+
const failed = files.filter((f) => f.state === 'failed').length
|
|
309
311
|
const ready = files.some((f) => f.state === 'ready')
|
|
310
312
|
|
|
311
313
|
const go = useCallback(
|
|
@@ -431,8 +433,7 @@ export function CommentBox({
|
|
|
431
433
|
</div>
|
|
432
434
|
</div>
|
|
433
435
|
</div>
|
|
434
|
-
{sending && <FieldLine>Saving…</FieldLine>}
|
|
435
|
-
{refusedLine}
|
|
436
|
+
{sending && <FieldLine>Saving…</FieldLine>} {refusedLine}
|
|
436
437
|
</div>
|
|
437
438
|
)
|
|
438
439
|
}
|
|
@@ -459,13 +460,16 @@ export function CommentBox({
|
|
|
459
460
|
}
|
|
460
461
|
attachments={fileCards}
|
|
461
462
|
ready={ready}
|
|
462
|
-
holding={uploading || sending}
|
|
463
|
+
holding={uploading || failed > 0 || sending}
|
|
463
464
|
selection={{ link: true }}
|
|
464
465
|
className={cn(sending && '[&_[data-composer-editor]]:text-text-muted')}
|
|
465
466
|
/>
|
|
466
467
|
{upload && <FilePicker ref={picker} multiple accept={accept} onPick={attachFiles} />}
|
|
467
468
|
{sending && <FieldLine>Sending…</FieldLine>}
|
|
468
469
|
{uploading && !sending && <FieldLine>Uploading… Send waits for the file.</FieldLine>}
|
|
470
|
+
{failed > 0 && !uploading && !sending && (
|
|
471
|
+
<FieldLine>{failed === 1 ? 'Remove the file that did not upload to send.' : 'Remove the files that did not upload to send.'}</FieldLine>
|
|
472
|
+
)}
|
|
469
473
|
{refusedLine}
|
|
470
474
|
</div>
|
|
471
475
|
)
|
|
@@ -10,14 +10,19 @@ row and on its column, and a ➕ bar under the table and right of it.
|
|
|
10
10
|
|
|
11
11
|
<Canvas of={EditorTableControlsStories.Default} />
|
|
12
12
|
|
|
13
|
+
<Canvas of={EditorTableControlsStories.NoHeaderRow} />
|
|
14
|
+
|
|
13
15
|
## When
|
|
14
16
|
|
|
15
17
|
- **An editor whose documents hold tables** — with TableKit
|
|
16
18
|
(`@tiptap/extension-table`) in its extensions. Point at a cell: the row's
|
|
17
19
|
handle sits on the table's left edge, the column's on its top edge; each
|
|
18
20
|
opens Insert (above and below, or left and right), Delete, and Delete
|
|
19
|
-
table.
|
|
20
|
-
row the
|
|
21
|
+
table. The first row's menu opens with Header row, ticked while the first
|
|
22
|
+
row is the table's header; choosing it turns the header row off (the first
|
|
23
|
+
row becomes an ordinary row) or on again. A header row offers nothing above
|
|
24
|
+
it, and deleting it makes the next row the header. With the header off, the
|
|
25
|
+
first row takes Insert above and deleting it promotes nothing. From the last row, a ➕ under the table adds a row after it; from the
|
|
21
26
|
last column, a ➕ right of the table adds a column after it.
|
|
22
27
|
- **Not editable**: nothing is drawn.
|
|
23
28
|
|
|
@@ -36,10 +36,18 @@ const DOCUMENT = {
|
|
|
36
36
|
],
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
const NO_HEADER = {
|
|
40
|
+
type: 'doc',
|
|
41
|
+
content: [
|
|
42
|
+
{ type: 'paragraph', content: [{ type: 'text', text: 'The first row’s handle turns the header row back on.' }] },
|
|
43
|
+
{ type: 'table', content: [row('tableCell', 'Item one', 'Value', 'Value'), row('tableCell', 'Item two', 'Value', 'Value')] },
|
|
44
|
+
],
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function Editing({ editable, content = DOCUMENT }: { editable: boolean; content?: object }) {
|
|
40
48
|
const editor = useEditor({
|
|
41
49
|
extensions: [StarterKit.configure({ dropcursor: blockDropCursor }), TableKit.configure({ table: { resizable: false } }), BlockId],
|
|
42
|
-
content
|
|
50
|
+
content,
|
|
43
51
|
editable,
|
|
44
52
|
editorProps: { attributes: { class: richTextClassName('default', 'outline-none'), 'aria-label': 'Text' } },
|
|
45
53
|
})
|
|
@@ -52,11 +60,16 @@ function Editing({ editable }: { editable: boolean }) {
|
|
|
52
60
|
)
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
/** Point at a cell; press a handle for Insert and Delete, or a ➕ bar to add a row or a column at the end. */
|
|
63
|
+
/** Point at a cell; press a handle for Insert and Delete, or a ➕ bar to add a row or a column at the end. The first row's handle also has Header row, ticked while it is on. */
|
|
56
64
|
export const Default: Story = {
|
|
57
65
|
render: () => <Editing editable />,
|
|
58
66
|
}
|
|
59
67
|
|
|
68
|
+
/** A table with its header row off: the first row is an ordinary row, and its handle's Header row is not ticked. */
|
|
69
|
+
export const NoHeaderRow: Story = {
|
|
70
|
+
render: () => <Editing editable content={NO_HEADER} />,
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
/** An editor that is not editable: no controls. */
|
|
61
74
|
export const NotEditable: Story = {
|
|
62
75
|
render: () => <Editing editable={false} />,
|
|
@@ -13,7 +13,7 @@ import { Editor } from '@tiptap/core'
|
|
|
13
13
|
import StarterKit from '@tiptap/starter-kit'
|
|
14
14
|
import { TableKit } from '@tiptap/extension-table'
|
|
15
15
|
import { BlockId } from './BlockNodes'
|
|
16
|
-
import { EditorTableControls, appendTableColumn, appendTableRow, deleteTableColumn, deleteTableRow } from './EditorTableControls'
|
|
16
|
+
import { EditorTableControls, appendTableColumn, appendTableRow, deleteTableColumn, deleteTableRow, toggleTableHeaderRow } from './EditorTableControls'
|
|
17
17
|
|
|
18
18
|
type Json = { type: string; attrs?: Record<string, unknown>; content?: Json[]; text?: string }
|
|
19
19
|
|
|
@@ -230,12 +230,50 @@ describe('EditorTableControls', () => {
|
|
|
230
230
|
const user = await mount(e)
|
|
231
231
|
await act(async () => user.hover(screen.getByText('B')))
|
|
232
232
|
await press(user, screen.getByRole('button', { name: 'Row menu' }))
|
|
233
|
-
expect(screen.getAllByRole('menuitem').map((r) => r.textContent)).toEqual(['Insert below', 'Delete', 'Delete table'])
|
|
233
|
+
expect(screen.getAllByRole('menuitem').map((r) => r.textContent)).toEqual(['Header row', 'Insert below', 'Delete', 'Delete table'])
|
|
234
234
|
await user.click(screen.getByRole('menuitem', { name: 'Delete' }))
|
|
235
235
|
await frame()
|
|
236
236
|
expect(shape(e)).toEqual(['#a1|#b1|#c1', 'a2|b2|c2'])
|
|
237
237
|
})
|
|
238
238
|
|
|
239
|
+
it('the first row’s menu turns the header row off and on; off, the first row is an ordinary row', async () => {
|
|
240
|
+
const e = editor()
|
|
241
|
+
const user = await mount(e)
|
|
242
|
+
await act(async () => user.hover(screen.getByText('B')))
|
|
243
|
+
await press(user, screen.getByRole('button', { name: 'Row menu' }))
|
|
244
|
+
await user.click(screen.getByRole('menuitem', { name: 'Header row' }))
|
|
245
|
+
await frame()
|
|
246
|
+
expect(shape(e)).toEqual(['A|B|C', 'a1|b1|c1', 'a2|b2|c2'])
|
|
247
|
+
|
|
248
|
+
// Off: the first row takes a row above it, and deleting it promotes nothing.
|
|
249
|
+
await act(async () => user.hover(screen.getByText('B')))
|
|
250
|
+
await press(user, screen.getByRole('button', { name: 'Row menu' }))
|
|
251
|
+
expect(screen.getAllByRole('menuitem').map((r) => r.textContent)).toEqual(['Header row', 'Insert above', 'Insert below', 'Delete', 'Delete table'])
|
|
252
|
+
await user.click(screen.getByRole('menuitem', { name: 'Header row' }))
|
|
253
|
+
await frame()
|
|
254
|
+
expect(shape(e)).toEqual(['#A|#B|#C', 'a1|b1|c1', 'a2|b2|c2'])
|
|
255
|
+
|
|
256
|
+
await act(async () => user.hover(screen.getByText('B')))
|
|
257
|
+
await press(user, screen.getByRole('button', { name: 'Row menu' }))
|
|
258
|
+
await user.click(screen.getByRole('menuitem', { name: 'Header row' }))
|
|
259
|
+
await frame()
|
|
260
|
+
await act(async () => user.hover(screen.getByText('B')))
|
|
261
|
+
await press(user, screen.getByRole('button', { name: 'Row menu' }))
|
|
262
|
+
await user.click(screen.getByRole('menuitem', { name: 'Delete' }))
|
|
263
|
+
await frame()
|
|
264
|
+
expect(shape(e)).toEqual(['a1|b1|c1', 'a2|b2|c2'])
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
it('switches the header row from any cell of the table, and only on the first row’s menu', async () => {
|
|
268
|
+
const e = editor()
|
|
269
|
+
const user = await mount(e)
|
|
270
|
+
await act(async () => user.hover(screen.getByText('b2')))
|
|
271
|
+
await press(user, screen.getByRole('button', { name: 'Row menu' }))
|
|
272
|
+
expect(screen.queryByRole('menuitem', { name: 'Header row' })).toBeNull()
|
|
273
|
+
expect(toggleTableHeaderRow(e, cellOf('b2'))).toBe(true)
|
|
274
|
+
expect(shape(e)).toEqual(['A|B|C', 'a1|b1|c1', 'a2|b2|c2'])
|
|
275
|
+
})
|
|
276
|
+
|
|
239
277
|
it('takes the controls away when the document changes without an update — someone else’s edit loaded', async () => {
|
|
240
278
|
const e = editor()
|
|
241
279
|
const user = await mount(e)
|
|
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState, type MouseEvent, type ReactNo
|
|
|
2
2
|
import type { Editor } from '@tiptap/core'
|
|
3
3
|
import { TextSelection, type Command } from '@tiptap/pm/state'
|
|
4
4
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, deleteColumn, deleteRow, deleteTable, toggleHeader } from '@tiptap/pm/tables'
|
|
5
|
-
import { IconColumnInsertLeft, IconColumnInsertRight, IconGripHorizontal, IconGripVertical, IconPlus, IconRowInsertBottom, IconRowInsertTop, IconTrash } from '@tabler/icons-react'
|
|
5
|
+
import { IconCheck, IconColumnInsertLeft, IconColumnInsertRight, IconGripHorizontal, IconGripVertical, IconPlus, IconRowInsertBottom, IconRowInsertTop, IconTableRow, IconTrash } from '@tabler/icons-react'
|
|
6
6
|
import { cn } from './cn'
|
|
7
7
|
import { IconButton } from './IconButton'
|
|
8
8
|
import { FLOATING_SURFACE_CLASSES } from './looks'
|
|
@@ -67,6 +67,15 @@ export function deleteTableRow(editor: Editor, cell: HTMLTableCellElement): bool
|
|
|
67
67
|
return inCell(editor, cell, header ? (state, dispatch, view) => deleteRow(state, dispatch) && (!view || toggleHeader('row')(view.state, view.dispatch)) : deleteRow)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* The table's first row becomes its header row, or an ordinary row again:
|
|
72
|
+
* whichever cell of the table `cell` is. A table with no header row has no
|
|
73
|
+
* text spelling, so the agent keeps it as written (SPEC §13.3, "No spelling").
|
|
74
|
+
*/
|
|
75
|
+
export function toggleTableHeaderRow(editor: Editor, cell: HTMLTableCellElement): boolean {
|
|
76
|
+
return inCell(editor, cell, toggleHeader('row'))
|
|
77
|
+
}
|
|
78
|
+
|
|
70
79
|
/** The same for a column: the last one deletes the table. */
|
|
71
80
|
export function deleteTableColumn(editor: Editor, cell: HTMLTableCellElement): boolean {
|
|
72
81
|
const row = cell.closest('tr')
|
|
@@ -114,7 +123,9 @@ const HANDLE_BOX = cn(FLOATING_SURFACE_CLASSES, 'shadow-none')
|
|
|
114
123
|
/**
|
|
115
124
|
* A table's own controls in an editor, as in Notion: point at a cell and a
|
|
116
125
|
* handle sits on its row's left edge and on its column's top edge; press one
|
|
117
|
-
* for Insert above and below (left and right), Delete, and Delete table.
|
|
126
|
+
* for Insert above and below (left and right), Delete, and Delete table. The
|
|
127
|
+
* first row's menu also turns the header row on and off (Header row, ticked
|
|
128
|
+
* while it is on); with it off, the first row is an ordinary row. On
|
|
118
129
|
* the last row a ➕ bar under the table adds a row, and on the last column one
|
|
119
130
|
* right of it adds a column. Tab in
|
|
120
131
|
* the last cell adds a row too — that is TableKit's own.
|
|
@@ -202,6 +213,18 @@ export function EditorTableControls({ editor, children, className }: EditorTable
|
|
|
202
213
|
</IconButton>
|
|
203
214
|
}
|
|
204
215
|
>
|
|
216
|
+
{/* The header row is switched where it lives: on the first row's menu, ticked while that row is the header. */}
|
|
217
|
+
{shown.row.rowIndex === 0 && (
|
|
218
|
+
<>
|
|
219
|
+
<MenuItem
|
|
220
|
+
label="Header row"
|
|
221
|
+
leading={<IconTableRow {...ICON} />}
|
|
222
|
+
trailing={isHeaderRow(shown.row) ? <IconCheck {...ICON} aria-hidden /> : undefined}
|
|
223
|
+
onClick={run(() => toggleTableHeaderRow(editor, shown.cell))}
|
|
224
|
+
/>
|
|
225
|
+
<MenuSeparator />
|
|
226
|
+
</>
|
|
227
|
+
)}
|
|
205
228
|
{/* Nothing goes above a header row: it is the table's first row, and a header anywhere else is no header (RichText, the agent's text). */}
|
|
206
229
|
{!isHeaderRow(shown.row) && <MenuItem label="Insert above" leading={<IconRowInsertTop {...ICON} />} onClick={run(() => inCell(editor, shown.cell, addRowBefore))} />}
|
|
207
230
|
<MenuItem label="Insert below" leading={<IconRowInsertBottom {...ICON} />} onClick={run(() => inCell(editor, shown.cell, addRowAfter))} />
|
package/src/editor.ts
CHANGED
|
@@ -53,7 +53,7 @@ export {
|
|
|
53
53
|
type ListKind,
|
|
54
54
|
type QuoteKind,
|
|
55
55
|
} from './EditorBlockHandle'
|
|
56
|
-
export { EditorTableControls, appendTableRow, appendTableColumn, deleteTableRow, deleteTableColumn, type EditorTableControlsProps } from './EditorTableControls'
|
|
56
|
+
export { EditorTableControls, appendTableRow, appendTableColumn, deleteTableRow, deleteTableColumn, toggleTableHeaderRow, type EditorTableControlsProps } from './EditorTableControls'
|
|
57
57
|
export {
|
|
58
58
|
PersonMention,
|
|
59
59
|
UrgentPersonMention,
|
package/src/linked.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* widgets look nothing up, and keep nothing but what a reader does to them.
|
|
7
7
|
*
|
|
8
8
|
* The shape follows the prototype Miky approved (Widgets 2, 15 Oct; why:
|
|
9
|
-
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/
|
|
9
|
+
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md).
|
|
10
10
|
*/
|
|
11
11
|
import type { ThingKind } from './KindIcon'
|
|
12
12
|
|
|
@@ -48,20 +48,20 @@ describe('the registry builds', () => {
|
|
|
48
48
|
expect(registry.entries.map((one) => one.name).sort()).toEqual(values.map((one) => one.name).sort())
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
it('counts
|
|
51
|
+
it('counts 204 names over 95 files: 138 components, 63 helpers and 3 hooks (toggleTableHeaderRow, a table’s header row on and off (LEAF-12), on 19 October;EntryShell, the screen while nobody is signed in, moved from Peek (AUT-3), on 17 October; CommentBox with commentBoxRows, and ReactionRow with AddReactionButton and whoReacted, the shared comment box and reaction row (COMM-2), on 17 October; the link widgets — LinkChip, LinkRow, LinkCard, CardUnder, PartCard, LinkPreview and their parts, with useCanHover, chosenOf, loadingShapeOf and unavailableMemory — from the Widgets 2 prototype, on 16 October; InlineText, a title or the line under it edited where it stands (SUM-4), on 16 October; ComposeBox with ComposeKeys and its classes, CommentHighlights with its five helpers, and keepSelection and releaseSelection, from the Leaf prototype (LEAF-4), on 16 October;NavTree, NavTreeSection, the composer triggers and UnreadDot joined on 2 October; BlockHandle and EditorBlockHandle (RIC-18) on 2 October, moveBlock and blockDropCursor, the drop in the gutter, on 5 October, MembersPill and MembersDialog, moved from Peek (SHI-31), on 6 October, ShowMore on 7 October, AppProvider on 8 October, and KindIcon, thingKindOf and PastedImages with its two helpers, moved from Peek, on 8 October; CodeBlockColours, the coloured code block of the editor, on 9 October; Checklist, Callout, isChecklistTick and calloutLook (RIC-19) on 13 October; EditorTableControls and its four actions (RIC-21) on 13 October; ReferenceCards, useReferenceCards and its three helpers, the card a chip in a document asks for, on 14 October; LinkChips and its two helpers, a URL in a document read as its chip, on 14 October; ReferenceMenu, ReferenceMenuView and three helpers, the menu of a chip while writing, on 14 October; PastedMarkdown, markdown pasted as the blocks it spells (LEAF-10), on 15 October; turnIntoRows, turnListInto and turnQuoteInto, the block menu’s Turn into for a list and a quote (LEAF-11), on 15 October)', () => {
|
|
52
52
|
// The reconciliation GATES.md §24 explains. If this changes, that changes.
|
|
53
53
|
// The `EDITOR_EXTENSIONS` count as components by their names; they are
|
|
54
54
|
// editor extensions, documented on SelectionToolbar's, BlockNodes' and
|
|
55
55
|
// ComposerTriggers' pages.
|
|
56
56
|
const kinds = registry.entries.reduce<Record<string, number>>((all, one) => ({ ...all, [one.kind]: (all[one.kind] ?? 0) + 1 }), {})
|
|
57
|
-
expect(kinds).toEqual({ component: 138, helper:
|
|
57
|
+
expect(kinds).toEqual({ component: 138, helper: 63, hook: 3 })
|
|
58
58
|
expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(95)
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
it('gives every entry a purpose, from its own page or from the comment above it', () => {
|
|
62
62
|
expect(registry.entries.filter((one) => one.purpose.trim() === '')).toEqual([])
|
|
63
63
|
expect(registry.entries.filter((one) => one.purposeFrom === 'page').length).toBe(89)
|
|
64
|
-
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(
|
|
64
|
+
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(115)
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
it('takes a name with a page of its own from the page, and a name without one from the code', () => {
|