@prosekit/core 0.0.0-next-20230709094459 → 0.0.0-next-20240421132240

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.
@@ -0,0 +1,1720 @@
1
+ import { AllSelection } from '@prosekit/pm/state';
2
+ import { Attrs } from '@prosekit/pm/model';
3
+ import { Attrs as Attrs_2 } from 'prosemirror-model';
4
+ import { Command } from '@prosekit/pm/state';
5
+ import type { ConditionalExcept } from 'type-fest';
6
+ import type { ContentMatch } from '@prosekit/pm/model';
7
+ import type { DirectEditorProps } from '@prosekit/pm/view';
8
+ import type { DOMEventMap } from '@prosekit/pm/view';
9
+ import { DOMParser as DOMParser_2 } from '@prosekit/pm/model';
10
+ import { DOMSerializer } from '@prosekit/pm/model';
11
+ import { EditorState } from '@prosekit/pm/state';
12
+ import type { EditorStateConfig } from '@prosekit/pm/state';
13
+ import { EditorView } from '@prosekit/pm/view';
14
+ import type { EmptyObject } from 'type-fest';
15
+ import type { IsEqual } from 'type-fest';
16
+ import { Mark } from '@prosekit/pm/model';
17
+ import type { MarkSpec } from '@prosekit/pm/model';
18
+ import { MarkType } from '@prosekit/pm/model';
19
+ import { MarkType as MarkType_2 } from 'prosemirror-model';
20
+ import { Node as Node_2 } from 'prosemirror-model';
21
+ import type { Node as Node_3 } from '@prosekit/pm/model';
22
+ import { NodeSelection } from '@prosekit/pm/state';
23
+ import type { NodeSpec } from '@prosekit/pm/model';
24
+ import { NodeType } from '@prosekit/pm/model';
25
+ import { NodeType as NodeType_2 } from 'prosemirror-model';
26
+ import { NodeView } from '@prosekit/pm/view';
27
+ import { NodeViewConstructor } from '@prosekit/pm/view';
28
+ import { Options } from 'tsup';
29
+ import { Plugin as Plugin_2 } from '@prosekit/pm/state';
30
+ import { ProseMirrorFragment } from '@prosekit/pm/model';
31
+ import { ProseMirrorNode } from '@prosekit/pm/model';
32
+ import { Schema } from '@prosekit/pm/model';
33
+ import type { SchemaSpec } from '@prosekit/pm/model';
34
+ import { Selection as Selection_2 } from '@prosekit/pm/state';
35
+ import { Selection as Selection_3 } from 'prosemirror-state';
36
+ import type { Simplify } from 'type-fest';
37
+ import type { Slice } from '@prosekit/pm/model';
38
+ import { TextSelection } from '@prosekit/pm/state';
39
+ import { Transaction } from '@prosekit/pm/state';
40
+ import type { UnionToIntersection } from 'type-fest';
41
+
42
+ declare type Action = (options: {
43
+ tr: Transaction;
44
+ view?: EditorView;
45
+ }) => boolean;
46
+
47
+ /**
48
+ * Returns a command that adds the given mark with the given attributes.
49
+ *
50
+ * @public
51
+ */
52
+ declare function addMark(options: {
53
+ /**
54
+ * The type of the mark to add.
55
+ */
56
+ type: string | MarkType;
57
+ /**
58
+ * The attributes of the mark to add.
59
+ */
60
+ attrs?: Attrs | null;
61
+ /**
62
+ * The start position of the document. By default it will be the start position of current selection.
63
+ */
64
+ from?: number;
65
+ /**
66
+ * The end position of the document. By default it will be the end position of current selection.
67
+ */
68
+ to?: number;
69
+ }): Command;
70
+ export { addMark }
71
+ export { addMark as addMark_alias_1 }
72
+
73
+ export declare function applyAction(operator: Action): Command;
74
+
75
+ /**
76
+ * Utility function assert that two types are equal in tests.
77
+ */
78
+ export declare function assertTypeEqual<T, U>(_val: IsEqual<T, U>): void;
79
+
80
+ export declare function attrsMatch(nodeOrMark: ProseMirrorNode | Mark, attrs: Attrs): boolean;
81
+
82
+ export declare abstract class BaseExtension<T extends ExtensionTyping = ExtensionTyping> implements Extension<T> {
83
+ extension: Extension | Extension[];
84
+ priority?: Priority;
85
+ _type?: T;
86
+ /**
87
+ * @internal
88
+ *
89
+ * Whether this extension has payload that can be converted to a schema.
90
+ *
91
+ * Notice that this does not mean that the extension has a schema. For
92
+ * example, a `FacetExtension` with a `schemaFacet` will return `true` for
93
+ * this property, but will return `null` for `schema`.
94
+ */
95
+ abstract hasSchema: boolean;
96
+ /**
97
+ * @internal
98
+ *
99
+ * The schema that this extension represents.
100
+ */
101
+ abstract schema: Schema | null;
102
+ }
103
+
104
+ /**
105
+ * Some basic props for custom node views.
106
+ *
107
+ * @public
108
+ */
109
+ declare interface BaseNodeViewOptions {
110
+ /**
111
+ * The wrapping DOM element for the node view. Defaults to `div` for block nodes and `span` for inline nodes.
112
+ */
113
+ as?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
114
+ /**
115
+ * The wrapping DOM element for the node view's content. Defaults to `div` for block nodes and `span` for inline nodes.
116
+ */
117
+ contentAs?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
118
+ update?: NodeView['update'];
119
+ ignoreMutation?: NodeView['ignoreMutation'];
120
+ selectNode?: NodeView['selectNode'];
121
+ deselectNode?: NodeView['deselectNode'];
122
+ setSelection?: NodeView['setSelection'];
123
+ stopEvent?: NodeView['stopEvent'];
124
+ destroy?: NodeView['destroy'];
125
+ onUpdate?: () => void;
126
+ }
127
+ export { BaseNodeViewOptions }
128
+ export { BaseNodeViewOptions as BaseNodeViewOptions_alias_1 }
129
+
130
+ declare type ClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
131
+ export { ClickHandler }
132
+ export { ClickHandler as ClickHandler_alias_1 }
133
+
134
+ declare type ClickOnHandler = (view: EditorView, pos: number, node: Node_3, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
135
+ export { ClickOnHandler }
136
+ export { ClickOnHandler as ClickOnHandler_alias_1 }
137
+
138
+ /**
139
+ * A utility for constructing `className` strings conditionally.
140
+ *
141
+ * It is a re-export of [clsx/lite](https://www.npmjs.com/package/clsx) with stricter types.
142
+ *
143
+ * @public
144
+ */
145
+ declare const clsx: (...args: Array<string | boolean | null | undefined>) => string;
146
+ export { clsx }
147
+ export { clsx as clsx_alias_1 }
148
+
149
+ export declare function collectNodes(content: NodeContent): ProseMirrorNode[];
150
+
151
+ export declare function combineEventHandlers<Handler extends (...args: any[]) => boolean | void, Args extends Parameters<Handler> = Parameters<Handler>>(): readonly [(handlers: Handler[]) => void, (...args: Args) => boolean];
152
+
153
+ export declare interface CommandApplier<Args extends any[] = any[]> {
154
+ (...args: Args): boolean;
155
+ canApply(...args: Args): boolean;
156
+ }
157
+
158
+ /**
159
+ * @internal
160
+ */
161
+ declare interface CommandArgs {
162
+ [name: string]: any[];
163
+ }
164
+ export { CommandArgs }
165
+ export { CommandArgs as CommandArgs_alias_1 }
166
+
167
+ export declare type CommandCreator<Args extends any[] = any[]> = (...arg: Args) => Command;
168
+
169
+ export declare interface CommandCreators {
170
+ [name: string]: CommandCreator;
171
+ }
172
+
173
+ export declare const commandFacet: Facet<CommandCreators, CommandCreators>;
174
+
175
+ export declare type CommandPayload = CommandCreators;
176
+
177
+ export declare type Converters = ConverterTuple[];
178
+
179
+ declare type ConverterTuple = Tuple5<FacetConverter | undefined>;
180
+
181
+ /**
182
+ * @public
183
+ */
184
+ declare function createEditor<E extends Extension>(options: EditorOptions<E>): Editor<E>;
185
+ export { createEditor }
186
+ export { createEditor as createEditor_alias_1 }
187
+
188
+ export declare function createMarkBuilder(getState: () => EditorState | null | undefined, type: MarkType): MarkBuilder;
189
+
190
+ export declare function createNodeBuilder(getState: () => EditorState | null | undefined, type: NodeType): NodeBuilder;
191
+
192
+ export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
193
+
194
+ export declare const default_alias_1: {
195
+ test: {
196
+ environment: "jsdom";
197
+ };
198
+ };
199
+
200
+ /**
201
+ * @internal
202
+ */
203
+ declare function defaultBlockAt(match: ContentMatch): NodeType_2 | null;
204
+ export { defaultBlockAt }
205
+ export { defaultBlockAt as defaultBlockAt_alias_1 }
206
+
207
+ declare interface DefaultStateOptions {
208
+ /**
209
+ * A JSON object representing the starting document to use when creating the
210
+ * editor.
211
+ */
212
+ defaultDoc?: NodeJSON;
213
+ /**
214
+ * A HTML element or a HTML string representing the starting document to use
215
+ * when creating the editor.
216
+ */
217
+ defaultHTML?: string | HTMLElement;
218
+ /**
219
+ * A JSON object representing the starting selection to use when creating the
220
+ * editor. It's only used when `defaultDoc` or `defaultHTML` is also provided.
221
+ */
222
+ defaultSelection?: SelectionJSON;
223
+ }
224
+ export { DefaultStateOptions }
225
+ export { DefaultStateOptions as DefaultStateOptions_alias_1 }
226
+
227
+ /**
228
+ * Add some base commands
229
+ *
230
+ * @public
231
+ */
232
+ declare function defineBaseCommands(): Extension<{
233
+ COMMAND_ARGS: {
234
+ insertText: [{
235
+ text: string;
236
+ from?: number | undefined;
237
+ to?: number | undefined;
238
+ }];
239
+ insertNode: [options: {
240
+ node: Node_2;
241
+ pos?: number | undefined;
242
+ type?: undefined;
243
+ attrs?: undefined;
244
+ } | {
245
+ node?: undefined;
246
+ pos?: number | undefined;
247
+ type: string;
248
+ attrs?: Attrs_2 | undefined;
249
+ }];
250
+ wrap: [{
251
+ nodeType: NodeType_2;
252
+ attrs?: Attrs_2 | null | undefined;
253
+ }];
254
+ setBlockType: [options: {
255
+ type: string | NodeType_2;
256
+ attrs?: Attrs_2 | null | undefined;
257
+ from?: number | undefined;
258
+ to?: number | undefined;
259
+ }];
260
+ setNodeAttrs: [options: {
261
+ type: string | NodeType_2;
262
+ attrs: Attrs_2;
263
+ pos?: number | undefined;
264
+ }];
265
+ selectAll: [];
266
+ addMark: [options: {
267
+ type: string | MarkType_2;
268
+ attrs?: Attrs_2 | null | undefined;
269
+ from?: number | undefined;
270
+ to?: number | undefined;
271
+ }];
272
+ removeMark: [options: {
273
+ type: string | MarkType_2;
274
+ attrs?: Attrs_2 | null | undefined;
275
+ from?: number | undefined;
276
+ to?: number | undefined;
277
+ }];
278
+ };
279
+ }>;
280
+ export { defineBaseCommands }
281
+ export { defineBaseCommands as defineBaseCommands_alias_1 }
282
+
283
+ /**
284
+ * Defines some basic key bindings.
285
+ *
286
+ * @public
287
+ */
288
+ declare function defineBaseKeymap(options?: {
289
+ /**
290
+ * The priority of the keymap.
291
+ *
292
+ * @default Priority.low
293
+ */
294
+ priority?: Priority;
295
+ }): Extension<ExtensionTyping<string, string, CommandArgs>>;
296
+ export { defineBaseKeymap }
297
+ export { defineBaseKeymap as defineBaseKeymap_alias_1 }
298
+
299
+ /**
300
+ * @public
301
+ *
302
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
303
+ */
304
+ declare function defineClickHandler(handler: ClickHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
305
+ export { defineClickHandler }
306
+ export { defineClickHandler as defineClickHandler_alias_1 }
307
+
308
+ /**
309
+ * @public
310
+ *
311
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
312
+ */
313
+ declare function defineClickOnHandler(handler: ClickOnHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
314
+ export { defineClickOnHandler }
315
+ export { defineClickOnHandler as defineClickOnHandler_alias_1 }
316
+
317
+ declare function defineCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
318
+ COMMAND_ARGS: {
319
+ [K in keyof T]: Parameters<T[K]>;
320
+ };
321
+ }>;
322
+ export { defineCommands }
323
+ export { defineCommands as defineCommands_alias_1 }
324
+
325
+ declare function defineDefaultState({ defaultDoc, defaultHTML, defaultSelection, }: DefaultStateOptions): Extension;
326
+ export { defineDefaultState }
327
+ export { defineDefaultState as defineDefaultState_alias_1 }
328
+
329
+ /**
330
+ * @public
331
+ */
332
+ declare function defineDoc(): Extension< {
333
+ NODES: "doc";
334
+ }>;
335
+ export { defineDoc }
336
+ export { defineDoc as defineDoc_alias_1 }
337
+
338
+ /**
339
+ * Registers a event handler that is called when the editor document is changed.
340
+ *
341
+ * @public
342
+ */
343
+ declare function defineDocChangeHandler(handler: DocChangeHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
344
+ export { defineDocChangeHandler }
345
+ export { defineDocChangeHandler as defineDocChangeHandler_alias_1 }
346
+
347
+ /**
348
+ * Register a new event handler for the given event type.
349
+ *
350
+ * @public
351
+ */
352
+ declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): Extension<ExtensionTyping<string, string, CommandArgs>>;
353
+ export { defineDOMEventHandler }
354
+ export { defineDOMEventHandler as defineDOMEventHandler_alias_1 }
355
+
356
+ /**
357
+ * @public
358
+ *
359
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
360
+ */
361
+ declare function defineDoubleClickHandler(handler: DoubleClickHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
362
+ export { defineDoubleClickHandler }
363
+ export { defineDoubleClickHandler as defineDoubleClickHandler_alias_1 }
364
+
365
+ /**
366
+ * @public
367
+ *
368
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
369
+ */
370
+ declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
371
+ export { defineDoubleClickOnHandler }
372
+ export { defineDoubleClickOnHandler as defineDoubleClickOnHandler_alias_1 }
373
+
374
+ /**
375
+ * @public
376
+ *
377
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
378
+ */
379
+ declare function defineDropHandler(handler: DropHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
380
+ export { defineDropHandler }
381
+ export { defineDropHandler as defineDropHandler_alias_1 }
382
+
383
+ /**
384
+ * Registers a event handler that is called when the editor gains or loses focus.
385
+ *
386
+ * @public
387
+ */
388
+ declare function defineFocusChangeHandler(handler: FocusChangeHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
389
+ export { defineFocusChangeHandler }
390
+ export { defineFocusChangeHandler as defineFocusChangeHandler_alias_1 }
391
+
392
+ /**
393
+ * Add undo/redo history to the editor.
394
+ */
395
+ declare function defineHistory(): Extension< {
396
+ COMMAND_ARGS: {
397
+ undo: [];
398
+ redo: [];
399
+ };
400
+ }>;
401
+ export { defineHistory }
402
+ export { defineHistory as defineHistory_alias_1 }
403
+
404
+ /**
405
+ * @public
406
+ *
407
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
408
+ */
409
+ declare function defineKeyDownHandler(handler: KeyDownHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
410
+ export { defineKeyDownHandler }
411
+ export { defineKeyDownHandler as defineKeyDownHandler_alias_1 }
412
+
413
+ /**
414
+ * @public
415
+ */
416
+ declare function defineKeymap(keymap: Keymap): Extension;
417
+ export { defineKeymap }
418
+ export { defineKeymap as defineKeymap_alias_1 }
419
+
420
+ /**
421
+ * @public
422
+ *
423
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
424
+ */
425
+ declare function defineKeyPressHandler(handler: KeyPressHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
426
+ export { defineKeyPressHandler }
427
+ export { defineKeyPressHandler as defineKeyPressHandler_alias_1 }
428
+
429
+ /**
430
+ * @public
431
+ */
432
+ declare function defineMarkAttr(options: MarkAttrOptions): Extension;
433
+ export { defineMarkAttr }
434
+ export { defineMarkAttr as defineMarkAttr_alias_1 }
435
+
436
+ /**
437
+ * @public
438
+ */
439
+ declare function defineMarkSpec<Mark extends string>(options: MarkSpecOptions<Mark>): Extension<{
440
+ MARKS: Mark;
441
+ }>;
442
+ export { defineMarkSpec }
443
+ export { defineMarkSpec as defineMarkSpec_alias_1 }
444
+
445
+ /**
446
+ * Registers a event handler that is called when the editor view is mounted.
447
+ *
448
+ * @public
449
+ */
450
+ declare function defineMountHandler(handler: MountHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
451
+ export { defineMountHandler }
452
+ export { defineMountHandler as defineMountHandler_alias_1 }
453
+
454
+ /**
455
+ * Defines an attribute for a node type.
456
+ *
457
+ * @public
458
+ */
459
+ declare function defineNodeAttr(options: NodeAttrOptions): Extension;
460
+ export { defineNodeAttr }
461
+ export { defineNodeAttr as defineNodeAttr_alias_1 }
462
+
463
+ /**
464
+ * Defines a node type.
465
+ *
466
+ * @public
467
+ */
468
+ declare function defineNodeSpec<NodeName extends string>(options: NodeSpecOptions<NodeName>): Extension<{
469
+ NODES: NodeName;
470
+ }>;
471
+ export { defineNodeSpec }
472
+ export { defineNodeSpec as defineNodeSpec_alias_1 }
473
+
474
+ declare function defineNodeView(options: NodeViewOptions): Extension;
475
+ export { defineNodeView }
476
+ export { defineNodeView as defineNodeView_alias_1 }
477
+
478
+ /**
479
+ * @internal
480
+ */
481
+ declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): Extension;
482
+ export { defineNodeViewFactory }
483
+ export { defineNodeViewFactory as defineNodeViewFactory_alias_1 }
484
+
485
+ /**
486
+ * @public
487
+ *
488
+ * Defines a paragraph node spec as the highest priority, because it should be the default block node for most cases.
489
+ */
490
+ declare function defineParagraph(): Extension< {
491
+ NODES: "paragraph";
492
+ }>;
493
+ export { defineParagraph }
494
+ export { defineParagraph as defineParagraph_alias_1 }
495
+
496
+ /**
497
+ * @public
498
+ *
499
+ * Defines a paragraph node spec.
500
+ */
501
+ export declare function defineParagraphSpec(): Extension< {
502
+ NODES: "paragraph";
503
+ }>;
504
+
505
+ /**
506
+ * @public
507
+ *
508
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
509
+ */
510
+ declare function definePasteHandler(handler: PasteHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
511
+ export { definePasteHandler }
512
+ export { definePasteHandler as definePasteHandler_alias_1 }
513
+
514
+ /**
515
+ * Adds a ProseMirror plugin to the editor.
516
+ *
517
+ * @param plugin - The ProseMirror plugin to add, or an array of plugins, or a
518
+ * function that returns one or multiple plugins.
519
+ *
520
+ * @public
521
+ */
522
+ declare function definePlugin(plugin: Plugin_2 | Plugin_2[] | ((context: {
523
+ schema: Schema;
524
+ }) => Plugin_2 | Plugin_2[])): Extension;
525
+ export { definePlugin }
526
+ export { definePlugin as definePlugin_alias_1 }
527
+
528
+ /**
529
+ * @public
530
+ *
531
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
532
+ */
533
+ declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
534
+ export { defineScrollToSelectionHandler }
535
+ export { defineScrollToSelectionHandler as defineScrollToSelectionHandler_alias_1 }
536
+
537
+ /**
538
+ * @public
539
+ */
540
+ declare function defineText(): Extension< {
541
+ NODES: "text";
542
+ }>;
543
+ export { defineText }
544
+ export { defineText as defineText_alias_1 }
545
+
546
+ /**
547
+ * @public
548
+ *
549
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
550
+ */
551
+ declare function defineTextInputHandler(handler: TextInputHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
552
+ export { defineTextInputHandler }
553
+ export { defineTextInputHandler as defineTextInputHandler_alias_1 }
554
+
555
+ /**
556
+ * @public
557
+ *
558
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
559
+ */
560
+ declare function defineTripleClickHandler(handler: TripleClickHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
561
+ export { defineTripleClickHandler }
562
+ export { defineTripleClickHandler as defineTripleClickHandler_alias_1 }
563
+
564
+ /**
565
+ * @public
566
+ *
567
+ * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
568
+ */
569
+ declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
570
+ export { defineTripleClickOnHandler }
571
+ export { defineTripleClickOnHandler as defineTripleClickOnHandler_alias_1 }
572
+
573
+ /**
574
+ * Registers a event handler that is called when the editor view is unmounted.
575
+ *
576
+ * @public
577
+ */
578
+ declare function defineUnmountHandler(handler: UnmountHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
579
+ export { defineUnmountHandler }
580
+ export { defineUnmountHandler as defineUnmountHandler_alias_1 }
581
+
582
+ /**
583
+ * Registers a event handler that is called when the editor state is updated.
584
+ *
585
+ * @public
586
+ */
587
+ declare function defineUpdateHandler(handler: UpdateHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
588
+ export { defineUpdateHandler }
589
+ export { defineUpdateHandler as defineUpdateHandler_alias_1 }
590
+
591
+ /**
592
+ * A function that is called when the editor document is changed.
593
+ *
594
+ * @param view - The editor view.
595
+ * @param prevState - The previous editor state.
596
+ *
597
+ * @public
598
+ */
599
+ declare type DocChangeHandler = (view: EditorView, prevState: EditorState) => void;
600
+ export { DocChangeHandler }
601
+ export { DocChangeHandler as DocChangeHandler_alias_1 }
602
+
603
+ /**
604
+ * @internal
605
+ */
606
+ export declare class DOMDocumentNotFoundError extends ProseKitError {
607
+ constructor();
608
+ }
609
+
610
+ /** @public */
611
+ declare type DOMDocumentOptions = {
612
+ document?: Document;
613
+ };
614
+ export { DOMDocumentOptions }
615
+ export { DOMDocumentOptions as DOMDocumentOptions_alias_1 }
616
+
617
+ /**
618
+ * @internal
619
+ */
620
+ export declare const domEventFacet: Facet<DOMEventPayload, PluginPayload>;
621
+
622
+ /**
623
+ * A function to handle the events fired on the editable DOM element. Returns
624
+ * `true` to indicate that it handled the given event. you are responsible for
625
+ * calling `preventDefault` yourself (or not, if you want to allow the default
626
+ * behavior).
627
+ *
628
+ * @public
629
+ */
630
+ declare type DOMEventHandler<Event extends keyof DOMEventMap = string> = (view: EditorView, event: DOMEventMap[Event]) => boolean | void;
631
+ export { DOMEventHandler }
632
+ export { DOMEventHandler as DOMEventHandler_alias_1 }
633
+
634
+ /**
635
+ * @internal
636
+ */
637
+ export declare type DOMEventPayload = [event: string, handler: DOMEventHandler];
638
+
639
+ export declare type DOMNode = InstanceType<typeof window.Node>;
640
+
641
+ /** @public */
642
+ declare type DOMParserOptions = {
643
+ DOMParser?: typeof DOMParser_2;
644
+ };
645
+ export { DOMParserOptions }
646
+ export { DOMParserOptions as DOMParserOptions_alias_1 }
647
+
648
+ /** @public */
649
+ declare type DOMSerializerOptions = {
650
+ DOMSerializer?: typeof DOMSerializer;
651
+ };
652
+ export { DOMSerializerOptions }
653
+ export { DOMSerializerOptions as DOMSerializerOptions_alias_1 }
654
+
655
+ declare type DoubleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
656
+ export { DoubleClickHandler }
657
+ export { DoubleClickHandler as DoubleClickHandler_alias_1 }
658
+
659
+ declare type DoubleClickOnHandler = (view: EditorView, pos: number, node: Node_3, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
660
+ export { DoubleClickOnHandler }
661
+ export { DoubleClickOnHandler as DoubleClickOnHandler_alias_1 }
662
+
663
+ declare type DropHandler = (view: EditorView, event: DragEvent, slice: Slice, moved: boolean) => boolean | void;
664
+ export { DropHandler }
665
+ export { DropHandler as DropHandler_alias_1 }
666
+
667
+ /**
668
+ * @public
669
+ */
670
+ declare class Editor<E extends Extension = any> {
671
+ private instance;
672
+ private constructor();
673
+ private afterMounted;
674
+ /**
675
+ * @internal
676
+ */
677
+ static create(instance: any): Editor<any>;
678
+ /**
679
+ * Whether the editor is mounted.
680
+ */
681
+ get mounted(): boolean;
682
+ /**
683
+ * The editor view.
684
+ */
685
+ get view(): EditorView;
686
+ /**
687
+ * The editor schema.
688
+ */
689
+ get schema(): Schema<ExtractNodes<E>, ExtractMarks<E>>;
690
+ get commands(): ExtractCommandAppliers<E>;
691
+ /**
692
+ * Whether the editor is focused.
693
+ */
694
+ get focused(): boolean;
695
+ /**
696
+ * Mount the editor to the given HTML element.
697
+ * Pass `null` or `undefined` to unmount the editor.
698
+ */
699
+ mount(place: HTMLElement | null | undefined): void;
700
+ /**
701
+ * Unmount the editor. This is equivalent to `mount(null)`.
702
+ */
703
+ unmount(): void;
704
+ /**
705
+ * Focus the editor.
706
+ */
707
+ focus(): void;
708
+ /**
709
+ * Blur the editor.
710
+ */
711
+ blur(): void;
712
+ use(extension: Extension): VoidFunction;
713
+ get state(): EditorState;
714
+ get nodes(): Record<ExtractNodes<E>, NodeBuilder>;
715
+ get marks(): Record<ExtractMarks<E>, MarkBuilder>;
716
+ }
717
+ export { Editor }
718
+ export { Editor as Editor_alias_1 }
719
+
720
+ /**
721
+ * @internal
722
+ */
723
+ declare class EditorNotFoundError extends ProseKitError {
724
+ constructor();
725
+ }
726
+ export { EditorNotFoundError }
727
+ export { EditorNotFoundError as EditorNotFoundError_alias_1 }
728
+
729
+ /**
730
+ * @public
731
+ */
732
+ declare interface EditorOptions<E extends Extension> {
733
+ /**
734
+ * The extension to use when creating the editor.
735
+ */
736
+ extension: E;
737
+ /**
738
+ * A JSON object representing the starting document to use when creating the
739
+ * editor.
740
+ */
741
+ defaultDoc?: NodeJSON;
742
+ /**
743
+ * A HTML element or a HTML string representing the starting document to use
744
+ * when creating the editor.
745
+ */
746
+ defaultHTML?: string | HTMLElement;
747
+ /**
748
+ * A JSON object representing the starting selection to use when creating the
749
+ * editor. It's only used when `defaultDoc` or `defaultHTML` is also provided.
750
+ */
751
+ defaultSelection?: SelectionJSON;
752
+ }
753
+ export { EditorOptions }
754
+ export { EditorOptions as EditorOptions_alias_1 }
755
+
756
+ /**
757
+ * Parse a HTML string to a HTML element.
758
+ *
759
+ * @internal
760
+ */
761
+ export declare function elementFromHTML(html: string, options?: DOMDocumentOptions): HTMLElement;
762
+
763
+ /**
764
+ * Parse a ProseMirror document JSON object to a HTML element.
765
+ *
766
+ * @public
767
+ */
768
+ declare function elementFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
769
+ export { elementFromJSON }
770
+ export { elementFromJSON as elementFromJSON_alias_1 }
771
+
772
+ /**
773
+ * Serialize a ProseMirror node to a HTML element.
774
+ *
775
+ * @public
776
+ */
777
+ declare function elementFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
778
+ export { elementFromNode }
779
+ export { elementFromNode as elementFromNode_alias_1 }
780
+
781
+ declare type EmptyValue = undefined | null | EmptyObject;
782
+
783
+ export declare type ExceptEmptyValue<T> = ConditionalExcept<T, EmptyValue>;
784
+
785
+ /**
786
+ * Expands the selection to include the entire mark at the current position.
787
+ *
788
+ * @public
789
+ */
790
+ declare function expandMark(options: {
791
+ /**
792
+ * The type of the mark to expand.
793
+ */
794
+ type: string | MarkType;
795
+ }): Command;
796
+ export { expandMark }
797
+ export { expandMark as expandMark_alias_1 }
798
+
799
+ /**
800
+ * @public
801
+ */
802
+ declare interface Extension<T extends ExtensionTyping = ExtensionTyping> {
803
+ extension: Extension | Extension[];
804
+ priority?: Priority;
805
+ _type?: T;
806
+ /**
807
+ * @public
808
+ *
809
+ * The schema that this extension represents.
810
+ */
811
+ schema: Schema | null;
812
+ }
813
+ export { Extension }
814
+ export { Extension as Extension_alias_1 }
815
+
816
+ /**
817
+ * @internal
818
+ */
819
+ declare interface ExtensionTyping<Node extends string = string, Mark extends string = string, Commands extends CommandArgs = CommandArgs> {
820
+ NODES?: Node;
821
+ MARKS?: Mark;
822
+ COMMAND_ARGS?: Commands;
823
+ }
824
+ export { ExtensionTyping }
825
+ export { ExtensionTyping as ExtensionTyping_alias_1 }
826
+
827
+ /**
828
+ * @public
829
+ */
830
+ declare type ExtractCommandAppliers<E extends Extension> = ToCommandApplier<ExtractCommandArgs<E>>;
831
+ export { ExtractCommandAppliers }
832
+ export { ExtractCommandAppliers as ExtractCommandAppliers_alias_1 }
833
+
834
+ /**
835
+ * @internal
836
+ */
837
+ export declare type ExtractCommandArgs<E extends Extension> = ExtractCommandArgsFromTyping<ExtractTyping<E>>;
838
+
839
+ export declare type ExtractCommandArgsFromTyping<T extends ExtensionTyping> = ExtractKey<T, 'COMMAND_ARGS'>;
840
+
841
+ /**
842
+ * @public
843
+ */
844
+ declare type ExtractCommandCreators<E extends Extension> = ToCommandCreators<ExtractCommandArgs<E>>;
845
+ export { ExtractCommandCreators }
846
+ export { ExtractCommandCreators as ExtractCommandCreators_alias_1 }
847
+
848
+ /**
849
+ * @intneral
850
+ */
851
+ export declare type ExtractKey<T, K extends string> = Extract<T, Record<K, any>>[K];
852
+
853
+ /**
854
+ * @public
855
+ */
856
+ declare type ExtractMarks<E extends Extension> = ExtractMarksFromTyping<ExtractTyping<E>>;
857
+ export { ExtractMarks }
858
+ export { ExtractMarks as ExtractMarks_alias_1 }
859
+
860
+ export declare type ExtractMarksFromTyping<T extends ExtensionTyping> = ExtractKey<T, 'MARKS'>;
861
+
862
+ /**
863
+ * @public
864
+ */
865
+ declare type ExtractNodes<E extends Extension> = ExtractNodesFromTyping<ExtractTyping<E>>;
866
+ export { ExtractNodes }
867
+ export { ExtractNodes as ExtractNodes_alias_1 }
868
+
869
+ export declare type ExtractNodesFromTyping<T extends ExtensionTyping> = ExtractKey<T, 'NODES'>;
870
+
871
+ /**
872
+ * @internal
873
+ */
874
+ export declare type ExtractTyping<E extends Extension> = E extends Extension<infer T> ? T : never;
875
+
876
+ /**
877
+ * @public
878
+ */
879
+ declare class Facet<Input, Output> {
880
+ /**
881
+ * @internal
882
+ */
883
+ readonly index: number;
884
+ /**
885
+ * @internal
886
+ */
887
+ readonly converter: () => FacetConverter<Input, Output>;
888
+ /**
889
+ * @internal
890
+ */
891
+ readonly next: Facet<Output, any> | null;
892
+ /**
893
+ * @internal
894
+ */
895
+ readonly singleton: boolean;
896
+ /**
897
+ * @internal
898
+ */
899
+ isSchema: boolean;
900
+ private constructor();
901
+ static define<Input, Output>({ converter, convert, next, singleton, }: FacetOptions<Input, Output>): Facet<Input, Output>;
902
+ /**
903
+ * @internal
904
+ */
905
+ static defineRootFacet<Input>(options: Omit<FacetOptions<Input, Input>, 'next'>): Facet<Input, Input>;
906
+ extension(payloads: Input[]): Extension;
907
+ }
908
+ export { Facet }
909
+ export { Facet as Facet_alias_1 }
910
+
911
+ /**
912
+ * @public
913
+ */
914
+ export declare interface FacetConverter<Input = any, Output = any> {
915
+ create: (inputs: Input[]) => Output;
916
+ update: (inputs: Input[]) => Output | null;
917
+ }
918
+
919
+ /**
920
+ * @public
921
+ */
922
+ export declare class FacetExtensionImpl<Input, Output> extends BaseExtension {
923
+ readonly facet: Facet<Input, Output>;
924
+ readonly payloads: Input[];
925
+ extension: Extension;
926
+ hasSchema: boolean;
927
+ schema: null;
928
+ constructor(facet: Facet<Input, Output>, payloads: Input[]);
929
+ }
930
+
931
+ /**
932
+ * @public
933
+ */
934
+ declare interface FacetOptions<Input, Output> {
935
+ convert?: (payloads: Input[]) => Output;
936
+ converter?: () => FacetConverter<Input, Output>;
937
+ next: Facet<Output, any>;
938
+ singleton?: boolean;
939
+ }
940
+ export { FacetOptions }
941
+ export { FacetOptions as FacetOptions_alias_1 }
942
+
943
+ export declare function findBrowserDocument(options?: {
944
+ document?: Document;
945
+ }): Document | undefined;
946
+
947
+ export declare function findBrowserWindow(options?: {
948
+ document?: Document;
949
+ }): (Window & typeof globalThis) | null | undefined;
950
+
951
+ /**
952
+ * A function that is called when the editor gains or loses focus.
953
+ *
954
+ * @param hasFocus - Whether the editor has focus.
955
+ *
956
+ * @public
957
+ */
958
+ declare type FocusChangeHandler = (hasFocus: boolean) => void;
959
+ export { FocusChangeHandler }
960
+ export { FocusChangeHandler as FocusChangeHandler_alias_1 }
961
+
962
+ export declare function getBrowserDocument(options?: {
963
+ document?: Document;
964
+ }): Document;
965
+
966
+ export declare function getBrowserWindow(options?: {
967
+ document?: Document;
968
+ }): Window & typeof globalThis;
969
+
970
+ export declare function getCustomSelection(state: EditorState, from?: number | null, to?: number | null): Selection_3;
971
+
972
+ export declare function getFacetCount(): number;
973
+
974
+ /**
975
+ * Returns a unique id in the current process that can be used in various places.
976
+ *
977
+ * @internal
978
+ */
979
+ declare function getId(): string;
980
+ export { getId as _getId }
981
+ export { getId }
982
+
983
+ /**
984
+ * @internal
985
+ */
986
+ declare function getMarkType(schema: Schema, type: string | MarkType): MarkType;
987
+ export { getMarkType }
988
+ export { getMarkType as getMarkType_alias_1 }
989
+
990
+ /**
991
+ * @internal
992
+ */
993
+ declare function getNodeType(schema: Schema, type: string | NodeType): NodeType;
994
+ export { getNodeType }
995
+ export { getNodeType as getNodeType_alias_1 }
996
+
997
+ export declare type GroupedEntries<T extends Record<string, any>> = {
998
+ [K in keyof T]?: T[K][];
999
+ };
1000
+
1001
+ export declare function groupEntries<T extends Record<string, any>>(entries: ObjectEntries<T>[]): GroupedEntries<T>;
1002
+
1003
+ /**
1004
+ * @internal
1005
+ */
1006
+ export declare function htmlFromElement(element: HTMLElement): string;
1007
+
1008
+ /**
1009
+ * Parse a ProseMirror document JSON object to a HTML string.
1010
+ *
1011
+ * @public
1012
+ */
1013
+ declare function htmlFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): string;
1014
+ export { htmlFromJSON }
1015
+ export { htmlFromJSON as htmlFromJSON_alias_1 }
1016
+
1017
+ /**
1018
+ * Serialize a ProseMirror node to a HTML string
1019
+ *
1020
+ * @public
1021
+ */
1022
+ declare function htmlFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): string;
1023
+ export { htmlFromNode }
1024
+ export { htmlFromNode as htmlFromNode_alias_1 }
1025
+
1026
+ /**
1027
+ * Returns a command that inserts the given node at the current selection or at
1028
+ * the given position.
1029
+ *
1030
+ * @public
1031
+ */
1032
+ declare function insertNode(options: {
1033
+ node: ProseMirrorNode;
1034
+ pos?: number;
1035
+ type?: undefined;
1036
+ attrs?: undefined;
1037
+ } | {
1038
+ node?: undefined;
1039
+ pos?: number;
1040
+ type: string;
1041
+ attrs?: Attrs;
1042
+ }): Command;
1043
+ export { insertNode }
1044
+ export { insertNode as insertNode_alias_1 }
1045
+
1046
+ export declare function insertNodeAction({ node, pos, }: {
1047
+ node: ProseMirrorNode;
1048
+ pos?: number;
1049
+ }): Action;
1050
+
1051
+ /**
1052
+ * Returns a command that inserts the given text.
1053
+ *
1054
+ * @public
1055
+ */
1056
+ export declare function insertText({ text, from, to, }: {
1057
+ text: string;
1058
+ from?: number;
1059
+ to?: number;
1060
+ }): Command;
1061
+
1062
+ /**
1063
+ * @internal
1064
+ */
1065
+ declare function isAllSelection(sel: Selection_2): sel is AllSelection;
1066
+ export { isAllSelection }
1067
+ export { isAllSelection as isAllSelection_alias_1 }
1068
+
1069
+ export declare function isElement(value: unknown): value is Element;
1070
+
1071
+ /**
1072
+ * Check if the selection is in a code block.
1073
+ *
1074
+ * @internal
1075
+ */
1076
+ declare function isInCodeBlock(selection: Selection_2): boolean | undefined;
1077
+ export { isInCodeBlock }
1078
+ export { isInCodeBlock as isInCodeBlock_alias_1 }
1079
+
1080
+ export declare const isMac: boolean;
1081
+
1082
+ /**
1083
+ * @internal
1084
+ */
1085
+ declare function isMark(mark: unknown): mark is Mark;
1086
+ export { isMark }
1087
+ export { isMark as isMark_alias_1 }
1088
+
1089
+ /**
1090
+ * @internal
1091
+ */
1092
+ export declare function isMarkActive(state: EditorState, type: string | MarkType, attrs?: Attrs | null): boolean;
1093
+
1094
+ export declare function isNodeActive(state: EditorState, type: string | NodeType, attrs?: Attrs | null): boolean;
1095
+
1096
+ /**
1097
+ * @internal
1098
+ */
1099
+ declare function isNodeSelection(sel: Selection_2): sel is NodeSelection;
1100
+ export { isNodeSelection }
1101
+ export { isNodeSelection as isNodeSelection_alias_1 }
1102
+
1103
+ export declare function isNotNull<T>(value: T | null | undefined): value is T;
1104
+
1105
+ /**
1106
+ * @internal
1107
+ */
1108
+ declare function isProseMirrorNode(node: unknown): node is ProseMirrorNode;
1109
+ export { isProseMirrorNode }
1110
+ export { isProseMirrorNode as isProseMirrorNode_alias_1 }
1111
+
1112
+ /**
1113
+ * @internal
1114
+ */
1115
+ declare function isTextSelection(sel: Selection_2): sel is TextSelection;
1116
+ export { isTextSelection }
1117
+ export { isTextSelection as isTextSelection_alias_1 }
1118
+
1119
+ /**
1120
+ * Serialize a HTML element to a ProseMirror document JSON object.
1121
+ *
1122
+ * @public
1123
+ */
1124
+ export declare function jsonFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): NodeJSON;
1125
+
1126
+ /**
1127
+ * Parse a HTML string to a ProseMirror document JSON object.
1128
+ *
1129
+ * @public
1130
+ */
1131
+ declare function jsonFromHTML(html: string, options: DOMDocumentOptions & DOMParserOptions & JSONParserOptions): NodeJSON;
1132
+ export { jsonFromHTML }
1133
+ export { jsonFromHTML as jsonFromHTML_alias_1 }
1134
+
1135
+ /**
1136
+ * Return a JSON object representing this node.
1137
+ *
1138
+ * @public
1139
+ */
1140
+ declare function jsonFromNode(node: ProseMirrorNode): NodeJSON;
1141
+ export { jsonFromNode }
1142
+ export { jsonFromNode as jsonFromNode_alias_1 }
1143
+
1144
+ /**
1145
+ * Return a JSON object representing this state.
1146
+ *
1147
+ * @public
1148
+ */
1149
+ declare function jsonFromState(state: EditorState): StateJSON;
1150
+ export { jsonFromState }
1151
+ export { jsonFromState as jsonFromState_alias_1 }
1152
+
1153
+ /** @public */
1154
+ declare type JSONParserOptions = {
1155
+ schema: Schema;
1156
+ };
1157
+ export { JSONParserOptions }
1158
+ export { JSONParserOptions as JSONParserOptions_alias_1 }
1159
+
1160
+ declare type KeyDownHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
1161
+ export { KeyDownHandler }
1162
+ export { KeyDownHandler as KeyDownHandler_alias_1 }
1163
+
1164
+ /**
1165
+ * @public
1166
+ */
1167
+ declare interface Keymap {
1168
+ [key: string]: Command;
1169
+ }
1170
+ export { Keymap }
1171
+ export { Keymap as Keymap_alias_1 }
1172
+
1173
+ /**
1174
+ * @internal
1175
+ */
1176
+ declare const keymapFacet: Facet<Keymap, PluginPayload>;
1177
+ export { keymapFacet }
1178
+ export { keymapFacet as keymapFacet_alias_1 }
1179
+
1180
+ /**
1181
+ * @internal
1182
+ */
1183
+ declare type KeymapPayload = Keymap;
1184
+ export { KeymapPayload }
1185
+ export { KeymapPayload as KeymapPayload_alias_1 }
1186
+
1187
+ declare type KeyPressHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
1188
+ export { KeyPressHandler }
1189
+ export { KeyPressHandler as KeyPressHandler_alias_1 }
1190
+
1191
+ /**
1192
+ * @public
1193
+ */
1194
+ declare interface MarkAttrOptions {
1195
+ /**
1196
+ * The name of the mark type.
1197
+ */
1198
+ type: string;
1199
+ /**
1200
+ * The name of the attribute.
1201
+ */
1202
+ attr: string;
1203
+ /**
1204
+ * The default value for this attribute, to use when no explicit value is
1205
+ * provided. Attributes that have no default must be provided whenever a mark
1206
+ * of a type that has them is created.
1207
+ */
1208
+ default?: any;
1209
+ /**
1210
+ * Returns the attribute key and value to be set on the DOM node.
1211
+ */
1212
+ toDOM?: (value: any) => [key: string, value: string] | null | void;
1213
+ /**
1214
+ * Parses the attribute value from the DOM.
1215
+ */
1216
+ parseDOM?: (node: HTMLElement) => any;
1217
+ }
1218
+ export { MarkAttrOptions }
1219
+ export { MarkAttrOptions as MarkAttrOptions_alias_1 }
1220
+
1221
+ export declare interface MarkBuilder {
1222
+ (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode[];
1223
+ (...children: NodeChild[]): ProseMirrorNode[];
1224
+ isActive(attrs?: Attrs): boolean;
1225
+ }
1226
+
1227
+ /**
1228
+ * @public
1229
+ */
1230
+ declare interface MarkSpecOptions<MarkName extends string = string> extends MarkSpec {
1231
+ name: MarkName;
1232
+ }
1233
+ export { MarkSpecOptions }
1234
+ export { MarkSpecOptions as MarkSpecOptions_alias_1 }
1235
+
1236
+ /**
1237
+ * A function that is called when the editor view is mounted.
1238
+ *
1239
+ * @param view - The editor view.
1240
+ *
1241
+ * @public
1242
+ */
1243
+ declare type MountHandler = (view: EditorView) => void;
1244
+ export { MountHandler }
1245
+ export { MountHandler as MountHandler_alias_1 }
1246
+
1247
+ /**
1248
+ * @public
1249
+ */
1250
+ declare interface NodeAttrOptions {
1251
+ /**
1252
+ * The name of the node type.
1253
+ */
1254
+ type: string;
1255
+ /**
1256
+ * The name of the attribute.
1257
+ */
1258
+ attr: string;
1259
+ /**
1260
+ * The default value for this attribute, to use when no explicit value is
1261
+ * provided. Attributes that have no default must be provided whenever a node
1262
+ * of a type that has them is created.
1263
+ */
1264
+ default?: any;
1265
+ /**
1266
+ * Returns the attribute key and value to be set on the DOM node.
1267
+ */
1268
+ toDOM?: (value: any) => [key: string, value: string] | null | void;
1269
+ /**
1270
+ * Parses the attribute value from the DOM.
1271
+ */
1272
+ parseDOM?: (node: HTMLElement) => any;
1273
+ }
1274
+ export { NodeAttrOptions }
1275
+ export { NodeAttrOptions as NodeAttrOptions_alias_1 }
1276
+
1277
+ export declare interface NodeBuilder {
1278
+ (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode;
1279
+ (...children: NodeChild[]): ProseMirrorNode;
1280
+ isActive(attrs?: Attrs): boolean;
1281
+ }
1282
+
1283
+ export declare type NodeChild = ProseMirrorNode | string | NodeChild[];
1284
+
1285
+ export declare type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
1286
+
1287
+ /**
1288
+ * Parse a HTML element to a ProseMirror node.
1289
+ *
1290
+ * @public
1291
+ */
1292
+ declare function nodeFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): ProseMirrorNode;
1293
+ export { nodeFromElement }
1294
+ export { nodeFromElement as nodeFromElement_alias_1 }
1295
+
1296
+ /**
1297
+ * Parse a HTML string to a ProseMirror node.
1298
+ *
1299
+ * @public
1300
+ */
1301
+ declare function nodeFromHTML(html: string, options: DOMParserOptions & JSONParserOptions & DOMDocumentOptions): ProseMirrorNode;
1302
+ export { nodeFromHTML }
1303
+ export { nodeFromHTML as nodeFromHTML_alias_1 }
1304
+
1305
+ /**
1306
+ * Parse a JSON object to a ProseMirror node.
1307
+ *
1308
+ * @public
1309
+ */
1310
+ declare function nodeFromJSON(json: NodeJSON, options: JSONParserOptions): ProseMirrorNode;
1311
+ export { nodeFromJSON }
1312
+ export { nodeFromJSON as nodeFromJSON_alias_1 }
1313
+
1314
+ /**
1315
+ * A JSON representation of the prosemirror node.
1316
+ *
1317
+ * @public
1318
+ */
1319
+ declare interface NodeJSON {
1320
+ type: string;
1321
+ marks?: Array<any>;
1322
+ text?: string;
1323
+ content?: NodeJSON[];
1324
+ attrs?: Record<string, any>;
1325
+ }
1326
+ export { NodeJSON }
1327
+ export { NodeJSON as NodeJSON_alias_1 }
1328
+
1329
+ /**
1330
+ * @public
1331
+ */
1332
+ declare interface NodeSpecOptions<NodeName extends string = string> extends NodeSpec {
1333
+ name: NodeName;
1334
+ topNode?: boolean;
1335
+ }
1336
+ export { NodeSpecOptions }
1337
+ export { NodeSpecOptions as NodeSpecOptions_alias_1 }
1338
+
1339
+ /**
1340
+ * @internal
1341
+ */
1342
+ declare type NodeViewFactoryOptions<T> = {
1343
+ group: string;
1344
+ name: string;
1345
+ args: T;
1346
+ } | {
1347
+ group: string;
1348
+ name?: undefined;
1349
+ factory: (args: T) => NodeViewConstructor;
1350
+ };
1351
+ export { NodeViewFactoryOptions }
1352
+ export { NodeViewFactoryOptions as NodeViewFactoryOptions_alias_1 }
1353
+
1354
+ declare interface NodeViewOptions {
1355
+ name: string;
1356
+ constructor: NodeViewConstructor;
1357
+ }
1358
+ export { NodeViewOptions }
1359
+ export { NodeViewOptions as NodeViewOptions_alias_1 }
1360
+
1361
+ /**
1362
+ * @internal
1363
+ */
1364
+ declare const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
1365
+ export { OBJECT_REPLACEMENT_CHARACTER }
1366
+ export { OBJECT_REPLACEMENT_CHARACTER as OBJECT_REPLACEMENT_CHARACTER_alias_1 }
1367
+
1368
+ /**
1369
+ * @internal
1370
+ *
1371
+ * @example
1372
+ *
1373
+ * ```
1374
+ * type MyObject = { a: 1; b: 'B' }
1375
+ * type MyEntries = ObjectEntries<MyObject>
1376
+ * // ^ ["a", 1] | ["b", "B"]
1377
+ *
1378
+ */
1379
+ export declare type ObjectEntries<T extends Record<string, any>> = {
1380
+ [K in keyof T]: [K, T[K]];
1381
+ }[keyof T];
1382
+
1383
+ export declare function objectEqual<T>(a: T, b: T): boolean;
1384
+
1385
+ declare type PasteHandler = (view: EditorView, event: ClipboardEvent, slice: Slice) => boolean | void;
1386
+ export { PasteHandler }
1387
+ export { PasteHandler as PasteHandler_alias_1 }
1388
+
1389
+ declare type Payload = unknown;
1390
+
1391
+ export declare type Payloads = PayloadTuple[];
1392
+
1393
+ declare type PayloadTuple = Tuple5<Payload[]>;
1394
+
1395
+ /**
1396
+ * @internal
1397
+ */
1398
+ declare const pluginFacet: Facet<PluginPayload, StatePayload>;
1399
+ export { pluginFacet }
1400
+ export { pluginFacet as pluginFacet_alias_1 }
1401
+
1402
+ /**
1403
+ * @internal
1404
+ */
1405
+ declare type PluginPayload = (context: {
1406
+ schema: Schema;
1407
+ }) => Plugin_2 | Plugin_2[];
1408
+ export { PluginPayload }
1409
+ export { PluginPayload as PluginPayload_alias_1 }
1410
+
1411
+ /**
1412
+ * ProseKit extension priority.
1413
+ *
1414
+ * @public
1415
+ */
1416
+ declare const enum Priority {
1417
+ lowest = 4,
1418
+ low = 3,
1419
+ default = 2,
1420
+ high = 1,
1421
+ highest = 0
1422
+ }
1423
+ export { Priority }
1424
+ export { Priority as Priority_alias_1 }
1425
+
1426
+ /**
1427
+ * Base class for all ProseKit errors.
1428
+ *
1429
+ * @internal
1430
+ */
1431
+ declare class ProseKitError extends Error {
1432
+ }
1433
+ export { ProseKitError }
1434
+ export { ProseKitError as ProseKitError_alias_1 }
1435
+
1436
+ /**
1437
+ * Returns a command that removes the given mark.
1438
+ *
1439
+ * @public
1440
+ */
1441
+ declare function removeMark(options: {
1442
+ /**
1443
+ * The type of the mark to remove.
1444
+ */
1445
+ type: string | MarkType;
1446
+ /**
1447
+ * If attrs is given, remove precisely the mark with the given attrs. Otherwise, remove all marks of the given type.
1448
+ */
1449
+ attrs?: Attrs | null;
1450
+ /**
1451
+ * The start position of the document. By default it will be the start position of current selection.
1452
+ */
1453
+ from?: number;
1454
+ /**
1455
+ * The end position of the document. By default it will be the end position of current selection.
1456
+ */
1457
+ to?: number;
1458
+ }): Command;
1459
+ export { removeMark }
1460
+ export { removeMark as removeMark_alias_1 }
1461
+
1462
+ export declare const schemaFacet: Facet<SchemaPayload, SchemaPayload>;
1463
+
1464
+ export declare type SchemaPayload = SchemaSpec;
1465
+
1466
+ declare type ScrollToSelectionHandler = (view: EditorView) => boolean;
1467
+ export { ScrollToSelectionHandler }
1468
+ export { ScrollToSelectionHandler as ScrollToSelectionHandler_alias_1 }
1469
+
1470
+ /**
1471
+ * Returns a command that selects the whole document.
1472
+ *
1473
+ * @public
1474
+ */
1475
+ export declare function selectAll(): Command;
1476
+
1477
+ /**
1478
+ * A JSON representation of the prosemirror selection.
1479
+ *
1480
+ * @public
1481
+ */
1482
+ declare interface SelectionJSON {
1483
+ anchor: number;
1484
+ head: number;
1485
+ type: string;
1486
+ }
1487
+ export { SelectionJSON }
1488
+ export { SelectionJSON as SelectionJSON_alias_1 }
1489
+
1490
+ /**
1491
+ * Returns a command that tries to set the selected textblocks to the given node
1492
+ * type with the given attributes.
1493
+ *
1494
+ * @public
1495
+ */
1496
+ declare function setBlockType(options: {
1497
+ type: NodeType | string;
1498
+ attrs?: Attrs | null;
1499
+ from?: number;
1500
+ to?: number;
1501
+ }): Command;
1502
+ export { setBlockType }
1503
+ export { setBlockType as setBlockType_alias_1 }
1504
+
1505
+ /**
1506
+ * Returns a command that set the attributes of the current node.
1507
+ *
1508
+ * @public
1509
+ */
1510
+ declare function setNodeAttrs(options: {
1511
+ /**
1512
+ * The type of node to set the attributes of.
1513
+ *
1514
+ * If current node is not of this type, the command will do nothing.
1515
+ */
1516
+ type: string | NodeType;
1517
+ /**
1518
+ * The attributes to set.
1519
+ */
1520
+ attrs: Attrs;
1521
+ /**
1522
+ * The position of the node. Defaults to the position of the wrapping node
1523
+ * containing the current selection.
1524
+ */
1525
+ pos?: number;
1526
+ }): Command;
1527
+ export { setNodeAttrs }
1528
+ export { setNodeAttrs as setNodeAttrs_alias_1 }
1529
+
1530
+ export declare function setSelectionAround(tr: Transaction, pos: number): void;
1531
+
1532
+ /**
1533
+ * @internal
1534
+ */
1535
+ export declare type Setter<T> = (value: T) => void;
1536
+
1537
+ /**
1538
+ * @internal
1539
+ */
1540
+ declare type SimplifyExtension<E extends Extension | Extension[]> = E extends Extension[] ? Extension<ExceptEmptyValue<{
1541
+ NODES: ExtractNodes<E[number]>;
1542
+ MARKS: ExtractMarks<E[number]>;
1543
+ COMMAND_ARGS: SimplifyUnion<ExtractCommandArgs<E[number]>>;
1544
+ }>> : E;
1545
+ export { SimplifyExtension }
1546
+ export { SimplifyExtension as SimplifyExtension_alias_1 }
1547
+
1548
+ /**
1549
+ * @intneral
1550
+ */
1551
+ declare type SimplifyUnion<T> = Simplify<UnionToIntersection<T>>;
1552
+ export { SimplifyUnion }
1553
+ export { SimplifyUnion as SimplifyUnion_alias_1 }
1554
+
1555
+ export declare const stateFacet: Facet<StatePayload, StatePayload>;
1556
+
1557
+ /**
1558
+ * Parse a JSON object to a ProseMirror state.
1559
+ *
1560
+ * @public
1561
+ */
1562
+ declare function stateFromJSON(json: StateJSON, options: JSONParserOptions): EditorState;
1563
+ export { stateFromJSON }
1564
+ export { stateFromJSON as stateFromJSON_alias_1 }
1565
+
1566
+ /**
1567
+ * A JSON representation of the prosemirror state.
1568
+ *
1569
+ * @public
1570
+ */
1571
+ declare interface StateJSON {
1572
+ /**
1573
+ * The main `ProseMirror` doc.
1574
+ */
1575
+ doc: NodeJSON;
1576
+ /**
1577
+ * The current selection.
1578
+ */
1579
+ selection: SelectionJSON;
1580
+ }
1581
+ export { StateJSON }
1582
+ export { StateJSON as StateJSON_alias_1 }
1583
+
1584
+ export declare type StatePayload = (ctx: {
1585
+ schema: Schema;
1586
+ }) => EditorStateConfig;
1587
+
1588
+ declare type TextInputHandler = (view: EditorView, from: number, to: number, text: string) => boolean | void;
1589
+ export { TextInputHandler }
1590
+ export { TextInputHandler as TextInputHandler_alias_1 }
1591
+
1592
+ export declare type ToCommandApplier<T extends CommandArgs> = {
1593
+ [K in keyof T]: CommandApplier<T[K]>;
1594
+ };
1595
+
1596
+ export declare type ToCommandArgs<T extends CommandCreators> = {
1597
+ [K in keyof T]: Parameters<T[K]>;
1598
+ };
1599
+
1600
+ export declare type ToCommandCreators<T extends CommandArgs> = {
1601
+ [K in keyof T]: CommandCreator<T[K]>;
1602
+ };
1603
+
1604
+ /**
1605
+ * Returns a command that toggles the given mark with the given attributes.
1606
+ *
1607
+ * @public
1608
+ */
1609
+ declare function toggleMark({ type, attrs, }: {
1610
+ type: string | MarkType;
1611
+ attrs?: Attrs | null;
1612
+ }): Command;
1613
+ export { toggleMark }
1614
+ export { toggleMark as toggleMark_alias_1 }
1615
+
1616
+ /**
1617
+ * Returns a command that set the selected textblocks to the given node type
1618
+ * with the given attributes.
1619
+ *
1620
+ * @public
1621
+ */
1622
+ declare function toggleNode({ type, attrs, }: {
1623
+ type: string | NodeType;
1624
+ attrs?: Attrs | null;
1625
+ }): Command;
1626
+ export { toggleNode }
1627
+ export { toggleNode as toggleNode_alias_1 }
1628
+
1629
+ declare type TripleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
1630
+ export { TripleClickHandler }
1631
+ export { TripleClickHandler as TripleClickHandler_alias_1 }
1632
+
1633
+ declare type TripleClickOnHandler = (view: EditorView, pos: number, node: Node_3, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
1634
+ export { TripleClickOnHandler }
1635
+ export { TripleClickOnHandler as TripleClickOnHandler_alias_1 }
1636
+
1637
+ declare type Tuple5<T> = [T, T, T, T, T];
1638
+
1639
+ /**
1640
+ * Merge multiple extensions into one.
1641
+ *
1642
+ * @public
1643
+ */
1644
+ declare function union<E extends Extension | Extension[]>(extension: E): SimplifyExtension<E>;
1645
+ export { union }
1646
+ export { union as union_alias_1 }
1647
+
1648
+ export declare class UnionExtensionImpl<T extends ExtensionTyping = ExtensionTyping> extends BaseExtension<T> implements Extension<T> {
1649
+ extension: BaseExtension[];
1650
+ private _schema;
1651
+ private hasSchemaCount;
1652
+ constructor(extension?: BaseExtension[]);
1653
+ get hasSchema(): boolean;
1654
+ get schema(): Schema | null;
1655
+ }
1656
+
1657
+ export declare function uniqPush<T>(prev: readonly T[], next: readonly T[]): T[];
1658
+
1659
+ export declare function uniqRemove<T>(prev: T[], next: T[]): T[];
1660
+
1661
+ /**
1662
+ * A function that is called when the editor view is unmounted.
1663
+ *
1664
+ * @public
1665
+ */
1666
+ declare type UnmountHandler = () => void;
1667
+ export { UnmountHandler }
1668
+ export { UnmountHandler as UnmountHandler_alias_1 }
1669
+
1670
+ export declare function updateExtension(prevInputs: Payloads, prevConverters: Converters, extension: Extension, mode: 'add' | 'remove'): {
1671
+ schemaInput: SchemaPayload | null;
1672
+ stateInput: StatePayload | null;
1673
+ viewInput: ViewPayload | null;
1674
+ commandInput: CommandCreators | null;
1675
+ };
1676
+
1677
+ /**
1678
+ * A function that is called when the editor state is updated.
1679
+ *
1680
+ * @param view - The editor view.
1681
+ * @param prevState - The previous editor state.
1682
+ *
1683
+ * @public
1684
+ */
1685
+ declare type UpdateHandler = (view: EditorView, prevState: EditorState) => void;
1686
+ export { UpdateHandler }
1687
+ export { UpdateHandler as UpdateHandler_alias_1 }
1688
+
1689
+ export declare const viewFacet: Facet<ViewPayload, ViewPayload>;
1690
+
1691
+ export declare type ViewPayload = Omit<DirectEditorProps, 'state'>;
1692
+
1693
+ export declare function voidFunction(): void;
1694
+
1695
+ /**
1696
+ * @public
1697
+ */
1698
+ declare function withPriority<T extends Extension>(extension: T, priority: Priority): T;
1699
+ export { withPriority }
1700
+ export { withPriority as withPriority_alias_1 }
1701
+
1702
+ /**
1703
+ * @internal
1704
+ */
1705
+ declare function withSkipCodeBlock(command: Command): Command;
1706
+ export { withSkipCodeBlock }
1707
+ export { withSkipCodeBlock as withSkipCodeBlock_alias_1 }
1708
+
1709
+ /**
1710
+ * Returns a command that wraps the selected textblock with the given node type
1711
+ * with the given attributes.
1712
+ *
1713
+ * @public
1714
+ */
1715
+ export declare function wrap({ nodeType, attrs, }: {
1716
+ nodeType: NodeType;
1717
+ attrs?: Attrs | null;
1718
+ }): Command;
1719
+
1720
+ export { }