import { BlockValidationResult } from "./validation"; import { BlockInstance } from "@wordpress/blocks"; import Instruction from "./Instruction"; import Leaf from "./Leaf"; export declare type DefinitionClass = { new (separator: string, template?: string, instructions?: Record, tree?: Leaf): T; separatorCharacters: string[]; parser: (definition: T) => T; }; /** * Definition class. */ export default abstract class Definition { separator: string; template: string; instructions: Record; tree: Leaf; /** * Creates a block BlockDefinition. * * @param separator The separator used. * @param template The template. * @param instructions The parsed instructions. * @param tree The parsed leaves. */ constructor(separator: string, template?: string, instructions?: Record, tree?: Leaf); /** * Customizes the way in which a merge is performed. * Concatenates arrays rather than having the first array be overwritten by a second. * * @see https://lodash.com/docs/4.17.15#mergeWith * * @param existingConfig The configuration that should be appended to. * @param newConfig The configuration to append to the existing configuration. * * @returns array The appended configurations. */ customizer(existingConfig: string[], newConfig: string[]): string[]; /** * Returns the configuration of this BlockDefinition. * Applying the customizer makes sure that the configurations of multiple instructions are concatenated rather than overwritten. * * @returns The configuration. */ configuration(): Record; /** * Checks if the Definition block is valid. * * @param blockInstance The block to be validated. * * @returns The validation result for the given block. */ validate(blockInstance: BlockInstance): BlockValidationResult; /** * Registers a definition. */ abstract register(): void; }