@prosekit/core 0.7.15 → 0.8.1

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.
@@ -1,203 +1,1519 @@
1
- export { addMark } from './_tsup-dts-rollup.js';
2
- export { AddMarkOptions } from './_tsup-dts-rollup.js';
3
- export { expandMark } from './_tsup-dts-rollup.js';
4
- export { ExpandMarkOptions } from './_tsup-dts-rollup.js';
5
- export { insertDefaultBlock } from './_tsup-dts-rollup.js';
6
- export { InsertDefaultBlockOptions } from './_tsup-dts-rollup.js';
7
- export { insertNode } from './_tsup-dts-rollup.js';
8
- export { InsertNodeOptions } from './_tsup-dts-rollup.js';
9
- export { removeMark } from './_tsup-dts-rollup.js';
10
- export { RemoveMarkOptions } from './_tsup-dts-rollup.js';
11
- export { removeNode } from './_tsup-dts-rollup.js';
12
- export { RemoveNodeOptions } from './_tsup-dts-rollup.js';
13
- export { setBlockType } from './_tsup-dts-rollup.js';
14
- export { SetBlockTypeOptions } from './_tsup-dts-rollup.js';
15
- export { setNodeAttrs } from './_tsup-dts-rollup.js';
16
- export { SetNodeAttrsOptions } from './_tsup-dts-rollup.js';
17
- export { toggleMark } from './_tsup-dts-rollup.js';
18
- export { ToggleMarkOptions } from './_tsup-dts-rollup.js';
19
- export { toggleNode } from './_tsup-dts-rollup.js';
20
- export { ToggleNodeOptions } from './_tsup-dts-rollup.js';
21
- export { toggleWrap } from './_tsup-dts-rollup.js';
22
- export { ToggleWrapOptions } from './_tsup-dts-rollup.js';
23
- export { unsetBlockType } from './_tsup-dts-rollup.js';
24
- export { UnsetBlockTypeOptions } from './_tsup-dts-rollup.js';
25
- export { unsetMark } from './_tsup-dts-rollup.js';
26
- export { UnsetMarkOptions } from './_tsup-dts-rollup.js';
27
- export { wrap } from './_tsup-dts-rollup.js';
28
- export { WrapOptions } from './_tsup-dts-rollup.js';
29
- export { MarkAction } from './_tsup-dts-rollup.js';
30
- export { MarkBuilder } from './_tsup-dts-rollup.js';
31
- export { NodeAction } from './_tsup-dts-rollup.js';
32
- export { NodeBuilder } from './_tsup-dts-rollup.js';
33
- export { NodeChild } from './_tsup-dts-rollup.js';
34
- export { createEditor } from './_tsup-dts-rollup.js';
35
- export { Editor } from './_tsup-dts-rollup.js';
36
- export { EditorOptions } from './_tsup-dts-rollup.js';
37
- export { union } from './_tsup-dts-rollup.js';
38
- export { withPriority } from './_tsup-dts-rollup.js';
39
- export { EditorNotFoundError_alias_1 as EditorNotFoundError } from './_tsup-dts-rollup.js';
40
- export { ProseKitError_alias_1 as ProseKitError } from './_tsup-dts-rollup.js';
41
- export { defineClipboardSerializer } from './_tsup-dts-rollup.js';
42
- export { ClipboardSerializerOptions } from './_tsup-dts-rollup.js';
43
- export { defineBaseCommands } from './_tsup-dts-rollup.js';
44
- export { defineCommands } from './_tsup-dts-rollup.js';
45
- export { BaseCommandsExtension } from './_tsup-dts-rollup.js';
46
- export { defineDefaultState } from './_tsup-dts-rollup.js';
47
- export { DefaultStateOptions } from './_tsup-dts-rollup.js';
48
- export { defineDoc } from './_tsup-dts-rollup.js';
49
- export { DocExtension } from './_tsup-dts-rollup.js';
50
- export { defineDocChangeHandler } from './_tsup-dts-rollup.js';
51
- export { DocChangeHandler } from './_tsup-dts-rollup.js';
52
- export { defineDOMEventHandler } from './_tsup-dts-rollup.js';
53
- export { DOMEventHandler } from './_tsup-dts-rollup.js';
54
- export { defineClickHandler } from './_tsup-dts-rollup.js';
55
- export { defineClickOnHandler } from './_tsup-dts-rollup.js';
56
- export { defineDoubleClickHandler } from './_tsup-dts-rollup.js';
57
- export { defineDoubleClickOnHandler } from './_tsup-dts-rollup.js';
58
- export { defineDropHandler } from './_tsup-dts-rollup.js';
59
- export { defineKeyDownHandler } from './_tsup-dts-rollup.js';
60
- export { defineKeyPressHandler } from './_tsup-dts-rollup.js';
61
- export { definePasteHandler } from './_tsup-dts-rollup.js';
62
- export { defineScrollToSelectionHandler } from './_tsup-dts-rollup.js';
63
- export { defineTextInputHandler } from './_tsup-dts-rollup.js';
64
- export { defineTripleClickHandler } from './_tsup-dts-rollup.js';
65
- export { defineTripleClickOnHandler } from './_tsup-dts-rollup.js';
66
- export { editorEventFacet } from './_tsup-dts-rollup.js';
67
- export { ClickHandler } from './_tsup-dts-rollup.js';
68
- export { ClickOnHandler } from './_tsup-dts-rollup.js';
69
- export { DoubleClickHandler } from './_tsup-dts-rollup.js';
70
- export { DoubleClickOnHandler } from './_tsup-dts-rollup.js';
71
- export { DropHandler } from './_tsup-dts-rollup.js';
72
- export { EditorEventPayload } from './_tsup-dts-rollup.js';
73
- export { KeyDownHandler } from './_tsup-dts-rollup.js';
74
- export { KeyPressHandler } from './_tsup-dts-rollup.js';
75
- export { PasteHandler } from './_tsup-dts-rollup.js';
76
- export { ScrollToSelectionHandler } from './_tsup-dts-rollup.js';
77
- export { TextInputHandler } from './_tsup-dts-rollup.js';
78
- export { TripleClickHandler } from './_tsup-dts-rollup.js';
79
- export { TripleClickOnHandler } from './_tsup-dts-rollup.js';
80
- export { defineFocusChangeHandler } from './_tsup-dts-rollup.js';
81
- export { FocusChangeHandler } from './_tsup-dts-rollup.js';
82
- export { defineMountHandler } from './_tsup-dts-rollup.js';
83
- export { defineUnmountHandler } from './_tsup-dts-rollup.js';
84
- export { defineUpdateHandler } from './_tsup-dts-rollup.js';
85
- export { MountHandler } from './_tsup-dts-rollup.js';
86
- export { UnmountHandler } from './_tsup-dts-rollup.js';
87
- export { UpdateHandler } from './_tsup-dts-rollup.js';
88
- export { defineHistory } from './_tsup-dts-rollup.js';
89
- export { HistoryExtension } from './_tsup-dts-rollup.js';
90
- export { HistoryOptions } from './_tsup-dts-rollup.js';
91
- export { defineKeymap } from './_tsup-dts-rollup.js';
92
- export { keymapFacet } from './_tsup-dts-rollup.js';
93
- export { Keymap } from './_tsup-dts-rollup.js';
94
- export { KeymapPayload } from './_tsup-dts-rollup.js';
95
- export { defineBaseKeymap } from './_tsup-dts-rollup.js';
96
- export { BaseKeymapExtension } from './_tsup-dts-rollup.js';
97
- export { defineMarkAttr } from './_tsup-dts-rollup.js';
98
- export { defineMarkSpec } from './_tsup-dts-rollup.js';
99
- export { MarkAttrOptions } from './_tsup-dts-rollup.js';
100
- export { MarkSpecOptions } from './_tsup-dts-rollup.js';
101
- export { defineMarkView } from './_tsup-dts-rollup.js';
102
- export { MarkViewOptions } from './_tsup-dts-rollup.js';
103
- export { defineMarkViewComponent } from './_tsup-dts-rollup.js';
104
- export { defineMarkViewFactory } from './_tsup-dts-rollup.js';
105
- export { MarkViewComponentOptions } from './_tsup-dts-rollup.js';
106
- export { MarkViewFactoryOptions } from './_tsup-dts-rollup.js';
107
- export { defineNodeAttr } from './_tsup-dts-rollup.js';
108
- export { defineNodeSpec } from './_tsup-dts-rollup.js';
109
- export { NodeAttrOptions } from './_tsup-dts-rollup.js';
110
- export { NodeSpecOptions } from './_tsup-dts-rollup.js';
111
- export { defineNodeView } from './_tsup-dts-rollup.js';
112
- export { NodeViewOptions } from './_tsup-dts-rollup.js';
113
- export { defineNodeViewComponent } from './_tsup-dts-rollup.js';
114
- export { defineNodeViewFactory } from './_tsup-dts-rollup.js';
115
- export { NodeViewComponentOptions } from './_tsup-dts-rollup.js';
116
- export { NodeViewFactoryOptions } from './_tsup-dts-rollup.js';
117
- export { defineParagraph } from './_tsup-dts-rollup.js';
118
- export { ParagraphExtension } from './_tsup-dts-rollup.js';
119
- export { definePlugin } from './_tsup-dts-rollup.js';
120
- export { pluginFacet } from './_tsup-dts-rollup.js';
121
- export { PluginPayload } from './_tsup-dts-rollup.js';
122
- export { defineText } from './_tsup-dts-rollup.js';
123
- export { TextExtension } from './_tsup-dts-rollup.js';
124
- export { defineFacet } from './_tsup-dts-rollup.js';
125
- export { Facet } from './_tsup-dts-rollup.js';
126
- export { defineFacetPayload } from './_tsup-dts-rollup.js';
127
- export { AnyFunction } from './_tsup-dts-rollup.js';
128
- export { AnyAttrs } from './_tsup-dts-rollup.js';
129
- export { AttrSpec } from './_tsup-dts-rollup.js';
130
- export { BaseNodeViewOptions } from './_tsup-dts-rollup.js';
131
- export { Extension } from './_tsup-dts-rollup.js';
132
- export { ExtensionTyping } from './_tsup-dts-rollup.js';
133
- export { ExtractCommandActions } from './_tsup-dts-rollup.js';
134
- export { ExtractCommandAppliers } from './_tsup-dts-rollup.js';
135
- export { ExtractCommandCreators } from './_tsup-dts-rollup.js';
136
- export { ExtractMarkActions } from './_tsup-dts-rollup.js';
137
- export { ExtractMarks } from './_tsup-dts-rollup.js';
138
- export { ExtractNodeActions } from './_tsup-dts-rollup.js';
139
- export { ExtractNodes } from './_tsup-dts-rollup.js';
140
- export { PlainExtension } from './_tsup-dts-rollup.js';
141
- export { Union } from './_tsup-dts-rollup.js';
142
- export { UnionExtension } from './_tsup-dts-rollup.js';
143
- export { CommandAction } from './_tsup-dts-rollup.js';
144
- export { CommandTyping } from './_tsup-dts-rollup.js';
145
- export { MarkTyping } from './_tsup-dts-rollup.js';
146
- export { ToMarkAction } from './_tsup-dts-rollup.js';
147
- export { NodeTyping } from './_tsup-dts-rollup.js';
148
- export { ToNodeAction } from './_tsup-dts-rollup.js';
149
- export { NodeJSON } from './_tsup-dts-rollup.js';
150
- export { SelectionJSON } from './_tsup-dts-rollup.js';
151
- export { StateJSON } from './_tsup-dts-rollup.js';
152
- export { StepJSON } from './_tsup-dts-rollup.js';
153
- export { PickSubType } from './_tsup-dts-rollup.js';
154
- export { Priority } from './_tsup-dts-rollup.js';
155
- export { SimplifyDeeper } from './_tsup-dts-rollup.js';
156
- export { SimplifyUnion } from './_tsup-dts-rollup.js';
157
- export { assert } from './_tsup-dts-rollup.js';
158
- export { canUseRegexLookbehind } from './_tsup-dts-rollup.js';
159
- export { clsx } from './_tsup-dts-rollup.js';
160
- export { collectChildren } from './_tsup-dts-rollup.js';
161
- export { collectNodes } from './_tsup-dts-rollup.js';
162
- export { NodeContent } from './_tsup-dts-rollup.js';
163
- export { containsInlineNode } from './_tsup-dts-rollup.js';
164
- export { defaultBlockAt } from './_tsup-dts-rollup.js';
165
- export { isApple } from './_tsup-dts-rollup.js';
166
- export { findParentNode } from './_tsup-dts-rollup.js';
167
- export { FindParentNodeResult } from './_tsup-dts-rollup.js';
168
- export { findParentNodeOfType } from './_tsup-dts-rollup.js';
169
- export { _getId } from './_tsup-dts-rollup.js';
170
- export { getMarkType } from './_tsup-dts-rollup.js';
171
- export { getNodeType } from './_tsup-dts-rollup.js';
172
- export { isAtBlockStart } from './_tsup-dts-rollup.js';
173
- export { isElement } from './_tsup-dts-rollup.js';
174
- export { isInCodeBlock } from './_tsup-dts-rollup.js';
175
- export { isMarkAbsent } from './_tsup-dts-rollup.js';
176
- export { isMarkActive } from './_tsup-dts-rollup.js';
177
- export { maybeRun } from './_tsup-dts-rollup.js';
178
- export { elementFromJSON } from './_tsup-dts-rollup.js';
179
- export { elementFromNode } from './_tsup-dts-rollup.js';
180
- export { htmlFromJSON } from './_tsup-dts-rollup.js';
181
- export { htmlFromNode } from './_tsup-dts-rollup.js';
182
- export { jsonFromHTML } from './_tsup-dts-rollup.js';
183
- export { jsonFromNode } from './_tsup-dts-rollup.js';
184
- export { jsonFromState } from './_tsup-dts-rollup.js';
185
- export { nodeFromElement } from './_tsup-dts-rollup.js';
186
- export { nodeFromHTML } from './_tsup-dts-rollup.js';
187
- export { nodeFromJSON } from './_tsup-dts-rollup.js';
188
- export { stateFromJSON } from './_tsup-dts-rollup.js';
189
- export { DOMDocumentOptions } from './_tsup-dts-rollup.js';
190
- export { DOMParserOptions } from './_tsup-dts-rollup.js';
191
- export { DOMSerializerOptions } from './_tsup-dts-rollup.js';
192
- export { JSONParserOptions } from './_tsup-dts-rollup.js';
193
- export { setSelectionAround } from './_tsup-dts-rollup.js';
194
- export { isAllSelection } from './_tsup-dts-rollup.js';
195
- export { isFragment } from './_tsup-dts-rollup.js';
196
- export { isMark } from './_tsup-dts-rollup.js';
197
- export { isNodeSelection } from './_tsup-dts-rollup.js';
198
- export { isProseMirrorNode } from './_tsup-dts-rollup.js';
199
- export { isSelection } from './_tsup-dts-rollup.js';
200
- export { isSlice } from './_tsup-dts-rollup.js';
201
- export { isTextSelection } from './_tsup-dts-rollup.js';
202
- export { withSkipCodeBlock } from './_tsup-dts-rollup.js';
203
- export { OBJECT_REPLACEMENT_CHARACTER } from './_tsup-dts-rollup.js';
1
+ import { AnyAttrs, AttrSpec, CommandAction, CommandCreator, CommandTyping, DOMDocumentOptions, DOMParserOptions, DOMSerializerOptions, Editor$1 as Editor, EditorOptions, Extension, ExtensionTyping, ExtractCommandActions, ExtractCommandAppliers, ExtractCommandCreators, ExtractMarkActions, ExtractMarks, ExtractNodeActions, ExtractNodes, JSONParserOptions, MarkAction, MarkBuilder, MarkTyping, NodeAction, NodeBuilder, NodeChild, NodeJSON, NodeTyping, PickSubType, PlainExtension, Priority$1 as Priority, SelectionJSON, SimplifyDeeper, SimplifyUnion, StateJSON, StepJSON, ToMarkAction, ToNodeAction, Union, UnionExtension, createEditor$1 as createEditor, elementFromJSON$1 as elementFromJSON, elementFromNode$1 as elementFromNode, htmlFromJSON$1 as htmlFromJSON, htmlFromNode$1 as htmlFromNode, jsonFromHTML$1 as jsonFromHTML, jsonFromNode$1 as jsonFromNode, jsonFromState$1 as jsonFromState, nodeFromElement$1 as nodeFromElement, nodeFromHTML$1 as nodeFromHTML, nodeFromJSON$1 as nodeFromJSON, stateFromJSON$1 as stateFromJSON } from "./editor-BP9kgR6R.js";
2
+ import { AllSelection, Command, EditorState, EditorStateConfig, NodeSelection, Plugin, Selection, TextSelection, Transaction } from "@prosekit/pm/state";
3
+ import { Attrs as Attrs$1, ContentMatch, DOMSerializer, Fragment, Mark as Mark$1, MarkSpec, MarkType as MarkType$1, Node as Node$1, NodeSpec, NodeType as NodeType$1, ProseMirrorFragment, ProseMirrorNode, ResolvedPos, Schema, Slice } from "@prosekit/pm/model";
4
+ import { DOMEventMap, EditorView, MarkViewConstructor, NodeView, NodeViewConstructor } from "@prosekit/pm/view";
5
+
6
+ //#region src/commands/add-mark.d.ts
7
+ /**
8
+ * @public
9
+ */
10
+ /**
11
+ * @public
12
+ */
13
+ interface AddMarkOptions {
14
+ /**
15
+ * The type of the mark to add.
16
+ */
17
+ type: string | MarkType$1;
18
+ /**
19
+ * The attributes of the mark to add.
20
+ */
21
+ attrs?: Attrs$1 | null;
22
+ /**
23
+ * The start position of the document. By default it will be the start position of current selection.
24
+ */
25
+ from?: number;
26
+ /**
27
+ * The end position of the document. By default it will be the end position of current selection.
28
+ */
29
+ to?: number;
30
+ }
31
+ /**
32
+ * Returns a command that adds the given mark with the given attributes.
33
+ *
34
+ * @public
35
+ */
36
+ declare function addMark(options: AddMarkOptions): Command; //#endregion
37
+ //#region src/commands/expand-mark.d.ts
38
+ /**
39
+ * @public
40
+ */
41
+ interface ExpandMarkOptions {
42
+ /**
43
+ * The type of the mark to expand.
44
+ */
45
+ type: string | MarkType$1;
46
+ }
47
+ /**
48
+ * Expands the selection to include the entire mark at the current position.
49
+ *
50
+ * @public
51
+ */
52
+ declare function expandMark(options: ExpandMarkOptions): Command;
53
+
54
+ //#endregion
55
+ //#region src/commands/insert-default-block.d.ts
56
+ /**
57
+ * @public
58
+ */
59
+ interface InsertDefaultBlockOptions {
60
+ /**
61
+ * The position to insert the node at. By default it will insert after the
62
+ * current selection.
63
+ */
64
+ pos?: number;
65
+ }
66
+ /**
67
+ * Returns a command that inserts a default block after current selection or at
68
+ * the given position.
69
+ *
70
+ * @public
71
+ */
72
+ declare function insertDefaultBlock(options?: InsertDefaultBlockOptions): Command;
73
+
74
+ //#endregion
75
+ //#region src/commands/insert-node.d.ts
76
+ /**
77
+ * @public
78
+ */
79
+ interface InsertNodeOptions {
80
+ /**
81
+ * The node to insert. Either this or `type` must be provided.
82
+ */
83
+ node?: ProseMirrorNode;
84
+ /**
85
+ * The type of the node to insert. Either this or `node` must be provided.
86
+ */
87
+ type?: string | NodeType$1;
88
+ /**
89
+ * When `type` is provided, the attributes of the node to insert.
90
+ */
91
+ attrs?: Attrs$1;
92
+ /**
93
+ * The position to insert the node at. By default it will be the anchor
94
+ * position of current selection.
95
+ */
96
+ pos?: number;
97
+ }
98
+ /**
99
+ * Returns a command that inserts the given node at the current selection or at
100
+ * the given position.
101
+ *
102
+ * @public
103
+ */
104
+ declare function insertNode(options: InsertNodeOptions): Command;
105
+
106
+ //#endregion
107
+ //#region src/commands/remove-mark.d.ts
108
+ /**
109
+ * @public
110
+ */
111
+ interface RemoveMarkOptions {
112
+ /**
113
+ * The type of the mark to remove.
114
+ */
115
+ type: string | MarkType$1;
116
+ /**
117
+ * If attrs is given, remove precisely the mark with the given attrs. Otherwise, remove all marks of the given type.
118
+ */
119
+ attrs?: Attrs$1 | null;
120
+ /**
121
+ * The start position of the document. By default it will be the start position of current selection.
122
+ */
123
+ from?: number;
124
+ /**
125
+ * The end position of the document. By default it will be the end position of current selection.
126
+ */
127
+ to?: number;
128
+ }
129
+ /**
130
+ * Returns a command that removes the given mark.
131
+ *
132
+ * @public
133
+ */
134
+ declare function removeMark(options: RemoveMarkOptions): Command;
135
+
136
+ //#endregion
137
+ //#region src/commands/remove-node.d.ts
138
+ /**
139
+ * @public
140
+ */
141
+ interface RemoveNodeOptions {
142
+ /**
143
+ * The type of the node to remove.
144
+ */
145
+ type: string | NodeType$1;
146
+ /**
147
+ * The document position to start searching node. By default it will be the
148
+ * anchor position of current selection.
149
+ */
150
+ pos?: number;
151
+ }
152
+ /**
153
+ * Returns a command to remove the nearest ancestor node of a specific type from the current position.
154
+ *
155
+ * @public
156
+ */
157
+ declare function removeNode(options: RemoveNodeOptions): Command;
158
+
159
+ //#endregion
160
+ //#region src/commands/set-block-type.d.ts
161
+ /**
162
+ * @public
163
+ */
164
+ interface SetBlockTypeOptions {
165
+ type: NodeType$1 | string;
166
+ attrs?: Attrs$1 | null;
167
+ from?: number;
168
+ to?: number;
169
+ }
170
+ /**
171
+ * Returns a command that tries to set the selected textblocks to the given node
172
+ * type with the given attributes.
173
+ *
174
+ * @public
175
+ */
176
+ declare function setBlockType(options: SetBlockTypeOptions): Command;
177
+
178
+ //#endregion
179
+ //#region src/commands/set-node-attrs.d.ts
180
+ /**
181
+ * @public
182
+ */
183
+ interface SetNodeAttrsOptions {
184
+ /**
185
+ * The type of node to set the attributes of.
186
+ *
187
+ * If current node is not of this type, the command will do nothing.
188
+ */
189
+ type: string | NodeType$1 | string[] | NodeType$1[];
190
+ /**
191
+ * The attributes to set.
192
+ */
193
+ attrs: Attrs$1;
194
+ /**
195
+ * The position of the node. Defaults to the position of the wrapping node
196
+ * containing the current selection.
197
+ */
198
+ pos?: number;
199
+ }
200
+ /**
201
+ * Returns a command that set the attributes of the current node.
202
+ *
203
+ * @public
204
+ */
205
+ declare function setNodeAttrs(options: SetNodeAttrsOptions): Command;
206
+
207
+ //#endregion
208
+ //#region src/commands/toggle-mark.d.ts
209
+ /**
210
+ * @public
211
+ */
212
+ interface ToggleMarkOptions {
213
+ /**
214
+ * The mark type to toggle.
215
+ */
216
+ type: string | MarkType$1;
217
+ /**
218
+ * The optional attributes to set on the mark.
219
+ */
220
+ attrs?: Attrs$1 | null;
221
+ /**
222
+ * Controls whether, when part of the selected range has the mark
223
+ * already and part doesn't, the mark is removed (`true`) or added
224
+ * (`false`).
225
+ *
226
+ * @default false
227
+ */
228
+ removeWhenPresent?: boolean;
229
+ /**
230
+ * Whether the command should act on the content of inline nodes marked as
231
+ * [atoms](https://prosemirror.net/docs/ref/#model.NodeSpec.atom) that are
232
+ * completely covered by a selection range.
233
+ *
234
+ * @default true
235
+ */
236
+ enterInlineAtoms?: boolean;
237
+ }
238
+ /**
239
+ * Returns a command that toggles the given mark with the given attributes.
240
+ *
241
+ * @param options
242
+ *
243
+ * @public
244
+ */
245
+ declare function toggleMark({
246
+ type,
247
+ attrs,
248
+ removeWhenPresent,
249
+ enterInlineAtoms
250
+ }: ToggleMarkOptions): Command;
251
+
252
+ //#endregion
253
+ //#region src/commands/toggle-node.d.ts
254
+ /**
255
+ * @public
256
+ */
257
+ interface ToggleNodeOptions {
258
+ /**
259
+ * The type of the node to toggle.
260
+ */
261
+ type: string | NodeType$1;
262
+ /**
263
+ * The attributes of the node to toggle.
264
+ */
265
+ attrs?: Attrs$1 | null;
266
+ }
267
+ /**
268
+ * Returns a command that set the selected textblocks to the given node type
269
+ * with the given attributes.
270
+ *
271
+ * @param options
272
+ *
273
+ * @public
274
+ */
275
+ declare function toggleNode({
276
+ type,
277
+ attrs
278
+ }: ToggleNodeOptions): Command;
279
+
280
+ //#endregion
281
+ //#region src/commands/toggle-wrap.d.ts
282
+ interface ToggleWrapOptions {
283
+ /**
284
+ * The type of the node to toggle.
285
+ */
286
+ type: string | NodeType$1;
287
+ /**
288
+ * The attributes of the node to toggle.
289
+ */
290
+ attrs?: Attrs$1 | null;
291
+ }
292
+ /**
293
+ * Toggle between wrapping an inactive node with the provided node type, and
294
+ * lifting it up into it's parent.
295
+ *
296
+ * @param options
297
+ *
298
+ * @public
299
+ */
300
+ declare function toggleWrap(options: ToggleWrapOptions): Command;
301
+
302
+ //#endregion
303
+ //#region src/commands/unset-block-type.d.ts
304
+ /**
305
+ * @public
306
+ */
307
+ interface UnsetBlockTypeOptions {
308
+ /**
309
+ * The start position of the document. By default it will be the start position of current selection.
310
+ */
311
+ from?: number;
312
+ /**
313
+ * The end position of the document. By default it will be the end position of current selection.
314
+ */
315
+ to?: number;
316
+ }
317
+ /**
318
+ * Returns a command that set the type of all textblocks between the given range
319
+ * to the default type (usually `paragraph`).
320
+ *
321
+ * @public
322
+ */
323
+ declare function unsetBlockType(options?: UnsetBlockTypeOptions): Command;
324
+
325
+ //#endregion
326
+ //#region src/commands/unset-mark.d.ts
327
+ /**
328
+ * @public
329
+ */
330
+ interface UnsetMarkOptions {
331
+ /**
332
+ * The start position of the document. By default it will be the start position of current selection.
333
+ */
334
+ from?: number;
335
+ /**
336
+ * The end position of the document. By default it will be the end position of current selection.
337
+ */
338
+ to?: number;
339
+ }
340
+ /**
341
+ * Returns a command that removes all marks.
342
+ *
343
+ * @public
344
+ */
345
+ declare function unsetMark(options?: UnsetMarkOptions): Command;
346
+
347
+ //#endregion
348
+ //#region src/commands/wrap.d.ts
349
+ /**
350
+ * @public
351
+ */
352
+ interface WrapOptions {
353
+ /**
354
+ * The node type to wrap the selected textblock with.
355
+ */
356
+ type: NodeType$1 | string;
357
+ /**
358
+ * @deprecated Use `nodeSpec` instead.
359
+ */
360
+ nodeType?: NodeType$1;
361
+ /**
362
+ * Optional attributes to apply to the node.
363
+ */
364
+ attrs?: Attrs$1 | null;
365
+ }
366
+ /**
367
+ * Returns a command that wraps the selected textblock with the given node type.
368
+ *
369
+ * @param options
370
+ *
371
+ * @public
372
+ */
373
+ declare function wrap(options: WrapOptions): Command;
374
+
375
+ //#endregion
376
+ //#region src/editor/union.d.ts
377
+ /**
378
+ * Merges multiple extensions into one. You can pass multiple extensions as
379
+ * arguments or a single array containing multiple extensions.
380
+ *
381
+ * @throws If no extensions are provided.
382
+ *
383
+ * @example
384
+ *
385
+ * ```ts
386
+ * function defineFancyNodes() {
387
+ * return union(
388
+ * defineFancyParagraph(),
389
+ * defineFancyHeading(),
390
+ * )
391
+ * }
392
+ * ```
393
+ *
394
+ * @example
395
+ *
396
+ * ```ts
397
+ * function defineFancyNodes() {
398
+ * return union([
399
+ * defineFancyParagraph(),
400
+ * defineFancyHeading(),
401
+ * ])
402
+ * }
403
+ * ```
404
+ *
405
+ * @public
406
+ */
407
+ declare function union<const E extends readonly Extension[]>(...exts: E): Union<E>;
408
+ declare function union<const E extends readonly Extension[]>(exts: E): Union<E>;
409
+
410
+ //#endregion
411
+ //#region src/editor/with-priority.d.ts
412
+ /**
413
+ * Return an new extension with the given priority.
414
+ *
415
+ * @example
416
+ * ```ts
417
+ * import { Priority, withPriority } from 'prosekit/core'
418
+ *
419
+ * const extension = withPriority(defineMyExtension(), Priority.high)
420
+ * ```
421
+ *
422
+ * @public
423
+ */
424
+ declare function withPriority<T extends Extension>(extension: T, priority: Priority): T;
425
+
426
+ //#endregion
427
+ //#region src/error.d.ts
428
+ /**
429
+ * Base class for all ProseKit errors.
430
+ *
431
+ * @internal
432
+ */
433
+ declare class ProseKitError extends Error {}
434
+ /**
435
+ * @internal
436
+ */
437
+ declare class EditorNotFoundError extends ProseKitError {
438
+ constructor();
439
+ }
440
+
441
+ //#endregion
442
+ //#region src/types/any-function.d.ts
443
+ /**
444
+ * @internal
445
+ */
446
+ /**
447
+ * @internal
448
+ */
449
+ type AnyFunction = (...args: any[]) => any;
450
+
451
+ //#endregion
452
+ //#region src/extensions/clipboard-serializer.d.ts
453
+ type SerializeFragmentFunction = typeof DOMSerializer.prototype.serializeFragment;
454
+ type SerializeNodeFunction = typeof DOMSerializer.prototype.serializeNode;
455
+ type NodesFromSchemaFunction = typeof DOMSerializer.nodesFromSchema;
456
+ type MarksFromSchemaFunction = typeof DOMSerializer.marksFromSchema;
457
+ type FunctionWrapper<T extends AnyFunction> = (fn: T) => T;
458
+ /**
459
+ * @internal
460
+ */
461
+ interface ClipboardSerializerOptions {
462
+ serializeFragmentWrapper?: FunctionWrapper<SerializeFragmentFunction>;
463
+ serializeNodeWrapper?: FunctionWrapper<SerializeNodeFunction>;
464
+ nodesFromSchemaWrapper?: FunctionWrapper<NodesFromSchemaFunction>;
465
+ marksFromSchemaWrapper?: FunctionWrapper<MarksFromSchemaFunction>;
466
+ }
467
+ /**
468
+ * @internal
469
+ */
470
+ declare function defineClipboardSerializer(options: ClipboardSerializerOptions): PlainExtension;
471
+
472
+ //#endregion
473
+ //#region src/commands/insert-text.d.ts
474
+ /**
475
+ * @public
476
+ */
477
+ type InsertTextOptions = {
478
+ text: string;
479
+ from?: number;
480
+ to?: number;
481
+ };
482
+
483
+ //#endregion
484
+ //#region src/extensions/command.d.ts
485
+ /**
486
+ * Returns a command that inserts the given text.
487
+ *
488
+ * @public
489
+ */
490
+ declare function defineCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
491
+ Commands: { [K in keyof T]: Parameters<T[K]> };
492
+ }>;
493
+ /**
494
+ * @internal
495
+ */
496
+ type BaseCommandsExtension = Extension<{
497
+ Commands: {
498
+ insertText: [options: InsertTextOptions];
499
+ insertNode: [options: InsertNodeOptions];
500
+ removeNode: [options: RemoveNodeOptions];
501
+ wrap: [options: WrapOptions];
502
+ toggleWrap: [options: ToggleWrapOptions];
503
+ setBlockType: [options: SetBlockTypeOptions];
504
+ setNodeAttrs: [options: SetNodeAttrsOptions];
505
+ insertDefaultBlock: [options?: InsertDefaultBlockOptions];
506
+ selectAll: [];
507
+ addMark: [options: AddMarkOptions];
508
+ removeMark: [options: RemoveMarkOptions];
509
+ unsetBlockType: [options?: UnsetBlockTypeOptions];
510
+ unsetMark: [options?: UnsetMarkOptions];
511
+ };
512
+ }>;
513
+ /**
514
+ * Add some base commands
515
+ *
516
+ * @public
517
+ */
518
+ declare function defineBaseCommands(): BaseCommandsExtension;
519
+
520
+ //#endregion
521
+ //#region src/extensions/default-state.d.ts
522
+ /**
523
+ * @public
524
+ */
525
+ interface DefaultStateOptions {
526
+ /**
527
+ * The starting document to use when creating the editor. It can be a
528
+ * ProseMirror node JSON object, a HTML string, or a HTML element instance.
529
+ */
530
+ defaultContent?: NodeJSON | string | HTMLElement;
531
+ /**
532
+ * A JSON object representing the starting document to use when creating the
533
+ * editor.
534
+ *
535
+ * @deprecated Use `defaultContent` instead.
536
+ */
537
+ defaultDoc?: NodeJSON;
538
+ /**
539
+ * A HTML element or a HTML string representing the starting document to use
540
+ * when creating the editor.
541
+ *
542
+ * @deprecated Use `defaultContent` instead.
543
+ */
544
+ defaultHTML?: string | HTMLElement;
545
+ /**
546
+ * A JSON object representing the starting selection to use when creating the
547
+ * editor. It's only used when `defaultContent` is also provided.
548
+ */
549
+ defaultSelection?: SelectionJSON;
550
+ }
551
+ /**
552
+ * Define a default state for the editor.
553
+ *
554
+ * @param options
555
+ *
556
+ * @public
557
+ */
558
+ declare function defineDefaultState({
559
+ defaultSelection,
560
+ defaultContent,
561
+ defaultDoc,
562
+ defaultHTML
563
+ }: DefaultStateOptions): PlainExtension;
564
+
565
+ //#endregion
566
+ //#region src/extensions/doc.d.ts
567
+ /**
568
+ * @internal
569
+ */
570
+ type DocExtension = Extension<{
571
+ Nodes: {
572
+ doc: Attrs$1;
573
+ };
574
+ }>;
575
+ /**
576
+ * @public
577
+ *
578
+ * @deprecated Use the following import instead:
579
+ *
580
+ * ```ts
581
+ * import { defineDoc } from 'prosekit/extensions/doc'
582
+ * ```
583
+ */
584
+ declare function defineDoc(): DocExtension;
585
+
586
+ //#endregion
587
+ //#region src/extensions/events/doc-change.d.ts
588
+ /**
589
+ * A function that is called when the editor document is changed.
590
+ *
591
+ * @param view - The editor view.
592
+ * @param prevState - The previous editor state.
593
+ *
594
+ * @public
595
+ */
596
+ type DocChangeHandler = (view: EditorView, prevState: EditorState) => void;
597
+ /**
598
+ * Registers a event handler that is called when the editor document is changed.
599
+ *
600
+ * @public
601
+ */
602
+ declare function defineDocChangeHandler(handler: DocChangeHandler): PlainExtension;
603
+
604
+ //#endregion
605
+ //#region src/facets/facet-types.d.ts
606
+ /**
607
+ * @internal
608
+ */
609
+ type FacetReducer<Input, Output> = (input: Input[]) => Output;
610
+
611
+ //#endregion
612
+ //#region src/facets/facet.d.ts
613
+ /**
614
+ * @internal
615
+ */
616
+ declare class Facet<Input, Output> {
617
+ private _reducer?;
618
+ private _reduce?;
619
+ /**
620
+ * @internal
621
+ */
622
+ readonly index: number;
623
+ /**
624
+ * @internal
625
+ */
626
+ readonly parent: Facet<Output, any> | null;
627
+ /**
628
+ * @internal
629
+ */
630
+ readonly singleton: boolean;
631
+ /**
632
+ * A index path to retrieve the current facet in a tree from the root.
633
+ *
634
+ * @internal
635
+ */
636
+ readonly path: number[];
637
+ /**
638
+ * @internal
639
+ */
640
+ constructor(parent: Facet<Output, any> | null, singleton: boolean, _reducer?: FacetReducer<Input, Output> | undefined, _reduce?: () => FacetReducer<Input, Output>);
641
+ get reducer(): FacetReducer<Input, Output>;
642
+ }
643
+ /**
644
+ * @internal
645
+ */
646
+ declare function defineFacet<Input, Output>(options: {
647
+ /**
648
+ * The parent facet in the tree.
649
+ */
650
+ parent: Facet<Output, any>;
651
+ /**
652
+ * Set this to true if you only want to keep one facet payload. For example,
653
+ * this facet corresponds to a ProseMirror plugin with a key.
654
+ */
655
+ singleton?: boolean;
656
+ /**
657
+ * A reducer is a function that accepts an array of input and produce a single
658
+ * output.
659
+ */
660
+ reducer?: FacetReducer<Input, Output>;
661
+ /**
662
+ * A callback function that returns a reducer. This is useful if you want to
663
+ * store something in the closure.
664
+ */
665
+ reduce?: () => FacetReducer<Input, Output>;
666
+ }): Facet<Input, Output>;
667
+
668
+ //#endregion
669
+ //#region src/facets/state.d.ts
670
+ type StatePayload = (ctx: {
671
+ schema: Schema;
672
+ }) => EditorStateConfig;
673
+
674
+ //#endregion
675
+ //#region src/extensions/plugin.d.ts
676
+ /**
677
+ * Adds a ProseMirror plugin to the editor.
678
+ *
679
+ * @param plugin - The ProseMirror plugin to add, or an array of plugins, or a
680
+ * function that returns one or multiple plugins.
681
+ *
682
+ * @public
683
+ */
684
+ declare function definePlugin(plugin: Plugin | Plugin[] | ((context: {
685
+ schema: Schema;
686
+ }) => Plugin | Plugin[])): PlainExtension;
687
+ /**
688
+ * @internal
689
+ */
690
+ type PluginPayload = Plugin | Plugin[] | ((context: {
691
+ schema: Schema;
692
+ }) => Plugin | Plugin[]);
693
+ /**
694
+ * @internal
695
+ */
696
+ declare const pluginFacet: Facet<PluginPayload, StatePayload>;
697
+
698
+ //#endregion
699
+ //#region src/extensions/events/dom-event.d.ts
700
+ /**
701
+ * A function to handle the events fired on the editable DOM element. Returns
702
+ * `true` to indicate that it handled the given event. you are responsible for
703
+ * calling `preventDefault` yourself (or not, if you want to allow the default
704
+ * behavior).
705
+ *
706
+ * @public
707
+ */
708
+ type DOMEventHandler<Event extends keyof DOMEventMap = string> = (view: EditorView, event: DOMEventMap[Event]) => boolean | void;
709
+ /**
710
+ * @internal
711
+ */
712
+
713
+ /**
714
+ * Register a new event handler for the given event type.
715
+ *
716
+ * @public
717
+ */
718
+ declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): PlainExtension;
719
+
720
+ //#endregion
721
+ //#region src/types/object-entries.d.ts
722
+ /**
723
+ * @internal
724
+ */
725
+ /**
726
+ * @internal
727
+ *
728
+ * @example
729
+ *
730
+ * ```
731
+ * type MyObject = { a: 1; b: 'B' }
732
+ * type MyEntries = ObjectEntries<MyObject>
733
+ * // ^ ["a", 1] | ["b", "B"]
734
+ */
735
+ type ObjectEntries<T extends Record<string, any>> = { [K in keyof T]: [K, T[K]] }[keyof T];
736
+
737
+ //#endregion
738
+ //#region src/extensions/events/editor-event.d.ts
739
+ type KeyDownHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
740
+ type KeyPressHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
741
+ type TextInputHandler = (view: EditorView, from: number, to: number, text: string) => boolean | void;
742
+ type ClickOnHandler = (view: EditorView, pos: number, node: Node$1, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
743
+ type ClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
744
+ type DoubleClickOnHandler = (view: EditorView, pos: number, node: Node$1, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
745
+ type DoubleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
746
+ type TripleClickOnHandler = (view: EditorView, pos: number, node: Node$1, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
747
+ type TripleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
748
+ type PasteHandler = (view: EditorView, event: ClipboardEvent, slice: Slice) => boolean | void;
749
+ type DropHandler = (view: EditorView, event: DragEvent, slice: Slice, moved: boolean) => boolean | void;
750
+ type ScrollToSelectionHandler = (view: EditorView) => boolean;
751
+ /**
752
+ * @public
753
+ *
754
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
755
+ */
756
+ declare function defineKeyDownHandler(handler: KeyDownHandler): PlainExtension;
757
+ /**
758
+ * @public
759
+ *
760
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
761
+ */
762
+ declare function defineKeyPressHandler(handler: KeyPressHandler): PlainExtension;
763
+ /**
764
+ * @public
765
+ *
766
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
767
+ */
768
+ declare function defineTextInputHandler(handler: TextInputHandler): PlainExtension;
769
+ /**
770
+ * @public
771
+ *
772
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
773
+ */
774
+ declare function defineClickOnHandler(handler: ClickOnHandler): PlainExtension;
775
+ /**
776
+ * @public
777
+ *
778
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
779
+ */
780
+ declare function defineClickHandler(handler: ClickHandler): PlainExtension;
781
+ /**
782
+ * @public
783
+ *
784
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
785
+ */
786
+ declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): PlainExtension;
787
+ /**
788
+ * @public
789
+ *
790
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
791
+ */
792
+ declare function defineDoubleClickHandler(handler: DoubleClickHandler): PlainExtension;
793
+ /**
794
+ * @public
795
+ *
796
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
797
+ */
798
+ declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): PlainExtension;
799
+ /**
800
+ * @public
801
+ *
802
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
803
+ */
804
+ declare function defineTripleClickHandler(handler: TripleClickHandler): PlainExtension;
805
+ /**
806
+ * @public
807
+ *
808
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
809
+ */
810
+ declare function definePasteHandler(handler: PasteHandler): PlainExtension;
811
+ /**
812
+ * @public
813
+ *
814
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
815
+ */
816
+ declare function defineDropHandler(handler: DropHandler): PlainExtension;
817
+ /**
818
+ * @public
819
+ *
820
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
821
+ */
822
+ declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): PlainExtension;
823
+ interface EditorEventMap {
824
+ keyDown: KeyDownHandler;
825
+ keyPress: KeyPressHandler;
826
+ textInput: TextInputHandler;
827
+ clickOn: ClickOnHandler;
828
+ click: ClickHandler;
829
+ doubleClickOn: DoubleClickOnHandler;
830
+ doubleClick: DoubleClickHandler;
831
+ tripleClickOn: TripleClickOnHandler;
832
+ tripleClick: TripleClickHandler;
833
+ paste: PasteHandler;
834
+ drop: DropHandler;
835
+ scrollToSelection: ScrollToSelectionHandler;
836
+ }
837
+ /**
838
+ * @internal
839
+ */
840
+ type EditorEventPayload = ObjectEntries<EditorEventMap>;
841
+ /**
842
+ * @internal
843
+ */
844
+ declare const editorEventFacet: Facet<EditorEventPayload, PluginPayload>;
845
+
846
+ //#endregion
847
+ //#region src/extensions/events/focus.d.ts
848
+ /**
849
+ * A function that is called when the editor gains or loses focus.
850
+ *
851
+ * @param hasFocus - Whether the editor has focus.
852
+ *
853
+ * @public
854
+ */
855
+ type FocusChangeHandler = (hasFocus: boolean) => void;
856
+ /**
857
+ * Registers a event handler that is called when the editor gains or loses focus.
858
+ *
859
+ * @public
860
+ */
861
+ declare function defineFocusChangeHandler(handler: FocusChangeHandler): PlainExtension;
862
+
863
+ //#endregion
864
+ //#region src/extensions/events/plugin-view.d.ts
865
+ /**
866
+ * A function that is called when the editor view is mounted.
867
+ *
868
+ * @param view - The editor view.
869
+ *
870
+ * @public
871
+ */
872
+ type MountHandler = (view: EditorView) => void;
873
+ /**
874
+ * A function that is called when the editor state is updated.
875
+ *
876
+ * @param view - The editor view.
877
+ * @param prevState - The previous editor state.
878
+ *
879
+ * @public
880
+ */
881
+ type UpdateHandler = (view: EditorView, prevState: EditorState) => void;
882
+ /**
883
+ * A function that is called when the editor view is unmounted.
884
+ *
885
+ * @public
886
+ */
887
+ type UnmountHandler = () => void;
888
+ /**
889
+ * Registers a event handler that is called when the editor view is mounted.
890
+ *
891
+ * @public
892
+ */
893
+ declare function defineMountHandler(handler: MountHandler): PlainExtension;
894
+ /**
895
+ * Registers a event handler that is called when the editor state is updated.
896
+ *
897
+ * @public
898
+ */
899
+ declare function defineUpdateHandler(handler: UpdateHandler): PlainExtension;
900
+ /**
901
+ * Registers a event handler that is called when the editor view is unmounted.
902
+ *
903
+ * @public
904
+ */
905
+ declare function defineUnmountHandler(handler: UnmountHandler): PlainExtension;
906
+
907
+ //#endregion
908
+ //#region src/extensions/history.d.ts
909
+ /**
910
+ * Options for {@link defineHistory}.
911
+ *
912
+ * @public
913
+ */
914
+ interface HistoryOptions {
915
+ /**
916
+ * The amount of history events that are collected before the oldest events
917
+ * are discarded.
918
+ *
919
+ * @default 200
920
+ */
921
+ depth?: number;
922
+ /**
923
+ * The delay in milliseconds between changes after which a new group should be
924
+ * started.
925
+ *
926
+ * @default 250
927
+ */
928
+ newGroupDelay?: number;
929
+ }
930
+ /**
931
+ * @internal
932
+ */
933
+ type HistoryExtension = Extension<{
934
+ Commands: {
935
+ undo: [];
936
+ redo: [];
937
+ };
938
+ }>;
939
+ /**
940
+ * Add undo/redo history to the editor.
941
+ *
942
+ * @param options
943
+ *
944
+ * @public
945
+ */
946
+ declare function defineHistory({
947
+ depth,
948
+ newGroupDelay
949
+ }?: HistoryOptions): HistoryExtension;
950
+
951
+ //#endregion
952
+ //#region src/extensions/keymap.d.ts
953
+ /**
954
+ * @public
955
+ */
956
+ interface Keymap {
957
+ [key: string]: Command;
958
+ }
959
+ /**
960
+ * @public
961
+ */
962
+ declare function defineKeymap(keymap: Keymap): PlainExtension;
963
+ /**
964
+ * @internal
965
+ */
966
+ type KeymapPayload = Keymap;
967
+ /**
968
+ * @internal
969
+ */
970
+ declare const keymapFacet: Facet<KeymapPayload, PluginPayload>;
971
+
972
+ //#endregion
973
+ //#region src/extensions/keymap-base.d.ts
974
+ /**
975
+ * @internal
976
+ */
977
+ type BaseKeymapExtension = PlainExtension;
978
+ /**
979
+ * Defines some basic key bindings.
980
+ *
981
+ * @public
982
+ */
983
+ declare function defineBaseKeymap(options?: {
984
+ /**
985
+ * The priority of the keymap.
986
+ *
987
+ * @default Priority.low
988
+ */
989
+ priority?: Priority;
990
+ }): BaseKeymapExtension;
991
+
992
+ //#endregion
993
+ //#region src/extensions/mark-spec.d.ts
994
+ /**
995
+ * @public
996
+ */
997
+ interface MarkSpecOptions<MarkName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends MarkSpec {
998
+ /**
999
+ * The name of the mark type.
1000
+ */
1001
+ name: MarkName;
1002
+ /**
1003
+ * The attributes that marks of this type get.
1004
+ */
1005
+ attrs?: { [K in keyof Attrs]: AttrSpec<Attrs[K]> };
1006
+ }
1007
+ /**
1008
+ * @public
1009
+ */
1010
+ interface MarkAttrOptions<MarkName extends string = string, AttrName extends string = string, AttrType = any> extends AttrSpec<AttrType> {
1011
+ /**
1012
+ * The name of the mark type.
1013
+ */
1014
+ type: MarkName;
1015
+ /**
1016
+ * The name of the attribute.
1017
+ */
1018
+ attr: AttrName;
1019
+ /**
1020
+ * Returns the attribute key and value to be set on the HTML element.
1021
+ *
1022
+ * If the returned `key` is `"style"`, the value is a string of CSS properties and will
1023
+ * be prepended to the existing `style` attribute on the DOM node.
1024
+ *
1025
+ * @param value - The value of the attribute of current ProseMirror node.
1026
+ */
1027
+ toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
1028
+ /**
1029
+ * Parses the attribute value from the DOM.
1030
+ */
1031
+ parseDOM?: (node: HTMLElement) => AttrType;
1032
+ }
1033
+ /**
1034
+ * @public
1035
+ */
1036
+ declare function defineMarkSpec<Mark extends string, Attrs extends AnyAttrs = AnyAttrs>(options: MarkSpecOptions<Mark, Attrs>): Extension<{
1037
+ Marks: { [K in Mark]: Attrs };
1038
+ }>;
1039
+ /**
1040
+ * @public
1041
+ */
1042
+ declare function defineMarkAttr<MarkType extends string = string, AttrName extends string = string, AttrType = any>(options: MarkAttrOptions<MarkType, AttrName, AttrType>): Extension<{
1043
+ Marks: { [K in MarkType]: AttrType };
1044
+ }>;
1045
+
1046
+ //#endregion
1047
+ //#region src/extensions/mark-view.d.ts
1048
+ interface MarkViewOptions {
1049
+ name: string;
1050
+ constructor: MarkViewConstructor;
1051
+ }
1052
+ declare function defineMarkView(options: MarkViewOptions): Extension;
1053
+
1054
+ //#endregion
1055
+ //#region src/extensions/mark-view-effect.d.ts
1056
+ /**
1057
+ * @internal
1058
+ */
1059
+ type MarkViewFactoryOptions<T> = {
1060
+ group: string;
1061
+ factory: (args: T) => MarkViewConstructor;
1062
+ };
1063
+ /**
1064
+ * @internal
1065
+ */
1066
+ type MarkViewComponentOptions<T> = {
1067
+ group: string;
1068
+ name: string;
1069
+ args: T;
1070
+ };
1071
+ /**
1072
+ * @internal
1073
+ */
1074
+ declare function defineMarkViewFactory<T>(options: MarkViewFactoryOptions<T>): Extension;
1075
+ /**
1076
+ * @internal
1077
+ */
1078
+ declare function defineMarkViewComponent<T>(options: MarkViewComponentOptions<T>): Extension;
1079
+
1080
+ //#endregion
1081
+ //#region src/extensions/node-spec.d.ts
1082
+ /**
1083
+ * @public
1084
+ */
1085
+ interface NodeSpecOptions<NodeName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends NodeSpec {
1086
+ /**
1087
+ * The name of the node type.
1088
+ */
1089
+ name: NodeName;
1090
+ /**
1091
+ * Whether this is the top-level node type. Only one node type can be the
1092
+ * top-level node type in a schema.
1093
+ */
1094
+ topNode?: boolean;
1095
+ /**
1096
+ * The attributes that nodes of this type get.
1097
+ */
1098
+ attrs?: { [key in keyof Attrs]: AttrSpec<Attrs[key]> };
1099
+ }
1100
+ /**
1101
+ * @public
1102
+ */
1103
+ interface NodeAttrOptions<NodeName extends string = string, AttrName extends string = string, AttrType = any> extends AttrSpec<AttrType> {
1104
+ /**
1105
+ * The name of the node type.
1106
+ */
1107
+ type: NodeName;
1108
+ /**
1109
+ * The name of the attribute.
1110
+ */
1111
+ attr: AttrName;
1112
+ /**
1113
+ * Whether the attribute should be kept when the node is split. Set it to
1114
+ * `true` if you want to inherit the attribute from the previous node when
1115
+ * splitting the node by pressing `Enter`.
1116
+ *
1117
+ * @default undefined
1118
+ */
1119
+ splittable?: boolean;
1120
+ /**
1121
+ * Returns the attribute key and value to be set on the HTML element.
1122
+ *
1123
+ * If the returned `key` is `"style"`, the value is a string of CSS properties and will
1124
+ * be prepended to the existing `style` attribute on the DOM node.
1125
+ *
1126
+ * @param value - The value of the attribute of current ProseMirror node.
1127
+ */
1128
+ toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
1129
+ /**
1130
+ * Parses the attribute value from the DOM.
1131
+ */
1132
+ parseDOM?: (node: HTMLElement) => AttrType;
1133
+ }
1134
+ /**
1135
+ * Defines a node type.
1136
+ *
1137
+ * @public
1138
+ */
1139
+ declare function defineNodeSpec<Node extends string, Attrs extends AnyAttrs = AnyAttrs>(options: NodeSpecOptions<Node, Attrs>): Extension<{
1140
+ Nodes: { [K in Node]: Attrs };
1141
+ }>;
1142
+ /**
1143
+ * Defines an attribute for a node type.
1144
+ *
1145
+ * @public
1146
+ */
1147
+ declare function defineNodeAttr<NodeType extends string = string, AttrName extends string = string, AttrType = any>(options: NodeAttrOptions<NodeType, AttrName, AttrType>): Extension<{
1148
+ Nodes: { [K in NodeType]: { [K in AttrName]: AttrType } };
1149
+ }>;
1150
+
1151
+ //#endregion
1152
+ //#region src/extensions/node-view.d.ts
1153
+ interface NodeViewOptions {
1154
+ name: string;
1155
+ constructor: NodeViewConstructor;
1156
+ }
1157
+ declare function defineNodeView(options: NodeViewOptions): Extension;
1158
+
1159
+ //#endregion
1160
+ //#region src/extensions/node-view-effect.d.ts
1161
+ /**
1162
+ * @internal
1163
+ */
1164
+ type NodeViewFactoryOptions<T> = {
1165
+ group: string;
1166
+ factory: (args: T) => NodeViewConstructor;
1167
+ };
1168
+ /**
1169
+ * @internal
1170
+ */
1171
+ type NodeViewComponentOptions<T> = {
1172
+ group: string;
1173
+ name: string;
1174
+ args: T;
1175
+ };
1176
+ /**
1177
+ * @internal
1178
+ */
1179
+ declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): Extension;
1180
+ /**
1181
+ * @internal
1182
+ */
1183
+ declare function defineNodeViewComponent<T>(options: NodeViewComponentOptions<T>): Extension;
1184
+
1185
+ //#endregion
1186
+ //#region src/extensions/paragraph.d.ts
1187
+ /**
1188
+ * @internal
1189
+ */
1190
+ type ParagraphSpecExtension = Extension<{
1191
+ Nodes: {
1192
+ paragraph: Attrs$1;
1193
+ };
1194
+ }>;
1195
+ /**
1196
+ * @internal
1197
+ *
1198
+ * @deprecated Use the following import instead:
1199
+ *
1200
+ * ```ts
1201
+ * import type { ParagraphExtension } from 'prosekit/extensions/paragraph'
1202
+ * ```
1203
+ */
1204
+ type ParagraphExtension = ParagraphSpecExtension;
1205
+ /**
1206
+ * @public
1207
+ *
1208
+ * Defines a paragraph node spec as the highest priority, because it should be the default block node for most cases.
1209
+ *
1210
+ * @deprecated Use the following import instead:
1211
+ *
1212
+ * ```ts
1213
+ * import { defineParagraph } from 'prosekit/extensions/paragraph'
1214
+ * ```
1215
+ */
1216
+ declare function defineParagraph(): ParagraphExtension;
1217
+
1218
+ //#endregion
1219
+ //#region src/extensions/text.d.ts
1220
+ /**
1221
+ * @internal
1222
+ */
1223
+ type TextExtension = Extension<{
1224
+ Nodes: {
1225
+ text: Attrs$1;
1226
+ };
1227
+ }>;
1228
+ /**
1229
+ * @public
1230
+ *
1231
+ * @deprecated Use the following import instead:
1232
+ *
1233
+ * ```ts
1234
+ * import { defineText } from 'prosekit/extensions/text'
1235
+ * ```
1236
+ */
1237
+ declare function defineText(): TextExtension;
1238
+
1239
+ //#endregion
1240
+ //#region src/facets/facet-extension.d.ts
1241
+ /**
1242
+ * @internal
1243
+ */
1244
+ declare function defineFacetPayload<Input>(facet: Facet<Input, any>, payloads: Input[]): Extension;
1245
+
1246
+ //#endregion
1247
+ //#region src/types/base-node-view-options.d.ts
1248
+ /**
1249
+ * Some basic props for custom node views.
1250
+ *
1251
+ * @deprecated - This is no longer needed. Use `CoreNodeViewUserOptions` from `@prosemirror-adapter/core` instead.
1252
+ *
1253
+ * @hidden
1254
+ */
1255
+ interface BaseNodeViewOptions {
1256
+ /**
1257
+ * The wrapping DOM element for the node view. Defaults to `div` for block nodes and `span` for inline nodes.
1258
+ */
1259
+ as?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
1260
+ /**
1261
+ * The wrapping DOM element for the node view's content. Defaults to `div` for block nodes and `span` for inline nodes.
1262
+ */
1263
+ contentAs?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
1264
+ update?: NodeView["update"];
1265
+ ignoreMutation?: NodeView["ignoreMutation"];
1266
+ selectNode?: NodeView["selectNode"];
1267
+ deselectNode?: NodeView["deselectNode"];
1268
+ setSelection?: NodeView["setSelection"];
1269
+ stopEvent?: NodeView["stopEvent"];
1270
+ destroy?: NodeView["destroy"];
1271
+ onUpdate?: () => void;
1272
+ }
1273
+
1274
+ //#endregion
1275
+ //#region src/utils/assert.d.ts
1276
+ /**
1277
+ * @internal
1278
+ */
1279
+ declare function assert(condition: unknown, message?: string): asserts condition;
1280
+
1281
+ //#endregion
1282
+ //#region src/utils/can-use-regex-lookbehind.d.ts
1283
+ declare const canUseRegexLookbehind: () => boolean;
1284
+
1285
+ //#endregion
1286
+ //#region src/utils/clsx.d.ts
1287
+ /**
1288
+ * A utility for constructing `className` strings conditionally.
1289
+ *
1290
+ * It is a re-export of [clsx/lite](https://www.npmjs.com/package/clsx) with stricter types.
1291
+ *
1292
+ * @public
1293
+ */
1294
+ declare const clsx: (...args: Array<string | boolean | null | undefined>) => string;
1295
+
1296
+ //#endregion
1297
+ //#region src/utils/collect-children.d.ts
1298
+ /**
1299
+ * Collects all children of a node or a fragment, and returns them as an array.
1300
+ *
1301
+ * @public
1302
+ */
1303
+ declare function collectChildren(parent: ProseMirrorNode | Fragment): ProseMirrorNode[];
1304
+
1305
+ //#endregion
1306
+ //#region src/utils/collect-nodes.d.ts
1307
+ /**
1308
+ * @public
1309
+ *
1310
+ * @deprecated
1311
+ */
1312
+ type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
1313
+ /**
1314
+ * Collects all nodes from a given content.
1315
+ *
1316
+ * @deprecated Use `collectChildren` instead.
1317
+ *
1318
+ * @public
1319
+ */
1320
+ declare function collectNodes(content: NodeContent): ProseMirrorNode[];
1321
+
1322
+ //#endregion
1323
+ //#region src/utils/contains-inline-node.d.ts
1324
+ /**
1325
+ * @internal
1326
+ */
1327
+ declare function containsInlineNode(doc: ProseMirrorNode, from: number, to: number): boolean;
1328
+
1329
+ //#endregion
1330
+ //#region src/utils/default-block-at.d.ts
1331
+ /**
1332
+ * @internal
1333
+ */
1334
+ declare function defaultBlockAt(match: ContentMatch): NodeType$1 | null;
1335
+
1336
+ //#endregion
1337
+ //#region src/utils/env.d.ts
1338
+ /**
1339
+ * @private
1340
+ */
1341
+ declare const isApple: boolean;
1342
+
1343
+ //#endregion
1344
+ //#region src/utils/find-parent-node.d.ts
1345
+ /**
1346
+ * @public
1347
+ */
1348
+ interface FindParentNodeResult {
1349
+ /**
1350
+ * The closest parent node that satisfies the predicate.
1351
+ */
1352
+ node: ProseMirrorNode;
1353
+ /**
1354
+ * The position directly before the node.
1355
+ */
1356
+ pos: number;
1357
+ /**
1358
+ * The position at the start of the node.
1359
+ */
1360
+ start: number;
1361
+ /**
1362
+ * The depth of the node.
1363
+ */
1364
+ depth: number;
1365
+ }
1366
+ /**
1367
+ * Find the closest parent node that satisfies the predicate.
1368
+ *
1369
+ * @public
1370
+ */
1371
+ declare function findParentNode(predicate: (node: ProseMirrorNode) => boolean, $pos: ResolvedPos): FindParentNodeResult | undefined;
1372
+
1373
+ //#endregion
1374
+ //#region src/utils/find-parent-node-of-type.d.ts
1375
+ /**
1376
+ * Finds the closest parent node that matches the given node type.
1377
+ *
1378
+ * @public
1379
+ */
1380
+ declare function findParentNodeOfType(type: NodeType$1 | string, $pos: ResolvedPos): FindParentNodeResult | undefined;
1381
+
1382
+ //#endregion
1383
+ //#region src/utils/get-id.d.ts
1384
+ /**
1385
+ * Returns a unique id in the current process that can be used in various places.
1386
+ *
1387
+ * @internal
1388
+ */
1389
+ declare function getId(): string;
1390
+
1391
+ //#endregion
1392
+ //#region src/utils/get-mark-type.d.ts
1393
+ /**
1394
+ * @internal
1395
+ */
1396
+ declare function getMarkType(schema: Schema, type: string | MarkType$1): MarkType$1;
1397
+
1398
+ //#endregion
1399
+ //#region src/utils/get-node-type.d.ts
1400
+ /**
1401
+ * @internal
1402
+ */
1403
+ declare function getNodeType(schema: Schema, type: string | NodeType$1): NodeType$1;
1404
+
1405
+ //#endregion
1406
+ //#region src/utils/is-at-block-start.d.ts
1407
+ /**
1408
+ * Whether the selection is an empty text selection at the start of a block.
1409
+ *
1410
+ * @internal
1411
+ */
1412
+ declare function isAtBlockStart(state: EditorState, view?: EditorView): ResolvedPos | null;
1413
+
1414
+ //#endregion
1415
+ //#region src/utils/is-in-code-block.d.ts
1416
+ /**
1417
+ * Check if the selection is in a code block.
1418
+ *
1419
+ * @internal
1420
+ */
1421
+ declare function isInCodeBlock(selection: Selection): boolean;
1422
+
1423
+ //#endregion
1424
+ //#region src/utils/is-mark-absent.d.ts
1425
+ /**
1426
+ * Returns true if the given mark is missing in some part of the range.
1427
+ * Returns false if the entire range has the given mark.
1428
+ * Returns true if the mark is not allowed in the range.
1429
+ *
1430
+ * @internal
1431
+ */
1432
+ declare function isMarkAbsent(node: ProseMirrorNode, from: number, to: number, markType: MarkType$1, attrs?: Attrs$1 | null): boolean;
1433
+
1434
+ //#endregion
1435
+ //#region src/utils/is-mark-active.d.ts
1436
+ /**
1437
+ * @internal
1438
+ */
1439
+ declare function isMarkActive(state: EditorState, type: string | MarkType$1, attrs?: Attrs$1 | null): boolean;
1440
+
1441
+ //#endregion
1442
+ //#region src/utils/maybe-run.d.ts
1443
+ /**
1444
+ * @internal
1445
+ */
1446
+ declare function maybeRun<MaybeFn, Result = (MaybeFn extends ((...args: any[]) => void) ? ReturnType<MaybeFn> : MaybeFn)>(value: MaybeFn, ...args: MaybeFn extends ((...args: any[]) => void) ? Parameters<MaybeFn> : never): Result;
1447
+
1448
+ //#endregion
1449
+ //#region src/utils/set-selection-around.d.ts
1450
+ declare function setSelectionAround(tr: Transaction, pos: number): void;
1451
+
1452
+ //#endregion
1453
+ //#region src/utils/type-assertion.d.ts
1454
+ /**
1455
+ * Checks if the given object is a `ProseMirrorNode` instance.
1456
+ */
1457
+ declare function isProseMirrorNode(node: unknown): node is ProseMirrorNode;
1458
+ /**
1459
+ * Checks if the given object is a `Mark` instance.
1460
+ *
1461
+ * @public
1462
+ */
1463
+ declare function isMark(mark: unknown): mark is Mark$1;
1464
+ /**
1465
+ * Checks if the given object is a `Fragment` instance.
1466
+ *
1467
+ * @public
1468
+ */
1469
+ declare function isFragment(fragment: unknown): fragment is Fragment;
1470
+ /**
1471
+ * Checks if the given object is a `Slice` instance.
1472
+ *
1473
+ * @public
1474
+ */
1475
+ declare function isSlice(slice: unknown): slice is Slice;
1476
+ /**
1477
+ * Checks if the given object is a `Selection` instance.
1478
+ *
1479
+ * @public
1480
+ */
1481
+ declare function isSelection(sel: unknown): sel is Selection;
1482
+ /**
1483
+ * Checks if the given object is a `TextSelection` instance.
1484
+ *
1485
+ * @public
1486
+ */
1487
+ declare function isTextSelection(sel: Selection): sel is TextSelection;
1488
+ /**
1489
+ * Checks if the given object is a `NodeSelection` instance.
1490
+ *
1491
+ * @public
1492
+ */
1493
+ declare function isNodeSelection(sel: Selection): sel is NodeSelection;
1494
+ /**
1495
+ * Checks if the given object is a `AllSelection` instance.
1496
+ *
1497
+ * @public
1498
+ */
1499
+ declare function isAllSelection(sel: Selection): sel is AllSelection;
1500
+
1501
+ //#endregion
1502
+ //#region src/utils/unicode.d.ts
1503
+ /**
1504
+ * @internal
1505
+ */
1506
+ /**
1507
+ * @internal
1508
+ */
1509
+ declare const OBJECT_REPLACEMENT_CHARACTER = "";
1510
+
1511
+ //#endregion
1512
+ //#region src/utils/with-skip-code-block.d.ts
1513
+ /**
1514
+ * @internal
1515
+ */
1516
+ declare function withSkipCodeBlock(command: Command): Command;
1517
+
1518
+ //#endregion
1519
+ export { AddMarkOptions, AnyAttrs, AnyFunction, AttrSpec, BaseCommandsExtension, BaseKeymapExtension, BaseNodeViewOptions, ClickHandler, ClickOnHandler, ClipboardSerializerOptions, CommandAction, CommandTyping, DOMDocumentOptions, DOMEventHandler, DOMParserOptions, DOMSerializerOptions, DefaultStateOptions, DocChangeHandler, DocExtension, DoubleClickHandler, DoubleClickOnHandler, DropHandler, Editor, EditorEventPayload, EditorNotFoundError, EditorOptions, ExpandMarkOptions, Extension, ExtensionTyping, ExtractCommandActions, ExtractCommandAppliers, ExtractCommandCreators, ExtractMarkActions, ExtractMarks, ExtractNodeActions, ExtractNodes, Facet, FindParentNodeResult, FocusChangeHandler, HistoryExtension, HistoryOptions, InsertDefaultBlockOptions, InsertNodeOptions, JSONParserOptions, KeyDownHandler, KeyPressHandler, Keymap, KeymapPayload, MarkAction, MarkAttrOptions, MarkBuilder, MarkSpecOptions, MarkTyping, MarkViewComponentOptions, MarkViewFactoryOptions, MarkViewOptions, MountHandler, NodeAction, NodeAttrOptions, NodeBuilder, NodeChild, NodeContent, NodeJSON, NodeSpecOptions, NodeTyping, NodeViewComponentOptions, NodeViewFactoryOptions, NodeViewOptions, OBJECT_REPLACEMENT_CHARACTER, ParagraphExtension, PasteHandler, PickSubType, PlainExtension, PluginPayload, Priority, ProseKitError, RemoveMarkOptions, RemoveNodeOptions, ScrollToSelectionHandler, SelectionJSON, SetBlockTypeOptions, SetNodeAttrsOptions, SimplifyDeeper, SimplifyUnion, StateJSON, StepJSON, TextExtension, TextInputHandler, ToMarkAction, ToNodeAction, ToggleMarkOptions, ToggleNodeOptions, ToggleWrapOptions, TripleClickHandler, TripleClickOnHandler, Union, UnionExtension, UnmountHandler, UnsetBlockTypeOptions, UnsetMarkOptions, UpdateHandler, WrapOptions, getId as _getId, addMark, assert, canUseRegexLookbehind, clsx, collectChildren, collectNodes, containsInlineNode, createEditor, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClickHandler, defineClickOnHandler, defineClipboardSerializer, defineCommands, defineDOMEventHandler, defineDefaultState, defineDoc, defineDocChangeHandler, defineDoubleClickHandler, defineDoubleClickOnHandler, defineDropHandler, defineFacet, defineFacetPayload, defineFocusChangeHandler, defineHistory, defineKeyDownHandler, defineKeyPressHandler, defineKeymap, defineMarkAttr, defineMarkSpec, defineMarkView, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeAttr, defineNodeSpec, defineNodeView, defineNodeViewComponent, defineNodeViewFactory, defineParagraph, definePasteHandler, definePlugin, defineScrollToSelectionHandler, defineText, defineTextInputHandler, defineTripleClickHandler, defineTripleClickOnHandler, defineUnmountHandler, defineUpdateHandler, editorEventFacet, elementFromJSON, elementFromNode, expandMark, findParentNode, findParentNodeOfType, getMarkType, getNodeType, htmlFromJSON, htmlFromNode, insertDefaultBlock, insertNode, isAllSelection, isApple, isAtBlockStart, isFragment, isInCodeBlock, isMark, isMarkAbsent, isMarkActive, isNodeSelection, isProseMirrorNode, isSelection, isSlice, isTextSelection, jsonFromHTML, jsonFromNode, jsonFromState, keymapFacet, maybeRun, nodeFromElement, nodeFromHTML, nodeFromJSON, pluginFacet, removeMark, removeNode, setBlockType, setNodeAttrs, setSelectionAround, stateFromJSON, toggleMark, toggleNode, toggleWrap, union, unsetBlockType, unsetMark, withPriority, withSkipCodeBlock, wrap };