@examind/block-types 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +40 -0
  2. package/package.json +21 -0
  3. package/types/examind/index.d.ts +12 -0
  4. package/types/examind/nodes/EssayQuestionNode.ts +16 -0
  5. package/types/examind/nodes/FillInTheBlankQuestionNode.ts +14 -0
  6. package/types/examind/nodes/FillInTheBlankSpaceNode.ts +21 -0
  7. package/types/examind/nodes/FinancialStatementQuestionNode.ts +46 -0
  8. package/types/examind/nodes/HorizontalRuleNode.ts +3 -0
  9. package/types/examind/nodes/ImageNode.ts +18 -0
  10. package/types/examind/nodes/JournalEntryQuestionNode.ts +32 -0
  11. package/types/examind/nodes/MatchingQuestionNode.ts +21 -0
  12. package/types/examind/nodes/MultipleOptionQuestionNode.ts +29 -0
  13. package/types/examind/nodes/ShortAnswerQuestionNode.ts +15 -0
  14. package/types/examind/nodes/SimulationQuestionNode.ts +15 -0
  15. package/types/examind/nodes/VariableNode.ts +24 -0
  16. package/types/index.ts +2 -0
  17. package/types/lexical/LexicalCommands.ts +159 -0
  18. package/types/lexical/LexicalConstants.ts +51 -0
  19. package/types/lexical/LexicalEditor.ts +597 -0
  20. package/types/lexical/LexicalEditorState.ts +30 -0
  21. package/types/lexical/LexicalEvents.ts +13 -0
  22. package/types/lexical/LexicalGC.ts +13 -0
  23. package/types/lexical/LexicalMutations.ts +10 -0
  24. package/types/lexical/LexicalNode.ts +460 -0
  25. package/types/lexical/LexicalNodeState.ts +379 -0
  26. package/types/lexical/LexicalNormalization.ts +9 -0
  27. package/types/lexical/LexicalReconciler.ts +13 -0
  28. package/types/lexical/LexicalSelection.ts +295 -0
  29. package/types/lexical/LexicalUpdateTags.ts +51 -0
  30. package/types/lexical/LexicalUpdates.ts +31 -0
  31. package/types/lexical/LexicalUtils.ts +304 -0
  32. package/types/lexical/index.ts +35 -0
  33. package/types/lexical/link/index.ts +125 -0
  34. package/types/lexical/list/LexicalListItemNode.ts +65 -0
  35. package/types/lexical/list/LexicalListNode.ts +56 -0
  36. package/types/lexical/list/checkList.ts +9 -0
  37. package/types/lexical/list/formatList.ts +69 -0
  38. package/types/lexical/list/index.ts +11 -0
  39. package/types/lexical/list/utils.ts +64 -0
  40. package/types/lexical/nodes/ArtificialNode.ts +12 -0
  41. package/types/lexical/nodes/LexicalDecoratorNode.ts +26 -0
  42. package/types/lexical/nodes/LexicalElementNode.ts +207 -0
  43. package/types/lexical/nodes/LexicalLineBreakNode.ts +25 -0
  44. package/types/lexical/nodes/LexicalParagraphNode.ts +31 -0
  45. package/types/lexical/nodes/LexicalRootNode.ts +30 -0
  46. package/types/lexical/nodes/LexicalTabNode.ts +28 -0
  47. package/types/lexical/nodes/LexicalTextNode.ts +288 -0
  48. package/types/lexical/rich-text/index.ts +53 -0
  49. package/types/lexical/table/LexicalTableCellNode.ts +72 -0
  50. package/types/lexical/table/LexicalTableCommands.ts +17 -0
  51. package/types/lexical/table/LexicalTableNode.ts +65 -0
  52. package/types/lexical/table/LexicalTableObserver.ts +108 -0
  53. package/types/lexical/table/LexicalTablePluginHelpers.ts +25 -0
  54. package/types/lexical/table/LexicalTableRowNode.ts +34 -0
  55. package/types/lexical/table/LexicalTableSelection.ts +74 -0
  56. package/types/lexical/table/LexicalTableSelectionHelpers.ts +40 -0
  57. package/types/lexical/table/LexicalTableUtils.ts +112 -0
  58. package/types/lexical/table/constants.ts +8 -0
  59. package/types/lexical/table/index.ts +16 -0
