import { type ParsedBlockPatternBlock } from '@wp-typia/block-runtime/metadata-core'; import type { PatternCatalogDiagnostic, PatternCatalogEntry } from './pattern-catalog.js'; /** * Validates section role slugs used by pattern manifests and content markers. */ export declare const PATTERN_SECTION_ROLE_PATTERN: RegExp; /** * Convention used to discover section role markers in serialized pattern * content. Defaults target `core/group` wrappers with a `section` base class, * `section--{role}` role class tokens, and `metadata.sectionRole` attributes. */ export type PatternCatalogSectionRoleConvention = { /** * Serialized block name used as the section wrapper. Defaults to * `core/group`. */ wrapperBlockName?: string; /** * Optional class that marks a wrapper block as section-like even when the * role marker is missing. Defaults to `section`. */ baseClassName?: string; /** * Class token pattern where exactly one `{role}` placeholder is replaced by * the section role slug. Defaults to `section--{role}`. */ roleClassNamePattern?: string; /** * Dot-separated block attribute paths that can carry role slugs. Defaults to * `metadata.sectionRole`. */ roleAttributePaths?: readonly string[]; /** * Warn when a full pattern repeats the same section role marker. Defaults to * `false`. */ requireUniqueFullPatternRoles?: boolean; }; /** * Section wrapper match extracted from a parsed WordPress block tree. */ export type PatternCatalogSectionRoleMatch = { blockName: string; blockPath: string; roles: readonly string[]; }; /** * Fully resolved section-role marker convention with its compiled class matcher. */ export type NormalizedPatternCatalogSectionRoleConvention = Required & { /** * Compiled matcher for role class tokens produced from `roleClassNamePattern`. */ roleClassNamePatternRegExp: RegExp; }; /** * Resolve a section-role convention and compile its class-token matcher. * * @param convention Optional marker convention override. * @returns A fully populated convention ready for repeated block traversal. * @throws When `roleClassNamePattern` does not contain exactly one `{role}` placeholder. */ export declare function normalizePatternCatalogSectionRoleConvention(convention?: PatternCatalogSectionRoleConvention): NormalizedPatternCatalogSectionRoleConvention; /** * Extract section role slugs from serialized block attributes using the * configured class and metadata marker convention. * * @param attributes Parsed block attributes from serialized pattern content. * @param convention Optional marker convention override. * @returns Unique role marker values in discovery order. */ export declare function extractPatternSectionRolesFromAttributes(attributes: Record, convention?: PatternCatalogSectionRoleConvention): string[]; /** * Find section wrapper blocks and their role markers in parsed pattern content. * * @param blocks Parsed block tree returned by `validateBlockPatternContentNesting`. * @param convention Optional marker convention override. * @returns Section wrapper matches with serialized block paths. */ export declare function extractPatternSectionRoleMatches(blocks: readonly ParsedBlockPatternBlock[], convention?: PatternCatalogSectionRoleConvention): PatternCatalogSectionRoleMatch[]; /** * Build the known valid section-role set from pattern catalog entries. * * @param patterns Catalog entries that may declare a `sectionRole`. * @returns Valid section role slugs declared by the catalog. */ export declare function collectKnownPatternSectionRoles(patterns: readonly Pick[]): ReadonlySet; /** * Validate serialized pattern content against the catalog section-role rules. * * @param options Pattern content, marker convention, known roles, and diagnostic context. * @returns Diagnostics for invalid, missing, mismatched, unknown, or duplicate section-role markers. */ export declare function validatePatternContentSectionRoles({ content, contentFile, convention, knownSectionRoles, label, pattern }: { content: string; contentFile: string; convention: NormalizedPatternCatalogSectionRoleConvention; knownSectionRoles: ReadonlySet; label: string; pattern: PatternCatalogEntry; }): PatternCatalogDiagnostic[];