@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,88 +1,76 @@
1
- import {
2
- defineMarkInputRule
3
- } from "./chunk-I2UMHK3L.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,159 @@
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-CZGvZlhf.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
+ interface CodeBlockAttrs {
13
+ language: string;
14
+ }
15
+ //#endregion
16
+ //#region src/code-block/code-block-commands.d.ts
17
+ /**
18
+ * @internal
19
+ */
20
+ type CodeBlockCommandsExtension = Extension<{
21
+ Commands: {
22
+ setCodeBlock: [attrs?: CodeBlockAttrs];
23
+ insertCodeBlock: [attrs?: CodeBlockAttrs];
24
+ toggleCodeBlock: [attrs?: CodeBlockAttrs];
25
+ setCodeBlockAttrs: [attrs: CodeBlockAttrs];
26
+ };
27
+ }>;
28
+ /**
29
+ * Adds commands for working with `codeBlock` nodes.
30
+ *
31
+ * @public
32
+ */
33
+ declare function defineCodeBlockCommands(): CodeBlockCommandsExtension;
34
+ //#endregion
35
+ //#region src/code-block/code-block-spec.d.ts
36
+ /**
37
+ * @internal
38
+ */
39
+ type CodeBlockSpecExtension = Extension<{
40
+ Nodes: {
41
+ codeBlock: CodeBlockAttrs;
42
+ };
43
+ }>;
44
+ /**
45
+ * Defines the `codeBlock` node spec.
46
+ *
47
+ * @public
48
+ */
49
+ declare function defineCodeBlockSpec(): CodeBlockSpecExtension;
50
+ //#endregion
51
+ //#region src/code-block/code-block.d.ts
52
+ /**
53
+ * @internal
54
+ */
55
+ type CodeBlockExtension = Union<[CodeBlockSpecExtension, CodeBlockCommandsExtension]>;
56
+ /**
57
+ * Adds `codeBlock` nodes to the editor. This includes the following extensions:
58
+ *
59
+ * - {@link defineCodeBlockSpec}
60
+ * - {@link defineCodeBlockInputRule}
61
+ * - {@link defineCodeBlockEnterRule}
62
+ * - {@link defineCodeBlockKeymap}
63
+ * - {@link defineCodeBlockCommands}.
64
+ *
65
+ * @public
66
+ */
67
+ declare function defineCodeBlock(): CodeBlockExtension;
68
+ //#endregion
69
+ //#region src/code-block/code-block-highlight.d.ts
70
+ /**
71
+ * @public
72
+ *
73
+ * An alias for the `Parser` type from the `prosemirror-highlight` package.
74
+ */
75
+ type HighlightParser = Parser;
76
+ /**
77
+ * @public
78
+ */
79
+ type CodeBlockHighlightOptions = {
80
+ parser: HighlightParser;
81
+ };
82
+ /**
83
+ * Adds syntax highlighting to code blocks. This function requires a `Parser`
84
+ * instance from the `prosemirror-highlight` package. See the
85
+ * [documentation](https://github.com/ocavue/prosemirror-highlight) for more
86
+ * information.
87
+ *
88
+ * @param options
89
+ *
90
+ * @public
91
+ */
92
+ declare function defineCodeBlockHighlight({
93
+ parser
94
+ }: CodeBlockHighlightOptions): Extension;
95
+ //#endregion
96
+ //#region src/code-block/code-block-input-rule.d.ts
97
+ /**
98
+ * Adds input rules for `codeBlock` nodes.
99
+ *
100
+ * @public
101
+ */
102
+ declare function defineCodeBlockInputRule(): PlainExtension;
103
+ /**
104
+ * Adds enter rules for `codeBlock` nodes.
105
+ *
106
+ * @public
107
+ */
108
+ declare function defineCodeBlockEnterRule(): PlainExtension;
109
+ //#endregion
110
+ //#region src/code-block/code-block-keymap.d.ts
111
+ /**
112
+ * Defines the keymap for code blocks.
113
+ */
114
+ declare function defineCodeBlockKeymap(): PlainExtension;
115
+ //#endregion
116
+ //#region src/code-block/code-block-shiki.d.ts
117
+ /**
118
+ * The options to configure the Shiki highlighter.
119
+ *
120
+ * @public
121
+ */
122
+ interface CodeBlockShikiOptions extends Omit<ShikiHighlighterOptions, "themes" | "langs" | "engine"> {
123
+ /**
124
+ * A list of Shiki themes to pre-load. The first theme in the list will be
125
+ * used to render the code block.
126
+ *
127
+ * @default ['one-dark-pro']
128
+ */
129
+ themes?: ShikiBundledTheme[];
130
+ /**
131
+ * A list of Shiki languages to pre-load.
132
+ *
133
+ * @default ['text']
134
+ */
135
+ langs?: (ShikiBundledLanguage | SpecialLanguage)[];
136
+ /**
137
+ * The RegExp engine to use. By default, the JavaScript engine is used.
138
+ */
139
+ engine?: ShikiHighlighterOptions["engine"];
140
+ }
141
+ /**
142
+ * Adds syntax highlighting to code blocks using the [Shiki](https://github.com/shikijs/shiki) package.
143
+ *
144
+ * It will set two CSS variables on the code block elements:
145
+ *
146
+ * - `--prosemirror-highlight`: sets text color
147
+ * - `--prosemirror-highlight-bg`: sets background color
148
+ *
149
+ * @param options - The options to configure the Shiki highlighter.
150
+ *
151
+ * @public
152
+ */
153
+ declare function defineCodeBlockShiki({
154
+ themes,
155
+ langs,
156
+ ...rest
157
+ }?: CodeBlockShikiOptions): Extension;
158
+ //#endregion
159
+ export { CodeBlockAttrs, CodeBlockCommandsExtension, CodeBlockExtension, CodeBlockHighlightOptions, CodeBlockSpecExtension, HighlightParser, ShikiBundledLanguage, ShikiBundledLanguageInfo, ShikiBundledTheme, ShikiBundledThemeInfo, defineCodeBlock, defineCodeBlockCommands, defineCodeBlockEnterRule, defineCodeBlockHighlight, defineCodeBlockInputRule, defineCodeBlockKeymap, defineCodeBlockShiki, defineCodeBlockSpec, shikiBundledLanguagesInfo, shikiBundledThemesInfo };