{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "api-slate-node-docs",
  "title": "Node",
  "description": "API reference for nodes in Plate.",
  "files": [
    {
      "path": "../../content/docs/api/slate/node.mdx",
      "content": "---\ntitle: Node\ndescription: API reference for nodes in Plate.\n---\n\nNodes are the building blocks of Plate documents. It can either be the Editor root node (highest), an Element node, or a Text node (lowest). This API provides utilities for interacting with nodes, including traversing, querying, and extracting data.\n\n```ts\ntype TNode = Editor | TElement | TText;\n\ntype Descendant = Element | Text\ntype Ancestor = Editor | Element\n```\n\n- [Editor](/docs/api/slate/editor-api)\n- [Element](/docs/api/slate/element)\n- [Text](/docs/api/slate/text)\n\n## `NodeAPI`\n\n### `ancestor`\n\nGet the node at a specific path, asserting that it's an ancestor node.\n\n<API name=\"ancestor\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node to start from.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the ancestor node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"Ancestor | undefined\">\n  The ancestor node if found, or `undefined` if not found.\n</APIReturns>\n</API>\n\n### `ancestors`\n\nReturn a generator of all the ancestor nodes above a specific path.\n\n<API name=\"ancestors\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node to start from.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to get ancestors for.\n  </APIItem>\n  <APIItem name=\"options\" type=\"NodeAncestorsOptions\" optional>\n    Options for ancestor retrieval.\n  </APIItem>\n</APIParameters>\n\n<APIOptions type=\"NodeAncestorsOptions\">\n  <APIItem name=\"reverse\" type=\"boolean\" optional>\n    If true, returns ancestors top-down instead of bottom-up.\n  </APIItem>\n</APIOptions>\n\n<APIReturns type=\"Generator<NodeEntry<Ancestor>, void, undefined>\">\n  A generator of ancestor node entries.\n</APIReturns>\n</API>\n\n### `child`\n\nGet the child of a node at a specific index.\n\n<API name=\"child\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The parent node.\n  </APIItem>\n  <APIItem name=\"index\" type=\"number\">\n    The index of the child.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"TNode | undefined\">\n  The child node if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `children`\n\nIterate over the children of a node at a specific path.\n\n<API name=\"children\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the parent node.\n  </APIItem>\n  <APIItem name=\"options\" type=\"NodeChildrenOptions\" optional>\n    Options for iterating over children.\n  </APIItem>\n</APIParameters>\n\n<APIOptions type=\"NodeChildrenOptions\">\n  <APIItem name=\"reverse\" type=\"boolean\" optional>\n    If true, iterates in reverse order.\n  </APIItem>\n  <APIItem name=\"from\" type=\"number\" optional>\n    Start index (inclusive).\n  </APIItem>\n  <APIItem name=\"to\" type=\"number\" optional>\n    End index (exclusive).\n  </APIItem>\n</APIOptions>\n\n<APIReturns type=\"Generator<NodeEntry<TNode>, void, undefined>\">\n  A generator of child node entries.\n</APIReturns>\n</API>\n\n### `common`\n\nGet an entry for the common ancestor node of two paths.\n\n<API name=\"common\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    First path.\n  </APIItem>\n  <APIItem name=\"another\" type=\"Path\">\n    Second path.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeEntry<N> | undefined\">\n  The common ancestor entry if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `descendant`\n\nGet the node at a specific path, asserting that it's a descendant node.\n\n<API name=\"descendant\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the descendant.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"Descendant | undefined\">\n  The descendant node if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `descendants`\n\nReturn a generator of all the descendant node entries inside a root node.\n\n<API name=\"descendants\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"options\" type=\"NodeDescendantsOptions\" optional>\n    Options for descendant retrieval.\n  </APIItem>\n</APIParameters>\n\n<APIOptions type=\"NodeDescendantsOptions\">\n  <APIItem name=\"from\" type=\"Path\" optional>\n    Starting path.\n  </APIItem>\n  <APIItem name=\"to\" type=\"Path\" optional>\n    Ending path.\n  </APIItem>\n  <APIItem name=\"reverse\" type=\"boolean\" optional>\n    If true, iterates in reverse order.\n  </APIItem>\n  <APIItem name=\"pass\" type=\"(node: Descendant) => boolean\" optional>\n    A function to filter descendants.\n  </APIItem>\n</APIOptions>\n\n<APIReturns type=\"Generator<NodeEntry<Descendant>, void, undefined>\">\n  A generator of descendant node entries.\n</APIReturns>\n</API>\n\n### `elements`\n\nReturn a generator of all the element nodes inside a root node.\n\n<API name=\"elements\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"options\" type=\"NodeElementsOptions\" optional>\n    Options for element retrieval.\n  </APIItem>\n</APIParameters>\n\n<APIOptions type=\"NodeElementsOptions\">\n  <APIItem name=\"pass\" type=\"(node: Element) => boolean\" optional>\n    A function to filter elements.\n  </APIItem>\n  <APIItem name=\"reverse\" type=\"boolean\" optional>\n    If true, iterates in reverse order.\n  </APIItem>\n  <APIItem name=\"from\" type=\"Path\" optional>\n    Starting path.\n  </APIItem>\n  <APIItem name=\"to\" type=\"Path\" optional>\n    Ending path.\n  </APIItem>\n</APIOptions>\n\n<APIReturns type=\"Generator<NodeEntry<Element>, void, undefined>\">\n  A generator of element entries.\n</APIReturns>\n</API>\n\n### `first`\n\nGet the first node entry in a root node from a path.\n\n<API name=\"first\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeEntry<N> | undefined\">\n  The first node entry if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `firstChild`\n\nGet the first child node entry of a node.\n\n<API name=\"firstChild\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The parent node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the parent node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeEntry<N> | undefined\">\n  The first child node entry if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `firstText`\n\nGet the first text node entry of a node.\n\n<API name=\"firstText\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The parent node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the parent node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeEntry<N> | undefined\">\n  The first text node entry if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `fragment`\n\nGet the sliced fragment represented by a range inside a root node.\n\n<API name=\"fragment\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"range\" type=\"TRange\">\n    The range to slice.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"N[]\">\n  The sliced fragment.\n</APIReturns>\n</API>\n\n### `get`\n\nGet the descendant node referred to by a specific path.\n\n<API name=\"get\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"TNode | undefined\">\n  The node if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `last`\n\nGet the last node entry in a root node from a path.\n\n<API name=\"last\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeEntry<N> | undefined\">\n  The last node entry if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `lastChild`\n\nGet the last child node entry of a node.\n\n<API name=\"lastChild\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The parent node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the parent node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeEntry<N> | undefined\">\n  The last child node entry if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `leaf`\n\nGet the node at a specific path, ensuring it's a leaf text node.\n\n<API name=\"leaf\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"N | undefined\">\n  The leaf node if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `levels`\n\nReturn a generator of the in a branch of the tree, from a specific path.\n\n<API name=\"levels\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"Generator<NodeEntry<N>, void, undefined>\">\n  A generator of node entries in a branch of the tree from a specific path.\n</APIReturns>\n</API>\n\n### `nodes`\n\nReturn a generator of all the node entries of a root node.\n\n<API name=\"nodes\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"options\" type=\"NodeTextsOptions\" optional>\n    Similar options to `descendants`.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"Generator<NodeEntry<N>, void, undefined>\">\n  A generator of node entries.\n</APIReturns>\n</API>\n\n### `parent`\n\nGet the parent of a node at a specific path.\n\n<API name=\"parent\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"Ancestor | undefined\">\n  The parent node if found, or `undefined` otherwise.\n</APIReturns>\n</API>\n\n### `texts`\n\nReturn a generator of all leaf text nodes in a root node.\n\n<API name=\"texts\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"options\" type=\"NodeTextsOptions\" optional>\n    Options for text node retrieval.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"Generator<NodeEntry<Text>, void, undefined>\">\n  A generator of text node entries.\n</APIReturns>\n</API>\n\n### `extractProps`\n\nGet the props of a node.\n\n<API name=\"extractProps\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"TNode\">\n    The node to extract props from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeProps<N>\">\n  The props of the node.\n</APIReturns>\n</API>\n\n### `has`\n\nCheck if a descendant node exists at a specific path.\n\n<API name=\"has\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to check.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if a node exists at the specified path, `false` otherwise.\n</APIReturns>\n</API>\n\n### `hasSingleChild`\n\nCheck if a node has a single child.\n\n<API name=\"hasSingleChild\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"TNode\">\n    The node to check.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the node has a single child.\n</APIReturns>\n</API>\n\n### `isAncestor`\n\nCheck if a value implements the `Ancestor` interface.\n\n<API name=\"isAncestor\">\n<APIParameters>\n  <APIItem name=\"value\" type=\"any\">\n    The value to check.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the value implements the `Ancestor` interface.\n</APIReturns>\n</API>\n\n### `isDescendant`\n\nCheck if a value implements the `Descendant` interface.\n\n<API name=\"isDescendant\">\n<APIParameters>\n  <APIItem name=\"value\" type=\"any\">\n    The value to check.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the value implements the `Descendant` interface.\n</APIReturns>\n</API>\n\n### `isLastChild`\n\nCheck if a node is the last child of its parent.\n\n<API name=\"isLastChild\">\n<APIParameters>\n  <APIItem name=\"root\" type=\"TNode\">\n    The root node.\n  </APIItem>\n  <APIItem name=\"path\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the node is the last child of its parent.\n</APIReturns>\n</API>\n\n### `isNode`\n\nCheck if a value implements the `TNode` interface.\n\n<API name=\"isNode\">\n<APIParameters>\n  <APIItem name=\"value\" type=\"any\">\n    The value to check.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the value implements the `TNode` interface.\n</APIReturns>\n</API>\n\n### `isNodeList`\n\nCheck if a value is a list of `Descendant` objects.\n\n<API name=\"isNodeList\">\n<APIParameters>\n  <APIItem name=\"value\" type=\"any\">\n    The value to check.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the value is a list of `Descendant` objects.\n</APIReturns>\n</API>\n\n### `matches`\n\nCheck if a node matches a set of props.\n\n<API name=\"matches\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"Descendant\">\n    The node to check.\n  </APIItem>\n  <APIItem name=\"props\" type=\"Partial<Descendant>\">\n    The properties to match against.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the node matches the provided properties.\n</APIReturns>\n</API>\n\n### `string`\n\nGet the concatenated text string of a node's content.\n\n<API name=\"string\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"TNode\">\n    The node to get text from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"string\">\n  The concatenated text content.\n</APIReturns>\n</API>\n\n## Types\n\n### `TNode`\n\n`Node` is a type alias for `TNode`.\n\n```ts\ntype TNode = Editor | TElement | TText;\n```\n\n### `NodeEntry`\n\n`NodeEntry` objects are returned when iterating over the nodes in a Plate document tree. They consist of an array with two elements: the `TNode` and its `Path` relative to the root node in the document.\n\n<API name=\"NodeEntry\">\n<APIAttributes>\n  <APIItem name=\"0\" type=\"TNode\">\n    The node itself.\n  </APIItem>\n  <APIItem name=\"1\" type=\"Path\">\n    The path to the node.\n  </APIItem>\n</APIAttributes>\n</API>\n\n### `Descendant`\n\nThe `Descendant` union type represents nodes that are descendants in the tree.\n\n```ts\ntype Descendant = TElement | TText;\n```\n\n\n### `Ancestor`\n\nThe `Ancestor` union type represents nodes that are ancestors in the tree.\n\n```ts\ntype Ancestor = Editor | TElement;\n```\n\n### `NodeOf<N>`\n\n<API name=\"NodeOf\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"TNode\">\n    The node to get the type of.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"N\">\n  The node type.\n</APIReturns>\n</API>\n\n### `NodeIn<V>`\n\n<API name=\"NodeIn\">\n<APIParameters>\n  <APIItem name=\"value\" type=\"Value\">\n    The value to get node types from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"NodeOf<V[number]>\">\n  All possible node types from the specified value.\n</APIReturns>\n</API>\n\n### `TNodeMatch<N>`\n\n<API name=\"TNodeMatch\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"N\">\n    The node to match.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"boolean\">\n  `true` if the node matches the predicate.\n</APIReturns>\n</API>\n\n### `DescendantOf<N>`\n\n<API name=\"DescendantOf\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"N\">\n    The node to get descendant types from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"DescendantOf<N>\">\n  All possible descendant node types from the specified root node.\n</APIReturns>\n</API>\n\n### `DescendantIn<V>`\n\n<API name=\"DescendantIn\">\n<APIParameters>\n  <APIItem name=\"value\" type=\"Value\">\n    The value to get descendant types from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"DescendantIn<V>\">\n  All possible descendant node types from the specified value.\n</APIReturns>\n</API>\n\n### `ChildOf<N>`\n\n<API name=\"ChildOf\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"N\">\n    The node to get the child type from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"ChildOf<N>\">\n  The child node type.\n</APIReturns>\n</API>\n\n### `AncestorOf<N>`\n\n<API name=\"AncestorOf\">\n<APIParameters>\n  <APIItem name=\"node\" type=\"N\">\n    The node to get ancestor types from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"AncestorOf<N>\">\n  All possible ancestor node types from the specified root node.\n</APIReturns>\n</API>\n\n### `AncestorIn<V>`\n\n<API name=\"AncestorIn\">\n<APIParameters>\n  <APIItem name=\"value\" type=\"Value\">\n    The value to get ancestor types from.\n  </APIItem>\n</APIParameters>\n\n<APIReturns type=\"AncestorIn<V>\">\n  All possible ancestor node types from the specified value.\n</APIReturns>\n</API>\n\n### `AncestorEntry`\n\nAncestor entries represent an ancestor node (Editor or Element) and its path.\n\n<API name=\"AncestorEntry\">\n<APIAttributes>\n  <APIItem name=\"0\" type=\"Ancestor\">\n    The Editor or Element node.\n  </APIItem>\n  <APIItem name=\"1\" type=\"Path\">\n    The path to the ancestor.\n  </APIItem>\n</APIAttributes>\n</API>\n\n### `DescendantEntry`\n\nDescendant entries represent a descendant node (Element or Text) and its path.\n\n<API name=\"DescendantEntry\">\n<APIAttributes>\n  <APIItem name=\"0\" type=\"Descendant\">\n    The Element or Text node.\n  </APIItem>\n  <APIItem name=\"1\" type=\"Path\">\n    The path to the descendant.\n  </APIItem>\n</APIAttributes>\n</API>\n\n### `NodeChildEntry`\n\nNode child entries represent a child node and its path relative to its parent.\n\n<API name=\"NodeChildEntry\">\n<APIAttributes>\n  <APIItem name=\"0\" type=\"TNode\">\n    The child node.\n  </APIItem>\n  <APIItem name=\"1\" type=\"Path\">\n    The path to the child.\n  </APIItem>\n</APIAttributes>\n</API>",
      "type": "registry:file",
      "target": "content/docs/plate/api/slate/node.mdx"
    }
  ],
  "type": "registry:file"
}