Skip to content

feat(conversation): add ConversationMap and useReadingPosition - #11

Closed
pratikbuilds wants to merge 1 commit into
conversation/06-history-windowfrom
conversation/07-conversation-map
Closed

pratikbuilds wants to merge 1 commit into
conversation/06-history-windowfrom
conversation/07-conversation-map

Conversation

@pratikbuilds

Copy link
Copy Markdown
Owner

ConversationMap shows one tick per turn, marked faint, on screen or current, previews a turn on hover or focus and jumps to it with the conversation's glide. The rail is one tab stop with arrow keys and Enter, and keeping the current tick in view scrolls only the rail. useReadingPosition reports the current and on-screen turns from one IntersectionObserver over the item registry, measuring on the conversation's per-frame scroll snapshots. A jumped-to turn stays current until the reader scrolls.

Stacked on #10: review only this commit. Part of corbitsdev#94.

Notes for review

  • useReadingPosition reads the container from useConversation().scrollContainer() and measures on subscribeScroll snapshots; works when a host overrides ConversationContent's data-slot.
  • jumpTo pins a clicked turn as current until the reader actually scrolls (a byReader snapshot with movement); clicking or typing inside the log keeps it. The keyboard preview follows its tick along an overflowing rail.
  • Keep-in-view scrolls only the rail (rail.scrollTo); the page never moves (e2e asserts window.scrollY stays 0).
  • A turn whose start item isn't mounted (windowed history) is never on screen; clicking its tick only fires onSelect.
  • (04) MessageSendStatus and MessageHeader register through Message's context, so they work at any depth (e.g. inside MessageFooter) and Message never doubles the status line. The live region belongs to Message and reads the current error (or "Not sent."). Server-rendered HTML shows the default line until hydration registers a placed one.

Verification

  • This commit passes bun run typecheck and bun run lint on its own (the stack is checked commit by commit).
  • At the top of the stack: bun run check, bun run build, bun run dep-guard, bun run contrast-test and bun run test:e2e (Playwright specs and the Storybook axe sweep in light and dark) pass.

Closes corbitsdev#101

ConversationMap shows one tick per turn, marked faint, on screen or
current, previews a turn on hover or focus and jumps to it with the
conversation's glide. The rail is one tab stop with arrow keys and
Enter, and keeping the current tick in view scrolls only the rail.
useReadingPosition reports the current and on-screen turns from one
IntersectionObserver over the item registry, measuring on the
conversation's per-frame scroll snapshots. A jumped-to turn stays
current until the reader scrolls.
@pratikbuilds

Copy link
Copy Markdown
Owner Author

Moved upstream: corbitsdev#123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant