import { BaseGridPlugin, PluginQuery } from './plugin/base-plugin';
import { ColumnConfig, ColumnConfigMap, ColumnInternal, FitMode, FrameworkAdapter, GridColumnState, GridConfig, HeaderContentDefinition, InternalGrid, ResizeController, ToolbarButtonConfig, ToolbarButtonInfo, ToolPanelDefinition, VirtualState } from './types';
export declare class DataGridElement<T = any> extends HTMLElement implements InternalGrid<T> {
    #private;
    static readonly tagName = "tbw-grid";
    static readonly version: string;
    /**
     * Registry of framework adapters that handle converting light DOM elements
     * to functional renderers/editors. Framework libraries (Angular, React, Vue)
     * register adapters to enable zero-boilerplate component integration.
     */
    private static adapters;
    /**
     * Register a framework adapter for handling framework-specific components.
     * Adapters are checked in registration order when processing light DOM templates.
     *
     * @example
     * ```typescript
     * // In @toolbox-web/grid-angular
     * import { AngularGridAdapter } from '@toolbox-web/grid-angular';
     *
     * // One-time setup in app
     * GridElement.registerAdapter(new AngularGridAdapter(injector, appRef));
     * ```
     */
    static registerAdapter(adapter: FrameworkAdapter): void;
    /**
     * Get all registered framework adapters.
     * Used internally by light DOM parsing to find adapters that can handle templates.
     */
    static getAdapters(): readonly FrameworkAdapter[];
    /**
     * Clear all registered adapters (primarily for testing).
     */
    static clearAdapters(): void;
    static get observedAttributes(): string[];
    /**
     * Access the grid's ShadowRoot.
     *
     * Note: The grid renders into its light DOM and does not attach a shadow root,
     * so this getter returns `null`. Use `grid.querySelector()` directly for DOM queries.
     *
     * @deprecated This property returns `null` since Shadow DOM was removed.
     *             Use `grid.querySelector()` or `grid.querySelectorAll()` directly.
     * @returns null (no shadow root is attached)
     */
    get shadowRoot(): ShadowRoot | null;
    _rows: T[];
    get _columns(): ColumnInternal<T>[];
    set _columns(value: ColumnInternal<T>[]);
    get _visibleColumns(): ColumnInternal<T>[];
    _headerRowEl: HTMLElement;
    _bodyEl: HTMLElement;
    _rowPool: HTMLElement[];
    _resizeController: ResizeController;
    _virtualization: VirtualState;
    _focusRow: number;
    _focusCol: number;
    /** Flag to restore focus styling after next render. @internal */
    _restoreFocusAfterRender: boolean;
    _sortState: {
        field: string;
        direction: 1 | -1;
    } | null;
    _gridTemplate: string;
    __rowRenderEpoch: number;
    __didInitialAutoSize: boolean;
    /** Light DOM columns cache - delegates to ConfigManager */
    get __lightDomColumnsCache(): ColumnInternal[] | undefined;
    set __lightDomColumnsCache(value: ColumnInternal[] | undefined);
    /** Original column nodes - delegates to ConfigManager */
    get __originalColumnNodes(): HTMLElement[] | undefined;
    set __originalColumnNodes(value: HTMLElement[] | undefined);
    __originalOrder: T[];
    /**
     * Framework adapter instance set by framework directives (Angular Grid, React DataGrid).
     * Used to handle framework-specific component rendering.
     * @internal
     */
    __frameworkAdapter?: FrameworkAdapter;
    __rowsBodyEl: HTMLElement | null;
    get rows(): T[];
    set rows(value: T[]);
    /**
     * Get the original unfiltered/unprocessed rows.
     * Use this when you need access to all source data regardless of active filters.
     */
    get sourceRows(): T[];
    get columns(): ColumnConfig<T>[];
    set columns(value: ColumnConfig<T>[] | ColumnConfigMap<T> | undefined);
    get gridConfig(): GridConfig<T>;
    set gridConfig(value: GridConfig<T> | undefined);
    get fitMode(): FitMode;
    set fitMode(value: FitMode | undefined);
    get editOn(): string | boolean | undefined;
    set editOn(value: string | boolean | undefined);
    /**
     * Effective config accessor for internal modules and plugins.
     * Returns the merged config (single source of truth) before plugin processing.
     * Use this when you need the raw merged config (e.g., for column definitions including hidden).
     * @internal Plugin API
     */
    get effectiveConfig(): GridConfig<T>;
    /**
     * Get the disconnect signal for event listener cleanup.
     * This signal is aborted when the grid disconnects from the DOM.
     * Plugins and internal code can use this for automatic listener cleanup.
     * @internal Plugin API
     * @example
     * element.addEventListener('click', handler, { signal: this.grid.disconnectSignal });
     */
    get disconnectSignal(): AbortSignal;
    constructor();
    /**
     * Get a plugin instance by its class.
     * Used by plugins for inter-plugin communication.
     * @internal Plugin API
     */
    getPlugin<P extends BaseGridPlugin>(PluginClass: new (...args: any[]) => P): P | undefined;
    /**
     * Get a plugin instance by its name.
     * Used for loose coupling between plugins (avoids static imports).
     * @internal Plugin API
     */
    getPluginByName(name: string): BaseGridPlugin | undefined;
    /**
     * Request a full re-render of the grid.
     * Called by plugins when they need the grid to update.
     * Note: This does NOT reset plugin state - just re-processes rows/columns and renders.
     * @internal Plugin API
     */
    requestRender(): void;
    /**
     * Request a full re-render and restore focus styling afterward.
     * Use this when a plugin action (like expand/collapse) triggers a render
     * but needs to maintain keyboard navigation focus.
     * @internal Plugin API
     */
    requestRenderWithFocus(): void;
    /**
     * Update the grid's column template CSS.
     * Called by resize controller during column resize operations.
     * @internal
     */
    updateTemplate(): void;
    /**
     * Request a lightweight style update without rebuilding DOM.
     * Called by plugins when they only need to update CSS classes/styles.
     * This runs all plugin afterRender hooks without rebuilding row/column DOM.
     * @internal Plugin API
     */
    requestAfterRender(): void;
    connectedCallback(): void;
    disconnectedCallback(): void;
    /**
     * Handle HTML attribute changes.
     * Only processes attribute values when SET (non-null).
     * Removing an attribute does NOT clear JS-set properties.
     */
    attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
    /**
     * Find the header row element in the shadow DOM.
     * Used by plugins that need to access header cells for styling or measurement.
     * @internal Plugin API
     */
    findHeaderRow(): HTMLElement;
    /**
     * Find a rendered row element by its data row index.
     * Returns null if the row is not currently rendered (virtualized out of view).
     * Used by plugins that need to access specific row elements for styling or measurement.
     * @internal Plugin API
     * @param rowIndex - The data row index (not the DOM position)
     */
    findRenderedRowElement(rowIndex: number): HTMLElement | null;
    /**
     * Dispatch a cell click event to the plugin system.
     * Returns true if any plugin handled the event.
     */
    _dispatchCellClick(event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement): boolean;
    /**
     * Dispatch a row click event to the plugin system.
     * Returns true if any plugin handled the event.
     */
    _dispatchRowClick(event: MouseEvent, rowIndex: number, row: any, rowEl: HTMLElement): boolean;
    /**
     * Dispatch a header click event to the plugin system.
     * Returns true if any plugin handled the event.
     */
    _dispatchHeaderClick(event: MouseEvent, colIndex: number, headerEl: HTMLElement): boolean;
    /**
     * Dispatch a keyboard event to the plugin system.
     * Returns true if any plugin handled the event.
     */
    _dispatchKeyDown(event: KeyboardEvent): boolean;
    /**
     * Get horizontal scroll boundary offsets from plugins.
     * Used by keyboard navigation to ensure focused cells are fully visible
     * when plugins like pinned columns obscure part of the scroll area.
     */
    _getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
        left: number;
        right: number;
        skipScroll?: boolean;
    };
    /**
     * Query all plugins with a generic query and collect responses.
     * This enables inter-plugin communication without the core knowing plugin-specific concepts.
     * @internal Plugin API
     *
     * @example
     * // Check if any plugin vetoes moving a column
     * const responses = grid.queryPlugins<boolean>({ type: PLUGIN_QUERIES.CAN_MOVE_COLUMN, context: column });
     * const canMove = !responses.includes(false);
     */
    queryPlugins<T>(query: PluginQuery): T[];
    ready(): Promise<void>;
    forceLayout(): Promise<void>;
    /**
     * Trim the internal row pool to match the current visible window size.
     *
     * The grid maintains a pool of reusable row DOM elements for virtualization.
     * When the dataset shrinks significantly (e.g., after filtering or deleting rows),
     * the pool may have excess elements that consume memory unnecessarily.
     *
    /** Public method: returns a frozen snapshot of the merged effective configuration */
    getConfig(): Promise<Readonly<GridConfig<T>>>;
    setColumnVisible(field: string, visible: boolean): boolean;
    toggleColumnVisibility(field: string): boolean;
    isColumnVisible(field: string): boolean;
    showAllColumns(): void;
    getAllColumns(): Array<{
        field: string;
        header: string;
        visible: boolean;
        lockVisible?: boolean;
        utility?: boolean;
    }>;
    setColumnOrder(order: string[]): void;
    getColumnOrder(): string[];
    /**
     * Get the current column state, including order, width, visibility, sort, and plugin state.
     * Returns a serializable object suitable for localStorage or database storage.
     */
    getColumnState(): GridColumnState;
    /**
     * Set the column state, restoring order, width, visibility, sort, and plugin state.
     * Use this to restore previously saved column state.
     */
    set columnState(state: GridColumnState | undefined);
    /**
     * Get the current column state.
     */
    get columnState(): GridColumnState | undefined;
    /**
     * Request a state change event to be emitted.
     * Called internally after resize, reorder, visibility, or sort changes.
     * Plugins should call this after changing their state.
     * The event is debounced to avoid excessive events during drag operations.
     * @internal Plugin API
     */
    requestStateChange(): void;
    /**
     * Reset column state to initial configuration.
     * Clears all user modifications (order, width, visibility, sort).
     */
    resetColumnState(): void;
    /** Check if the tool panel is currently open. */
    get isToolPanelOpen(): boolean;
    /**
     * Get the currently active tool panel ID, or null if none is open.
     * @deprecated Use isToolPanelOpen and expandedToolPanelSections instead.
     */
    get activeToolPanel(): string | null;
    /** Get the IDs of expanded accordion sections. */
    get expandedToolPanelSections(): string[];
    /** Open the tool panel (accordion view with all registered panels). */
    openToolPanel(): void;
    /** Close the tool panel. */
    closeToolPanel(): void;
    /** Toggle the tool panel open/closed. */
    toggleToolPanel(): void;
    /** Toggle an accordion section expanded/collapsed. */
    toggleToolPanelSection(sectionId: string): void;
    /** Get registered tool panel definitions. */
    getToolPanels(): ToolPanelDefinition[];
    /** Register a custom tool panel (without creating a plugin). */
    registerToolPanel(panel: ToolPanelDefinition): void;
    /** Unregister a custom tool panel. */
    unregisterToolPanel(panelId: string): void;
    /** Get registered header content definitions. */
    getHeaderContents(): HeaderContentDefinition[];
    /** Register custom header content (without creating a plugin). */
    registerHeaderContent(content: HeaderContentDefinition): void;
    /** Unregister custom header content. */
    unregisterHeaderContent(contentId: string): void;
    /** Get all registered toolbar buttons. */
    getToolbarButtons(): ToolbarButtonInfo[];
    /** Register a custom toolbar button programmatically. */
    registerToolbarButton(button: ToolbarButtonConfig): void;
    /** Unregister a custom toolbar button. */
    unregisterToolbarButton(buttonId: string): void;
    /** Enable/disable a toolbar button by ID. */
    setToolbarButtonDisabled(buttonId: string, disabled: boolean): void;
    /**
     * Re-parse light DOM shell elements and refresh shell header.
     * Call this after dynamically modifying <tbw-grid-header> children.
     */
    refreshShellHeader(): void;
    /**
     * Register custom CSS styles to be injected into the grid's shadow DOM.
     * Use this to style custom cell renderers, editors, or detail panels.
     *
     * Uses adoptedStyleSheets for efficiency - styles survive shadow DOM rebuilds.
     *
     * @param id - Unique identifier for the style block (for removal/updates)
     * @param css - CSS string to inject
     *
     * @example
     * ```typescript
     * // Register custom styles for a detail panel
     * grid.registerStyles('my-detail-styles', `
     *   .my-detail-panel { padding: 16px; }
     *   .my-detail-table { width: 100%; }
     * `);
     *
     * // Update styles later
     * grid.registerStyles('my-detail-styles', updatedCss);
     *
     * // Remove styles
     * grid.unregisterStyles('my-detail-styles');
     * ```
     */
    registerStyles(id: string, css: string): void;
    /**
     * Remove previously registered custom styles.
     * @param id - The ID used when registering the styles
     */
    unregisterStyles(id: string): void;
    /**
     * Get list of registered custom style IDs.
     */
    getRegisteredStyles(): string[];
    /**
     * Re-parse light DOM column elements and refresh the grid.
     * Call this after framework adapters have registered their templates.
     * Uses the render scheduler to batch with other pending updates.
     * @internal Used by framework integration libraries (Angular, React, Vue)
     */
    refreshColumns(): void;
    /**
     * Core virtualization routine. Chooses between bypass (small datasets), grouped window rendering,
     * or standard row window rendering.
     * @internal Plugin API
     */
    refreshVirtualWindow(force?: boolean): void;
}
declare global {
    interface HTMLElementTagNameMap {
        'tbw-grid': DataGridElement;
    }
}
//# sourceMappingURL=grid.d.ts.map