@prosekit/core 0.1.2 → 0.1.3

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.
@@ -171,9 +171,16 @@ declare function defineBaseCommands(): Extension<{
171
171
  from?: number | undefined;
172
172
  to?: number | undefined;
173
173
  }];
174
- insertNode: [{
174
+ insertNode: [options: {
175
175
  node: Node_2;
176
176
  pos?: number | undefined;
177
+ type?: undefined;
178
+ attrs?: undefined;
179
+ } | {
180
+ node?: undefined;
181
+ pos?: number | undefined;
182
+ type: string;
183
+ attrs?: Attrs_2 | undefined;
177
184
  }];
178
185
  wrap: [{
179
186
  nodeType: NodeType_2;
@@ -579,17 +586,18 @@ export { getNodeType as getNodeType_alias_1 }
579
586
  declare function insertNode(options: {
580
587
  node: ProseMirrorNode;
581
588
  pos?: number;
582
- }): Command;
583
-
584
- declare function insertNode(options: {
585
- attrs?: Attrs;
586
- type: string;
589
+ type?: undefined;
590
+ attrs?: undefined;
591
+ } | {
592
+ node?: undefined;
587
593
  pos?: number;
594
+ type: string;
595
+ attrs?: Attrs;
588
596
  }): Command;
589
597
  export { insertNode }
590
598
  export { insertNode as insertNode_alias_1 }
591
599
 
592
- export declare function insertNode_alias_2({ node, pos, }: {
600
+ export declare function insertNodeAction({ node, pos, }: {
593
601
  node: ProseMirrorNode;
594
602
  pos?: number;
595
603
  }): Action;
@@ -1,3 +1,4 @@
1
+ export { ProseKitError } from './_tsup-dts-rollup';
1
2
  export { addMark } from './_tsup-dts-rollup';
2
3
  export { insertNode } from './_tsup-dts-rollup';
3
4
  export { removeMark } from './_tsup-dts-rollup';
@@ -9,7 +10,6 @@ export { createEditor } from './_tsup-dts-rollup';
9
10
  export { EditorOptions } from './_tsup-dts-rollup';
10
11
  export { union } from './_tsup-dts-rollup';
11
12
  export { withPriority } from './_tsup-dts-rollup';
12
- export { ProseKitError_alias_1 as ProseKitError } from './_tsup-dts-rollup';
13
13
  export { defineBaseCommands } from './_tsup-dts-rollup';
14
14
  export { defineCommands } from './_tsup-dts-rollup';
15
15
  export { defineDefaultState } from './_tsup-dts-rollup';
@@ -64,3 +64,61 @@ export { isMark } from './_tsup-dts-rollup';
64
64
  export { isNodeSelection } from './_tsup-dts-rollup';
65
65
  export { isProseMirrorNode } from './_tsup-dts-rollup';
66
66
  export { isTextSelection } from './_tsup-dts-rollup';
67
+ export { insertText } from './_tsup-dts-rollup';
68
+ export { selectAll } from './_tsup-dts-rollup';
69
+ export { wrap } from './_tsup-dts-rollup';
70
+ export { createNodeBuilder } from './_tsup-dts-rollup';
71
+ export { createMarkBuilder } from './_tsup-dts-rollup';
72
+ export { NodeChild } from './_tsup-dts-rollup';
73
+ export { NodeBuilder } from './_tsup-dts-rollup';
74
+ export { MarkBuilder } from './_tsup-dts-rollup';
75
+ export { applyAction } from './_tsup-dts-rollup';
76
+ export { insertNodeAction } from './_tsup-dts-rollup';
77
+ export { defineParagraphSpec } from './_tsup-dts-rollup';
78
+ export { UpdateHandler } from './_tsup-dts-rollup';
79
+ export { BaseExtension } from './_tsup-dts-rollup';
80
+ export { CommandPayload } from './_tsup-dts-rollup';
81
+ export { commandFacet } from './_tsup-dts-rollup';
82
+ export { getFacetCount } from './_tsup-dts-rollup';
83
+ export { FacetConverter } from './_tsup-dts-rollup';
84
+ export { FacetExtensionImpl } from './_tsup-dts-rollup';
85
+ export { updateExtension } from './_tsup-dts-rollup';
86
+ export { Payloads } from './_tsup-dts-rollup';
87
+ export { Converters } from './_tsup-dts-rollup';
88
+ export { SchemaPayload } from './_tsup-dts-rollup';
89
+ export { schemaFacet } from './_tsup-dts-rollup';
90
+ export { StatePayload } from './_tsup-dts-rollup';
91
+ export { stateFacet } from './_tsup-dts-rollup';
92
+ export { UnionExtensionImpl } from './_tsup-dts-rollup';
93
+ export { ViewPayload } from './_tsup-dts-rollup';
94
+ export { viewFacet } from './_tsup-dts-rollup';
95
+ export { assertTypeEqual } from './_tsup-dts-rollup';
96
+ export { CommandApplier } from './_tsup-dts-rollup';
97
+ export { CommandCreator } from './_tsup-dts-rollup';
98
+ export { CommandCreators } from './_tsup-dts-rollup';
99
+ export { ToCommandArgs } from './_tsup-dts-rollup';
100
+ export { ToCommandCreators } from './_tsup-dts-rollup';
101
+ export { ToCommandApplier } from './_tsup-dts-rollup';
102
+ export { ExceptEmptyValue } from './_tsup-dts-rollup';
103
+ export { ExtractNodesFromTyping } from './_tsup-dts-rollup';
104
+ export { ExtractMarksFromTyping } from './_tsup-dts-rollup';
105
+ export { ExtractCommandArgsFromTyping } from './_tsup-dts-rollup';
106
+ export { ExtractTyping } from './_tsup-dts-rollup';
107
+ export { ExtractCommandArgs } from './_tsup-dts-rollup';
108
+ export { ExtractKey } from './_tsup-dts-rollup';
109
+ export { voidFunction } from './_tsup-dts-rollup';
110
+ export { attrsMatch } from './_tsup-dts-rollup';
111
+ export { collectNodes } from './_tsup-dts-rollup';
112
+ export { NodeContent } from './_tsup-dts-rollup';
113
+ export { isMac } from './_tsup-dts-rollup';
114
+ export { getCustomSelection } from './_tsup-dts-rollup';
115
+ export { getBrowserDocument } from './_tsup-dts-rollup';
116
+ export { getBrowserWindow } from './_tsup-dts-rollup';
117
+ export { isMarkActive } from './_tsup-dts-rollup';
118
+ export { isNodeActive } from './_tsup-dts-rollup';
119
+ export { isNotNull } from './_tsup-dts-rollup';
120
+ export { objectEqual } from './_tsup-dts-rollup';
121
+ export { elementFromHTML } from './_tsup-dts-rollup';
122
+ export { uniqPush } from './_tsup-dts-rollup';
123
+ export { uniqRemove } from './_tsup-dts-rollup';
124
+ export { default_alias as default } from './_tsup-dts-rollup';
@@ -746,8 +746,8 @@ function flattenChildren(schema, children, mark) {
746
746
  }
747
747
  function normalizeArgs(args) {
748
748
  const [attrs, ...children] = args;
749
- if (isNodeChild(args)) {
750
- children.unshift(args);
749
+ if (isNodeChild(attrs)) {
750
+ children.unshift(attrs);
751
751
  return [null, children];
752
752
  } else if (typeof attrs === "object") {
753
753
  return [attrs, children];
@@ -1082,26 +1082,6 @@ function wrap({
1082
1082
  };
1083
1083
  }
1084
1084
 
1085
- // src/extensions/actions.ts
1086
- import "@prosekit/pm/model";
1087
- import { Selection as Selection2 } from "@prosekit/pm/state";
1088
- import { insertPoint as insertPoint2 } from "@prosekit/pm/transform";
1089
- function insertNode2({
1090
- node,
1091
- pos
1092
- }) {
1093
- return ({ tr }) => {
1094
- const insertPos = insertPoint2(tr.doc, pos != null ? pos : tr.selection.to, node.type);
1095
- if (insertPos == null) {
1096
- return false;
1097
- }
1098
- tr.insert(insertPos, node);
1099
- const $pos = tr.doc.resolve(insertPos);
1100
- tr.setSelection(Selection2.near($pos));
1101
- return true;
1102
- };
1103
- }
1104
-
1105
1085
  // src/extensions/command.ts
1106
1086
  function defineCommands(commands) {
1107
1087
  return commandFacet.extension([commands]);
@@ -1109,7 +1089,7 @@ function defineCommands(commands) {
1109
1089
  function defineBaseCommands() {
1110
1090
  return defineCommands({
1111
1091
  insertText,
1112
- insertNode: insertNode2,
1092
+ insertNode,
1113
1093
  wrap,
1114
1094
  setBlockType,
1115
1095
  selectAll,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/core",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",