@prosekit/core 0.8.0 → 0.8.2

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