/** * Block Service * * Provides block lookup and query operations. * Uses pre-computed data from block-registry for O(1) operations. * * @module BlockService */ import type { BlockConfig, BlockCategory } from '../../types/blocks'; /** * Block Service - Provides runtime block queries * * This service layer abstracts block registry access, making the registry * a pure data structure (Data-Only pattern). All query logic lives here. * * Performance: All operations are O(1) or O(n) with zero I/O. */ export declare class BlockService { /** * Get all registered blocks * * @returns Array of all block configurations * * @example * ```typescript * const blocks = BlockService.getAll() * // Returns all 16 blocks from the registry * ``` */ static getAll(): BlockConfig[]; /** * Get block by slug * * @param slug - Unique block identifier * @returns Block configuration or undefined if not found * * @example * ```typescript * const heroBlock = BlockService.get('hero') * if (heroBlock) { * console.log(heroBlock.name) // "Hero Section" * } * ``` */ static get(slug: string): BlockConfig | undefined; /** * Get blocks by category * * @param category - Block category to filter by * @returns Array of blocks in the specified category * * @example * ```typescript * const heroBlocks = BlockService.getByCategory('hero') * // Returns all hero blocks (4 blocks) * ``` */ static getByCategory(category: BlockCategory): BlockConfig[]; /** * Check if block exists * * @param slug - Block slug to check * @returns True if block exists in registry * * @example * ```typescript * if (BlockService.has('hero')) { * // Block exists, safe to use * } * ``` */ static has(slug: string): boolean; /** * Get blocks that are allowed in patterns * Filters out blocks with allowInPatterns: false * * @returns Array of blocks allowed in patterns * * @example * ```typescript * const patternsBlocks = BlockService.getForPatterns() * // Returns all blocks except pattern references * ``` */ static getForPatterns(): BlockConfig[]; /** * Get blocks for a specific entity scope, respecting pattern context * * @param entitySlug - Entity slug (e.g., 'pages', 'posts', 'patterns') * @returns Filtered blocks array * * @example * ```typescript * // Get blocks for pages * const pageBlocks = BlockService.getForScope('pages') * * // Get blocks for patterns (excludes blocks with allowInPatterns: false) * const patternBlocks = BlockService.getForScope('patterns') * ``` */ static getForScope(entitySlug: string): BlockConfig[]; } //# sourceMappingURL=block.service.d.ts.map