import { Container, EditorSnapshot, Path, PortableTextBlock } from "@portabletext/editor";
import { JSX } from "react";
/**
 * A cell node in the table's value. The content array's field name is
 * configurable (see `defineTable`), so structural reads go through the
 * config-bound accessors rather than properties.
 *
 * @public
 */
type CellNode = PortableTextBlock & {
  _key: string;
};
/**
 * A row node in the table's value.
 *
 * @public
 */
type RowNode = PortableTextBlock & {
  _key: string;
};
/**
 * A table node in the value. `headerRows` is a fixed field name regardless
 * of configuration.
 *
 * @public
 */
type TableNode = PortableTextBlock & {
  _key: string;
  /** Number of leading rows that are header rows. */
  headerRows?: number;
};
/**
 * @public
 */
type TableSelection = {
  tablePath: Path;
  rowRange: [number, number];
  colRange: [number, number];
};
/**
 * The resolved table configuration: which type names and array fields the
 * behaviors, guards, and selection derivation operate on. Derived from the
 * container definitions passed to `defineTable`; the shape itself (three
 * nested levels plus `headerRows` on the table) is fixed.
 */
type TableConfig = {
  tableType: string;
  rowsField: string;
  rowType: string;
  cellsField: string;
  cellType: string;
  valueField: string;
};
/**
 * The container definitions `defineTable` builds on, role-keyed. Each is a
 * `defineContainer(...)` result; an omitted role falls back to the
 * canonical definition (`table`/`row`/`cell` with the bare render).
 *
 * @public
 */
type TableContainers = {
  table?: Container;
  row?: Container;
  cell?: Container;
};
/**
 * What `defineTable` returns: the plugin component, the behaviors for
 * consumers that own container registration themselves, the rectangle
 * selector, and the node guards, all bound to the definition's type names
 * and array fields.
 *
 * @public
 */
type TableDefinition = {
  /**
   * Registers the containers (nested per the definition) and mounts the
   * table behaviors. Renders next to `PortableTextEditable` inside
   * `EditorProvider`.
   */
  Plugin: () => JSX.Element;
  /**
   * The table behaviors, split out so a consumer that owns container
   * registration (its own `NodePlugin`) can mount them with a
   * `<BehaviorPlugin behaviors={table.behaviors} />` instead of `Plugin`.
   */
  behaviors: ReturnType<typeof createTableBehaviors>;
  /**
   * A fresh table block using the definition's type names and array
   * fields, ready for `insert.block`: `rows` by `columns` cells (default
   * 3×3), each holding one empty text block. No `_key`s; the editor
   * generates them on insert. `headerRows` is included only when passed,
   * since the field is optional schema surface.
   */
  createBlock: (options?: {
    rows?: number;
    columns?: number;
    headerRows?: number;
  }) => {
    [key: string]: unknown;
    _type: string;
  };
  /**
   * The rectangle spanned by the current selection's corner cells, or
   * `undefined` unless the selection spans more than one cell of one table
   * matching this definition.
   */
  getTableSelection: (snapshot: EditorSnapshot) => TableSelection | undefined;
  isTable: (node: PortableTextBlock) => node is TableNode;
  isRow: (node: PortableTextBlock) => node is RowNode;
  isCell: (node: PortableTextBlock) => node is CellNode;
};
/**
 * Builds a table definition over role-keyed container definitions. The
 * consumer owns each definition (type name, array field, render, and the
 * cell's `of`); the plugin owns the nesting, grafting `table.of → row.of →
 * cell` itself, because every behavior and the clipboard format depend
 * on the three-level shape. An `of` on the table or row
 * definition draws a warning instead of being honored.
 *
 * No argument yields the canonical definition: `table`/`row`/`cell` type
 * names, `rows`/`cells`/`value` array fields, and bare
 * `<table>`/`<tr>`/`<td>` renders.
 *
 * @public
 */
declare function defineTable(options?: {
  containers?: TableContainers;
}): TableDefinition;
declare function createTableBehaviors(config: TableConfig): import("@portabletext/editor/behaviors").Behavior<"*" | "annotation.*" | "annotation.add" | "annotation.remove" | "annotation.set" | "annotation.toggle" | "block.*" | "block.set" | "block.unset" | "child.*" | "child.set" | "child.unset" | "clipboard.*" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "decorator.*" | "decorator.add" | "decorator.remove" | "decorator.toggle" | "delete" | "delete.*" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialization.*" | "deserialization.failure" | "deserialization.success" | "deserialize" | "deserialize.*" | "deserialize.data" | "drag.*" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragleave" | "drag.dragover" | "drag.dragstart" | "drag.drop" | "history.*" | "history.redo" | "history.undo" | "input.*" | "insert" | "insert.*" | "insert.block" | "insert.blocks" | "insert.break" | "insert.child" | "insert.inline object" | "insert.soft break" | "insert.span" | "insert.text" | "keyboard.*" | "keyboard.keydown" | "keyboard.keyup" | "list item.*" | "list item.add" | "list item.remove" | "list item.toggle" | "mouse.*" | "mouse.click" | "move.*" | "move.backward" | "move.block" | "move.block down" | "move.block up" | "move.forward" | "remove.*" | "remove.text" | "select" | "select.*" | "select.block" | "select.next block" | "select.previous block" | "serialization.*" | "serialization.failure" | "serialization.success" | "serialize" | "serialize.*" | "serialize.data" | "set" | "set.*" | "split" | "split.*" | "style.*" | "style.add" | "style.remove" | "style.toggle" | "unset" | "unset.*" | `custom.${string}`, true, import("@portabletext/editor/behaviors").BehaviorEvent>[];
export { RowNode as a, CellNode as i, TableDefinition as n, TableNode as o, defineTable as r, TableSelection as s, TableContainers as t };
//# sourceMappingURL=define-table-3GV9TkI7.d.ts.map