@prosekit/extensions 0.11.1 → 0.11.3

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 (48) hide show
  1. package/dist/{drop-indicator-QKkPzJIx.js → drop-indicator-B8P652g2.js} +13 -2
  2. package/dist/paste-rule-Cca3n5TA.js +173 -0
  3. package/dist/prosekit-extensions-autocomplete.d.ts +47 -47
  4. package/dist/prosekit-extensions-blockquote.d.ts +11 -11
  5. package/dist/prosekit-extensions-bold.d.ts +16 -16
  6. package/dist/prosekit-extensions-code-block.d.ts +82 -82
  7. package/dist/prosekit-extensions-code.d.ts +16 -16
  8. package/dist/prosekit-extensions-commit.d.ts +20 -20
  9. package/dist/prosekit-extensions-doc.d.ts +4 -4
  10. package/dist/prosekit-extensions-drop-cursor.d.ts +20 -20
  11. package/dist/prosekit-extensions-drop-indicator.d.ts +68 -68
  12. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  13. package/dist/prosekit-extensions-enter-rule.d.ts +57 -57
  14. package/dist/prosekit-extensions-file.d.ts +54 -54
  15. package/dist/prosekit-extensions-gap-cursor.d.ts +15 -15
  16. package/dist/prosekit-extensions-hard-break.d.ts +16 -16
  17. package/dist/prosekit-extensions-heading.d.ts +19 -19
  18. package/dist/prosekit-extensions-horizontal-rule.d.ts +6 -6
  19. package/dist/prosekit-extensions-image.d.ts +14 -14
  20. package/dist/prosekit-extensions-input-rule.d.ts +70 -70
  21. package/dist/prosekit-extensions-italic.d.ts +16 -16
  22. package/dist/prosekit-extensions-link.d.ts +34 -26
  23. package/dist/prosekit-extensions-link.js +19 -2
  24. package/dist/prosekit-extensions-list.d.ts +38 -38
  25. package/dist/prosekit-extensions-list.js +1 -1
  26. package/dist/prosekit-extensions-loro.d.ts +19 -19
  27. package/dist/prosekit-extensions-mark-rule.d.ts +17 -17
  28. package/dist/prosekit-extensions-mention.d.ts +10 -10
  29. package/dist/prosekit-extensions-mod-click-prevention.d.ts +7 -7
  30. package/dist/prosekit-extensions-paragraph.d.ts +23 -23
  31. package/dist/prosekit-extensions-paste-rule.d.ts +93 -0
  32. package/dist/prosekit-extensions-paste-rule.js +3 -0
  33. package/dist/prosekit-extensions-placeholder.d.ts +20 -20
  34. package/dist/prosekit-extensions-placeholder.js +1 -1
  35. package/dist/prosekit-extensions-readonly.d.ts +2 -2
  36. package/dist/prosekit-extensions-search.d.ts +36 -36
  37. package/dist/prosekit-extensions-strike.d.ts +16 -16
  38. package/dist/prosekit-extensions-table.d.ts +134 -134
  39. package/dist/prosekit-extensions-table.js +1 -1
  40. package/dist/prosekit-extensions-text-align.d.ts +29 -29
  41. package/dist/prosekit-extensions-text.d.ts +4 -4
  42. package/dist/prosekit-extensions-underline.d.ts +14 -14
  43. package/dist/prosekit-extensions-virtual-selection.d.ts +11 -11
  44. package/dist/prosekit-extensions-yjs.d.ts +27 -27
  45. package/dist/{shiki-highlighter-chunk-NV2F_Qjl.d.ts → shiki-highlighter-chunk-DSPM0T27.d.ts} +1 -1
  46. package/dist/shiki-highlighter-chunk.d.ts +1 -1
  47. package/package.json +16 -8
  48. /package/dist/{table-3rDWFyBH.js → table-C_qAMj5-.js} +0 -0
@@ -3,52 +3,52 @@ import { Attrs } from "@prosekit/pm/model";
3
3
 
4
4
  //#region src/code/code-commands.d.ts
5
5
  /**
6
- * @internal
7
- */
6
+ * @internal
7
+ */
8
8
  type CodeCommandsExtension = Extension<{
9
9
  Commands: {
10
10
  toggleCode: [];
11
11
  };
12
12
  }>;
13
13
  /**
14
- * @internal
15
- */
14
+ * @internal
15
+ */
16
16
  declare function defineCodeCommands(): CodeCommandsExtension;
17
17
  //#endregion
18
18
  //#region src/code/code-spec.d.ts
