@prosekit/extensions 0.0.0-next-20231120040948 → 0.0.0-next-20240427133255

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.
Files changed (39) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +560 -91
  2. package/dist/chunk-ASTUC4KT.js +111 -0
  3. package/dist/chunk-DYFRBXUX.js +56 -0
  4. package/dist/list/style.css +17 -12
  5. package/dist/prosekit-extensions-autocomplete.js +8 -4
  6. package/dist/prosekit-extensions-blockquote.d.ts +1 -0
  7. package/dist/prosekit-extensions-blockquote.js +12 -1
  8. package/dist/prosekit-extensions-code-block.d.ts +14 -4
  9. package/dist/prosekit-extensions-code-block.js +171 -75
  10. package/dist/prosekit-extensions-drop-cursor.d.ts +2 -0
  11. package/dist/prosekit-extensions-drop-cursor.js +9 -0
  12. package/dist/prosekit-extensions-enter-rule.d.ts +5 -0
  13. package/dist/prosekit-extensions-enter-rule.js +8 -0
  14. package/dist/prosekit-extensions-heading.js +20 -14
  15. package/dist/prosekit-extensions-image.js +1 -0
  16. package/dist/prosekit-extensions-input-rule.d.ts +3 -0
  17. package/dist/prosekit-extensions-input-rule.js +10 -0
  18. package/dist/prosekit-extensions-link.d.ts +2 -0
  19. package/dist/prosekit-extensions-link.js +63 -5
  20. package/dist/prosekit-extensions-list.d.ts +1 -0
  21. package/dist/prosekit-extensions-list.js +7 -2
  22. package/dist/prosekit-extensions-mark-rule.d.ts +3 -0
  23. package/dist/prosekit-extensions-mark-rule.js +173 -0
  24. package/dist/prosekit-extensions-mention.d.ts +1 -0
  25. package/dist/prosekit-extensions-mention.js +15 -2
  26. package/dist/prosekit-extensions-placeholder.js +4 -1
  27. package/dist/prosekit-extensions-readonly.d.ts +1 -0
  28. package/dist/prosekit-extensions-readonly.js +16 -0
  29. package/dist/prosekit-extensions-table.d.ts +7 -0
  30. package/dist/prosekit-extensions-table.js +197 -0
  31. package/dist/prosekit-extensions-virtual-selection.d.ts +1 -0
  32. package/dist/prosekit-extensions-virtual-selection.js +58 -0
  33. package/dist/shiki-import-25BJYIO2.js +5 -0
  34. package/dist/table/style.css +34 -0
  35. package/dist/virtual-selection/style.css +6 -0
  36. package/package.json +71 -15
  37. package/dist/prosekit-extensions-suggestion.d.ts +0 -3
  38. package/dist/prosekit-extensions-suggestion.js +0 -161
  39. package/src/index.ts +0 -1
@@ -1,19 +1,35 @@
1
+ import { Attrs } from '@prosekit/pm/model';
2
+ import { BundledLanguage } from 'shiki';
3
+ import { BundledLanguageInfo } from 'shiki';
4
+ import { bundledLanguagesInfo } from 'shiki';
5
+ import { BundledTheme } from 'shiki';
6
+ import { BundledThemeInfo } from 'shiki';
7
+ import { bundledThemesInfo } from 'shiki';
8
+ import { Command } from '@prosekit/pm/state';
1
9
  import { CommandArgs } from '@prosekit/core';
2
10
  import { DedentListOptions } from 'prosemirror-flat-list';
3
11
  import { EditorState } from '@prosekit/pm/state';
4
12
  import { Extension } from '@prosekit/core';
5
13
  import { ExtensionTyping } from '@prosekit/core';
6
- import type { HLJSApi } from 'highlight.js';
14
+ import { getHighlighter } from 'shiki/bundle/full';
7
15
  import { IndentListOptions } from 'prosemirror-flat-list';
16
+ import { InputRule } from '@prosekit/pm/inputrules';
8
17
  import { ListAttributes } from 'prosemirror-flat-list';
18
+ import { ListDOMSerializer } from 'prosemirror-flat-list';
19
+ import { MarkType } from '@prosekit/pm/model';
9
20
  import { NodeRange } from 'prosemirror-model';
21
+ import { NodeType } from '@prosekit/pm/model';
10
22
  import { Options } from 'tsup';
23
+ import { Parser } from 'prosemirror-highlight';
11
24
  import { Plugin as Plugin_2 } from '@prosekit/pm/state';
