@prosekit/core 0.0.0-next-20240622120010 → 0.0.0-next-20240626133927

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';
@@ -71,6 +72,13 @@ export { addMark as addMark_alias_1 }
71
72
 
72
73
  export declare function applyAction(operator: Action): Command;
73
74
 
75
+ export declare const applyMarkForTest: ApplyMarkFunction;
76
+
77
+ /**
78
+ * @internal
79
+ */
80
+ export declare type ApplyMarkFunction = (mark: Mark, children: ProseMirrorNode[]) => ProseMirrorNode[];
81
+
74
82
  /**
75
83
  * @internal
76
84
  */
@@ -148,6 +156,8 @@ export declare function baseToggleMark(markType: MarkType, attrs?: Attrs | null,
148
156
  removeWhenPresent: boolean;
149
157
  }): Command;
150
158
 
159
+ export declare function buildNode(type: NodeType, args: [Attrs | NodeChild | null | undefined, ...NodeChild[]], createNode: CreateNodeFunction): ProseMirrorNode;
160
+
151
161
  export declare function cache<T>(fn: () => T): () => T;
152
162
 
153
163
  declare const canUseRegexLookbehind: () => boolean;
@@ -208,19 +218,35 @@ declare function createEditor<E extends Extension>(options: EditorOptions<E>): E
208
218
  export { createEditor }
209
219
  export { createEditor as createEditor_alias_1 }
210
220
 
211
- export declare function createMarkBuilder(getState: () => EditorState | null | undefined, type: MarkType): MarkBuilder;
221
+ /**
222
+ * @internal
223
+ */
224
+ export declare function createMarkBuilders(schema: Schema, getState: () => EditorState | null | undefined, applyMark?: ApplyMarkFunction): Record<string, MarkBuilder>;
225
+
226
+ /**
227
+ * @internal
228
+ */
229
+ export declare function createNodeBuilders(schema: Schema, getState: () => EditorState | null | undefined, createNode?: CreateNodeFunction): Record<string, NodeBuilder>;
230
+
231
+ export declare const createNodeForTest: CreateNodeFunction;
212
232
 
213
- export declare function createNodeBuilder(getState: () => EditorState | null | undefined, type: NodeType): NodeBuilder;
233
+ /**
234
+ * @internal
235
+ */
236
+ export declare type CreateNodeFunction = (type: NodeType, attrs: Attrs | null, children: ProseMirrorNode[]) => ProseMirrorNode;
237
+
238
+ /**
239
+ * @public
240
+ */
241
+ declare function createTestEditor<E extends Extension>(options: EditorOptions<E>): TestEditor<E>;
242
+ export { createTestEditor }
243
+ export { createTestEditor as createTestEditor_alias_1 }
214
244
 
215
245
  export declare function deepEquals<T>(a: T, b: T): boolean;
216
246
 
217
247
  export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
218
248
 
219
- export declare const default_alias_1: {
220
- test: {
221
- environment: "jsdom";
222
- };
223
- };
249
+ export { default_alias_1 }
224
250
 
225
251
  /**
226
252
  * @internal
@@ -323,7 +349,7 @@ declare function defineBaseKeymap(options?: {
323
349
  * @default Priority.low
324
350
  */
325
351
  priority?: Priority;
326
- }): Extension<any>;
352
+ }): Extension<ExtensionTyping<any, any, any>>;
327
353
  export { defineBaseKeymap }
328
354
  export { defineBaseKeymap as defineBaseKeymap_alias_1 }
329
355
 
@@ -332,7 +358,7 @@ export { defineBaseKeymap as defineBaseKeymap_alias_1 }
332
358
  *
333
359
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
334
360
  */
335
- declare function defineClickHandler(handler: ClickHandler): Extension<any>;
361
+ declare function defineClickHandler(handler: ClickHandler): Extension<ExtensionTyping<any, any, any>>;
336
362
  export { defineClickHandler }
337
363
  export { defineClickHandler as defineClickHandler_alias_1 }
338
364
 
@@ -341,7 +367,7 @@ export { defineClickHandler as defineClickHandler_alias_1 }
341
367
  *
342
368
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
343
369
  */
