@prosekit/extensions 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/commit/style.css +1 -1
  2. package/dist/commit/style.js +0 -0
  3. package/dist/enter-rule-RdhEA900.js +96 -0
  4. package/dist/gap-cursor/style.css +6 -3
  5. package/dist/gap-cursor/style.js +0 -0
  6. package/dist/input-rule-Gji4N7Oe.js +93 -0
  7. package/dist/list/style.css +7 -7
  8. package/dist/list/style.js +0 -0
  9. package/dist/loro/style.css +13 -9
  10. package/dist/loro/style.js +0 -0
  11. package/dist/mark-rule-wEOcDt6i.js +160 -0
  12. package/dist/placeholder/style.css +3 -3
  13. package/dist/placeholder/style.js +0 -0
  14. package/dist/prosekit-extensions-autocomplete.d.ts +33 -3
  15. package/dist/prosekit-extensions-autocomplete.js +126 -174
  16. package/dist/prosekit-extensions-blockquote.d.ts +48 -8
  17. package/dist/prosekit-extensions-blockquote.js +64 -78
  18. package/dist/prosekit-extensions-bold.d.ts +54 -8
  19. package/dist/prosekit-extensions-bold.js +61 -73
  20. package/dist/prosekit-extensions-code-block.d.ts +159 -20
  21. package/dist/prosekit-extensions-code-block.js +201 -184
  22. package/dist/prosekit-extensions-code.d.ts +54 -8
  23. package/dist/prosekit-extensions-code.js +44 -56
  24. package/dist/prosekit-extensions-commit.d.ts +52 -4
  25. package/dist/prosekit-extensions-commit.js +140 -183
  26. package/dist/prosekit-extensions-doc.d.ts +19 -2
  27. package/dist/prosekit-extensions-doc.js +14 -12
  28. package/dist/prosekit-extensions-drop-cursor.d.ts +35 -3
  29. package/dist/prosekit-extensions-drop-cursor.js +14 -8
  30. package/dist/prosekit-extensions-enter-rule.d.ts +105 -5
  31. package/dist/prosekit-extensions-enter-rule.js +3 -8
  32. package/dist/prosekit-extensions-file.d.ts +129 -8
  33. package/dist/prosekit-extensions-file.js +124 -132
  34. package/dist/prosekit-extensions-gap-cursor.d.ts +26 -2
  35. package/dist/prosekit-extensions-gap-cursor.js +21 -9
  36. package/dist/prosekit-extensions-hard-break.d.ts +53 -0
  37. package/dist/prosekit-extensions-hard-break.js +58 -0
  38. package/dist/prosekit-extensions-heading.d.ts +63 -9
  39. package/dist/prosekit-extensions-heading.js +121 -95
  40. package/dist/prosekit-extensions-horizontal-rule.d.ts +38 -8
  41. package/dist/prosekit-extensions-horizontal-rule.js +53 -71
  42. package/dist/prosekit-extensions-image.d.ts +50 -7
  43. package/dist/prosekit-extensions-image.js +71 -62
  44. package/dist/prosekit-extensions-input-rule.d.ts +129 -6
  45. package/dist/prosekit-extensions-input-rule.js +3 -14
  46. package/dist/prosekit-extensions-italic.d.ts +54 -8
  47. package/dist/prosekit-extensions-italic.js +51 -63
  48. package/dist/prosekit-extensions-link.d.ts +62 -10
  49. package/dist/prosekit-extensions-link.js +95 -100
  50. package/dist/prosekit-extensions-list.d.ts +104 -17
  51. package/dist/prosekit-extensions-list.js +115 -158
  52. package/dist/prosekit-extensions-loro.d.ts +69 -11
  53. package/dist/prosekit-extensions-loro.js +49 -77
  54. package/dist/prosekit-extensions-mark-rule.d.ts +37 -2
  55. package/dist/prosekit-extensions-mark-rule.js +3 -6
  56. package/dist/prosekit-extensions-mention.d.ts +39 -4
  57. package/dist/prosekit-extensions-mention.js +52 -50
  58. package/dist/prosekit-extensions-mod-click-prevention.d.ts +17 -2
  59. package/dist/prosekit-extensions-mod-click-prevention.js +20 -16
  60. package/dist/prosekit-extensions-paragraph.d.ts +60 -7
  61. package/dist/prosekit-extensions-paragraph.js +46 -45
  62. package/dist/prosekit-extensions-placeholder.d.ts +33 -2
  63. package/dist/prosekit-extensions-placeholder.js +39 -56
  64. package/dist/prosekit-extensions-readonly.d.ts +10 -1
  65. package/dist/prosekit-extensions-readonly.js +13 -14
  66. package/dist/prosekit-extensions-search.d.ts +74 -3
  67. package/dist/prosekit-extensions-search.js +48 -47
  68. package/dist/prosekit-extensions-strike.d.ts +47 -8
  69. package/dist/prosekit-extensions-strike.js +44 -49
  70. package/dist/prosekit-extensions-table.d.ts +231 -26
  71. package/dist/prosekit-extensions-table.js +3 -34
  72. package/dist/prosekit-extensions-text-align.d.ts +71 -8
  73. package/dist/prosekit-extensions-text-align.js +63 -44
  74. package/dist/prosekit-extensions-text.d.ts +19 -2
  75. package/dist/prosekit-extensions-text.js +13 -11
  76. package/dist/prosekit-extensions-underline.d.ts +43 -7
  77. package/dist/prosekit-extensions-underline.js +33 -37
  78. package/dist/prosekit-extensions-virtual-selection.d.ts +21 -2
  79. package/dist/prosekit-extensions-virtual-selection.js +49 -52
  80. package/dist/prosekit-extensions-yjs.d.ts +90 -14
  81. package/dist/prosekit-extensions-yjs.js +88 -131
  82. package/dist/prosekit-extensions.d.ts +1 -1
  83. package/dist/search/style.css +4 -3
  84. package/dist/search/style.js +0 -0
  85. package/dist/shiki-highlighter-chunk-CZGvZlhf.d.ts +18 -0
  86. package/dist/shiki-highlighter-chunk.d.ts +2 -0
  87. package/dist/shiki-highlighter-chunk.js +32 -39
  88. package/dist/table/style.css +10 -13
  89. package/dist/table/style.js +0 -0
  90. package/dist/table-DnVliJ6E.js +287 -0
  91. package/dist/virtual-selection/style.css +2 -2
  92. package/dist/virtual-selection/style.js +0 -0
  93. package/dist/yjs/style.css +9 -8
  94. package/dist/yjs/style.js +0 -0
  95. package/package.json +81 -54
  96. package/dist/_tsup-dts-rollup.d.ts +0 -2459
  97. package/dist/chunk-6UYLCVBX.js +0 -185
  98. package/dist/chunk-D54VSLLS.js +0 -105
  99. package/dist/chunk-I2UMHK3L.js +0 -99
  100. package/dist/chunk-QVFEYPQ6.js +0 -306
@@ -1,8 +1,71 @@
1
- export { setTextAlign } from './_tsup-dts-rollup.js';
2
- export { defineTextAlignCommands } from './_tsup-dts-rollup.js';
3
- export { defineTextAlignKeymap } from './_tsup-dts-rollup.js';
4
- export { defineTextAlign } from './_tsup-dts-rollup.js';
5
- export { TextAlignOptions } from './_tsup-dts-rollup.js';
6
- export { TextAlignAttrsExtension } from './_tsup-dts-rollup.js';
7
- export { TextAlignCommandsExtension } from './_tsup-dts-rollup.js';
8
- export { TextAlignExtension } from './_tsup-dts-rollup.js';
1
+ import { Extension, PlainExtension, Union } from "@prosekit/core";
2
+ import { Command } from "@prosekit/pm/state";
3
+
4
+ //#region src/text-align/index.d.ts
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ interface TextAlignOptions<NodeName extends string = string> {
10
+ /**
11
+ * The names of node to add the attribute to.
12
+ *
13
+ * @example
14
+ *
15
+ * ["paragraph", "heading"]
16
+ */
17
+ types: NodeName[];
18
+ /**
19
+ * The default value for the attribute.
20
+ *
21
+ * @default "left"
22
+ */
23
+ default?: string;
24
+ }
25
+ /**
26
+ * @internal
27
+ */
28
+ type TextAlignAttrsExtension<NodeName extends string> = Extension<{
29
+ Nodes: { [K in NodeName]: {
30
+ textAlign: string | null;
31
+ } };
32
+ }>;
33
+ /**
34
+ * @internal
35
+ */
36
+ declare function setTextAlign({
37
+ types,
38
+ value
39
+ }: {
40
+ types: string[];
41
+ value: string | null;
42
+ }): Command;
43
+ /**
44
+ * @internal
45
+ */
46
+ type TextAlignCommandsExtension = Extension<{
47
+ Commands: {
48
+ setTextAlign: [value: string | null];
49
+ };
50
+ }>;
51
+ /**
52
+ * @internal
53
+ */
54
+ declare function defineTextAlignCommands(types: string[]): TextAlignCommandsExtension;
55
+ /**
56
+ * @internal
57
+ */
58
+ declare function defineTextAlignKeymap(types: string[]): PlainExtension;
59
+ /**
60
+ * @internal
61
+ */
62
+ type TextAlignExtension<NodeName extends string> = Union<[TextAlignAttrsExtension<NodeName>, TextAlignCommandsExtension]>;
63
+ /**
64
+ * Adds a `textAlign` attribute to the specified nodes. This will be rendered as
65
+ * a CSS `text-align` style.
66
+ *
67
+ * @public
68
+ */
69
+ declare function defineTextAlign<NodeName extends string = string>(options: TextAlignOptions<NodeName>): TextAlignExtension<NodeName>;
70
+ //#endregion
71
+ export { TextAlignAttrsExtension, TextAlignCommandsExtension, TextAlignExtension, TextAlignOptions, defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
@@ -1,55 +1,74 @@
1
- // src/text-align/index.ts
2
- import {
3
- defineCommands,
4
- defineKeymap,
5
- defineNodeAttr,
6
- setNodeAttrs,
7
- union
8
- } from "@prosekit/core";
1
+ import { defineCommands, defineKeymap, defineNodeAttr, setNodeAttrs, union } from "@prosekit/core";
2
+
3
+ //#region src/text-align/index.ts
9
4
  function defineTextAlignAttr(type, defaultValue) {
10
- return defineNodeAttr({
11
- type,
12
- attr: "textAlign",
13
- default: defaultValue,
14
- splittable: true,
15
- toDOM: (value) => value ? ["style", `text-align:${value};`] : null,
16
- parseDOM: (node) => {
17
- return node.style.getPropertyValue("text-align") || null;
18
- }
19
- });
5
+ return defineNodeAttr({
6
+ type,
7
+ attr: "textAlign",
8
+ default: defaultValue,
9
+ splittable: true,
10
+ toDOM: (value) => value ? ["style", `text-align:${value};`] : null,
11
+ parseDOM: (node) => {
12
+ return node.style.getPropertyValue("text-align") || null;
13
+ }
14
+ });
20
15
  }
16
+ /**
17
+ * @internal
18
+ */
21
19
  function defineTextAlignAttrs(types, defaultValue) {
22
- return union(types.map((type) => defineTextAlignAttr(type, defaultValue)));
20
+ return union(types.map((type) => defineTextAlignAttr(type, defaultValue)));
23
21
  }
24
- function setTextAlign({
25
- types,
26
- value
27
- }) {
28
- return setNodeAttrs({ type: types, attrs: { textAlign: value } });
22
+ /**
23
+ * @internal
24
+ */
25
+ function setTextAlign({ types, value }) {
26
+ return setNodeAttrs({
27
+ type: types,
28
+ attrs: { textAlign: value }
29
+ });
29
30
  }
31
+ /**
32
+ * @internal
33
+ */
30
34
  function defineTextAlignCommands(types) {
31
- return defineCommands({
32
- setTextAlign: (value) => setTextAlign({ types, value })
33
- });
35
+ return defineCommands({ setTextAlign: (value) => setTextAlign({
36
+ types,
37
+ value
38
+ }) });
34
39
  }
40
+ /**
41
+ * @internal
42
+ */
35
43
  function defineTextAlignKeymap(types) {
36
- return defineKeymap({
37
- "mod-shift-l": setTextAlign({ types, value: "left" }),
38
- "mod-shift-e": setTextAlign({ types, value: "center" }),
39
- "mod-shift-r": setTextAlign({ types, value: "right" }),
40
- "mod-shift-j": setTextAlign({ types, value: "justify" })
41
- });
44
+ return defineKeymap({
45
+ "mod-shift-l": setTextAlign({
46
+ types,
47
+ value: "left"
48
+ }),
49
+ "mod-shift-e": setTextAlign({
50
+ types,
51
+ value: "center"
52
+ }),
53
+ "mod-shift-r": setTextAlign({
54
+ types,
55
+ value: "right"
56
+ }),
57
+ "mod-shift-j": setTextAlign({
58
+ types,
59
+ value: "justify"
60
+ })
61
+ });
42
62
  }
63
+ /**
64
+ * Adds a `textAlign` attribute to the specified nodes. This will be rendered as
65
+ * a CSS `text-align` style.
66
+ *
67
+ * @public
68
+ */
43
69
  function defineTextAlign(options) {
44
- return union(
45
- defineTextAlignAttrs(options.types, options.default || "left"),
46
- defineTextAlignKeymap(options.types),
47
- defineTextAlignCommands(options.types)
48
- );
70
+ return union(defineTextAlignAttrs(options.types, options.default || "left"), defineTextAlignKeymap(options.types), defineTextAlignCommands(options.types));
49
71
  }
50
- export {
51
- defineTextAlign,
52
- defineTextAlignCommands,
53
- defineTextAlignKeymap,
54
- setTextAlign
55
- };
72
+
73
+ //#endregion
74
+ export { defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
@@ -1,2 +1,19 @@
1
- export { defineText } from './_tsup-dts-rollup.js';
2
- export { TextExtension } from './_tsup-dts-rollup.js';
1
+ import { Extension } from "@prosekit/core";
2
+ import { Attrs } from "@prosekit/pm/model";
3
+
4
+ //#region src/text/index.d.ts
5
+
6
+ /**
7
+ * @internal
8
+ */
9
+ type TextExtension = Extension<{
10
+ Nodes: {
11
+ text: Attrs;
12
+ };
13
+ }>;
14
+ /**
15
+ * @public
16
+ */
17
+ declare function defineText(): TextExtension;
18
+ //#endregion
19
+ export { TextExtension, defineText };
@@ -1,13 +1,15 @@
1
- // src/text/index.ts
2
- import {
3
- defineNodeSpec
4
- } from "@prosekit/core";
1
+ import { defineNodeSpec } from "@prosekit/core";
2
+
3
+ //#region src/text/index.ts
4
+ /**
5
+ * @public
6
+ */
5
7
  function defineText() {
6
- return defineNodeSpec({
7
- name: "text",
8
- group: "inline"
9
- });
8
+ return defineNodeSpec({
9
+ name: "text",
10
+ group: "inline"
11
+ });
10
12
  }
11
- export {
12
- defineText
13
- };
13
+
14
+ //#endregion
15
+ export { defineText };
@@ -1,7 +1,43 @@
1
- export { defineUnderlineSpec } from './_tsup-dts-rollup.js';
2
- export { defineUnderlineCommands } from './_tsup-dts-rollup.js';
3
- export { defineUnderlineKeymap } from './_tsup-dts-rollup.js';
4
- export { defineUnderline } from './_tsup-dts-rollup.js';
5
- export { UnderlineSpecExtension } from './_tsup-dts-rollup.js';
6
- export { UnderlineCommandsExtension } from './_tsup-dts-rollup.js';
7
- export { UnderlineExtension } from './_tsup-dts-rollup.js';
1
+ import { Extension, PlainExtension, Union } from "@prosekit/core";
2
+ import { Attrs } from "@prosekit/pm/model";
3
+
4
+ //#region src/underline/index.d.ts
5
+
6
+ /**
7
+ * @internal
8
+ */
9
+ type UnderlineSpecExtension = Extension<{
10
+ Marks: {
11
+ underline: Attrs;
12
+ };
13
+ }>;
14
+ /**
15
+ * @internal
16
+ */
17
+ declare function defineUnderlineSpec(): UnderlineSpecExtension;
18
+ /**
19
+ * @internal
20
+ */
21
+ type UnderlineCommandsExtension = Extension<{
22
+ Commands: {
23
+ toggleUnderline: [];
24
+ };
25
+ }>;
26
+ /**
27
+ * @internal
28
+ */
29
+ declare function defineUnderlineCommands(): UnderlineCommandsExtension;
30
+ /**
31
+ * @internal
32
+ */
33
+ declare function defineUnderlineKeymap(): PlainExtension;
34
+ /**
35
+ * @internal
36
+ */
37
+ type UnderlineExtension = Union<[UnderlineSpecExtension, UnderlineCommandsExtension]>;
38
+ /**
39
+ * @public
40
+ */
41
+ declare function defineUnderline(): UnderlineExtension;
42
+ //#endregion
43
+ export { UnderlineCommandsExtension, UnderlineExtension, UnderlineSpecExtension, defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
@@ -1,45 +1,41 @@
1
- // src/underline/index.ts
2
- import {
3
- defineCommands,
4
- defineKeymap,
5
- defineMarkSpec,
6
- toggleMark,
7
- union
8
- } from "@prosekit/core";
1
+ import { defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
2
+
3
+ //#region src/underline/index.ts
4
+ /**
5
+ * @internal
6
+ */
9
7
  function defineUnderlineSpec() {
10
- return defineMarkSpec({
11
- name: "underline",
12
- parseDOM: [
13
- { tag: "u" },
14
- { tag: "underline" },
15
- { style: "text-decoration=underline" },
16
- { style: "text-decoration-line=underline" }
17
- ],
18
- toDOM() {
19
- return ["u", 0];
20
- }
21
- });
8
+ return defineMarkSpec({
9
+ name: "underline",
10
+ parseDOM: [
11
+ { tag: "u" },
12
+ { tag: "underline" },
13
+ { style: "text-decoration=underline" },
14
+ { style: "text-decoration-line=underline" }
15
+ ],
16
+ toDOM() {
17
+ return ["u", 0];
18
+ }
19
+ });
22
20
  }
21
+ /**
22
+ * @internal
23
+ */
23
24
  function defineUnderlineCommands() {
24
- return defineCommands({
25
- toggleUnderline: () => toggleMark({ type: "underline" })
26
- });
25
+ return defineCommands({ toggleUnderline: () => toggleMark({ type: "underline" }) });
27
26
  }
27
+ /**
28
+ * @internal
29
+ */
28
30
  function defineUnderlineKeymap() {
29
- return defineKeymap({
30
- "Mod-u": toggleMark({ type: "underline" })
31
- });
31
+ return defineKeymap({ "Mod-u": toggleMark({ type: "underline" }) });
32
32
  }
33
+ /**
34
+ * @public
35
+ */
33
36
  function defineUnderline() {
34
- return union(
35
- defineUnderlineSpec(),
36
- defineUnderlineCommands(),
37
- defineUnderlineKeymap()
38
- );
37
+ return union(defineUnderlineSpec(), defineUnderlineCommands(), defineUnderlineKeymap());
39
38
  }
40
- export {
41
- defineUnderline,
42
- defineUnderlineCommands,
43
- defineUnderlineKeymap,
44
- defineUnderlineSpec
45
- };
39
+
40
+ //#endregion
41
+ export { defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
@@ -1,2 +1,21 @@
1
- export { defineVirtualSelection } from './_tsup-dts-rollup.js';
2
- export { VirtualSelectionExtension } from './_tsup-dts-rollup.js';
1
+ import { PlainExtension } from "@prosekit/core";
2
+
3
+ //#region src/virtual-selection/index.d.ts
4
+
5
+ /**
6
+ * @internal
7
+ */
8
+ type VirtualSelectionExtension = PlainExtension;
9
+ /**
10
+ * Shows a virtual selection when the editor is not focused. When the editor is
11
+ * not focused, the selected inline content will be wrapped in a `<span>`
12
+ * element with the class `prosekit-virtual-selection`.
13
+ *
14
+ * This is useful when you want to move the focus to an element outside the
15
+ * editor, but still want to show the selection.
16
+ *
17
+ * @public
18
+ */
19
+ declare function defineVirtualSelection(): VirtualSelectionExtension;
20
+ //#endregion
21
+ export { VirtualSelectionExtension, defineVirtualSelection };
@@ -1,61 +1,58 @@
1
- // src/virtual-selection/index.ts
2
- import {
3
- definePlugin
4
- } from "@prosekit/core";
5
- import {
6
- PluginKey,
7
- ProseMirrorPlugin
8
- } from "@prosekit/pm/state";
9
- import {
10
- Decoration,
11
- DecorationSet
12
- } from "@prosekit/pm/view";
1
+ import { definePlugin } from "@prosekit/core";
2
+ import { PluginKey, ProseMirrorPlugin } from "@prosekit/pm/state";
3
+ import { Decoration, DecorationSet } from "@prosekit/pm/view";
4
+
5
+ //#region src/virtual-selection/index.ts
6
+ /**
7
+ * Shows a virtual selection when the editor is not focused. When the editor is
8
+ * not focused, the selected inline content will be wrapped in a `<span>`
9
+ * element with the class `prosekit-virtual-selection`.
10
+ *
11
+ * This is useful when you want to move the focus to an element outside the
12
+ * editor, but still want to show the selection.
13
+ *
14
+ * @public
15
+ */
13
16
  function defineVirtualSelection() {
14
- return definePlugin(virtualSelectionPlugin);
17
+ return definePlugin(virtualSelectionPlugin);
15
18
  }
16
- var key = new PluginKey("prosekit-virtual-selection");
19
+ const key = new PluginKey("prosekit-virtual-selection");
17
20
  function getFocusMeta(tr) {
18
- return tr.getMeta(key);
21
+ return tr.getMeta(key);
19
22
  }
20
23
  function setFocusMeta(tr, value) {
21
- return tr.setMeta(key, value);
24
+ return tr.setMeta(key, value);
22
25
  }
23
26
  function getFocusState(state) {
24
- return key.getState(state);
27
+ return key.getState(state);
25
28
  }
26
- var virtualSelectionPlugin = new ProseMirrorPlugin({
27
- key,
28
- state: {
29
- init: () => false,
30
- apply: (tr, value) => {
31
- return getFocusMeta(tr) ?? value;
32
- }
33
- },
34
- props: {
35
- handleDOMEvents: {
36
- focus: (view) => {
37
- view.dispatch(setFocusMeta(view.state.tr, false));
38
- },
39
- blur: (view) => {
40
- const { dom, root } = view;
41
- const activeElement = root.activeElement;
42
- if (activeElement === dom) return;
43
- view.dispatch(setFocusMeta(view.state.tr, true));
44
- }
45
- },
46
- decorations: (state) => {
47
- const { selection, doc } = state;
48
- if (selection.empty || !getFocusState(state)) {
49
- return null;
50
- }
51
- return DecorationSet.create(doc, [
52
- Decoration.inline(selection.from, selection.to, {
53
- class: "prosekit-virtual-selection"
54
- })
55
- ]);
56
- }
57
- }
29
+ const virtualSelectionPlugin = new ProseMirrorPlugin({
30
+ key,
31
+ state: {
32
+ init: () => false,
33
+ apply: (tr, value) => {
34
+ return getFocusMeta(tr) ?? value;
35
+ }
36
+ },
37
+ props: {
38
+ handleDOMEvents: {
39
+ focus: (view) => {
40
+ view.dispatch(setFocusMeta(view.state.tr, false));
41
+ },
42
+ blur: (view) => {
43
+ const { dom, root } = view;
44
+ const activeElement = root.activeElement;
45
+ if (activeElement === dom) return;
46
+ view.dispatch(setFocusMeta(view.state.tr, true));
47
+ }
48
+ },
49
+ decorations: (state) => {
50
+ const { selection, doc } = state;
51
+ if (selection.empty || !getFocusState(state)) return null;
52
+ return DecorationSet.create(doc, [Decoration.inline(selection.from, selection.to, { class: "prosekit-virtual-selection" })]);
53
+ }
54
+ }
58
55
  });
59
- export {
60
- defineVirtualSelection
61
- };
56
+
57
+ //#endregion
58
+ export { defineVirtualSelection };
@@ -1,14 +1,90 @@
1
- export { defineYjs } from './_tsup-dts-rollup.js';
2
- export { YjsExtension } from './_tsup-dts-rollup.js';
3
- export { YjsOptions } from './_tsup-dts-rollup.js';
4
- export { defineYjsCommands } from './_tsup-dts-rollup.js';
5
- export { defineYjsCursorPlugin } from './_tsup-dts-rollup.js';
6
- export { YjsCursorOptions } from './_tsup-dts-rollup.js';
7
- export { YjsCursorPluginOptions } from './_tsup-dts-rollup.js';
8
- export { defineYjsKeymap } from './_tsup-dts-rollup.js';
9
- export { defineYjsSyncPlugin } from './_tsup-dts-rollup.js';
10
- export { YjsSyncOptions } from './_tsup-dts-rollup.js';
11
- export { YjsSyncPluginOptions } from './_tsup-dts-rollup.js';
12
- export { defineYjsUndoPlugin } from './_tsup-dts-rollup.js';
13
- export { YjsUndoOptions } from './_tsup-dts-rollup.js';
14
- export { YjsUndoPluginOptions } from './_tsup-dts-rollup.js';
1
+ import { Extension, PlainExtension, Union } from "@prosekit/core";
2
+ import { yCursorPlugin, ySyncPlugin, yUndoPlugin } from "y-prosemirror";
3
+ import { Awareness } from "y-protocols/awareness";
4
+ import * as Y$1 from "yjs";
5
+ import * as Y from "yjs";
6
+
7
+ //#region src/yjs/yjs-commands.d.ts
8
+ /**
9
+ * @internal
10
+ */
11
+ type YjsCommandsExtension = Extension<{
12
+ Commands: {
13
+ undo: [];
14
+ redo: [];
15
+ };
16
+ }>;
17
+ declare function defineYjsCommands(): YjsCommandsExtension;
18
+ //#endregion
19
+ //#region src/yjs/yjs-cursor-plugin.d.ts
20
+ /**
21
+ * Options for `y-prosemirror`'s `yCursorPlugin`.
22
+ */
23
+ type YjsCursorPluginOptions = NonNullable<Parameters<typeof yCursorPlugin>[1]>;
24
+ interface YjsCursorOptions extends YjsCursorPluginOptions {
25
+ awareness: Awareness;
26
+ }
27
+ declare function defineYjsCursorPlugin(options: YjsCursorOptions): PlainExtension;
28
+ //#endregion
29
+ //#region src/yjs/yjs-sync-plugin.d.ts
30
+ /**
31
+ * Options for `y-prosemirror`'s `ySyncPlugin`.
32
+ */
33
+ type YjsSyncPluginOptions = NonNullable<Parameters<typeof ySyncPlugin>[1]>;
34
+ interface YjsSyncOptions extends YjsSyncPluginOptions {
35
+ fragment: Y$1.XmlFragment;
36
+ }
37
+ declare function defineYjsSyncPlugin(options: YjsSyncOptions): PlainExtension;
38
+ //#endregion
39
+ //#region src/yjs/yjs-undo-plugin.d.ts
40
+ /**
41
+ * Options for the `y-prosemirror`'s `yUndoPlugin`.
42
+ */
43
+ type YjsUndoPluginOptions = NonNullable<Parameters<typeof yUndoPlugin>[0]>;
44
+ interface YjsUndoOptions extends YjsUndoPluginOptions {}
45
+ /**
46
+ * @internal
47
+ */
48
+ declare function defineYjsUndoPlugin(options: YjsUndoOptions): PlainExtension;
49
+ //#endregion
50
+ //#region src/yjs/yjs.d.ts
51
+ interface YjsOptions {
52
+ /**
53
+ * The Yjs instance handles the state of shared data.
54
+ */
55
+ doc: Y.Doc;
56
+ /**
57
+ * The Awareness instance.
58
+ */
59
+ awareness: Awareness;
60
+ /**
61
+ * The Yjs XmlFragment to use. If not provided,
62
+ * `doc.getXmlFragment('prosemirror')` will be used.
63
+ */
64
+ fragment?: Y.XmlFragment;
65
+ /**
66
+ * Options for `y-prosemirror`'s `ySyncPlugin`.
67
+ */
68
+ sync?: YjsSyncPluginOptions;
69
+ /**
70
+ * Options for the `y-prosemirror`'s `yUndoPlugin`.
71
+ */
72
+ undo?: YjsUndoPluginOptions;
73
+ /**
74
+ * Options for `y-prosemirror`'s `yCursorPlugin`.
75
+ */
76
+ cursor?: YjsCursorPluginOptions;
77
+ }
78
+ /**
79
+ * @internal
80
+ */
81
+ type YjsExtension = Union<[YjsCommandsExtension, PlainExtension]>;
82
+ /**
83
+ * @public
84
+ */
85
+ declare function defineYjs(options: YjsOptions): YjsExtension;
86
+ //#endregion
87
+ //#region src/yjs/yjs-keymap.d.ts
88
+ declare function defineYjsKeymap(): PlainExtension;
89
+ //#endregion
90
+ export { YjsCursorOptions, YjsCursorPluginOptions, YjsExtension, YjsOptions, YjsSyncOptions, YjsSyncPluginOptions, YjsUndoOptions, YjsUndoPluginOptions, defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };