@prosekit/core 0.10.0 → 0.11.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 (132) hide show
  1. package/dist/{editor-BULC1zqX.d.ts → editor.d.ts} +48 -8
  2. package/dist/editor.d.ts.map +1 -0
  3. package/dist/{editor-g-Rqn-ZE.js → editor.js} +19 -60
  4. package/dist/editor.js.map +1 -0
  5. package/dist/prosekit-core-test.d.ts +1 -1
  6. package/dist/prosekit-core-test.js +2 -4
  7. package/dist/prosekit-core-test.js.map +1 -1
  8. package/dist/prosekit-core.d.ts +69 -68
  9. package/dist/prosekit-core.d.ts.map +1 -1
  10. package/dist/prosekit-core.js +100 -135
  11. package/dist/prosekit-core.js.map +1 -1
  12. package/package.json +8 -7
  13. package/src/commands/add-mark.ts +2 -2
  14. package/src/commands/expand-mark.ts +1 -1
  15. package/src/commands/insert-default-block.spec.ts +3 -3
  16. package/src/commands/insert-default-block.ts +1 -1
  17. package/src/commands/insert-node.ts +3 -3
  18. package/src/commands/remove-mark.ts +2 -2
  19. package/src/commands/remove-node.ts +2 -2
  20. package/src/commands/select-block.spec.ts +2 -2
  21. package/src/commands/select-block.ts +1 -1
  22. package/src/commands/set-block-type.ts +2 -2
  23. package/src/commands/set-node-attrs-between.spec.ts +2 -2
  24. package/src/commands/set-node-attrs-between.ts +1 -1
  25. package/src/commands/set-node-attrs.spec.ts +2 -2
  26. package/src/commands/set-node-attrs.ts +2 -2
  27. package/src/commands/toggle-mark.ts +2 -2
  28. package/src/commands/toggle-node.ts +2 -2
  29. package/src/commands/toggle-wrap.spec.ts +1 -1
  30. package/src/commands/toggle-wrap.ts +2 -2
  31. package/src/commands/unset-block-type.spec.ts +1 -1
  32. package/src/commands/unset-block-type.ts +1 -1
  33. package/src/commands/unset-mark.spec.ts +1 -1
  34. package/src/commands/unset-mark.ts +1 -1
  35. package/src/commands/wrap.ts +1 -1
  36. package/src/editor/action.spec.ts +3 -3
  37. package/src/editor/action.ts +6 -6
  38. package/src/editor/editor.spec.ts +5 -5
  39. package/src/editor/editor.ts +13 -13
  40. package/src/editor/union.spec.ts +7 -7
  41. package/src/editor/union.ts +4 -4
  42. package/src/editor/with-priority.ts +3 -3
  43. package/src/error.ts +8 -1
  44. package/src/extensions/clipboard-serializer.ts +17 -9
  45. package/src/extensions/command.ts +19 -19
  46. package/src/extensions/default-state.spec.ts +3 -3
  47. package/src/extensions/default-state.ts +5 -5
  48. package/src/extensions/events/doc-change.ts +2 -2
  49. package/src/extensions/events/dom-event.spec.ts +3 -3
  50. package/src/extensions/events/dom-event.ts +7 -7
  51. package/src/extensions/events/editor-event.ts +6 -6
  52. package/src/extensions/events/focus.spec.ts +4 -4
  53. package/src/extensions/events/focus.ts +2 -2
  54. package/src/extensions/events/plugin-view.ts +4 -4
  55. package/src/extensions/history.ts +6 -6
  56. package/src/extensions/keymap-base.spec.ts +5 -5
  57. package/src/extensions/keymap-base.ts +6 -6
  58. package/src/extensions/keymap.spec.ts +5 -5
  59. package/src/extensions/keymap.ts +4 -4
  60. package/src/extensions/mark-spec.spec.ts +3 -3
  61. package/src/extensions/mark-spec.ts +8 -8
  62. package/src/extensions/mark-view-effect.ts +4 -4
  63. package/src/extensions/mark-view.ts +4 -4
  64. package/src/extensions/node-spec.spec.ts +5 -5
  65. package/src/extensions/node-spec.ts +8 -8
  66. package/src/extensions/node-view-effect.ts +4 -4
  67. package/src/extensions/node-view.ts +4 -4
  68. package/src/extensions/plugin.spec.ts +5 -5
  69. package/src/extensions/plugin.ts +5 -5
  70. package/src/facets/base-extension.ts +7 -7
  71. package/src/facets/command.ts +3 -3
  72. package/src/facets/facet-extension.spec.ts +6 -6
  73. package/src/facets/facet-extension.ts +12 -8
  74. package/src/facets/facet-node.spec.ts +3 -3
  75. package/src/facets/facet-node.ts +24 -14
  76. package/src/facets/facet.spec.ts +1 -1
  77. package/src/facets/facet.ts +14 -7
  78. package/src/facets/root.ts +2 -2
  79. package/src/facets/schema-spec.ts +2 -2
  80. package/src/facets/schema.ts +3 -3
  81. package/src/facets/state.spec.ts +6 -6
  82. package/src/facets/state.ts +3 -3
  83. package/src/facets/union-extension.ts +9 -6
  84. package/src/index.ts +74 -74
  85. package/src/test/index.ts +1 -1
  86. package/src/test/test-builder.ts +2 -2
  87. package/src/test/test-editor.spec.ts +1 -1
  88. package/src/test/test-editor.ts +6 -6
  89. package/src/testing/index.ts +10 -10
  90. package/src/types/extension-mark.ts +1 -1
  91. package/src/types/extension-node.ts +1 -1
  92. package/src/types/extension.spec.ts +2 -2
  93. package/src/types/extension.ts +8 -8
  94. package/src/types/pick-string-literal.spec.ts +2 -2
  95. package/src/types/pick-string-literal.ts +1 -1
  96. package/src/types/pick-sub-type.spec.ts +2 -2
  97. package/src/types/priority.ts +50 -7
  98. package/src/types/simplify-deeper.spec.ts +2 -2
  99. package/src/types/simplify-union.spec.ts +2 -2
  100. package/src/utils/array-grouping.spec.ts +1 -1
  101. package/src/utils/assert.ts +1 -1
  102. package/src/utils/can-use-regex-lookbehind.ts +2 -8
  103. package/src/utils/clsx.spec.ts +1 -1
  104. package/src/utils/combine-event-handlers.spec.ts +1 -1
  105. package/src/utils/editor-content.spec.ts +2 -2
  106. package/src/utils/editor-content.ts +4 -4
  107. package/src/utils/find-parent-node-of-type.ts +2 -2
  108. package/src/utils/find-parent-node.spec.ts +2 -2
  109. package/src/utils/get-dom-api.ts +1 -1
  110. package/src/utils/get-mark-type.ts +1 -1
  111. package/src/utils/get-node-type.ts +1 -1
  112. package/src/utils/get-node-types.ts +1 -1
  113. package/src/utils/includes-mark.ts +1 -1
  114. package/src/utils/is-mark-absent.spec.ts +2 -2
  115. package/src/utils/is-mark-absent.ts +1 -1
  116. package/src/utils/is-mark-active.ts +3 -3
  117. package/src/utils/is-node-active.spec.ts +2 -2
  118. package/src/utils/is-node-active.ts +3 -3
  119. package/src/utils/is-subset.spec.ts +1 -1
  120. package/src/utils/maybe-run.spec.ts +1 -1
  121. package/src/utils/merge-objects.spec.ts +1 -1
  122. package/src/utils/merge-objects.ts +1 -1
  123. package/src/utils/merge-specs.ts +1 -1
  124. package/src/utils/object-equal.spec.ts +1 -1
  125. package/src/utils/output-spec.test.ts +1 -1
  126. package/src/utils/parse.spec.ts +3 -3
  127. package/src/utils/parse.ts +3 -3
  128. package/src/utils/remove-undefined-values.spec.ts +1 -1
  129. package/src/utils/unicode.spec.ts +1 -1
  130. package/src/utils/with-skip-code-block.ts +1 -1
  131. package/dist/editor-BULC1zqX.d.ts.map +0 -1
  132. package/dist/editor-g-Rqn-ZE.js.map +0 -1
