@prosekit/core 0.6.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import { Attrs } from '@prosekit/pm/model';
3
3
  import { Attrs as Attrs_2 } from 'prosemirror-model';
4
4
  import { Command } from '@prosekit/pm/state';
5
5
  import type { ContentMatch } from '@prosekit/pm/model';
6
+ import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
6
7
  import type { DirectEditorProps } from '@prosekit/pm/view';
7
8
  import type { DOMEventMap } from '@prosekit/pm/view';
8
9
  import { DOMParser as DOMParser_2 } from '@prosekit/pm/model';
@@ -24,6 +25,7 @@ import { NodeType as NodeType_2 } from 'prosemirror-model';
24
25
  import { NodeView } from '@prosekit/pm/view';
25
26
  import { NodeViewConstructor } from '@prosekit/pm/view';
26
27
  import { Options } from 'tsup';
28
+ import type { ParseOptions } from '@prosekit/pm/model';
27
29
  import { Plugin as Plugin_2 } from '@prosekit/pm/state';
28
30
  import { ProseMirrorFragment } from '@prosekit/pm/model';
29
31
  import { ProseMirrorNode } from '@prosekit/pm/model';
@@ -71,6 +73,13 @@ export { addMark as addMark_alias_1 }
71
73
 
72
74
  export declare function applyAction(operator: Action): Command;
73
75
 
76
+ export declare const applyMarkForTest: ApplyMarkFunction;
77
+
78
+ /**
79
+ * @internal
80
+ */
81
+ export declare type ApplyMarkFunction = (mark: Mark, children: ProseMirrorNode[]) => ProseMirrorNode[];
82
+
74
83
  /**
75
84
  * @internal
76
85
  */
@@ -148,6 +157,8 @@ export declare function baseToggleMark(markType: MarkType, attrs?: Attrs | null,
148
157
  removeWhenPresent: boolean;
149
158
  }): Command;
150
159
 
160
+ export declare function buildNode(type: NodeType, args: [Attrs | NodeChild | null | undefined, ...NodeChild[]], createNode: CreateNodeFunction): ProseMirrorNode;
161
+
151
162
  export declare function cache<T>(fn: () => T): () => T;
152
163
 
153
164
  declare const canUseRegexLookbehind: () => boolean;
@@ -173,7 +184,14 @@ declare const clsx: (...args: Array<string | boolean | null | undefined>) => str
173
184
  export { clsx }
174
185
  export { clsx as clsx_alias_1 }
175
186
 
176
- export declare function collectNodes(content: NodeContent): ProseMirrorNode[];
187
+ /**
188
+ * Collects all nodes from a given content.
189
+ *
190
+ * @public
191
+ */
192
+ declare function collectNodes(content: NodeContent): ProseMirrorNode[];
193
+ export { collectNodes }
194
+ export { collectNodes as collectNodes_alias_1 }
177
195
 
178
196
  export declare function combineEventHandlers<Handler extends (...args: any[]) => boolean | void, Args extends Parameters<Handler> = Parameters<Handler>>(): readonly [(handlers: Handler[]) => void, (...args: Args) => boolean];
179
197
 
@@ -208,19 +226,35 @@ declare function createEditor<E extends Extension>(options: EditorOptions<E>): E
208
226
  export { createEditor }
209
227
  export { createEditor as createEditor_alias_1 }
210
228
 
211
- export declare function createMarkBuilder(getState: () => EditorState | null | undefined, type: MarkType): MarkBuilder;
229
+ /**
230
+ * @internal
231
+ */
232
+ export declare function createMarkBuilders(schema: Schema, getState: () => EditorState | null | undefined, applyMark?: ApplyMarkFunction): Record<string, MarkBuilder>;
212
233
 
213
- export declare function createNodeBuilder(getState: () => EditorState | null | undefined, type: NodeType): NodeBuilder;
234
+ /**
235
+ * @internal
236
+ */
237
+ export declare function createNodeBuilders(schema: Schema, getState: () => EditorState | null | undefined, createNode?: CreateNodeFunction): Record<string, NodeBuilder>;
238
+
239
+ export declare const createNodeForTest: CreateNodeFunction;
240
+
241
+ /**
242
+ * @internal
243
+ */
244
+ export declare type CreateNodeFunction = (type: NodeType, attrs: Attrs | null, children: ProseMirrorNode[]) => ProseMirrorNode;
245
+
246
+ /**
247
+ * @public
248
+ */
249
+ declare function createTestEditor<E extends Extension>(options: EditorOptions<E>): TestEditor<E>;
250
+ export { createTestEditor }
251
+ export { createTestEditor as createTestEditor_alias_1 }
214
252
 
215
253
  export declare function deepEquals<T>(a: T, b: T): boolean;
216
254
 
217
255
  export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
218
256
 
219
- export declare const default_alias_1: {
220
- test: {
221
- environment: "jsdom";
222
- };
223
- };
257
+ export { default_alias_1 }
224
258
 
225
259
  /**
226
260
  * @internal
@@ -323,7 +357,7 @@ declare function defineBaseKeymap(options?: {
323
357
  * @default Priority.low
324
358
  */
325
359
  priority?: Priority;
326
- }): Extension<any>;
360
+ }): Extension<ExtensionTyping<any, any, any>>;
327
361
  export { defineBaseKeymap }
328
362
  export { defineBaseKeymap as defineBaseKeymap_alias_1 }
329
363
 
@@ -332,7 +366,7 @@ export { defineBaseKeymap as defineBaseKeymap_alias_1 }
332
366
  *
333
367
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
334
368
  */
335
- declare function defineClickHandler(handler: ClickHandler): Extension<any>;
369
+ declare function defineClickHandler(handler: ClickHandler): Extension<ExtensionTyping<any, any, any>>;
336
370
  export { defineClickHandler }
337
371
  export { defineClickHandler as defineClickHandler_alias_1 }
338
372
 
@@ -341,7 +375,7 @@ export { defineClickHandler as defineClickHandler_alias_1 }
341
375
  *
342
376
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
343
377
  */
344
- declare function defineClickOnHandler(handler: ClickOnHandler): Extension<any>;
378
+ declare function defineClickOnHandler(handler: ClickOnHandler): Extension<ExtensionTyping<any, any, any>>;
345
379
  export { defineClickOnHandler }
346
380
  export { defineClickOnHandler as defineClickOnHandler_alias_1 }
347
381
 
@@ -375,7 +409,7 @@ export { defineDoc as defineDoc_alias_1 }
375
409
  *
376
410
  * @public
377
411
  */
378
- declare function defineDocChangeHandler(handler: DocChangeHandler): Extension<any>;
412
+ declare function defineDocChangeHandler(handler: DocChangeHandler): Extension<ExtensionTyping<any, any, any>>;
379
413
  export { defineDocChangeHandler }
380
414
  export { defineDocChangeHandler as defineDocChangeHandler_alias_1 }
381
415
 
@@ -384,7 +418,7 @@ export { defineDocChangeHandler as defineDocChangeHandler_alias_1 }
384
418
  *
385
419
  * @public
386
420
  */
387
- declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): Extension<any>;
421
+ declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): Extension<ExtensionTyping<any, any, any>>;
388
422
  export { defineDOMEventHandler }
389
423
  export { defineDOMEventHandler as defineDOMEventHandler_alias_1 }
390
424
 
@@ -393,7 +427,7 @@ export { defineDOMEventHandler as defineDOMEventHandler_alias_1 }
393
427
  *
394
428
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
395
429
  */
396
- declare function defineDoubleClickHandler(handler: DoubleClickHandler): Extension<any>;
430
+ declare function defineDoubleClickHandler(handler: DoubleClickHandler): Extension<ExtensionTyping<any, any, any>>;
397
431
  export { defineDoubleClickHandler }
398
432
  export { defineDoubleClickHandler as defineDoubleClickHandler_alias_1 }
399
433
 
@@ -402,7 +436,7 @@ export { defineDoubleClickHandler as defineDoubleClickHandler_alias_1 }
402
436
  *
403
437
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
404
438
  */
405
- declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): Extension<any>;
439
+ declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): Extension<ExtensionTyping<any, any, any>>;
406
440
  export { defineDoubleClickOnHandler }
407
441
  export { defineDoubleClickOnHandler as defineDoubleClickOnHandler_alias_1 }
408
442
 
@@ -411,7 +445,7 @@ export { defineDoubleClickOnHandler as defineDoubleClickOnHandler_alias_1 }
411
445
  *
412
446
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
413
447
  */