19
19
  /**
20
- * @internal
21
- */
20
+ * @internal
21
+ */
22
22
  type CodeSpecExtension = Extension<{
23
23
  Marks: {
24
24
  code: Attrs;
25
25
  };
26
26
  }>;
27
27
  /**
28
- * @internal
29
- */
28
+ * @internal
29
+ */
30
30
  declare function defineCodeSpec(): CodeSpecExtension;
31
31
  //#endregion
32
32
  //#region src/code/code.d.ts
33
33
  /**
34
- * @internal
35
- */
34
+ * @internal
35
+ */
36
36
  type CodeExtension = Union<[CodeSpecExtension, CodeCommandsExtension]>;
37
37
  /**
38
- * @public
39
- */
38
+ * @public
39
+ */
40
40
  declare function defineCode(): CodeExtension;
41
41
  //#endregion
42
42
  //#region src/code/code-input-rule.d.ts
43
43
  /**
44
- * @internal
45
- */
44
+ * @internal
45
+ */
46
46
  declare function defineCodeInputRule(): PlainExtension;
47
47
  //#endregion
48
48
  //#region src/code/code-keymap.d.ts
49
49
  /**
50
- * @internal
51
- */
50
+ * @internal
51
+ */
52
52
  declare function defineCodeKeymap(): PlainExtension;
53
53
  //#endregion
54
54
  export { type CodeCommandsExtension, type CodeExtension, type CodeSpecExtension, defineCode, defineCodeCommands, defineCodeInputRule, defineCodeKeymap, defineCodeSpec };
@@ -5,48 +5,48 @@ import { ProseMirrorNode } from "@prosekit/pm/model";
5
5
  //#region src/commit/index.d.ts
6
6
 
7
7
  /**
8
- * A JSON representation of a commit.
9
- */
8
+ * A JSON representation of a commit.
9
+ */
10
10
  interface Commit {
11
11
  /**
12
- * The current doc node in the JSON format
13
- */
12
+ * The current doc node in the JSON format
13
+ */
14
14
  doc: NodeJSON;
15
15
  /**
16
- * The parent node in the JSON format
17
- */
16
+ * The parent node in the JSON format
17
+ */
18
18
  parent: NodeJSON;
19
19
  /**
20
- * An array of steps in the JSON format that transform the parent node to the
21
- * current doc node.
22
- */
20
+ * An array of steps in the JSON format that transform the parent node to the
21
+ * current doc node.
22
+ */
23
23
  steps: StepJSON[];
24
24
  }
25
25
  /**
26
- * Define an extension to display the changes from the given commit in the editor.
27
- */
26
+ * Define an extension to display the changes from the given commit in the editor.
27
+ */
28
28
  declare function defineCommitViewer(commit: Commit): PlainExtension;
29
29
  declare class CommitRecorder {
30
30
  private parent;
31
31
  private doc;
32
32
  private steps;
33
33
  /**
34
- * Return a commit object including all changes since the last commit. `null`
35
- * will be returned if there is no change.
36
- */
34
+ * Return a commit object including all changes since the last commit. `null`
35
+ * will be returned if there is no change.
36
+ */
37
37
  commit(): Commit | null;
38
38
  /**
39
- * @internal
40
- */
39
+ * @internal
40
+ */
41
41
  init(doc: ProseMirrorNode): void;
42
42
  /**
43
- * @internal
44
- */
43
+ * @internal
44
+ */
45
45
  apply(tr: Transaction): void;
46
46
  }
47
47
  /**
48
- * Define an extension that can record the changes in the editor.
49
- */
48
+ * Define an extension that can record the changes in the editor.
49
+ */
50
50
  declare function defineCommitRecorder(commitRecorder: CommitRecorder): PlainExtension;
51
51
  //#endregion
52
52
  export { type Commit, CommitRecorder, defineCommitRecorder, defineCommitViewer };
@@ -4,16 +4,16 @@ import { Attrs } from "@prosekit/pm/model";
4
4
  //#region src/doc/index.d.ts
5
5
 
6
6
  /**
7
- * @internal
8
- */
7
+ * @internal
8
+ */
9
9
  type DocExtension = Extension<{
10
10
  Nodes: {
11
11
  doc: Attrs;
12
12
  };
13
13
  }>;
14
14
  /**
15
- * @public
16
- */
15
+ * @public
16
+ */
17
17
  declare function defineDoc(): DocExtension;
18
18
  //#endregion
19
19
  export { DocExtension, defineDoc };
@@ -3,35 +3,35 @@ import { PlainExtension } from "@prosekit/core";
3
3
  //#region src/drop-cursor/drop-cursor.d.ts
