@adea-ai/ui 0.162.6 → 0.162.8
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/components/composites/about-dialog/about-dialog.js +5 -5
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +3 -3
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +2 -2
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +22 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +10 -10
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +13 -13
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +12 -12
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +13 -13
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +9 -9
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +10 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -5
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js +7 -7
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +5 -5
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +13 -13
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js +7 -7
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +9 -9
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js +5 -5
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +10 -10
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/icon-picker/image-data-url.js.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.js +117 -117
- package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +7 -7
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js +2 -2
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +7 -7
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +12 -12
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js +5 -5
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/prompt-input/prompt-input.js +3 -3
- package/dist/components/composites/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/composites/queue/queue.js +13 -13
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -5
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js +16 -16
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +2 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +2 -2
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js +5 -5
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js +5 -5
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.js +2 -2
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +10 -10
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js +6 -6
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -5
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +2 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js +5 -5
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.js +1 -1
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +18 -18
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js +17 -17
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js +5 -5
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js +6 -6
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +1 -1
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +23 -23
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +2 -2
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +6 -6
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +11 -11
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js +1 -1
- package/dist/components/conversation/busy-send-button.js +10 -10
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/composer-core.js +1 -1
- package/dist/components/conversation/composer-menu.js +2 -2
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +7 -7
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +5 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +9 -9
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.js +9 -9
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js +13 -13
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/scroll-follow.js +1 -1
- package/dist/components/conversation/thread-panel.js +5 -5
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js +5 -5
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -2
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js +7 -7
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js +2 -2
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +5 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js +5 -5
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -2
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +2 -2
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -5
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/pane-focus.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +7 -7
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +5 -5
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js +1 -1
- package/dist/components/theme/appearance-panel.js +3 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.js +3 -3
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/script-projection.js +1 -1
- package/dist/components/theme/theme-catalogue-source.js +1 -1
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js +7 -7
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.js +1 -1
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.js +1 -1
- package/dist/components/theme/theme-toggle.js +7 -7
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +13 -13
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js +12 -12
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +14 -14
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +2 -2
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +16 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +7 -7
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js +2 -2
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button-group/button-group.js +2 -2
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +8 -8
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js +2 -2
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js +8 -8
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js +2 -2
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +6 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js +6 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +7 -7
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +21 -21
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js +1 -1
- package/dist/components/ui/command/command.js +23 -23
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/detail-panel/detail-panel.js +5 -5
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +2 -2
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +21 -21
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js +2 -2
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +14 -14
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +10 -10
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js +5 -5
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +2 -2
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js +14 -14
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js +2 -2
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +10 -10
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js +2 -2
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +2 -2
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js +2 -2
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js +2 -2
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +7 -7
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js +3 -3
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +2 -2
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +5 -5
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +18 -18
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +28 -28
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js +15 -15
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js +5 -5
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +10 -10
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +9 -9
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +11 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +21 -21
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js +5 -5
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +6 -6
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js +5 -5
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js +5 -5
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +2 -2
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js +4 -4
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +7 -7
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +2 -2
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +7 -7
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js +6 -6
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +7 -8
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.js +6 -6
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
- package/dist/components/ui/tooltip/lazy-tooltip.js +2 -2
- package/dist/components/ui/tooltip/tooltip.js +10 -10
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js +19 -19
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js +2 -2
- package/dist/lib/accent-presets.js +1 -1
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/async-action.js +1 -1
- package/dist/lib/create-poll.js +1 -1
- package/dist/lib/create-poll.js.map +1 -1
- package/dist/lib/external-link.js +1 -1
- package/dist/lib/external-link.js.map +1 -1
- package/dist/lib/fast-icon.js +1 -1
- package/dist/lib/theme-css.js +1 -1
- package/dist/lib/theme-engine-light.js +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-records.js +1 -1
- package/dist/lib/themes.js +1 -1
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/vite/source-parser.js +1 -1
- package/dist/vite/tailwind-sources.js +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-citation.js","names":["<Show when={count() > 0}>\n <span data-slot=\"inline-citation-root\">\n <Popover\n open={mode() !== 'closed'}\n onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>\n </span>\n </Show>","<Popover\n open={mode() !== 'closed'}\n onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>","onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}","placement=\"bottom\"","gutter={6}","<PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>","as={CitationTriggerButton}","variant=\"subtle\"","size=\"2xs\"","touchTarget=\"comfortable\"","onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}","onBlur={() => schedule('blur', 0)}","onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}","<Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>","<span aria-hidden=\"true\">+{count() - 1}</span>","<PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>","ref={(element: HTMLElement) => (content = element)}","class=\"w-72 max-w-full\"","onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}","onFocusIn={() => {\n focusInCard = true\n }}","onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}","onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}","onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}","<Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>","<span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>","<ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>","variant=\"ghost\"","size=\"icon-xs\"","tooltip=\"Previous source\"","onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}","<ChevronLeft />","<span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>","<ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>","tooltip=\"Next source\"","onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}","<ChevronRight />","<div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>","<PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>","class=\"p-0 [overflow-wrap:anywhere]\"","<CitationDetails source={source()} />","<InlineCitation\n index={numbers[0]}\n sources={numbers.flatMap((number) => {\n const source = sources[number - 1]\n return source ? [source] : []\n })}\n />","<Show when={host()}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">{host()}</p>\n </Show>","<Show when={href()}>\n {(url) => (\n <TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>\n )}\n </Show>","<TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>","target=\"_blank\"","rel=\"noreferrer noopener\"","class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"","boundText(url(), 96)","<span class=\"visually-hidden\"> (opens in a new tab)</span>","<Show when={withheld()}>\n <p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>\n </Show>","<p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>","<Show when={snippet()}>\n <p class=\"m-0 line-clamp-6 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {snippet()}\n </p>\n </Show>","ChevronLeft","LucideChevronLeft","ChevronRight","LucideChevronRight"],"sources":["../../../../src/components/composites/inline-citation/inline-citation.tsx"],"sourcesContent":["import { ChevronLeft as LucideChevronLeft, ChevronRight as LucideChevronRight } from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, flush, onCleanup, Show } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { slotted } from '#lib/slotted'\nimport { ActionButton } from '../action-button'\nimport { Button } from '../../ui/button'\nimport type { MessageCitations } from '../../ui/message'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { TextLink } from '../../ui/text-link'\nimport {\n SOURCE_SNIPPET_LIMIT,\n safeSourceUrl,\n sourceHost,\n sourceTitle,\n type Source,\n} from '../sources/source'\nimport { boundText } from '#lib/text'\nimport {\n citationLabel,\n citationName,\n nextCitationMode,\n wrapIndex,\n type CitationEvent,\n type CitationMode,\n} from './citation'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronLeft = fastIcon(LucideChevronLeft)\nconst ChevronRight = fastIcon(LucideChevronRight)\n\n/**\n * InlineCitation.\n *\n * A small badge inside a sentence, \"1\", or a host, that opens the source(s)\n * behind the claim: title, host, address, snippet, and Previous/Next when several\n * sources share one marker. It is an inline element for prose such as\n * `MessageText`: it never breaks across lines, stays on the text baseline, and\n * adds no block of its own. For the list of everything a reply used, reach for\n * `Sources`; the two number sources the same way.\n *\n * ## One popover, two ways to open it\n *\n * A hover card would exclude everyone who is not holding a mouse, so this is a\n * `Popover` that a pointer can also *peek* at:\n *\n * - **Hover or keyboard focus peeks.** The popover opens without taking focus\n * and closes when the pointer or focus leaves. Touch has no hover, so a touch\n * never peeks. A keyboard peek's card is inert, so Tab moves on from the badge\n * to the next control on the page instead of into a card that is closing.\n * - **Click, tap, Enter or Space pins.** Focus moves into the popover so its\n * link and Previous/Next are reachable; it stays until Escape, an outside press,\n * or the badge is pressed again, and focus returns to the badge. Pressing a badge\n * that is only peeking pins it rather than toggling it shut, the transitions\n * are the pure `nextCitationMode`.\n *\n * The popover's trigger toggles on every press, so `open` is controlled and its own\n * close request is ignored for the press that we already decided (`pressing`).\n * Without that, hover-then-click, the commonest pointer path, would close the card.\n *\n * ## It makes no claim without sources\n *\n * No sources renders nothing: a marker that points nowhere is not a citation.\n * The address is a link only when `safeSourceUrl` allows it; the host comes from\n * the parsed URL; titles and snippets are clipped, cleaned of direction\n * overrides and rendered as text. The badge's accessible name carries the title\n * and host (the visible label is only a number or a host), so a reader hears\n * what is cited without opening anything.\n */\nexport type InlineCitationProps = {\n /** One source, or several that support the same claim. */\n sources: readonly Source[]\n /**\n * The 1-based number to show, matching the source's position in `Sources`.\n * Omit it to show the host instead; a number is never guessed.\n */\n index?: number\n /** Milliseconds a pointer rests before the peek opens. */\n hoverDelay?: number\n class?: string\n}\n\n// ui-sdk parts write their own data-slot; the rendered element restores ours.\nconst CitationTriggerButton = slotted(Button, 'inline-citation')\n\nconst LEAVE_DELAY = 200\n\nexport function InlineCitation(props: InlineCitationProps) {\n const local = props\n const [mode, setMode] = createSignal<CitationMode>('closed')\n const [position, setPosition] = createSignal(0)\n let timer: ReturnType<typeof setTimeout> | undefined\n let content: HTMLElement | undefined\n let pressing = false\n // Focus handed back to the badge as the popover closes is not a request to\n // peek again; without this, Escape from a pinned card reopens it as a preview.\n let restoringFocus = false\n // A keyboard peek is a preview of the badge the reader is already on. Its card\n // sits in a portal at the end of the document, so if it stayed tabbable, Tab\n // from the badge would walk into the card, the card would close behind the\n // focus as the badge blurred, and focus would fall to <body> and be pulled\n // back to the badge: a keyboard trap. The card is inert until Enter or Space\n // pins it, and while it closes. A pointer peek stays interactive.\n const [keyboardPeek, setKeyboardPeek] = createSignal(false)\n // Focus goes back to the badge only when it was in the card. A peek never\n // held focus, and its close (finishing after its exit animation) must not\n // pull the reader back from wherever Tab has taken them since.\n let focusInCard = false\n // Escape closes the innermost layer first: an open Previous/Next tooltip, then\n // the card. Only the top-most layer takes Escape, and a tooltip\n // that just closed stays the top layer while it animates out, so a second\n // Escape pressed during that exit used to vanish and leave the card open.\n // Whether a tooltip was open is read before any handler runs (window,\n // capture); an Escape that closed nothing else closes the card itself.\n let escapeClosedTooltip = false\n const onWindowKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n escapeClosedTooltip =\n content?.ownerDocument.querySelector('[data-slot=\"tooltip-content\"][data-expanded]') != null\n }\n const pinned = createMemo(() => mode() === 'pinned')\n createEffect(pinned, (isPinned) => {\n if (!isPinned || typeof window === 'undefined') return\n window.addEventListener('keydown', onWindowKeyDown, true)\n return () => window.removeEventListener('keydown', onWindowKeyDown, true)\n })\n\n const count = () => local.sources.length\n const active = () => local.sources[wrapIndex(position(), count())]\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n onCleanup(clear)\n\n // The state machine steps on this plain copy: a signal read lags its write\n // until the next flush, and two events in one tick (a press, then the popover's\n // own toggle) must each see the other's result.\n let current: CitationMode = 'closed'\n const dispatch = (event: CitationEvent) => {\n const next = nextCitationMode(current, event)\n if (next !== 'peek') setKeyboardPeek(false)\n else if (current === 'closed') setKeyboardPeek(event === 'focus')\n current = next\n setMode(next)\n }\n const schedule = (event: CitationEvent, delay: number) => {\n clear()\n timer = setTimeout(() => dispatch(event), delay)\n }\n\n const onPointerEnter = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('enter', local.hoverDelay ?? 150)\n }\n const onPointerLeave = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('leave', LEAVE_DELAY)\n }\n\n const onClick = () => {\n clear()\n const wasPeeking = current === 'peek'\n dispatch('press')\n // The popover toggles right after this handler; its request is not a dismissal.\n pressing = true\n queueMicrotask(() => {\n pressing = false\n })\n // The peek never took focus; a deliberate press must hand it over, once\n // the popover's own toggle (which runs after this handler) has settled.\n // The popover is already open, so ui-sdk's open focus does not run again:\n // focus goes to the card's first control, as it does on a fresh open.\n if (wasPeeking)\n queueMicrotask(() => {\n const first = content?.querySelector<HTMLElement>(\n 'a[href], button:not(:disabled), [tabindex]:not([tabindex=\"-1\"])'\n )\n ;(first ?? content)?.focus()\n })\n }\n\n // The badge and the popover's portal marker share one wrapper. Without it they\n // are loose siblings in the host's node list, and when the portal marker comes\n // and goes as the card opens and closes, a host that renders its inline nodes\n // as one array (MessageText) reconciles that array and can move the badge,\n // which drops keyboard focus to <body> on the badge the reader just reached.\n return (\n <Show when={count() > 0}>\n <span data-slot=\"inline-citation-root\">\n <Popover\n open={mode() !== 'closed'}\n onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>\n </span>\n </Show>\n )\n}\n\n/**\n * Citation markers for `MessageText`, from the sources a reply really used.\n *\n * `[^2]` in the text becomes the second source's badge; `[^1,3]` one badge for\n * sources 1 and 3. A number beyond the list leaves the marker as written, and an\n * empty list makes every marker literal, so text can never cite a source the host\n * did not supply.\n *\n * <MessageText text={reply} citations={messageCitations(sources)} />\n */\nexport function messageCitations(sources: readonly Source[]): MessageCitations {\n return {\n count: sources.length,\n render: (numbers) => (\n <InlineCitation\n index={numbers[0]}\n sources={numbers.flatMap((number) => {\n const source = sources[number - 1]\n return source ? [source] : []\n })}\n />\n ),\n }\n}\n\nfunction CitationDetails(props: { source: Source }) {\n const href = () => safeSourceUrl(props.source.url)\n const host = () => sourceHost(props.source.url)\n const snippet = () =>\n props.source.snippet ? boundText(props.source.snippet, SOURCE_SNIPPET_LIMIT) : ''\n const withheld = () => props.source.url !== undefined && props.source.url !== '' && !href()\n\n return (\n <>\n <Show when={host()}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">{host()}</p>\n </Show>\n <Show when={href()}>\n {(url) => (\n <TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>\n )}\n </Show>\n <Show when={withheld()}>\n <p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>\n </Show>\n <Show when={snippet()}>\n <p class=\"m-0 line-clamp-6 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {snippet()}\n </p>\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAMoD,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,iBAAe,SAASC,YAAkB;AAsDhD,IAAM,wBAAwB,QAAQ,QAAQ,iBAAiB;AAE/D,IAAM,cAAc;AAEpB,SAAgB,eAAe,OAA4B;CACzD,MAAM,QAAQ;CACd,MAAM,CAAC,MAAM,WAAW,aAA2B,QAAQ;CAC3D,MAAM,CAAC,UAAU,eAAe,aAAa,CAAC;CAC9C,IAAI;CACJ,IAAI;CACJ,IAAI,WAAW;CAGf,IAAI,iBAAiB;CAOrB,MAAM,CAAC,cAAc,mBAAmB,aAAa,KAAK;CAI1D,IAAI,cAAc;CAOlB,IAAI,sBAAsB;CAC1B,MAAM,mBAAmB,UAAyB;EAChD,IAAI,MAAM,QAAQ,UAAU;EAC5B,sBACE,SAAS,cAAc,cAAc,gDAA8C,KAAK;CAC5F;CACA,MAAM,SAAS,iBAAiB,KAAK,MAAM,QAAQ;CACnD,aAAa,SAAS,aAAa;EACjC,IAAI,CAAC,YAAY,OAAO,WAAW,aA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AiF,IAAA,SAAA,QAAA;IAAjF,OAAA,QAAuE,IAAU;IAAjF,OAAA;GAAiF,EAAA,CAAA,IADnF,KAAA;EAEM,CAAA;EACNC,gBAAAA,MAAAA;GAAM,IAAA,OAAA;IAAM,OAAA,KAAK;GAAC;GAAlBA,WACI,QACAC,gBAAAA,UAAAA;IACE,IAAA,OAAA;KAAM,OAAA,IAAI;IAAC;IACXC,QAAO;IACPC,KAAI;IACJC,OAAM;IAJR,IAAA,WAAA;KAKC,OAAA,CACEC,WAAAA;MAAU,OAAA,UAAA,IAAI,GAAG,EAAE;KACpBC,CAAAA,GAAAA,QAAyD,CAD1D;IAES;;EAER,CAAA;EACNC,WAAAA;;IAAY,OAAA,CAAA,CAAA,SAAS;GAEf,CAAA,CAAC,CAAD,IADJC,QAAkE,IADpE,KAAA;EAEM,CAAA;EACNC,WAAAA;;IAAY,OAAA,CAAA,CAAA,QAAQ;GAId,CAAA,CAAC,CAAD,WAHJ;IAEG,IAAA,SAAA,QAAA;IAFH,OAAA,QACG,OACA;IAFH,OAAA;GAEG,EAAA,CAAA,IAHL,KAAA;EAIM,CAAA;CAvBP;AA0BL"}
|
|
1
|
+
{"version":3,"file":"inline-citation.js","names":["<Show when={count() > 0}>\n <span data-slot=\"inline-citation-root\">\n <Popover\n open={mode() !== 'closed'}\n onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>\n </span>\n </Show>","<Popover\n open={mode() !== 'closed'}\n onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>","onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}","placement=\"bottom\"","gutter={6}","<PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>","as={CitationTriggerButton}","variant=\"subtle\"","size=\"2xs\"","touchTarget=\"comfortable\"","onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}","onBlur={() => schedule('blur', 0)}","onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}","<Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>","<span aria-hidden=\"true\">+{count() - 1}</span>","<PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>","ref={(element: HTMLElement) => (content = element)}","class=\"w-72 max-w-full\"","onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}","onFocusIn={() => {\n focusInCard = true\n }}","onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}","onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}","onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}","<Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>","<span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>","<ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>","variant=\"ghost\"","size=\"icon-xs\"","tooltip=\"Previous source\"","onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}","<ChevronLeft />","<span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>","<ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>","tooltip=\"Next source\"","onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}","<ChevronRight />","<div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>","<PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>","class=\"p-0 [overflow-wrap:anywhere]\"","<CitationDetails source={source()} />","<InlineCitation\n index={numbers[0]}\n sources={numbers.flatMap((number) => {\n const source = sources[number - 1]\n return source ? [source] : []\n })}\n />","<Show when={host()}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">{host()}</p>\n </Show>","<Show when={href()}>\n {(url) => (\n <TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>\n )}\n </Show>","<TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>","target=\"_blank\"","rel=\"noreferrer noopener\"","class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"","boundText(url(), 96)","<span class=\"visually-hidden\"> (opens in a new tab)</span>","<Show when={withheld()}>\n <p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>\n </Show>","<p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>","<Show when={snippet()}>\n <p class=\"m-0 line-clamp-6 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {snippet()}\n </p>\n </Show>","LucideChevronLeft","LucideChevronRight","_$insert"],"sources":["../../../../src/components/composites/inline-citation/inline-citation.tsx"],"sourcesContent":["import { ChevronLeft as LucideChevronLeft, ChevronRight as LucideChevronRight } from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, flush, onCleanup, Show } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { slotted } from '#lib/slotted'\nimport { ActionButton } from '../action-button'\nimport { Button } from '../../ui/button'\nimport type { MessageCitations } from '../../ui/message'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { TextLink } from '../../ui/text-link'\nimport {\n SOURCE_SNIPPET_LIMIT,\n safeSourceUrl,\n sourceHost,\n sourceTitle,\n type Source,\n} from '../sources/source'\nimport { boundText } from '#lib/text'\nimport {\n citationLabel,\n citationName,\n nextCitationMode,\n wrapIndex,\n type CitationEvent,\n type CitationMode,\n} from './citation'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronLeft = fastIcon(LucideChevronLeft)\nconst ChevronRight = fastIcon(LucideChevronRight)\n\n/**\n * InlineCitation.\n *\n * A small badge inside a sentence, \"1\", or a host, that opens the source(s)\n * behind the claim: title, host, address, snippet, and Previous/Next when several\n * sources share one marker. It is an inline element for prose such as\n * `MessageText`: it never breaks across lines, stays on the text baseline, and\n * adds no block of its own. For the list of everything a reply used, reach for\n * `Sources`; the two number sources the same way.\n *\n * ## One popover, two ways to open it\n *\n * A hover card would exclude everyone who is not holding a mouse, so this is a\n * `Popover` that a pointer can also *peek* at:\n *\n * - **Hover or keyboard focus peeks.** The popover opens without taking focus\n * and closes when the pointer or focus leaves. Touch has no hover, so a touch\n * never peeks. A keyboard peek's card is inert, so Tab moves on from the badge\n * to the next control on the page instead of into a card that is closing.\n * - **Click, tap, Enter or Space pins.** Focus moves into the popover so its\n * link and Previous/Next are reachable; it stays until Escape, an outside press,\n * or the badge is pressed again, and focus returns to the badge. Pressing a badge\n * that is only peeking pins it rather than toggling it shut, the transitions\n * are the pure `nextCitationMode`.\n *\n * The popover's trigger toggles on every press, so `open` is controlled and its own\n * close request is ignored for the press that we already decided (`pressing`).\n * Without that, hover-then-click, the commonest pointer path, would close the card.\n *\n * ## It makes no claim without sources\n *\n * No sources renders nothing: a marker that points nowhere is not a citation.\n * The address is a link only when `safeSourceUrl` allows it; the host comes from\n * the parsed URL; titles and snippets are clipped, cleaned of direction\n * overrides and rendered as text. The badge's accessible name carries the title\n * and host (the visible label is only a number or a host), so a reader hears\n * what is cited without opening anything.\n */\nexport type InlineCitationProps = {\n /** One source, or several that support the same claim. */\n sources: readonly Source[]\n /**\n * The 1-based number to show, matching the source's position in `Sources`.\n * Omit it to show the host instead; a number is never guessed.\n */\n index?: number\n /** Milliseconds a pointer rests before the peek opens. */\n hoverDelay?: number\n class?: string\n}\n\n// ui-sdk parts write their own data-slot; the rendered element restores ours.\nconst CitationTriggerButton = slotted(Button, 'inline-citation')\n\nconst LEAVE_DELAY = 200\n\nexport function InlineCitation(props: InlineCitationProps) {\n const local = props\n const [mode, setMode] = createSignal<CitationMode>('closed')\n const [position, setPosition] = createSignal(0)\n let timer: ReturnType<typeof setTimeout> | undefined\n let content: HTMLElement | undefined\n let pressing = false\n // Focus handed back to the badge as the popover closes is not a request to\n // peek again; without this, Escape from a pinned card reopens it as a preview.\n let restoringFocus = false\n // A keyboard peek is a preview of the badge the reader is already on. Its card\n // sits in a portal at the end of the document, so if it stayed tabbable, Tab\n // from the badge would walk into the card, the card would close behind the\n // focus as the badge blurred, and focus would fall to <body> and be pulled\n // back to the badge: a keyboard trap. The card is inert until Enter or Space\n // pins it, and while it closes. A pointer peek stays interactive.\n const [keyboardPeek, setKeyboardPeek] = createSignal(false)\n // Focus goes back to the badge only when it was in the card. A peek never\n // held focus, and its close (finishing after its exit animation) must not\n // pull the reader back from wherever Tab has taken them since.\n let focusInCard = false\n // Escape closes the innermost layer first: an open Previous/Next tooltip, then\n // the card. Only the top-most layer takes Escape, and a tooltip\n // that just closed stays the top layer while it animates out, so a second\n // Escape pressed during that exit used to vanish and leave the card open.\n // Whether a tooltip was open is read before any handler runs (window,\n // capture); an Escape that closed nothing else closes the card itself.\n let escapeClosedTooltip = false\n const onWindowKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n escapeClosedTooltip =\n content?.ownerDocument.querySelector('[data-slot=\"tooltip-content\"][data-expanded]') != null\n }\n const pinned = createMemo(() => mode() === 'pinned')\n createEffect(pinned, (isPinned) => {\n if (!isPinned || typeof window === 'undefined') return\n window.addEventListener('keydown', onWindowKeyDown, true)\n return () => window.removeEventListener('keydown', onWindowKeyDown, true)\n })\n\n const count = () => local.sources.length\n const active = () => local.sources[wrapIndex(position(), count())]\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n onCleanup(clear)\n\n // The state machine steps on this plain copy: a signal read lags its write\n // until the next flush, and two events in one tick (a press, then the popover's\n // own toggle) must each see the other's result.\n let current: CitationMode = 'closed'\n const dispatch = (event: CitationEvent) => {\n const next = nextCitationMode(current, event)\n if (next !== 'peek') setKeyboardPeek(false)\n else if (current === 'closed') setKeyboardPeek(event === 'focus')\n current = next\n setMode(next)\n }\n const schedule = (event: CitationEvent, delay: number) => {\n clear()\n timer = setTimeout(() => dispatch(event), delay)\n }\n\n const onPointerEnter = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('enter', local.hoverDelay ?? 150)\n }\n const onPointerLeave = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('leave', LEAVE_DELAY)\n }\n\n const onClick = () => {\n clear()\n const wasPeeking = current === 'peek'\n dispatch('press')\n // The popover toggles right after this handler; its request is not a dismissal.\n pressing = true\n queueMicrotask(() => {\n pressing = false\n })\n // The peek never took focus; a deliberate press must hand it over, once\n // the popover's own toggle (which runs after this handler) has settled.\n // The popover is already open, so ui-sdk's open focus does not run again:\n // focus goes to the card's first control, as it does on a fresh open.\n if (wasPeeking)\n queueMicrotask(() => {\n const first = content?.querySelector<HTMLElement>(\n 'a[href], button:not(:disabled), [tabindex]:not([tabindex=\"-1\"])'\n )\n ;(first ?? content)?.focus()\n })\n }\n\n // The badge and the popover's portal marker share one wrapper. Without it they\n // are loose siblings in the host's node list, and when the portal marker comes\n // and goes as the card opens and closes, a host that renders its inline nodes\n // as one array (MessageText) reconciles that array and can move the badge,\n // which drops keyboard focus to <body> on the badge the reader just reached.\n return (\n <Show when={count() > 0}>\n <span data-slot=\"inline-citation-root\">\n <Popover\n open={mode() !== 'closed'}\n onOpenChange={(next: boolean) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={CitationTriggerButton}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n clear()\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n // A blur fires before focus lands on its next element, and Solid\n // flushes the close between the two. ui-sdk then finds focus on\n // <body> and hands it back to this badge, so Shift+Tab could never\n // leave it. The close waits one task, until focus has arrived.\n onBlur={() => schedule('blur', 0)}\n onKeyDown={(event: KeyboardEvent) => {\n // ui-sdk moves Tab from the trigger into an open popover, but a\n // keyboard peek's card is inert, so the move would fail and keep\n // focus here. The peek closes first (flushed, so ui-sdk sees it\n // closed) and Tab moves on from the badge, as before.\n if (event.key !== 'Tab' || event.shiftKey || current !== 'peek' || !keyboardPeek())\n return\n clear()\n dispatch('blur')\n flush()\n }}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (current === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || current !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>\n </span>\n </Show>\n )\n}\n\n/**\n * Citation markers for `MessageText`, from the sources a reply really used.\n *\n * `[^2]` in the text becomes the second source's badge; `[^1,3]` one badge for\n * sources 1 and 3. A number beyond the list leaves the marker as written, and an\n * empty list makes every marker literal, so text can never cite a source the host\n * did not supply.\n *\n * <MessageText text={reply} citations={messageCitations(sources)} />\n */\nexport function messageCitations(sources: readonly Source[]): MessageCitations {\n return {\n count: sources.length,\n render: (numbers) => (\n <InlineCitation\n index={numbers[0]}\n sources={numbers.flatMap((number) => {\n const source = sources[number - 1]\n return source ? [source] : []\n })}\n />\n ),\n }\n}\n\nfunction CitationDetails(props: { source: Source }) {\n const href = () => safeSourceUrl(props.source.url)\n const host = () => sourceHost(props.source.url)\n const snippet = () =>\n props.source.snippet ? boundText(props.source.snippet, SOURCE_SNIPPET_LIMIT) : ''\n const withheld = () => props.source.url !== undefined && props.source.url !== '' && !href()\n\n return (\n <>\n <Show when={host()}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">{host()}</p>\n </Show>\n <Show when={href()}>\n {(url) => (\n <TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>\n )}\n </Show>\n <Show when={withheld()}>\n <p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>\n </Show>\n <Show when={snippet()}>\n <p class=\"m-0 line-clamp-6 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {snippet()}\n </p>\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAM,cAAc,SAASoD,aAAiB;AAC9C,IAAM,eAAe,SAASC,cAAkB;AAsD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OACA;IAFH,OAAA;GAEG,EAAA,CAAA,IAHL,KAAA;EAIM,CAAA;CAvBP;AA0BL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
1
|
import { Dynamic, className, createComponent, effect, insert, memo, mergeProps, readShallow, template } from "@solidjs/web";
|
|
3
2
|
import { Show, omit } from "solid-js";
|
|
3
|
+
import { cn } from "../../../lib/utils.js";
|
|
4
4
|
// src/components/composites/list-row/list-row-control.tsx
|
|
5
5
|
var _tmpl$ = /* @__PURE__ */ template(`<div data-slot=list-row-content class="flex min-w-0 flex-1 items-center gap-2.5"><span data-slot=list-row-label class="flex min-w-0 flex-1 flex-col"><span class=truncate>`);
|
|
6
6
|
var _tmpl$2 = /* @__PURE__ */ template(`<span data-slot=list-row-leading class="flex shrink-0 items-center justify-center [&_svg]:size-4">`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-row-control.js","names":["<Dynamic\n component={rowAs()}\n data-slot=\"list-row\"\n type={rowAs() === 'button' ? (local.type ?? 'button') : local.type}\n tabindex={local.tabindex ?? (rowAs() === 'button' || rowAs() === 'a' ? 0 : undefined)}\n aria-current={local.selected ? 'true' : undefined}\n data-selected={local.selected ? '' : undefined}\n data-description={local.description ? '' : undefined}\n data-stack-trailing={local.stackTrailing === false ? 'never' : undefined}\n class={cn(\n 'group/row list-row-description flex min-w-0 items-center gap-2.5 rounded-md px-2 text-sm',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n {\n 'h-row-sm': local.dense && !local.description,\n 'h-row-md': !local.dense && !local.description,\n },\n {\n 'bg-primary-subtle text-foreground': local.selected,\n 'hover:bg-surface-hover': !local.selected,\n },\n local.class\n )}\n {...(rest as ComponentProps<'div'>)}\n >\n <Show when={local.leading}>\n {(leadingSlot) => (\n <span\n data-slot=\"list-row-leading\"\n class=\"flex shrink-0 items-center justify-center [&_svg]:size-4\"\n >\n {leadingSlot()}\n </span>\n )}\n </Show>\n <div data-slot=\"list-row-content\" class=\"flex min-w-0 flex-1 items-center gap-2.5\">\n <span data-slot=\"list-row-label\" class=\"flex min-w-0 flex-1 flex-col\">\n <span class=\"truncate\">{local.children}</span>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"list-row-description\"\n class={cn(\n 'text-xs',\n {\n truncate: local.truncateDescription,\n 'break-words': !local.truncateDescription,\n },\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>\n </span>\n <Show when={local.trailing}>\n {(trailingSlot) => (\n <span\n data-slot=\"list-row-trailing\"\n class={cn(\n 'ms-auto flex shrink-0 items-center gap-1',\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {trailingSlot()}\n </span>\n )}\n </Show>\n </div>\n </Dynamic>","rowAs() === 'button' ? (local.type ?? 'button') : local.type","<Show when={local.leading}>\n {(leadingSlot) => (\n <span\n data-slot=\"list-row-leading\"\n class=\"flex shrink-0 items-center justify-center [&_svg]:size-4\"\n >\n {leadingSlot()}\n </span>\n )}\n </Show>","<Show when={local.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"list-row-description\"\n class={cn(\n 'text-xs',\n {\n truncate: local.truncateDescription,\n 'break-words': !local.truncateDescription,\n },\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>","<Show when={local.trailing}>\n {(trailingSlot) => (\n <span\n data-slot=\"list-row-trailing\"\n class={cn(\n 'ms-auto flex shrink-0 items-center gap-1',\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {trailingSlot()}\n </span>\n )}\n </Show>","_$readShallow"],"sources":["../../../../src/components/composites/list-row/list-row-control.tsx"],"sourcesContent":["import type { ComponentProps, JSX, ValidComponent } from '@solidjs/web'\nimport { Show, omit } from 'solid-js'\nimport { Dynamic } from '@solidjs/web'\nimport { cn } from '#lib/utils'\n\n/**\n * The props of `T` with `Props` laid over them, plus `as`: the shape of the\n * polymorphic props these types have always had.\n */\nexport type PolymorphicProps<T extends ValidComponent, Props extends object = {}> = Omit<\n ComponentProps<T>,\n keyof Props | 'as'\n> &\n Props & { as?: T | keyof JSX.IntrinsicElements }\n\nexport type ListRowControlProps<T extends ValidComponent = 'div'> = PolymorphicProps<\n T,\n {\n class?: string\n /** Marks the row as current. Sets `aria-current` for a link row. */\n selected?: boolean\n /** Draw the row at the compact height. */\n dense?: boolean\n /** Leading slot: an avatar, an icon, a checkbox. */\n leading?: JSX.Element\n /** Trailing slot: a count, a menu trigger, a timestamp. */\n trailing?: JSX.Element\n /** A second line that wraps and grows the row to fit its content. */\n description?: string\n /**\n * Keep the description on one line and end it with an ellipsis instead of\n * wrapping, so a described row stays at its minimum height however long the\n * text is. Use it where rows must be a predictable height (a virtualised\n * queue); leave it off where the whole description should be readable. Pair\n * it with a `tooltip` when the full text matters, and with\n * `stackTrailing={false}` to keep a trailing slot beside the text.\n */\n truncateDescription?: boolean\n /**\n * Whether a described row may drop its trailing slot onto its own line when\n * the row gets narrow (the default). Pass `false` for a short, truncating\n * label whose single action must stay beside it.\n */\n stackTrailing?: boolean\n /** Native button type; defaults to `button` for button rows. */\n type?: ComponentProps<'button'>['type']\n }\n>\n\ntype ListRowControlBaseProps<T extends ValidComponent = 'div'> = ListRowControlProps<T> & {\n as?: T\n}\n\n/** A tree-shakeable ListRow renderer without optional tooltip behavior. */\nexport function ListRowControl<T extends ValidComponent = 'div'>(props: ListRowControlProps<T>) {\n const local = props as ListRowControlBaseProps\n const rest = omit(\n local,\n 'as',\n 'class',\n 'selected',\n 'dense',\n 'leading',\n 'trailing',\n 'description',\n 'truncateDescription',\n 'stackTrailing',\n 'type',\n 'tabindex',\n 'children'\n )\n const hasClickHandler = () => Boolean(rest.onClick)\n const rowAs = (): ValidComponent => local.as ?? (hasClickHandler() ? 'button' : 'div')\n\n // Solid's Dynamic directly: a polymorphic wrapper would add a prop split and\n // merge around the same call for every row.\n return (\n <Dynamic\n component={rowAs()}\n data-slot=\"list-row\"\n type={rowAs() === 'button' ? (local.type ?? 'button') : local.type}\n tabindex={local.tabindex ?? (rowAs() === 'button' || rowAs() === 'a' ? 0 : undefined)}\n aria-current={local.selected ? 'true' : undefined}\n data-selected={local.selected ? '' : undefined}\n data-description={local.description ? '' : undefined}\n data-stack-trailing={local.stackTrailing === false ? 'never' : undefined}\n class={cn(\n 'group/row list-row-description flex min-w-0 items-center gap-2.5 rounded-md px-2 text-sm',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n {\n 'h-row-sm': local.dense && !local.description,\n 'h-row-md': !local.dense && !local.description,\n },\n {\n 'bg-primary-subtle text-foreground': local.selected,\n 'hover:bg-surface-hover': !local.selected,\n },\n local.class\n )}\n {...(rest as ComponentProps<'div'>)}\n >\n <Show when={local.leading}>\n {(leadingSlot) => (\n <span\n data-slot=\"list-row-leading\"\n class=\"flex shrink-0 items-center justify-center [&_svg]:size-4\"\n >\n {leadingSlot()}\n </span>\n )}\n </Show>\n <div data-slot=\"list-row-content\" class=\"flex min-w-0 flex-1 items-center gap-2.5\">\n <span data-slot=\"list-row-label\" class=\"flex min-w-0 flex-1 flex-col\">\n <span class=\"truncate\">{local.children}</span>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"list-row-description\"\n class={cn(\n 'text-xs',\n {\n truncate: local.truncateDescription,\n 'break-words': !local.truncateDescription,\n },\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>\n </span>\n <Show when={local.trailing}>\n {(trailingSlot) => (\n <span\n data-slot=\"list-row-trailing\"\n class={cn(\n 'ms-auto flex shrink-0 items-center gap-1',\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {trailingSlot()}\n </span>\n )}\n </Show>\n </div>\n </Dynamic>\n )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KM,EAAA,CAAA;EAEJ,CAAA,UACN;GAkCK,IAAA,OAAA,OAAA;GAjCH,IAAA,QAAA,KAAA;GACE,IAAA,QAAA,MAAA;GAAuB,OAAA,aAAA;IAAC,OAAA,MAAM;GAAQ,CAAO;GAD/C,OAAA,OAEEC,gBAAAA,MAAAA;IAAM,IAAA,OAAA;KAAM,OAAA,MAAM;IAAW;IAA7BA,WACI,2BACA;KAYM,IAAA,QAAA,QAAA;KAZN,OAAA,OAWG,eACG;KAVJ,aAAAE,YAAO,GACL,WACA;MACE,UAAU,MAAM;MAChB,eAAe,CAAC,MAAM;KACxB,GACA,MAAM,WAAW,oBAAoB,uBACvC,CAAC,IAPD,KAAA,QAAA;MAOC,UAAA,OAAA,KAAA,GAAA;;KATH,OAAA;IAYM,EAAA,CAAA;GAEJ,CAAA,GAlBR,IAmBM;GApBR,OAAA,MAqBED,gBAAAA,MAAAA;IAAM,IAAA,OAAA;KAAM,OAAA,MAAM;IAAQ;IAA1BA,WACI,wBACA;KAQM,IAAA,QAAA,QAAA;KARN,OAAA,OAOG,YACG;KANJ,aAAAC,YAAO,GACL,4CACA,MAAM,WAAW,oBAAoB,uBACvC,CAAC,IAHD,KAAA,QAAA;MAGC,UAAA,OAAA,KAAA,GAAA;;KALH,OAAA;IAQM,EAAA,CAAA;GAEJ,CAAA,GAjCR,IAkCK;GAlCL,OAAA;EAkCK,EAAA,CAAA,CA5CN;CA6CQ,EAAA,CAAA,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"list-row-control.js","names":["<Dynamic\n component={rowAs()}\n data-slot=\"list-row\"\n type={rowAs() === 'button' ? (local.type ?? 'button') : local.type}\n tabindex={local.tabindex ?? (rowAs() === 'button' || rowAs() === 'a' ? 0 : undefined)}\n aria-current={local.selected ? 'true' : undefined}\n data-selected={local.selected ? '' : undefined}\n data-description={local.description ? '' : undefined}\n data-stack-trailing={local.stackTrailing === false ? 'never' : undefined}\n class={cn(\n 'group/row list-row-description flex min-w-0 items-center gap-2.5 rounded-md px-2 text-sm',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n {\n 'h-row-sm': local.dense && !local.description,\n 'h-row-md': !local.dense && !local.description,\n },\n {\n 'bg-primary-subtle text-foreground': local.selected,\n 'hover:bg-surface-hover': !local.selected,\n },\n local.class\n )}\n {...(rest as ComponentProps<'div'>)}\n >\n <Show when={local.leading}>\n {(leadingSlot) => (\n <span\n data-slot=\"list-row-leading\"\n class=\"flex shrink-0 items-center justify-center [&_svg]:size-4\"\n >\n {leadingSlot()}\n </span>\n )}\n </Show>\n <div data-slot=\"list-row-content\" class=\"flex min-w-0 flex-1 items-center gap-2.5\">\n <span data-slot=\"list-row-label\" class=\"flex min-w-0 flex-1 flex-col\">\n <span class=\"truncate\">{local.children}</span>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"list-row-description\"\n class={cn(\n 'text-xs',\n {\n truncate: local.truncateDescription,\n 'break-words': !local.truncateDescription,\n },\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>\n </span>\n <Show when={local.trailing}>\n {(trailingSlot) => (\n <span\n data-slot=\"list-row-trailing\"\n class={cn(\n 'ms-auto flex shrink-0 items-center gap-1',\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {trailingSlot()}\n </span>\n )}\n </Show>\n </div>\n </Dynamic>","rowAs() === 'button' ? (local.type ?? 'button') : local.type","<Show when={local.leading}>\n {(leadingSlot) => (\n <span\n data-slot=\"list-row-leading\"\n class=\"flex shrink-0 items-center justify-center [&_svg]:size-4\"\n >\n {leadingSlot()}\n </span>\n )}\n </Show>","<Show when={local.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"list-row-description\"\n class={cn(\n 'text-xs',\n {\n truncate: local.truncateDescription,\n 'break-words': !local.truncateDescription,\n },\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>","<Show when={local.trailing}>\n {(trailingSlot) => (\n <span\n data-slot=\"list-row-trailing\"\n class={cn(\n 'ms-auto flex shrink-0 items-center gap-1',\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {trailingSlot()}\n </span>\n )}\n </Show>","_$insert","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/composites/list-row/list-row-control.tsx"],"sourcesContent":["import type { ComponentProps, JSX, ValidComponent } from '@solidjs/web'\nimport { Show, omit } from 'solid-js'\nimport { Dynamic } from '@solidjs/web'\nimport { cn } from '#lib/utils'\n\n/**\n * The props of `T` with `Props` laid over them, plus `as`: the shape of the\n * polymorphic props these types have always had.\n */\nexport type PolymorphicProps<T extends ValidComponent, Props extends object = {}> = Omit<\n ComponentProps<T>,\n keyof Props | 'as'\n> &\n Props & { as?: T | keyof JSX.IntrinsicElements }\n\nexport type ListRowControlProps<T extends ValidComponent = 'div'> = PolymorphicProps<\n T,\n {\n class?: string\n /** Marks the row as current. Sets `aria-current` for a link row. */\n selected?: boolean\n /** Draw the row at the compact height. */\n dense?: boolean\n /** Leading slot: an avatar, an icon, a checkbox. */\n leading?: JSX.Element\n /** Trailing slot: a count, a menu trigger, a timestamp. */\n trailing?: JSX.Element\n /** A second line that wraps and grows the row to fit its content. */\n description?: string\n /**\n * Keep the description on one line and end it with an ellipsis instead of\n * wrapping, so a described row stays at its minimum height however long the\n * text is. Use it where rows must be a predictable height (a virtualised\n * queue); leave it off where the whole description should be readable. Pair\n * it with a `tooltip` when the full text matters, and with\n * `stackTrailing={false}` to keep a trailing slot beside the text.\n */\n truncateDescription?: boolean\n /**\n * Whether a described row may drop its trailing slot onto its own line when\n * the row gets narrow (the default). Pass `false` for a short, truncating\n * label whose single action must stay beside it.\n */\n stackTrailing?: boolean\n /** Native button type; defaults to `button` for button rows. */\n type?: ComponentProps<'button'>['type']\n }\n>\n\ntype ListRowControlBaseProps<T extends ValidComponent = 'div'> = ListRowControlProps<T> & {\n as?: T\n}\n\n/** A tree-shakeable ListRow renderer without optional tooltip behavior. */\nexport function ListRowControl<T extends ValidComponent = 'div'>(props: ListRowControlProps<T>) {\n const local = props as ListRowControlBaseProps\n const rest = omit(\n local,\n 'as',\n 'class',\n 'selected',\n 'dense',\n 'leading',\n 'trailing',\n 'description',\n 'truncateDescription',\n 'stackTrailing',\n 'type',\n 'tabindex',\n 'children'\n )\n const hasClickHandler = () => Boolean(rest.onClick)\n const rowAs = (): ValidComponent => local.as ?? (hasClickHandler() ? 'button' : 'div')\n\n // Solid's Dynamic directly: a polymorphic wrapper would add a prop split and\n // merge around the same call for every row.\n return (\n <Dynamic\n component={rowAs()}\n data-slot=\"list-row\"\n type={rowAs() === 'button' ? (local.type ?? 'button') : local.type}\n tabindex={local.tabindex ?? (rowAs() === 'button' || rowAs() === 'a' ? 0 : undefined)}\n aria-current={local.selected ? 'true' : undefined}\n data-selected={local.selected ? '' : undefined}\n data-description={local.description ? '' : undefined}\n data-stack-trailing={local.stackTrailing === false ? 'never' : undefined}\n class={cn(\n 'group/row list-row-description flex min-w-0 items-center gap-2.5 rounded-md px-2 text-sm',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n {\n 'h-row-sm': local.dense && !local.description,\n 'h-row-md': !local.dense && !local.description,\n },\n {\n 'bg-primary-subtle text-foreground': local.selected,\n 'hover:bg-surface-hover': !local.selected,\n },\n local.class\n )}\n {...(rest as ComponentProps<'div'>)}\n >\n <Show when={local.leading}>\n {(leadingSlot) => (\n <span\n data-slot=\"list-row-leading\"\n class=\"flex shrink-0 items-center justify-center [&_svg]:size-4\"\n >\n {leadingSlot()}\n </span>\n )}\n </Show>\n <div data-slot=\"list-row-content\" class=\"flex min-w-0 flex-1 items-center gap-2.5\">\n <span data-slot=\"list-row-label\" class=\"flex min-w-0 flex-1 flex-col\">\n <span class=\"truncate\">{local.children}</span>\n <Show when={local.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"list-row-description\"\n class={cn(\n 'text-xs',\n {\n truncate: local.truncateDescription,\n 'break-words': !local.truncateDescription,\n },\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>\n </span>\n <Show when={local.trailing}>\n {(trailingSlot) => (\n <span\n data-slot=\"list-row-trailing\"\n class={cn(\n 'ms-auto flex shrink-0 items-center gap-1',\n local.selected ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {trailingSlot()}\n </span>\n )}\n </Show>\n </div>\n </Dynamic>\n )\n}\n"],"mappings":";;;;;;;;;AAsDA,SAAgB,eAAiD,OAA+B;CAC9F,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,MACA,SACA,YACA,SACA,WACA,YACA,eACA,uBACA,iBACA,QACA,YACA,UACF;CACA,MAAM,wBAAwB,QAAQ,KAAK,OAAO;CAClD,MAAM,cAA8B,MAAM,OAAO,gBAAgB,IAAI,WAAW;CAIhF,OACEA,gBAAAA,SAAAA,WAAAA;EACE,IAAA,YAAA;GAAW,OAAA,MAAM;EAAC;EAClB,aAAU;EACV,IAAA,OAAA;GAAMC,OAAAA,WAAAA;IAAM,OAAA,MAAA,MAAM;GAA+C,CAAA,CAAC,CAAD,IAAnC,MAAM,QAAQ,WAAY,MAAM;EAAI;EAClE,IAAA,WAAA;GAAU,OAAA,MAAM,aAAa,MAAM,MAAM,YAAY,MAAM,MAAM,MAAM,IAAI,KAAA;EAAU;EACrF,IAAA,iBAAA;GAAc,OAAA,MAAM,WAAW,SAAS,KAAA;EAAS;EACjD,IAAA,kBAAA;GAAe,OAAA,MAAM,WAAW,KAAK,KAAA;EAAS;EAC9C,IAAA,qBAAA;GAAkB,OAAA,MAAM,cAAc,KAAK,KAAA;EAAS;EACpD,IAAA,wBAAA;GAAqB,OAAA,MAAM,kBAAkB,QAAQ,UAAU,KAAA;EAAS;EACxE,IAAA,UAAA;GAAO,OAAA,GACL,4FACA,2CACA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AAA,CAAA,CA5CN;CA6CQ,EAAA,CAAA,CAAA;AAEb"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { createComponent, insert, memo, mergeProps, spread, template } from "@solidjs/web";
|
|
2
|
+
import { Show, createSignal, createUniqueId, omit } from "solid-js";
|
|
1
3
|
import { createDeferredTooltip } from "../../ui/tooltip/deferred-tooltip.js";
|
|
2
4
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../ui/tooltip/tooltip.js";
|
|
3
5
|
import { Text } from "../../ui/typography/typography.js";
|
|
4
6
|
import { cn } from "../../../lib/utils.js";
|
|
5
7
|
import { ListRowControl } from "./list-row-control.js";
|
|
6
|
-
import { createComponent, insert, memo, mergeProps, spread, template } from "@solidjs/web";
|
|
7
|
-
import { Show, createSignal, createUniqueId, omit } from "solid-js";
|
|
8
8
|
// src/components/composites/list-row/list-row.tsx
|
|
9
9
|
var _tmpl$ = /* @__PURE__ */ template(`<div><div class="flex flex-col gap-0.5">`);
|
|
10
10
|
var _tmpl$2 = /* @__PURE__ */ template(`<div class="group/list-header flex items-center gap-1 px-2 py-1"><!><!>`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-row.js","names":["<ListRowControl\n as={rowAs()}\n {...(rest as unknown as ListRowControlProps<T>)}\n ref={(element: HTMLElement) => {\n deferred.ref(element)\n const forwarded = local.ref as unknown\n if (typeof forwarded === 'function') forwarded(element)\n }}\n type={rowType()}\n aria-describedby={describedBy()}\n onPointerEnter={deferred.onPointerEnter}\n onFocus={deferred.onFocus}\n />","ref={(element: HTMLElement) => {\n deferred.ref(element)\n const forwarded = local.ref as unknown\n if (typeof forwarded === 'function') forwarded(element)\n }}","<Show when={deferred.armed() && local.tooltip}>\n {(tooltipSlot) => (\n <Tooltip open={tooltipOpen()} onOpenChange={setTooltipOpen}>\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>\n </Tooltip>\n )}\n </Show>","deferred.armed() && local.tooltip","<Tooltip open={tooltipOpen()} onOpenChange={setTooltipOpen}>\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>\n </Tooltip>","onOpenChange={setTooltipOpen}","<TooltipTrigger as={deferred.Target} />","<TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>","id={tooltipId}","<Show when={local.label}>\n {(labelSlot) => (\n <div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>\n )}\n </Show>","<Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>","variant=\"overline\"","class=\"min-w-0 flex-1 truncate\"","<div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>","<Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>","<div data-slot=\"list-group\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <Show when={local.label}>\n {(labelSlot) => (\n <div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>\n )}\n </Show>\n <div class=\"flex flex-col gap-0.5\">{local.children}</div>\n </div>"],"sources":["../../../../src/components/composites/list-row/list-row.tsx"],"sourcesContent":["import type { ComponentProps, JSX, ValidComponent } from '@solidjs/web'\nimport { createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { createDeferredTooltip, Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'\nimport { Text } from '../../ui/typography'\nimport { cn } from '#lib/utils'\nimport { ListRowControl, type ListRowControlProps, type PolymorphicProps } from './list-row-control'\n\nexport type ListRowProps<T extends ValidComponent = 'div'> = PolymorphicProps<\n T,\n ListRowControlProps<T> & {\n /** A short explanation shown on pointer hover and keyboard focus. */\n tooltip?: string\n /** Native button type; defaults to `button` for button rows. */\n type?: ComponentProps<'button'>['type']\n /** Additional accessible description preserved on plain and rich rows. */\n 'aria-describedby'?: string\n }\n>\n\n/**\n * Rich row composition with optional hover and keyboard tooltip behavior.\n * Import ListRowControl when the tooltip API is not needed and the consumer\n * wants the plain renderer to tree-shake independently.\n *\n * The tooltip is mounted on demand: a list of tooltip rows renders plain rows,\n * and a row builds its tooltip the first time a pointer enters it or keyboard\n * focus reaches it. The event that armed it is replayed to the new trigger, so\n * the tip opens on the same timing as an eagerly mounted one.\n */\nexport function ListRow<T extends ValidComponent = 'div'>(props: ListRowProps<T>) {\n // Typed as the button form so the row's event props and ref are visible to\n // `omit`; the element type itself still comes from `as`.\n const local = props as unknown as ListRowProps<'button'> & { as?: T }\n const rest = omit(local, 'as', 'tooltip', 'aria-describedby', 'ref', 'onPointerEnter', 'onFocus')\n const [tooltipOpen, setTooltipOpen] = createSignal(false)\n const tooltipId = `list-row-tooltip-${createUniqueId()}`\n const hasClickHandler = () => Boolean(rest.onClick)\n const rowAs = () => (local.as ?? (hasClickHandler() ? 'button' : 'div')) as T\n const rowType = () => (rowAs() === 'button' ? (rest.type ?? 'button') : rest.type)\n const describedBy = () => {\n const external = local['aria-describedby']\n if (!tooltipOpen() || !local.tooltip) return external\n const ids = new Set([...(external?.split(/\\s+/) ?? []), tooltipId].filter(Boolean))\n return [...ids].join(' ')\n }\n const deferred = createDeferredTooltip({\n enabled: () => !!local.tooltip,\n onPointerEnter: () => local.onPointerEnter,\n onFocus: () => local.onFocus,\n })\n // Spread `rest` itself, never a function's result: a spread call compiles to a memo\n // that reads every prop getter (children, leading, trailing), so each row would\n // rebuild its content whenever any value it reads changed, such as a list's selection.\n return (\n <>\n <ListRowControl\n as={rowAs()}\n {...(rest as unknown as ListRowControlProps<T>)}\n ref={(element: HTMLElement) => {\n deferred.ref(element)\n const forwarded = local.ref as unknown\n if (typeof forwarded === 'function') forwarded(element)\n }}\n type={rowType()}\n aria-describedby={describedBy()}\n onPointerEnter={deferred.onPointerEnter}\n onFocus={deferred.onFocus}\n />\n <Show when={deferred.armed() && local.tooltip}>\n {(tooltipSlot) => (\n <Tooltip open={tooltipOpen()} onOpenChange={setTooltipOpen}>\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>\n </Tooltip>\n )}\n </Show>\n </>\n )\n}\n\n/**\n * A group of rows with an optional heading and a scrolling body. The heading is\n * a plain label rather than a control: grouping is for reading, and a disclosure\n * on a list of five rows costs more attention than it saves.\n */\nexport function ListGroup(props: ComponentProps<'div'> & { label?: string; action?: JSX.Element }) {\n const local = props\n const rest = omit(props, 'class', 'label', 'action', 'children')\n return (\n <div data-slot=\"list-group\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <Show when={local.label}>\n {(labelSlot) => (\n <div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>\n )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J,CAAA,GAVRD,KAWK;GAXL,OAAA;EAWK,EAAA,CAAA;CAEH,CAAA,GAhBRE,KAkBK;CADH,OAAA,aAAmC;EAAC,OAAA,MAAM;CAAQ,CAAM;CAlB5D,OACEA;AAoBJ"}
|
|
1
|
+
{"version":3,"file":"list-row.js","names":["<ListRowControl\n as={rowAs()}\n {...(rest as unknown as ListRowControlProps<T>)}\n ref={(element: HTMLElement) => {\n deferred.ref(element)\n const forwarded = local.ref as unknown\n if (typeof forwarded === 'function') forwarded(element)\n }}\n type={rowType()}\n aria-describedby={describedBy()}\n onPointerEnter={deferred.onPointerEnter}\n onFocus={deferred.onFocus}\n />","ref={(element: HTMLElement) => {\n deferred.ref(element)\n const forwarded = local.ref as unknown\n if (typeof forwarded === 'function') forwarded(element)\n }}","<Show when={deferred.armed() && local.tooltip}>\n {(tooltipSlot) => (\n <Tooltip open={tooltipOpen()} onOpenChange={setTooltipOpen}>\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>\n </Tooltip>\n )}\n </Show>","deferred.armed() && local.tooltip","<Tooltip open={tooltipOpen()} onOpenChange={setTooltipOpen}>\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>\n </Tooltip>","onOpenChange={setTooltipOpen}","<TooltipTrigger as={deferred.Target} />","<TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>","id={tooltipId}","<Show when={local.label}>\n {(labelSlot) => (\n <div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>\n )}\n </Show>","<Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>","variant=\"overline\"","class=\"min-w-0 flex-1 truncate\"","<div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>","<Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>","<div data-slot=\"list-group\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <Show when={local.label}>\n {(labelSlot) => (\n <div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>\n )}\n </Show>\n <div class=\"flex flex-col gap-0.5\">{local.children}</div>\n </div>","_$spread","_$insert"],"sources":["../../../../src/components/composites/list-row/list-row.tsx"],"sourcesContent":["import type { ComponentProps, JSX, ValidComponent } from '@solidjs/web'\nimport { createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { createDeferredTooltip, Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'\nimport { Text } from '../../ui/typography'\nimport { cn } from '#lib/utils'\nimport { ListRowControl, type ListRowControlProps, type PolymorphicProps } from './list-row-control'\n\nexport type ListRowProps<T extends ValidComponent = 'div'> = PolymorphicProps<\n T,\n ListRowControlProps<T> & {\n /** A short explanation shown on pointer hover and keyboard focus. */\n tooltip?: string\n /** Native button type; defaults to `button` for button rows. */\n type?: ComponentProps<'button'>['type']\n /** Additional accessible description preserved on plain and rich rows. */\n 'aria-describedby'?: string\n }\n>\n\n/**\n * Rich row composition with optional hover and keyboard tooltip behavior.\n * Import ListRowControl when the tooltip API is not needed and the consumer\n * wants the plain renderer to tree-shake independently.\n *\n * The tooltip is mounted on demand: a list of tooltip rows renders plain rows,\n * and a row builds its tooltip the first time a pointer enters it or keyboard\n * focus reaches it. The event that armed it is replayed to the new trigger, so\n * the tip opens on the same timing as an eagerly mounted one.\n */\nexport function ListRow<T extends ValidComponent = 'div'>(props: ListRowProps<T>) {\n // Typed as the button form so the row's event props and ref are visible to\n // `omit`; the element type itself still comes from `as`.\n const local = props as unknown as ListRowProps<'button'> & { as?: T }\n const rest = omit(local, 'as', 'tooltip', 'aria-describedby', 'ref', 'onPointerEnter', 'onFocus')\n const [tooltipOpen, setTooltipOpen] = createSignal(false)\n const tooltipId = `list-row-tooltip-${createUniqueId()}`\n const hasClickHandler = () => Boolean(rest.onClick)\n const rowAs = () => (local.as ?? (hasClickHandler() ? 'button' : 'div')) as T\n const rowType = () => (rowAs() === 'button' ? (rest.type ?? 'button') : rest.type)\n const describedBy = () => {\n const external = local['aria-describedby']\n if (!tooltipOpen() || !local.tooltip) return external\n const ids = new Set([...(external?.split(/\\s+/) ?? []), tooltipId].filter(Boolean))\n return [...ids].join(' ')\n }\n const deferred = createDeferredTooltip({\n enabled: () => !!local.tooltip,\n onPointerEnter: () => local.onPointerEnter,\n onFocus: () => local.onFocus,\n })\n // Spread `rest` itself, never a function's result: a spread call compiles to a memo\n // that reads every prop getter (children, leading, trailing), so each row would\n // rebuild its content whenever any value it reads changed, such as a list's selection.\n return (\n <>\n <ListRowControl\n as={rowAs()}\n {...(rest as unknown as ListRowControlProps<T>)}\n ref={(element: HTMLElement) => {\n deferred.ref(element)\n const forwarded = local.ref as unknown\n if (typeof forwarded === 'function') forwarded(element)\n }}\n type={rowType()}\n aria-describedby={describedBy()}\n onPointerEnter={deferred.onPointerEnter}\n onFocus={deferred.onFocus}\n />\n <Show when={deferred.armed() && local.tooltip}>\n {(tooltipSlot) => (\n <Tooltip open={tooltipOpen()} onOpenChange={setTooltipOpen}>\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId}>{tooltipSlot()}</TooltipContent>\n </Tooltip>\n )}\n </Show>\n </>\n )\n}\n\n/**\n * A group of rows with an optional heading and a scrolling body. The heading is\n * a plain label rather than a control: grouping is for reading, and a disclosure\n * on a list of five rows costs more attention than it saves.\n */\nexport function ListGroup(props: ComponentProps<'div'> & { label?: string; action?: JSX.Element }) {\n const local = props\n const rest = omit(props, 'class', 'label', 'action', 'children')\n return (\n <div data-slot=\"list-group\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <Show when={local.label}>\n {(labelSlot) => (\n <div class=\"group/list-header flex items-center gap-1 px-2 py-1\">\n <Text variant=\"overline\" class=\"min-w-0 flex-1 truncate\">\n {labelSlot()}\n </Text>\n <Show when={local.action}>\n {(actionSlot) => (\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100\">\n {actionSlot()}\n </span>\n )}\n </Show>\n </div>\n )}\n </Show>\n <div class=\"flex flex-col gap-0.5\">{local.children}</div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,QAA0C,OAAwB;CAGhF,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,MAAM,WAAW,oBAAoB,OAAO,kBAAkB,SAAS;CAChG,MAAM,CAAC,aAAa,kBAAkB,aAAa,KAAK;CACxD,MAAM,YAAY,oBAAoB,eAAe;CACrD,MAAM,wBAAwB,QAAQ,KAAK,OAAO;CAClD,MAAM,cAAe,MAAM,OAAO,gBAAgB,IAAI,WAAW;CACjE,MAAM,gBAAiB,MAAM,MAAM,WAAY,KAAK,QAAQ,WAAY,KAAK;CAC7E,MAAM,oBAAoB;EACxB,MAAM,WAAW,MAAM;EACvB,IAAI,CAAC,YAAY,KAAK,CAAC,MAAM,SAAS,OAAO;EAE7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AM,OAAO,KAAK,OAAO,SAAS,SAAS,UAAU,UAAU;CAE7D,IAAA,OAAA,OAkBK;CADH,IAAA,QAAA,KAAA;CAjB2EQ,OAAA,MAAA,CAAA;EAAxE,aAAA;EAAuB,IAAA,UAAA;GAAO,OAAA,GAAG,yBAAyB,MAAM,KAAK;EAAC;CAAU,GAAJ,IAAA,GAAA,IAAA;CAAjFC,OAAA,MACER,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAK;EAAvBA,WACI,qBACA;GAWK,IAAA,QAAA,QAAA;GAXL,IAAA,QAAA,MAAA;;GACEC,OAAAA,OAAAA,gBAAAA,MAAAA;IAAMC,SAAQ;IAAWC,OAAM;IAA/B,IAAA,WAAA;KACG,OAAA,UAAU;IACP;GAHRC,CAAAA,GAAAA,KAWK;GAXLI,OAAA,OAIEH,gBAAAA,MAAAA;IAAM,IAAA,OAAA;KAAM,OAAA,MAAM;IAAM;IAAxBA,WACI,sBACA;KAEM,IAAA,QAAA,QAAA;KAFNG,OAAA,OACG,UACG;KAFN,OAAA;IAEM,EAAA,CAAA;GAEJ,CAAA,GAVRJ,KAWK;GAXL,OAAA;EAWK,EAAA,CAAA;CAEH,CAAA,GAhBRE,KAkBK;CADHE,OAAA,aAAmC;EAAC,OAAA,MAAM;CAAQ,CAAM;CAlB5D,OACEF;AAoBJ"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import { className, createComponent, effect, insert, memo, mergeProps, readShallow, ref, template } from "@solidjs/web";
|
|
2
|
+
import { History as History$1, LoaderCircle as LoaderCircle$1 } from "@lucide/solid";
|
|
3
|
+
import { createEffect, createSignal, omit, onCleanup } from "solid-js";
|
|
1
4
|
import { cn } from "../../../lib/utils.js";
|
|
2
5
|
import { Button } from "../../ui/button/button.js";
|
|
3
6
|
import { ConversationSurface } from "../../conversation/conversation-surface.js";
|
|
4
7
|
import { anchorIds, captureAnchor, restoreAnchor } from "./scroll-anchor.js";
|
|
5
8
|
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
6
9
|
import { forwardRef } from "../../../lib/refs.js";
|
|
7
|
-
import { className, createComponent, effect, insert, memo, mergeProps, readShallow, ref, template } from "@solidjs/web";
|
|
8
|
-
import { History, LoaderCircle } from "@lucide/solid";
|
|
9
|
-
import { createEffect, createSignal, omit, onCleanup } from "solid-js";
|
|
10
10
|
// src/components/composites/message-scroller/message-scroller.tsx
|
|
11
11
|
var _tmpl$ = /* @__PURE__ */ template(`<div data-slot=message-scroller><p role=status class=sr-only>`);
|
|
12
12
|
var _tmpl$2 = /* @__PURE__ */ template(`<div data-slot=message-scroller-older class="flex justify-center py-2">`);
|
|
13
13
|
var _tmpl$3 = /* @__PURE__ */ template(`<p role=status class="flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground"><!><!>`);
|
|
14
|
-
var History
|
|
15
|
-
var LoaderCircle
|
|
14
|
+
var History = fastIcon(History$1);
|
|
15
|
+
var LoaderCircle = fastIcon(LoaderCircle$1);
|
|
16
16
|
/** How far from the top counts as "reached the top", in px. */
|
|
17
17
|
var TOP_MARGIN = 160;
|
|
18
18
|
function MessageScroller(props) {
|
|
@@ -169,7 +169,7 @@ function MessageScroller(props) {
|
|
|
169
169
|
var _el$4 = _tmpl$3();
|
|
170
170
|
var _el$5 = _el$4.firstChild;
|
|
171
171
|
var _el$6 = _el$5.nextSibling;
|
|
172
|
-
insert(_el$4, createComponent(LoaderCircle
|
|
172
|
+
insert(_el$4, createComponent(LoaderCircle, {
|
|
173
173
|
"aria-hidden": "true",
|
|
174
174
|
class: "size-3.5 motion-safe:animate-spin"
|
|
175
175
|
}), _el$5);
|
|
@@ -184,7 +184,7 @@ function MessageScroller(props) {
|
|
|
184
184
|
class: "gap-1.5 text-muted-foreground",
|
|
185
185
|
onClick: () => void load(true),
|
|
186
186
|
get children() {
|
|
187
|
-
return [createComponent(History
|
|
187
|
+
return [createComponent(History, { "aria-hidden": "true" }), memo(() => {
|
|
188
188
|
return local.olderLabel ?? "Load earlier messages";
|
|
189
189
|
})];
|
|
190
190
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-scroller.js","names":["<ConversationSurface\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n resetKey={local.resetKey}\n contentRef={(element) => {\n content = element\n }}\n onFollowHold={(hold) => {\n holdFollow = hold\n }}\n {...rest}\n ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}\n class=\"flex-1\"\n header={\n <>\n <Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>\n {local.header}\n </>\n }\n empty={local.empty}\n >\n {local.children}\n </ConversationSurface>","role=\"log\"","contentRef={(element) => {\n content = element\n }}","onFollowHold={(hold) => {\n holdFollow = hold\n }}","ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}","class=\"flex-1\"","<Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>","ref={watchTop()}","<LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />","class=\"size-3.5 motion-safe:animate-spin\"","<p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>","<Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>","type=\"button\"","variant=\"ghost\"","size=\"sm\"","class=\"gap-1.5 text-muted-foreground\"","onClick={() => void load(true)}","<History aria-hidden=\"true\" />","local.olderLabel ?? 'Load earlier messages'","{local.header}","<div\n class={cn('relative flex min-h-0 flex-1 flex-col', local.class)}\n data-slot=\"message-scroller\"\n >\n <ConversationSurface\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n resetKey={local.resetKey}\n contentRef={(element) => {\n content = element\n }}\n onFollowHold={(hold) => {\n holdFollow = hold\n }}\n {...rest}\n ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}\n class=\"flex-1\"\n header={\n <>\n <Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>\n {local.header}\n </>\n }\n empty={local.empty}\n >\n {local.children}\n </ConversationSurface>\n <p role=\"status\" class=\"sr-only\">\n {local.announcement}\n </p>\n </div>","History","LucideHistory","LoaderCircle","LucideLoaderCircle","_$readShallow"],"sources":["../../../../src/components/composites/message-scroller/message-scroller.tsx"],"sourcesContent":["import { History as LucideHistory, LoaderCircle as LucideLoaderCircle } from '@lucide/solid'\nimport { createEffect, onCleanup, Show, omit, createSignal } from 'solid-js'\nimport { type JSX } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { ConversationSurface, type ConversationSurfaceProps } from '../../conversation'\nimport { anchorIds, captureAnchor, restoreAnchor, type ScrollAnchor } from './scroll-anchor'\nimport { fastIcon } from '#lib/fast-icon'\nimport { forwardRef } from '#lib/refs'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst History = fastIcon(LucideHistory)\nconst LoaderCircle = fastIcon(LucideLoaderCircle)\n\n/**\n * MessageScroller.\n *\n * The thread. It owns the three scroll behaviours a chat gets wrong when each\n * is bolted on separately, and keeps them from fighting:\n *\n * 1. **Follow the reply only while the reader is at the bottom.** New and\n * streaming content scrolls into view when the reader is already at the end,\n * and never otherwise. Scrolling up parks the view; the \"Jump to latest\"\n * control brings it back. (This is `ConversationSurface`'s follow contract,\n * which this component wraps rather than reimplements.)\n * 2. **Load history without moving what the reader is looking at.** When the\n * reader reaches the top, `onLoadOlder` is asked for earlier turns. Turns\n * inserted *above* the viewport would normally push the visible content down\n * by exactly their height; here the first visible turn (found by\n * `data-anchor-id`, which `Message` sets from `anchorId`) is measured before\n * the load and put back to the same offset after it, on every layout change\n * until the load settles, so images and code blocks that size themselves\n * late do not jolt the view either. A \"Load earlier\" button is always present\n * while there is more, because the scroll trigger alone is unreachable to a\n * keyboard or switch user and fires nothing in a short pane.\n * 3. **Announce without flooding.** The scroller is a polite log, and a turn that\n * is still arriving marks itself `aria-busy`, so a screen reader waits for the\n * settled turn instead of reading every token. `announcement` is a separate\n * status region for the two moments that matter: a response starting and a\n * response finishing.\n *\n * What it does not own: which turns exist, their identity, or what \"older\"\n * means. The host passes children and a loader; a session switch is\n * `resetKey`, which re-arms follow and discards any in-flight anchor.\n */\nexport type MessageScrollerProps = Omit<ConversationSurfaceProps, 'header' | 'empty'> & {\n hasOlder?: boolean\n /** The host is loading earlier turns right now, whether or not this scroller asked. */\n loadingOlder?: boolean\n /**\n * Load earlier turns. The scroller preserves the reader's position across the\n * resulting insert whether the host resolves before or after rendering them. A\n * rejection is the host's to report: the control stays so the reader can retry.\n */\n onLoadOlder?: () => void | Promise<void>\n /** Words for the loader row; override for another language. */\n olderLabel?: string\n loadingOlderLabel?: string\n /** Rendered above the first turn, below the history control. */\n header?: JSX.Element\n empty?: JSX.Element\n /** A short sentence for the live status region (\"Assistant is responding\"). */\n announcement?: string\n}\n\n/** How far from the top counts as \"reached the top\", in px. */\nconst TOP_MARGIN = 160\n\nexport function MessageScroller(props: MessageScrollerProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'hasOlder',\n 'loadingOlder',\n 'onLoadOlder',\n 'olderLabel',\n 'loadingOlderLabel',\n 'header',\n 'empty',\n 'announcement',\n 'ref',\n 'resetKey',\n 'children'\n )\n let scroller: HTMLDivElement | undefined\n let content: HTMLDivElement | undefined\n // A load whose promise resolved while the host still reports `loadingOlder`: its\n // turns land when the host clears it, and the anchor is held until then.\n let afterHostLoad: (() => void) | undefined\n createEffect(\n () => local.loadingOlder,\n (loadingOlder) => {\n if (loadingOlder || !afterHostLoad) return\n const resume = afterHostLoad\n afterHostLoad = undefined\n resume()\n }\n )\n let holdFollow: (() => () => void) | undefined\n let epoch = 0\n // `loading` answers \"is a load running\" at once; the signal only drives the\n // view, and its reads lag a write until the next flush, so two load requests\n // in one tick (the observer and a press) would both see it false.\n let loading = false\n const [inFlight, setInFlightSignal] = createSignal(false)\n const setInFlight = (value: boolean) => {\n loading = value\n setInFlightSignal(value)\n }\n\n // While a load holds the reader's place, the browser's own scroll anchoring is\n // switched off: it moves the offset by the same insert, and the two corrections\n // would be added together.\n let nativeAnchoring: string | undefined\n const holdNativeAnchoring = () => {\n if (!scroller || nativeAnchoring !== undefined) return\n nativeAnchoring = scroller.style.overflowAnchor\n scroller.style.overflowAnchor = 'none'\n }\n const releaseNativeAnchoring = () => {\n if (scroller && nativeAnchoring !== undefined) scroller.style.overflowAnchor = nativeAnchoring\n nativeAnchoring = undefined\n }\n\n // A session switch invalidates a load that was started for the previous one.\n createEffect(\n () => local.resetKey,\n () => {\n epoch += 1\n afterHostLoad = undefined\n setInFlight(false)\n stopWatching()\n releaseNativeAnchoring()\n }\n )\n\n const settle = (\n anchor: ScrollAnchor | undefined,\n run: number,\n heightBefore: number,\n restoreFocus: boolean,\n releaseHold?: () => void\n ) => {\n const finish = () => {\n if (run !== epoch) return releaseHold?.()\n if (scroller) restoreAnchor(scroller, anchor)\n stopWatching()\n releaseNativeAnchoring()\n setInFlight(false)\n // The control that started the load was replaced by the loading line, which\n // takes focus with it. Put it back on the control (or the thread), so a\n // keyboard user is not dropped onto the page.\n if (restoreFocus && scroller && document.activeElement === document.body) {\n const again = scroller.querySelector<HTMLElement>(\n '[data-slot=\"message-scroller-older\"] button'\n )\n ;(again ?? scroller).focus({ preventScroll: true })\n }\n // Still at the top after a load that added content: keep going, so a\n // pane taller than one page of history fills without a second scroll.\n if (\n scroller &&\n local.hasOlder &&\n scroller.scrollTop < TOP_MARGIN &&\n scroller.scrollHeight > heightBefore\n )\n void load()\n releaseHold?.()\n }\n // Two frames: the first lets the host's insert commit, the second lets\n // late-sizing content (images, highlighted code) report its height.\n const afterInsert = () =>\n requestAnimationFrame(() =>\n requestAnimationFrame(() => {\n if (run !== epoch) return releaseHold?.()\n if (local.loadingOlder) afterHostLoad = afterInsert\n else finish()\n })\n )\n afterInsert()\n }\n\n let observer: MutationObserver | undefined\n let resizer: ResizeObserver | undefined\n let unfollow: (() => void) | undefined\n const stopWatching = () => {\n observer?.disconnect()\n resizer?.disconnect()\n unfollow?.()\n unfollow = undefined\n }\n const load = async (fromControl = false) => {\n if (!scroller || !local.onLoadOlder || !local.hasOlder || local.loadingOlder || loading) return\n const run = epoch\n const anchor = captureAnchor(scroller, anchorIds(scroller))\n const heightBefore = scroller.scrollHeight\n const restoreFocus =\n fromControl && document.activeElement?.closest('[data-slot=\"message-scroller-older\"]') != null\n setInFlight(true)\n holdNativeAnchoring()\n // Every layout change while the load is open re-pins the anchor *before\n // paint*, which is what makes the insert invisible.\n stopWatching()\n observer = new MutationObserver(() => {\n if (run === epoch && scroller) restoreAnchor(scroller, anchor)\n })\n observer.observe(scroller, { childList: true, subtree: true })\n // Turns that size themselves late (`content-visibility`, images, highlighted code)\n // move the anchor without adding or removing a node, and with the browser's own\n // anchoring held off nothing else would carry the reader through that.\n if (content && typeof ResizeObserver !== 'undefined') {\n resizer = new ResizeObserver(() => {\n if (run === epoch && scroller) restoreAnchor(scroller, anchor)\n })\n resizer.observe(content)\n }\n // The reader may carry on scrolling while the host answers. A restore re-takes the\n // anchor on the turn they have come to, whichever of the observers or this event\n // reaches it first.\n const follow = () => {\n if (run === epoch && scroller) restoreAnchor(scroller, anchor)\n }\n scroller.addEventListener('scroll', follow, { passive: true })\n const watched = scroller\n unfollow = () => watched.removeEventListener('scroll', follow)\n await Promise.resolve(local.onLoadOlder()).catch(() => undefined)\n // A load that outlived its conversation inserts into a thread whose reader it knows\n // nothing about, and the anchor it held is gone. What it does to the layout (rows\n // taking their height, a clamp, the insert itself) is not the reader scrolling, so the\n // follow position is held until the two frames the insert needs have passed.\n settle(anchor, run, heightBefore, restoreFocus, run !== epoch ? holdFollow?.() : undefined)\n }\n\n onCleanup(() => {\n epoch += 1\n stopWatching()\n releaseNativeAnchoring()\n })\n\n // A ref factory: the cleanup is registered by the owner that builds the row,\n // since a ref callback itself cannot own one.\n const watchTop = () => {\n let io: IntersectionObserver | undefined\n onCleanup(() => io?.disconnect())\n return (element: HTMLDivElement) => {\n if (typeof IntersectionObserver === 'undefined') return\n io = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) void load()\n },\n { root: scroller ?? null, rootMargin: `${TOP_MARGIN}px 0px 0px 0px` }\n )\n io.observe(element)\n }\n }\n\n return (\n <div\n class={cn('relative flex min-h-0 flex-1 flex-col', local.class)}\n data-slot=\"message-scroller\"\n >\n <ConversationSurface\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n resetKey={local.resetKey}\n contentRef={(element) => {\n content = element\n }}\n onFollowHold={(hold) => {\n holdFollow = hold\n }}\n {...rest}\n ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}\n class=\"flex-1\"\n header={\n <>\n <Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>\n {local.header}\n </>\n }\n empty={local.empty}\n >\n {local.children}\n </ConversationSurface>\n <p role=\"status\" class=\"sr-only\">\n {local.announcement}\n </p>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAMqB,YAAU,SAASC,OAAa;AACtC,IAAMC,iBAAe,SAASC,YAAkB;;AAsDhD,IAAM,aAAa;AAEnB,SAAgB,gBAAgB,OAA6B;CAC3D,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,YACA,gBACA,eACA,cACA,qBACA,UACA,SACA,gBACA,OACA,YACA,UACF;CACA,IAAI;CACJ,IAAI;CAGJ,IAAI;CACJ,mBACQ,MAAM,eACX,iBAAiB;EAChB,IAAI,gBAAgB,CAAC,eAAe;EACpC,MAAM,SAAS;EACf,gBAAgB,KAAA;EAChB,OAAO;CACT,CACF;CACA,IAAI;CACJ,IAAI,QAAQ;CAIZ,IAAI,UAAU;CACd,MAAM,CAAC,UAAU,qBAAqB,aAAa,KAAK;CACxD,MAAM,eAAe,UAAmB;EACtC,UAAU;EACV,kBAAkB,KAAK;CACzB;CAKA,IAAI;CACJ,MAAM,4BAA4B;EAChC,IAAI,CAAC,YAAY,oBAAoB,KAAA,GAAW;EAChD,kBAAkB,SAAS,MAAM;EACjC,SAAS,MAAM,iBAAiB;CAClC;CACA,MAAM,+BAA+B;EACnC,IAAI,YAAY,oBAAoB,KAAA,GAAW,SAAS,MAAM,iBAAiB;EAC/E,kBAAkB,KAAA;CACpB;CAGA,mBACQ,MAAM,gBACN;EACJ,SAAS;EACT,gBAAgB,KAAA;EAChB,YAAY,KAAK;EACjB,aAAa;EACb,uBAAuB;CACzB,CACF;CAEA,MAAM,UACJ,QACA,KACA,cACA,cACA,gBACG;EACH,MAAM,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={local.resetKey}\n contentRef={(element) => {\n content = element\n }}\n onFollowHold={(hold) => {\n holdFollow = hold\n }}\n {...rest}\n ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}\n class=\"flex-1\"\n header={\n <>\n <Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>\n {local.header}\n </>\n }\n empty={local.empty}\n >\n {local.children}\n </ConversationSurface>","role=\"log\"","contentRef={(element) => {\n content = element\n }}","onFollowHold={(hold) => {\n holdFollow = hold\n }}","ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}","class=\"flex-1\"","<Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>","ref={watchTop()}","<LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />","class=\"size-3.5 motion-safe:animate-spin\"","<p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>","<Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>","type=\"button\"","variant=\"ghost\"","size=\"sm\"","class=\"gap-1.5 text-muted-foreground\"","onClick={() => void load(true)}","<History aria-hidden=\"true\" />","local.olderLabel ?? 'Load earlier messages'","{local.header}","<div\n class={cn('relative flex min-h-0 flex-1 flex-col', local.class)}\n data-slot=\"message-scroller\"\n >\n <ConversationSurface\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n resetKey={local.resetKey}\n contentRef={(element) => {\n content = element\n }}\n onFollowHold={(hold) => {\n holdFollow = hold\n }}\n {...rest}\n ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}\n class=\"flex-1\"\n header={\n <>\n <Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>\n {local.header}\n </>\n }\n empty={local.empty}\n >\n {local.children}\n </ConversationSurface>\n <p role=\"status\" class=\"sr-only\">\n {local.announcement}\n </p>\n </div>","LucideHistory","LucideLoaderCircle","_$insert","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/composites/message-scroller/message-scroller.tsx"],"sourcesContent":["import { History as LucideHistory, LoaderCircle as LucideLoaderCircle } from '@lucide/solid'\nimport { createEffect, onCleanup, Show, omit, createSignal } from 'solid-js'\nimport { type JSX } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { ConversationSurface, type ConversationSurfaceProps } from '../../conversation'\nimport { anchorIds, captureAnchor, restoreAnchor, type ScrollAnchor } from './scroll-anchor'\nimport { fastIcon } from '#lib/fast-icon'\nimport { forwardRef } from '#lib/refs'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst History = fastIcon(LucideHistory)\nconst LoaderCircle = fastIcon(LucideLoaderCircle)\n\n/**\n * MessageScroller.\n *\n * The thread. It owns the three scroll behaviours a chat gets wrong when each\n * is bolted on separately, and keeps them from fighting:\n *\n * 1. **Follow the reply only while the reader is at the bottom.** New and\n * streaming content scrolls into view when the reader is already at the end,\n * and never otherwise. Scrolling up parks the view; the \"Jump to latest\"\n * control brings it back. (This is `ConversationSurface`'s follow contract,\n * which this component wraps rather than reimplements.)\n * 2. **Load history without moving what the reader is looking at.** When the\n * reader reaches the top, `onLoadOlder` is asked for earlier turns. Turns\n * inserted *above* the viewport would normally push the visible content down\n * by exactly their height; here the first visible turn (found by\n * `data-anchor-id`, which `Message` sets from `anchorId`) is measured before\n * the load and put back to the same offset after it, on every layout change\n * until the load settles, so images and code blocks that size themselves\n * late do not jolt the view either. A \"Load earlier\" button is always present\n * while there is more, because the scroll trigger alone is unreachable to a\n * keyboard or switch user and fires nothing in a short pane.\n * 3. **Announce without flooding.** The scroller is a polite log, and a turn that\n * is still arriving marks itself `aria-busy`, so a screen reader waits for the\n * settled turn instead of reading every token. `announcement` is a separate\n * status region for the two moments that matter: a response starting and a\n * response finishing.\n *\n * What it does not own: which turns exist, their identity, or what \"older\"\n * means. The host passes children and a loader; a session switch is\n * `resetKey`, which re-arms follow and discards any in-flight anchor.\n */\nexport type MessageScrollerProps = Omit<ConversationSurfaceProps, 'header' | 'empty'> & {\n hasOlder?: boolean\n /** The host is loading earlier turns right now, whether or not this scroller asked. */\n loadingOlder?: boolean\n /**\n * Load earlier turns. The scroller preserves the reader's position across the\n * resulting insert whether the host resolves before or after rendering them. A\n * rejection is the host's to report: the control stays so the reader can retry.\n */\n onLoadOlder?: () => void | Promise<void>\n /** Words for the loader row; override for another language. */\n olderLabel?: string\n loadingOlderLabel?: string\n /** Rendered above the first turn, below the history control. */\n header?: JSX.Element\n empty?: JSX.Element\n /** A short sentence for the live status region (\"Assistant is responding\"). */\n announcement?: string\n}\n\n/** How far from the top counts as \"reached the top\", in px. */\nconst TOP_MARGIN = 160\n\nexport function MessageScroller(props: MessageScrollerProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'hasOlder',\n 'loadingOlder',\n 'onLoadOlder',\n 'olderLabel',\n 'loadingOlderLabel',\n 'header',\n 'empty',\n 'announcement',\n 'ref',\n 'resetKey',\n 'children'\n )\n let scroller: HTMLDivElement | undefined\n let content: HTMLDivElement | undefined\n // A load whose promise resolved while the host still reports `loadingOlder`: its\n // turns land when the host clears it, and the anchor is held until then.\n let afterHostLoad: (() => void) | undefined\n createEffect(\n () => local.loadingOlder,\n (loadingOlder) => {\n if (loadingOlder || !afterHostLoad) return\n const resume = afterHostLoad\n afterHostLoad = undefined\n resume()\n }\n )\n let holdFollow: (() => () => void) | undefined\n let epoch = 0\n // `loading` answers \"is a load running\" at once; the signal only drives the\n // view, and its reads lag a write until the next flush, so two load requests\n // in one tick (the observer and a press) would both see it false.\n let loading = false\n const [inFlight, setInFlightSignal] = createSignal(false)\n const setInFlight = (value: boolean) => {\n loading = value\n setInFlightSignal(value)\n }\n\n // While a load holds the reader's place, the browser's own scroll anchoring is\n // switched off: it moves the offset by the same insert, and the two corrections\n // would be added together.\n let nativeAnchoring: string | undefined\n const holdNativeAnchoring = () => {\n if (!scroller || nativeAnchoring !== undefined) return\n nativeAnchoring = scroller.style.overflowAnchor\n scroller.style.overflowAnchor = 'none'\n }\n const releaseNativeAnchoring = () => {\n if (scroller && nativeAnchoring !== undefined) scroller.style.overflowAnchor = nativeAnchoring\n nativeAnchoring = undefined\n }\n\n // A session switch invalidates a load that was started for the previous one.\n createEffect(\n () => local.resetKey,\n () => {\n epoch += 1\n afterHostLoad = undefined\n setInFlight(false)\n stopWatching()\n releaseNativeAnchoring()\n }\n )\n\n const settle = (\n anchor: ScrollAnchor | undefined,\n run: number,\n heightBefore: number,\n restoreFocus: boolean,\n releaseHold?: () => void\n ) => {\n const finish = () => {\n if (run !== epoch) return releaseHold?.()\n if (scroller) restoreAnchor(scroller, anchor)\n stopWatching()\n releaseNativeAnchoring()\n setInFlight(false)\n // The control that started the load was replaced by the loading line, which\n // takes focus with it. Put it back on the control (or the thread), so a\n // keyboard user is not dropped onto the page.\n if (restoreFocus && scroller && document.activeElement === document.body) {\n const again = scroller.querySelector<HTMLElement>(\n '[data-slot=\"message-scroller-older\"] button'\n )\n ;(again ?? scroller).focus({ preventScroll: true })\n }\n // Still at the top after a load that added content: keep going, so a\n // pane taller than one page of history fills without a second scroll.\n if (\n scroller &&\n local.hasOlder &&\n scroller.scrollTop < TOP_MARGIN &&\n scroller.scrollHeight > heightBefore\n )\n void load()\n releaseHold?.()\n }\n // Two frames: the first lets the host's insert commit, the second lets\n // late-sizing content (images, highlighted code) report its height.\n const afterInsert = () =>\n requestAnimationFrame(() =>\n requestAnimationFrame(() => {\n if (run !== epoch) return releaseHold?.()\n if (local.loadingOlder) afterHostLoad = afterInsert\n else finish()\n })\n )\n afterInsert()\n }\n\n let observer: MutationObserver | undefined\n let resizer: ResizeObserver | undefined\n let unfollow: (() => void) | undefined\n const stopWatching = () => {\n observer?.disconnect()\n resizer?.disconnect()\n unfollow?.()\n unfollow = undefined\n }\n const load = async (fromControl = false) => {\n if (!scroller || !local.onLoadOlder || !local.hasOlder || local.loadingOlder || loading) return\n const run = epoch\n const anchor = captureAnchor(scroller, anchorIds(scroller))\n const heightBefore = scroller.scrollHeight\n const restoreFocus =\n fromControl && document.activeElement?.closest('[data-slot=\"message-scroller-older\"]') != null\n setInFlight(true)\n holdNativeAnchoring()\n // Every layout change while the load is open re-pins the anchor *before\n // paint*, which is what makes the insert invisible.\n stopWatching()\n observer = new MutationObserver(() => {\n if (run === epoch && scroller) restoreAnchor(scroller, anchor)\n })\n observer.observe(scroller, { childList: true, subtree: true })\n // Turns that size themselves late (`content-visibility`, images, highlighted code)\n // move the anchor without adding or removing a node, and with the browser's own\n // anchoring held off nothing else would carry the reader through that.\n if (content && typeof ResizeObserver !== 'undefined') {\n resizer = new ResizeObserver(() => {\n if (run === epoch && scroller) restoreAnchor(scroller, anchor)\n })\n resizer.observe(content)\n }\n // The reader may carry on scrolling while the host answers. A restore re-takes the\n // anchor on the turn they have come to, whichever of the observers or this event\n // reaches it first.\n const follow = () => {\n if (run === epoch && scroller) restoreAnchor(scroller, anchor)\n }\n scroller.addEventListener('scroll', follow, { passive: true })\n const watched = scroller\n unfollow = () => watched.removeEventListener('scroll', follow)\n await Promise.resolve(local.onLoadOlder()).catch(() => undefined)\n // A load that outlived its conversation inserts into a thread whose reader it knows\n // nothing about, and the anchor it held is gone. What it does to the layout (rows\n // taking their height, a clamp, the insert itself) is not the reader scrolling, so the\n // follow position is held until the two frames the insert needs have passed.\n settle(anchor, run, heightBefore, restoreFocus, run !== epoch ? holdFollow?.() : undefined)\n }\n\n onCleanup(() => {\n epoch += 1\n stopWatching()\n releaseNativeAnchoring()\n })\n\n // A ref factory: the cleanup is registered by the owner that builds the row,\n // since a ref callback itself cannot own one.\n const watchTop = () => {\n let io: IntersectionObserver | undefined\n onCleanup(() => io?.disconnect())\n return (element: HTMLDivElement) => {\n if (typeof IntersectionObserver === 'undefined') return\n io = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) void load()\n },\n { root: scroller ?? null, rootMargin: `${TOP_MARGIN}px 0px 0px 0px` }\n )\n io.observe(element)\n }\n }\n\n return (\n <div\n class={cn('relative flex min-h-0 flex-1 flex-col', local.class)}\n data-slot=\"message-scroller\"\n >\n <ConversationSurface\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n resetKey={local.resetKey}\n contentRef={(element) => {\n content = element\n }}\n onFollowHold={(hold) => {\n holdFollow = hold\n }}\n {...rest}\n ref={(element) => {\n scroller = element\n forwardRef(() => local.ref, element)\n }}\n class=\"flex-1\"\n header={\n <>\n <Show when={local.hasOlder || local.loadingOlder}>\n <div\n ref={watchTop()}\n data-slot=\"message-scroller-older\"\n class=\"flex justify-center py-2\"\n >\n <Show\n when={local.loadingOlder || inFlight()}\n fallback={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n class=\"gap-1.5 text-muted-foreground\"\n onClick={() => void load(true)}\n >\n <History aria-hidden=\"true\" />\n {local.olderLabel ?? 'Load earlier messages'}\n </Button>\n }\n >\n <p\n role=\"status\"\n // The button's own height: swapping one for the other must not move\n // the turns below it by even a pixel while the anchor is being held.\n class=\"flex h-control-sm items-center gap-1.5 text-xs text-muted-foreground\"\n >\n <LoaderCircle aria-hidden=\"true\" class=\"size-3.5 motion-safe:animate-spin\" />\n {local.loadingOlderLabel ?? 'Loading earlier messages…'}\n </p>\n </Show>\n </div>\n </Show>\n {local.header}\n </>\n }\n empty={local.empty}\n >\n {local.children}\n </ConversationSurface>\n <p role=\"status\" class=\"sr-only\">\n {local.announcement}\n </p>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAM,UAAU,SAASqB,SAAa;AACtC,IAAM,eAAe,SAASC,cAAkB;;AAsDhD,IAAM,aAAa;AAEnB,SAAgB,gBAAgB,OAA6B;CAC3D,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,YACA,gBACA,eACA,cACA,qBACA,UACA,SACA,gBACA,OACA,YACA,UACF;CACA,IAAI;CACJ,IAAI;CAGJ,IAAI;CACJ,mBACQ,MAAM,eACX,iBAAiB;EAChB,IAAI,gBAAgB,CAAC,eAAe;EACpC,MAAM,SAAS;EACf,gBAAgB,KAAA;EAChB,OAAO;CACT,CACF;CACA,IAAI;CACJ,IAAI,QAAQ;CAIZ,IAAI,UAAU;CACd,MAAM,CAAC,UAAU,qBAAqB,aAAa,KAAK;CACxD,MAAM,eAAe,UAAmB;EACtC,UAAU;EACV,kBAAkB,KAAK;CACzB;CAKA,IAAI;CACJ,MAAM,4BAA4B;EAChC,IAAI,CAAC,YAAY,oBAAoB,KAAA,GAAW;EAChD,kBAAkB,SAAS,MAAM;EACjC,SAAS,MAAM,iBAAiB;CAClC;CACA,MAAM,+BAA+B;EACnC,IAAI,YAAY,oBAAoB,KAAA,GAAW,SAAS,MAAM,iBAAiB;EAC/E,kBAAkB,KAAA;CACpB;CAGA,mBACQ,MAAM,gBACN;EACJ,SAAS;EACT,gBAAgB,KAAA;EAChB,YAAY,KAAK;EACjB,aAAa;EACb,uBAAuB;CACzB,CACF;CAEA,MAAM,UACJ,QACA,KACA,cACA,cACA,gBACG;EACH,MAAM,eAAe;GACnB,IAAI,QAAQ,OAAO,OAAO,cAAc;GACxC,IAAI,UAAU,cAAc,UAAU,MAAM;GAC5C,aAAa;GACb,uBAAuB;GACvB,YAAY,KAAK;GAIjB,IAAI,gBAAgB,YAAY,SAAS,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