344
- declare function defineClickOnHandler(handler: ClickOnHandler): Extension<any>;
370
+ declare function defineClickOnHandler(handler: ClickOnHandler): Extension<ExtensionTyping<any, any, any>>;
345
371
  export { defineClickOnHandler }
346
372
  export { defineClickOnHandler as defineClickOnHandler_alias_1 }
347
373
 
@@ -375,7 +401,7 @@ export { defineDoc as defineDoc_alias_1 }
375
401
  *
376
402
  * @public
377
403
  */
378
- declare function defineDocChangeHandler(handler: DocChangeHandler): Extension<any>;
404
+ declare function defineDocChangeHandler(handler: DocChangeHandler): Extension<ExtensionTyping<any, any, any>>;
379
405
  export { defineDocChangeHandler }
380
406
  export { defineDocChangeHandler as defineDocChangeHandler_alias_1 }
381
407
 
@@ -384,7 +410,7 @@ export { defineDocChangeHandler as defineDocChangeHandler_alias_1 }
384
410
  *
385
411
  * @public
386
412
  */
387
- declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): Extension<any>;
413
+ declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): Extension<ExtensionTyping<any, any, any>>;
388
414
  export { defineDOMEventHandler }
389
415
  export { defineDOMEventHandler as defineDOMEventHandler_alias_1 }
390
416
 
@@ -393,7 +419,7 @@ export { defineDOMEventHandler as defineDOMEventHandler_alias_1 }
393
419
  *
394
420
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
395
421
  */
396
- declare function defineDoubleClickHandler(handler: DoubleClickHandler): Extension<any>;
422
+ declare function defineDoubleClickHandler(handler: DoubleClickHandler): Extension<ExtensionTyping<any, any, any>>;
397
423
  export { defineDoubleClickHandler }
398
424
  export { defineDoubleClickHandler as defineDoubleClickHandler_alias_1 }
399
425
 
@@ -402,7 +428,7 @@ export { defineDoubleClickHandler as defineDoubleClickHandler_alias_1 }
402
428
  *
403
429
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
404
430
  */
405
- declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): Extension<any>;
431
+ declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): Extension<ExtensionTyping<any, any, any>>;
406
432
  export { defineDoubleClickOnHandler }
407
433
  export { defineDoubleClickOnHandler as defineDoubleClickOnHandler_alias_1 }
408
434
 
@@ -411,7 +437,7 @@ export { defineDoubleClickOnHandler as defineDoubleClickOnHandler_alias_1 }
411
437
  *
412
438
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
413
439
  */
414
- declare function defineDropHandler(handler: DropHandler): Extension<any>;
440
+ declare function defineDropHandler(handler: DropHandler): Extension<ExtensionTyping<any, any, any>>;
415
441
  export { defineDropHandler }
416
442
  export { defineDropHandler as defineDropHandler_alias_1 }
417
443
 
@@ -454,7 +480,7 @@ export { defineFacetPayload as defineFacetPayload_alias_1 }
454
480
  *
455
481
  * @public
456
482
  */
457
- declare function defineFocusChangeHandler(handler: FocusChangeHandler): Extension<any>;
483
+ declare function defineFocusChangeHandler(handler: FocusChangeHandler): Extension<ExtensionTyping<any, any, any>>;
458
484
  export { defineFocusChangeHandler }
459
485
  export { defineFocusChangeHandler as defineFocusChangeHandler_alias_1 }
460
486
 
@@ -462,10 +488,11 @@ export { defineFocusChangeHandler as defineFocusChangeHandler_alias_1 }
462
488
  * Add undo/redo history to the editor.
463
489
  */
464
490
  declare function defineHistory(): Extension< {
465
- Nodes: any;
466
- Marks: any;
491
+ Nodes: never;
492
+ Marks: never;
467
493
  Commands: {
468
- [x: string]: any;
494
+ undo: [];
495
+ redo: [];
469
496
  };
470
497
  }>;
471
498
  export { defineHistory }
@@ -476,7 +503,7 @@ export { defineHistory as defineHistory_alias_1 }
476
503
  *
477
504
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
478
505
  */
479
- declare function defineKeyDownHandler(handler: KeyDownHandler): Extension<any>;
506
+ declare function defineKeyDownHandler(handler: KeyDownHandler): Extension<ExtensionTyping<any, any, any>>;
480
507
  export { defineKeyDownHandler }
