import { BaseGridPlugin } from '../plugin';
import { ColumnConfig, ColumnConfigMap, ColumnInternal, FitMode, GridColumnState, GridConfig, HeaderContentDefinition, ToolbarContentDefinition, ToolPanelDefinition } from '../types';
/**
 * Callbacks for ConfigManager to notify the grid of changes.
 */
export interface ConfigManagerCallbacks<T> {
    /** Get current rows for column inference */
    getRows: () => T[];
    /** Get current sort state */
    getSortState: () => {
        field: string;
        direction: 1 | -1;
    } | null;
    /** Set sort state */
    setSortState: (state: {
        field: string;
        direction: 1 | -1;
    } | null) => void;
    /** Notify that config changed and re-render is needed */
    onConfigChange: () => void;
    /** Emit a custom event */
    emit: (eventName: string, detail: unknown) => void;
    /** Clear row pool for visibility changes */
    clearRowPool: () => void;
    /** Run setup after state changes */
    setup: () => void;
    /** Render header */
    renderHeader: () => void;
    /** Update column template */
    updateTemplate: () => void;
    /** Refresh virtual window */
    refreshVirtualWindow: () => void;
    /** Get virtualization state for row height application */
    getVirtualization: () => {
        rowHeight: number;
    };
    /** Set row height on virtualization state */
    setRowHeight: (height: number) => void;
    /** Apply animation config to host element */
    applyAnimationConfig: (config: GridConfig<T>) => void;
    /** Get light DOM title from shell state (synced from parseLightDomShell) */
    getShellLightDomTitle: () => string | null;
    /** Get registered tool panels from shell state */
    getShellToolPanels: () => Map<string, ToolPanelDefinition>;
    /** Get registered header contents from shell state */
    getShellHeaderContents: () => Map<string, HeaderContentDefinition>;
    /** Get registered toolbar contents from shell state */
    getShellToolbarContents: () => Map<string, ToolbarContentDefinition>;
    /** Get light DOM header content elements */
    getShellLightDomHeaderContent: () => HTMLElement[];
    /** Get whether a tool buttons container was found in light DOM */
    getShellHasToolButtonsContainer: () => boolean;
}
/**
 * ConfigManager handles all configuration lifecycle for the grid.
 *
 * Manages:
 * - Source collection (gridConfig, columns, attributes, Light DOM)
 * - Effective config (merged from all sources)
 * - State persistence (collectState, applyState, resetState)
 * - Column visibility and ordering
 */
