import * as dom from "../../../../base/browser/dom.js"; import { ReplaceInput } from "../../../../base/browser/ui/findinput/replaceInput.js"; import { IInputBoxStyles, InputBox } from "../../../../base/browser/ui/inputbox/inputBox.js"; import { Widget } from "../../../../base/browser/ui/widget.js"; import { Event } from "../../../../base/common/event.js"; import { IClipboardService } from "../../../../platform/clipboard/common/clipboardService.service.js"; import { IConfigurationService } from "../../../../platform/configuration/common/configuration.service.js"; import { IContextKeyService } from "../../../../platform/contextkey/common/contextkey.service.js"; import { IContextMenuService } from "../../../../platform/contextview/browser/contextView.service.js"; import { IContextViewService } from "../../../../platform/contextview/browser/contextView.service.js"; import { IKeybindingService } from "../../../../platform/keybinding/common/keybinding.service.js"; import { IAccessibilityService } from "../../../../platform/accessibility/common/accessibility.service.js"; import { IToggleStyles } from "../../../../base/browser/ui/toggle/toggle.js"; import { NotebookFindFilters } from "../../notebook/browser/contrib/find/findFilters.js"; import { IInstantiationService } from "../../../../platform/instantiation/common/instantiation.js"; import { IEditorService } from "../../../services/editor/common/editorService.service.js"; import { SearchFindInput } from "./searchFindInput.js"; export interface ISearchWidgetOptions { value?: string; replaceValue?: string; isRegex?: boolean; isCaseSensitive?: boolean; isWholeWords?: boolean; searchHistory?: string[]; replaceHistory?: string[]; preserveCase?: boolean; _hideReplaceToggle?: boolean; showContextToggle?: boolean; inputBoxStyles: IInputBoxStyles; toggleStyles: IToggleStyles; notebookOptions?: NotebookToggleState; } interface NotebookToggleState { isInNotebookMarkdownInput: boolean; isInNotebookMarkdownPreview: boolean; isInNotebookCellInput: boolean; isInNotebookCellOutput: boolean; } export declare class SearchWidget extends Widget { private readonly contextViewService; private readonly contextKeyService; private readonly keybindingService; private readonly clipboardServce; private readonly configurationService; private readonly accessibilityService; private readonly contextMenuService; private readonly instantiationService; private readonly editorService; private static readonly INPUT_MAX_HEIGHT; private static readonly REPLACE_ALL_DISABLED_LABEL; private static readonly REPLACE_ALL_ENABLED_LABEL; domNode: HTMLElement | undefined; searchInput: SearchFindInput | undefined; searchInputFocusTracker: dom.IFocusTracker | undefined; private searchInputBoxFocused; private replaceContainer; replaceInput: ReplaceInput | undefined; replaceInputFocusTracker: dom.IFocusTracker | undefined; private replaceInputBoxFocused; private toggleReplaceButton; private replaceAllAction; private replaceActive; private replaceActionBar; private _replaceHistoryDelayer; private ignoreGlobalFindBufferOnNextFocus; private previousGlobalFindBufferValue; /** * Tracks whether the accessibility help hint has been announced in the ARIA label. * Reset when the widget loses focus, allowing the hint to be announced again * on the next focus. */ private _accessibilityHelpHintAnnounced; private _labelResetTimeout; private _onSearchSubmit; readonly onSearchSubmit: Event<{ triggeredOnType: boolean; delay: number; }>; private _onSearchCancel; readonly onSearchCancel: Event<{ focus: boolean; }>; private _onReplaceToggled; readonly onReplaceToggled: Event; private _onReplaceStateChange; readonly onReplaceStateChange: Event; private _onPreserveCaseChange; readonly onPreserveCaseChange: Event; private _onReplaceValueChanged; readonly onReplaceValueChanged: Event; private _onReplaceAll; readonly onReplaceAll: Event; private _onBlur; readonly onBlur: Event; private _onDidHeightChange; readonly onDidHeightChange: Event; private readonly _onDidToggleContext; readonly onDidToggleContext: Event; private showContextToggle; contextLinesInput: InputBox; private _notebookFilters; private readonly _toggleReplaceButtonListener; constructor(container: HTMLElement, options: ISearchWidgetOptions, contextViewService: IContextViewService, contextKeyService: IContextKeyService, keybindingService: IKeybindingService, clipboardServce: IClipboardService, configurationService: IConfigurationService, accessibilityService: IAccessibilityService, contextMenuService: IContextMenuService, instantiationService: IInstantiationService, editorService: IEditorService); private _hasNotebookOpen; getNotebookFilters(): NotebookFindFilters; focus(select?: boolean, focusReplace?: boolean, suppressGlobalSearchBuffer?: boolean): void; /** * Updates the ARIA label of the search input box. * When a screen reader is active and the accessibility verbosity setting is enabled, * includes a hint about pressing Alt+F1 for accessibility help on first focus. * The hint is only announced once per focus cycle to prevent double-speak. * @param includeHint Whether to include the accessibility help hint in the label */ private _updateSearchInputAriaLabel; setWidth(width: number): void; clear(): void; isReplaceShown(): boolean; isReplaceActive(): boolean; getReplaceValue(): string; toggleReplace(show?: boolean): void; getSearchHistory(): string[]; getReplaceHistory(): string[]; prependSearchHistory(history: string[]): void; prependReplaceHistory(history: string[]): void; clearHistory(): void; showNextSearchTerm(): void; showPreviousSearchTerm(): void; showNextReplaceTerm(): void; showPreviousReplaceTerm(): void; searchInputHasFocus(): boolean; replaceInputHasFocus(): boolean; focusReplaceAllAction(): void; focusRegexAction(): void; set replaceButtonVisibility(val: boolean); private render; private updateAccessibilitySupport; private renderToggleReplaceButton; private renderSearchInput; private onContextLinesChanged; setContextLines(lines: number): void; private renderReplaceInput; triggerReplaceAll(): Promise; private onToggleReplaceButton; setValue(value: string): void; setReplaceAllActionState(enabled: boolean): void; private updateReplaceActiveState; private validateSearchInput; private onSearchInputChanged; private onSearchInputKeyDown; private onCaseSensitiveKeyDown; private onRegexKeyDown; private onPreserveCaseKeyDown; private onReplaceInputKeyDown; private onReplaceActionbarKeyDown; private submitSearch; getContextLines(): number; modifyContextLines(increase: boolean): void; toggleContextLines(): void; dispose(): void; private get searchConfiguration(); } export declare function registerContributions(): void; export {};