@prosekit/extensions 0.11.0 → 0.11.2

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 (42) hide show
  1. package/dist/{drop-indicator-CCCaHFvw.js → drop-indicator-B8P652g2.js} +30 -3
  2. package/dist/prosekit-extensions-autocomplete.d.ts +47 -47
  3. package/dist/prosekit-extensions-blockquote.d.ts +11 -11
  4. package/dist/prosekit-extensions-bold.d.ts +16 -16
  5. package/dist/prosekit-extensions-code-block.d.ts +82 -82
  6. package/dist/prosekit-extensions-code.d.ts +16 -16
  7. package/dist/prosekit-extensions-commit.d.ts +20 -20
  8. package/dist/prosekit-extensions-doc.d.ts +4 -4
  9. package/dist/prosekit-extensions-drop-cursor.d.ts +20 -20
  10. package/dist/prosekit-extensions-drop-indicator.d.ts +77 -63
  11. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  12. package/dist/prosekit-extensions-enter-rule.d.ts +57 -57
  13. package/dist/prosekit-extensions-file.d.ts +54 -54
  14. package/dist/prosekit-extensions-gap-cursor.d.ts +15 -15
  15. package/dist/prosekit-extensions-hard-break.d.ts +16 -16
  16. package/dist/prosekit-extensions-heading.d.ts +19 -19
  17. package/dist/prosekit-extensions-horizontal-rule.d.ts +6 -6
  18. package/dist/prosekit-extensions-image.d.ts +14 -14
  19. package/dist/prosekit-extensions-input-rule.d.ts +70 -70
  20. package/dist/prosekit-extensions-italic.d.ts +16 -16
  21. package/dist/prosekit-extensions-link.d.ts +24 -24
  22. package/dist/prosekit-extensions-list.d.ts +38 -38
  23. package/dist/prosekit-extensions-list.js +1 -1
  24. package/dist/prosekit-extensions-loro.d.ts +19 -19
  25. package/dist/prosekit-extensions-mark-rule.d.ts +17 -17
  26. package/dist/prosekit-extensions-mention.d.ts +10 -10
  27. package/dist/prosekit-extensions-mod-click-prevention.d.ts +7 -7
  28. package/dist/prosekit-extensions-paragraph.d.ts +23 -23
  29. package/dist/prosekit-extensions-placeholder.d.ts +20 -20
  30. package/dist/prosekit-extensions-readonly.d.ts +2 -2
  31. package/dist/prosekit-extensions-search.d.ts +36 -36
  32. package/dist/prosekit-extensions-strike.d.ts +16 -16
  33. package/dist/prosekit-extensions-table.d.ts +134 -134
  34. package/dist/prosekit-extensions-text-align.d.ts +29 -29
  35. package/dist/prosekit-extensions-text.d.ts +4 -4
  36. package/dist/prosekit-extensions-underline.d.ts +14 -14
  37. package/dist/prosekit-extensions-virtual-selection.d.ts +11 -11
  38. package/dist/prosekit-extensions-virtual-selection.js +1 -1
  39. package/dist/prosekit-extensions-yjs.d.ts +27 -27
  40. package/dist/{shiki-highlighter-chunk-NV2F_Qjl.d.ts → shiki-highlighter-chunk-D7gKY7Kr.d.ts} +1 -1
  41. package/dist/shiki-highlighter-chunk.d.ts +1 -1
  42. package/package.json +8 -8
@@ -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 };
@@ -1,120 +1,134 @@
1
1
  import { PlainExtension } from "@prosekit/core";
2
+ import { NodeSelection } from "@prosekit/pm/state";
2
3
  import { EditorView } from "@prosekit/pm/view";
4
+ import { Slice } from "@prosekit/pm/model";
3
5
 
4
6
  //#region src/drop-indicator/types.d.ts
5
7
 
6
8
  /**
7
- * A function that will be called when the `dragover` event is fired. You can
8
- * return `false` to disable the current drop point and thus hide the drop
9
- * indicator.
10
- *
11
- * @public
12
- */
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
+ */
13
15
  type DragEventHandler = (options: DragEventHandlerOptions) => boolean;
