@prosekit/core 0.1.7 → 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 +28 -10
- package/dist/prosekit-core.d.ts +3 -2
- package/dist/prosekit-core.js +13 -5
- 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
|
/**
|
@@ -302,9 +305,12 @@ declare function defineNodeView(options: NodeViewOptions): Extension;
|
|
302
305
|
export { defineNodeView }
|
303
306
|
export { defineNodeView as defineNodeView_alias_1 }
|
304
307
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
+
/**
|
309
|
+
* @internal
|
310
|
+
*/
|
311
|
+
declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): Extension;
|
312
|
+
export { defineNodeViewFactory }
|
313
|
+
export { defineNodeViewFactory as defineNodeViewFactory_alias_1 }
|
308
314
|
|
309
315
|
/**
|
310
316
|
* @public
|
@@ -578,6 +584,15 @@ export declare function getCustomSelection(state: EditorState, from?: number | n
|
|
578
584
|
|
579
585
|
export declare function getFacetCount(): number;
|
580
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
|
+
|
581
596
|
/**
|
582
597
|
* @internal
|
583
598
|
*/
|
@@ -782,17 +797,20 @@ declare interface NodeSpecOptions<NodeName extends string = string> extends Node
|
|
782
797
|
export { NodeSpecOptions }
|
783
798
|
export { NodeSpecOptions as NodeSpecOptions_alias_1 }
|
784
799
|
|
785
|
-
|
800
|
+
/**
|
801
|
+
* @internal
|
802
|
+
*/
|
803
|
+
declare type NodeViewFactoryOptions<T> = {
|
786
804
|
group: string;
|
787
805
|
name: string;
|
788
|
-
args:
|
806
|
+
args: T;
|
789
807
|
} | {
|
790
808
|
group: string;
|
791
809
|
name?: undefined;
|
792
|
-
factory: (args:
|
810
|
+
factory: (args: T) => NodeViewConstructor;
|
793
811
|
};
|
794
|
-
export {
|
795
|
-
export {
|
812
|
+
export { NodeViewFactoryOptions }
|
813
|
+
export { NodeViewFactoryOptions as NodeViewFactoryOptions_alias_1 }
|
796
814
|
|
797
815
|
declare interface NodeViewOptions {
|
798
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";
|
@@ -1325,10 +1332,10 @@ var nodeViewFacet = Facet.define({
|
|
1325
1332
|
// src/extensions/node-view-effect.ts
|
1326
1333
|
import { ProseMirrorPlugin as ProseMirrorPlugin2 } from "@prosekit/pm/state";
|
1327
1334
|
import "@prosekit/pm/view";
|
1328
|
-
function
|
1329
|
-
return
|
1335
|
+
function defineNodeViewFactory(options) {
|
1336
|
+
return nodeViewFactoryFacet.extension([options]);
|
1330
1337
|
}
|
1331
|
-
var
|
1338
|
+
var nodeViewFactoryFacet = Facet.define({
|
1332
1339
|
convert: (inputs) => {
|
1333
1340
|
const nodeViews = {};
|
1334
1341
|
const options = {};
|
@@ -1351,7 +1358,7 @@ var nodeViewEffectFacet = Facet.define({
|
|
1351
1358
|
nodeViews[name] = factory(args);
|
1352
1359
|
}
|
1353
1360
|
}
|
1354
|
-
return () =>
|
1361
|
+
return () => [new ProseMirrorPlugin2({ props: { nodeViews } })];
|
1355
1362
|
},
|
1356
1363
|
next: pluginFacet
|
1357
1364
|
});
|
@@ -1427,6 +1434,7 @@ export {
|
|
1427
1434
|
Facet,
|
1428
1435
|
Priority,
|
1429
1436
|
ProseKitError,
|
1437
|
+
getId as _getId,
|
1430
1438
|
addMark,
|
1431
1439
|
createEditor,
|
1432
1440
|
defineBaseCommands,
|
@@ -1440,7 +1448,7 @@ export {
|
|
1440
1448
|
defineMarkSpec,
|
1441
1449
|
defineNodeSpec,
|
1442
1450
|
defineNodeView,
|
1443
|
-
|
1451
|
+
defineNodeViewFactory,
|
1444
1452
|
defineParagraph,
|
1445
1453
|
definePlugin,
|
1446
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 {
|