@@ -1,15 +1,14 @@
1
- import { A as isFragment, B as EditorNotFoundError, C as defineFacetPayload, D as Priority, E as defineFacet, F as isSlice, I as isTextSelection, L as getNodeType, M as isNodeSelection, N as isProseMirrorNode, O as isNodeActive, P as isSelection, R as assert, S as stateFacet, T as rootFacet, V as ProseKitError, _ as jsonFromState, a as union, b as nodeFromJSON, c as isMarkActive, d as elementFromJSON, f as elementFromNode, g as jsonFromNode, h as jsonFromHTML, j as isMark, k as isAllSelection, l as isMarkAbsent, m as htmlFromNode, p as htmlFromJSON, r as createEditor, t as Editor, u as defineDefaultState, v as nodeFromElement, w as schemaFacet, x as stateFromJSON, y as nodeFromHTML, z as getMarkType } from "./editor-g-Rqn-ZE.js";
1
+ import { A as isMark, B as ProseKitError, C as defineFacetPayload, D as isNodeActive, E as defineFacet, F as isTextSelection, I as getNodeType, L as assert, M as isProseMirrorNode, N as isSelection, O as isAllSelection, P as isSlice, R as getMarkType, S as stateFacet, T as rootFacet, _ as jsonFromState, a as union, b as nodeFromJSON, c as isMarkActive, d as elementFromJSON, f as elementFromNode, g as jsonFromNode, h as jsonFromHTML, j as isNodeSelection, k as isFragment, l as isMarkAbsent, m as htmlFromNode, p as htmlFromJSON, r as createEditor, t as Editor, u as defineDefaultState, v as nodeFromElement, w as schemaFacet, x as stateFromJSON, y as nodeFromHTML, z as EditorNotFoundError } from "./editor.js";
2
2
  import { Plugin, PluginKey, ProseMirrorPlugin, TextSelection } from "@prosekit/pm/state";
