import { BaseApi } from './BaseApi'; import { BaseModifierApi } from './BaseModifierApi'; export interface ControlApi extends BaseApi, BaseModifierApi { /** * Sets the visibility of a specific UI element within the control's scope. * @param uiElementName - The ID of the UI element to show/hide. * @param isVisible - True to show the element, false to hide it. */ setVisibility(uiElementName: string, isVisible: boolean): void; /** * @description Sets a specific attribute on a target UI element within the control's scope. * Use attributes defined in {@link UEAttr}. * @param uiElementName - The ID of the target UI element. * @param attribute - The name of the attribute to set (should be one of UEAttr). * @param value - The value to set for the attribute. */ setUIEAttribute(uiElementName: string, attribute: string, value: unknown): void; /** * Updates the values of multiple UI elements within the control's scope at once. * @param valuesMap - A record object where keys are UI element IDs and values are their new values. */ updateValues(valuesMap: Record): void; /** * Updates the value of single UI element within the control's scope * @param path - path of updated UI element * @param value - value of updated UI element * @example * ```typescript * // update the value of the input with the name 'text' * this.api.updateUIElementValue('text', 'updated value'); * // update the value of the input with name 'text' in the first item of the {@link UIElementType.REPEATABLE} element with name 'items' * this.api.updateUIElementValue('items[0].text', 'updated value'); * ``` */ updateUIElementValue(path: string, value: unknown): void; /** * @description Returns the current values of all UI elements managed by this control. * @returns A record object where keys are UI element IDs and values are their current values. */ getValues(): Record; /** * Registers a callback function to be invoked when the value of a specific UI element changes. * @param uiElementName - The ID of the UI element to listen to. * @param callback - The function to call on value change, receiving the new and old values as well * as the value index if it's a part of repeatable ui element. */ onValueChanged(uiElementName: string, callback: (newValue: unknown, oldValue: unknown, index?: number) => void): void; /** * Updates the title of a settings panel tab with raw HTML content. * @param tabId - The ID of the tab whose title should be updated. * @param html - HTML string to render as the tab title. */ setSettingsPanelTabTitleHtml(tabId: string, html: string): void; }