import { HeaderContentDefinition, IconValue, ShellConfig, ToolbarButtonConfig, ToolbarButtonInfo, ToolPanelDefinition } from '../types';
/**
 * State for managing shell UI.
 *
 * NOTE: This interface is being refactored. Config-like properties are moving
 * to effectiveConfig.shell. Only runtime state should remain here.
 *
 * @deprecated Properties that are configuration (toolPanels, headerContents, etc.)
 * are moving to ShellConfig in types.ts. Use ShellRuntimeState for new code.
 */
export interface ShellState {
    /** Registered tool panels (from plugins + consumer API) */
    toolPanels: Map<string, ToolPanelDefinition>;
    /** Registered header content (from plugins + consumer API) */
    headerContents: Map<string, HeaderContentDefinition>;
    /** Custom toolbar buttons registered via API */
    toolbarButtons: Map<string, ToolbarButtonConfig>;
    /** Whether a <tbw-grid-tool-buttons> container was found in light DOM */
    hasToolButtonsContainer: boolean;
    /** Light DOM header content elements */
    lightDomHeaderContent: HTMLElement[];
    /** Light DOM header title from <tbw-grid-header title="..."> */
    lightDomTitle: string | null;
    /** IDs of tool panels registered from light DOM (to avoid re-parsing) */
    lightDomToolPanelIds: Set<string>;
    /** IDs of tool panels registered via registerToolPanel API */
    apiToolPanelIds: Set<string>;
    /** Whether the tool panel sidebar is open */
    isPanelOpen: boolean;
    /** Which accordion sections are expanded (by panel ID) */
    expandedSections: Set<string>;
    /** Whether light DOM header content has been moved to placeholder (perf optimization) */
    lightDomContentMoved: boolean;
    /** Whether light DOM toolbar buttons have been moved to placeholder (perf optimization) */
    lightDomToolButtonsMoved: boolean;
    /** Cleanup functions for header content render returns */
    headerContentCleanups: Map<string, () => void>;
    /** Cleanup functions for each panel section's render return */
    panelCleanups: Map<string, () => void>;
    /** Cleanup functions for toolbar button render returns */
    toolbarButtonCleanups: Map<string, () => void>;
}
/**
 * Runtime-only shell state (not configuration).
 *
 * Configuration (toolPanels, headerContents, toolbarButtons, title) lives in
 * effectiveConfig.shell. This state holds runtime UI state and cleanup functions.
 */
export interface ShellRuntimeState {
    /** Whether the tool panel sidebar is currently open */
    isPanelOpen: boolean;
    /** Which accordion sections are currently expanded (by panel ID) */
    expandedSections: Set<string>;
    /** Cleanup functions for header content render returns */
    headerContentCleanups: Map<string, () => void>;
    /** Cleanup functions for each panel section's render return */
    panelCleanups: Map<string, () => void>;
    /** Cleanup functions for toolbar button render returns */
    toolbarButtonCleanups: Map<string, () => void>;
    /** IDs of tool panels registered from light DOM (to avoid re-parsing) */
    lightDomToolPanelIds: Set<string>;
    /** IDs of tool panels registered via registerToolPanel API */
    apiToolPanelIds: Set<string>;
    /** Whether a <tbw-grid-tool-buttons> container was found in light DOM */
    hasToolButtonsContainer: boolean;
}
/**
 * Create initial shell runtime state.
 */
export declare function createShellRuntimeState(): ShellRuntimeState;
/**
 * Create initial shell state.
 */
export declare function createShellState(): ShellState;
/**
 * Determine if shell header should be rendered.
 * Reads only from effectiveConfig.shell (single source of truth).
 */
export declare function shouldRenderShellHeader(config: ShellConfig | undefined): boolean;
/**
 * Render the shell header HTML.
 *
 * Toolbar buttons come from two sources:
 * 1. Light DOM slot (users provide their own HTML buttons)
 * 2. Config/API with element or render function (programmatic insertion)
 *
 * The grid does NOT create buttons from config (icon/action).
 * Users have full control over button HTML, styling, and behavior.
 * The only button the grid creates is the tool panel toggle.
 *
 * @param toolPanelIcon - Icon for the tool panel toggle (from grid icon config)
 */
