@estiva-app/ui 0.82.1 → 0.84.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/BlockNodes.d.ts +16 -5
- package/dist/BlockNodes.d.ts.map +1 -1
- package/dist/CommentBox.d.ts +11 -2
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/ComposeBox.d.ts +17 -0
- package/dist/ComposeBox.d.ts.map +1 -1
- package/dist/DocumentEditor.d.ts +5 -4
- package/dist/DocumentEditor.d.ts.map +1 -1
- package/dist/LinkPlaces.d.ts +51 -0
- package/dist/LinkPlaces.d.ts.map +1 -0
- package/dist/ReferenceMenu.d.ts.map +1 -1
- package/dist/editor.d.ts +1 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +392 -178
- package/dist/editor.js.map +4 -4
- package/dist/linked.examples.d.ts.map +1 -1
- package/dist/links.d.ts.map +1 -1
- package/package.json +1 -1
- package/registry.json +75 -12
- package/src/BlockNodes.tsx +36 -9
- package/src/CommentBox.mdx +11 -1
- package/src/CommentBox.stories.tsx +75 -2
- package/src/CommentBox.test.tsx +170 -3
- package/src/CommentBox.tsx +211 -53
- package/src/ComposeBox.tsx +19 -2
- package/src/DocumentEditor.mdx +7 -2
- package/src/DocumentEditor.stories.tsx +101 -15
- package/src/DocumentEditor.test.tsx +49 -0
- package/src/DocumentEditor.tsx +17 -10
- package/src/LinkPlaces.mdx +59 -0
- package/src/LinkPlaces.stories.tsx +60 -0
- package/src/LinkPlaces.test.ts +134 -0
- package/src/LinkPlaces.ts +169 -0
- package/src/ReferenceCards.mdx +4 -0
- package/src/ReferenceMenu.mdx +32 -24
- package/src/ReferenceMenu.stories.tsx +15 -16
- package/src/ReferenceMenu.test.tsx +161 -57
- package/src/ReferenceMenu.tsx +48 -44
- package/src/editor.ts +1 -0
- package/src/linked.examples.ts +4 -3
- package/src/links.ts +4 -1
- package/src/pages.test.ts +2 -2
- package/src/registry/registry.test.ts +6 -6
- package/stories/Choosing.mdx +3 -2
package/src/editor.ts
CHANGED
|
@@ -113,6 +113,7 @@ export {
|
|
|
113
113
|
type ReferenceCardSlot,
|
|
114
114
|
} from './ReferenceCards'
|
|
115
115
|
export { LinkChips, findLinkChips, refreshLinkChips, type LinkChipsOptions, type PastedRange } from './LinkChips'
|
|
116
|
+
export { LinkPlaces, linkPlaceAt, staysChip, type LinkPlace } from './LinkPlaces'
|
|
116
117
|
export { ReferenceMenu, ReferenceMenuView, isReferenceMenuOpen, referenceMenuClick, type ReferenceMenuViewProps } from './ReferenceMenu'
|
|
117
118
|
export {
|
|
118
119
|
DocumentEditor,
|
package/src/linked.examples.ts
CHANGED
|
@@ -60,9 +60,10 @@ export const GROUP: Linked = {
|
|
|
60
60
|
done: { done: 2, total: 5 },
|
|
61
61
|
conversation: { count: 2, href: '#group-conversation' },
|
|
62
62
|
children: [
|
|
63
|
-
|
|
64
|
-
{ id: 'example:
|
|
65
|
-
{ id: 'example:
|
|
63
|
+
// The same keys as `ITEM` and `ITEM_NO_SUMMARY`, so a story showing the group beside its items reads as one set.
|
|
64
|
+
{ id: 'example:c1', title: 'Item one', href: '#c1', key: 'ABC-2', status: { label: 'Done', colour: 'green' }, owner: { name: 'Person one' } },
|
|
65
|
+
{ id: 'example:c2', title: 'Item two', href: '#c2', key: 'ABC-3', status: { label: 'In progress', colour: 'blue' }, owner: { name: 'Person two' } },
|
|
66
|
+
{ id: 'example:c3', title: 'Item three', href: '#c3', key: 'ABC-4', status: { label: 'Todo', colour: 'neutral' } },
|
|
66
67
|
],
|
|
67
68
|
}
|
|
68
69
|
|
package/src/links.ts
CHANGED
|
@@ -43,7 +43,10 @@ export const PasteOverWords = Extension.create({
|
|
|
43
43
|
return false
|
|
44
44
|
})
|
|
45
45
|
if (plain && LINK_ON_WORDS_TARGET.test(url) && !/[[\]\n]/.test(state.doc.textBetween(from, to))) {
|
|
46
|
-
|
|
46
|
+
// The caret goes after the link: left selected, the words open the selection strip's Link field,
|
|
47
|
+
// which takes focus and the next Enter, so a box needed two to send (COMM-8).
|
|
48
|
+
const tr = state.tr.addMark(from, to, schema.marks.link.create({ href: url }))
|
|
49
|
+
view.dispatch(tr.setSelection(TextSelection.create(tr.doc, to)).removeStoredMark(schema.marks.link))
|
|
47
50
|
return true
|
|
48
51
|
}
|
|
49
52
|
const before = state.doc.textBetween(Math.max(to - 1, $to.start()), to, '', '')
|
package/src/pages.test.ts
CHANGED
|
@@ -44,8 +44,8 @@ const HOLDS_ONLY: Record<string, string> = {
|
|
|
44
44
|
PastedMarkdown: 'Nothing. It draws nothing; it hands pasted text to the app\'s reader and puts back what that reads.',
|
|
45
45
|
CodeBlockColours: 'Nothing. It names each word of a code block; the RichText class list colours them.',
|
|
46
46
|
LinkChips: 'Nothing. It draws nothing; it turns the URLs the app recognises into chips.',
|
|
47
|
-
// Its box is the Popover's, which owns what a box does; it holds which
|
|
48
|
-
ReferenceMenu: 'Nothing. Its box is the Popover; it holds which
|
|
47
|
+
// Its box is the Popover's, which owns what a box does; it holds which link the menu is on.
|
|
48
|
+
ReferenceMenu: 'Nothing. Its box is the Popover; it holds which link the menu is open on, and its keys.',
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const dir = new URL('.', import.meta.url)
|
|
@@ -26,7 +26,7 @@ import { SCHEMA_VERSION, validateRegistry, type Registry, type RegistryEntry } f
|
|
|
26
26
|
const root = process.cwd()
|
|
27
27
|
const registry = buildRegistry({ root })
|
|
28
28
|
/** Editor extensions: named like components by the catalogue, and not React components. */
|
|
29
|
-
const EDITOR_EXTENSIONS = ['KeptSelection', 'BlockId', 'UnknownBlock', 'ReferenceNode', 'AttachmentNode', 'PersonMention', 'UrgentPersonMention', 'PersonReference', 'CaptionedReference', 'ReferenceTrigger', 'SlashCommands', 'PastedImages', 'PastedMarkdown', 'CodeBlockColours', 'Checklist', 'Callout', 'ReferenceCards', 'LinkChips', 'ReferenceMenu', 'CommentHighlights', 'ComposeKeys']
|
|
29
|
+
const EDITOR_EXTENSIONS = ['KeptSelection', 'BlockId', 'UnknownBlock', 'ReferenceNode', 'AttachmentNode', 'PersonMention', 'UrgentPersonMention', 'PersonReference', 'CaptionedReference', 'ReferenceTrigger', 'SlashCommands', 'PastedImages', 'PastedMarkdown', 'CodeBlockColours', 'Checklist', 'Callout', 'ReferenceCards', 'LinkChips', 'LinkPlaces', 'ReferenceMenu', 'CommentHighlights', 'ComposeKeys']
|
|
30
30
|
const entry = (name: string): RegistryEntry => {
|
|
31
31
|
const found = registry.entries.find((candidate) => candidate.name === name)
|
|
32
32
|
if (!found) throw new Error(`no entry for ${name}`)
|
|
@@ -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 209 names over 97 files: 141 components, 65 helpers and 3 hooks (LinkPlaces with linkPlaceAt and staysChip, a link in a document drawn where it sits (WBD-4), on 20 October; DocumentEditor, one document editor for every app, and PersonReference, `@` in a document (WBD-3), on 20 October; 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:
|
|
58
|
-
expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(
|
|
57
|
+
expect(kinds).toEqual({ component: 141, helper: 65, hook: 3 })
|
|
58
|
+
expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(97)
|
|
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
|
-
expect(registry.entries.filter((one) => one.purposeFrom === 'page').length).toBe(
|
|
64
|
-
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(
|
|
63
|
+
expect(registry.entries.filter((one) => one.purposeFrom === 'page').length).toBe(91)
|
|
64
|
+
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(118)
|
|
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', () => {
|
package/stories/Choosing.mdx
CHANGED
|
@@ -105,9 +105,10 @@ fork freely, owe nothing back, mention it on the package's ticket.
|
|
|
105
105
|
| A document or an image attached to something, posted or waiting to be sent | **AttachmentCard** — the file decides the shape; `pending` in a composer |
|
|
106
106
|
| A picture pasted into an editor, attached rather than pasted | **PastedImages** — from `@estiva-app/ui/editor`; the app hands it its upload |
|
|
107
107
|
| Markdown pasted as plain text, landing as the headings, lists and tables it spells | **PastedMarkdown** — from `@estiva-app/ui/editor`, in an editor that saves a block document; the app hands it the protocol's reader |
|
|
108
|
-
| A
|
|
108
|
+
| A link in a document drawn where it sits: chip in a sentence, row alone on its line, card in the row's place | **LinkPlaces** — from `@estiva-app/ui/editor`, beside `ReferenceNode`; the app's view draws what `place` says. **DocumentEditor** has it |
|
|
109
|
+
| A card a chip in a document asks for, drawn after its line (an editor not yet on the line rule) | **ReferenceCards** — from `@estiva-app/ui/editor`, beside `ReferenceNode`; the app draws its card into each slot |
|
|
109
110
|
| A URL in a document that reads as the chip of what it points at | **LinkChips** — from `@estiva-app/ui/editor`, beside `ReferenceNode`; the app says what each URL names |
|
|
110
|
-
| Open a
|
|
111
|
+
| Open a link in a document, or show a lone one as its row or card, while writing | **ReferenceMenu** — from `@estiva-app/ui/editor`, beside `LinkPlaces`; a click on the link, or putting one alone on a line, opens it |
|
|
111
112
|
| A code block in an editor, coloured by its language as you type | **CodeBlockColours** — from `@estiva-app/ui/editor`, in place of the starter kit's code block |
|
|
112
113
|
| A link to something an app looked up, in a sentence | **LinkChip** — hover shows its card; loading and "not available" drawn for you. **LinkChips** (editor) turns a URL in a document into one |
|
|
113
114
|
| A link alone on its line | **LinkRow** — one 36px line for every kind; **LinkUnavailable** when it cannot be read |
|