3
3
  import { DOMSerializer, Fragment, Slice } from "@prosekit/pm/model";
4
4
  import { ReplaceAroundStep, dropPoint, findWrapping } from "@prosekit/pm/transform";
5
5
  import { baseKeymap, chainCommands, createParagraphNear, deleteSelection, joinTextblockBackward, lift, liftEmptyBlock, newlineInCode, selectAll as selectAll$1, selectNodeBackward, setBlockType as setBlockType$1, toggleMark as toggleMark$1 } from "@prosekit/pm/commands";
6
- import { isElementLike, isNotNullish, mapGroupBy, once } from "@ocavue/utils";
6
+ import { isElementLike, isNotNullish, mapGroupBy, supportsRegexLookbehind } from "@ocavue/utils";
7
7
  import { history, redo, undo } from "@prosekit/pm/history";
8
8
  import { keydownHandler } from "@prosekit/pm/keymap";
9
9
  import { splitSplittableBlock } from "prosemirror-splittable";
10
10
  import OrderedMap from "orderedmap";
11
11
  import clsxLite from "clsx/lite";
12
-
13
12
  //#region src/commands/add-mark.ts
14
13
  /**
15
14
  * Returns a command that adds the given mark with the given attributes.
@@ -26,7 +25,6 @@ function addMark(options) {
26
25
  return true;
27
26
  };
28
27
  }
29
-
30
28
  //#endregion
31
29
  //#region src/commands/expand-mark.ts
32
30
  /**
@@ -64,7 +62,6 @@ function expandMarkAfter($pos, predicate) {
64
62
  else break;
65
63
  return $pos.posAtIndex(boundaryIndex) + parent.child(boundaryIndex).nodeSize;
66
64
  }
67
-
68
65
  //#endregion
69
66
  //#region src/utils/default-block-at.ts
70
67
  /**
@@ -77,7 +74,6 @@ function defaultBlockAt(match) {
77
74
  }
78
75
  return null;
79
76
  }
80
-
81
77
  //#endregion
82
78
  //#region src/commands/insert-default-block.ts
83
79
  /**
@@ -107,7 +103,6 @@ function insertDefaultBlock(options) {
107
103
  return true;
108
104
  };
109
105
  }
110
-
111
106
  //#endregion
112
107
  //#region src/utils/set-selection-around.ts
113
108
  function setSelectionAround(tr, pos) {
@@ -116,7 +111,6 @@ function setSelectionAround(tr, pos) {
116
111
  const selection = TextSelection.between($pos, $pos);
117
112
  tr.setSelection(selection);
118
113
  }
119
-
120
114
  //#endregion
121
115
  //#region src/commands/insert-node.ts
122
116
  /**
@@ -139,7 +133,6 @@ function insertNode(options) {
139
133
  return true;
140
134
  };
141
135
  }
142
-
143
136
  //#endregion
144
137
  //#region src/commands/remove-mark.ts
145
138
  /**
@@ -158,7 +151,6 @@ function removeMark(options) {
158
151
  return true;
159
152
  };
160
153
  }
161
-
162
154
  //#endregion
163
155
  //#region src/utils/find-parent-node.ts
164
156
  /**
@@ -177,7 +169,6 @@ function findParentNode(predicate, $pos) {
177
169
  };
178
170
  }
179
171
  }
180
-
181
172
  //#endregion
182
173
  //#region src/utils/get-node-types.ts
183
174
  /**
@@ -187,7 +178,6 @@ function getNodeTypes(schema, types) {
187
178
  if (Array.isArray(types)) return types.map((type) => getNodeType(schema, type));
188
179
  return [getNodeType(schema, types)];
189
180
  }
190
-
191
181
  //#endregion
192
182
  //#region src/utils/find-parent-node-of-type.ts
193
183
  /**
@@ -199,7 +189,6 @@ function findParentNodeOfType(type, $pos) {
199
189
  const nodeTypes = getNodeTypes($pos.doc.type.schema, type);
200
190
  return findParentNode((node) => nodeTypes.includes(node.type), $pos);
201
191
  }
202
-
203
192
  //#endregion
204
193
  //#region src/commands/remove-node.ts
205
194
  /**
@@ -217,7 +206,6 @@ function removeNode(options) {
217
206
  return true;
218
207
  };
219
208
  }
220
-
221
209
  //#endregion
222
210
  //#region src/commands/select-all.ts
223
211
  /**
@@ -228,7 +216,6 @@ function removeNode(options) {
228
216
  function selectAll() {
229
217
  return selectAll$1;
230
218
  }
231
-
232
219
  //#endregion
233
220
  //#region src/commands/select-block.ts
234
221
  function getTextblockEndpoint(selection, side) {
@@ -267,7 +254,6 @@ const selectBlockCommand = (state, dispatch) => {
267
254
  function selectBlock() {
268
255
  return selectBlockCommand;
269
256
  }
270
-
271
257
  //#endregion
272
258
  //#region src/utils/get-custom-selection.ts
273
259
  function getCustomSelection(state, from, to) {
@@ -279,7 +265,6 @@ function getCustomSelection(state, from, to) {
279
265
  }
280
266
  return state.selection;
281
267
  }
282
-
283
268
  //#endregion
284
269
  //#region src/commands/set-block-type.ts
285
270
  /**
@@ -318,38 +303,6 @@ function setBlockType(options) {
318
303
  return true;
319
304
  };
320
305
  }
321
-
322
- //#endregion
323
- //#region src/commands/set-node-attrs.ts
324
- /**
325
- * Returns a command that sets the attributes of the current node.
326
- *
327
- * @param options
328
- *
329
- * @public
330
- */
331
- function setNodeAttrs({ type, attrs, pos }) {
332
- return (state, dispatch) => {
333
- let updatePos;
334
- if (pos == null) {
335
- const found = findParentNodeOfType(type, state.selection.$anchor);
336
- if (!found) return false;
337
- updatePos = found.pos;
338
- } else {
339
- const found = state.doc.nodeAt(pos);
340
- if (!found) return false;
341
- if (!getNodeTypes(state.schema, type).includes(found.type)) return false;
342
- updatePos = pos;
343
- }
344
- if (dispatch) {
345
- const { tr } = state;
346
- for (const [key, value] of Object.entries(attrs)) tr.setNodeAttribute(updatePos, key, value);
347
- dispatch(tr);
348
- }
349
- return true;
350
- };
351
- }
352
-
353
306
  //#endregion
