@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.
Files changed (44) hide show
  1. package/dist/BlockNodes.d.ts +16 -5
  2. package/dist/BlockNodes.d.ts.map +1 -1
  3. package/dist/CommentBox.d.ts +11 -2
  4. package/dist/CommentBox.d.ts.map +1 -1
  5. package/dist/ComposeBox.d.ts +17 -0
  6. package/dist/ComposeBox.d.ts.map +1 -1
  7. package/dist/DocumentEditor.d.ts +5 -4
  8. package/dist/DocumentEditor.d.ts.map +1 -1
  9. package/dist/LinkPlaces.d.ts +51 -0
  10. package/dist/LinkPlaces.d.ts.map +1 -0
  11. package/dist/ReferenceMenu.d.ts.map +1 -1
  12. package/dist/editor.d.ts +1 -0
  13. package/dist/editor.d.ts.map +1 -1
  14. package/dist/editor.js +392 -178
  15. package/dist/editor.js.map +4 -4
  16. package/dist/linked.examples.d.ts.map +1 -1
  17. package/dist/links.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/registry.json +75 -12
  20. package/src/BlockNodes.tsx +36 -9
  21. package/src/CommentBox.mdx +11 -1
  22. package/src/CommentBox.stories.tsx +75 -2
  23. package/src/CommentBox.test.tsx +170 -3
  24. package/src/CommentBox.tsx +211 -53
  25. package/src/ComposeBox.tsx +19 -2
  26. package/src/DocumentEditor.mdx +7 -2
  27. package/src/DocumentEditor.stories.tsx +101 -15
  28. package/src/DocumentEditor.test.tsx +49 -0
  29. package/src/DocumentEditor.tsx +17 -10
  30. package/src/LinkPlaces.mdx +59 -0
  31. package/src/LinkPlaces.stories.tsx +60 -0
  32. package/src/LinkPlaces.test.ts +134 -0
  33. package/src/LinkPlaces.ts +169 -0
  34. package/src/ReferenceCards.mdx +4 -0
  35. package/src/ReferenceMenu.mdx +32 -24
  36. package/src/ReferenceMenu.stories.tsx +15 -16
  37. package/src/ReferenceMenu.test.tsx +161 -57
  38. package/src/ReferenceMenu.tsx +48 -44
  39. package/src/editor.ts +1 -0
  40. package/src/linked.examples.ts +4 -3
  41. package/src/links.ts +4 -1
  42. package/src/pages.test.ts +2 -2
  43. package/src/registry/registry.test.ts +6 -6
  44. 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,
@@ -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
- { id: 'example:c1', title: 'Item one', href: '#c1', key: 'ABC-1', status: { label: 'Done', colour: 'green' }, owner: { name: 'Person one' } },
64
- { id: 'example:c2', title: 'Item two', href: '#c2', key: 'ABC-2', status: { label: 'In progress', colour: 'blue' }, owner: { name: 'Person two' } },
65
- { id: 'example:c3', title: 'Item three', href: '#c3', key: 'ABC-3', status: { label: 'Todo', colour: 'neutral' } },
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
- view.dispatch(state.tr.addMark(from, to, schema.marks.link.create({ href: url })))
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 chip the menu is on.
48
- ReferenceMenu: 'Nothing. Its box is the Popover; it holds which chip the menu is open on, and its keys.',
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 206 names over 96 files: 140 components, 63 helpers and 3 hooks (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)', () => {
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: 140, helper: 63, hook: 3 })
58
- expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(96)
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(90)
64
- expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(116)
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', () => {
@@ -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 card a chip in a document asks for, drawn after its line | **ReferenceCards** — from `@estiva-app/ui/editor`, beside `ReferenceNode`; the app draws its card into each slot |
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 chip in a document, or choose its card, while writing | **ReferenceMenu** — from `@estiva-app/ui/editor`, beside `ReferenceCards`; a click on the chip, or putting one in, opens it |
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 |