{
  "purpose": "Keep a readable conversation position while content grows, without confusing native scrolling, message identity, visibility and keyboard focus.",
  "avoid": "New messages must not unexpectedly displace a reader of older content.",
  "classification": "source-bound-reference-with-explicit-decisions",
  "basis": "Pinned React/primitive sources lead API, lifecycle and semantics; native visual observations and explicit reference decisions are mapped in figma/traceability.json.",
  "profile": "interactive-control/1",
  "profileRationale": "The family presents controls or navigation; static depictions do not establish an interactive contract.",
  "componentId": "shadcn:MessageScroller",
  "sourceRule": "MessageScrollerProvider is headless, with autoScroll=false default, defaultScrollPosition=end, scrollEdgeThreshold8px, previous-item peek64px, scrollMargin0. Root is div; actual Viewport defaults named region Messages, tabIndex0. Content defaults role=log/aria-relevant=additions; reference supplies transcript name and speaker text. Item is div with stable messageId and optional scrollAnchor=false; every direct content row is an Item, including separators/loading rows if supplied. Stable IDs—not array index or text—drive command targets, visibility and prepend preservation. Viewport preserveScrollOnPrepend defaults true. Initial default position applies once on first nonempty render (start|end|last-anchor), pending-scroll marks initial layout until applied. With autoScroll true, new content follows only while already following the bottom; deliberate wheel/touch/viewport scroll keys release follow, and readers away from end are not pulled down. Native geometry and Resize/Mutation/Intersection observers derive edges, anchor positioning and visibility; internal modes following-bottom/free-scrolling/anchored-to-message/settling-jump are not public controlled props. Anchored turns reserve a hidden accessibility spacer as needed. useMessageScroller returns scrollToMessage/scrollToStart/scrollToEnd with optional align/behavior/scrollMargin; commands return false when viewport/eligible target unavailable and may defer a known target until mounted. useMessageScrollerScrollable exposes start/end overflow booleans, useMessageScrollerVisibility exposes currentAnchorId and visibleMessageIds using lazily subscribed observers. These are hook snapshots, not fabricated change events. Button defaults direction=end, behavior=smooth, native type=button and readable source label; inactive button is inert/tabIndex-1. Active Button invokes onClick first, preventDefault vetoes command; accepted command blurs button then uses the real scroll command. Viewport onScroll syncs actual geometry before caller onScroll; wheel/touch/key user intent is observed before caller callbacks, so preventDefault there is not an invented undo of source intent.",
  "keyboardAndFocus": "Named viewport is natively focusable; Home/End/Page/arrow/Space scroll according to browser and release auto-follow intent. Scroll changes do not imply a selected message, move keyboard focus to a message, or announce every streamed token. Native scroll buttons support Enter/Space only while active, have meaningful names and preserve caller cancellation. The source intentionally blurs accepted scroll buttons; reference does not claim a focus trap or automatic focus return. Escape is passive. Essential speaker attribution/text remains readable; role=log additions is the source policy, and repeated complete-text rerenders must not become the only task status. Loading/network errors are caller feedback, not scroll state.",
  "referenceDecision": "Reference has14 stable report message IDs, an explicit turn anchor, autoScroll=true and opening=end. Named log/region and speaker text are caller composition. Append/prepend actions only change local arrays, jump uses actual hook; no AI/backend transport is implied. A constrained viewport and measurable row heights are validation geometry, not replacement native FIG styling. No message selection API, generic ARIA grid or invented source position event is added.",
  "sourceCommit": "45bbf9ba23c9c0f63d38887947e5fb06f59c7da3",
  "sourceFiles": [
    "sources/shadcn/apps/v4/registry/bases/base/ui/message-scroller.tsx.source",
    "sources/shadcn/apps/v4/content/docs/components/base/message-scroller.mdx.source",
    "sources/shadcn/apps/v4/registry/bases/base/examples/message-scroller-example.tsx.source",
    "sources/shadcn/packages/react/src/message-scroller/use-message-scroller-refs.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/message-scroller.perf.browser.test.tsx.source",
    "sources/shadcn/packages/react/src/message-scroller/use-message-scroller-controller.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/message-scroller.test.tsx.source",
    "sources/shadcn/packages/react/src/message-scroller/geometry.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/geometry.test.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/use-message-scroller-commands.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/utils.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/PERFORMANCE.md.source",
    "sources/shadcn/packages/react/src/message-scroller/message-scroller.browser.test.tsx.source",
    "sources/shadcn/packages/react/src/message-scroller/README.md.source",
    "sources/shadcn/packages/react/src/message-scroller/types.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/stores.ts.source",
    "sources/shadcn/packages/react/src/message-scroller/components.tsx.source",
    "sources/shadcn/packages/react/src/message-scroller/index.ts.source"
  ],
  "visualContract": {
    "layoutPolicy": "MessageScrollerProvider and three hooks are headless controllers; actual Root/Viewport/Content/Item/Button and private measured spacer have stable semantic bindings. Source native region/log semantics, stable message IDs, data-pending-scroll and active/inert command states stay authoritative. Native examples show 384px conversation cards/14px corners with different heights; this reference explicitly chooses a responsive 384px surface with 320px viewport and 72px minimum message rows to demonstrate real overflow, not a universal source sizing default.16px transcript inset and 8px row gaps provide readable speaker text. Private measured spacer remains source-owned and aria-hidden; no overriding measured height or scrollTop is encoded in CSS. Buttons use real source 28px icon-sm/16px glyphs and top/bottom 16px, hidden/inert when unavailable, with reduced-motion transitions. Native scroll position, follow intent, visible IDs and keyboard focus remain independent; wheel/key release auto-follow, actual observers preserve prepend anchor. No page coordinates, message-selection state, invented scroll callback or backend lifecycle.",
    "parts": "component.json#/partBindings",
    "tokenBindings": "component.json#/visualContract/tokens",
    "sourceEvidence": "figma/traceability.json"
  }
}