354
307
  //#region src/commands/set-node-attrs-between.ts
355
308
  /**
@@ -384,7 +337,36 @@ function setNodeAttrsBetween(options) {
384
337
  return true;
385
338
  };
386
339
  }
387
-
340
+ //#endregion
341
+ //#region src/commands/set-node-attrs.ts
342
+ /**
343
+ * Returns a command that sets the attributes of the current node.
344
+ *
345
+ * @param options
346
+ *
347
+ * @public
348
+ */
349
+ function setNodeAttrs({ type, attrs, pos }) {
350
+ return (state, dispatch) => {
351
+ let updatePos;
352
+ if (pos == null) {
353
+ const found = findParentNodeOfType(type, state.selection.$anchor);
354
+ if (!found) return false;
355
+ updatePos = found.pos;
356
+ } else {
357
+ const found = state.doc.nodeAt(pos);
358
+ if (!found) return false;
359
+ if (!getNodeTypes(state.schema, type).includes(found.type)) return false;
360
+ updatePos = pos;
361
+ }
362
+ if (dispatch) {
363
+ const { tr } = state;
364
+ for (const [key, value] of Object.entries(attrs)) tr.setNodeAttribute(updatePos, key, value);
365
+ dispatch(tr);
366
+ }
367
+ return true;
368
+ };
369
+ }
388
370
  //#endregion
389
371
  //#region src/commands/toggle-mark.ts
