import { type BlockElementType, type BlockAttributes, type BlockPreset, type VisibleBlockItem, type PresetReference } from "../TemplateEditor/store"; export interface UseBlockConfigResult { /** * Currently visible blocks in the sidebar. * Can include both built-in block types and preset references. */ visibleBlocks: VisibleBlockItem[]; /** * Set which blocks are visible in the sidebar (and their order). * Use strings for built-in blocks and { type, preset } for presets. * * @example * setVisibleBlocks([ * 'text', * { type: 'button', preset: 'portal' }, // preset between text and image * 'image', * 'button', * ]); */ setVisibleBlocks: (blocks: VisibleBlockItem[]) => void; /** * Reset visible blocks to defaults */ resetVisibleBlocks: () => void; /** * Default visible blocks for reference */ defaultVisibleBlocks: VisibleBlockItem[]; /** * Set default attributes for a block type. * These defaults are applied when creating new blocks of this type. */ setDefaults: (type: BlockElementType, defaults: BlockAttributes) => void; /** * Get default attributes for a block type */ getDefaults: (type: BlockElementType) => BlockAttributes | undefined; /** * Clear defaults for a block type (revert to built-in defaults) */ clearDefaults: (type: BlockElementType) => void; /** * Register a block preset (pre-configured variant of a block type) */ registerPreset: (preset: BlockPreset) => void; /** * Unregister a preset by type and key */ unregisterPreset: (type: BlockElementType, key: string) => void; /** * Get all registered presets */ presets: BlockPreset[]; /** * Get presets for a specific block type */ getPresetsForType: (type: BlockElementType) => BlockPreset[]; /** * Insert a block at the end of the document. * If presetKey is provided, uses the preset's attributes. * Otherwise, uses the type's defaults (if set). */ insertBlock: (type: BlockElementType, presetKey?: string) => void; } /** * Hook to configure and manage block elements in the editor. * * This hook provides a comprehensive API for: * - Controlling which blocks appear in the sidebar and their order * - Setting default attributes for block types * - Creating and managing block presets (pre-configured variants) * - Programmatically inserting blocks * * @returns Object containing all block configuration functions and state * * @example * ```tsx * const { * visibleBlocks, * setVisibleBlocks, * setDefaults, * registerPreset, * insertBlock, * } = useBlockConfig(); * * // Register a preset first * registerPreset({ * type: 'button', * key: 'portal', * label: 'Go to Portal', * attributes: { href: 'https://portal.example.com', content: 'Go to Portal' } * }); * * // Control which blocks appear in sidebar (including presets) * setVisibleBlocks([ * 'text', * { type: 'button', preset: 'portal' }, // Preset between text and image * 'image', * 'button', * ]); * * // Set defaults for all new buttons * setDefaults('button', { borderRadius: '4px', backgroundColor: '#007bff' }); * * // Insert a block programmatically * insertBlock('button', 'portal'); * ``` */ export declare const useBlockConfig: () => UseBlockConfigResult; export type { BlockElementType, BlockAttributes, BlockPreset, VisibleBlockItem, PresetReference };