/*! * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ declare const TABSTER_ATTRIBUTE_NAME: "data-tabster"; declare const TABSTER_DUMMY_INPUT_ATTRIBUTE_NAME: "data-tabster-dummy"; declare const FOCUSABLE_SELECTOR: string; declare const AsyncFocusSources$1: { readonly EscapeGroupper: 1; readonly Restorer: 2; readonly Deloser: 3; }; declare const ObservedElementAccessibilities$1: { readonly Any: 0; readonly Accessible: 1; readonly Focusable: 2; }; declare const ObservedElementRequestStatuses$1: { readonly Waiting: 0; readonly Succeeded: 1; readonly Canceled: 2; readonly TimedOut: 3; }; declare const ObservedElementFailureReasons$1: { readonly CanceledFocusChange: 1; readonly TimeoutElementNotInDOM: 2; readonly TimeoutElementNotAccessible: 3; readonly TimeoutElementNotFocusable: 4; readonly TimeoutElementNotReady: 5; readonly SupersededByNewRequest: 6; readonly FocusCallFailed: 7; }; declare const RestoreFocusOrders$1: { readonly History: 0; readonly DeloserDefault: 1; readonly RootDefault: 2; readonly DeloserFirst: 3; readonly RootFirst: 4; }; declare const DeloserStrategies$1: { /** * If the focus is lost, the focus will be restored automatically using all available focus history. * This is the default strategy. */ readonly Auto: 0; /** * If the focus is lost from this Deloser instance, the focus will not be restored automatically. * The application might listen to the event and restore the focus manually. * But if it is lost from another Deloser instance, the history of this Deloser could be used finding * the element to focus. */ readonly Manual: 1; }; declare const Visibilities$1: { readonly Invisible: 0; readonly PartiallyVisible: 1; readonly Visible: 2; }; declare const RestorerTypes$1: { readonly Source: 0; readonly Target: 1; }; declare const MoverDirections$1: { readonly Both: 0; readonly Vertical: 1; readonly Horizontal: 2; readonly Grid: 3; readonly GridLinear: 4; }; declare const MoverKeys$1: { readonly ArrowUp: 1; readonly ArrowDown: 2; readonly ArrowLeft: 3; readonly ArrowRight: 4; readonly PageUp: 5; readonly PageDown: 6; readonly Home: 7; readonly End: 8; }; declare const GroupperTabbabilities$1: { readonly Unlimited: 0; readonly Limited: 1; readonly LimitedTrapFocus: 2; }; declare const GroupperMoveFocusActions$1: { readonly Enter: 1; readonly Escape: 2; }; declare const SysDummyInputsPositions$1: { readonly Auto: 0; readonly Inside: 1; readonly Outside: 2; }; /*! * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ interface HTMLElementWithTabsterFlags extends HTMLElement { __tabsterElementFlags?: { /** * @deprecated This option is added to support interop between Fluent UI V9 and Fluent UI V8. * Once Fluent UI V8 is not supported anymore, this option should be removed. */ noDirectAriaHidden?: boolean; }; } interface TabsterDOMAttribute { [TABSTER_ATTRIBUTE_NAME]: string | undefined; } interface TabsterCoreProps { autoRoot?: RootProps; /** * Allows all tab key presses under the tabster root to be controlled by tabster * @default true */ controlTab?: boolean; /** * When controlTab is false, Root doesn't have dummy inputs by default. * This option allows to enable dummy inputs on Root. */ rootDummyInputs?: boolean; /** * A callback that will be called for the uncontrolled areas when Tabster wants * to know is the uncontrolled element wants complete control (for example it * is trapping focus) and Tabster should not interfere with handling Tab. * If the callback returns undefined, then the default behaviour is to return * the uncontrolled.completely value from the element. If the callback returns * non-undefined value, the callback's value will dominate the element's * uncontrolled.completely value. */ checkUncontrolledCompletely?: (element: HTMLElement, completely: boolean) => boolean | undefined; /** * @deprecated use checkUncontrolledCompletely. */ checkUncontrolledTrappingFocus?: (element: HTMLElement) => boolean; /** * Custom getter for parent elements. Defaults to the default .parentElement call * Currently only used to detect tabster contexts */ getParent?(el: Node): Node | null; /** * Ability to redefine all DOM API calls used by Tabster. For example, for * ShadowDOM support. */ DOMAPI?: Partial; } interface DOMAPI { createMutationObserver: (callback: MutationCallback) => MutationObserver; createTreeWalker(doc: Document, root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker; getParentNode(node: Node | null | undefined): ParentNode | null; getParentElement(element: HTMLElement | null | undefined): HTMLElement | null; nodeContains(parent: Node | null | undefined, child: Node | null | undefined): boolean; getActiveElement(doc: Document): Element | null; querySelector(element: ParentNode, selector: string): Element | null; querySelectorAll(element: ParentNode, selector: string): Element[]; getElementById(doc: Document, id: string): HTMLElement | null; getFirstChild(node: Node | null | undefined): ChildNode | null; getLastChild(node: Node | null | undefined): ChildNode | null; getNextSibling(node: Node | null | undefined): ChildNode | null; getPreviousSibling(node: Node | null | undefined): ChildNode | null; getFirstElementChild(element: Element | null | undefined): Element | null; getLastElementChild(element: Element | null | undefined): Element | null; getNextElementSibling(element: Element | null | undefined): Element | null; getPreviousElementSibling(element: Element | null | undefined): Element | null; appendChild(parent: Node, child: Node): Node; insertBefore(parent: Node, child: Node, referenceChild: Node | null): Node; getSelection(ref: Node): Selection | null; getElementsByName(referenceElement: HTMLElement, name: string): NodeListOf; } type GetTabster = () => TabsterCore; type GetWindow = () => Window; type SubscribableCallback = (val: A, detail: B) => void; interface Disposable { } interface Subscribable { subscribe(callback: SubscribableCallback): void; unsubscribe(callback: SubscribableCallback): void; } interface KeyboardNavigationState extends Subscribable, Disposable { isNavigatingWithKeyboard(): boolean; setNavigatingWithKeyboard(isNavigatingWithKeyboard: boolean): void; } interface FocusedElementDetail { relatedTarget?: HTMLElement; isFocusedProgrammatically?: boolean; modalizerId?: string; } type AsyncFocusSources = typeof AsyncFocusSources$1; type AsyncFocusSource = AsyncFocusSources[keyof AsyncFocusSources]; interface FocusedElementState extends Subscribable, Disposable { getFocusedElement(): HTMLElement | undefined; getLastFocusedElement(): HTMLElement | undefined; focus(element: HTMLElement, noFocusedProgrammaticallyFlag?: boolean, noAccessibleCheck?: boolean, preventScroll?: boolean): boolean; focusDefault(container: HTMLElement): boolean; focusFirst(props: FindFirstProps): boolean; focusLast(props: FindFirstProps): boolean; resetFocus(container: HTMLElement): boolean; } interface WeakHTMLElement { get(): HTMLElement | undefined; getData(): D | undefined; } interface TabsterPart

{ readonly id: string; getElement(): HTMLElement | undefined; getProps(): P; setProps(props: P): void; } interface TabsterPartWithFindNextTabbable { findNextTabbable(current?: HTMLElement, reference?: HTMLElement, isBackward?: boolean, ignoreAccessibility?: boolean): NextTabbable | null; } interface TabsterPartWithAcceptElement { acceptElement(element: HTMLElement, state: FocusableAcceptElementState): number | undefined; } interface ObservedElementProps { names: string[]; details?: any; } interface ObservedElementDetails extends ObservedElementProps { accessibility?: ObservedElementAccessibility; } type ObservedElementChangeType = "added" | "removed" | "updated"; /** * Changes to observed elements in the DOM. */ interface ObservedElementChange { /** * The HTML element that was added, removed, or updated. */ element: HTMLElement; /** * The type of change that occurred: * - "added": A new element with observed names was added to the DOM * - "removed": An observed element was completely removed from the DOM * - "updated": An existing observed element had its names modified (added or removed) */ type: ObservedElementChangeType; /** * The current array of observed names associated with this element. * - For "added" events: Contains all names for the new element * - For "removed" events: Empty array (since element is being removed) * - For "updated" events: Contains the complete current list of names after the update */ names: string[]; /** * Optional array of names that were added in this change. * - For "added" events: Contains all names (same as `names`) * - For "removed" events: undefined * - For "updated" events: Contains only the newly added names, or undefined if no names were added */ addedNames?: string[]; /** * Optional array of names that were removed in this change. * - For "added" events: undefined * - For "removed" events: Contains all previous names that the element had * - For "updated" events: Contains only the removed names, or undefined if no names were removed */ removedNames?: string[]; } type ObservedElementAccessibilities = typeof ObservedElementAccessibilities$1; type ObservedElementAccessibility = ObservedElementAccessibilities[keyof ObservedElementAccessibilities]; type ObservedElementRequestStatuses = typeof ObservedElementRequestStatuses$1; type ObservedElementRequestStatus = ObservedElementRequestStatuses[keyof ObservedElementRequestStatuses]; type ObservedElementFailureReasons = typeof ObservedElementFailureReasons$1; type ObservedElementFailureReason = ObservedElementFailureReasons[keyof ObservedElementFailureReasons]; interface ObservedElementAsyncRequestDiagnostics { /** * Reason for failure when status is Canceled or TimedOut. */ reason?: ObservedElementFailureReason; /** * Time spent waiting for element to appear in DOM (ms). */ waitForElementDuration?: number; /** * State of the target element at the time of failure. * Only present for timeout or failure cases. */ targetState?: { inDOM: boolean; isAccessible?: boolean; isFocusable?: boolean; }; /** * Callback to access the element that received focus, causing cancellation. * Only present when canceled due to focus change. * Returns null if the element is no longer available. */ getCancelTriggeringElement?: () => HTMLElement | null; } interface ObservedElementAsyncRequest { result: Promise; cancel(): void; status?: ObservedElementRequestStatus; /** * Detailed diagnostic information about the request. */ diagnostics: ObservedElementAsyncRequestDiagnostics; } interface ObservedElementAPIInternal { } interface ObservedElementAPI extends Subscribable, Disposable, ObservedElementAPIInternal { getElement(observedName: string, accessibility?: ObservedElementAccessibility): HTMLElement | null; waitElement(observedName: string, timeout: number, accessibility?: ObservedElementAccessibility): ObservedElementAsyncRequest; requestFocus(observedName: string, timeout: number, options?: Pick): ObservedElementAsyncRequest; /** * Returns all currently registered observed elements grouped by their observed names. * * @returns A Map where each key is an observed name, and each value is an array of elements * associated with that name along with their complete names arrays. * * @example * ```typescript * const allObserved = observedElement.getAllObservedElements(); * // Map might contain: * // "button-1" -> [{ element: