@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,295 @@
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 { LexicalEditor } from './LexicalEditor';
8
+ import type { EditorState } from './LexicalEditorState';
9
+ import type { NodeKey } from './LexicalNode';
10
+ import type { ElementNode } from './nodes/LexicalElementNode';
11
+ import type { TextFormatType } from './nodes/LexicalTextNode';
12
+ import { TextNode } from '.';
13
+ import { LexicalNode } from './LexicalNode';
14
+ export type TextPointType = {
15
+ _selection: BaseSelection;
16
+ getNode: () => TextNode;
17
+ is: (point: PointType) => boolean;
18
+ isBefore: (point: PointType) => boolean;
19
+ key: NodeKey;
20
+ offset: number;
21
+ set: (key: NodeKey, offset: number, type: 'text' | 'element', onlyIfChanged?: boolean) => void;
22
+ type: 'text';
23
+ };
24
+ export type ElementPointType = {
25
+ _selection: BaseSelection;
26
+ getNode: () => ElementNode;
27
+ is: (point: PointType) => boolean;
28
+ isBefore: (point: PointType) => boolean;
29
+ key: NodeKey;
30
+ offset: number;
31
+ set: (key: NodeKey, offset: number, type: 'text' | 'element', onlyIfChanged?: boolean) => void;
32
+ type: 'element';
33
+ };
34
+ export type PointType = TextPointType | ElementPointType;
35
+ export declare class Point {
36
+ key: NodeKey;
37
+ offset: number;
38
+ type: 'text' | 'element';
39
+ _selection: BaseSelection | null;
40
+ constructor(key: NodeKey, offset: number, type: 'text' | 'element');
41
+ is(point: PointType): boolean;
42
+ isBefore(b: PointType): boolean;
43
+ getNode(): LexicalNode;
44
+ set(key: NodeKey, offset: number, type: 'text' | 'element', onlyIfChanged?: boolean): void;
45
+ }
46
+ export declare function $createPoint(key: NodeKey, offset: number, type: 'text' | 'element'): PointType;
47
+ export declare function $moveSelectionPointToEnd(point: PointType, node: LexicalNode): void;
48
+ export interface BaseSelection {
49
+ _cachedNodes: Array<LexicalNode> | null;
50
+ dirty: boolean;
51
+ clone(): BaseSelection;
52
+ extract(): Array<LexicalNode>;
53
+ getNodes(): Array<LexicalNode>;
54
+ getTextContent(): string;
55
+ insertText(text: string): void;
56
+ insertRawText(text: string): void;
57
+ is(selection: null | BaseSelection): boolean;
58
+ insertNodes(nodes: Array<LexicalNode>): void;
59
+ getStartEndPoints(): null | [PointType, PointType];
60
+ isCollapsed(): boolean;
61
+ isBackward(): boolean;
62
+ getCachedNodes(): LexicalNode[] | null;
63
+ setCachedNodes(nodes: LexicalNode[] | null): void;
64
+ }
65
+ export declare class NodeSelection implements BaseSelection {
66
+ _nodes: Set<NodeKey>;
67
+ _cachedNodes: Array<LexicalNode> | null;
68
+ dirty: boolean;
69
+ constructor(objects: Set<NodeKey>);
70
+ getCachedNodes(): LexicalNode[] | null;
71
+ setCachedNodes(nodes: LexicalNode[] | null): void;
72
+ is(selection: null | BaseSelection): boolean;
73
+ isCollapsed(): boolean;
74
+ isBackward(): boolean;
75
+ getStartEndPoints(): null;
76
+ add(key: NodeKey): void;
77
+ delete(key: NodeKey): void;
78
+ clear(): void;
79
+ has(key: NodeKey): boolean;
80
+ clone(): NodeSelection;
81
+ extract(): Array<LexicalNode>;
82
+ insertRawText(text: string): void;
83
+ insertText(): void;
84
+ insertNodes(nodes: Array<LexicalNode>): void;
85
+ getNodes(): Array<LexicalNode>;
86
+ getTextContent(): string;
87
+ /**
88
+ * Remove all nodes in the NodeSelection. If there were any nodes,
89
+ * replace the selection with a new RangeSelection at the previous
90
+ * location of the first node.
91
+ */
92
+ deleteNodes(): void;
93
+ }
94
+ export declare function $isRangeSelection(x: unknown): x is RangeSelection;
95
+ export declare class RangeSelection implements BaseSelection {
96
+ format: number;
97
+ style: string;
98
+ anchor: PointType;
99
+ focus: PointType;
100
+ _cachedNodes: Array<LexicalNode> | null;
101
+ dirty: boolean;
102
+ constructor(anchor: PointType, focus: PointType, format: number, style: string);
103
+ getCachedNodes(): LexicalNode[] | null;
104
+ setCachedNodes(nodes: LexicalNode[] | null): void;
105
+ /**
106
+ * Used to check if the provided selections is equal to this one by value,
107
+ * including anchor, focus, format, and style properties.
108
+ * @param selection - the Selection to compare this one to.
109
+ * @returns true if the Selections are equal, false otherwise.
110
+ */
111
+ is(selection: null | BaseSelection): boolean;
112
+ /**
113
+ * Returns whether the Selection is "collapsed", meaning the anchor and focus are
114
+ * the same node and have the same offset.
115
+ *
116
+ * @returns true if the Selection is collapsed, false otherwise.
117
+ */
118
+ isCollapsed(): boolean;
119
+ /**
120
+ * Gets all the nodes in the Selection. Uses caching to make it generally suitable
121
+ * for use in hot paths.
122
+ *
123
+ * See also the {@link CaretRange} APIs (starting with
124
+ * {@link $caretRangeFromSelection}), which are likely to provide a better
125
+ * foundation for any operation where partial selection is relevant
126
+ * (e.g. the anchor or focus are inside an ElementNode and TextNode)
127
+ *
128
+ * @returns an Array containing all the nodes in the Selection
129
+ */
130
+ getNodes(): Array<LexicalNode>;
131
+ /**
132
+ * Sets this Selection to be of type "text" at the provided anchor and focus values.
133
+ *
134
+ * @param anchorNode - the anchor node to set on the Selection
135
+ * @param anchorOffset - the offset to set on the Selection
136
+ * @param focusNode - the focus node to set on the Selection
137
+ * @param focusOffset - the focus offset to set on the Selection
138
+ */
139
+ setTextNodeRange(anchorNode: TextNode, anchorOffset: number, focusNode: TextNode, focusOffset: number): void;
140
+ /**
141
+ * Gets the (plain) text content of all the nodes in the selection.
142
+ *
143
+ * @returns a string representing the text content of all the nodes in the Selection
144
+ */
145
+ getTextContent(): string;
146
+ /**
147
+ * Attempts to map a DOM selection range onto this Lexical Selection,
148
+ * setting the anchor, focus, and type accordingly
149
+ *
150
+ * @param range a DOM Selection range conforming to the StaticRange interface.
151
+ */
152
+ applyDOMRange(range: StaticRange): void;
153
+ /**
154
+ * Creates a new RangeSelection, copying over all the property values from this one.
155
+ *
156
+ * @returns a new RangeSelection with the same property values as this one.
157
+ */
158
+ clone(): RangeSelection;
159
+ /**
160
+ * Toggles the provided format on all the TextNodes in the Selection.
161
+ *
162
+ * @param format a string TextFormatType to toggle on the TextNodes in the selection
163
+ */
164
+ toggleFormat(format: TextFormatType): void;
165
+ /**
166
+ * Sets the value of the style property on the Selection
167
+ *
168
+ * @param style - the style to set at the value of the style property.
169
+ */
170
+ setStyle(style: string): void;
171
+ /**
172
+ * Returns whether the provided TextFormatType is present on the Selection. This will be true if any node in the Selection
173
+ * has the specified format.
174
+ *
175
+ * @param type the TextFormatType to check for.
176
+ * @returns true if the provided format is currently toggled on on the Selection, false otherwise.
177
+ */
178
+ hasFormat(type: TextFormatType): boolean;
179
+ /**
180
+ * Attempts to insert the provided text into the EditorState at the current Selection.
181
+ * converts tabs, newlines, and carriage returns into LexicalNodes.
182
+ *
183
+ * @param text the text to insert into the Selection
184
+ */
185
+ insertRawText(text: string): void;
186
+ /**
187
+ * Insert the provided text into the EditorState at the current Selection.
188
+ *
189
+ * @param text the text to insert into the Selection
190
+ */
191
+ insertText(text: string): void;
192
+ /**
193
+ * Removes the text in the Selection, adjusting the EditorState accordingly.
194
+ */
195
+ removeText(): void;
196
+ /**
197
+ * Applies the provided format to the TextNodes in the Selection, splitting or
198
+ * merging nodes as necessary.
199
+ *
200
+ * @param formatType the format type to apply to the nodes in the Selection.
201
+ * @param alignWithFormat a 32-bit integer representing formatting flags to align with.
202
+ */
203
+ formatText(formatType: TextFormatType, alignWithFormat?: number | null): void;
204
+ /**
205
+ * Attempts to "intelligently" insert an arbitrary list of Lexical nodes into the EditorState at the
206
+ * current Selection according to a set of heuristics that determine how surrounding nodes
207
+ * should be changed, replaced, or moved to accommodate the incoming ones.
208
+ *
209
+ * @param nodes - the nodes to insert
210
+ */
211
+ insertNodes(nodes: Array<LexicalNode>): void;
212
+ /**
213
+ * Inserts a new ParagraphNode into the EditorState at the current Selection
214
+ *
215
+ * @returns the newly inserted node.
216
+ */
217
+ insertParagraph(): ElementNode | null;
218
+ /**
219
+ * Inserts a logical linebreak, which may be a new LineBreakNode or a new ParagraphNode, into the EditorState at the
220
+ * current Selection.
221
+ */
222
+ insertLineBreak(selectStart?: boolean): void;
223
+ /**
224
+ * Extracts the nodes in the Selection, splitting nodes where necessary
225
+ * to get offset-level precision.
226
+ *
227
+ * @returns The nodes in the Selection
228
+ */
229
+ extract(): Array<LexicalNode>;
230
+ /**
231
+ * Modifies the Selection according to the parameters and a set of heuristics that account for
232
+ * various node types. Can be used to safely move or extend selection by one logical "unit" without
233
+ * dealing explicitly with all the possible node types.
234
+ *
235
+ * @param alter the type of modification to perform
236
+ * @param isBackward whether or not selection is backwards
237
+ * @param granularity the granularity at which to apply the modification
238
+ */
239
+ modify(alter: 'move' | 'extend', isBackward: boolean, granularity: 'character' | 'word' | 'lineboundary'): void;
240
+ /**
241
+ * Helper for handling forward character and word deletion that prevents element nodes
242
+ * like a table, columns layout being destroyed
243
+ *
244
+ * @param anchor the anchor
245
+ * @param anchorNode the anchor node in the selection
246
+ * @param isBackward whether or not selection is backwards
247
+ */
248
+ forwardDeletion(anchor: PointType, anchorNode: TextNode | ElementNode, isBackward: boolean): boolean;
249
+ /**
250
+ * Performs one logical character deletion operation on the EditorState based on the current Selection.
251
+ * Handles different node types.
252
+ *
253
+ * @param isBackward whether or not the selection is backwards.
254
+ */
255
+ deleteCharacter(isBackward: boolean): void;
256
+ /**
257
+ * Performs one logical line deletion operation on the EditorState based on the current Selection.
258
+ * Handles different node types.
259
+ *
260
+ * @param isBackward whether or not the selection is backwards.
261
+ */
262
+ deleteLine(isBackward: boolean): void;
263
+ /**
264
+ * Performs one logical word deletion operation on the EditorState based on the current Selection.
265
+ * Handles different node types.
266
+ *
267
+ * @param isBackward whether or not the selection is backwards.
268
+ */
269
+ deleteWord(isBackward: boolean): void;
270
+ /**
271
+ * Returns whether the Selection is "backwards", meaning the focus
272
+ * logically precedes the anchor in the EditorState.
273
+ * @returns true if the Selection is backwards, false otherwise.
274
+ */
275
+ isBackward(): boolean;
276
+ getStartEndPoints(): null | [PointType, PointType];
277
+ }
278
+ export declare function $isNodeSelection(x: unknown): x is NodeSelection;
279
+ export declare function $getCharacterOffsets(selection: BaseSelection): [number, number];
280
+ export declare function $isBlockElementNode(node: LexicalNode | null | undefined): node is ElementNode;
281
+ export declare function $internalMakeRangeSelection(anchorKey: NodeKey, anchorOffset: number, focusKey: NodeKey, focusOffset: number, anchorType: 'text' | 'element', focusType: 'text' | 'element'): RangeSelection;
282
+ export declare function $createRangeSelection(): RangeSelection;
283
+ export declare function $createNodeSelection(): NodeSelection;
284
+ export declare function $internalCreateSelection(editor: LexicalEditor, event: UIEvent | Event | null): null | BaseSelection;
285
+ export declare function $createRangeSelectionFromDom(domSelection: Selection | null, editor: LexicalEditor): null | RangeSelection;
286
+ export declare function $internalCreateRangeSelection(lastSelection: null | BaseSelection, domSelection: Selection | null, editor: LexicalEditor, event: UIEvent | Event | null): null | RangeSelection;
287
+ export declare function $getSelection(): null | BaseSelection;
288
+ export declare function $getPreviousSelection(): null | BaseSelection;
289
+ export declare function $updateElementSelectionOnCreateDeleteNode(selection: RangeSelection, parentNode: LexicalNode, nodeOffset: number, times?: number): void;
290
+ export declare function applySelectionTransforms(nextEditorState: EditorState, editor: LexicalEditor): void;
291
+ export declare function moveSelectionPointToSibling(point: PointType, node: LexicalNode, parent: ElementNode, prevSibling: LexicalNode | null, nextSibling: LexicalNode | null): void;
292
+ export declare function adjustPointOffsetForMergedSibling(point: PointType, isBefore: boolean, key: NodeKey, target: TextNode, textLength: number): void;
293
+ export declare function updateDOMSelection(prevSelection: BaseSelection | null, nextSelection: BaseSelection | null, editor: LexicalEditor, domSelection: Selection, tags: Set<string>, rootElement: HTMLElement, nodeCount: number): void;
294
+ export declare function $insertNodes(nodes: Array<LexicalNode>): void;
295
+ export declare function $getTextContent(): string;
@@ -0,0 +1,51 @@
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
+ /**
8
+ * Common update tags used in Lexical. These tags can be used with editor.update() or $addUpdateTag()
9
+ * to indicate the type/purpose of an update. Multiple tags can be used in a single update.
10
+ */
11
+ /**
12
+ * Indicates that the update is related to history operations (undo/redo)
13
+ */
14
+ export declare const HISTORIC_TAG = "historic";
15
+ /**
16
+ * Indicates that a new history entry should be pushed to the history stack
17
+ */
18
+ export declare const HISTORY_PUSH_TAG = "history-push";
19
+ /**
20
+ * Indicates that the current update should be merged with the previous history entry
21
+ */
22
+ export declare const HISTORY_MERGE_TAG = "history-merge";
23
+ /**
24
+ * Indicates that the update is related to a paste operation
25
+ */
26
+ export declare const PASTE_TAG = "paste";
27
+ /**
28
+ * Indicates that the update is related to collaborative editing
29
+ */
30
+ export declare const COLLABORATION_TAG = "collaboration";
31
+ /**
32
+ * Indicates that the update should skip collaborative sync
33
+ */
34
+ export declare const SKIP_COLLAB_TAG = "skip-collab";
35
+ /**
36
+ * Indicates that the update should skip scrolling the selection into view
37
+ */
38
+ export declare const SKIP_SCROLL_INTO_VIEW_TAG = "skip-scroll-into-view";
39
+ /**
40
+ * Indicates that the update should skip updating the DOM selection
41
+ * This is useful when you want to make updates without changing the selection or focus
42
+ */
43
+ export declare const SKIP_DOM_SELECTION_TAG = "skip-dom-selection";
44
+ /**
45
+ * The update was triggered by editor.focus()
46
+ */
47
+ export declare const FOCUS_TAG = "focus";
48
+ /**
49
+ * The set of known update tags to help with TypeScript suggestions.
50
+ */
51
+ export type UpdateTag = typeof COLLABORATION_TAG | typeof FOCUS_TAG | typeof HISTORIC_TAG | typeof HISTORY_MERGE_TAG | typeof HISTORY_PUSH_TAG | typeof PASTE_TAG | typeof SKIP_COLLAB_TAG | typeof SKIP_DOM_SELECTION_TAG | typeof SKIP_SCROLL_INTO_VIEW_TAG | (string & {});
@@ -0,0 +1,31 @@
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 { SerializedEditorState } from './LexicalEditorState';
8
+ import type { LexicalNode, SerializedLexicalNode } from './LexicalNode';
9
+ import { CommandPayloadType, EditorUpdateOptions, LexicalCommand, LexicalEditor, SetListeners, Transform } from './LexicalEditor';
10
+ import { EditorState } from './LexicalEditorState';
11
+ export declare function isCurrentlyReadOnlyMode(): boolean;
12
+ export declare function errorOnReadOnly(): void;
13
+ export declare function errorOnInfiniteTransforms(): void;
14
+ export declare function getActiveEditorState(): EditorState;
15
+ export declare function getActiveEditor(): LexicalEditor;
16
+ export declare function internalGetActiveEditor(): LexicalEditor | null;
17
+ export declare function internalGetActiveEditorState(): EditorState | null;
18
+ export declare function $applyTransforms(editor: LexicalEditor, node: LexicalNode, transformsCache: Map<string, Array<Transform<LexicalNode>>>): void;
19
+ export declare function $parseSerializedNode(serializedNode: SerializedLexicalNode): LexicalNode;
20
+ export declare function parseEditorState(serializedEditorState: SerializedEditorState, editor: LexicalEditor, updateFn: void | (() => void)): EditorState;
21
+ export declare function readEditorState<V>(editor: LexicalEditor | null, editorState: EditorState, callbackFn: () => V): V;
22
+ export declare function $commitPendingUpdates(editor: LexicalEditor, recoveryEditorState?: EditorState): void;
23
+ export declare function triggerListeners<T extends keyof SetListeners>(type: T, editor: LexicalEditor, isCurrentlyEnqueuingUpdates: boolean, ...payload: SetListeners[T]): void;
24
+ export declare function triggerCommandListeners<TCommand extends LexicalCommand<unknown>>(editor: LexicalEditor, type: TCommand, payload: CommandPayloadType<TCommand>): boolean;
25
+ /**
26
+ * A variant of updateEditor that will not defer if it is nested in an update
27
+ * to the same editor, much like if it was an editor.dispatchCommand issued
28
+ * within an update
29
+ */
30
+ export declare function updateEditorSync(editor: LexicalEditor, updateFn: () => void, options?: EditorUpdateOptions): void;
31
+ export declare function updateEditor(editor: LexicalEditor, updateFn: () => void, options?: EditorUpdateOptions): void;