export declare function renderShellHeader(config: ShellConfig | undefined, state: ShellState, toolPanelIcon?: IconValue): string;
/**
 * Render the shell body wrapper HTML (contains grid content + accordion-style tool panel).
 * @param icons - Optional icons for expand/collapse chevrons (from grid config)
 */
export declare function renderShellBody(config: ShellConfig | undefined, state: ShellState, gridContentHtml: string, icons?: {
    expand?: IconValue;
    collapse?: IconValue;
}): string;
/**
 * Parse light DOM shell elements (tbw-grid-header, etc.).
 * Safe to call multiple times - will only parse once when elements are available.
 */
export declare function parseLightDomShell(host: HTMLElement, state: ShellState): void;
/**
 * Parse toolbar buttons container element (<tbw-grid-tool-buttons>).
 * This is a container element that holds custom toolbar buttons.
 * Users put their buttons inside and have full control over their HTML.
 *
 * Example:
 * ```html
 * <tbw-grid>
 *   <tbw-grid-tool-buttons>
 *     <button>My button</button>
 *     <button>My other button</button>
 *   </tbw-grid-tool-buttons>
 * </tbw-grid>
 * ```
 *
 * The container's children are moved to the toolbar placeholder after shell renders.
 */
export declare function parseLightDomToolButtons(host: HTMLElement, state: ShellState): void;
/**
 * Callback type for creating a tool panel renderer from a light DOM element.
 * This is used by framework adapters (Angular, React, etc.) to create renderers
 * from their template syntax.
 */
export type ToolPanelRendererFactory = (element: HTMLElement) => ((container: HTMLElement) => void | (() => void)) | undefined;
/**
 * Parse light DOM tool panel elements (<tbw-grid-tool-panel>).
 * These can appear as direct children of <tbw-grid> for declarative tool panel configuration.
 *
 * Attributes:
 * - `id` (required): Unique panel identifier
 * - `title` (required): Panel title shown in accordion header
 * - `icon`: Icon for accordion section header (emoji or text)
 * - `tooltip`: Tooltip for accordion section header
 * - `order`: Panel order priority (lower = first, default: 100)
 *
 * For vanilla JS, the element's innerHTML is used as the panel content.
 * For framework adapters, the adapter can provide a custom renderer factory.
 *
 * @param host - The grid host element
 * @param state - Shell state to update
 * @param rendererFactory - Optional factory for creating renderers (used by framework adapters)
 */
export declare function parseLightDomToolPanels(host: HTMLElement, state: ShellState, rendererFactory?: ToolPanelRendererFactory): void;
/**
 * Set up event listeners for shell toolbar buttons and accordion.
 */
export declare function setupShellEventListeners(renderRoot: Element, config: ShellConfig | undefined, state: ShellState, callbacks: {
    onPanelToggle: () => void;
    onSectionToggle: (sectionId: string) => void;
    onToolbarButtonClick: (buttonId: string) => void;
}): void;
/**
 * Set up resize handle for tool panel.
 * Returns a cleanup function to remove event listeners.
 */
export declare function setupToolPanelResize(renderRoot: Element, config: ShellConfig | undefined, onResize: (width: number) => void): () => void;
/**
 * Render custom button elements/render functions into toolbar slots.
 * Also moves light DOM toolbar buttons to the placeholder (once).
 */
export declare function renderCustomToolbarButtons(renderRoot: Element, config: ShellConfig | undefined, state: ShellState, host?: HTMLElement): void;
/**
 * Render header content from plugins into the shell content area.
 * Also moves light DOM header content to the placeholder (once).
 */
export declare function renderHeaderContent(renderRoot: Element, state: ShellState): void;
/**
 * Render content for expanded accordion sections.
 * @param icons - Optional icons for expand/collapse chevrons (from grid config)
 */
export declare function renderPanelContent(renderRoot: Element, state: ShellState, icons?: {
    expand?: IconValue;
    collapse?: IconValue;
}): void;
/**
 * Update toolbar button active states.
 */
export declare function updateToolbarActiveStates(renderRoot: Element, state: ShellState): void;
/**
 * Update tool panel open/close state.
 */
export declare function updatePanelState(renderRoot: Element, state: ShellState): void;
/**
 * Get all toolbar button info (for debugging/introspection only).
 * Since users have full control over their button HTML, this returns limited info.
 */
