import { type SuggestionOptions } from '@tiptap/suggestion'; import { type SuggestionMenuRow, type SuggestionMenuSection } from './SuggestionMenu'; /** * Open, or closed less than 100ms ago — what an Enter handler asks. Choosing a * row with Enter closes the list, and that same Enter must not also send. */ export declare function isSuggestionActive(): boolean; /** * Open *now*, with no grace period — what an Escape handler asks. The first * Escape closes the list, the second is somebody's deliberate press. */ export declare function isSuggestionOpen(): boolean; /** How a list looks and what fills it — everything but the editor's own wiring. */ export interface SuggestionPopupOptions { /** Names the list — "Commands", "People". */ ariaLabel: string; /** The box's width, e.g. `w-[300px]`. */ width: string; /** The cap before the rows scroll, e.g. `max-h-[400px]`. */ maxHeight: string; /** The plugin's items, and the typed query, → the sections to draw. One unlabeled section by default. */ sections?: (items: T[], query: string) => readonly SuggestionMenuSection[]; itemKey: (item: T) => string; row: (item: T) => SuggestionMenuRow; /** * With `refresh`: called with a listener while the list is open; the app * calls it when its data has changed (a search landing), and the open list is * drawn again for the same query. Returns the unsubscribe, run when the list * closes however it closes. */ subscribe?: (listener: () => void) => () => void; /** The items for a query, as the plugin's `items` answers — asked again when `subscribe` fires. */ refresh?: (query: string) => T[]; } /** * The `render` of a Tiptap suggestion plugin, drawn as a `SuggestionMenu` — * the popup controller Peek wrote four times (`mention.tsx`, `slashCommands.tsx`), * once. * * Suggestion({ editor, char: '/', items, command, * render: suggestionPopup({ ariaLabel: 'Commands', width: 'w-[300px]', * maxHeight: 'max-h-[400px]', itemKey, row, sections }) }) * * It mounts the list when the query starts and removes it when it ends: the * plugin owns the list's life. Escape closes it and is used up; ↑, ↓ and Enter * go to the list; every other key stays the editor's. The list portals itself * (the package `Popover`), so the mount point is only a mount point. */ export declare function suggestionPopup(options: SuggestionPopupOptions): NonNullable['render']>; //# sourceMappingURL=suggestionPopup.d.ts.map