export declare class ConfigManager<T = unknown> {
    #private;
    constructor(callbacks: ConfigManagerCallbacks<T>);
    /** Get the frozen original config (compiled from sources, immutable) */
    get original(): GridConfig<T>;
    /** Get the mutable effective config (current runtime state) */
    get effective(): GridConfig<T>;
    /** Get columns from effective config */
    get columns(): ColumnInternal<T>[];
    /** Set columns on effective config */
    set columns(value: ColumnInternal<T>[]);
    /** Get light DOM columns cache */
    get lightDomColumnsCache(): ColumnInternal<T>[] | undefined;
    /** Set light DOM columns cache */
    set lightDomColumnsCache(value: ColumnInternal<T>[] | undefined);
    /** Get original column nodes */
    get originalColumnNodes(): HTMLElement[] | undefined;
    /** Set original column nodes */
    set originalColumnNodes(value: HTMLElement[] | undefined);
    /** Get light DOM title */
    get lightDomTitle(): string | undefined;
    /** Set light DOM title */
    set lightDomTitle(value: string | undefined);
    /** Get initial column state */
    get initialColumnState(): GridColumnState | undefined;
    /** Set initial column state */
    set initialColumnState(value: GridColumnState | undefined);
    /**
     * Check if sources have changed since last merge.
     */
    get sourcesChanged(): boolean;
    /**
     * Mark that sources have changed and need re-merging.
     * Call this when external state (shell maps, etc.) that feeds into
     * collectAllSources() has been updated.
     */
    markSourcesChanged(): void;
    /** Set gridConfig source */
    setGridConfig(config: GridConfig<T> | undefined): void;
    /** Get the raw gridConfig source */
    getGridConfig(): GridConfig<T> | undefined;
    /** Set columns source */
    setColumns(columns: ColumnConfig<T>[] | ColumnConfigMap<T> | undefined): void;
    /** Get the raw columns source */
    getColumns(): ColumnConfig<T>[] | ColumnConfigMap<T> | undefined;
    /** Set fitMode source */
    setFitMode(mode: FitMode | undefined): void;
    /** Get the raw fitMode source */
    getFitMode(): FitMode | undefined;
    /**
     * Merge all sources into effective config.
     * Also applies post-merge operations (rowHeight, fixed mode widths, animation).
     *
     * Called by RenderScheduler's mergeConfig phase.
     *
     * Two-layer architecture:
     * 1. Sources → #originalConfig (frozen, immutable)
     * 2. Clone → #effectiveConfig (mutable, runtime changes)
     *
     * When sources change, both layers are rebuilt.
     * When sources haven't changed AND columns exist, this is a no-op.
     * Runtime mutations only affect effectiveConfig.
     * resetState() clones originalConfig back to effectiveConfig.
     */
    merge(): void;
    /**
     * Collect current column state by diffing original vs effective.
     * Returns only the changes from the original configuration.
     */
    collectState(plugins: BaseGridPlugin[]): GridColumnState;
    /**
     * Apply column state to the grid.
     */
    applyState(state: GridColumnState, plugins: BaseGridPlugin[]): void;
    /**
     * Reset state to original configuration.
     *
     * Two-layer architecture: Clones #originalConfig back to #effectiveConfig.
     * This discards all runtime changes (hidden, width, order) and restores
     * the state to what was compiled from sources.
     */
    resetState(plugins: BaseGridPlugin[]): void;
    /**
     * Request a debounced state change event.
     */
    requestStateChange(plugins: BaseGridPlugin[]): void;
    /**
     * Set the visibility of a column.
     * @returns true if visibility changed, false otherwise
     */
    setColumnVisible(field: string, visible: boolean): boolean;
    /**
     * Toggle column visibility.
     */
    toggleColumnVisibility(field: string): boolean;
    /**
     * Check if a column is visible.
     */
    isColumnVisible(field: string): boolean;
    /**
     * Show all columns.
     */
    showAllColumns(): void;
    /**
     * Get all columns with visibility info.
     */
    getAllColumns(): Array<{
        field: string;
        header: string;
        visible: boolean;
        lockVisible?: boolean;
        utility?: boolean;
    }>;
    /**
     * Get current column order.
     */
    getColumnOrder(): string[];
    /**
     * Set column order.
     */
    setColumnOrder(order: string[]): void;
    /**
     * Parse light DOM columns from host element.
     */
    parseLightDomColumns(host: HTMLElement): void;
    /**
     * Clear the light DOM columns cache.
     */
    clearLightDomCache(): void;
    /**
     * Register a handler for Light DOM element changes.
     * When elements matching the tag name are added/removed/changed,
     * the callback will be invoked (debounced).
     *
     * @param tagName - The lowercase tag name to watch (e.g., 'tbw-grid-header')
     * @param callback - Called when matching elements change
     */
    registerLightDomHandler(tagName: string, callback: () => void): void;
    /**
     * Unregister a Light DOM element handler.
     */
    unregisterLightDomHandler(tagName: string): void;
    /**
     * Set up MutationObserver to watch for Light DOM changes.
     * This is generic infrastructure - specific handling is done via registered handlers.
     *
     * When Light DOM elements are added/removed/changed, the observer:
     * 1. Identifies which registered tag names were affected
     * 2. Debounces multiple mutations into a single callback per handler
     * 3. Invokes the registered callbacks
     *
     * This mechanism allows plugins to register their own Light DOM elements
     * and handle parsing themselves, then hand config to ConfigManager.
     *
     * @param host - The host element to observe (the grid element)
     */
    observeLightDOM(host: HTMLElement): void;
    /**
     * Register a change listener.
     */
    onChange(callback: () => void): void;
    /**
     * Notify all change listeners.
     */
    notifyChange(): void;
    /**
     * Dispose of the ConfigManager and clean up resources.
     */
    dispose(): void;
}
//# sourceMappingURL=config-manager.d.ts.map