export declare function getToolbarButtonsInfo(config: ShellConfig | undefined, state: ShellState): ToolbarButtonInfo[];
/**
 * Cleanup all shell state when grid disconnects.
 */
export declare function cleanupShellState(state: ShellState): void;
/**
 * Callbacks for ShellController to communicate with the grid.
 * This interface decouples the controller from grid internals.
 */
export interface ShellControllerCallbacks {
    /** Get the render root for DOM queries (the grid element) */
    getShadow: () => Element;
    /** Get the current shell config */
    getShellConfig: () => ShellConfig | undefined;
    /** Get accordion expand/collapse icons */
    getAccordionIcons: () => {
        expand: IconValue;
        collapse: IconValue;
    };
    /** Emit an event from the grid */
    emit: (eventName: string, detail: unknown) => void;
    /** Refresh the shell header (re-parse light DOM and re-render) */
    refreshShellHeader: () => void;
}
/**
 * Controller interface for managing shell/tool panel behavior.
 */
export interface ShellController {
    /** Whether the shell has been initialized */
    readonly isInitialized: boolean;
    /** Set the initialized state */
    setInitialized(value: boolean): void;
    /** Whether the tool panel is currently open */
    readonly isPanelOpen: boolean;
    /** Get the currently active panel ID (deprecated) */
    readonly activePanel: string | null;
    /** Get IDs of expanded accordion sections */
    readonly expandedSections: string[];
    /** Open the tool panel */
    openToolPanel(): void;
    /** Close the tool panel */
    closeToolPanel(): void;
    /** Toggle the tool panel */
    toggleToolPanel(): void;
    /** Toggle an accordion section */
    toggleToolPanelSection(sectionId: string): void;
    /** Get registered tool panels */
    getToolPanels(): ToolPanelDefinition[];
    /** Register a tool panel */
    registerToolPanel(panel: ToolPanelDefinition): void;
    /** Unregister a tool panel */
    unregisterToolPanel(panelId: string): void;
    /** Get registered header contents */
    getHeaderContents(): HeaderContentDefinition[];
    /** Register header content */
    registerHeaderContent(content: HeaderContentDefinition): void;
    /** Unregister header content */
    unregisterHeaderContent(contentId: string): void;
    /** Get all toolbar buttons info */
    getToolbarButtons(): ToolbarButtonInfo[];
    /** Register a toolbar button */
    registerToolbarButton(button: ToolbarButtonConfig): void;
    /** Unregister a toolbar button */
    unregisterToolbarButton(buttonId: string): void;
    /** Enable/disable a toolbar button */
    setToolbarButtonDisabled(buttonId: string, disabled: boolean): void;
}
/**
 * Create a ShellController instance.
 * The controller encapsulates all tool panel orchestration logic.
 */
export declare function createShellController(state: ShellState, callbacks: ShellControllerCallbacks): ShellController;
/**
 * Core grid content HTML template.
 * Uses faux scrollbar pattern for smooth virtualized scrolling.
 */
export declare const GRID_CONTENT_HTML = "\n  <div class=\"tbw-scroll-area\">\n    <div class=\"rows-body-wrapper\">\n      <div class=\"rows-body\" role=\"grid\">\n        <div class=\"header\" role=\"rowgroup\">\n          <div class=\"header-row\" role=\"row\" part=\"header-row\"></div>\n        </div>\n        <div class=\"rows-container\" role=\"presentation\">\n          <div class=\"rows-viewport\" role=\"presentation\">\n            <div class=\"rows\"></div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n  <div class=\"faux-vscroll\">\n    <div class=\"faux-vscroll-spacer\"></div>\n  </div>\n";
/**
 * Build the complete grid DOM structure using direct DOM construction.
 * This is 2-3x faster than innerHTML for initial render.
 *
 * @param renderRoot - The element to render into (will be cleared)
 * @param shellConfig - Shell configuration
 * @param state - Shell state
 * @param icons - Optional icons
 * @returns Whether shell is active (for post-render setup)
 */
export declare function buildGridDOMIntoElement(renderRoot: Element, shellConfig: ShellConfig | undefined, runtimeState: {
    isPanelOpen: boolean;
    expandedSections: Set<string>;
}, icons?: {
    toolPanel?: IconValue;
    expand?: IconValue;
    collapse?: IconValue;
}): boolean;
//# sourceMappingURL=shell.d.ts.map