414
- declare function defineDropHandler(handler: DropHandler): Extension<any>;
448
+ declare function defineDropHandler(handler: DropHandler): Extension<ExtensionTyping<any, any, any>>;
415
449
  export { defineDropHandler }
416
450
  export { defineDropHandler as defineDropHandler_alias_1 }
417
451
 
@@ -454,7 +488,7 @@ export { defineFacetPayload as defineFacetPayload_alias_1 }
454
488
  *
455
489
  * @public
456
490
  */
457
- declare function defineFocusChangeHandler(handler: FocusChangeHandler): Extension<any>;
491
+ declare function defineFocusChangeHandler(handler: FocusChangeHandler): Extension<ExtensionTyping<any, any, any>>;
458
492
  export { defineFocusChangeHandler }
459
493
  export { defineFocusChangeHandler as defineFocusChangeHandler_alias_1 }
460
494
 
@@ -477,7 +511,7 @@ export { defineHistory as defineHistory_alias_1 }
477
511
  *
478
512
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
479
513
  */
480
- declare function defineKeyDownHandler(handler: KeyDownHandler): Extension<any>;
514
+ declare function defineKeyDownHandler(handler: KeyDownHandler): Extension<ExtensionTyping<any, any, any>>;
481
515
  export { defineKeyDownHandler }
482
516
  export { defineKeyDownHandler as defineKeyDownHandler_alias_1 }
483
517
 
@@ -493,7 +527,7 @@ export { defineKeymap as defineKeymap_alias_1 }
493
527
  *
494
528
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
495
529
  */
496
- declare function defineKeyPressHandler(handler: KeyPressHandler): Extension<any>;
530
+ declare function defineKeyPressHandler(handler: KeyPressHandler): Extension<ExtensionTyping<any, any, any>>;
497
531
  export { defineKeyPressHandler }
498
532
  export { defineKeyPressHandler as defineKeyPressHandler_alias_1 }
499
533
 
@@ -520,7 +554,7 @@ export { defineMarkSpec as defineMarkSpec_alias_1 }
520
554
  *
521
555
  * @public
522
556
  */
523
- declare function defineMountHandler(handler: MountHandler): Extension<any>;
557
+ declare function defineMountHandler(handler: MountHandler): Extension<ExtensionTyping<any, any, any>>;
524
558
  export { defineMountHandler }
525
559
  export { defineMountHandler as defineMountHandler_alias_1 }
526
560
 
@@ -550,6 +584,13 @@ declare function defineNodeView(options: NodeViewOptions): Extension;
550
584
  export { defineNodeView }
551
585
  export { defineNodeView as defineNodeView_alias_1 }
552
586
 
587
+ /**
588
+ * @internal
589
+ */
590
+ declare function defineNodeViewComponent<T>(options: NodeViewComponentOptions<T>): Extension;
591
+ export { defineNodeViewComponent }
592
+ export { defineNodeViewComponent as defineNodeViewComponent_alias_1 }
593
+
553
594
  /**
554
595
  * @internal
555
596
  */
@@ -586,7 +627,7 @@ Commands: never;
586
627
  *
587
628
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
588
629
  */
589
- declare function definePasteHandler(handler: PasteHandler): Extension<any>;
630
+ declare function definePasteHandler(handler: PasteHandler): Extension<ExtensionTyping<any, any, any>>;
590
631
  export { definePasteHandler }
591
632
  export { definePasteHandler as definePasteHandler_alias_1 }
592
633
 
@@ -609,10 +650,70 @@ export { definePlugin as definePlugin_alias_1 }
609
650
  *
610
651
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
611
652
  */
612
- declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): Extension<any>;
653
+ declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): Extension<ExtensionTyping<any, any, any>>;
613
654
  export { defineScrollToSelectionHandler }
614
655
  export { defineScrollToSelectionHandler as defineScrollToSelectionHandler_alias_1 }
615
656
 
