import { Disposable, IDisposable } from "../../../../../../base/common/lifecycle.js"; /** * The kinds of content competing for the space directly above a chat input, in * precedence order. Lower wins, so the lowest claimed lane is the one leading. */ export declare enum ChatInputNoticeLane { /** Quota, promo, permission and extension-provided notifications. */ Notification = 0, /** Voice and dictation introductions. */ Onboarding = 1, /** Getting-started tips. Always yields to anything else. */ Tip = 2 } /** A notice keyboard focus can be moved into and back out of. */ export interface IChatInputNoticeFocusTarget { hasFocus(): boolean; focus(): void; /** * Whether there is anything to focus yet. Claims can be held before their * content exists, and focus must not be reported as handled in that window. */ canFocus?(): boolean; } /** One chat input, as seen by anything that has to pick between several. */ export interface IChatInputSurface { readonly focusRoot: HTMLElement; lastFocused: number; } /** * Keeps `surface.lastFocused` current. Shared so everything ranking chat inputs * measures recency the same way. */ export declare function trackChatInputRecency(surface: IChatInputSurface): IDisposable; /** * The chat input the user is most plausibly working in: the focused one if there * is one, otherwise the most recently focused. Only inputs that are on screen in * the active window are considered, so content is never docked to - and focus * never jumps to - an input in a background window. * * `isEligible` narrows the field further for callers that need something more * from the input than that it is usable. */ export declare function pickActiveChatInput(surfaces: Iterable, isEligible?: (surface: T) => boolean): T | undefined; export interface IChatInputNoticeClaimOptions { /** How to move keyboard focus into this notice while it is on screen. */ readonly focusTarget?: IChatInputNoticeFocusTarget; /** * Called when this claim starts or stops being the notice on screen. A claim * is held while standing down, so content put away for something with higher * precedence - or for a newer notice in its own lane - comes back on its own. */ readonly onDidChangeLeading?: (leading: boolean) => void; } /** * Tracks which kinds of notice occupy the area above a single chat input so * lower-precedence content can stand down, instead of each producer reaching * into its siblings' DOM. * * Exactly one claim leads at a time: the newest claim in the lowest occupied * lane. Everything else stands down but keeps its claim, so precedence between * categories and recency within a category are the same mechanism. */ export declare class ChatInputNoticeHost extends Disposable { private readonly _focusInput; private readonly _claims; private readonly _leases; /** The claim currently announced as being on screen. */ private _leadingClaim; private _notifying; private _isDisposed; /** Identifies the current `setOccupied` call, so stale leases are not stored. */ private _leaseToken; constructor(_focusInput: () => void); /** * Claim `lane` until the returned disposable is disposed. Claims are counted, * so producers sharing a lane do not release each other. */ occupy(lane: ChatInputNoticeLane, options?: IChatInputNoticeClaimOptions): IDisposable; /** Claim or release `lane` on behalf of a producer that reports visibility. */ setOccupied(lane: ChatInputNoticeLane, occupied: boolean, focusTarget?: IChatInputNoticeFocusTarget): void; /** * Moves focus into the notice currently showing, or back to the input when it * already has focus. Returns false when there is nothing to focus. */ toggleFocus(): boolean; /** * Whether focus can actually be moved into the notice leading here, so a * caller choosing between hosts never settles on one that would do nothing. * Only the leading claim counts, so focus can never land on a notice that * something else has put away. */ hasFocusableNotice(): boolean; /** * Brings the announced leader in line with the claims actually held. * * Standing down is a real side effect - it moves focus and hides DOM - so a * callback can change who owns the space while this is still running. State * is therefore re-read after every single notification rather than captured * up front, so a leader that has since been replaced is never announced. */ private _notifyLeading; /** * Tells `claim` it is no longer the notice on screen, and keeps keyboard focus * out of the void. * * Standing down is not the producer's decision - the space is being taken for * something else - so a producer that had focus is about to hide content that * holds it. Leaving focus on `` would also drop the context keys the chat * keybindings depend on, so it returns to the input here rather than in every * producer that can be displaced. The incoming notice is announced, not focused, * so the input is always the right destination. */ private _standDown; dispose(): void; }