14
16
  /**
15
- * Options for {@link DragEventHandler}.
16
- *
17
- * @public
18
- */
17
+ * Options for {@link DragEventHandler}.
18
+ *
19
+ * @public
20
+ */
19
21
  interface DragEventHandlerOptions {
20
22
  /**
21
- * The editor's view.
22
- */
23
+ * The editor's view.
24
+ */
23
25
  view: EditorView;
24
26
  /**
25
- * The drop position in current document.
26
- */
27
+ * The drop position in current document.
28
+ */
27
29
  pos: number;
28
30
  /**
29
- * The `dragover` event.
30
- */
31
+ * The `dragover` event.
32
+ */
31
33
  event: DragEvent;
32
34
  }
33
35
  /**
34
- * A function that will be called when the drop indicator should be shown.
35
- *
36
- * @public
37
- */
36
+ * A function that will be called when the drop indicator should be shown.
37
+ *
38
+ * @public
39
+ */
38
40
  type ShowHandler = (options: ShowHandlerOptions) => void;
39
41
  /**
40
- * Options for {@link ShowHandler}.
41
- *
42
- * @public
43
- */
42
+ * Options for {@link ShowHandler}.
43
+ *
44
+ * @public
45
+ */
44
46
  interface ShowHandlerOptions {
45
47
  /**
46
- * The editor's view.
47
- */
48
+ * The editor's view.
49
+ */
48
50
  view: EditorView;
49
51
  /**
50
- * The ProseMirror position that the drop indicator should be shown at.
51
- */
52
+ * The ProseMirror position that the drop indicator should be shown at.
53
+ */
52
54
  pos: number;
53
55
  /**
54
- * The line that the drop indicator should be shown at.
55
- */
56
+ * The line that the drop indicator should be shown at.
57
+ */
56
58
  line: Line;
57
59
  }
58
60
  /**
59
- * @internal
60
- */
61
+ * @internal
62
+ */
61
63
  interface Point {
62
64
  readonly x: number;
63
65
  readonly y: number;
64
66
  }
65
67
  /**
66
- * @internal
67
- */
68
+ * @internal
69
+ */
68
70
  interface Line {
69
71
  readonly p1: Point;
70
72
  readonly p2: Point;
71
73
  }
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
+ */
81
+ interface ViewDragging {
82
+ readonly slice: Slice;
83
+ readonly move: boolean;
84
+ readonly node?: NodeSelection;
85
+ }
72
86
  //#endregion
73
87
  //#region src/drop-indicator/drop-indicator-facet.d.ts
74
88
  /**
75
- * @internal
76
- */
89
+ * @internal
90
+ */
77
91
  interface DropIndicatorPayload {
78
92
  /**
79
- * A callback that is called when the drop indicator should be shown.
80
- */
93
+ * A callback that is called when the drop indicator should be shown.
94
+ */
81
95
  onShow?: ShowHandler;
82
96
  /**
83
- * A callback that is called when the drop indicator should be hidden.
84
- */
97
+ * A callback that is called when the drop indicator should be hidden.
98
+ */
85
99
  onHide?: VoidFunction;
86
100
  /**
87
- * A callback that is called when the `dragover` event is fired. You can
88
- * return `false` to disable the current drop point and thus hide the drop
89
- * indicator.
90
- */
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
+ */
91
105
  onDrag?: DragEventHandler;
92
106
  }
93
107
  //#endregion
94
108
  //#region src/drop-indicator/drop-indicator.d.ts
95
109
  /**
96
- * @internal
97
- */
110
+ * @internal
111
+ */
98
112
  type DropIndicatorExtension = PlainExtension;
99
113
  /**
100
- * Defines an extension that controls the behavior of the drop indicator.
101
- *
102
- * This extension itself doesn't draw the drop indicator, but it provides the
103
- * necessary callbacks to do so. You probably don't want to use this extension
104
- * directly, but rather use the `<DropIndicator>` component.
105
- *
106
- * You can add this extension multiple times. If any extension has `onDrag`
107
- * callback defined, and it returns `false`, then the drop point will be
108
- * discarded.
109
- *
110
- * @public
111
- */
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
+ */
112
126
  declare function defineDropIndicator(options?: DropIndicatorOptions): DropIndicatorExtension;
113
127
  /**
114
- * Options for {@link defineDropIndicator}.
115
- *
116
- * @public
117
- */
128
+ * Options for {@link defineDropIndicator}.
129
+ *
130
+ * @public
131
+ */
118
132
  interface DropIndicatorOptions extends DropIndicatorPayload {}
119
133
  //#endregion
120
- export { type DragEventHandler, type DragEventHandlerOptions, type DropIndicatorExtension, type DropIndicatorOptions, type Line, type Point, type ShowHandler, type ShowHandlerOptions, defineDropIndicator };
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-CCCaHFvw.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,