@prosekit/core 0.0.18 → 0.0.19

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.
@@ -1,3 +1,4 @@
1
+ import { AllSelection } from '@prosekit/pm/state';
1
2
  import { Attrs } from '@prosekit/pm/model';
2
3
  import { Attrs as Attrs_2 } from 'prosemirror-model';
3
4
  import { Command } from '@prosekit/pm/state';
@@ -14,6 +15,7 @@ import type { MarkSpec } from '@prosekit/pm/model';
14
15
  import { MarkType } from '@prosekit/pm/model';
15
16
  import { MarkType as MarkType_2 } from 'prosemirror-model';
16
17
  import { Node as Node_2 } from 'prosemirror-model';
18
+ import { NodeSelection } from '@prosekit/pm/state';
17
19
  import type { NodeSpec } from '@prosekit/pm/model';
18
20
  import { NodeType } from '@prosekit/pm/model';
19
21
  import { NodeType as NodeType_2 } from 'prosemirror-model';
@@ -24,8 +26,10 @@ import { ProseMirrorFragment } from '@prosekit/pm/model';
24
26
  import { ProseMirrorNode } from '@prosekit/pm/model';
25
27
  import { Schema } from '@prosekit/pm/model';
26
28
  import type { SchemaSpec } from '@prosekit/pm/model';
27
- import { Selection as Selection_2 } from 'prosemirror-state';
29
+ import { Selection as Selection_2 } from '@prosekit/pm/state';
30
+ import { Selection as Selection_3 } from 'prosemirror-state';
28
31
  import type { Simplify } from 'type-fest';
32
+ import { TextSelection } from '@prosekit/pm/state';
29
33
  import { Transaction } from '@prosekit/pm/state';
30
34
  import type { UnionToIntersection } from 'type-fest';
31
35
  import { UserProjectConfigExport } from 'vitest/dist/config.js';
@@ -558,7 +562,7 @@ export declare function getBrowserDocument(): Document | undefined;
558
562
 
559
563
  export declare function getBrowserWindow(): (Window & typeof globalThis) | null | undefined;
560
564
 
561
- export declare function getCustomSelection(state: EditorState, from?: number | null, to?: number | null): Selection_2;
565
+ export declare function getCustomSelection(state: EditorState, from?: number | null, to?: number | null): Selection_3;
562
566
 
563
567
  export declare function getFacetCount(): number;
564
568
 
@@ -614,15 +618,46 @@ export declare function insertText({ text, from, to, }: {
614
618
  to?: number;
615
619
  }): Command;
616
620
 
621
+ /**
622
+ * @internal
623
+ */
624
+ declare function isAllSelection(sel: Selection_2): sel is AllSelection;
625
+ export { isAllSelection }
626
+ export { isAllSelection as isAllSelection_alias_1 }
627
+
617
628
  export declare const isMac: boolean;
618
629
 
619
- export declare function isMark(mark: unknown): mark is Mark;
630
+ /**
631
+ * @internal
632
+ */
633
+ declare function isMark(mark: unknown): mark is Mark;
634
+ export { isMark }
635
+ export { isMark as isMark_alias_1 }
620
636
 
621
637
  export declare function isMarkActive(state: EditorState, type: string | MarkType, attrs?: Attrs | null): boolean;
622
638
 
623
639
  export declare function isNodeActive(state: EditorState, type: string | NodeType, attrs?: Attrs | null): boolean;
624
640
 
625
- export declare function isProseMirrorNode(node: unknown): node is ProseMirrorNode;
641
+ /**
642
+ * @internal
643
+ */
644
+ declare function isNodeSelection(sel: Selection_2): sel is NodeSelection;
645
+ export { isNodeSelection }
646
+ export { isNodeSelection as isNodeSelection_alias_1 }
647
+
648
+ /**
649
+ * @internal
650
+ */
651
+ declare function isProseMirrorNode(node: unknown): node is ProseMirrorNode;
652
+ export { isProseMirrorNode }
653
+ export { isProseMirrorNode as isProseMirrorNode_alias_1 }
654
+
655
+ /**
656
+ * @internal
657
+ */
658
+ declare function isTextSelection(sel: Selection_2): sel is TextSelection;
659
+ export { isTextSelection }
660
+ export { isTextSelection as isTextSelection_alias_1 }
626
661
 
627
662
  /**
628
663
  * @public
@@ -785,8 +820,8 @@ export declare function selectAll(): Command;
785
820
  * @public
786
821
  */
787
822
  declare interface SelectionJson {
788
- from: number;
789
- to: number;
823
+ anchor: number;
824
+ head: number;
790
825
  type: string;
791
826
  }
792
827
  export { SelectionJson }
@@ -55,3 +55,8 @@ export { elementToJSON } from './_tsup-dts-rollup';
55
55
  export { elementToNode } from './_tsup-dts-rollup';
56
56
  export { htmlToJSON } from './_tsup-dts-rollup';
57
57
  export { htmlToNode } from './_tsup-dts-rollup';
58
+ export { isAllSelection } from './_tsup-dts-rollup';
59
+ export { isMark } from './_tsup-dts-rollup';
60
+ export { isNodeSelection } from './_tsup-dts-rollup';
61
+ export { isProseMirrorNode } from './_tsup-dts-rollup';
62
+ export { isTextSelection } from './_tsup-dts-rollup';
@@ -637,12 +637,26 @@ function updateExtension(prevInputs, prevConverters, extension, mode) {
637
637
 
638
638
  // src/utils/type-assertion.ts
639
639
  import { Mark, ProseMirrorNode } from "@prosekit/pm/model";
640
+ import {
641
+ AllSelection,
642
+ NodeSelection,
643
+ TextSelection as TextSelection2
644
+ } from "@prosekit/pm/state";
640
645
  function isProseMirrorNode(node) {
641
646
  return node instanceof ProseMirrorNode;
642
647
  }
643
648
  function isMark(mark) {
644
649
  return mark instanceof Mark;
645
650
  }
651
+ function isTextSelection(sel) {
652
+ return sel instanceof TextSelection2;
653
+ }
654
+ function isNodeSelection(sel) {
655
+ return sel instanceof NodeSelection;
656
+ }
657
+ function isAllSelection(sel) {
658
+ return sel instanceof AllSelection;
659
+ }
646
660
 
647
661
  // src/utils/is-mark-active.ts
648
662
  function isMarkActive(state, type, attrs) {
@@ -1022,10 +1036,10 @@ function insertText({
1022
1036
  }
1023
1037
 
1024
1038
  // src/commands/select-all.ts
1025
- import { AllSelection } from "@prosekit/pm/state";
1039
+ import { AllSelection as AllSelection2 } from "@prosekit/pm/state";
1026
1040
  function selectAll() {
1027
1041
  return (state, dispatch) => {
1028
- dispatch == null ? void 0 : dispatch(state.tr.setSelection(new AllSelection(state.doc)));
1042
+ dispatch == null ? void 0 : dispatch(state.tr.setSelection(new AllSelection2(state.doc)));
1029
1043
  return true;
1030
1044
  };
1031
1045
  }
@@ -1407,6 +1421,11 @@ export {
1407
1421
  htmlToJSON,
1408
1422
  htmlToNode,
1409
1423
  insertNode,
1424
+ isAllSelection,
1425
+ isMark,
1426
+ isNodeSelection,
1427
+ isProseMirrorNode,
1428
+ isTextSelection,
1410
1429
  pluginFacet,
1411
1430
  removeMark,
1412
1431
  setBlockType,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/core",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.19",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",