@prosekit/core 0.1.6 → 0.1.8
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.
- package/dist/_tsup-dts-rollup.d.ts +38 -11
- package/dist/prosekit-core.d.ts +3 -2
- package/dist/prosekit-core.js +17 -7
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/src/index.ts +3 -2
@@ -32,7 +32,6 @@ import type { Simplify } from 'type-fest';
|
|
32
32
|
import { TextSelection } from '@prosekit/pm/state';
|
33
33
|
import { Transaction } from '@prosekit/pm/state';
|
34
34
|
import type { UnionToIntersection } from 'type-fest';
|
35
|
-
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
36
35
|
|
37
36
|
declare type Action = (options: {
|
38
37
|
tr: Transaction;
|
@@ -137,7 +136,11 @@ export declare function createNodeBuilder(getState: () => EditorState | null | u
|
|
137
136
|
|
138
137
|
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
139
138
|
|
140
|
-
export declare const default_alias_1:
|
139
|
+
export declare const default_alias_1: {
|
140
|
+
test: {
|
141
|
+
environment: "jsdom";
|
142
|
+
};
|
143
|
+
};
|
141
144
|
|
142
145
|
declare interface DefaultStateOptions {
|
143
146
|
/**
|
@@ -211,9 +214,18 @@ export { defineBaseCommands }
|
|
211
214
|
export { defineBaseCommands as defineBaseCommands_alias_1 }
|
212
215
|
|
213
216
|
/**
|
217
|
+
* Defines some basic key bindings.
|
218
|
+
*
|
214
219
|
* @public
|
215
220
|
*/
|
216
|
-
declare function defineBaseKeymap(
|
221
|
+
declare function defineBaseKeymap(options?: {
|
222
|
+
/**
|
223
|
+
* The priority of the keymap.
|
224
|
+
*
|
225
|
+
* @default Priority.low
|
226
|
+
*/
|
227
|
+
priority?: Priority;
|
228
|
+
}): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
217
229
|
export { defineBaseKeymap }
|
218
230
|
export { defineBaseKeymap as defineBaseKeymap_alias_1 }
|
219
231
|
|
@@ -293,9 +305,12 @@ declare function defineNodeView(options: NodeViewOptions): Extension;
|
|
293
305
|
export { defineNodeView }
|
294
306
|
export { defineNodeView as defineNodeView_alias_1 }
|
295
307
|
|
296
|
-
|
297
|
-
|
298
|
-
|
308
|
+
/**
|
309
|
+
* @internal
|
310
|
+
*/
|
311
|
+
declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): Extension;
|
312
|
+
export { defineNodeViewFactory }
|
313
|
+
export { defineNodeViewFactory as defineNodeViewFactory_alias_1 }
|
299
314
|
|
300
315
|
/**
|
301
316
|
* @public
|
@@ -569,6 +584,15 @@ export declare function getCustomSelection(state: EditorState, from?: number | n
|
|
569
584
|
|
570
585
|
export declare function getFacetCount(): number;
|
571
586
|
|
587
|
+
/**
|
588
|
+
* Returns a unique id in the current process that can be used in various places.
|
589
|
+
*
|
590
|
+
* @internal
|
591
|
+
*/
|
592
|
+
declare function getId(): string;
|
593
|
+
export { getId as _getId }
|
594
|
+
export { getId }
|
595
|
+
|
572
596
|
/**
|
573
597
|
* @internal
|
574
598
|
*/
|
@@ -773,17 +797,20 @@ declare interface NodeSpecOptions<NodeName extends string = string> extends Node
|
|
773
797
|
export { NodeSpecOptions }
|
774
798
|
export { NodeSpecOptions as NodeSpecOptions_alias_1 }
|
775
799
|
|
776
|
-
|
800
|
+
/**
|
801
|
+
* @internal
|
802
|
+
*/
|
803
|
+
declare type NodeViewFactoryOptions<T> = {
|
777
804
|
group: string;
|
778
805
|
name: string;
|
779
|
-
args:
|
806
|
+
args: T;
|
780
807
|
} | {
|
781
808
|
group: string;
|
782
809
|
name?: undefined;
|
783
|
-
factory: (args:
|
810
|
+
factory: (args: T) => NodeViewConstructor;
|
784
811
|
};
|
785
|
-
export {
|
786
|
-
export {
|
812
|
+
export { NodeViewFactoryOptions }
|
813
|
+
export { NodeViewFactoryOptions as NodeViewFactoryOptions_alias_1 }
|
787
814
|
|
788
815
|
declare interface NodeViewOptions {
|
789
816
|
name: string;
|
package/dist/prosekit-core.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
export { _getId } 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';
|
@@ -26,8 +27,8 @@ export { defineNodeSpec } from './_tsup-dts-rollup';
|
|
26
27
|
export { NodeSpecOptions } from './_tsup-dts-rollup';
|
27
28
|
export { defineNodeView } from './_tsup-dts-rollup';
|
28
29
|
export { NodeViewOptions } from './_tsup-dts-rollup';
|
29
|
-
export {
|
30
|
-
export {
|
30
|
+
export { defineNodeViewFactory } from './_tsup-dts-rollup';
|
31
|
+
export { NodeViewFactoryOptions } from './_tsup-dts-rollup';
|
31
32
|
export { defineParagraph } from './_tsup-dts-rollup';
|
32
33
|
export { definePlugin } from './_tsup-dts-rollup';
|
33
34
|
export { pluginFacet } from './_tsup-dts-rollup';
|
package/dist/prosekit-core.js
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
// src/utils/get-id.ts
|
2
|
+
var id = 0;
|
3
|
+
function getId() {
|
4
|
+
id = (id + 1) % Number.MAX_SAFE_INTEGER;
|
5
|
+
return `id:${id}`;
|
6
|
+
}
|
7
|
+
|
1
8
|
// src/commands/add-mark.ts
|
2
9
|
import "@prosekit/pm/model";
|
3
10
|
import "@prosekit/pm/state";
|
@@ -1191,8 +1198,10 @@ var pluginFacet = Facet.define({
|
|
1191
1198
|
function defineKeymap(keymap) {
|
1192
1199
|
return keymapFacet.extension([keymap]);
|
1193
1200
|
}
|
1194
|
-
function defineBaseKeymap() {
|
1195
|
-
|
1201
|
+
function defineBaseKeymap(options) {
|
1202
|
+
var _a;
|
1203
|
+
const priority = (_a = options == null ? void 0 : options.priority) != null ? _a : 3 /* low */;
|
1204
|
+
return withPriority(defineKeymap(baseKeymap), priority);
|
1196
1205
|
}
|
1197
1206
|
var keymapFacet = Facet.define({
|
1198
1207
|
converter: () => {
|
@@ -1323,10 +1332,10 @@ var nodeViewFacet = Facet.define({
|
|
1323
1332
|
// src/extensions/node-view-effect.ts
|
1324
1333
|
import { ProseMirrorPlugin as ProseMirrorPlugin2 } from "@prosekit/pm/state";
|
1325
1334
|
import "@prosekit/pm/view";
|
1326
|
-
function
|
1327
|
-
return
|
1335
|
+
function defineNodeViewFactory(options) {
|
1336
|
+
return nodeViewFactoryFacet.extension([options]);
|
1328
1337
|
}
|
1329
|
-
var
|
1338
|
+
var nodeViewFactoryFacet = Facet.define({
|
1330
1339
|
convert: (inputs) => {
|
1331
1340
|
const nodeViews = {};
|
1332
1341
|
const options = {};
|
@@ -1349,7 +1358,7 @@ var nodeViewEffectFacet = Facet.define({
|
|
1349
1358
|
nodeViews[name] = factory(args);
|
1350
1359
|
}
|
1351
1360
|
}
|
1352
|
-
return () =>
|
1361
|
+
return () => [new ProseMirrorPlugin2({ props: { nodeViews } })];
|
1353
1362
|
},
|
1354
1363
|
next: pluginFacet
|
1355
1364
|
});
|
@@ -1425,6 +1434,7 @@ export {
|
|
1425
1434
|
Facet,
|
1426
1435
|
Priority,
|
1427
1436
|
ProseKitError,
|
1437
|
+
getId as _getId,
|
1428
1438
|
addMark,
|
1429
1439
|
createEditor,
|
1430
1440
|
defineBaseCommands,
|
@@ -1438,7 +1448,7 @@ export {
|
|
1438
1448
|
defineMarkSpec,
|
1439
1449
|
defineNodeSpec,
|
1440
1450
|
defineNodeView,
|
1441
|
-
|
1451
|
+
defineNodeViewFactory,
|
1442
1452
|
defineParagraph,
|
1443
1453
|
definePlugin,
|
1444
1454
|
defineText,
|
package/dist/style.css
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/core",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1.
|
4
|
+
"version": "0.1.8",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -40,13 +40,13 @@
|
|
40
40
|
"dependencies": {
|
41
41
|
"@prosekit/pm": "^0.1.0",
|
42
42
|
"orderedmap": "^2.1.1",
|
43
|
-
"type-fest": "^4.8.
|
43
|
+
"type-fest": "^4.8.3"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@prosekit/dev": "*",
|
47
47
|
"tsup": "^8.0.1",
|
48
|
-
"typescript": "^5.3.
|
49
|
-
"vitest": "^0.
|
48
|
+
"typescript": "^5.3.3",
|
49
|
+
"vitest": "^1.0.4"
|
50
50
|
},
|
51
51
|
"scripts": {
|
52
52
|
"build:tsup": "tsup",
|
package/src/index.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
export { getId as _getId } from './utils/get-id'
|
1
2
|
export { addMark } from './commands/add-mark'
|
2
3
|
export { insertNode } from './commands/insert-node'
|
3
4
|
export { removeMark } from './commands/remove-mark'
|
@@ -25,8 +26,8 @@ export { defineMarkSpec, type MarkSpecOptions } from './extensions/mark-spec'
|
|
25
26
|
export { defineNodeSpec, type NodeSpecOptions } from './extensions/node-spec'
|
26
27
|
export { defineNodeView, type NodeViewOptions } from './extensions/node-view'
|
27
28
|
export {
|
28
|
-
|
29
|
-
type
|
29
|
+
defineNodeViewFactory,
|
30
|
+
type NodeViewFactoryOptions,
|
30
31
|
} from './extensions/node-view-effect'
|
31
32
|
export { defineParagraph } from './extensions/paragraph'
|
32
33
|
export {
|