/** * @license * Copyright 2023 Nuraly, Laabidi Aymen * SPDX-License-Identifier: MIT */ import { TabsHost, BaseTabsController } from './base.controller.js'; import { ReactiveControllerHost } from 'lit'; import { TabEditable, TabItem } from '../tabs.types.js'; /** * Editable controller interface for tabs components */ export interface EditableController { handleAddTab(): void; handleRemoveTab(tabIndex: number): void; handleEditTab(tabIndex: number, newLabel: string): void; canAddTab(): boolean; canDeleteTab(tab?: TabItem): boolean; canEditTabTitle(tab?: TabItem): boolean; } /** * Enhanced tabs host interface for editable functionality */ export interface TabsEditableHost extends TabsHost { editable?: TabEditable; dispatchEventWithMetadata(eventName: string, detail: any): void; } /** * Editable controller manages editable functionality for tabs components * Handles add, delete, and edit operations for tabs */ export declare class TabsEditableController extends BaseTabsController implements EditableController { protected _host: TabsEditableHost & ReactiveControllerHost; constructor(host: TabsEditableHost & ReactiveControllerHost); get host(): TabsEditableHost & ReactiveControllerHost; /** * Handle adding a new tab */ handleAddTab(): void; /** * Handle removing a tab * @param tabIndex - Index of tab to remove */ handleRemoveTab(tabIndex: number): void; /** * Handle editing a tab title * @param tabIndex - Index of tab to edit * @param newLabel - New label for the tab */ handleEditTab(tabIndex: number, newLabel: string): void; /** * Check if user can add tabs */ canAddTab(): boolean; /** * Check if user can delete a specific tab * @param tab - Tab to check (optional, falls back to global setting) */ canDeleteTab(tab?: TabItem): boolean; /** * Check if user can edit tab titles for a specific tab * @param tab - Tab to check (optional, falls back to global setting) */ canEditTabTitle(tab?: TabItem): boolean; /** * Check if tab can be moved (for drag and drop) */ canMoveTab(): boolean; /** * Get editable state for a specific tab * @param tab - Tab to check */ getTabEditableState(tab: TabItem): { canDelete: boolean; canEdit: boolean; canMove: boolean; }; /** * Validate if a tab label is valid * @param label - Label to validate */ private isValidTabLabel; /** * Get the contenteditable attribute value for tab text * @param tab - Tab to check */ getContentEditableAttribute(tab: TabItem): string | undefined; /** * Handle blur event for editable tab titles * @param event - Blur event * @param tabIndex - Index of the tab */ handleTabTitleBlur(event: Event, tabIndex: number): void; /** * Handle keydown events for editable tab titles * @param event - Keyboard event * @param tabIndex - Index of the tab */ handleTabTitleKeyDown(event: KeyboardEvent, tabIndex: number): void; } //# sourceMappingURL=editable.controller.d.ts.map