/** * A representation of a single node within a block's rich text value. If * representing a text node, the value is simply a string of the node value. * As representing an element node, it is an object of: * * 1. `type` (string): Tag name. * 2. `props` (object): Attributes and children array of BlockNode. */ type BlockNode = string | { type: string; props: Record; }; /** * Given a single node and a node type (e.g. `'br'`), returns true if the node * corresponds to that type, false otherwise. * * @param node Block node to test * @param type Node to type to test against. * * @return Whether node is of intended type. */ declare function isNodeOfType(node: BlockNode, type: string): boolean; /** * Given an object implementing the NamedNodeMap interface, returns a plain * object equivalent value of name, value key-value pairs. * * @see https://dom.spec.whatwg.org/#interface-namednodemap * * @param nodeMap NamedNodeMap to convert to object. * * @return Object equivalent value of NamedNodeMap. */ export declare function getNamedNodeMapAsObject(nodeMap: NamedNodeMap): Record; /** * Given a DOM Element or Text node, returns an equivalent block node. Throws * if passed any node type other than element or text. * * @throws {TypeError} If non-element/text node is passed. * * @param domNode DOM node to convert. * * @return Block node equivalent to DOM node. */ export declare function fromDOM(domNode: Node): BlockNode; /** * Given a block node, returns its HTML string representation. * * @param node Block node to convert to string. * * @return String HTML representation of block node. */ export declare function toHTML(node: BlockNode): string; /** * Given a selector, returns an hpq matcher generating a BlockNode value * matching the selector result. * * @param selector DOM selector. * * @return hpq matcher. */ export declare function matcher(selector?: string): (domNode: Element) => BlockNode | null; /** * Object of utility functions used in managing block attribute values of * source `node`. * * @see https://github.com/WordPress/gutenberg/pull/10439 * * @deprecated since 4.0. The `node` source should not be used, and can be * replaced by the `html` source. * * @private */ declare const _default: { isNodeOfType: typeof isNodeOfType; fromDOM: typeof fromDOM; toHTML: typeof toHTML; matcher: typeof matcher; }; export default _default; //# sourceMappingURL=node.d.ts.map