@prosekit/extensions 0.7.24 → 0.9.0

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 +2 -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 +8 -5
  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 +21 -17
  10. package/dist/loro/style.js +0 -0
  11. package/dist/mark-rule-wEOcDt6i.js +160 -0
  12. package/dist/placeholder/style.css +5 -5
  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 +122 -174
  16. package/dist/prosekit-extensions-blockquote.d.ts +51 -8
  17. package/dist/prosekit-extensions-blockquote.js +64 -78
  18. package/dist/prosekit-extensions-bold.d.ts +61 -8
  19. package/dist/prosekit-extensions-bold.js +61 -73
  20. package/dist/prosekit-extensions-code-block.d.ts +172 -20
  21. package/dist/prosekit-extensions-code-block.js +201 -184
  22. package/dist/prosekit-extensions-code.d.ts +61 -8
  23. package/dist/prosekit-extensions-code.js +44 -55
  24. package/dist/prosekit-extensions-commit.d.ts +53 -4
  25. package/dist/prosekit-extensions-commit.js +142 -183
  26. package/dist/prosekit-extensions-doc.d.ts +22 -0
  27. package/dist/prosekit-extensions-doc.js +16 -0
  28. package/dist/prosekit-extensions-drop-cursor.d.ts +34 -3
  29. package/dist/prosekit-extensions-drop-cursor.js +14 -8
  30. package/dist/prosekit-extensions-enter-rule.d.ts +106 -5
  31. package/dist/prosekit-extensions-enter-rule.js +3 -8
  32. package/dist/prosekit-extensions-file.d.ts +126 -8
  33. package/dist/prosekit-extensions-file.js +111 -132
  34. package/dist/prosekit-extensions-gap-cursor.d.ts +29 -2
  35. package/dist/prosekit-extensions-gap-cursor.js +21 -9
  36. package/dist/prosekit-extensions-hard-break.d.ts +58 -0
  37. package/dist/prosekit-extensions-hard-break.js +58 -0
  38. package/dist/prosekit-extensions-heading.d.ts +69 -9
  39. package/dist/prosekit-extensions-heading.js +121 -95
  40. package/dist/prosekit-extensions-horizontal-rule.d.ts +41 -8
  41. package/dist/prosekit-extensions-horizontal-rule.js +53 -71
  42. package/dist/prosekit-extensions-image.d.ts +53 -7
  43. package/dist/prosekit-extensions-image.js +71 -62
  44. package/dist/prosekit-extensions-input-rule.d.ts +134 -6
  45. package/dist/prosekit-extensions-input-rule.js +3 -14
  46. package/dist/prosekit-extensions-italic.d.ts +61 -8
  47. package/dist/prosekit-extensions-italic.js +51 -63
  48. package/dist/prosekit-extensions-link.d.ts +65 -10
  49. package/dist/prosekit-extensions-link.js +95 -100
  50. package/dist/prosekit-extensions-list.d.ts +114 -17
  51. package/dist/prosekit-extensions-list.js +115 -158
  52. package/dist/prosekit-extensions-loro.d.ts +78 -11
  53. package/dist/prosekit-extensions-loro.js +49 -77
  54. package/dist/prosekit-extensions-mark-rule.d.ts +41 -2
  55. package/dist/prosekit-extensions-mark-rule.js +3 -6
  56. package/dist/prosekit-extensions-mention.d.ts +40 -4
  57. package/dist/prosekit-extensions-mention.js +52 -50
  58. package/dist/prosekit-extensions-mod-click-prevention.d.ts +20 -2
  59. package/dist/prosekit-extensions-mod-click-prevention.js +20 -16
  60. package/dist/prosekit-extensions-paragraph.d.ts +65 -0
  61. package/dist/prosekit-extensions-paragraph.js +60 -0
  62. package/dist/prosekit-extensions-placeholder.d.ts +32 -2
  63. package/dist/prosekit-extensions-placeholder.js +39 -56
  64. package/dist/prosekit-extensions-readonly.d.ts +13 -1
  65. package/dist/prosekit-extensions-readonly.js +13 -14
  66. package/dist/prosekit-extensions-search.d.ts +77 -3
  67. package/dist/prosekit-extensions-search.js +48 -47
  68. package/dist/prosekit-extensions-strike.d.ts +50 -8
  69. package/dist/prosekit-extensions-strike.js +44 -49
  70. package/dist/prosekit-extensions-table.d.ts +237 -26
  71. package/dist/prosekit-extensions-table.js +3 -34
  72. package/dist/prosekit-extensions-text-align.d.ts +72 -8
  73. package/dist/prosekit-extensions-text-align.js +63 -44
  74. package/dist/prosekit-extensions-text.d.ts +22 -0
  75. package/dist/prosekit-extensions-text.js +15 -0
  76. package/dist/prosekit-extensions-underline.d.ts +46 -7
  77. package/dist/prosekit-extensions-underline.js +33 -37
  78. package/dist/prosekit-extensions-virtual-selection.d.ts +24 -2
  79. package/dist/prosekit-extensions-virtual-selection.js +49 -52
  80. package/dist/prosekit-extensions-yjs.d.ts +99 -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 +5 -5
  84. package/dist/search/style.js +0 -0
  85. package/dist/shiki-highlighter-chunk-Cd3WeOKL.d.ts +19 -0
  86. package/dist/shiki-highlighter-chunk.d.ts +2 -0
  87. package/dist/shiki-highlighter-chunk.js +34 -43
  88. package/dist/table/style.css +18 -17
  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 +15 -17
  94. package/dist/yjs/style.js +0 -0
  95. package/package.json +103 -52
  96. package/dist/_tsup-dts-rollup.d.ts +0 -2500
  97. package/dist/chunk-6UYLCVBX.js +0 -185
  98. package/dist/chunk-BV3SHIMW.js +0 -98
  99. package/dist/chunk-D54VSLLS.js +0 -105
  100. package/dist/chunk-HFAZX2J3.js +0 -306