481
508
  export { defineKeyDownHandler as defineKeyDownHandler_alias_1 }
482
509
 
@@ -492,7 +519,7 @@ export { defineKeymap as defineKeymap_alias_1 }
492
519
  *
493
520
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
494
521
  */
495
- declare function defineKeyPressHandler(handler: KeyPressHandler): Extension<any>;
522
+ declare function defineKeyPressHandler(handler: KeyPressHandler): Extension<ExtensionTyping<any, any, any>>;
496
523
  export { defineKeyPressHandler }
497
524
  export { defineKeyPressHandler as defineKeyPressHandler_alias_1 }
498
525
 
@@ -519,7 +546,7 @@ export { defineMarkSpec as defineMarkSpec_alias_1 }
519
546
  *
520
547
  * @public
521
548
  */
522
- declare function defineMountHandler(handler: MountHandler): Extension<any>;
549
+ declare function defineMountHandler(handler: MountHandler): Extension<ExtensionTyping<any, any, any>>;
523
550
  export { defineMountHandler }
524
551
  export { defineMountHandler as defineMountHandler_alias_1 }
525
552
 
@@ -585,7 +612,7 @@ Commands: never;
585
612
  *
586
613
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
587
614
  */
588
- declare function definePasteHandler(handler: PasteHandler): Extension<any>;
615
+ declare function definePasteHandler(handler: PasteHandler): Extension<ExtensionTyping<any, any, any>>;
589
616
  export { definePasteHandler }
590
617
  export { definePasteHandler as definePasteHandler_alias_1 }
591
618
 
@@ -608,10 +635,70 @@ export { definePlugin as definePlugin_alias_1 }
608
635
  *
609
636
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
610
637
  */
611
- declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): Extension<any>;
638
+ declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): Extension<ExtensionTyping<any, any, any>>;
612
639
  export { defineScrollToSelectionHandler }
613
640
  export { defineScrollToSelectionHandler as defineScrollToSelectionHandler_alias_1 }
614
641
 
642
+ /**
643
+ * @internal
644
+ */
645
+ export declare function defineTestExtension(): Extension< {
646
+ Nodes: "text" | "doc" | "paragraph";
647
+ Marks: "bold";
648
+ Commands: {
649
+ undo: [];
650
+ redo: [];
651
+ insertText: [{
652
+ text: string;
653
+ from?: number;
654
+ to?: number;
655
+ }];
656
+ insertNode: [options: {
657
+ node: Node_2;
658
+ pos?: number;
659
+ type?: undefined;
660
+ attrs?: undefined;
661
+ } | {
662
+ node?: undefined;
663
+ pos?: number;
664
+ type: string;
665
+ attrs?: Attrs_2;
666
+ }];
667
+ removeNode: [options: {
668
+ type: string | NodeType_2;
669
+ pos?: number;
670
+ }];
671
+ wrap: [{
672
+ nodeType: NodeType_2;
673
+ attrs?: Attrs_2 | null;
674
+ }];
675
+ setBlockType: [options: {
676
+ type: NodeType_2 | string;
677
+ attrs?: Attrs_2 | null;
678
+ from?: number;
679
+ to?: number;
680
+ }];
681
+ setNodeAttrs: [options: {
682
+ type: string | NodeType_2 | string[] | NodeType_2[];
683
+ attrs: Attrs_2;
684
+ pos?: number;
685
+ }];
686
+ selectAll: [];
687
+ addMark: [options: {
688
+ type: string | MarkType_2;
689
+ attrs?: Attrs_2 | null;
690
+ from?: number;
691
+ to?: number;
692
+ }];
693
+ removeMark: [options: {
694
+ type: string | MarkType_2;
695
+ attrs?: Attrs_2 | null;
696
+ from?: number;
697
+ to?: number;
698
+ }];
699
+ };
700
+ }>;
701
+
615
702
  /**
616
703
  * @public
617
704
  */
@@ -628,7 +715,7 @@ export { defineText as defineText_alias_1 }
628
715
  *
629
716
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
630
717
  */
