@prosekit/extensions 0.7.7 → 0.7.9

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.
@@ -174,6 +174,15 @@ CodeBlockCommandsExtension
174
174
  export { CodeBlockExtension }
175
175
  export { CodeBlockExtension as CodeBlockExtension_alias_1 }
176
176
 
177
+ /**
178
+ * @public
179
+ */
180
+ declare type CodeBlockHighlightOptions = {
181
+ parser: HighlightParser;
182
+ };
183
+ export { CodeBlockHighlightOptions }
184
+ export { CodeBlockHighlightOptions as CodeBlockHighlightOptions_alias_1 }
185
+
177
186
  /**
178
187
  * @public
179
188
  */
@@ -379,11 +388,11 @@ export { defineCodeBlockEnterRule as defineCodeBlockEnterRule_alias_1 }
379
388
  * [documentation](https://github.com/ocavue/prosemirror-highlight) for more
380
389
  * information.
381
390
  *
391
+ * @param options
392
+ *
382
393
  * @public
383
394
  */
384
- declare function defineCodeBlockHighlight({ parser, }: {
385
- parser: HighlightParser;
386
- }): Extension;
395
+ declare function defineCodeBlockHighlight({ parser, }: CodeBlockHighlightOptions): Extension;
387
396
  export { defineCodeBlockHighlight }
388
397
  export { defineCodeBlockHighlight as defineCodeBlockHighlight_alias_1 }
389
398
 
@@ -404,6 +413,8 @@ export declare function defineCodeBlockKeymap(): PlainExtension;
404
413
  /**
405
414
  * Adds syntax highlighting to code blocks using the [shiki](https://github.com/shikijs/shiki) package.
406
415
  *
416
+ * @param options
417
+ *
407
418
  * @public
408
419
  */
409
420
  declare function defineCodeBlockShiki({ themes, langs, langAlias, }?: CodeBlockShikiOptions): Extension;
@@ -463,9 +474,11 @@ export declare function defineDropCursor(options?: DropCursorOptions): DropCurso
463
474
  * the cursor matches `regex` and user presses Enter. The `regex` should end
464
475
  * with `$`.
465
476
  *
477
+ * @param options
478
+ *
466
479
  * @public
467
480
  */
468
- export declare function defineEnterRule(options: EnterRuleOptions): PlainExtension;
481
+ export declare function defineEnterRule({ regex, handler, stop, }: EnterRuleOptions): PlainExtension;
469
482
 
470
483
  /**
471
484
  * Capture clicks near and arrow-key-motion past places that don't have a
@@ -836,9 +849,11 @@ export declare function defineTextAlignKeymap(types: string[]): PlainExtension;
836
849
  *
837
850
  * See also {@link defineEnterRule}.
838
851
  *
852
+ * @param options
853
+ *
839
854
  * @public
840
855
  */
841
- export declare function defineTextBlockEnterRule(options: TextBlockEnterRuleOptions): PlainExtension;
856
+ export declare function defineTextBlockEnterRule({ regex, type, attrs, stop, }: TextBlockEnterRuleOptions): PlainExtension;
842
857
 
843
858
  /**
844
859
  * Defines an input rule that changes the type of a textblock when the matched
@@ -846,6 +861,8 @@ export declare function defineTextBlockEnterRule(options: TextBlockEnterRuleOpti
846
861
  *
847
862
  * See also [textblockTypeInputRule](https://prosemirror.net/docs/ref/#inputrules.textblockTypeInputRule)
848
863
  *
864
+ * @param options
865
+ *
849
866
  * @public
850
867
  */
851
868
  export declare function defineTextBlockInputRule({ regex, type, attrs, }: {
@@ -903,6 +920,8 @@ export declare function defineVirtualSelection(): VirtualSelectionExtension;
903
920
  *
904
921
  * See also [wrappingInputRule](https://prosemirror.net/docs/ref/#inputrules.wrappingInputRule)
905
922
  *
923
+ * @param options
924
+ *
906
925
  * @public
907
926
  */
908
927
  export declare function defineWrappingInputRule({ regex, type, attrs, join, }: {
@@ -13,13 +13,20 @@ import {
13
13
  PluginKey,
14
14
  ProseMirrorPlugin
15
15
  } from "@prosekit/pm/state";
16
- function defineEnterRule(options) {
17
- const { regex, handler, stop = false } = options;
16
+ function defineEnterRule({
17
+ regex,
18
+ handler,
19
+ stop = false
20
+ }) {
18
21
  const rule = new EnterRule(regex, handler, stop);
19
22
  return defineFacetPayload(enterRule, [rule]);
20
23
  }
21
- function defineTextBlockEnterRule(options) {
22
- const { regex, type, attrs, stop = true } = options;
24
+ function defineTextBlockEnterRule({
25
+ regex,
26
+ type,
27
+ attrs,
28
+ stop = true
29
+ }) {
23
30
  return defineEnterRule({
24
31
  regex,
25
32
  handler: ({ state, from, to, match }) => {
@@ -3,6 +3,7 @@ export { CodeBlockExtension_alias_1 as CodeBlockExtension } from './_tsup-dts-ro
3
3
  export { defineCodeBlockCommands_alias_1 as defineCodeBlockCommands } from './_tsup-dts-rollup';
4
4
  export { CodeBlockCommandsExtension_alias_1 as CodeBlockCommandsExtension } from './_tsup-dts-rollup';
5
5
  export { defineCodeBlockHighlight_alias_1 as defineCodeBlockHighlight } from './_tsup-dts-rollup';
6
+ export { CodeBlockHighlightOptions_alias_1 as CodeBlockHighlightOptions } from './_tsup-dts-rollup';
6
7
  export { HighlightParser_alias_1 as HighlightParser } from './_tsup-dts-rollup';
7
8
  export { defineCodeBlockEnterRule_alias_1 as defineCodeBlockEnterRule } from './_tsup-dts-rollup';
8
9
  export { defineCodeBlockInputRule_alias_1 as defineCodeBlockInputRule } from './_tsup-dts-rollup';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineTextBlockEnterRule
3
- } from "./chunk-5H7DHO2K.js";
3
+ } from "./chunk-RE23OQPF.js";
4
4
  import {
5
5
  defineTextBlockInputRule
6
6
  } from "./chunk-J57QWYYX.js";
@@ -1,6 +1,6 @@
1
1
  // src/commit/index.ts
2
2
  import {
3
- collectNodes,
3
+ collectChildren,
4
4
  defineDefaultState,
5
5
  definePlugin,
6
6
  jsonFromNode,
@@ -48,7 +48,7 @@ function decorateDeletionSlice(slice) {
48
48
  ];
49
49
  }
50
50
  if (openStart > 0 && content.childCount >= 2) {
51
- const nodes = collectNodes(content);
51
+ const nodes = collectChildren(content);
52
52
  const head = Fragment.from(nodes.slice(0, 1));
53
53
  const body = Fragment.from(nodes.slice(1));
54
54
  return [
@@ -57,7 +57,7 @@ function decorateDeletionSlice(slice) {
57
57
  ];
58
58
  }
59
59
  if (openEnd > 0 && content.childCount >= 2) {
60
- const nodes = collectNodes(content);
60
+ const nodes = collectChildren(content);
61
61
  const body = Fragment.from(nodes.slice(0, -1));
62
62
  const tail = Fragment.from(nodes.slice(-1));
63
63
  return [
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineEnterRule,
3
3
  defineTextBlockEnterRule
4
- } from "./chunk-5H7DHO2K.js";
4
+ } from "./chunk-RE23OQPF.js";
5
5
  export {
6
6
  defineEnterRule,
7
7
  defineTextBlockEnterRule
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GPSAJOJA.js";
4
4
  import {
5
5
  defineEnterRule
6
- } from "./chunk-5H7DHO2K.js";
6
+ } from "./chunk-RE23OQPF.js";
7
7
  import {
8
8
  defineInputRule
9
9
  } from "./chunk-J57QWYYX.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.7.7",
4
+ "version": "0.7.9",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -193,13 +193,13 @@
193
193
  "prosemirror-highlight": "^0.8.0",
194
194
  "prosemirror-search": "^1.0.0",
195
195
  "prosemirror-tables": "^1.4.0",
196
- "shiki": "^1.11.1",
197
- "@prosekit/core": "^0.7.6",
198
- "@prosekit/pm": "^0.1.7"
196
+ "shiki": "^1.12.0",
197
+ "@prosekit/core": "^0.7.8",
198
+ "@prosekit/pm": "^0.1.8"
199
199
  },
200
200
  "devDependencies": {
201
201
  "@vitest/browser": "^2.0.4",
202
- "tsup": "^8.2.2",
202
+ "tsup": "^8.2.3",
203
203
  "type-fest": "^4.23.0",
204
204
  "typescript": "^5.5.3",
205
205
  "vitest": "^2.0.4",