{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "api-slate-docs",
  "title": "Slate",
  "description": "API reference for @platejs/slate.",
  "files": [
    {
      "path": "../../content/docs/api/slate.mdx",
      "content": "---\ntitle: Slate\ndescription: API reference for @platejs/slate.\n---\n\n`@platejs/slate` is Plate's framework-free Slate layer. It exports the editor\nfactory, editor APIs, transforms, node/location types, DOM helpers from\n`slate-dom`, history helpers, and small query utilities.\n\n## Installation\n\n```bash\nnpm install @platejs/slate\n```\n\nUse `@platejs/slate` in package code that should not import React or Plate core.\nUse `platejs` in app code when the umbrella package is already available.\n\n## Quick Use\n\n```ts title=\"Create a framework-free editor\"\nimport { createEditor, withHistory } from '@platejs/slate';\n\nconst editor = withHistory(\n  createEditor({\n    children: [{ children: [{ text: 'Hello' }], type: 'p' }],\n  })\n);\n\neditor.tf.insertText(' world');\n\nconst text = editor.api.string([]);\n```\n\n`createEditor` returns an editor with `api`, `tf`, and legacy direct methods.\n`withHistory` replaces `undo`, `redo`, `apply`, and `writeHistory` with real\nhistory behavior.\n\n## Package Surface\n\n| Surface | Export | Use |\n| --- | --- | --- |\n| Editor factory | `createEditor` | Creates a Slate editor and binds Plate's `api` and `tf` namespaces. |\n| Editor types | `Editor`, `Value`, `ValueOf` | Type editor instances and document values. |\n| Editor API | `EditorApi` | Read/query editor state through `editor.api`. |\n| Editor transforms | `EditorTransforms` | Change editor state through `editor.tf`. |\n| Interfaces | `ElementApi`, `NodeApi`, `TextApi`, `PathApi`, `PointApi`, `RangeApi`, `OperationApi` | Typed helpers for Slate data structures. |\n| Refs | `PathRef`, `PointRef`, `RangeRef` | Mutable location refs that track editor operations. |\n| History | `HistoryApi`, `withHistory` | Undo/redo stacks and history batching flags. |\n| DOM helpers | `slate-dom` re-exports | DOM selection, browser, and diff helpers used by editable surfaces. |\n| Utilities | `getAt`, `match`, `queryEditor`, `queryNode`, `deleteMerge` | Shared query and transform predicates. |\n\n## Editor Shape\n\nAn `Editor` contains the Slate document state plus Plate's namespaced helpers.\n\n| Field | Type | Use |\n| --- | --- | --- |\n| `children` | `Value` | Document nodes. |\n| `selection` | `TRange \\| null` | Current selection. |\n| `operations` | `Operation[]` | Operations applied since the last change flush. |\n| `marks` | `Record<string, any> \\| null` | Marks applied to the next inserted text. |\n| `history` | `History` | Undo and redo stacks. |\n| `meta` | `UnknownObject & { isNormalizing?: boolean }` | Custom metadata and normalization state. |\n| `api` | `EditorApi` | Query methods. |\n| `tf` | `EditorTransforms` | Transform methods. |\n| `transforms` | `EditorTransforms` | Alias of `tf` for compatibility. |\n\n`createEditor` also syncs legacy direct methods, so existing Slate-style calls\nsuch as `editor.insertText()` continue to route to the current transform\nimplementation.\n\n## API Map\n\n| Page | Covers |\n| --- | --- |\n| [Editor API](/docs/api/slate/editor-api) | Query methods on `editor.api`, including locations, DOM lookup, marks, blocks, and selection predicates. |\n| [Editor Transforms](/docs/api/slate/editor-transforms) | Mutation methods on `editor.tf`, including text, node, mark, selection, history, and keyboard transforms. |\n| [Node](/docs/api/slate/node) | Node, descendant, ancestor, and node-entry helpers. |\n| [Element](/docs/api/slate/element) | Element types, element props, and element guards. |\n| [Text](/docs/api/slate/text) | Text node types, mark objects, and text guards. |\n| [Path](/docs/api/slate/path) | Path comparison, movement, ancestry, and transform helpers. |\n| [Point](/docs/api/slate/point) | Point comparison, edge checks, and point transforms. |\n| [Range](/docs/api/slate/range) | Range checks, edge helpers, intersection, inclusion, and transforms. |\n| [Location](/docs/api/slate/location) | `Path`, `Point`, `Range`, and `Span` location unions. |\n| [Location Ref](/docs/api/slate/location-ref) | `PathRef`, `PointRef`, and `RangeRef` affinity behavior. |\n| [Operation](/docs/api/slate/operation) | Slate operation types, operation lists, and operation inversion. |\n\n## History\n\n```ts title=\"Batch history\"\neditor.tf.withNewBatch(() => {\n  editor.tf.insertText('Title');\n  editor.tf.insertBreak();\n});\n\neditor.tf.withoutSaving(() => {\n  editor.tf.select([]);\n});\n```\n\n`withHistory` stores undo batches in `history.undos` and redo batches in\n`history.redos`. Selection-only operations are not saved. Adjacent text inserts\nor removals on the same path merge into one batch unless a history transform\nsets a different batching mode.\n\n## DOM Helpers\n\n`@platejs/slate` re-exports selected `slate-dom` helpers, including browser\nflags, DOM point/range types, DOM selection helpers, string diff helpers, and\n`withDOM`.\n\nUse these exports when a package already depends on `@platejs/slate`; import\nfrom `slate-dom` directly only for code that is intentionally independent of\nPlate's Slate layer.\n\n## Utilities\n\n| Utility | Use |\n| --- | --- |\n| `getAt` | Normalizes editor locations and node inputs before query/transform calls. |\n| `match` | Builds node predicates from match options. |\n| `queryEditor` | Checks editor state before running a transform. |\n| `queryNode` | Checks a node against type, path, and predicate options. |\n| `deleteMerge` | Shared delete/merge behavior for text deletion transforms. |\n| `assignLegacyTransforms` / `syncLegacyMethods` | Keeps legacy direct editor methods wired to `editor.tf`. |\n\n## Related APIs\n\n- [Plate](/docs/api/plate) shows where `@platejs/slate` is re-exported from the\n  `platejs` umbrella package.\n- [Plate Editor](/docs/api/core/plate-editor) covers the React/Core editor layer\n  built on top of this package.\n",
      "type": "registry:file",
      "target": "content/docs/plate/api/slate.mdx"
    }
  ],
  "type": "registry:file"
}