fix: resolve TypeScript errors in frontend build

This commit is contained in:
Hiro
2026-03-30 23:16:07 +00:00
parent b733306773
commit 24925e1acb
2941 changed files with 418042 additions and 49 deletions

19
node_modules/prosemirror-tables/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (C) 2015-2016 by Marijn Haverbeke <marijnh@gmail.com> and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

254
node_modules/prosemirror-tables/README.md generated vendored Normal file
View File

@@ -0,0 +1,254 @@
# ProseMirror table module
This module defines a schema extension to support tables with
rowspan/colspan support, a custom selection class for cell selections
in such a table, a plugin to manage such selections and enforce
invariants on such tables, and a number of commands to work with
tables.
The `demo` directory contains a `demo.ts` and `index.html`, which
can be built with `pnpm run build_demo` to show a simple demo of how the
module can be used.
## [Live Demo](https://prosemirror-tables.netlify.app/)
## Documentation
The module's main file exports everything you need to work with it.
The first thing you'll probably want to do is create a table-enabled
schema. That's what `tableNodes` is for:
* **`tableNodes`**`(options: Object) → Object`\
This function creates a set of [node
specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for
`table`, `table_row`, and `table_cell` nodes types as used by this
module. The result can then be added to the set of nodes when
creating a a schema.
* **`options`**`: Object`\
The following options are understood:
* **`tableGroup`**`: ?string`\
A group name (something like `"block"`) to add to the table
node type.
* **`cellContent`**`: string`\
The content expression for table cells.
* **`cellAttributes`**`: ?Object`\
Additional attributes to add to cells. Maps attribute names to
objects with the following properties:
* **`default`**`: any`\
The attribute's default value.
* **`getFromDOM`**`: ?fn(dom.Node) → any`\
A function to read the attribute's value from a DOM node.
* **`setDOMAttr`**`: ?fn(value: any, attrs: Object)`\
A function to add the attribute's value to an attribute
object that's used to render the cell's DOM.
* **`tableEditing`**`() → Plugin`\
Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)
that, when added to an editor, enables cell-selection, handles
cell-based copy/paste, and makes sure tables stay well-formed (each
row has the same width, and cells don't overlap).
You should probably put this plugin near the end of your array of
plugins, since it handles mouse and arrow key events in tables
rather broadly, and other plugins, like the gap cursor or the
column-width dragging plugin, might want to get a turn first to
perform more specific behavior.
### class CellSelection extends Selection
A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)
subclass that represents a cell selection spanning part of a table.
With the plugin enabled, these will be created when the user
selects across cells, and will be drawn by giving selected cells a
`selectedCell` CSS class.
* `new `**`CellSelection`**`($anchorCell: ResolvedPos, $headCell: ?ResolvedPos = $anchorCell)`\
A table selection is identified by its anchor and head cells. The
positions given to this constructor should point _before_ two
cells in the same table. They may be the same, to select a single
cell.
* **`$anchorCell`**`: ResolvedPos`\
A resolved position pointing _in front of_ the anchor cell (the one
that doesn't move when extending the selection).
* **`$headCell`**`: ResolvedPos`\
A resolved position pointing in front of the head cell (the one
moves when extending the selection).
* **`content`**`() → Slice`\
Returns a rectangular slice of table rows containing the selected
cells.
* **`isColSelection`**`() → bool`\
True if this selection goes all the way from the top to the
bottom of the table.
* **`isRowSelection`**`() → bool`\
True if this selection goes all the way from the left to the
right of the table.
* `static `**`colSelection`**`($anchorCell: ResolvedPos, $headCell: ?ResolvedPos = $anchorCell) → CellSelection`\
Returns the smallest column selection that covers the given anchor
and head cell.
* `static `**`rowSelection`**`($anchorCell: ResolvedPos, $headCell: ?ResolvedPos = $anchorCell) → CellSelection`\
Returns the smallest row selection that covers the given anchor
and head cell.
* `static `**`create`**`(doc: Node, anchorCell: number, headCell: ?number = anchorCell) → CellSelection`
### Commands
The following commands can be used to make table-editing functionality
available to users.
* **`addColumnBefore`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Command to add a column before the column with the selection.
* **`addColumnAfter`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Command to add a column after the column with the selection.
* **`deleteColumn`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Command function that removes the selected columns from a table.
* **`addRowBefore`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Add a table row before the selection.
* **`addRowAfter`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Add a table row after the selection.
* **`deleteRow`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Remove the selected rows from a table.
* **`mergeCells`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Merge the selected cells into a single cell. Only available when
the selected cells' outline forms a rectangle.
* **`splitCell`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Split a selected cell, whose rowpan or colspan is greater than one,
into smaller cells. Use the first cell type for the new cells.
* **`splitCellWithType`**`(getType: fn({row: number, col: number, node: Node}) → NodeType) → fn(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Split a selected cell, whose rowpan or colspan is greater than one,
into smaller cells with the cell type (th, td) returned by getType function.
* **`setCellAttr`**`(name: string, value: any) → fn(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Returns a command that sets the given attribute to the given value,
and is only available when the currently selected cell doesn't
already have that attribute set to that value.
* **`toggleHeaderRow`**`(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Toggles whether the selected row contains header cells.
* **`toggleHeaderColumn`**`(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Toggles whether the selected column contains header cells.
* **`toggleHeaderCell`**`(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Toggles whether the selected cells are header cells.
* **`toggleHeader`**`(type: string, options: ?{useDeprecatedLogic: bool}) → fn(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Toggles between row/column header and normal cells (Only applies to first row/column).
For deprecated behavior pass `useDeprecatedLogic` in options with true.
* **`goToNextCell`**`(direction: number) → fn(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Returns a command for selecting the next (direction=1) or previous
(direction=-1) cell in a table.
* **`deleteTable`**`(state: EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Deletes the table around the selection, if any.
* **`moveTableRow`**`(options: MoveTableRowOptions) → fn(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Move a table row from one index to another.
* **`moveTableColumn`**`(options: MoveTableColumnOptions) → fn(EditorState, dispatch: ?fn(tr: Transaction)) → bool`\
Move a table column from one index to another.
### Utilities
* **`fixTables`**`(state: EditorState, oldState: ?EditorState) → ?Transaction`\
Inspect all tables in the given state's document and return a
transaction that fixes them, if necessary. If `oldState` was
provided, that is assumed to hold a previous, known-good state,
which will be used to avoid re-scanning unchanged parts of the
document.
* **`findTable`**`($pos: ResolvedPos) → ?FindNodeResult`\
Find the closest table node that contains the given position, if any.
* **`findCellRange`**`($pos: ResolvedPos, anchorHit: ?number, headHit: ?number) → ?[ResolvedPos, ResolvedPos]`\
Find the anchor and head cell in the same table by using the given position and optional hit positions, or fallback to the selection's anchor and head.
* **`findCellPos`**`(doc: Node, pos: number) → ?ResolvedPos`\
Find a resolved pos of a cell by using the given position as a hit point.
### class TableMap
A table map describes the structore of a given table. To avoid
recomputing them all the time, they are cached per table node. To
be able to do that, positions saved in the map are relative to the
start of the table, rather than the start of the document.
* **`width`**`: number`\
The width of the table
* **`height`**`: number`\
The table's height
* **`map`**`: [number]`\
A width * height array with the start position of
the cell covering that part of the table in each slot
* **`findCell`**`(pos: number) → Rect`\
Find the dimensions of the cell at the given position.
* **`colCount`**`(pos: number) → number`\
Find the left side of the cell at the given position.
* **`nextCell`**`(pos: number, axis: string, dir: number) → ?number`\
Find the next cell in the given direction, starting from the cell
at `pos`, if any.
* **`rectBetween`**`(a: number, b: number) → Rect`\
Get the rectangle spanning the two given cells.
* **`cellsInRect`**`(rect: Rect) → [number]`\
Return the position of all cells that have the top left corner in
the given rectangle.
* **`positionAt`**`(row: number, col: number, table: Node) → number`\
Return the position at which the cell at the given row and column
starts, or would start, if a cell started there.
* `static `**`get`**`(table: Node) → TableMap`\
Find the table map for the given table node.

2683
node_modules/prosemirror-tables/dist/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

751
node_modules/prosemirror-tables/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,751 @@
import { Command, EditorState, Plugin, PluginKey, Selection, Transaction } from "prosemirror-state";
import { Attrs, Fragment, Node, NodeSpec, NodeType, ResolvedPos, Schema, Slice } from "prosemirror-model";
import { EditorView, NodeView, ViewMutationRecord } from "prosemirror-view";
import { Mappable } from "prosemirror-transform";
//#region src/fixtables.d.ts
/**
* @public
*/
declare const fixTablesKey: PluginKey<{
fixTables: boolean;
}>;
/**
* Inspect all tables in the given state's document and return a
* transaction that fixes them, if necessary. If `oldState` was
* provided, that is assumed to hold a previous, known-good state,
* which will be used to avoid re-scanning unchanged parts of the
* document.
*
* @public
*/
declare function fixTables(state: EditorState, oldState?: EditorState): Transaction | undefined;
//#endregion
//#region src/input.d.ts
/**
* @public
*/
type Direction = -1 | 1;
/**
* @public
*/
declare function handlePaste(view: EditorView, _: ClipboardEvent, slice: Slice): boolean;
//#endregion
//#region src/tablemap.d.ts
/**
* @public
*/
type ColWidths = number[];
/**
* @public
*/
type Problem = {
type: 'colwidth mismatch';
pos: number;
colwidth: ColWidths;
} | {
type: 'collision';
pos: number;
row: number;
n: number;
} | {
type: 'missing';
row: number;
n: number;
} | {
type: 'overlong_rowspan';
pos: number;
n: number;
} | {
type: 'zero_sized';
};
/**
* @public
*/
interface Rect {
left: number;
top: number;
right: number;
bottom: number;
}
/**
* A table map describes the structure of a given table. To avoid
* recomputing them all the time, they are cached per table node. To
* be able to do that, positions saved in the map are relative to the
* start of the table, rather than the start of the document.
*
* @public
*/
declare class TableMap {
/**
* The number of columns
*/
width: number;
/**
* The number of rows
*/
height: number;
/**
* A width * height array with the start position of
* the cell covering that part of the table in each slot
*/
map: number[];
/**
* An optional array of problems (cell overlap or non-rectangular
* shape) for the table, used by the table normalizer.
*/
problems: Problem[] | null;
constructor(
/**
* The number of columns
*/
width: number,
/**
* The number of rows
*/
height: number,
/**
* A width * height array with the start position of
* the cell covering that part of the table in each slot
*/
map: number[],
/**
* An optional array of problems (cell overlap or non-rectangular
* shape) for the table, used by the table normalizer.
*/
problems: Problem[] | null);
findCell(pos: number): Rect;
colCount(pos: number): number;
nextCell(pos: number, axis: 'horiz' | 'vert', dir: number): null | number;
rectBetween(a: number, b: number): Rect;
cellsInRect(rect: Rect): number[];
positionAt(row: number, col: number, table: Node): number;
static get(table: Node): TableMap;
}
//#endregion
//#region src/util.d.ts
/**
* @public
*/
type MutableAttrs = Record<string, unknown>;
/**
* @public
*/
interface CellAttrs {
colspan: number;
rowspan: number;
colwidth: number[] | null;
}
/**
* @public
*/
declare const tableEditingKey: PluginKey<number>;
/**
* @public
*/
declare function cellAround($pos: ResolvedPos): ResolvedPos | null;
/**
* @public
*/
declare function isInTable(state: EditorState): boolean;
/**
* @internal
*/
declare function selectionCell(state: EditorState): ResolvedPos;
/**
* @public
*/
declare function cellNear($pos: ResolvedPos): ResolvedPos | undefined;
/**
* @public
*/
declare function pointsAtCell($pos: ResolvedPos): boolean;
/**
* @public
*/
declare function moveCellForward($pos: ResolvedPos): ResolvedPos;
/**
* @internal
*/
declare function inSameTable($cellA: ResolvedPos, $cellB: ResolvedPos): boolean;
/**
* @public
*/
declare function findCell($pos: ResolvedPos): Rect;
/**
* @public
*/
declare function colCount($pos: ResolvedPos): number;
/**
* @public
*/
declare function nextCell($pos: ResolvedPos, axis: 'horiz' | 'vert', dir: number): ResolvedPos | null;
/**
* @public
*/
declare function removeColSpan(attrs: CellAttrs, pos: number, n?: number): CellAttrs;
/**
* @public
*/
declare function addColSpan(attrs: CellAttrs, pos: number, n?: number): Attrs;
/**
* @public
*/
declare function columnIsHeader(map: TableMap, table: Node, col: number): boolean;
//#endregion
//#region src/cellselection.d.ts
/**
* @public
*/
interface CellSelectionJSON {
type: string;
anchor: number;
head: number;
}
/**
* A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)
* subclass that represents a cell selection spanning part of a table.
* With the plugin enabled, these will be created when the user
* selects across cells, and will be drawn by giving selected cells a
* `selectedCell` CSS class.
*
* @public
*/
declare class CellSelection extends Selection {
$anchorCell: ResolvedPos;
$headCell: ResolvedPos;
constructor($anchorCell: ResolvedPos, $headCell?: ResolvedPos);
map(doc: Node, mapping: Mappable): CellSelection | Selection;
content(): Slice;
replace(tr: Transaction, content?: Slice): void;
replaceWith(tr: Transaction, node: Node): void;
forEachCell(f: (node: Node, pos: number) => void): void;
isColSelection(): boolean;
static colSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
isRowSelection(): boolean;
eq(other: unknown): boolean;
static rowSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
toJSON(): CellSelectionJSON;
static fromJSON(doc: Node, json: CellSelectionJSON): CellSelection;
static create(doc: Node, anchorCell: number, headCell?: number): CellSelection;
getBookmark(): CellBookmark;
}
/**
* @public
*/
declare class CellBookmark {
anchor: number;
head: number;
constructor(anchor: number, head: number);
map(mapping: Mappable): CellBookmark;
resolve(doc: Node): CellSelection | Selection;
}
//#endregion
//#region src/columnresizing.d.ts
/**
* @public
*/
declare const columnResizingPluginKey: PluginKey<ResizeState>;
/**
* @public
*/
type ColumnResizingOptions = {
handleWidth?: number;
/**
* Minimum width of a cell /column. The column cannot be resized smaller than this.
*/
cellMinWidth?: number;
/**
* The default minWidth of a cell / column when it doesn't have an explicit width (i.e.: it has not been resized manually)
*/
defaultCellMinWidth?: number;
lastColumnResizable?: boolean;
/**
* A custom node view for the rendering table nodes. By default, the plugin
* uses the {@link TableView} class. You can explicitly set this to `null` to
* not use a custom node view.
*/
View?: (new (node: Node, cellMinWidth: number, view: EditorView) => NodeView) | null;
};
/**
* @public
*/
type Dragging = {
startX: number;
startWidth: number;
};
/**
* @public
*/
declare function columnResizing({
handleWidth,
cellMinWidth,
defaultCellMinWidth,
View,
lastColumnResizable
}?: ColumnResizingOptions): Plugin;
/**
* @public
*/
declare class ResizeState {
activeHandle: number;
dragging: Dragging | false;
constructor(activeHandle: number, dragging: Dragging | false);
apply(tr: Transaction): ResizeState;
}
//#endregion
//#region src/commands.d.ts
/**
* @public
*/
type TableRect = Rect & {
tableStart: number;
map: TableMap;
table: Node;
};
/**
* Helper to get the selected rectangle in a table, if any. Adds table
* map, table node, and table start offset to the object for
* convenience.
*
* @public
*/
declare function selectedRect(state: EditorState): TableRect;
/**
* Add a column at the given position in a table.
*
* @public
*/
declare function addColumn(tr: Transaction, {
map,
tableStart,
table
}: TableRect, col: number): Transaction;
/**
* Command to add a column before the column with the selection.
*
* @public
*/
declare function addColumnBefore(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Command to add a column after the column with the selection.
*
* @public
*/
declare function addColumnAfter(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
declare function removeColumn(tr: Transaction, {
map,
table,
tableStart
}: TableRect, col: number): void;
/**
* Command function that removes the selected columns from a table.
*
* @public
*/
declare function deleteColumn(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
declare function rowIsHeader(map: TableMap, table: Node, row: number): boolean;
/**
* @public
*/
declare function addRow(tr: Transaction, {
map,
tableStart,
table
}: TableRect, row: number): Transaction;
/**
* Add a table row before the selection.
*
* @public
*/
declare function addRowBefore(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Add a table row after the selection.
*
* @public
*/
declare function addRowAfter(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
declare function removeRow(tr: Transaction, {
map,
table,
tableStart
}: TableRect, row: number): void;
/**
* Remove the selected rows from a table.
*
* @public
*/
declare function deleteRow(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Merge the selected cells into a single cell. Only available when
* the selected cells' outline forms a rectangle.
*
* @public
*/
declare function mergeCells(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Split a selected cell, whose rowpan or colspan is greater than one,
* into smaller cells. Use the first cell type for the new cells.
*
* @public
*/
declare function splitCell(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
interface GetCellTypeOptions {
node: Node;
row: number;
col: number;
}
/**
* Split a selected cell, whose rowpan or colspan is greater than one,
* into smaller cells with the cell type (th, td) returned by getType function.
*
* @public
*/
declare function splitCellWithType(getCellType: (options: GetCellTypeOptions) => NodeType): Command;
/**
* Returns a command that sets the given attribute to the given value,
* and is only available when the currently selected cell doesn't
* already have that attribute set to that value.
*
* @public
*/
declare function setCellAttr(name: string, value: unknown): Command;
/**
* @public
*/
type ToggleHeaderType = 'column' | 'row' | 'cell';
/**
* Toggles between row/column header and normal cells (Only applies to first row/column).
* For deprecated behavior pass `useDeprecatedLogic` in options with true.
*
* @public
*/
declare function toggleHeader(type: ToggleHeaderType, options?: {
useDeprecatedLogic: boolean;
}): Command;
/**
* Toggles whether the selected row contains header cells.
*
* @public
*/
declare const toggleHeaderRow: Command;
/**
* Toggles whether the selected column contains header cells.
*
* @public
*/
declare const toggleHeaderColumn: Command;
/**
* Toggles whether the selected cells are header cells.
*
* @public
*/
declare const toggleHeaderCell: Command;
/**
* Returns a command for selecting the next (direction=1) or previous
* (direction=-1) cell in a table.
*
* @public
*/
declare function goToNextCell(direction: Direction): Command;
/**
* Deletes the table around the selection, if any.
*
* @public
*/
declare function deleteTable(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Deletes the content of the selected cells, if they are not empty.
*
* @public
*/
declare function deleteCellSelection(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Options for moveTableRow
*
* @public
*/
interface MoveTableRowOptions {
/**
* The source row index to move from.
*/
from: number;
/**
* The destination row index to move to.
*/
to: number;
/**
* Whether to select the moved row after the operation.
*
* @default true
*/
select?: boolean;
/**
* Optional position to resolve table from. If not provided, uses the current selection.
*/
pos?: number;
}
/**
* Move a table row from index `from` to index `to`.
*
* @public
*/
declare function moveTableRow(options: MoveTableRowOptions): Command;
/**
* Options for moveTableColumn
*
* @public
*/
interface MoveTableColumnOptions {
/**
* The source column index to move from.
*/
from: number;
/**
* The destination column index to move to.
*/
to: number;
/**
* Whether to select the moved column after the operation.
*
* @default true
*/
select?: boolean;
/**
* Optional position to resolve table from. If not provided, uses the current selection.
*/
pos?: number;
}
/**
* Move a table column from index `from` to index `to`.
*
* @public
*/
declare function moveTableColumn(options: MoveTableColumnOptions): Command;
//#endregion
//#region src/copypaste.d.ts
/**
* @internal
*/
type Area = {
width: number;
height: number;
rows: Fragment[];
};
/**
* Get a rectangular area of cells from a slice, or null if the outer
* nodes of the slice aren't table cells or rows.
*
* @internal
*/
declare function pastedCells(slice: Slice): Area | null;
/**
* Clip or extend (repeat) the given set of cells to cover the given
* width and height. Will clip rowspan/colspan cells at the edges when
* they stick out.
*
* @internal
*/
declare function clipCells({
width,
height,
rows
}: Area, newWidth: number, newHeight: number): Area;
/**
* Insert the given set of cells (as returned by `pastedCells`) into a
* table, at the position pointed at by rect.
*
* @internal
*/
declare function insertCells(state: EditorState, dispatch: (tr: Transaction) => void, tableStart: number, rect: Rect, cells: Area): void;
//#endregion
//#region src/schema.d.ts
/**
* @public
*/
type getFromDOM = (dom: HTMLElement) => unknown;
/**
* @public
*/
type setDOMAttr = (value: unknown, attrs: MutableAttrs) => void;
/**
* @public
*/
interface CellAttributes {
/**
* The attribute's default value.
*/
default: unknown;
/**
* A function or type name used to validate values of this attribute.
*
* See [validate](https://prosemirror.net/docs/ref/#model.AttributeSpec.validate).
*/
validate?: string | ((value: unknown) => void);
/**
* A function to read the attribute's value from a DOM node.
*/
getFromDOM?: getFromDOM;
/**
* A function to add the attribute's value to an attribute
* object that's used to render the cell's DOM.
*/
setDOMAttr?: setDOMAttr;
}
/**
* @public
*/
interface TableNodesOptions {
/**
* A group name (something like `"block"`) to add to the table
* node type.
*/
tableGroup?: string;
/**
* The content expression for table cells.
*/
cellContent: string;
/**
* Additional attributes to add to cells. Maps attribute names to
* objects with the following properties:
*/
cellAttributes: {
[key: string]: CellAttributes;
};
}
/**
* @public
*/
type TableNodes = Record<'table' | 'table_row' | 'table_cell' | 'table_header', NodeSpec>;
/**
* This function creates a set of [node
* specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for
* `table`, `table_row`, and `table_cell` nodes types as used by this
* module. The result can then be added to the set of nodes when
* creating a schema.
*
* @public
*/
declare function tableNodes(options: TableNodesOptions): TableNodes;
/**
* @public
*/
type TableRole = 'table' | 'row' | 'cell' | 'header_cell';
/**
* @public
*/
declare function tableNodeTypes(schema: Schema): Record<TableRole, NodeType>;
//#endregion
//#region src/tableview.d.ts
/**
* @public
*/
declare class TableView implements NodeView {
node: Node;
defaultCellMinWidth: number;
dom: HTMLDivElement;
table: HTMLTableElement;
colgroup: HTMLTableColElement;
contentDOM: HTMLTableSectionElement;
constructor(node: Node, defaultCellMinWidth: number);
update(node: Node): boolean;
ignoreMutation(record: ViewMutationRecord): boolean;
}
/**
* @public
*/
declare function updateColumnsOnResize(node: Node, colgroup: HTMLTableColElement, table: HTMLTableElement, defaultCellMinWidth: number, overrideCol?: number, overrideValue?: number): void;
//#endregion
//#region src/utils/query.d.ts
/**
* Find the closest table node for a given position.
*
* @public
*/
declare function findTable($pos: ResolvedPos): FindNodeResult | null;
/**
* Try to find the anchor and head cell in the same table by using the given
* anchor and head as hit points, or fallback to the selection's anchor and
* head.
*
* @public
*/
declare function findCellRange(selection: Selection, anchorHit?: number, headHit?: number): [ResolvedPos, ResolvedPos] | null;
/**
* Try to find a resolved pos of a cell by using the given pos as a hit point.
*
* @public
*/
declare function findCellPos(doc: Node, pos: number): ResolvedPos | undefined;
/**
* Result of finding a parent node.
*
* @public
*/
interface FindNodeResult {
/**
* The closest parent node that satisfies the predicate.
*/
node: Node;
/**
* The position directly before the node.
*/
pos: number;
/**
* The position at the start of the node.
*/
start: number;
/**
* The depth of the node.
*/
depth: number;
}
//#endregion
//#region src/index.d.ts
/**
* @public
*/
type TableEditingOptions = {
/**
* Whether to allow table node selection.
*
* By default, any node selection wrapping a table will be converted into a
* CellSelection wrapping all cells in the table. You can pass `true` to allow
* the selection to remain a NodeSelection.
*
* @default false
*/
allowTableNodeSelection?: boolean;
};
/**
* Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)
* that, when added to an editor, enables cell-selection, handles
* cell-based copy/paste, and makes sure tables stay well-formed (each
* row has the same width, and cells don't overlap).
*
* You should probably put this plugin near the end of your array of
* plugins, since it handles mouse and arrow key events in tables
* rather broadly, and other plugins, like the gap cursor or the
* column-width dragging plugin, might want to get a turn first to
* perform more specific behavior.
*
* @public
*/
declare function tableEditing({
allowTableNodeSelection
}?: TableEditingOptions): Plugin;
//#endregion
export { type CellAttributes, CellBookmark, CellSelection, type CellSelectionJSON, type ColWidths, type ColumnResizingOptions, type Direction, type Dragging, type FindNodeResult, GetCellTypeOptions, MoveTableColumnOptions, MoveTableRowOptions, type MutableAttrs, type Problem, type Rect, ResizeState, TableEditingOptions, TableMap, type TableNodes, type TableNodesOptions, TableRect, type TableRole, TableView, ToggleHeaderType, type Area as __Area, clipCells as __clipCells, insertCells as __insertCells, pastedCells as __pastedCells, addColSpan, addColumn, addColumnAfter, addColumnBefore, addRow, addRowAfter, addRowBefore, cellAround, cellNear, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, deleteCellSelection, deleteColumn, deleteRow, deleteTable, findCell, findCellPos, findCellRange, findTable, fixTables, fixTablesKey, type getFromDOM, goToNextCell, handlePaste, inSameTable, isInTable, mergeCells, moveCellForward, moveTableColumn, moveTableRow, nextCell, pointsAtCell, removeColSpan, removeColumn, removeRow, rowIsHeader, selectedRect, selectionCell, setCellAttr, type setDOMAttr, splitCell, splitCellWithType, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, updateColumnsOnResize };
//# sourceMappingURL=index.d.cts.map

1
node_modules/prosemirror-tables/dist/index.d.cts.map generated vendored Normal file

File diff suppressed because one or more lines are too long

751
node_modules/prosemirror-tables/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,751 @@
import { Command, EditorState, Plugin, PluginKey, Selection, Transaction } from "prosemirror-state";
import { Attrs, Fragment, Node, NodeSpec, NodeType, ResolvedPos, Schema, Slice } from "prosemirror-model";
import { DecorationSet, EditorView, NodeView, ViewMutationRecord } from "prosemirror-view";
import { Mappable } from "prosemirror-transform";
//#region src/fixtables.d.ts
/**
* @public
*/
declare const fixTablesKey: PluginKey<{
fixTables: boolean;
}>;
/**
* Inspect all tables in the given state's document and return a
* transaction that fixes them, if necessary. If `oldState` was
* provided, that is assumed to hold a previous, known-good state,
* which will be used to avoid re-scanning unchanged parts of the
* document.
*
* @public
*/
declare function fixTables(state: EditorState, oldState?: EditorState): Transaction | undefined;
//#endregion
//#region src/input.d.ts
/**
* @public
*/
type Direction = -1 | 1;
/**
* @public
*/
declare function handlePaste(view: EditorView, _: ClipboardEvent, slice: Slice): boolean;
//#endregion
//#region src/tablemap.d.ts
/**
* @public
*/
type ColWidths = number[];
/**
* @public
*/
type Problem = {
type: 'colwidth mismatch';
pos: number;
colwidth: ColWidths;
} | {
type: 'collision';
pos: number;
row: number;
n: number;
} | {
type: 'missing';
row: number;
n: number;
} | {
type: 'overlong_rowspan';
pos: number;
n: number;
} | {
type: 'zero_sized';
};
/**
* @public
*/
interface Rect {
left: number;
top: number;
right: number;
bottom: number;
}
/**
* A table map describes the structure of a given table. To avoid
* recomputing them all the time, they are cached per table node. To
* be able to do that, positions saved in the map are relative to the
* start of the table, rather than the start of the document.
*
* @public
*/
declare class TableMap {
/**
* The number of columns
*/
width: number;
/**
* The number of rows
*/
height: number;
/**
* A width * height array with the start position of
* the cell covering that part of the table in each slot
*/
map: number[];
/**
* An optional array of problems (cell overlap or non-rectangular
* shape) for the table, used by the table normalizer.
*/
problems: Problem[] | null;
constructor(
/**
* The number of columns
*/
width: number,
/**
* The number of rows
*/
height: number,
/**
* A width * height array with the start position of
* the cell covering that part of the table in each slot
*/
map: number[],
/**
* An optional array of problems (cell overlap or non-rectangular
* shape) for the table, used by the table normalizer.
*/
problems: Problem[] | null);
findCell(pos: number): Rect;
colCount(pos: number): number;
nextCell(pos: number, axis: 'horiz' | 'vert', dir: number): null | number;
rectBetween(a: number, b: number): Rect;
cellsInRect(rect: Rect): number[];
positionAt(row: number, col: number, table: Node): number;
static get(table: Node): TableMap;
}
//#endregion
//#region src/util.d.ts
/**
* @public
*/
type MutableAttrs = Record<string, unknown>;
/**
* @public
*/
interface CellAttrs {
colspan: number;
rowspan: number;
colwidth: number[] | null;
}
/**
* @public
*/
declare const tableEditingKey: PluginKey<number>;
/**
* @public
*/
declare function cellAround($pos: ResolvedPos): ResolvedPos | null;
/**
* @public
*/
declare function isInTable(state: EditorState): boolean;
/**
* @internal
*/
declare function selectionCell(state: EditorState): ResolvedPos;
/**
* @public
*/
declare function cellNear($pos: ResolvedPos): ResolvedPos | undefined;
/**
* @public
*/
declare function pointsAtCell($pos: ResolvedPos): boolean;
/**
* @public
*/
declare function moveCellForward($pos: ResolvedPos): ResolvedPos;
/**
* @internal
*/
declare function inSameTable($cellA: ResolvedPos, $cellB: ResolvedPos): boolean;
/**
* @public
*/
declare function findCell($pos: ResolvedPos): Rect;
/**
* @public
*/
declare function colCount($pos: ResolvedPos): number;
/**
* @public
*/
declare function nextCell($pos: ResolvedPos, axis: 'horiz' | 'vert', dir: number): ResolvedPos | null;
/**
* @public
*/
declare function removeColSpan(attrs: CellAttrs, pos: number, n?: number): CellAttrs;
/**
* @public
*/
declare function addColSpan(attrs: CellAttrs, pos: number, n?: number): Attrs;
/**
* @public
*/
declare function columnIsHeader(map: TableMap, table: Node, col: number): boolean;
//#endregion
//#region src/cellselection.d.ts
/**
* @public
*/
interface CellSelectionJSON {
type: string;
anchor: number;
head: number;
}
/**
* A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)
* subclass that represents a cell selection spanning part of a table.
* With the plugin enabled, these will be created when the user
* selects across cells, and will be drawn by giving selected cells a
* `selectedCell` CSS class.
*
* @public
*/
declare class CellSelection extends Selection {
$anchorCell: ResolvedPos;
$headCell: ResolvedPos;
constructor($anchorCell: ResolvedPos, $headCell?: ResolvedPos);
map(doc: Node, mapping: Mappable): CellSelection | Selection;
content(): Slice;
replace(tr: Transaction, content?: Slice): void;
replaceWith(tr: Transaction, node: Node): void;
forEachCell(f: (node: Node, pos: number) => void): void;
isColSelection(): boolean;
static colSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
isRowSelection(): boolean;
eq(other: unknown): boolean;
static rowSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
toJSON(): CellSelectionJSON;
static fromJSON(doc: Node, json: CellSelectionJSON): CellSelection;
static create(doc: Node, anchorCell: number, headCell?: number): CellSelection;
getBookmark(): CellBookmark;
}
/**
* @public
*/
declare class CellBookmark {
anchor: number;
head: number;
constructor(anchor: number, head: number);
map(mapping: Mappable): CellBookmark;
resolve(doc: Node): CellSelection | Selection;
}
//#endregion
//#region src/columnresizing.d.ts
/**
* @public
*/
declare const columnResizingPluginKey: PluginKey<ResizeState>;
/**
* @public
*/
type ColumnResizingOptions = {
handleWidth?: number;
/**
* Minimum width of a cell /column. The column cannot be resized smaller than this.
*/
cellMinWidth?: number;
/**
* The default minWidth of a cell / column when it doesn't have an explicit width (i.e.: it has not been resized manually)
*/
defaultCellMinWidth?: number;
lastColumnResizable?: boolean;
/**
* A custom node view for the rendering table nodes. By default, the plugin
* uses the {@link TableView} class. You can explicitly set this to `null` to
* not use a custom node view.
*/
View?: (new (node: Node, cellMinWidth: number, view: EditorView) => NodeView) | null;
};
/**
* @public
*/
type Dragging = {
startX: number;
startWidth: number;
};
/**
* @public
*/
declare function columnResizing({
handleWidth,
cellMinWidth,
defaultCellMinWidth,
View,
lastColumnResizable
}?: ColumnResizingOptions): Plugin;
/**
* @public
*/
declare class ResizeState {
activeHandle: number;
dragging: Dragging | false;
constructor(activeHandle: number, dragging: Dragging | false);
apply(tr: Transaction): ResizeState;
}
//#endregion
//#region src/commands.d.ts
/**
* @public
*/
type TableRect = Rect & {
tableStart: number;
map: TableMap;
table: Node;
};
/**
* Helper to get the selected rectangle in a table, if any. Adds table
* map, table node, and table start offset to the object for
* convenience.
*
* @public
*/
declare function selectedRect(state: EditorState): TableRect;
/**
* Add a column at the given position in a table.
*
* @public
*/
declare function addColumn(tr: Transaction, {
map,
tableStart,
table
}: TableRect, col: number): Transaction;
/**
* Command to add a column before the column with the selection.
*
* @public
*/
declare function addColumnBefore(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Command to add a column after the column with the selection.
*
* @public
*/
declare function addColumnAfter(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
declare function removeColumn(tr: Transaction, {
map,
table,
tableStart
}: TableRect, col: number): void;
/**
* Command function that removes the selected columns from a table.
*
* @public
*/
declare function deleteColumn(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
declare function rowIsHeader(map: TableMap, table: Node, row: number): boolean;
/**
* @public
*/
declare function addRow(tr: Transaction, {
map,
tableStart,
table
}: TableRect, row: number): Transaction;
/**
* Add a table row before the selection.
*
* @public
*/
declare function addRowBefore(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Add a table row after the selection.
*
* @public
*/
declare function addRowAfter(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
declare function removeRow(tr: Transaction, {
map,
table,
tableStart
}: TableRect, row: number): void;
/**
* Remove the selected rows from a table.
*
* @public
*/
declare function deleteRow(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Merge the selected cells into a single cell. Only available when
* the selected cells' outline forms a rectangle.
*
* @public
*/
declare function mergeCells(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Split a selected cell, whose rowpan or colspan is greater than one,
* into smaller cells. Use the first cell type for the new cells.
*
* @public
*/
declare function splitCell(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* @public
*/
interface GetCellTypeOptions {
node: Node;
row: number;
col: number;
}
/**
* Split a selected cell, whose rowpan or colspan is greater than one,
* into smaller cells with the cell type (th, td) returned by getType function.
*
* @public
*/
declare function splitCellWithType(getCellType: (options: GetCellTypeOptions) => NodeType): Command;
/**
* Returns a command that sets the given attribute to the given value,
* and is only available when the currently selected cell doesn't
* already have that attribute set to that value.
*
* @public
*/
declare function setCellAttr(name: string, value: unknown): Command;
/**
* @public
*/
type ToggleHeaderType = 'column' | 'row' | 'cell';
/**
* Toggles between row/column header and normal cells (Only applies to first row/column).
* For deprecated behavior pass `useDeprecatedLogic` in options with true.
*
* @public
*/
declare function toggleHeader(type: ToggleHeaderType, options?: {
useDeprecatedLogic: boolean;
}): Command;
/**
* Toggles whether the selected row contains header cells.
*
* @public
*/
declare const toggleHeaderRow: Command;
/**
* Toggles whether the selected column contains header cells.
*
* @public
*/
declare const toggleHeaderColumn: Command;
/**
* Toggles whether the selected cells are header cells.
*
* @public
*/
declare const toggleHeaderCell: Command;
/**
* Returns a command for selecting the next (direction=1) or previous
* (direction=-1) cell in a table.
*
* @public
*/
declare function goToNextCell(direction: Direction): Command;
/**
* Deletes the table around the selection, if any.
*
* @public
*/
declare function deleteTable(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Deletes the content of the selected cells, if they are not empty.
*
* @public
*/
declare function deleteCellSelection(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
/**
* Options for moveTableRow
*
* @public
*/
interface MoveTableRowOptions {
/**
* The source row index to move from.
*/
from: number;
/**
* The destination row index to move to.
*/
to: number;
/**
* Whether to select the moved row after the operation.
*
* @default true
*/
select?: boolean;
/**
* Optional position to resolve table from. If not provided, uses the current selection.
*/
pos?: number;
}
/**
* Move a table row from index `from` to index `to`.
*
* @public
*/
declare function moveTableRow(options: MoveTableRowOptions): Command;
/**
* Options for moveTableColumn
*
* @public
*/
interface MoveTableColumnOptions {
/**
* The source column index to move from.
*/
from: number;
/**
* The destination column index to move to.
*/
to: number;
/**
* Whether to select the moved column after the operation.
*
* @default true
*/
select?: boolean;
/**
* Optional position to resolve table from. If not provided, uses the current selection.
*/
pos?: number;
}
/**
* Move a table column from index `from` to index `to`.
*
* @public
*/
declare function moveTableColumn(options: MoveTableColumnOptions): Command;
//#endregion
//#region src/copypaste.d.ts
/**
* @internal
*/
type Area = {
width: number;
height: number;
rows: Fragment[];
};
/**
* Get a rectangular area of cells from a slice, or null if the outer
* nodes of the slice aren't table cells or rows.
*
* @internal
*/
declare function pastedCells(slice: Slice): Area | null;
/**
* Clip or extend (repeat) the given set of cells to cover the given
* width and height. Will clip rowspan/colspan cells at the edges when
* they stick out.
*
* @internal
*/
declare function clipCells({
width,
height,
rows
}: Area, newWidth: number, newHeight: number): Area;
/**
* Insert the given set of cells (as returned by `pastedCells`) into a
* table, at the position pointed at by rect.
*
* @internal
*/
declare function insertCells(state: EditorState, dispatch: (tr: Transaction) => void, tableStart: number, rect: Rect, cells: Area): void;
//#endregion
//#region src/schema.d.ts
/**
* @public
*/
type getFromDOM = (dom: HTMLElement) => unknown;
/**
* @public
*/
type setDOMAttr = (value: unknown, attrs: MutableAttrs) => void;
/**
* @public
*/
interface CellAttributes {
/**
* The attribute's default value.
*/
default: unknown;
/**
* A function or type name used to validate values of this attribute.
*
* See [validate](https://prosemirror.net/docs/ref/#model.AttributeSpec.validate).
*/
validate?: string | ((value: unknown) => void);
/**
* A function to read the attribute's value from a DOM node.
*/
getFromDOM?: getFromDOM;
/**
* A function to add the attribute's value to an attribute
* object that's used to render the cell's DOM.
*/
setDOMAttr?: setDOMAttr;
}
/**
* @public
*/
interface TableNodesOptions {
/**
* A group name (something like `"block"`) to add to the table
* node type.
*/
tableGroup?: string;
/**
* The content expression for table cells.
*/
cellContent: string;
/**
* Additional attributes to add to cells. Maps attribute names to
* objects with the following properties:
*/
cellAttributes: {
[key: string]: CellAttributes;
};
}
/**
* @public
*/
type TableNodes = Record<'table' | 'table_row' | 'table_cell' | 'table_header', NodeSpec>;
/**
* This function creates a set of [node
* specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for
* `table`, `table_row`, and `table_cell` nodes types as used by this
* module. The result can then be added to the set of nodes when
* creating a schema.
*
* @public
*/
declare function tableNodes(options: TableNodesOptions): TableNodes;
/**
* @public
*/
type TableRole = 'table' | 'row' | 'cell' | 'header_cell';
/**
* @public
*/
declare function tableNodeTypes(schema: Schema): Record<TableRole, NodeType>;
//#endregion
//#region src/tableview.d.ts
/**
* @public
*/
declare class TableView implements NodeView {
node: Node;
defaultCellMinWidth: number;
dom: HTMLDivElement;
table: HTMLTableElement;
colgroup: HTMLTableColElement;
contentDOM: HTMLTableSectionElement;
constructor(node: Node, defaultCellMinWidth: number);
update(node: Node): boolean;
ignoreMutation(record: ViewMutationRecord): boolean;
}
/**
* @public
*/
declare function updateColumnsOnResize(node: Node, colgroup: HTMLTableColElement, table: HTMLTableElement, defaultCellMinWidth: number, overrideCol?: number, overrideValue?: number): void;
//#endregion
//#region src/utils/query.d.ts
/**
* Find the closest table node for a given position.
*
* @public
*/
declare function findTable($pos: ResolvedPos): FindNodeResult | null;
/**
* Try to find the anchor and head cell in the same table by using the given
* anchor and head as hit points, or fallback to the selection's anchor and
* head.
*
* @public
*/
declare function findCellRange(selection: Selection, anchorHit?: number, headHit?: number): [ResolvedPos, ResolvedPos] | null;
/**
* Try to find a resolved pos of a cell by using the given pos as a hit point.
*
* @public
*/
declare function findCellPos(doc: Node, pos: number): ResolvedPos | undefined;
/**
* Result of finding a parent node.
*
* @public
*/
interface FindNodeResult {
/**
* The closest parent node that satisfies the predicate.
*/
node: Node;
/**
* The position directly before the node.
*/
pos: number;
/**
* The position at the start of the node.
*/
start: number;
/**
* The depth of the node.
*/
depth: number;
}
//#endregion
//#region src/index.d.ts
/**
* @public
*/
type TableEditingOptions = {
/**
* Whether to allow table node selection.
*
* By default, any node selection wrapping a table will be converted into a
* CellSelection wrapping all cells in the table. You can pass `true` to allow
* the selection to remain a NodeSelection.
*
* @default false
*/
allowTableNodeSelection?: boolean;
};
/**
* Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)
* that, when added to an editor, enables cell-selection, handles
* cell-based copy/paste, and makes sure tables stay well-formed (each
* row has the same width, and cells don't overlap).
*
* You should probably put this plugin near the end of your array of
* plugins, since it handles mouse and arrow key events in tables
* rather broadly, and other plugins, like the gap cursor or the
* column-width dragging plugin, might want to get a turn first to
* perform more specific behavior.
*
* @public
*/
declare function tableEditing({
allowTableNodeSelection
}?: TableEditingOptions): Plugin;
//#endregion
export { type CellAttributes, CellBookmark, CellSelection, type CellSelectionJSON, type ColWidths, type ColumnResizingOptions, type Direction, type Dragging, type FindNodeResult, GetCellTypeOptions, MoveTableColumnOptions, MoveTableRowOptions, type MutableAttrs, type Problem, type Rect, ResizeState, TableEditingOptions, TableMap, type TableNodes, type TableNodesOptions, TableRect, type TableRole, TableView, ToggleHeaderType, type Area as __Area, clipCells as __clipCells, insertCells as __insertCells, pastedCells as __pastedCells, addColSpan, addColumn, addColumnAfter, addColumnBefore, addRow, addRowAfter, addRowBefore, cellAround, cellNear, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, deleteCellSelection, deleteColumn, deleteRow, deleteTable, findCell, findCellPos, findCellRange, findTable, fixTables, fixTablesKey, type getFromDOM, goToNextCell, handlePaste, inSameTable, isInTable, mergeCells, moveCellForward, moveTableColumn, moveTableRow, nextCell, pointsAtCell, removeColSpan, removeColumn, removeRow, rowIsHeader, selectedRect, selectionCell, setCellAttr, type setDOMAttr, splitCell, splitCellWithType, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, updateColumnsOnResize };
//# sourceMappingURL=index.d.ts.map

1
node_modules/prosemirror-tables/dist/index.d.ts.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2626
node_modules/prosemirror-tables/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/prosemirror-tables/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

80
node_modules/prosemirror-tables/package.json generated vendored Normal file
View File

@@ -0,0 +1,80 @@
{
"name": "prosemirror-tables",
"type": "module",
"version": "1.8.5",
"description": "ProseMirror's rowspan/colspan tables component",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ProseMirror/prosemirror-tables.git"
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"style": "style/tables.css",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./style/tables.css": "./style/tables.css"
},
"files": [
"style",
"dist"
],
"dependencies": {
"prosemirror-keymap": "^1.2.3",
"prosemirror-model": "^1.25.4",
"prosemirror-state": "^1.4.4",
"prosemirror-transform": "^1.10.5",
"prosemirror-view": "^1.41.4"
},
"devDependencies": {
"@ocavue/eslint-config": "^3.8.0",
"@ocavue/tsconfig": "^0.6.2",
"@vitest/coverage-v8": "^4.0.16",
"builddocs": "^1.0.8",
"eslint": "^9.39.2",
"happy-dom": "^20.0.11",
"ist": "^1.1.7",
"pkg-pr-new": "^0.0.62",
"prettier": "^3.7.4",
"prosemirror-commands": "^1.7.1",
"prosemirror-example-setup": "^1.2.3",
"prosemirror-gapcursor": "^1.4.0",
"prosemirror-menu": "^1.2.5",
"prosemirror-schema-basic": "^1.2.4",
"prosemirror-test-builder": "^1.1.1",
"tsdown": "^0.18.2",
"typescript": "^5.9.3",
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"maintainers": [
{
"name": "Eduard Shvedai",
"email": "eshvedai@atlassian.com"
},
{
"name": "Huanhuan Huang",
"email": "hhuang@atlassian.com"
},
{
"name": "Ocavue",
"email": "ocavue@gmail.com"
}
],
"scripts": {
"dev": "vite demo",
"build_demo": "vite build demo",
"typecheck": "tsc --noEmit",
"test": "vitest",
"build": "tsdown",
"watch": "tsdown --watch",
"build_readme": "builddocs --name tables --format markdown --main src/README.md src/index.ts > README.md",
"format": "prettier --write .",
"lint": "eslint . && prettier --check . && pnpm run typecheck",
"fix": "eslint --fix . && prettier --write ."
}
}

48
node_modules/prosemirror-tables/style/tables.css generated vendored Normal file
View File

@@ -0,0 +1,48 @@
.ProseMirror .tableWrapper {
overflow-x: auto;
}
.ProseMirror table {
border-collapse: collapse;
table-layout: fixed;
width: 100%;
overflow: hidden;
}
.ProseMirror td,
.ProseMirror th {
vertical-align: top;
box-sizing: border-box;
position: relative;
}
.ProseMirror td:not([data-colwidth]):not(.column-resize-dragging),
.ProseMirror th:not([data-colwidth]):not(.column-resize-dragging) {
/* if there's no explicit width set and the column is not being resized, set a default width */
min-width: var(--default-cell-min-width);
}
.ProseMirror .column-resize-handle {
position: absolute;
right: -2px;
top: 0;
bottom: 0;
width: 4px;
z-index: 20;
background-color: #adf;
pointer-events: none;
}
.ProseMirror.resize-cursor {
cursor: ew-resize;
cursor: col-resize;
}
/* Give selected cells a blue overlay */
.ProseMirror .selectedCell:after {
z-index: 2;
position: absolute;
content: '';
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(200, 200, 255, 0.4);
pointer-events: none;
}