4
4
  interface DropCursorOptions {
5
5
  /**
6
- * The color of the cursor. Use `false` to apply no color and rely only on class.
7
- *
8
- * @default 'black'
9
- */
6
+ * The color of the cursor. Use `false` to apply no color and rely only on class.
7
+ *
8
+ * @default 'black'
9
+ */
10
10
  color?: string | false;
11
11
  /**
12
- * The precise width of the cursor in pixels.
13
- *
14
- * @default 1
15
- */
12
+ * The precise width of the cursor in pixels.
13
+ *
14
+ * @default 1
15
+ */
16
16
  width?: number;
17
17
  /**
18
- * A CSS class name to add to the cursor element.
19
- */
18
+ * A CSS class name to add to the cursor element.
19
+ */
20
20
  class?: string;
21
21
  }
22
22
  /**
23
- * @internal
24
- */
23
+ * @internal
24
+ */
25
25
  type DropCursorExtension = PlainExtension;
26
26
  /**
27
- * Show up a decoration at the drop position when something is dragged over the editor.
28
- *
29
- * See [prosemirror-dropcursor](https://github.com/ProseMirror/prosemirror-dropcursor) for more information.
30
- *
31
- * You probably want to use `<DropIndicator />` component instead of this extension.
32
- *
33
- * @public
34
- */
27
+ * Show up a decoration at the drop position when something is dragged over the editor.
28
+ *
29
+ * See [prosemirror-dropcursor](https://github.com/ProseMirror/prosemirror-dropcursor) for more information.
30
+ *
31
+ * You probably want to use `<DropIndicator />` component instead of this extension.
32
+ *
33
+ * @public
34
+ */
35
35
  declare function defineDropCursor(options?: DropCursorOptions): DropCursorExtension;
36
36
  //#endregion
37
37
  export { type DropCursorExtension, type DropCursorOptions, defineDropCursor };
@@ -6,78 +6,78 @@ import { Slice } from "@prosekit/pm/model";
6
6
  //#region src/drop-indicator/types.d.ts
7
7
 
8
8
  /**
9
- * A function that will be called when the `dragover` event is fired. You can
10
- * return `false` to disable the current drop point and thus hide the drop
11
- * indicator.
12
- *
13
- * @public
14
- */
9
+ * A function that will be called when the `dragover` event is fired. You can
10
+ * return `false` to disable the current drop point and thus hide the drop
11
+ * indicator.
12
+ *
13
+ * @public
14
+ */
15
15
  type DragEventHandler = (options: DragEventHandlerOptions) => boolean;
16
16
  /**
17
- * Options for {@link DragEventHandler}.
18
- *
19
- * @public
20
- */
17
+ * Options for {@link DragEventHandler}.
18
+ *
19
+ * @public
20
+ */
21
21
  interface DragEventHandlerOptions {
22
22
  /**
23
- * The editor's view.
24
- */
23
+ * The editor's view.
24
+ */
25
25
  view: EditorView;
26
26
  /**
27
- * The drop position in current document.
28
- */
27
+ * The drop position in current document.
28
+ */
29
29
  pos: number;
30
30
  /**
31
- * The `dragover` event.
32
- */
31
+ * The `dragover` event.
32
+ */
33
33
  event: DragEvent;
34
34
  }
35
35
  /**
36
- * A function that will be called when the drop indicator should be shown.
37
- *
38
- * @public
39
- */
36
+ * A function that will be called when the drop indicator should be shown.
37
+ *
38
+ * @public
39
+ */
40
40
  type ShowHandler = (options: ShowHandlerOptions) => void;
41
41
  /**
42
- * Options for {@link ShowHandler}.
43
- *
44
- * @public
45
- */
42
+ * Options for {@link ShowHandler}.
43
+ *
44
+ * @public
45
+ */
46
46
  interface ShowHandlerOptions {
47
47
  /**
48
- * The editor's view.
49
- */
48
+ * The editor's view.
49
+ */
50
50
  view: EditorView;
51
51
  /**
52
- * The ProseMirror position that the drop indicator should be shown at.
53
- */
52
+ * The ProseMirror position that the drop indicator should be shown at.
53
+ */
54
54
  pos: number;
55
55
  /**
56
- * The line that the drop indicator should be shown at.
57
- */
56
+ * The line that the drop indicator should be shown at.
57
+ */
58
58
  line: Line;
59
59
  }
60
60
  /**
61
- * @internal
62
- */
61
+ * @internal
62
+ */
63
63
  interface Point {
64
64
  readonly x: number;
65
65
  readonly y: number;
66
66
  }
67
67
  /**
68
- * @internal
69
- */
68
+ * @internal
69
+ */
70
70
  interface Line {
71
71
  readonly p1: Point;
72
72
  readonly p2: Point;
73
73
  }
74
74
  /**
75
- * An interface matching the internal ProseMirror implementation.
76
- *
77
- * See https://github.com/ProseMirror/prosemirror-view/blob/1.38.1/src/input.ts#L657
78
- *
79
- * @internal
80
- */
75
+ * An interface matching the internal ProseMirror implementation.
76
+ *
77
+ * See https://github.com/ProseMirror/prosemirror-view/blob/1.38.1/src/input.ts#L657
78
+ *
79
+ * @internal
80
+ */
81
81
  interface ViewDragging {
82
82
  readonly slice: Slice;
83
83
  readonly move: boolean;
@@ -86,49 +86,49 @@ interface ViewDragging {
86
86
  //#endregion
87
87
  //#region src/drop-indicator/drop-indicator-facet.d.ts
88
88
  /**
89
- * @internal
90
- */
89
+ * @internal
90
+ */
91
91
  interface DropIndicatorPayload {
92
92
  /**
93
- * A callback that is called when the drop indicator should be shown.
94
- */
93
+ * A callback that is called when the drop indicator should be shown.
94
+ */
95
95
  onShow?: ShowHandler;
96
96
  /**
97
- * A callback that is called when the drop indicator should be hidden.
98
- */
97
+ * A callback that is called when the drop indicator should be hidden.
98
+ */
99
99
  onHide?: VoidFunction;
100
100
  /**
101
- * A callback that is called when the `dragover` event is fired. You can
102
- * return `false` to disable the current drop point and thus hide the drop
103
- * indicator.
104
- */
101
+ * A callback that is called when the `dragover` event is fired. You can
102
+ * return `false` to disable the current drop point and thus hide the drop
103
+ * indicator.
104
+ */
105
105
  onDrag?: DragEventHandler;
106
106
  }
107
107
  //#endregion
108
108
  //#region src/drop-indicator/drop-indicator.d.ts
109
109
  /**
110
- * @internal
111
- */
110
+ * @internal
111
+ */
112
112
  type DropIndicatorExtension = PlainExtension;
113
113
  /**
114
- * Defines an extension that controls the behavior of the drop indicator.
115
- *
116
- * This extension itself doesn't draw the drop indicator, but it provides the
117
- * necessary callbacks to do so. You probably don't want to use this extension
118
- * directly, but rather use the `<DropIndicator>` component.
119
- *
120
- * You can add this extension multiple times. If any extension has `onDrag`
121
- * callback defined, and it returns `false`, then the drop point will be
122
- * discarded.
123
- *
124
- * @public
125
- */
114
+ * Defines an extension that controls the behavior of the drop indicator.
115
+ *
116
+ * This extension itself doesn't draw the drop indicator, but it provides the
117
+ * necessary callbacks to do so. You probably don't want to use this extension
118
+ * directly, but rather use the `<DropIndicator>` component.
119
+ *
120
+ * You can add this extension multiple times. If any extension has `onDrag`
121
+ * callback defined, and it returns `false`, then the drop point will be
122
+ * discarded.
123
+ *
124
+ * @public
125
+ */
126
126
  declare function defineDropIndicator(options?: DropIndicatorOptions): DropIndicatorExtension;
127
127
  /**
128
- * Options for {@link defineDropIndicator}.
129
- *
130
- * @public
131
- */
128
+ * Options for {@link defineDropIndicator}.
129
+ *
130
+ * @public
131
+ */
132
132
  interface DropIndicatorOptions extends DropIndicatorPayload {}
133
133
  //#endregion
134
134
  export { type DragEventHandler, type DragEventHandlerOptions, type DropIndicatorExtension, type DropIndicatorOptions, type Line, type Point, type ShowHandler, type ShowHandlerOptions, type ViewDragging, defineDropIndicator };
@@ -1,3 +1,3 @@
1
- import { defineDropIndicator } from "./drop-indicator-QKkPzJIx.js";
1
+ import { defineDropIndicator } from "./drop-indicator-B8P652g2.js";
2
2
 
3
3
  export { defineDropIndicator };
@@ -5,102 +5,102 @@ import { Attrs, NodeType } from "@prosekit/pm/model";
5
5
  //#region src/enter-rule/index.d.ts
6
6
 
7
7
  /**
8
- * @public
9
- *
10
- * Options for {@link EnterRuleHandler}.
11
- */
8
+ * @public
9
+ *
10
+ * Options for {@link EnterRuleHandler}.
11
+ */
12
12
  interface EnterRuleHandlerOptions {
13
13
  /**
14
- * The current editor state.
15
- */
14
+ * The current editor state.
15
+ */
16
16
  state: EditorState;
17
17
  /**
18
- * The start position of the matched text.
19
- */
18
+ * The start position of the matched text.
19
+ */
20
20
  from: number;
21
21
  /**
22
- * The end position of the matched text.
23
- */
22
+ * The end position of the matched text.
23
+ */
24
24
  to: number;
25
25
  /**
26
- * The matched result from the regular expression.
27
- */
26
+ * The matched result from the regular expression.
27
+ */
28
28
  match: RegExpExecArray;
29
29
  }
30
30
  /**
31
- * @public
32
- */
31
+ * @public
32
+ */
33
33
  type EnterRuleHandler = (options: EnterRuleHandlerOptions) => Transaction | null;
34
34
  /**
35
- * Options for {@link defineEnterRule}.
36
- *
37
- * @public
38
- */
35
+ * Options for {@link defineEnterRule}.
36
+ *
37
+ * @public
38
+ */
39
39
  type EnterRuleOptions = {
40
40
  /**
41
- * The regular expression to match against. It should end with `$`.
42
- */
41
+ * The regular expression to match against. It should end with `$`.
42
+ */
43
43
  regex: RegExp;
44
44
  /**
45
- * A function to be called when an enter rule is triggered.
46
- */
45
+ * A function to be called when an enter rule is triggered.
46
+ */
47
47
  handler: EnterRuleHandler;
48
48
  /**
49
- * Whether to stop further handlers from being called if this rule is triggered.
50
- *
51
- * @default false
52
- */
49
+ * Whether to stop further handlers from being called if this rule is triggered.
50
+ *
51
+ * @default false
52
+ */
53
53
  stop?: boolean;
54
54
  };
55
55
  /**
56
- * Options for {@link defineTextBlockEnterRule}.
57
- *
58
- * @public
59
- */
56
+ * Options for {@link defineTextBlockEnterRule}.
57
+ *
58
+ * @public
59
+ */
60
60
  interface TextBlockEnterRuleOptions {
61
61
  /**
62
- * The regular expression to match against. It should end with `$`.
63
- */
62
+ * The regular expression to match against. It should end with `$`.
63
+ */
64
64
  regex: RegExp;
65
65
  /**
66
- * The node type to replace the matched text with.
67
- */
66
+ * The node type to replace the matched text with.
67
+ */
68
68
  type: string | NodeType;
69
69
  /**
70
- * Attributes to set on the node. If a function is provided, it will be called
71
- * with the matched result from the regular expression.
72
- */
70
+ * Attributes to set on the node. If a function is provided, it will be called
71
+ * with the matched result from the regular expression.
72
+ */
73
73
  attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
74
74
  /**
75
- * Whether to stop further handlers from being called if this rule is triggered.
76
- *
77
- * @default true
78
- */
75
+ * Whether to stop further handlers from being called if this rule is triggered.
76
+ *
77
+ * @default true
78
+ */
79
79
  stop?: boolean;
80
80
  }
81
81
  /**
82
- * Defines an enter rule. An enter rule applies when the text directly in front of
83
- * the cursor matches `regex` and user presses Enter. The `regex` should end
84
- * with `$`.
85
- *
86
- * @param options
87
- *
88
- * @public
89
- */
82
+ * Defines an enter rule. An enter rule applies when the text directly in front of
83
+ * the cursor matches `regex` and user presses Enter. The `regex` should end
84
+ * with `$`.
85
+ *
86
+ * @param options
87
+ *
88
+ * @public
89
+ */
90
90
  declare function defineEnterRule({
91
91
  regex,
92
92
  handler,
93
93
  stop
94
94
  }: EnterRuleOptions): PlainExtension;
95
95
  /**
96
- * Defines an enter rule that replaces the matched text with a block node.
97
- *
98
- * See also {@link defineEnterRule}.
99
- *
100
- * @param options
101
- *
102
- * @public
103
- */
96
+ * Defines an enter rule that replaces the matched text with a block node.
97
+ *
98
+ * See also {@link defineEnterRule}.
99
+ *
100
+ * @param options
101
+ *
102
+ * @public
103
+ */
104
104
  declare function defineTextBlockEnterRule({
105
105
  regex,
106
106
  type,