@@ -0,0 +1,74 @@
1
+ // THIS FILE IS AUTO-GENERATED
2
+ // To regenerate, run: pnpm build (from the root of the project)
3
+
4
+ // Type definitions based on Lexical
5
+ // Original copyright: Meta Platforms, Inc. and affiliates.
6
+
7
+ import { BaseSelection, LexicalNode, NodeKey, PointType, TextFormatType } from './../';
8
+ import { TableCellNode } from './LexicalTableCellNode';
9
+ import { TableNode } from './LexicalTableNode';
10
+ export type TableSelectionShape = {
11
+ fromX: number;
12
+ fromY: number;
13
+ toX: number;
14
+ toY: number;
15
+ };
16
+ export type TableMapValueType = {
17
+ cell: TableCellNode;
18
+ startRow: number;
19
+ startColumn: number;
20
+ };
21
+ export type TableMapType = Array<Array<TableMapValueType>>;
22
+ export declare class TableSelection implements BaseSelection {
23
+ tableKey: NodeKey;
24
+ anchor: PointType;
25
+ focus: PointType;
26
+ _cachedNodes: Array<LexicalNode> | null;
27
+ dirty: boolean;
28
+ constructor(tableKey: NodeKey, anchor: PointType, focus: PointType);
29
+ getStartEndPoints(): [PointType, PointType];
30
+ /**
31
+ * {@link $createTableSelection} unfortunately makes it very easy to create
32
+ * nonsense selections, so we have a method to see if the selection probably
33
+ * makes sense.
34
+ *
35
+ * @returns true if the TableSelection is (probably) valid
36
+ */
37
+ isValid(): boolean;
38
+ /**
39
+ * Returns whether the Selection is "backwards", meaning the focus
40
+ * logically precedes the anchor in the EditorState.
41
+ * @returns true if the Selection is backwards, false otherwise.
42
+ */
43
+ isBackward(): boolean;
44
+ getCachedNodes(): LexicalNode[] | null;
45
+ setCachedNodes(nodes: LexicalNode[] | null): void;
46
+ is(selection: null | BaseSelection): boolean;
47
+ set(tableKey: NodeKey, anchorCellKey: NodeKey, focusCellKey: NodeKey): void;
48
+ clone(): TableSelection;
49
+ isCollapsed(): boolean;
50
+ extract(): Array<LexicalNode>;
51
+ insertRawText(text: string): void;
52
+ insertText(): void;
53
+ /**
54
+ * Returns whether the provided TextFormatType is present on the Selection.
55
+ * This will be true if any paragraph in table cells has the specified format.
56
+ *
57
+ * @param type the TextFormatType to check for.
58
+ * @returns true if the provided format is currently toggled on on the Selection, false otherwise.
59
+ */
60
+ hasFormat(type: TextFormatType): boolean;
61
+ insertNodes(nodes: Array<LexicalNode>): void;
62
+ getShape(): TableSelectionShape;
63
+ getNodes(): Array<LexicalNode>;
64
+ getTextContent(): string;
65
+ }
66
+ export declare function $isTableSelection(x: unknown): x is TableSelection;
67
+ export declare function $createTableSelection(): TableSelection;
68
+ export declare function $createTableSelectionFrom(tableNode: TableNode, anchorCell: TableCellNode, focusCell: TableCellNode): TableSelection;
69
+ /**
70
+ * Depth first visitor
71
+ * @param node The starting node
72
+ * @param $visit The function to call for each node. If the function returns false, then children of this node will not be explored
73
+ */
74
+ export declare function $visitRecursively(node: LexicalNode, $visit: (childNode: LexicalNode) => boolean | undefined | void): void;
@@ -0,0 +1,40 @@
1
+ // THIS FILE IS AUTO-GENERATED
2
+ // To regenerate, run: pnpm build (from the root of the project)
3
+
4
+ // Type definitions based on Lexical
5
+ // Original copyright: Meta Platforms, Inc. and affiliates.
6
+
7
+ import type { TableCellNode } from './LexicalTableCellNode';
8
+ import type { TableDOMCell } from './LexicalTableObserver';
9
+ import type { TableSelection } from './LexicalTableSelection';
10
+ import type { EditorState, LexicalEditor, LexicalNode, RangeSelection } from './../';
11
+ import { TableNode } from './LexicalTableNode';
12
+ import { TableDOMTable, TableObserver } from './LexicalTableObserver';
13
+ declare const LEXICAL_ELEMENT_KEY = "__lexicalTableSelection";
14
+ export declare function isHTMLTableElement(el: unknown): el is HTMLTableElement;
15
+ export declare function getTableElement<T extends HTMLElement | null>(tableNode: TableNode, dom: T): HTMLTableElementWithWithTableSelectionState | (T & null);
16
+ export declare function getEditorWindow(editor: LexicalEditor): Window | null;
17
+ export declare function $findParentTableCellNodeInTable(tableNode: LexicalNode, node: LexicalNode | null): TableCellNode | null;
18
+ export declare function applyTableHandlers(tableNode: TableNode, element: HTMLElement, editor: LexicalEditor, hasTabHandler: boolean): TableObserver;
19
+ export type HTMLTableElementWithWithTableSelectionState = HTMLTableElement & {
20
+ [LEXICAL_ELEMENT_KEY]?: TableObserver | undefined;
21
+ };
22
+ export declare function detachTableObserverFromTableElement(tableElement: HTMLTableElementWithWithTableSelectionState, tableObserver: TableObserver): void;
23
+ export declare function attachTableObserverToTableElement(tableElement: HTMLTableElementWithWithTableSelectionState, tableObserver: TableObserver): void;
24
+ export declare function getTableObserverFromTableElement(tableElement: HTMLTableElementWithWithTableSelectionState): TableObserver | null;
25
+ export declare function getDOMCellFromTarget(node: null | Node): TableDOMCell | null;
26
+ export declare function getDOMCellInTableFromTarget(table: HTMLTableElementWithWithTableSelectionState, node: null | Node): TableDOMCell | null;
27
+ export declare function doesTargetContainText(node: Node): boolean;
28
+ export declare function getTable(tableNode: TableNode, dom: HTMLElement): TableDOMTable;
29
+ export declare function $updateDOMForSelection(editor: LexicalEditor, table: TableDOMTable, selection: TableSelection | RangeSelection | null): void;
30
+ export declare function $forEachTableCell(grid: TableDOMTable, cb: (cell: TableDOMCell, lexicalNode: LexicalNode, cords: {
31
+ x: number;
32
+ y: number;
33
+ }) => void): void;
34
+ export declare function $addHighlightStyleToTable(editor: LexicalEditor, tableSelection: TableObserver): void;
35
+ export declare function $removeHighlightStyleToTable(editor: LexicalEditor, tableObserver: TableObserver): void;
36
+ export declare function $findCellNode(node: LexicalNode): null | TableCellNode;
37
+ export declare function $findTableNode(node: LexicalNode): null | TableNode;
38
+ export declare function $getObserverCellFromCellNodeOrThrow(tableObserver: TableObserver, tableCellNode: TableCellNode): TableDOMCell;
39
+ export declare function $getNearestTableCellInTableFromDOMNode(tableNode: TableNode, startingDOM: Node, editorState?: EditorState): TableCellNode | null;
40
+ export {};
@@ -0,0 +1,112 @@
1
+ // THIS FILE IS AUTO-GENERATED
2
+ // To regenerate, run: pnpm build (from the root of the project)
3
+
4
+ // Type definitions based on Lexical
5
+ // Original copyright: Meta Platforms, Inc. and affiliates.
6
+
7
+ import type { TableMapType, TableMapValueType } from './LexicalTableSelection';
8
+ import type { PointType } from './../';
9
+ import { LexicalNode } from './../';
10
+ import { InsertTableCommandPayloadHeaders } from '.';
11
+ import { TableCellNode } from './LexicalTableCellNode';
12
+ import { TableNode } from './LexicalTableNode';
13
+ import { TableDOMTable } from './LexicalTableObserver';
14
+ import { TableRowNode } from './LexicalTableRowNode';
15
+ export declare function $createTableNodeWithDimensions(rowCount: number, columnCount: number, includeHeaders?: InsertTableCommandPayloadHeaders): TableNode;
16
+ export declare function $getTableCellNodeFromLexicalNode(startingNode: LexicalNode): TableCellNode | null;
17
+ export declare function $getTableRowNodeFromTableCellNodeOrThrow(startingNode: LexicalNode): TableRowNode;
18
+ export declare function $getTableNodeFromLexicalNodeOrThrow(startingNode: LexicalNode): TableNode;
19
+ export declare function $getTableRowIndexFromTableCellNode(tableCellNode: TableCellNode): number;
20
+ export declare function $getTableColumnIndexFromTableCellNode(tableCellNode: TableCellNode): number;
21
+ export type TableCellSiblings = {
22
+ above: TableCellNode | null | undefined;
23
+ below: TableCellNode | null | undefined;
24
+ left: TableCellNode | null | undefined;
25
+ right: TableCellNode | null | undefined;
26
+ };
27
+ export declare function $getTableCellSiblingsFromTableCellNode(tableCellNode: TableCellNode, table: TableDOMTable): TableCellSiblings;
28
+ export declare function $removeTableRowAtIndex(tableNode: TableNode, indexToDelete: number): TableNode;
29
+ /**
30
+ * @deprecated This function does not support merged cells. Use {@link $insertTableRowAtSelection} or {@link $insertTableRowAtNode} instead.
31
+ */
32
+ export declare function $insertTableRow(tableNode: TableNode, targetIndex: number, shouldInsertAfter: boolean | undefined, rowCount: number, table: TableDOMTable): TableNode;
33
+ /**
34
+ * Inserts a table row before or after the current focus cell node,
35
+ * taking into account any spans. If successful, returns the
36
+ * inserted table row node.
37
+ */
38
+ export declare function $insertTableRowAtSelection(insertAfter?: boolean): TableRowNode | null;
39
+ /**
40
+ * @deprecated renamed to {@link $insertTableRowAtSelection}
41
+ */
42
+ export declare const $insertTableRow__EXPERIMENTAL: typeof $insertTableRowAtSelection;
43
+ /**
44
+ * Inserts a table row before or after the given cell node,
45
+ * taking into account any spans. If successful, returns the
46
+ * inserted table row node.
47
+ */
48
+ export declare function $insertTableRowAtNode(cellNode: TableCellNode, insertAfter?: boolean): TableRowNode | null;
49
+ /**
50
+ * @deprecated This function does not support merged cells. Use {@link $insertTableColumnAtSelection} or {@link $insertTableColumnAtNode} instead.
51
+ */
52
+ export declare function $insertTableColumn(tableNode: TableNode, targetIndex: number, shouldInsertAfter: boolean | undefined, columnCount: number, table: TableDOMTable): TableNode;
53
+ /**
54
+ * Inserts a column before or after the current focus cell node,
55
+ * taking into account any spans. If successful, returns the
56
+ * first inserted cell node.
57
+ */
58
+ export declare function $insertTableColumnAtSelection(insertAfter?: boolean): TableCellNode | null;
59
+ /**
60
+ * @deprecated renamed to {@link $insertTableColumnAtSelection}
61
+ */
62
+ export declare const $insertTableColumn__EXPERIMENTAL: typeof $insertTableColumnAtSelection;
63
+ /**
64
+ * Inserts a column before or after the given cell node,
65
+ * taking into account any spans. If successful, returns the
66
+ * first inserted cell node.
67
+ */
68
+ export declare function $insertTableColumnAtNode(cellNode: TableCellNode, insertAfter?: boolean, shouldSetSelection?: boolean): TableCellNode | null;
69
+ /**
70
+ * @deprecated This function does not support merged cells. Use {@link $deleteTableColumnAtSelection} instead.
71
+ */
72
+ export declare function $deleteTableColumn(tableNode: TableNode, targetIndex: number): TableNode;
73
+ export declare function $deleteTableRowAtSelection(): void;
74
+ /**
75
+ * @deprecated renamed to {@link $deleteTableRowAtSelection}
76
+ */
77
+ export declare const $deleteTableRow__EXPERIMENTAL: typeof $deleteTableRowAtSelection;
78
+ export declare function $deleteTableColumnAtSelection(): void;
79
+ /**
80
+ * @deprecated renamed to {@link $deleteTableColumnAtSelection}
81
+ */
82
+ export declare const $deleteTableColumn__EXPERIMENTAL: typeof $deleteTableColumnAtSelection;
83
+ export declare function $mergeCells(cellNodes: TableCellNode[]): TableCellNode | null;
84
+ export declare function $unmergeCell(): void;
85
+ export declare function $unmergeCellNode(cellNode: TableCellNode): void;
86
+ export declare function $computeTableMap(tableNode: TableNode, cellA: TableCellNode, cellB: TableCellNode): [TableMapType, TableMapValueType, TableMapValueType];
87
+ export declare function $computeTableMapSkipCellCheck(tableNode: TableNode, cellA: null | TableCellNode, cellB: null | TableCellNode): [
88
+ tableMap: TableMapType,
89
+ cellAValue: TableMapValueType | null,
90
+ cellBValue: TableMapValueType | null
91
+ ];
92
+ export declare function $getNodeTriplet(source: PointType | LexicalNode | TableCellNode): [TableCellNode, TableRowNode, TableNode];
93
+ export interface TableCellRectBoundary {
94
+ minColumn: number;
95
+ minRow: number;
96
+ maxColumn: number;
97
+ maxRow: number;
98
+ }
99
+ export interface TableCellRectSpans {
100
+ topSpan: number;
101
+ leftSpan: number;
102
+ rightSpan: number;
103
+ bottomSpan: number;
104
+ }
105
+ export declare function $computeTableCellRectSpans(map: TableMapType, boundary: TableCellRectBoundary): TableCellRectSpans;
106
+ export declare function $computeTableCellRectBoundary(map: TableMapType, cellAMap: TableMapValueType, cellBMap: TableMapValueType): TableCellRectBoundary;
107
+ export declare function $getTableCellNodeRect(tableCellNode: TableCellNode): {
108
+ rowIndex: number;
109
+ columnIndex: number;
110
+ rowSpan: number;
111
+ colSpan: number;
112
+ } | null;
@@ -0,0 +1,8 @@
1
+ // THIS FILE IS AUTO-GENERATED
2
+ // To regenerate, run: pnpm build (from the root of the project)
3
+
4
+ // Type definitions based on Lexical
5
+ // Original copyright: Meta Platforms, Inc. and affiliates.
6
+
7
+ export declare const PIXEL_VALUE_REG_EXP: RegExp;
8
+ export declare const COLUMN_WIDTH = 75;
@@ -0,0 +1,16 @@
1
+ // THIS FILE IS AUTO-GENERATED
2
+ // To regenerate, run: pnpm build (from the root of the project)
3
+
4
+ // Type definitions based on Lexical
5
+ // Original copyright: Meta Platforms, Inc. and affiliates.
6
+
7
+ export * from './LexicalTableCellNode';
8
+ export * from './LexicalTableCommands';
9
+ export * from './LexicalTableNode';
10
+ export * from './LexicalTableObserver';
11
+ export * from './LexicalTablePluginHelpers';
12
+ export * from './LexicalTableRowNode';
13
+ export * from './LexicalTableSelection';
14
+ export * from './LexicalTableSelectionHelpers';
15
+ export * from './LexicalTableUtils';
16
+ export * from './constants';