@@ -1,88 +1,76 @@
1
- import {
2
- defineMarkInputRule
3
- } from "./chunk-BV3SHIMW.js";
1
+ import { defineMarkInputRule } from "./input-rule-Gji4N7Oe.js";
2
+ import { canUseRegexLookbehind, defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
4
3
 
5
- // src/bold/bold.ts
6
- import {
7
- union
8
- } from "@prosekit/core";
9
-
10
- // src/bold/bold-commands.ts
11
- import {
12
- defineCommands,
13
- toggleMark
14
- } from "@prosekit/core";
4
+ //#region src/bold/bold-commands.ts
5
+ /**
6
+ * @internal
7
+ */
15
8
  function defineBoldCommands() {
16
- return defineCommands({
17
- toggleBold: () => toggleMark({ type: "bold" })
18
- });
9
+ return defineCommands({ toggleBold: () => toggleMark({ type: "bold" }) });
19
10
  }
20
11
 
21
- // src/bold/bold-input-rule.ts
22
- import { canUseRegexLookbehind } from "@prosekit/core";
12
+ //#endregion
13
+ //#region src/bold/bold-input-rule.ts
14
+ /**
15
+ * @internal
16
+ */
23
17
  function defineBoldInputRule() {
24
- return defineMarkInputRule({
25
- regex: canUseRegexLookbehind() ? /(?<=\s|^)\*\*([^\s*]|[^\s*][^*]*[^\s*])\*\*$/ : /\*\*([^\s*]|[^\s*][^*]*[^\s*])\*\*$/,
26
- type: "bold"
27
- });
18
+ return defineMarkInputRule({
19
+ regex: canUseRegexLookbehind() ? /(?<=\s|^)\*\*([^\s*]|[^\s*][^*]*[^\s*])\*\*$/ : /\*\*([^\s*]|[^\s*][^*]*[^\s*])\*\*$/,
20
+ type: "bold"
21
+ });
28
22
  }
29
23
 
30
- // src/bold/bold-keymap.ts
31
- import {
32
- defineKeymap,
33
- toggleMark as toggleMark2
34
- } from "@prosekit/core";
24
+ //#endregion
25
+ //#region src/bold/bold-keymap.ts
26
+ /**
27
+ * @internal
28
+ */
35
29
  function defineBoldKeymap() {
36
- return defineKeymap({
37
- "Mod-b": toggleMark2({ type: "bold" })
38
- });
30
+ return defineKeymap({ "Mod-b": toggleMark({ type: "bold" }) });
39
31
  }
40
32
 
41
- // src/bold/bold-spec.ts
42
- import {
43
- defineMarkSpec
44
- } from "@prosekit/core";
33
+ //#endregion
34
+ //#region src/bold/bold-spec.ts
35
+ /**
36
+ * @internal
37
+ */
45
38
  function defineBoldSpec() {
46
- return defineMarkSpec({
47
- name: "bold",
48
- parseDOM: [
49
- { tag: "strong" },
50
- // This works around a Google Docs misbehavior where
51
- // pasted content will be inexplicably wrapped in `<b>`
52
- // tags with a font-weight normal.
53
- {
54
- tag: "b",
55
- getAttrs: (node) => {
56
- return typeof node !== "string" && node.style.fontWeight !== "normal" && null;
57
- }
58
- },
59
- { style: "font-weight=400", clearMark: (m) => m.type.name == "strong" },
60
- {
61
- style: "font-weight",
62
- getAttrs: (value) => {
63
- return typeof value === "string" && /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null;
64
- }
65
- }
66
- ],
67
- toDOM() {
68
- return ["strong", 0];
69
- }
70
- });
39
+ return defineMarkSpec({
40
+ name: "bold",
41
+ parseDOM: [
42
+ { tag: "strong" },
43
+ {
44
+ tag: "b",
45
+ getAttrs: (node) => {
46
+ return typeof node !== "string" && node.style.fontWeight !== "normal" && null;
47
+ }
48
+ },
49
+ {
50
+ style: "font-weight=400",
51
+ clearMark: (m) => m.type.name == "strong"
52
+ },
53
+ {
54
+ style: "font-weight",
55
+ getAttrs: (value) => {
56
+ return typeof value === "string" && /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null;
57
+ }
58
+ }
59
+ ],
60
+ toDOM() {
61
+ return ["strong", 0];
62
+ }
63
+ });
71
64
  }
72
65
 
73
- // src/bold/bold.ts
66
+ //#endregion
67
+ //#region src/bold/bold.ts
68
+ /**
69
+ * @public
70
+ */
74
71
  function defineBold() {
75
- return union(
76
- defineBoldSpec(),
77
- defineBoldCommands(),
78
- defineBoldKeymap(),
79
- defineBoldInputRule()
80
- );
72
+ return union(defineBoldSpec(), defineBoldCommands(), defineBoldKeymap(), defineBoldInputRule());
81
73
  }
82
- export {
83
- defineBold,
84
- defineBoldCommands,
85
- defineBoldInputRule,
86
- defineBoldKeymap,
87
- defineBoldSpec
88
- };
74
+
75
+ //#endregion
76
+ export { defineBold, defineBoldCommands, defineBoldInputRule, defineBoldKeymap, defineBoldSpec };
@@ -1,20 +1,172 @@
1
- export { defineCodeBlock_alias_1 as defineCodeBlock } from './_tsup-dts-rollup.js';
2
- export { CodeBlockExtension_alias_1 as CodeBlockExtension } from './_tsup-dts-rollup.js';
3
- export { defineCodeBlockCommands_alias_1 as defineCodeBlockCommands } from './_tsup-dts-rollup.js';
4
- export { CodeBlockCommandsExtension_alias_1 as CodeBlockCommandsExtension } from './_tsup-dts-rollup.js';
5
- export { defineCodeBlockHighlight_alias_1 as defineCodeBlockHighlight } from './_tsup-dts-rollup.js';
6
- export { CodeBlockHighlightOptions_alias_1 as CodeBlockHighlightOptions } from './_tsup-dts-rollup.js';
7
- export { HighlightParser_alias_1 as HighlightParser } from './_tsup-dts-rollup.js';
8
- export { defineCodeBlockEnterRule_alias_1 as defineCodeBlockEnterRule } from './_tsup-dts-rollup.js';
9
- export { defineCodeBlockInputRule_alias_1 as defineCodeBlockInputRule } from './_tsup-dts-rollup.js';
10
- export { defineCodeBlockKeymap_alias_1 as defineCodeBlockKeymap } from './_tsup-dts-rollup.js';
11
- export { defineCodeBlockShiki_alias_1 as defineCodeBlockShiki } from './_tsup-dts-rollup.js';
12
- export { defineCodeBlockSpec_alias_1 as defineCodeBlockSpec } from './_tsup-dts-rollup.js';
13
- export { CodeBlockSpecExtension_alias_1 as CodeBlockSpecExtension } from './_tsup-dts-rollup.js';
14
- export { CodeBlockAttrs_alias_1 as CodeBlockAttrs } from './_tsup-dts-rollup.js';
15
- export { shikiBundledLanguagesInfo } from './_tsup-dts-rollup.js';
16
- export { shikiBundledThemesInfo } from './_tsup-dts-rollup.js';
17
- export { ShikiBundledLanguage } from './_tsup-dts-rollup.js';
18
- export { ShikiBundledLanguageInfo } from './_tsup-dts-rollup.js';
19
- export { ShikiBundledTheme } from './_tsup-dts-rollup.js';
20
- export { ShikiBundledThemeInfo } from './_tsup-dts-rollup.js';
1
+ import { ShikiHighlighterOptions } from "./shiki-highlighter-chunk-Cd3WeOKL.js";
2
+ import { Extension, PlainExtension, Union } from "@prosekit/core";
3
+ import { Parser } from "prosemirror-highlight";
4
+ import { BundledLanguage as ShikiBundledLanguage, BundledLanguageInfo as ShikiBundledLanguageInfo, BundledTheme as ShikiBundledTheme, BundledThemeInfo as ShikiBundledThemeInfo, SpecialLanguage, bundledLanguagesInfo as shikiBundledLanguagesInfo, bundledThemesInfo as shikiBundledThemesInfo } from "shiki";
5
+
6
+ //#region src/code-block/code-block-types.d.ts
7
+ /**
8
+ * The attributes for the `codeBlock` node.
9
+ *
10
+ * @public
11
+ */
12
+ /**
13
+ * The attributes for the `codeBlock` node.
14
+ *
15
+ * @public
16
+ */
17
+ interface CodeBlockAttrs {
18
+ language: string;
19
+ }
20
+
21
+ //#endregion
22
+ //#region src/code-block/code-block-commands.d.ts
23
+ /**
24
+ * @internal
25
+ */
26
+ type CodeBlockCommandsExtension = Extension<{
27
+ Commands: {
28
+ setCodeBlock: [attrs?: CodeBlockAttrs];
29
+ insertCodeBlock: [attrs?: CodeBlockAttrs];
30
+ toggleCodeBlock: [attrs?: CodeBlockAttrs];
31
+ setCodeBlockAttrs: [attrs: CodeBlockAttrs];
32
+ };
33
+ }>;
34
+ /**
35
+ * Adds commands for working with `codeBlock` nodes.
36
+ *
37
+ * @public
38
+ */
39
+ declare function defineCodeBlockCommands(): CodeBlockCommandsExtension;
40
+
41
+ //#endregion
42
+ //#region src/code-block/code-block-spec.d.ts
43
+ /**
44
+ * @internal
45
+ */
46
+ type CodeBlockSpecExtension = Extension<{
47
+ Nodes: {
48
+ codeBlock: CodeBlockAttrs;
49
+ };
50
+ }>;
51
+ /**
52
+ * Defines the `codeBlock` node spec.
53
+ *
54
+ * @public
55
+ */
56
+ declare function defineCodeBlockSpec(): CodeBlockSpecExtension;
57
+
58
+ //#endregion
59
+ //#region src/code-block/code-block.d.ts
60
+ /**
61
+ * @internal
62
+ */
63
+ type CodeBlockExtension = Union<[CodeBlockSpecExtension, CodeBlockCommandsExtension]>;
64
+ /**
65
+ * Adds `codeBlock` nodes to the editor. This includes the following extensions:
66
+ *
67
+ * - {@link defineCodeBlockSpec}
68
+ * - {@link defineCodeBlockInputRule}
69
+ * - {@link defineCodeBlockEnterRule}
70
+ * - {@link defineCodeBlockKeymap}
71
+ * - {@link defineCodeBlockCommands}.
72
+ *
73
+ * @public
74
+ */
75
+ declare function defineCodeBlock(): CodeBlockExtension;
76
+
77
+ //#endregion
78
+ //#region src/code-block/code-block-highlight.d.ts
79
+ /**
80
+ * @public
81
+ *
82
+ * An alias for the `Parser` type from the `prosemirror-highlight` package.
83
+ */
84
+ type HighlightParser = Parser;
85
+ /**
86
+ * @public
87
+ */
88
+ type CodeBlockHighlightOptions = {
89
+ parser: HighlightParser;
90
+ };
91
+ /**
92
+ * Adds syntax highlighting to code blocks. This function requires a `Parser`
93
+ * instance from the `prosemirror-highlight` package. See the
94
+ * [documentation](https://github.com/ocavue/prosemirror-highlight) for more
95
+ * information.
96
+ *
97
+ * @param options
98
+ *
99
+ * @public
100
+ */
101
+ declare function defineCodeBlockHighlight({
102
+ parser
103
+ }: CodeBlockHighlightOptions): Extension;
104
+
105
+ //#endregion
106
+ //#region src/code-block/code-block-input-rule.d.ts
107
+ /**
108
+ * Adds input rules for `codeBlock` nodes.
109
+ *
110
+ * @public
111
+ */
112
+ declare function defineCodeBlockInputRule(): PlainExtension;
113
+ /**
114
+ * Adds enter rules for `codeBlock` nodes.
115
+ *
116
+ * @public
117
+ */
118
+ declare function defineCodeBlockEnterRule(): PlainExtension;
119
+
120
+ //#endregion
121
+ //#region src/code-block/code-block-keymap.d.ts
122
+ /**
123
+ * Defines the keymap for code blocks.
124
+ */
125
+ declare function defineCodeBlockKeymap(): PlainExtension;
126
+
127
+ //#endregion
128
+ //#region src/code-block/code-block-shiki.d.ts
129
+ /**
130
+ * The options to configure the Shiki highlighter.
131
+ *
132
+ * @public
133
+ */
134
+ interface CodeBlockShikiOptions extends Omit<ShikiHighlighterOptions, "themes" | "langs" | "engine"> {
135
+ /**
136
+ * A list of Shiki themes to pre-load. The first theme in the list will be
137
+ * used to render the code block.
138
+ *
139
+ * @default ['one-dark-pro']
140
+ */
141
+ themes?: ShikiBundledTheme[];
142
+ /**
143
+ * A list of Shiki languages to pre-load.
144
+ *
145
+ * @default ['text']
146
+ */
147
+ langs?: (ShikiBundledLanguage | SpecialLanguage)[];
148
+ /**
149
+ * The RegExp engine to use. By default, the JavaScript engine is used.
150
+ */
151
+ engine?: ShikiHighlighterOptions["engine"];
152
+ }
153
+ /**
154
+ * Adds syntax highlighting to code blocks using the [Shiki](https://github.com/shikijs/shiki) package.
155
+ *
156
+ * It will set two CSS variables on the code block elements:
157
+ *
158
+ * - `--prosemirror-highlight`: sets text color
159
+ * - `--prosemirror-highlight-bg`: sets background color
160
+ *
161
+ * @param options - The options to configure the Shiki highlighter.
162
+ *
163
+ * @public
164
+ */
165
+ declare function defineCodeBlockShiki({
166
+ themes,
167
+ langs,
168
+ ...rest
169
+ }?: CodeBlockShikiOptions): Extension;
170
+
171
+ //#endregion
172
+ export { CodeBlockAttrs, CodeBlockCommandsExtension, CodeBlockExtension, CodeBlockHighlightOptions, CodeBlockSpecExtension, HighlightParser, ShikiBundledLanguage, ShikiBundledLanguageInfo, ShikiBundledTheme, ShikiBundledThemeInfo, defineCodeBlock, defineCodeBlockCommands, defineCodeBlockEnterRule, defineCodeBlockHighlight, defineCodeBlockInputRule, defineCodeBlockKeymap, defineCodeBlockShiki, defineCodeBlockSpec, shikiBundledLanguagesInfo, shikiBundledThemesInfo };