631
- declare function defineTextInputHandler(handler: TextInputHandler): Extension<any>;
718
+ declare function defineTextInputHandler(handler: TextInputHandler): Extension<ExtensionTyping<any, any, any>>;
632
719
  export { defineTextInputHandler }
633
720
  export { defineTextInputHandler as defineTextInputHandler_alias_1 }
634
721
 
@@ -637,7 +724,7 @@ export { defineTextInputHandler as defineTextInputHandler_alias_1 }
637
724
  *
638
725
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
639
726
  */
640
- declare function defineTripleClickHandler(handler: TripleClickHandler): Extension<any>;
727
+ declare function defineTripleClickHandler(handler: TripleClickHandler): Extension<ExtensionTyping<any, any, any>>;
641
728
  export { defineTripleClickHandler }
642
729
  export { defineTripleClickHandler as defineTripleClickHandler_alias_1 }
643
730
 
@@ -646,7 +733,7 @@ export { defineTripleClickHandler as defineTripleClickHandler_alias_1 }
646
733
  *
647
734
  * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
648
735
  */
649
- declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): Extension<any>;
736
+ declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): Extension<ExtensionTyping<any, any, any>>;
650
737
  export { defineTripleClickOnHandler }
651
738
  export { defineTripleClickOnHandler as defineTripleClickOnHandler_alias_1 }
652
739
 
@@ -655,7 +742,7 @@ export { defineTripleClickOnHandler as defineTripleClickOnHandler_alias_1 }
655
742
  *
656
743
  * @public
657
744
  */
658
- declare function defineUnmountHandler(handler: UnmountHandler): Extension<any>;
745
+ declare function defineUnmountHandler(handler: UnmountHandler): Extension<ExtensionTyping<any, any, any>>;
659
746
  export { defineUnmountHandler }
660
747
  export { defineUnmountHandler as defineUnmountHandler_alias_1 }
661
748
 
@@ -664,7 +751,7 @@ export { defineUnmountHandler as defineUnmountHandler_alias_1 }
664
751
  *
665
752
  * @public
666
753
  */
667
- declare function defineUpdateHandler(handler: UpdateHandler): Extension<any>;
754
+ declare function defineUpdateHandler(handler: UpdateHandler): Extension<ExtensionTyping<any, any, any>>;
668
755
  export { defineUpdateHandler }
669
756
  export { defineUpdateHandler as defineUpdateHandler_alias_1 }
670
757
 
@@ -749,8 +836,11 @@ export { DropHandler as DropHandler_alias_1 }
749
836
  */
