import { LitElement, TemplateResult, CSSResult } from 'lit'; import { Thread } from '../types/index.js'; declare global { interface HTMLElementTagNameMap { 'forge-ai-threads-search': AiThreadsSearchComponent; } interface HTMLElementEventMap { 'forge-ai-threads-search-query': CustomEvent; 'forge-ai-threads-search-load-more': CustomEvent; 'forge-ai-threads-search-select': CustomEvent; 'forge-ai-threads-search-new-chat': CustomEvent; 'forge-ai-threads-search-rename': CustomEvent; 'forge-ai-threads-search-delete': CustomEvent; 'forge-ai-threads-search-delete-confirm': CustomEvent; 'forge-ai-threads-search-back': CustomEvent; 'forge-ai-threads-search-retry': CustomEvent; } } export interface ForgeAiThreadsSearchQueryEventData { query: string; setResults: (results: Thread[]) => void; } export interface ForgeAiThreadsSearchLoadMoreEventData { query: string; appendResults: (results: Thread[]) => void; } export interface ForgeAiThreadsSearchSelectEventData { id: string; title: string; } export interface ForgeAiThreadsSearchRenameEventData { id: string; oldTitle: string; newTitle: string; onSuccess: () => void; onError: (error?: string) => void; } export interface ForgeAiThreadsSearchDeleteEventData { id: string; thread: Thread; onSuccess: () => void; onError: (error?: string) => void; } export interface ForgeAiThreadsSearchDeleteConfirmEventData { thread: Thread; } export declare const AiThreadsSearchComponentTagName: keyof HTMLElementTagNameMap; /** * @tag forge-ai-threads-search * * @slot header-actions - Slot for a persistent action pinned to the top-right of the header, alongside the "New chat" button (e.g. a "View all" button). * * @event {CustomEvent} forge-ai-threads-search-query - Fired when search query changes (debounced). * @event {CustomEvent} forge-ai-threads-search-load-more - Fired when the user scrolls near the bottom or clicks "Load more" for pagination. * @event {CustomEvent} forge-ai-threads-search-select - Fired when a thread is selected. * @event {CustomEvent} forge-ai-threads-search-new-chat - Fired when new chat button clicked. * @event {CustomEvent} forge-ai-threads-search-rename - Fired when thread renamed. Cancelable - if prevented, call onSuccess() to commit or onError() to revert. * @event {CustomEvent} forge-ai-threads-search-delete - Fired when thread delete confirmed. Cancelable - if prevented, call onSuccess() to commit deletion or onError() to revert. * @event {CustomEvent} forge-ai-threads-search-delete-confirm - Fired before showing the built-in delete confirmation. Cancelable - if prevented, this component shows no confirmation UI; the host must show its own and call confirmThreadDelete() once accepted. * @event {CustomEvent} forge-ai-threads-search-back - Fired when the back button (shown via showBackButton) is clicked. * @event {CustomEvent} forge-ai-threads-search-retry - Fired when the retry button in the error state is clicked. The host should re-request the threads and clear errorMessage once the load succeeds. * * @description A standalone search component for conversations/threads. Supports both local and external/async search patterns via event callbacks. * Optional rename and delete actions can be enabled via properties. */ export declare class AiThreadsSearchComponent extends LitElement { #private; static styles: CSSResult; threads: Thread[]; /** * The title text shown in the header. */ headerTitle: string; /** * Whether to show the "New chat" button in the header. */ showNewChatButton: boolean; /** * Whether to show a back button before the header title. */ showBackButton: boolean; /** * Whether to show the search field. */ showSearch: boolean; /** * Total number of threads available. When set to a positive number and fewer threads * are loaded than the total, infinite scroll is enabled. Leave at 0 (default) to disable * infinite scroll entirely. Useful when all data is loaded upfront. */ totalChats: number; /** * Placeholder text for the search input. The input's aria-label is "Search" - avoid reusing * that word here so screen readers don't announce the same word twice. */ placeholder: string; /** * Message describing a failed thread load. When no threads are loaded, an error banner with a * retry button replaces the empty state. When threads are already on screen the list stays visible * and the message shows as a compact single line with a retry - at the bottom of the list if a page * was in flight, otherwise above it. The host owns this value and should clear it once a load succeeds. */ errorMessage?: string; showThreadRename: boolean; showThreadDelete: boolean; /** * The id of the currently selected/active thread, highlighted in the list. */ selectedThreadId: string | null; private _resultsContainer; private _searchInput?; private _searchQuery; private _isSearching; private _searchResults; private _editingThreadId; private _hiddenThreadIds; private _openMenuThreadId; private _searchTimeout?; firstUpdated(): void; updated(changedProperties: Map): void; disconnectedCallback(): void; /** * Completes a delete that a host intercepted via `forge-ai-threads-search-delete-confirm` * (calling preventDefault() to show its own confirmation instead of this component's * built-in one). Call once the host's own confirmation has been accepted. */ confirmThreadDelete(thread: Thread): void; /** * Discards the current query and its results so the list shows every loaded chat again. * Dispatches no search event and moves no focus, so a host may call it on a surface that is * currently hidden (e.g. a popover that stays mounted between opens). */ resetSearch(): void; /** * Moves focus into the component: the search input when shown, otherwise the first chat in * the list, otherwise the first header button. */ focus(): void; render(): TemplateResult; }