12
25
  import { PluginKey } from '@prosekit/pm/state';
26
+ import { ProseMirrorNode } from '@prosekit/pm/model';
27
+ import type { ResolvedPos } from '@prosekit/pm/model';
28
+ import type { Selection as Selection_2 } from '@prosekit/pm/state';
29
+ import type { SpecialLanguage } from 'shiki';
13
30
  import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
14
31
  import { Transaction } from '@prosekit/pm/state';
15
32
  import { UnwrapListOptions } from 'prosemirror-flat-list';
16
- import { UserProjectConfigExport } from 'vitest/dist/config.js';
17
33
 
18
34
  declare class AutocompleteRule {
19
35
  readonly regex: RegExp;
@@ -34,30 +50,86 @@ declare class AutocompleteRule {
34
50
  export { AutocompleteRule }
35
51
  export { AutocompleteRule as AutocompleteRule_alias_1 }
36
52
 
53
+ export { BundledLanguage as ShikiBundledLanguage }
54
+ export { BundledLanguage as ShikiBundledLanguage_alias_1 }
55
+
56
+ export { BundledLanguageInfo as ShikiBundledLanguageInfo }
57
+ export { BundledLanguageInfo as ShikiBundledLanguageInfo_alias_1 }
58
+
59
+ export { bundledLanguagesInfo as shikiBundledLanguagesInfo }
60
+ export { bundledLanguagesInfo as shikiBundledLanguagesInfo_alias_1 }
61
+
62
+ export { BundledTheme as ShikiBundledTheme }
63
+ export { BundledTheme as ShikiBundledTheme_alias_1 }
64
+
65
+ export { BundledThemeInfo as ShikiBundledThemeInfo }
66
+ export { BundledThemeInfo as ShikiBundledThemeInfo_alias_1 }
67
+
68
+ export { bundledThemesInfo as shikiBundledThemesInfo }
69
+ export { bundledThemesInfo as shikiBundledThemesInfo_alias_1 }
70
+
71
+ export declare interface CellAttrs {
72
+ colspan: number;
73
+ rowspan: number;
74
+ colwidth: number[] | null;
75
+ }
76
+
77
+ /**
78
+ * The attributes for the `codeBlock` node.
79
+ *
80
+ * @public
81
+ */
37
82
  declare interface CodeBlockAttrs {
38
83
  language?: string;
39
84
  }
40
85
  export { CodeBlockAttrs }
41
86
  export { CodeBlockAttrs as CodeBlockAttrs_alias_1 }
42
87
 
88
+ /**
89
+ * @public
90
+ */
91
+ export declare interface CodeBlockShikiOptions {
92
+ /**
93
+ * Theme registation
94
+ *
95
+ * @default ['one-dark-pro']
96
+ */
97
+ themes?: BundledTheme[];
98
+ /**
99
+ * Language registation
100
+ *
101
+ * @default ['text']
102
+ */
103
+ langs?: (BundledLanguage | SpecialLanguage)[];
104
+ /**
105
+ * Alias of languages
106
+ *
107
+ * @example { 'my-lang': 'javascript' }
108
+ */
109
+ langAlias?: Record<string, BundledLanguage>;
110
+ }
111
+
43
112
  export declare function createAutocompletePlugin({ getRules, }: {
44
113
  getRules: () => AutocompleteRule[];
45
114
  }): Plugin_2;
46
115
 
47
- export declare function createPredictionPlugin(options: SuggestionOptions): Plugin_2;
116
+ /**
117
+ * @internal
118
+ */
119
+ export declare function createLazyParser(highlighterOptions: HighlighterOptions): Parser;
48
120
 
49
121
  export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
50
122
 
51
- export declare const default_alias_1: UserProjectConfigExport;
123
+ export declare const default_alias_1: {
124
+ test: {
125
+ environment: "jsdom";
126
+ };
127
+ };
52
128
 
53
129
  export declare function defaultCanMatch({ state }: {
54
130
  state: EditorState;
55
131
  }): boolean;
56
132
 
57
- export declare function defaultIsValid({ state }: {
58
- state: EditorState;
59
- }): boolean;
60
-
61
133
  export declare function defineAutocomplete(rule: AutocompleteRule): Extension;
62
134
 
63
135
  /**
@@ -67,6 +139,12 @@ export declare function defineBlockquote(): Extension< {
67
139
  NODES: "blockquote";
68
140
  }>;
69
141
 
142
+ /**
143
+ * Wraps the text block in a blockquote when `>` is typed at the start of a new
144
+ * line followed by a space.
145
+ */
146
+ export declare function defineBlockquoteInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
147
+
70
148
  export declare function defineBlockquoteSpec(): Extension< {
71
149
  NODES: "blockquote";
72
150
  }>;
@@ -104,32 +182,100 @@ toggleCode: [];
104
182
  }>;
105
183
 
106
184
  /**
185
+ * Adds `codeBlock` nodes to the editor. This includes the following extensions:
186
+ *
187
+ * - {@link defineCodeBlockSpec}
188
+ * - {@link defineCodeBlockInputRule}
189
+ * - {@link defineCodeBlockEnterRule}
190
+ * - {@link defineCodeBlockKeymap}
191
+ * - {@link defineCodeBlockCommands}.
192
+ *
107
193
  * @public
108
194
  */
109
- export declare function defineCodeBlock(options?: {
110
- hljs?: HLJSApi;
111
- }): Extension< {
195
+ declare function defineCodeBlock(): Extension< {
112
196
  NODES: "codeBlock";
113
197
  COMMAND_ARGS: {
114
- setCodeBlockLanguage: [language: string];
198
+ setCodeBlock: [attrs?: CodeBlockAttrs | undefined];
199
+ insertCodeBlock: [attrs?: CodeBlockAttrs | undefined];
200
+ toggleCodeBlock: [attrs?: CodeBlockAttrs | undefined];
201
+ setCodeBlockAttrs: [attrs: CodeBlockAttrs];
115
202
  };
116
203
  }>;
204
+ export { defineCodeBlock }
205
+ export { defineCodeBlock as defineCodeBlock_alias_1 }
117
206
 
118
- export declare function defineCodeBlockCommands(): Extension< {
207
+ /**
208
+ * Adds commands for working with `codeBlock` nodes.
209
+ *
210
+ * @public
211
+ */
212
+ declare function defineCodeBlockCommands(): Extension< {
119
213
  COMMAND_ARGS: {
120
- setCodeBlockLanguage: [language: string];
214
+ setCodeBlock: [attrs?: CodeBlockAttrs | undefined];
215
+ insertCodeBlock: [attrs?: CodeBlockAttrs | undefined];
216
+ toggleCodeBlock: [attrs?: CodeBlockAttrs | undefined];
217
+ setCodeBlockAttrs: [attrs: CodeBlockAttrs];
121
218
  };
122
219
  }>;
220
+ export { defineCodeBlockCommands }
221
+ export { defineCodeBlockCommands as defineCodeBlockCommands_alias_1 }
222
+
223
+ /**
224
+ * Adds enter rules for `codeBlock` nodes.
225
+ *
226
+ * @public
227
+ */
228
+ declare function defineCodeBlockEnterRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
229
+ export { defineCodeBlockEnterRule }
230
+ export { defineCodeBlockEnterRule as defineCodeBlockEnterRule_alias_1 }
231
+
232
+ /**
233
+ * Adds syntax highlighting to code blocks. This function requires a `Parser`
234
+ * instance from the `prosemirror-highlight` package. See the
235
+ * [documentation](https://github.com/ocavue/prosemirror-highlight) for more
236
+ * information.
237
+ *
238
+ * @public
239
+ */
240
+ declare function defineCodeBlockHighlight({ parser, }: {
241
+ parser: HighlightParser;
242
+ }): Extension;
243
+ export { defineCodeBlockHighlight }
244
+ export { defineCodeBlockHighlight as defineCodeBlockHighlight_alias_1 }
123
245
 
124
- export declare function defineCodeBlockHighlight(options: {
125
- hljs?: HLJSApi;
126
- }): Extension<ExtensionTyping<string, string, CommandArgs>>;
246
+ /**
247
+ * Adds input rules for `codeBlock` nodes.
248
+ *
249
+ * @public
250
+ */
251
+ declare function defineCodeBlockInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
252
+ export { defineCodeBlockInputRule }
253
+ export { defineCodeBlockInputRule as defineCodeBlockInputRule_alias_1 }
127
254
 
128
- export declare function defineCodeBlockInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
255
+ /**
256
+ * Defines the keymap for code blocks.
257
+ */
258
+ export declare function defineCodeBlockKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
129
259
 
130
- export declare function defineCodeBlockSpec(): Extension< {
260
+ /**
261
+ * Adds syntax highlighting to code blocks using the [shiki](https://github.com/shikijs/shiki) package.
262
+ *
263
+ * @public
264
+ */
265
+ declare function defineCodeBlockShiki({ themes, langs, langAlias, }?: CodeBlockShikiOptions): Extension;
266
+ export { defineCodeBlockShiki }
267
+ export { defineCodeBlockShiki as defineCodeBlockShiki_alias_1 }
268
+
269
+ /**
270
+ * Defines the `codeBlock` node spec.
271
+ *
272
+ * @public
273
+ */
274
+ declare function defineCodeBlockSpec(): Extension< {
131
275
  NODES: "codeBlock";
132
276
  }>;
277
+ export { defineCodeBlockSpec }
278
+ export { defineCodeBlockSpec as defineCodeBlockSpec_alias_1 }
133
279
 
134
280
  export declare function defineCodeCommands(): Extension< {
135
281
  COMMAND_ARGS: {
@@ -144,6 +290,24 @@ export declare function defineCodeSpec(): Extension< {
144
290
  MARKS: "code";
145
291
  }>;
146
292
 
293
+ /**
294
+ * Show up a decoration at the drop position when something is dragged over the editor.
295
+ *
296
+ * See [prosemirror-dropcursor](https://github.com/ProseMirror/prosemirror-dropcursor) for more information.
297
+ *
298
+ * @public
299
+ */
300
+ export declare function defineDropCursor(options?: DropCursorOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
301
+
302
+ /**
303
+ * Defines an enter rule. An enter rule applies when the text directly in front of
304
+ * the cursor matches `regex` and user presses Enter. The `regex` should end
305
+ * with `$`.
306
+ *
307
+ * @public
308
+ */
309
+ export declare function defineEnterRule({ regex, handler, stop, }: EnterRuleOptions): Extension;
310
+
147
311
  /**
148
312
  * @public
149
313
  */
@@ -164,6 +328,10 @@ toggleHeading: [attrs?: HeadingAttrs | undefined];
164
328
  };
165
329
  }>;
166
330
 
331
+ /**
332
+ * Converts the text block to a heading when `#` is typed at the start of a new
333
+ * line followed by a space.
334
+ */
167
335
  export declare function defineHeadingInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
168
336
 
169
337
  export declare function defineHeadingKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
@@ -192,6 +360,15 @@ export declare function defineImageSpec(): Extension< {
192
360
  NODES: "image";
193
361
  }>;
194
362
 
363
+ /**
364
+ * Defines an input rule extension.
365
+ *
366
+ * @param rule - The ProseMirror input rule to add.
367
+ *
368
+ * @public
369
+ */
370
+ export declare function defineInputRule(rule: InputRule): Extension;
371
+
195
372
  /**
196
373
  * @public
197
374
  */
@@ -223,17 +400,25 @@ export declare function defineLink(): Extension< {
223
400
  MARKS: "link";
224
401
  COMMAND_ARGS: {
225
402
  addLink: [attrs: LinkAttrs];
403
+ removeLink: [];
226
404
  toggleLink: [attrs: LinkAttrs];
405
+ expandLink: [];
227
406
  };
228
407
  }>;
229
408
 
230
409
  export declare function defineLinkCommands(): Extension< {
231
410
  COMMAND_ARGS: {
232
411
  addLink: [attrs: LinkAttrs];
412
+ removeLink: [];
233
413
  toggleLink: [attrs: LinkAttrs];
414
+ expandLink: [];
234
415
  };
235
416
  }>;
236
417
 
418
+ export declare function defineLinkEnterRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
419
+
420
+ export declare function defineLinkInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
421
+
237
422
  export declare function defineLinkSpec(): Extension< {
238
423
  MARKS: "link";
239
424
  }>;
@@ -241,36 +426,36 @@ MARKS: "link";
241
426
  /**
242
427
  * @public
243
428
  */
244
- export declare function defineList(): Extension< {
245
- NODES: "list";
246
- COMMAND_ARGS: {
247
- dedentList: [options?: DedentListOptions | undefined];
248
- indentList: [options?: IndentListOptions | undefined];
249
- moveList: [direction: "up" | "down"];
250
- splitList: [];
251
- toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
252
- toggleList: [attrs: ListAttributes];
253
- unwrapList: [options?: UnwrapListOptions | undefined];
254
- wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
255
- insertList: [attrs?: ListAttributes | undefined];
256
- };
257
- }>;
258
-
259
- export declare function defineListCommands(): Extension< {
260
- COMMAND_ARGS: {
261
- dedentList: [options?: DedentListOptions | undefined];
262
- indentList: [options?: IndentListOptions | undefined];
263
- moveList: [direction: "up" | "down"];
264
- splitList: [];
265
- toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
266
- toggleList: [attrs: ListAttributes];
267
- unwrapList: [options?: UnwrapListOptions | undefined];
268
- wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
269
- insertList: [attrs?: ListAttributes | undefined];
270
- };
271
- }>;
272
-
273
- export declare function defineListInputRules(): Extension<ExtensionTyping<string, string, CommandArgs>>;
429
+ export declare function defineList(): Extension<{
430
+ NODES: "list";
431
+ COMMAND_ARGS: {
432
+ dedentList: [options?: DedentListOptions | undefined];
433
+ indentList: [options?: IndentListOptions | undefined];
434
+ moveList: [direction: "up" | "down"];
435
+ splitList: [];
436
+ toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
437
+ toggleList: [attrs: ListAttributes];
438
+ unwrapList: [options?: UnwrapListOptions | undefined];
439
+ wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
440
+ insertList: [attrs?: ListAttributes | undefined];
441
+ };
442
+ }>;
443
+
444
+ export declare function defineListCommands(): Extension<{
445
+ COMMAND_ARGS: {
446
+ dedentList: [options?: DedentListOptions | undefined];
447
+ indentList: [options?: IndentListOptions | undefined];
448
+ moveList: [direction: "up" | "down"];
449
+ splitList: [];
450
+ toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
451
+ toggleList: [attrs: ListAttributes];
452
+ unwrapList: [options?: UnwrapListOptions | undefined];
453
+ wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
454
+ insertList: [attrs?: ListAttributes | undefined];
455
+ };
456
+ }>;
457
+
458
+ export declare function defineListInputRules(): Extension;
274
459
 
275
460
  /**
276
461
  * Returns a extension that adds key bindings for list.
@@ -281,15 +466,33 @@ export declare function defineListKeymap(): Extension<ExtensionTyping<string, st
281
466
 
282
467
  export declare function defineListPlugins(): Extension<ExtensionTyping<string, string, CommandArgs>>;
283
468
 
284
- export declare function defineListSpec(): Extension< {
285
- NODES: "list";
469
+ export declare function defineListSpec(): Extension<{
470
+ NODES: "list";
286
471
  }>;
287
472
 
473
+ /**
474
+ * A mark rule is something that can automatically apply marks to text if it matches a certain pattern, and remove them if it doesn't match anymore.
475
+ *
476
+ * For every transaction that changes the document, the mark rule will be applied to the changed text.
477
+ *
478
+ *
479
+ */
480
+ export declare function defineMarkRule(options: MarkRuleOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
481
+
288
482
  /**
289
483
  * @public
290
484
  */
291
485
  export declare function defineMention(): Extension< {
292
486
  NODES: "mention";
487
+ COMMAND_ARGS: {
488
+ insertMention: [attrs: MentionAttrs];
489
+ };
490
+ }>;
491
+
492
+ export declare function defineMentionCommands(): Extension< {
493
+ COMMAND_ARGS: {
494
+ insertMention: [attrs: MentionAttrs];
495
+ };
293
496
  }>;
294
497
 
295
498
  /**
@@ -305,6 +508,11 @@ NODES: "mention";
305
508
  */
306
509
  export declare function definePlaceholder(options: PlaceholderOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
307
510
 
511
+ /**
512
+ * Make the editor read-only.
513
+ */
514
+ export declare function defineReadonly(): Extension<ExtensionTyping<string, string, CommandArgs>>;
515
+
308
516
  /**
309
517
  * @public
310
518
  */
@@ -327,7 +535,102 @@ export declare function defineStrikeSpec(): Extension< {
327
535
  MARKS: "strike";
328
536
  }>;
329
537
 
330
- export declare function defineSuggestion(options: SuggestionOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
538
+ /**
539
+ * @public
540
+ */
541
+ export declare function defineTable(): Extension< {
542
+ NODES: "table" | "tableRow" | "tableCell" | "tableHeaderCell";
543
+ COMMAND_ARGS: {
544
+ insertTable: [{
545
+ row: number;
546
+ col: number;
547
+ header: boolean;
548
+ }];
549
+ exitTable: [];
550
+ };
551
+ }>;
552
+
553
+ declare function defineTableCellSpec(): Extension< {
554
+ NODES: "tableCell";
555
+ }>;
556
+ export { defineTableCellSpec }
557
+ export { defineTableCellSpec as defineTableCellSpec_alias_1 }
558
+
559
+ /**
560
+ * Adds commands for working with `table` nodes.
561
+ *
562
+ * @public
563
+ */
564
+ declare function defineTableCommands(): Extension< {
565
+ COMMAND_ARGS: {
566
+ insertTable: [{
567
+ row: number;
568
+ col: number;
569
+ header: boolean;
570
+ }];
571
+ exitTable: [];
572
+ };
573
+ }>;
574
+ export { defineTableCommands }
575
+ export { defineTableCommands as defineTableCommands_alias_1 }
576
+
577
+ declare function defineTableHeaderCellSpec(): Extension< {
578
+ NODES: "tableHeaderCell";
579
+ }>;
580
+ export { defineTableHeaderCellSpec }
581
+ export { defineTableHeaderCellSpec as defineTableHeaderCellSpec_alias_1 }
582
+
583
+ /**
584
+ * @public
585
+ */
586
+ declare function defineTablePlugins(): Extension<ExtensionTyping<string, string, CommandArgs>>;
587
+ export { defineTablePlugins }
588
+ export { defineTablePlugins as defineTablePlugins_alias_1 }
589
+
590
+ declare function defineTableRowSpec(): Extension< {
591
+ NODES: "tableRow";
592
+ }>;
593
+ export { defineTableRowSpec }
594
+ export { defineTableRowSpec as defineTableRowSpec_alias_1 }
595
+
596
+ declare function defineTableSpec(): Extension< {
597
+ NODES: "table";
598
+ }>;
599
+ export { defineTableSpec }
600
+ export { defineTableSpec as defineTableSpec_alias_1 }
601
+
602
+ /**
603
+ * Defines an enter rule that replaces the matched text with a block node.
604
+ *
605
+ * See also {@link defineEnterRule}.
606
+ *
607
+ * @public
608
+ */
609
+ export declare function defineTextBlockEnterRule({ regex, type, attrs, stop, }: TextBlockEnterRuleOptions): Extension;
610
+
611
+ /**
612
+ * Defines an input rule that changes the type of a textblock when the matched
613
+ * text is typed into it.
614
+ *
615
+ * See also [textblockTypeInputRule](https://prosemirror.net/docs/ref/#inputrules.textblockTypeInputRule)
616
+ *
617
+ * @public
618
+ */
619
+ export declare function defineTextBlockInputRule({ regex, type, attrs, }: {
620
+ /**
621
+ * The regular expression to match against. You'll usually want to start it
622
+ * with `^` to that it is only matched at the start of a textblock.
623
+ */
624
+ regex: RegExp;
625
+ /**
626
+ * The node type to replace the matched text with.
627
+ */
628
+ type: string | NodeType;
629
+ /**
630
+ * Attributes to set on the node.
631
+ */
632
+ attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
633
+ }): Extension;
331
634
 
332
635
  /**
333
636
  * @public
@@ -351,18 +654,177 @@ export declare function defineUnderlineSpec(): Extension< {
351
654
  MARKS: "underline";
352
655
  }>;
353
656
 
657
+ /**
658
+ * Shows a virtual selection when the editor is not focused. When the editor is
659
+ * not focused, the selected inline content will be wrapped in a `<span>`
660
+ * element with the class `prosekit-virtual-selection`.
661
+ *
662
+ * This is useful when you want to move the focus to an element outside the
663
+ * editor, but still want to show the selection.
664
+ *
665
+ * @public
666
+ */
667
+ export declare function defineVirtualSelection(): Extension;
668
+
669
+ /**
670
+ * Defines an input rule for automatically wrapping a textblock when a given
671
+ * string is typed.
672
+ *
673
+ * See also [wrappingInputRule](https://prosemirror.net/docs/ref/#inputrules.wrappingInputRule)
674
+ *
675
+ * @public
676
+ */
677
+ export declare function defineWrappingInputRule({ regex, type, attrs, join, }: {
678
+ /**
679
+ * The regular expression to match against. You'll usually want to start it
680
+ * with `^` to that it is only matched at the start of a textblock.
681
+ */
682
+ regex: RegExp;
683
+ /**
684
+ * The type of node to wrap in.
685
+ */
686
+ type: string | NodeType;
687
+ /**
688
+ * Attributes to set on the node.
689
+ */
690
+ attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
691
+ /**
692
+ * By default, if there's a node with the same type above the newly wrapped
693
+ * node, the rule will try to
694
+ * [join](https://prosemirror.net/docs/ref/#transform.Transform.join) those
695
+ * two nodes. You can pass a join predicate, which takes a regular expression
696
+ * match and the node before the wrapped node, and can return a boolean to
697
+ * indicate whether a join should happen.
698
+ */
699
+ join?: (match: RegExpMatchArray, node: ProseMirrorNode) => boolean;
700
+ }): Extension;
701
+
702
+ export declare interface DropCursorOptions {
703
+ /**
704
+ * The color of the cursor. Use `false` to apply no color and rely only on class.
705
+ *
706
+ * @default 'black'
707
+ */
708
+ color?: string | false;
709
+ /**
710
+ * The precise width of the cursor in pixels.
711
+ *
712
+ * @default 1
713
+ */
714
+ width?: number;
715
+ /**
716
+ * A CSS class name to add to the cursor element.
717
+ */
718
+ class?: string;
719
+ }
720
+
721
+ /**
722
+ * @public
723
+ */
724
+ export declare type EnterRuleHandler = (options: {
725
+ /**
726
+ * The current editor state.
727
+ */
728
+ state: EditorState;
729
+ /**
730
+ * The start position of the matched text.
731
+ */
732
+ from: number;
733
+ /**
734
+ * The end position of the matched text.
735
+ */
736
+ to: number;
737
+ /**
738
+ * The matched result from the regular expression.
739
+ */
740
+ match: RegExpExecArray;
741
+ }) => Transaction | null;
742
+
743
+ /**
744
+ * Options for {@link defineEnterRule}.
745
+ *
746
+ * @public
747
+ */
748
+ export declare type EnterRuleOptions = {
749
+ /**
750
+ * The regular expression to match against. It should end with `$`.
751
+ */
752
+ regex: RegExp;
753
+ /**
754
+ * A function to be called when an enter rule is triggered.
755
+ */
756
+ handler: EnterRuleHandler;
757
+ /**
758
+ * Whether to stop further handlers from being called if this rule is triggered.
759
+ *
760
+ * @default false
761
+ */
762
+ stop?: boolean;
763
+ };
764
+
765
+ /**
766
+ * When the selection is in a table node, create a default block after the table
767
+ * table, and move the cursor there.
768
+ *
769
+ * @public
770
+ */
771
+ export declare const exitTable: Command;
772
+
773
+ /**
774
+ * @internal
775
+ */
776
+ export declare function findChangedTextRanges(selection: Selection_2): Array<[from: number, to: number]>;
777
+
778
+ /** @internal */
779
+ export declare function getAffectedRange(transactions: readonly Transaction[], oldState: EditorState, newState: EditorState): readonly [number, number];
780
+
781
+ export { getHighlighter }
782
+
354
783
  export declare function getPluginState(state: EditorState): PredictionPluginState | undefined;
355
784
 
785
+ export declare function getSpanTextRanges($from: ResolvedPos, $to: ResolvedPos): [number, number][];
786
+
356
787
  export declare function getTrMeta(tr: Transaction): PredictionPluginState;
357
788
 
358
789
  export declare interface HeadingAttrs {
359
790
  level: number;
360
791
  }
361
792
 
793
+ declare type HighlighterOptions = {
794
+ themes: BundledTheme[];
795
+ langs: (BundledLanguage | SpecialLanguage)[];
796
+ langAlias?: Record<string, BundledLanguage>;
797
+ };
798
+
799
+ /**
800
+ * @public
801
+ *
802
+ * An alias for the `Parser` type from the `prosemirror-highlight` package.
803
+ */
804
+ declare type HighlightParser = Parser;
805
+ export { HighlightParser }
806
+ export { HighlightParser as HighlightParser_alias_1 }
807
+
362
808
  export declare interface ImageAttrs {
363
809
  src?: string | null;
364
810
  }
365
811
 
812
+ /**
813
+ * Insert a table node with the given number of rows and columns, and optionally
814
+ * a header row.
815
+ *
816
+ * @public
817
+ */
818
+ export declare function insertTable({ row, col, header, }: {
819
+ row: number;
820
+ col: number;
821
+ header: boolean;
822
+ }): Command;
823
+
824
+ export declare const LINK_RE: RegExp;
825
+
826
+ export declare const LINK_SPACE_RE: RegExp;
827
+
366
828
  /**
367
829
  * @public
368
830
  */
@@ -370,6 +832,25 @@ export declare interface LinkAttrs {
370
832
  href: string;
371
833
  }
372
834
 
835
+ export { ListDOMSerializer }
836
+
837
+ export declare interface MarkRuleOptions {
838
+ /**
839
+ * The regular expression to match against. It should have a `g` flag to match
840
+ * all instances of the mark.
841
+ */
842
+ regex: RegExp;
843
+ /**
844
+ * The mark type to apply to the matched text.
845
+ */
846
+ type: string | MarkType;
847
+ /**
848
+ * Attributes to set on the mark. If a function is provided, it will be called
849
+ * with the matched result from the regular expression.
850
+ */
851
+ attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
852
+ }
853
+
373
854
  declare type MatchHandler = (options: {
374
855
  state: EditorState;
375
856
  match: RegExpExecArray;
@@ -377,30 +858,16 @@ declare type MatchHandler = (options: {
377
858
  to: number;
378
859
  ignoreMatch: () => void;
379
860
  deleteMatch: () => void;
380
- }) => Transaction | null | void;
861
+ }) => void;
381
862
  export { MatchHandler }
382
863
  export { MatchHandler as MatchHandler_alias_1 }
383
864
 
384
- /**
385
- * @returns Return a Transaction object if you want to append a transaction to current state (using )
386
- */
387
- declare type MatchHandler_2 = (options: {
388
- rule: PredictionRule;
389
- match: RegExpMatchArray;
390
- matchAfter: RegExpMatchArray | null;
391
- state: EditorState;
392
- dismiss: VoidFunction;
393
- deleteMatch: VoidFunction;
394
- }) => void;
395
-
396
865
  export declare interface MentionAttrs {
397
866
  id: string;
398
867
  kind: string;
399
868
  value: string;
400
869
  }
401
870
 
402
- export declare const OBJECT_REPLACEMENT = "\uFFFC";
403
-
404
871
  export declare interface PlaceholderOptions {
405
872
  /**
406
873
  * The placeholder text to use.
@@ -408,8 +875,8 @@ export declare interface PlaceholderOptions {
408
875
  placeholder: string;
409
876
  /**
410
877
  * By default, the placeholder text will be shown whenever the current text
411
- * cursor is in an empty node. If you only want to show the placeholder when
412
- * the whole doc is empty, you can set this option to 'doc'.
878
+ * cursor is in an empty text node. If you only want to show the placeholder
879
+ * when the whole doc is empty, you can set this option to 'doc'.
413
880
  *
414
881
  * @default 'block'
415
882
  */
@@ -429,31 +896,33 @@ export declare interface PredictionPluginState {
429
896
  } | null;
430
897
  }
431
898
 
432
- declare interface PredictionRule {
433
- match: RegExp;
434
- matchAfter?: RegExp;
435
- }
436
- export { PredictionRule }
437
- export { PredictionRule as PredictionRule_alias_1 }
438
-
439
899
  export declare function setTrMeta(tr: Transaction, meta: PredictionPluginState): Transaction;
440
900
 
441
- declare interface SuggestionOptions {
442
- rules: PredictionRule[];
443
- onMatch: MatchHandler_2;
444
- onDeactivate: VoidFunction;
901
+ /**
902
+ * Options for {@link defineTextBlockEnterRule}.
903
+ *
904
+ * @public
905
+ */
906
+ export declare type TextBlockEnterRuleOptions = {
445
907
  /**
446
- * You can pass this function if you want to skip the matching in some cases.
447
- * By default, the plugin will only run the matching if the current selection
448
- * is empty, and the selection is not inside a
449
- * [code](https://prosemirror.net/docs/ref/#model.NodeSpec.code) node nor
450
- * inside a mark with the name as `code`.
908
+ * The regular expression to match against. It should end with `$`.
451
909
  */
452
- isValid?: (options: {
453
- state: EditorState;
454
- }) => boolean;
455
- }
456
- export { SuggestionOptions }
457
- export { SuggestionOptions as SuggestionOptions_alias_1 }
910
+ regex: RegExp;
911
+ /**
912
+ * The node type to replace the matched text with.
913
+ */
914
+ type: string | NodeType;
915
+ /**
916
+ * Attributes to set on the node. If a function is provided, it will be called
917
+ * with the matched result from the regular expression.
918
+ */
919
+ attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
920
+ /**
921
+ * Whether to stop further handlers from being called if this rule is triggered.
922
+ *
923
+ * @default true
924
+ */
925
+ stop?: boolean;
926
+ };
458
927
 
459
928
  export { }