657
+ /**
658
+ * @internal
659
+ */
660
+ export declare function defineTestExtension(): Extension< {
661
+ Nodes: "text" | "doc" | "paragraph";
662
+ Marks: "bold";
663
+ Commands: {
664
+ undo: [];
665
+ redo: [];
666
+ insertText: [{
667
+ text: string;
668
+ from?: number;
669
+ to?: number;
670
+ }];
671
+ insertNode: [options: {
672
+ node: Node_2;
673
+ pos?: number;
674
+ type?: undefined;
675
+ attrs?: undefined;
676
+ } | {
677
+ node?: undefined;
678
+ pos?: number;
679
+ type: string;
680
+ attrs?: Attrs_2;
681
+ }];
682
+ removeNode: [options: {
683
+ type: string | NodeType_2;
684
+ pos?: number;
685
+ }];
686
+ wrap: [{
687
+ nodeType: NodeType_2;
688
+ attrs?: Attrs_2 | null;
689
+ }];
690
+ setBlockType: [options: {
691
+ type: NodeType_2 | string;
692
+ attrs?: Attrs_2 | null;
693
+ from?: number;
694
+ to?: number;
695
+ }];
696
+ setNodeAttrs: [options: {
697
+ type: string | NodeType_2 | string[] | NodeType_2[];
698
+ attrs: Attrs_2;
699
+ pos?: number;
700
+ }];
701
+ selectAll: [];
702
+ addMark: [options: {
703
+ type: string | MarkType_2;
704
+ attrs?: Attrs_2 | null;
705
+ from?: number;
706
+ to?: number;
707
+ }];
708
+ removeMark: [options: {
709
+ type: string | MarkType_2;
710
+ attrs?: Attrs_2 | null;
711
+ from?: number;
712
+ to?: number;
713
+ }];
714
+ };
715
+ }>;
716
+
616
717
  /**
617
718
  * @public
618
719
  */
@@ -629,7 +730,7 @@ export { defineText as defineText_alias_1 }
629
730
  *
630
731
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
631
732
  */
632
- declare function defineTextInputHandler(handler: TextInputHandler): Extension<any>;
733
+ declare function defineTextInputHandler(handler: TextInputHandler): Extension<ExtensionTyping<any, any, any>>;
633
734
  export { defineTextInputHandler }
634
735
  export { defineTextInputHandler as defineTextInputHandler_alias_1 }
635
736
 
@@ -638,7 +739,7 @@ export { defineTextInputHandler as defineTextInputHandler_alias_1 }
638
739
  *
639
740
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
640
741
  */
641
- declare function defineTripleClickHandler(handler: TripleClickHandler): Extension<any>;
742
+ declare function defineTripleClickHandler(handler: TripleClickHandler): Extension<ExtensionTyping<any, any, any>>;
642
743
  export { defineTripleClickHandler }
643
744
  export { defineTripleClickHandler as defineTripleClickHandler_alias_1 }
644
745
 
@@ -647,7 +748,7 @@ export { defineTripleClickHandler as defineTripleClickHandler_alias_1 }
647
748
  *
648
749
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
649
750
  */
650
- declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): Extension<any>;
751
+ declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): Extension<ExtensionTyping<any, any, any>>;
651
752
  export { defineTripleClickOnHandler }
652
753
  export { defineTripleClickOnHandler as defineTripleClickOnHandler_alias_1 }
653
754
 
@@ -656,7 +757,7 @@ export { defineTripleClickOnHandler as defineTripleClickOnHandler_alias_1 }
656
757
  *
657
758
  * @public
658
759
  */
659
- declare function defineUnmountHandler(handler: UnmountHandler): Extension<any>;
760
+ declare function defineUnmountHandler(handler: UnmountHandler): Extension<ExtensionTyping<any, any, any>>;
660
761
  export { defineUnmountHandler }
661
762
  export { defineUnmountHandler as defineUnmountHandler_alias_1 }
662
763
 
@@ -665,7 +766,7 @@ export { defineUnmountHandler as defineUnmountHandler_alias_1 }
665
766
  *
666
767
  * @public
667
768
  */
668
- declare function defineUpdateHandler(handler: UpdateHandler): Extension<any>;
769
+ declare function defineUpdateHandler(handler: UpdateHandler): Extension<ExtensionTyping<any, any, any>>;
669
770
  export { defineUpdateHandler }
670
771
  export { defineUpdateHandler as defineUpdateHandler_alias_1 }
671
772
 
@@ -689,9 +790,9 @@ export declare class DOMDocumentNotFoundError extends ProseKitError {
689
790
  }
690
791
 
691
792
  /** @public */
692
- declare type DOMDocumentOptions = {
793
+ declare interface DOMDocumentOptions {
693
794
  document?: Document;
694
- };
795
+ }
695
796
  export { DOMDocumentOptions }
696
797
  export { DOMDocumentOptions as DOMDocumentOptions_alias_1 }
697
798
 
@@ -720,16 +821,16 @@ export declare type DOMEventPayload = [event: string, handler: DOMEventHandler];
720
821
  export declare type DOMNode = InstanceType<typeof window.Node>;
721
822
 
722
823
  /** @public */
723
- declare type DOMParserOptions = {
824
+ declare interface DOMParserOptions extends ParseOptions {
724
825
  DOMParser?: typeof DOMParser_2;
725
- };
826
+ }
726
827
  export { DOMParserOptions }
727
828
  export { DOMParserOptions as DOMParserOptions_alias_1 }
728
829
 
729
830
  /** @public */
730
- declare type DOMSerializerOptions = {
831
+ declare interface DOMSerializerOptions {
731
832
  DOMSerializer?: typeof DOMSerializer;
732
- };
833
+ }
733
834
  export { DOMSerializerOptions }
734
835
  export { DOMSerializerOptions as DOMSerializerOptions_alias_1 }
735
836
 
@@ -750,8 +851,11 @@ export { DropHandler as DropHandler_alias_1 }
750
851
  */
751
852
  declare class Editor<E extends Extension = any> {
752
853
  private instance;
753
- private constructor();
754
854
  private afterMounted;
855
+ /**
856
+ * @internal
857
+ */
858
+ constructor(instance: EditorInstance);
755
859
  /**
756
860
  * @internal
757
861
  */
@@ -768,6 +872,9 @@ declare class Editor<E extends Extension = any> {
768
872
  * The editor schema.
769
873
  */
770
874
  get schema(): Schema<ExtractNodes<E>, ExtractMarks<E>>;
875
+ /**
876
+ * All commands defined by the editor.
877
+ */
771
878
  get commands(): ExtractCommandAppliers<E>;
772
879
  /**
773
880
  * Whether the editor is focused.
@@ -790,14 +897,55 @@ declare class Editor<E extends Extension = any> {
790
897
  * Blur the editor.
791
898
  */
792
899
  blur(): void;
900
+ /**
901
+ * Register an extension to the editor. Return a function to unregister the
902
+ * extension.
903
+ */
793
904
  use(extension: Extension): VoidFunction;
905
+ /**
906
+ * The editor's current state.
907
+ */
794
908
  get state(): EditorState;
909
+ /**
910
+ * Update the editor's state.
911
+ *
912
+ * @remarks
913
+ *
914
+ * This is an advanced method. Use it only if you have a specific reason to
915
+ * directly manipulate the editor's state.
916
+ */
917
+ updateState(state: EditorState): void;
795
918
  get nodes(): Record<ExtractNodes<E>, NodeBuilder>;
796
919
  get marks(): Record<ExtractMarks<E>, MarkBuilder>;
797
920
  }
798
921
  export { Editor }
799
922
  export { Editor as Editor_alias_1 }
800
923
 
924
+ /**
925
+ * @internal
926
+ */
927
+ export declare class EditorInstance {
928
+ view: EditorView | null;
929
+ schema: Schema;
930
+ nodeBuilders: Record<string, NodeBuilder>;
931
+ markBuilders: Record<string, MarkBuilder>;
932
+ commandAppliers: Record<string, CommandApplier>;
933
+ private tree;
934
+ private directEditorProps;
935
+ constructor(extension: Extension);
936
+ getState: () => EditorState;
937
+ updateState(state: EditorState): void;
938
+ updateExtension(extension: Extension, add: boolean): void;
939
+ mount(place: HTMLElement): void;
940
+ unmount(): void;
941
+ get mounted(): boolean;
942
+ get assertView(): EditorView;
943
+ definePlugins(plugins: readonly Plugin_2[]): void;
944
+ removePlugins(plugins: readonly Plugin_2[]): void;
945
+ defineCommand<Args extends any[] = any[]>(name: string, commandCreator: CommandCreator<Args>): void;
946
+ removeCommand(name: string): void;
947
+ }
948
+
801
949
  /**
802
950
  * @internal
803
951
  */
@@ -876,7 +1024,7 @@ export { expandMark as expandMark_alias_1 }
876
1024
  /**
877
1025
  * @public
878
1026
  */
879
- declare interface Extension<T extends ExtensionTyping<any, any, any> = any> {
1027
+ declare interface Extension<T extends ExtensionTyping<any, any, any> = ExtensionTyping<any, any, any>> {
880
1028
  extension: Extension | Extension[];
881
1029
  priority?: Priority;
882
1030
  _type?: T;
@@ -934,6 +1082,8 @@ declare type ExtractNodes<E extends Extension> = ExtractTyping<E>['Nodes'];
934
1082
  export { ExtractNodes }
935
1083
  export { ExtractNodes as ExtractNodes_alias_1 }
936
1084
 
1085
+ export declare function extractTags(node: TaggedProseMirrorNode): Record<string, number>;
1086
+
937
1087
  /**
938
1088
  * @internal
939
1089
  */
@@ -1244,9 +1394,9 @@ export { jsonFromState }
1244
1394
  export { jsonFromState as jsonFromState_alias_1 }
1245
1395
 
1246
1396
  /** @public */
1247
- declare type JSONParserOptions = {
1397
+ declare interface JSONParserOptions {
1248
1398
  schema: Schema;
1249
- };
1399
+ }
1250
1400
  export { JSONParserOptions }
1251
1401
  export { JSONParserOptions as JSONParserOptions_alias_1 }
1252
1402
 
@@ -1311,11 +1461,16 @@ declare interface MarkAttrOptions {
1311
1461
  export { MarkAttrOptions }
1312
1462
  export { MarkAttrOptions as MarkAttrOptions_alias_1 }
1313
1463
 
1314
- export declare interface MarkBuilder {
1464
+ /**
1465
+ * @public
1466
+ */
1467
+ declare interface MarkBuilder {
1315
1468
  (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode[];
1316
1469
  (...children: NodeChild[]): ProseMirrorNode[];
1317
- isActive(attrs?: Attrs): boolean;
1470
+ isActive: (attrs?: Attrs) => boolean;
1318
1471
  }
1472
+ export { MarkBuilder }
1473
+ export { MarkBuilder as MarkBuilder_alias_1 }
1319
1474
 
1320
1475
  /**
1321
1476
  * @public
@@ -1385,15 +1540,28 @@ declare interface NodeAttrOptions {
1385
1540
  export { NodeAttrOptions }
1386
1541
  export { NodeAttrOptions as NodeAttrOptions_alias_1 }
1387
1542
 
1388
- export declare interface NodeBuilder {
1543
+ /**
1544
+ * @public
1545
+ */
1546
+ declare interface NodeBuilder {
1389
1547
  (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode;
1390
1548
  (...children: NodeChild[]): ProseMirrorNode;
1391
- isActive(attrs?: Attrs): boolean;
1549
+ isActive: (attrs?: Attrs) => boolean;
1392
1550
  }
1551
+ export { NodeBuilder }
1552
+ export { NodeBuilder as NodeBuilder_alias_1 }
1393
1553
 
1554
+ /**
1555
+ * @public
1556
+ */
1394
1557
  export declare type NodeChild = ProseMirrorNode | string | NodeChild[];
1395
1558
 
1396
- export declare type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
1559
+ /**
1560
+ * @public
1561
+ */
1562
+ declare type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
1563
+ export { NodeContent }
1564
+ export { NodeContent as NodeContent_alias_1 }
1397
1565
 
1398
1566
  /**
1399
1567
  * Parse a HTML element to a ProseMirror node.
@@ -1450,13 +1618,19 @@ export { NodeSpecOptions as NodeSpecOptions_alias_1 }
1450
1618
  /**
1451
1619
  * @internal
1452
1620
  */
1453
- declare type NodeViewFactoryOptions<T> = {
1621
+ declare type NodeViewComponentOptions<T> = {
1454
1622
  group: string;
1455
1623
  name: string;
1456
1624
  args: T;
1457
- } | {
1625
+ };
1626
+ export { NodeViewComponentOptions }
1627
+ export { NodeViewComponentOptions as NodeViewComponentOptions_alias_1 }
1628
+
1629
+ /**
1630
+ * @internal
1631
+ */
1632
+ declare type NodeViewFactoryOptions<T> = {
1458
1633
  group: string;
1459
- name?: undefined;
1460
1634
  factory: (args: T) => NodeViewConstructor;
1461
1635
  };
1462
1636
  export { NodeViewFactoryOptions }
@@ -1692,6 +1866,11 @@ export declare function setSelectionAround(tr: Transaction, pos: number): void;
1692
1866
  */
1693
1867
  export declare type Setter<T> = (value: T) => void;
1694
1868
 
1869
+ /**
1870
+ * @internal
1871
+ */
1872
+ export declare function setupEditorExtension<E extends Extension>(options: EditorOptions<E>): E;
1873
+
1695
1874
  /**
1696
1875
  * @internal
1697
1876
  */
@@ -1732,6 +1911,21 @@ export declare type StatePayload = (ctx: {
1732
1911
  schema: Schema;
1733
1912
  }) => EditorStateConfig;
1734
1913
 
1914
+ /**
1915
+ * A JSON representation of the prosemirror step.
1916
+ *
1917
+ * @public
1918
+ */
1919
+ declare interface StepJSON {
1920
+ /**
1921
+ * The type of the step.
1922
+ */
1923
+ stepType: string;
1924
+ [x: string]: unknown;
1925
+ }
1926
+ export { StepJSON }
1927
+ export { StepJSON as StepJSON_alias_1 }
1928
+
1735
1929
  /**
1736
1930
  * Takes two facet nodes and returns a new facet node containing inputs and
1737
1931
  * children from the first node but not the second.
@@ -1742,6 +1936,37 @@ export declare type StatePayload = (ctx: {
1742
1936
  */
1743
1937
  export declare function subtractFacetNode<I, O>(a: FacetNode<I, O>, b: FacetNode<I, O>): FacetNode<I, O>;
1744
1938
 
1939
+ export declare type TaggedProseMirrorNode = ProseMirrorNode & {
1940
+ tags?: Tags;
1941
+ };
1942
+
1943
+ declare type Tags = Record<string, number>;
1944
+
1945
+ /**
1946
+ * An editor for testing purposes.
1947
+ * @public
1948
+ */
1949
+ declare class TestEditor<E extends Extension = Extension> extends Editor<E> {
1950
+ constructor(instance: EditorInstance);
1951
+ /**
1952
+ * Set the editor state to the given document. You can use special tokens
1953
+ * `<a>` and `<b>` to set the anchor and head positions of the selection.
1954
+ *
1955
+ * @example
1956
+ *
1957
+ * ```ts
1958
+ * const editor = createTestEditor({ extension })
1959
+ * const n = editor.nodes
1960
+ * const doc = n.doc(n.paragraph('<a>Hello<b> world!'))
1961
+ * editor.set(doc) // "Hello" is selected.
1962
+ * ```
1963
+ */
1964
+ set(doc: ProseMirrorNode): void;
1965
+ dispatchEvent(event: Event): void;
1966
+ }
1967
+ export { TestEditor }
1968
+ export { TestEditor as TestEditor_alias_1 }
1969
+
1745
1970
  declare type TextInputHandler = (view: EditorView, from: number, to: number, text: string) => boolean | void;
1746
1971
  export { TextInputHandler }
1747
1972
  export { TextInputHandler as TextInputHandler_alias_1 }
@@ -1799,6 +2024,17 @@ export declare type Tuple5<T> = [T, T, T, T, T];
1799
2024
  *
1800
2025
  * @throws If no extensions are provided.
1801
2026
  *
2027
+ * @example
2028
+ *
2029
+ * ```ts
2030
+ * function defineFancyNodes() {
2031
+ * return union([
2032
+ * defineFancyParagraph(),
2033
+ * defineFancyHeading(),
2034
+ * ])
2035
+ * }
2036
+ * ```
2037
+ *
1802
2038
  * @public
1803
2039
  */
1804
2040
  declare function union<const E extends Extension | readonly Extension[]>(extension: E): UnionExtension<E>;
@@ -1870,6 +2106,15 @@ export declare type ViewPayload = Omit<DirectEditorProps, 'state'>;
1870
2106
  export declare function voidFunction(): void;
1871
2107
 
1872
2108
  /**
2109
+ * Return an new extension with the given priority.
2110
+ *
2111
+ * @example
2112
+ * ```ts
2113
+ * import { Priority, withPriority } from 'prosekit/core'
2114
+ *
2115
+ * const extension = withPriority(defineMyExtension(), Priority.high)
2116
+ * ```
2117
+ *
1873
2118
  * @public
1874
2119
  */
1875
2120
  declare function withPriority<T extends Extension>(extension: T, priority: Priority): T;