390
372
  /**
@@ -402,7 +384,6 @@ function toggleMark({ type, attrs, removeWhenPresent = false, enterInlineAtoms =
402
384
  })(state, dispatch, view);
403
385
  };
404
386
  }
405
-
406
387
  //#endregion
407
388
  //#region src/commands/toggle-node.ts
408
389
  /**
@@ -422,7 +403,6 @@ function toggleNode({ type, attrs }) {
422
403
  } else return setBlockType$1(getNodeType(state.schema, type), attrs)(state, dispatch, view);
423
404
  };
424
405
  }
425
-
426
406
  //#endregion
427
407
  //#region src/commands/wrap.ts
428
408
  /**
@@ -443,7 +423,6 @@ function wrap(options) {
443
423
  return true;
444
424
  };
445
425
  }
446
-
447
426
  //#endregion
448
427
  //#region src/commands/toggle-wrap.ts
449
428
  /**
@@ -464,7 +443,6 @@ function toggleWrap(options) {
464
443
  })(state, dispatch);
465
444
  };
466
445
  }
467
-
468
446
  //#endregion
469
447
  //#region src/commands/unset-block-type.ts
470
448
  /**
@@ -502,7 +480,6 @@ function unsetTextBlockType(tr, from, to) {
502
480
  });
503
481
  return tr.steps.length > mapFrom;
504
482
  }
505
-
506
483
  //#endregion
507
484
  //#region src/commands/unset-mark.ts
508
485
  /**
@@ -519,7 +496,6 @@ function unsetMark(options) {
519
496
  return true;
520
497
  };
521
498
  }
522
-
523
499
  //#endregion
524
500
  //#region src/editor/with-priority.ts
525
501
  /**
@@ -539,7 +515,6 @@ function withPriority(extension, priority) {
539
515
  result.priority = priority;
540
516
  return result;
541
517
  }
542
-
543
518
  //#endregion
544
519
  //#region src/extensions/plugin.ts
545
520
  /**
@@ -572,7 +547,6 @@ const pluginFacet = defineFacet({
572
547
  },
573
548
  parent: stateFacet
574
549
  });
575
-
576
550
  //#endregion
577
551
  //#region src/extensions/clipboard-serializer.ts
578
552
  function mergeWrappers(wrappers) {
@@ -596,9 +570,9 @@ var CustomDOMSerializer = class extends DOMSerializer {
596
570
  return wrapFunction(fn, this.serializeNodeWrapper)(...args);
597
571
  }
598
572
  };
573
+ const nodesFromSchema = /* @__PURE__ */ DOMSerializer.nodesFromSchema.bind(DOMSerializer);
574
+ const marksFromSchema = /* @__PURE__ */ DOMSerializer.marksFromSchema.bind(DOMSerializer);
599
575
  function createCustomDOMSerializer(schema, options) {
600
- const nodesFromSchema = (...args) => DOMSerializer.nodesFromSchema(...args);
601
- const marksFromSchema = (...args) => DOMSerializer.marksFromSchema(...args);
602
576
  return new CustomDOMSerializer(wrapFunction(nodesFromSchema, options.nodesFromSchemaWrapper)(schema), wrapFunction(marksFromSchema, options.marksFromSchemaWrapper)(schema), options.serializeFragmentWrapper, options.serializeNodeWrapper);
603
577
  }
