import { VegaSlimmer } from '../../vega-slimmer/vega-slimmer-core';
import { Nullable } from '../../types/general';
export declare type AriaDialogFocusableEntry = {
  /**
   * The trigger element is the element that, when interacted with (e.g., clicked), causes the dialog to be shown.
   */
  triggerEl: () => Nullable<HTMLElement>;
  /**
   * The dialog element is the element that represents the dialog content that is shown or hidden.
   */
  dialogEl: () => HTMLElement;
};
/**
 * The `AriaDialogFocusableTrapSlimmer` class is designed to manage focus behavior for dialog elements appended to the DOM, particularly in scenarios where screen readers like VoiceOver are used.
 * It detects when a click event is likely triggered by VoiceOver and ensures that focus is appropriately set to the first focusable element
 * within the dialog content when it is shown, and returns focus to the triggering element when the dialog is hidden.
 * This helps maintain a logical focus order and improves accessibility for keyboard users and screen reader users.
 */
export declare class AriaDialogFocusableTrapSlimmer extends VegaSlimmer {
  private entry;
  private isVoiceOverClick;
  private focusTriggerElement;
  private focusDialogTaskQueue;
  private dialogContentReadyObserver;
  private dialogContentReadySubject;
  private isChildFocused;
  /**
   * Ensures that the event listener for click events is set up when the component is connected to the DOM. This is important for cases where the component might be added to the DOM after it has been initialized, ensuring that the click events are properly handled to manage focus behavior for dialog elements.
   */
  connectedCallback(): void;
  /**
   * Removes the event listener for click events from the trigger element or the window when the component is disconnected from the DOM.
   */
  disconnectedCallback(): void;
  /**
   * Sets up the event listener for click events on the trigger element or the window after the component has loaded.
   */
  componentDidLoad(): void;
  /**
   * Ensures that any pending focus actions are executed after the component has rendered.
   */
  componentDidRender(): Promise<void>;
  constructor(entry: AriaDialogFocusableEntry);
  /**
   * When showing the dialog, if the last active element before the click event is detected as a VoiceOver click,
   *
   * @param {boolean} isOpen - A boolean indicating whether the dialog should be shown or hidden.
   * @returns {Promise<void>} A promise that resolves when the focus action is complete.
   */
  toggle(isOpen: boolean): Promise<void>;
  /**
   * When showing the appended element, if the last active element before the click event is detected as a VoiceOver click,
   *   it will attempt to focus the first focusable element within the appended element.
   *
   * @returns {Promise<void>} A promise that resolves when the focus action is complete.
   */
  show(): Promise<void>;
  /**
   * When hiding the appended element, if the last active element before the click event is detected as a VoiceOver click,
   *    it will attempt to focus back on the element that triggered the show action.
   *
   * @returns {Promise<void>} A promise that resolves when the focus action is complete.
   */
  hide(): Promise<void>;
  /**
   * Sets up the event listener for click events on the trigger element or the window.
   */
  private eventListenerHandler;
  /**
   * Removes the event listener for click events from the trigger element or the window.
   */
  private eventListenerRemover;
  /**
   * Subscribes to the dialog content ready ChangeManager subject if configured.
   * When the external component notifies that dialog content is rendered,
   * the observer retries focusing the first focusable element in the dialog.
   */
  private subscribeDialogContentReady;
  /**
   * Unsubscribes from the dialog content ready ChangeManager subject.
   */
  private unsubscribeDialogContentReady;
  /**
   * Handles the click event and determines if it is likely triggered by VoiceOver.
   *  If it is a VoiceOver click, it sets the `isVoiceOverClick` flag to true and stores the currently focused element as the trigger element.
   * 	If it is not a VoiceOver click, it resets the `focusTriggerElement` to null.
   *
   * @param {MouseEvent} e - The click event object that is passed to the event handler.
   */
  private handleClickEvent;
  /**
   * Handles the context menu event to prevent the default context menu from appearing when a VoiceOver click is detected.
   * This is important because VoiceOver users may trigger a context menu with a specific gesture, and preventing the default behavior can help ensure that the focus management works as intended without interference from the context menu.
   *
   * @param {MouseEvent} e - The context menu event object that is passed to the event handler.
   */
  private handleContextMenuEvent;
  /**
   * Focuses on the first focusable element within the dialog when the dialog content is ready and the last interaction was detected as a VoiceOver click. This method is called in response to the dialog content ready notification, ensuring that focus is set appropriately when the dialog is shown after being triggered by VoiceOver.
   * It retrieves the currently active element, stores it as the trigger element, and then focuses on the first focusable element within the dialog content.
   *
   */
  private focusOnFirstFocusableElement;
}
