import { Block, BlockInstance, InnerBlockTemplate, Transform } from "../"; /** * Given a `BlockInstance`, returns a copy of `BlockInstance`, optionally merging * new attributes and/or replacing its inner blocks. * * @param block - Block instance. * @param mergeAttributes - Block attributes. * @param newInnerBlocks - Nested blocks. */ export function cloneBlock>( block: BlockInstance, mergeAttributes?: Partial, newInnerBlocks?: BlockInstance[], ): BlockInstance; /** * Returns a `BlockInstance` given its type and attributes. * * @param name - Block name. * @param attributes - Block attributes. * @param innerBlocks - Nested blocks. */ export function createBlock>( name: string, attributes?: Partial, innerBlocks?: BlockInstance[], ): BlockInstance; /** * Given an array of InnerBlocks templates or Block Objects, * returns an array of created Blocks from them. * It handles the case of having InnerBlocks as Blocks by * converting them to the proper format to continue recursively. * * @param innerBlocksOrTemplate - Nested blocks or InnerBlocks templates. */ export function createBlocksFromInnerBlocksTemplate( innerBlocksOrTemplate: InnerBlockTemplate[], ): BlockInstance[]; /** * Given an array of transforms, returns the highest-priority transform where * the predicate function returns a truthy value. A higher-priority transform * is one with a lower priority value (i.e. first in priority order). Returns * null if the transforms set is empty or the predicate function returns a * falsey value for all entries. * * @param transforms - Transforms to search. * @param predicate - Function returning true on matching transform. * * @returns Highest-priority transform candidate. */ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics export function findTransform = Record>( transforms: T[], predicate: (transform: T) => boolean, ): Transform | null; /** * Returns normal block transforms for a given transform direction, optionally * for a specific block by name, or an empty array if there are no transforms. * If no block name is provided, returns transforms for all blocks. A normal * transform object includes `blockName` as a property. * * @param direction - Transform direction. * @param blockTypeOrName - `BlockInstance` or name. */ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics export function getBlockTransforms = Record>( direction: "to" | "from", blockTypeOrName?: string | Block, ): Array & { blockName: string }>; /** * Returns an array of block types that the set of blocks received as argument * can be transformed into. * * @param blocks - Array of `BlockInstance` * * @returns Block types that ALL blocks in `blocks` can be transformed to. */ export function getPossibleBlockTransformations(blocks: BlockInstance[]): Array>>; /** * Switch one or more blocks into one or more blocks of the new block type. * * @param blocks - One or more `BlockInstance`. * @param name - Block name of block to be switched to. */ export function switchToBlockType(blocks: BlockInstance | BlockInstance[], name: string): BlockInstance[] | null;