604
578
  const clipboardSerializerFacet = defineFacet({
@@ -626,7 +600,6 @@ const clipboardSerializerFacet = defineFacet({
626
600
  function defineClipboardSerializer(options) {
627
601
  return defineFacetPayload(clipboardSerializerFacet, [options]);
628
602
  }
629
-
630
603
  //#endregion
631
604
  //#region src/commands/insert-text.ts
632
605
  /**
@@ -640,7 +613,6 @@ function insertText({ text, from, to }) {
640
613
  return true;
641
614
  };
642
615
  }
643
-
644
616
  //#endregion
645
617
  //#region src/facets/command.ts
646
618
  const commandFacet = defineFacet({
@@ -654,7 +626,6 @@ const commandFacet = defineFacet({
654
626
  parent: rootFacet,
655
627
  singleton: true
656
628
  });
657
-
658
629
  //#endregion
659
630
  //#region src/extensions/command.ts
660
631
  function defineCommands(commands) {
@@ -684,7 +655,6 @@ function defineBaseCommands() {
684
655
  unsetMark
685
656
  });
686
657
  }
687
-
688
658
  //#endregion
689
659
  //#region src/extensions/events/plugin-view.ts
690
660
  /**
@@ -758,7 +728,6 @@ const pluginViewFacet = defineFacet({
758
728
  singleton: true
759
729
  });
760
730
  const pluginKey = new PluginKey("prosekit-plugin-view-handler");
761
-
762
731
  //#endregion
763
732
  //#region src/extensions/events/doc-change.ts
764
733
  /**
@@ -771,7 +740,6 @@ function defineDocChangeHandler(handler) {
771
740
  if (!view.state.doc.eq(prevState.doc)) handler(view, prevState);
772
741
  });
773
742
  }
774
-
775
743
  //#endregion
776
744
  //#region src/utils/array-grouping.ts
777
745
  function groupEntries(entries) {
@@ -779,7 +747,6 @@ function groupEntries(entries) {
779
747
  for (const [key, value] of entries) (result[key] ||= []).push(value);
780
748
  return result;
781
749
  }
782
-
783
750
  //#endregion
784
751
  //#region src/utils/combine-event-handlers.ts
785
752
  function combineEventHandlers() {
@@ -793,7 +760,6 @@ function combineEventHandlers() {
793
760
  }
794
761
  return [setHandlers, combinedEventHandler];
795
762
  }
796
-
797
763
  //#endregion
798
764
  //#region src/extensions/events/dom-event.ts
799
765
  /**
@@ -841,7 +807,6 @@ const domEventFacet = defineFacet({
841
807
  parent: pluginFacet,
842
808
  singleton: true
843
809
  });
844
-
845
810
  //#endregion
846
811
  //#region src/extensions/events/editor-event.ts
847
812
  function defineEventFacetPayload(payload) {
@@ -1003,7 +968,6 @@ function setupEditorEventPlugin() {
1003
968
  }
1004
969
  })];
1005
970
  }
1006
-
1007
971
  //#endregion
1008
972
  //#region src/extensions/events/focus.ts
1009
973
  /**
@@ -1016,7 +980,6 @@ function defineFocusChangeHandler(handler) {
1016
980
  const handleBlur = () => handler(false);
1017
981
  return defineDomEventFacetPayload(["focus", handleFocus], ["blur", handleBlur]);
1018
982
  }
1019
-
1020
983
  //#endregion
1021
984
  //#region src/utils/env.ts
1022
985
  /**
@@ -1025,7 +988,6 @@ function defineFocusChangeHandler(handler) {
1025
988
  * @internal
1026
989
  */
1027
990
  const isApple = typeof navigator !== "undefined" ? /Mac|iP(hone|[ao]d)/.test(navigator.platform) : false;
1028
-
1029
991
  //#endregion
1030
992
  //#region src/extensions/keymap.ts
1031
993
  /**
@@ -1060,7 +1022,6 @@ const keymapFacet = defineFacet({
1060
1022
  singleton: true
1061
1023
  });
1062
1024
  const keymapPluginKey = new PluginKey("prosekit-keymap");
1063
-
1064
1025
  //#endregion
1065
1026
  //#region src/extensions/history.ts
1066
1027
  const keymap = {
@@ -1085,7 +1046,6 @@ function defineHistory({ depth = 200, newGroupDelay = 250 } = {}) {
1085
1046
  newGroupDelay
1086
1047
  })), defineKeymap(keymap), defineCommands(commands));
1087
1048
  }
1088
-
1089
1049
  //#endregion
1090
1050
  //#region src/extensions/keymap-base.ts
1091
1051
  const customEnter = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitSplittableBlock);
@@ -1097,7 +1057,7 @@ const customBackspace = chainCommands(deleteSelection, joinTextblockBackward, se
1097
1057
  *
1098
1058
  * @public
1099
1059
  */
1100
- function defineBaseKeymap({ priority = Priority.low, preferBlockSelection = true } = {}) {
1060
+ function defineBaseKeymap({ priority = 1, preferBlockSelection = true } = {}) {
1101
1061
  return withPriority(defineKeymap({
1102
1062
  ...baseKeymap,
1103
1063
  "Mod-a": preferBlockSelection ? chainCommands(selectBlockCommand, selectAll$1) : selectAll$1,
@@ -1105,7 +1065,6 @@ function defineBaseKeymap({ priority = Priority.low, preferBlockSelection = true
1105
1065
  "Backspace": customBackspace
1106
1066
  }), priority);
1107
1067
  }
1108
-
1109
1068
  //#endregion
1110
1069
  //#region src/facets/schema-spec.ts
1111
1070
  const schemaSpecFacet = defineFacet({
@@ -1127,7 +1086,6 @@ const schemaSpecFacet = defineFacet({
1127
1086
  parent: schemaFacet,
1128
1087
  singleton: true
1129
1088
  });
1130
-
1131
1089
  //#endregion
1132
1090
  //#region src/utils/remove-undefined-values.ts
1133
1091
  function removeUndefinedValues(obj) {
@@ -1135,14 +1093,12 @@ function removeUndefinedValues(obj) {
1135
1093
  for (const [key, value] of Object.entries(obj)) if (value !== void 0) result[key] = value;
1136
1094
  return result;
1137
1095
  }
1138
-
1139
1096
  //#endregion
1140
1097
  //#region src/utils/merge-objects.ts
1141
1098
  function mergeObjects(...objects) {
1142
1099
  const filteredObjects = objects.filter(isNotNullish).map(removeUndefinedValues);
1143
1100
  return Object.assign({}, ...filteredObjects);
1144
1101
  }
1145
-
1146
1102
  //#endregion
1147
1103
  //#region src/utils/merge-specs.ts
1148
1104
  function mergeSpecs(a, b) {
@@ -1159,7 +1115,6 @@ function mergeSpecs(a, b) {
1159
1115
  parseDOM: [...a.parseDOM ?? [], ...b.parseDOM ?? []]
1160
1116
  });
1161
1117
  }
1162
-
1163
1118
  //#endregion
1164
1119
  //#region src/utils/output-spec.ts
1165
1120
  function wrapOutputSpecAttrs(toDOM, options) {
@@ -1230,7 +1185,6 @@ function setElementAttributes(element, attrs) {
1230
1185
  function joinStyles(...styles) {
1231
1186
  return styles.map((style) => style.trim().replace(/;$/, "")).filter(Boolean).join("; ");
1232
1187
  }
1233
-
1234
1188
  //#endregion
1235
1189
  //#region src/extensions/mark-spec.ts
1236
1190
  /**
@@ -1297,24 +1251,6 @@ const markSpecFacet = defineFacet({
1297
1251
  parent: schemaSpecFacet,
1298
1252
  singleton: true
1299
1253
  });
1300
-
1301
- //#endregion
1302
- //#region src/extensions/mark-view.ts
1303
- function defineMarkView(options) {
1304
- return defineFacetPayload(markViewFacet, [options]);
1305
- }
1306
- const markViewFacet = defineFacet({
1307
- reducer: (inputs) => {
1308
- const markViews = {};
1309
- for (const input of inputs) if (!markViews[input.name]) markViews[input.name] = input.constructor;
1310
- return () => [new ProseMirrorPlugin({
1311
- key: new PluginKey("prosekit-mark-view"),
1312
- props: { markViews }
1313
- })];
1314
- },
1315
- parent: pluginFacet
1316
- });
1317
-
1318
1254
  //#endregion
1319
1255
  //#region src/extensions/mark-view-effect.ts
1320
1256
  /**
@@ -1348,7 +1284,22 @@ const markViewFactoryFacet = defineFacet({
1348
1284
  },
1349
1285
  parent: pluginFacet
1350
1286
  });
1351
-
1287
+ //#endregion
1288
+ //#region src/extensions/mark-view.ts
1289
+ function defineMarkView(options) {
1290
+ return defineFacetPayload(markViewFacet, [options]);
1291
+ }
1292
+ const markViewFacet = defineFacet({
1293
+ reducer: (inputs) => {
1294
+ const markViews = {};
1295
+ for (const input of inputs) if (!markViews[input.name]) markViews[input.name] = input.constructor;
1296
+ return () => [new ProseMirrorPlugin({
1297
+ key: new PluginKey("prosekit-mark-view"),
1298
+ props: { markViews }
1299
+ })];
1300
+ },
1301
+ parent: pluginFacet
1302
+ });
1352
1303
  //#endregion
1353
1304
  //#region src/extensions/node-spec.ts
1354
1305
  /**
@@ -1419,24 +1370,6 @@ const nodeSpecFacet = defineFacet({
1419
1370
  parent: schemaSpecFacet,
1420
1371
  singleton: true
1421
1372
  });
1422
-
1423
- //#endregion
1424
- //#region src/extensions/node-view.ts
1425
- function defineNodeView(options) {
1426
- return defineFacetPayload(nodeViewFacet, [options]);
1427
- }
1428
- const nodeViewFacet = defineFacet({
1429
- reducer: (inputs) => {
1430
- const nodeViews = {};
1431
- for (const input of inputs) if (!nodeViews[input.name]) nodeViews[input.name] = input.constructor;
1432
- return () => [new ProseMirrorPlugin({
1433
- key: new PluginKey("prosekit-node-view"),
1434
- props: { nodeViews }
1435
- })];
1436
- },
1437
- parent: pluginFacet
1438
- });
1439
-
1440
1373
  //#endregion
1441
1374
  //#region src/extensions/node-view-effect.ts
1442
1375
  /**
@@ -1470,20 +1403,59 @@ const nodeViewFactoryFacet = defineFacet({
1470
1403
  },
1471
1404
  parent: pluginFacet
1472
1405
  });
1473
-
1406
+ //#endregion
1407
+ //#region src/extensions/node-view.ts
1408
+ function defineNodeView(options) {
1409
+ return defineFacetPayload(nodeViewFacet, [options]);
1410
+ }
1411
+ const nodeViewFacet = defineFacet({
1412
+ reducer: (inputs) => {
1413
+ const nodeViews = {};
1414
+ for (const input of inputs) if (!nodeViews[input.name]) nodeViews[input.name] = input.constructor;
1415
+ return () => [new ProseMirrorPlugin({
1416
+ key: new PluginKey("prosekit-node-view"),
1417
+ props: { nodeViews }
1418
+ })];
1419
+ },
1420
+ parent: pluginFacet
1421
+ });
1422
+ //#endregion
1423
+ //#region src/types/priority.ts
1424
+ /**
1425
+ * ProseKit extension priority.
1426
+ *
1427
+ * There are five priority levels available:
1428
+ *
1429
+ * - `Priority.lowest`
1430
+ * - `Priority.low`
1431
+ * - `Priority.default`
1432
+ * - `Priority.high`
1433
+ * - `Priority.highest`
1434
+ *
1435
+ * @example
1436
+ *
1437
+ * ```ts
1438
+ * import { withPriority, Priority } from 'prosekit/core'
1439
+ * import { myExtension } from './my-extension.js'
1440
+ *
1441
+ * const myExtensionWithHighPriority = withPriority(myExtension, Priority.high)
1442
+ * ```
1443
+ *
1444
+ * @public
1445
+ */
1446
+ const Priority = {
1447
+ lowest: 0,
1448
+ low: 1,
1449
+ default: 2,
1450
+ high: 3,
1451
+ highest: 4
1452
+ };
1474
1453
  //#endregion
1475
1454
  //#region src/utils/can-use-regex-lookbehind.ts
1476
1455
  /**
1477
1456
  * Checks if the browser supports [regex lookbehind assertion](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Lookbehind_assertion).
1478
1457
  */
1479
- const canUseRegexLookbehind = once(() => {
1480
- try {
1481
- return "ab".replace(/* @__PURE__ */ new RegExp("(?<=a)b", "g"), "c") === "ac";
1482
- } catch {
1483
- return false;
1484
- }
1485
- });
1486
-
1458
+ const canUseRegexLookbehind = supportsRegexLookbehind;
1487
1459
  //#endregion
1488
1460
  //#region src/utils/clsx.ts
1489
1461
  /**
@@ -1494,7 +1466,6 @@ const canUseRegexLookbehind = once(() => {
1494
1466
  * @public
1495
1467
  */
1496
1468
  const clsx = clsxLite;
1497
-
1498
1469
  //#endregion
1499
1470
  //#region src/utils/contains-inline-node.ts
1500
1471
  /**
@@ -1508,7 +1479,6 @@ function containsInlineNode(doc, from, to) {
1508
1479
  });
1509
1480
  return found;
1510
1481
  }
1511
-
1512
1482
  //#endregion
1513
1483
  //#region src/utils/find-node.ts
1514
1484
  /**
@@ -1549,7 +1519,6 @@ function findNodes(doc, predicate) {
1549
1519
  });
1550
1520
  return results;
1551
1521
  }
1552
-
1553
1522
  //#endregion
1554
1523
  //#region src/utils/is-at-block-start.ts
1555
1524
  /**
@@ -1562,7 +1531,6 @@ function isAtBlockStart(state, view) {
1562
1531
  if (!$cursor || (view ? !view.endOfTextblock("backward", state) : $cursor.parentOffset > 0)) return null;
1563
1532
  return $cursor;
1564
1533
  }
1565
-
1566
1534
  //#endregion
1567
1535
  //#region src/utils/is-in-code-block.ts
1568
1536
  function isCodeBlockType(type) {
@@ -1576,7 +1544,6 @@ function isCodeBlockType(type) {
1576
1544
  function isInCodeBlock(selection) {
1577
1545
  return isCodeBlockType(selection.$from.parent.type) || isCodeBlockType(selection.$to.parent.type);
1578
1546
  }
1579
-
1580
1547
  //#endregion
1581
1548
  //#region src/utils/maybe-run.ts
1582
1549
  /**
@@ -1585,14 +1552,12 @@ function isInCodeBlock(selection) {
1585
1552
  function maybeRun(value, ...args) {
1586
1553
  return typeof value === "function" ? value(...args) : value;
1587
1554
  }
1588
-
1589
1555
  //#endregion
1590
1556
  //#region src/utils/unicode.ts
1591
1557
  /**
1592
1558
  * @internal
1593
1559
  */
1594
1560
  const OBJECT_REPLACEMENT_CHARACTER = "";
1595
-
1596
1561
  //#endregion
1597
1562
  //#region src/utils/with-skip-code-block.ts
1598
1563
  /**
@@ -1604,7 +1569,7 @@ function withSkipCodeBlock(command) {
1604
1569
  return command(state, dispatch, view);
1605
1570
  };
1606
1571
  }
1607
-
1608
1572
  //#endregion
1609
1573
  export { Editor, EditorNotFoundError, OBJECT_REPLACEMENT_CHARACTER, Priority, ProseKitError, addMark, assert, canUseRegexLookbehind, clsx, containsInlineNode, createEditor, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClickHandler, defineClickOnHandler, defineClipboardSerializer, defineCommands, defineDOMEventHandler, defineDefaultState, defineDocChangeHandler, defineDoubleClickHandler, defineDoubleClickOnHandler, defineDropHandler, defineFacet, defineFacetPayload, defineFocusChangeHandler, defineHistory, defineKeyDownHandler, defineKeyPressHandler, defineKeymap, defineMarkAttr, defineMarkSpec, defineMarkView, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeAttr, defineNodeSpec, defineNodeView, defineNodeViewComponent, defineNodeViewFactory, definePasteHandler, definePlugin, defineScrollToSelectionHandler, defineTextInputHandler, defineTripleClickHandler, defineTripleClickOnHandler, defineUnmountHandler, defineUpdateHandler, editorEventFacet, elementFromJSON, elementFromNode, expandMark, findNode, findNodes, findParentNode, findParentNodeOfType, getMarkType, getNodeType, htmlFromJSON, htmlFromNode, insertDefaultBlock, insertNode, isAllSelection, isApple, isAtBlockStart, isFragment, isInCodeBlock, isMark, isMarkAbsent, isMarkActive, isNodeSelection, isProseMirrorNode, isSelection, isSlice, isTextSelection, jsonFromHTML, jsonFromNode, jsonFromState, keymapFacet, maybeRun, nodeFromElement, nodeFromHTML, nodeFromJSON, pluginFacet, removeMark, removeNode, selectAll, selectBlock, setBlockType, setNodeAttrs, setNodeAttrsBetween, setSelectionAround, stateFromJSON, toggleMark, toggleNode, toggleWrap, union, unsetBlockType, unsetMark, withPriority, withSkipCodeBlock, wrap };
1574
+
1610
1575
  //# sourceMappingURL=prosekit-core.js.map