750
837
  declare class Editor<E extends Extension = any> {
751
838
  private instance;
752
- private constructor();
753
839
  private afterMounted;
840
+ /**
841
+ * @internal
842
+ */
843
+ constructor(instance: EditorInstance);
754
844
  /**
755
845
  * @internal
756
846
  */
@@ -767,6 +857,9 @@ declare class Editor<E extends Extension = any> {
767
857
  * The editor schema.
768
858
  */
769
859
  get schema(): Schema<ExtractNodes<E>, ExtractMarks<E>>;
860
+ /**
861
+ * All commands defined by the editor.
862
+ */
770
863
  get commands(): ExtractCommandAppliers<E>;
771
864
  /**
772
865
  * Whether the editor is focused.
@@ -789,14 +882,55 @@ declare class Editor<E extends Extension = any> {
789
882
  * Blur the editor.
790
883
  */
791
884
  blur(): void;
885
+ /**
886
+ * Register an extension to the editor. Return a function to unregister the
887
+ * extension.
888
+ */
792
889
  use(extension: Extension): VoidFunction;
890
+ /**
891
+ * The editor's current state.
892
+ */
793
893
  get state(): EditorState;
894
+ /**
895
+ * Update the editor's state.
896
+ *
897
+ * @remarks
898
+ *
899
+ * This is an advanced method. Use it only if you have a specific reason to
900
+ * directly manipulate the editor's state.
901
+ */
902
+ updateState(state: EditorState): void;
794
903
  get nodes(): Record<ExtractNodes<E>, NodeBuilder>;
795
904
  get marks(): Record<ExtractMarks<E>, MarkBuilder>;
796
905
  }
797
906
  export { Editor }
798
907
  export { Editor as Editor_alias_1 }
799
908
 
909
+ /**
910
+ * @internal
911
+ */
912
+ export declare class EditorInstance {
913
+ view: EditorView | null;
914
+ schema: Schema;
915
+ nodeBuilders: Record<string, NodeBuilder>;
916
+ markBuilders: Record<string, MarkBuilder>;
917
+ commandAppliers: Record<string, CommandApplier>;
918
+ private tree;
919
+ private directEditorProps;
920
+ constructor(extension: Extension);
921
+ getState: () => EditorState;
922
+ updateState(state: EditorState): void;
923
+ updateExtension(extension: Extension, add: boolean): void;
924
+ mount(place: HTMLElement): void;
925
+ unmount(): void;
926
+ get mounted(): boolean;
927
+ get assertView(): EditorView;
928
+ definePlugins(plugins: readonly Plugin_2[]): void;
929
+ removePlugins(plugins: readonly Plugin_2[]): void;
930
+ defineCommand<Args extends any[] = any[]>(name: string, commandCreator: CommandCreator<Args>): void;
931
+ removeCommand(name: string): void;
932
+ }
933
+
800
934
  /**
801
935
  * @internal
802
936
  */
@@ -875,7 +1009,7 @@ export { expandMark as expandMark_alias_1 }
875
1009
  /**
876
1010
  * @public
877
1011
  */
878
- declare interface Extension<T extends ExtensionTyping<any, any, any> = any> {
1012
+ declare interface Extension<T extends ExtensionTyping<any, any, any> = ExtensionTyping<any, any, any>> {
879
1013
  extension: Extension | Extension[];
880
1014
  priority?: Priority;
881
1015
  _type?: T;
@@ -933,10 +1067,12 @@ declare type ExtractNodes<E extends Extension> = ExtractTyping<E>['Nodes'];
933
1067
  export { ExtractNodes }
934
1068
  export { ExtractNodes as ExtractNodes_alias_1 }
935
1069
 
1070
+ export declare function extractTags(node: TaggedProseMirrorNode): Record<string, number>;
1071
+
936
1072
  /**
937
1073
  * @internal
938
1074
  */
939
- export declare type ExtractTyping<E extends Extension> = E extends Extension<infer T> ? T : never;
1075
+ export declare type ExtractTyping<E extends Extension> = E extends Extension<ExtensionTyping<infer N, infer M, infer C>> ? ExtensionTyping<PickStringLiteral<N>, PickStringLiteral<M>, PickKnownCommandTyping<C>> : never;
940
1076
 
941
1077
  /**
942
1078
  * @internal
@@ -1310,11 +1446,16 @@ declare interface MarkAttrOptions {
1310
1446
  export { MarkAttrOptions }
1311
1447
  export { MarkAttrOptions as MarkAttrOptions_alias_1 }
1312
1448
 
1313
- export declare interface MarkBuilder {
1449
+ /**
1450
+ * @public
1451
+ */
1452
+ declare interface MarkBuilder {
1314
1453
  (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode[];
1315
1454
  (...children: NodeChild[]): ProseMirrorNode[];
1316
- isActive(attrs?: Attrs): boolean;
1455
+ isActive: (attrs?: Attrs) => boolean;
1317
1456
  }
1457
+ export { MarkBuilder }
1458
+ export { MarkBuilder as MarkBuilder_alias_1 }
1318
1459
 
1319
1460
  /**
1320
1461
  * @public
@@ -1384,12 +1525,20 @@ declare interface NodeAttrOptions {
1384
1525
  export { NodeAttrOptions }
1385
1526
  export { NodeAttrOptions as NodeAttrOptions_alias_1 }
1386
1527
 
1387
- export declare interface NodeBuilder {
1528
+ /**
1529
+ * @public
1530
+ */
1531
+ declare interface NodeBuilder {
1388
1532
  (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode;
1389
1533
  (...children: NodeChild[]): ProseMirrorNode;
1390
- isActive(attrs?: Attrs): boolean;
1534
+ isActive: (attrs?: Attrs) => boolean;
1391
1535
  }
1536
+ export { NodeBuilder }
1537
+ export { NodeBuilder as NodeBuilder_alias_1 }
1392
1538
 
1539
+ /**
1540
+ * @public
1541
+ */
1393
1542
  export declare type NodeChild = ProseMirrorNode | string | NodeChild[];
1394
1543
 
1395
1544
  export declare type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
@@ -1501,6 +1650,18 @@ export { PasteHandler as PasteHandler_alias_1 }
1501
1650
  */
1502
1651
  export declare type Payloads<T> = Tuple5<T[]>;
1503
1652
 
1653
+ /**
1654
+ * @internal
1655
+ */
1656
+ export declare type PickKnownCommandTyping<T extends CommandTyping> = [
1657
+ CommandTyping
1658
+ ] extends [T] ? never : T;
1659
+
1660
+ /**
1661
+ * @internal
1662
+ */
1663
+ export declare type PickStringLiteral<T extends string> = [string] extends [T] ? never : T;
1664
+
1504
1665
  /**
1505
1666
  * @internal
1506
1667
  */
@@ -1679,6 +1840,11 @@ export declare function setSelectionAround(tr: Transaction, pos: number): void;
1679
1840
  */
1680
1841
  export declare type Setter<T> = (value: T) => void;
1681
1842
 
1843
+ /**
1844
+ * @internal
1845
+ */
1846
+ export declare function setupEditorExtension<E extends Extension>(options: EditorOptions<E>): E;
1847
+
1682
1848
  /**
1683
1849
  * @internal
1684
1850
  */
@@ -1729,6 +1895,37 @@ export declare type StatePayload = (ctx: {
1729
1895
  */
1730
1896
  export declare function subtractFacetNode<I, O>(a: FacetNode<I, O>, b: FacetNode<I, O>): FacetNode<I, O>;
1731
1897
 
1898
+ export declare type TaggedProseMirrorNode = ProseMirrorNode & {
1899
+ tags?: Tags;
1900
+ };
1901
+
1902
+ declare type Tags = Record<string, number>;
1903
+
1904
+ /**
1905
+ * An editor for testing purposes.
1906
+ * @public
1907
+ */
1908
+ declare class TestEditor<E extends Extension = Extension> extends Editor<E> {
1909
+ constructor(instance: EditorInstance);
1910
+ /**
1911
+ * Set the editor state to the given document. You can use special tokens
1912
+ * `<a>` and `<b>` to set the anchor and head positions of the selection.
1913
+ *
1914
+ * @example
1915
+ *
1916
+ * ```ts
1917
+ * const editor = createTestEditor({ extension })
1918
+ * const n = editor.nodes
1919
+ * const doc = n.doc(n.paragraph('<a>Hello<b> world!'))
1920
+ * editor.set(doc) // "Hello" is selected.
1921
+ * ```
1922
+ */
1923
+ set(doc: ProseMirrorNode): void;
1924
+ dispatchEvent(event: Event): void;
1925
+ }
1926
+ export { TestEditor }
1927
+ export { TestEditor as TestEditor_alias_1 }
1928
+
1732
1929
  declare type TextInputHandler = (view: EditorView, from: number, to: number, text: string) => boolean | void;
1733
1930
  export { TextInputHandler }
1734
1931
  export { TextInputHandler as TextInputHandler_alias_1 }
@@ -1788,14 +1985,14 @@ export declare type Tuple5<T> = [T, T, T, T, T];
1788
1985
  *
1789
1986
  * @public
1790
1987
  */
1791
- declare function union<E extends Extension | Extension[]>(extension: E): UnionExtension<E>;
1988
+ declare function union<const E extends Extension | readonly Extension[]>(extension: E): UnionExtension<E>;
1792
1989
  export { union }
1793
1990
  export { union as union_alias_1 }
1794
1991
 
1795
1992
  /**
1796
1993
  * @internal
1797
1994
  */
1798
- declare type UnionExtension<E extends Extension | Extension[]> = E extends Extension[] ? Extension<{
1995
+ declare type UnionExtension<E extends Extension | readonly Extension[]> = E extends readonly Extension[] ? Extension<{
1799
1996
  Nodes: ExtractNodes<E[number]>;
1800
1997
  Marks: ExtractMarks<E[number]>;
1801
1998
  Commands: ExtractCommands<E[number]>;