export class MenuService { /** * CONSTRUCTOR */ /** * Creates a new MenuService instance. * @param {Object} options - The options object. * @param {AuroMenu} options.host - The host element that this service will control. Required. * @throws {Error} If the host is not provided. */ constructor({ host }?: { host: AuroMenu; }); /** * PROPERTIES AND GETTERS */ /** * Gets the list of registered menu options. * @returns {AuroMenuOption[]} */ get menuOptions(): AuroMenuOption[]; /** * Gets the currently highlighted option. * @returns {AuroMenuOption|null} */ get highlightedOption(): AuroMenuOption | null; /** * Gets the current value(s) of the selected option(s). * @returns {string|string[]|undefined} */ get currentValue(): string | string[] | undefined; /** * Gets the label(s) of the currently selected option(s). * @returns {string} */ get currentLabel(): string; /** * Gets the string representation of the current value(s). * For multi-select, this is a JSON stringified array. * @returns {string|undefined} */ get stringValue(): string | undefined; /** * Gets the key(s) of the currently selected option(s). * @returns {string|string[]|undefined} */ get currentKeys(): string | string[] | undefined; host: AuroMenu; size: any; shape: any; noCheckmark: any; disabled: any; matchWord: any; multiSelect: any; allowDeselect: any; selectAllMatchingOptions: any; highlightedIndex: number; _menuOptions: any[]; _subscribers: any[]; internalUpdateInProgress: boolean; selectedOptions: any[]; /** * PROPERTY SYNCING */ /** * Handles host updates. * This is a lit reactive lifecycle method. * This comes from the Lit controller interface provided by adding this service as a controller to the host. * See constructor for `this.host.addController(this)` * You can read more about Lit reactive controllers here: https://lit.dev/docs/composition/controllers/ */ hostUpdated(): void; /** * Handles host disconnection and memory cleanup. */ hostDisconnected(): void; /** * Sets a property value if it exists on the instance and the value has changed. * @param {string} property * @param {any} value */ setProperty(property: string, value: any): void; /** * Sets multiple properties on the instance. * @param {Object} properties - Key-value pairs of properties to set. */ setProperties(properties: any): void; /** * MENU OPTION HIGHLIGHTING */ /** * Highlights the next active option in the menu. */ highlightNext(): void; /** * Highlights the previous active option in the menu. */ highlightPrevious(): void; /** * Moves the highlighted option in the specified direction. * @param {string} direction - The direction to move the highlight ("next" or "previous"). */ moveHighlightedOption(direction: string): void; /** * Sets the highlighted index to the specified option. * @param {AuroMenuOption} option - The option to highlight. */ setHighlightedOption(option: AuroMenuOption): void; /** * Sets the highlighted option to the option at the specified index if it exists. * @param {number} index */ setHighlightedIndex(index: number): void; /** * Selects the currently highlighted option. */ selectHighlightedOption(): void; /** * SELECTION AND DESELECTION METHODS */ /** * Selects one or more options in a batch operation * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to select */ selectOptions(options: AuroMenuOption | AuroMenuOption[]): void; /** * Deselects one or more options in a batch operation * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to deselect */ deselectOptions(options: AuroMenuOption | AuroMenuOption[]): void; /** * Selects a single option. * @param {AuroMenuOption} option */ selectOption(option: AuroMenuOption): void; /** * Deselects a single option. * @param {AuroMenuOption} option */ deselectOption(option: AuroMenuOption): void; /** * Toggles the selection state of a single option. * @param {AuroMenuOption} option */ toggleOption(option: AuroMenuOption): void; /** * Selects options based on their value(s) when compared to a passed value or values. * Value or values are normalized to an array of strings that can be matched to option keys. * @param {string|number|Array} value - The value(s) to select. */ selectByValue(value: string | number | Array): void; /** * Resets the selected options to an empty array. */ reset(): void; /** * SUBSCRIPTION, NOTIFICATION AND EVENT DISPATCH METHODS */ /** * Subscribes a callback to menu service events. * @param {Function} callback - The callback to invoke on events. */ subscribe(callback: Function): void; /** * Remove a previously subscribed callback from menu service events. * @param {Function} callback */ unsubscribe(callback: Function): void; /** * Stages an update to notify subscribers of state and value changes. */ stageUpdate(): void; /** * Notifies subscribers of a menu service event. * All notifications are sent to all subscribers. * @param {string} event - The event to send to subscribers. */ notify(event: string): void; /** * Notifies subscribers of a state change (selected options has changed). */ notifyStateChange(): void; /** * Notifies subscribers of a value change (current value has changed). */ notifyValueChange(): void; /** * Dispatches a custom event from the host element. * @param {string} eventName * @param {any} detail */ dispatchChangeEvent(eventName: string, detail: any): void; /** * MENU OPTION MANAGEMENT METHODS */ /** * Adds a menu option to the service's list. * @param {AuroMenuOption} option - the option to track */ addMenuOption(option: AuroMenuOption): void; /** * Removes a menu option from the service's list. * @param {AuroMenuOption} option - the option to remove */ removeMenuOption(option: AuroMenuOption): void; /** * UTILITIES */ /** * Normalizes a value or array of values into an array of strings for option selection. * This function ensures that input values are consistently formatted for matching menu options. * * @param {string|number|Array} value - The value(s) to normalize. * @returns {Array} An array of string values suitable for option matching. * @throws {Error} If any value is not a string or number. */ _getNormalizedValues(value: string | number | Array): Array; /** * Returns whether two arrays of options contain the same elements. * @param {AuroMenuOption[]} arr1 - First array of options. * @param {AuroMenuOption[]} arr2 - Second array of options. * @returns {boolean} True if arrays match, false otherwise. */ optionsArraysMatch(arr1: AuroMenuOption[], arr2: AuroMenuOption[]): boolean; } export const MenuContext: import("@lit/context").Context<"menu-context", any>; import { AuroMenuOption } from "./auro-menuoption";