@prosekit/core 0.0.3 → 0.0.4
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/prosekit-core.d.ts +12 -6
- package/dist/prosekit-core.js +18 -4
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/index.ts +6 -1
package/dist/prosekit-core.d.ts
CHANGED
@@ -54,6 +54,11 @@ declare const enum Priority {
|
|
54
54
|
highest = 0
|
55
55
|
}
|
56
56
|
|
57
|
+
/**
|
58
|
+
* @intneral
|
59
|
+
*/
|
60
|
+
type SimplifyUnion<T> = Simplify<UnionToIntersection<T>>;
|
61
|
+
|
57
62
|
/**
|
58
63
|
* @public
|
59
64
|
*/
|
@@ -263,21 +268,22 @@ interface PluginOptions {
|
|
263
268
|
}
|
264
269
|
/** @public */
|
265
270
|
declare function addPlugin({ plugins }: PluginOptions): Extension;
|
271
|
+
/** @internal */
|
272
|
+
type PluginFacetInput = (context: {
|
273
|
+
schema: Schema;
|
274
|
+
}) => Plugin[];
|
275
|
+
/** @internal */
|
276
|
+
declare const pluginFacet: Facet<PluginFacetInput, StateConfigCallback>;
|
266
277
|
|
267
278
|
/** @public */
|
268
279
|
declare function addText(): Extension<{
|
269
280
|
NODES: "text";
|
270
281
|
}>;
|
271
282
|
|
272
|
-
/**
|
273
|
-
* @intneral
|
274
|
-
*/
|
275
|
-
type SimplifyUnion<T> = Simplify<UnionToIntersection<T>>;
|
276
|
-
|
277
283
|
/** @internal */
|
278
284
|
declare function getMarkType(schema: Schema, type: string | MarkType): MarkType;
|
279
285
|
|
280
286
|
/** @internal */
|
281
287
|
declare function getNodeType(schema: Schema, type: string | NodeType): NodeType;
|
282
288
|
|
283
|
-
export { CommandArgs, Editor, EditorOptions, Extension, ExtensionTyping, ExtractCommandCreators, ExtractCommandDispatchers, ExtractMarks, ExtractNodes, Facet, FacetExtension, FacetOptions, Keymap, MarkSpecOptions, NodeSpecOptions, NodeViewOptions, PluginOptions, Priority, ProseKitError, SimplifyUnion, StateConfigCallback, StateConfigContext, ViewProps, addBaseCommands, addBaseKeymap, addCommands, addDoc, addInputRule, addKeymap, addMarkSpec, addNodeSpec, addNodeView, addParagraph, addPlugin, addText, createEditor, defineExtension, getMarkType, getNodeType, toggleMark, withPriority };
|
289
|
+
export { CommandArgs, Editor, EditorOptions, Extension, ExtensionTyping, ExtractCommandCreators, ExtractCommandDispatchers, ExtractMarks, ExtractNodes, Facet, FacetExtension, FacetOptions, Keymap, MarkSpecOptions, NodeSpecOptions, NodeViewOptions, PluginFacetInput, PluginOptions, Priority, ProseKitError, SimplifyUnion, StateConfigCallback, StateConfigContext, ViewProps, addBaseCommands, addBaseKeymap, addCommands, addDoc, addInputRule, addKeymap, addMarkSpec, addNodeSpec, addNodeView, addParagraph, addPlugin, addText, createEditor, defineExtension, getMarkType, getNodeType, pluginFacet, toggleMark, withPriority };
|
package/dist/prosekit-core.js
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
// src/commands/toggle-mark.ts
|
2
2
|
import { toggleMark as baseToggleMark } from "@prosekit/pm/commands";
|
3
|
+
import "@prosekit/pm/model";
|
4
|
+
import "@prosekit/pm/state";
|
5
|
+
|
6
|
+
// src/utils/get-mark-type.ts
|
7
|
+
import "@prosekit/pm/model";
|
3
8
|
|
4
9
|
// src/error.ts
|
5
10
|
var ProseKitError = class extends Error {
|
@@ -28,7 +33,7 @@ function toggleMark(options) {
|
|
28
33
|
}
|
29
34
|
|
30
35
|
// src/editor/editor.ts
|
31
|
-
import { Schema } from "@prosekit/pm/model";
|
36
|
+
import { Schema as Schema2 } from "@prosekit/pm/model";
|
32
37
|
import { EditorState } from "@prosekit/pm/state";
|
33
38
|
import { EditorView } from "@prosekit/pm/view";
|
34
39
|
|
@@ -263,7 +268,7 @@ function createEditor({
|
|
263
268
|
if (!schemaInput) {
|
264
269
|
throw new Error("Schema must be defined");
|
265
270
|
}
|
266
|
-
const schema = new
|
271
|
+
const schema = new Schema2(schemaInput);
|
267
272
|
const stateConfig = stateInput ? stateInput({ schema }) : { schema };
|
268
273
|
const state = EditorState.create(stateConfig);
|
269
274
|
const directEditorProps = { state, ...viewInput };
|
@@ -427,6 +432,7 @@ function withPriority(extension, priority) {
|
|
427
432
|
}
|
428
433
|
|
429
434
|
// src/extensions/command.ts
|
435
|
+
import "@prosekit/pm/model";
|
430
436
|
import { AllSelection, Selection } from "@prosekit/pm/state";
|
431
437
|
import { findWrapping, insertPoint } from "@prosekit/pm/transform";
|
432
438
|
function addCommands(commands) {
|
@@ -536,8 +542,12 @@ function addDoc() {
|
|
536
542
|
|
537
543
|
// src/extensions/input-rules.ts
|
538
544
|
import { inputRules } from "@prosekit/pm/inputrules";
|
545
|
+
import "@prosekit/pm/model";
|
546
|
+
import "@prosekit/pm/state";
|
539
547
|
|
540
548
|
// src/extensions/plugin.ts
|
549
|
+
import "@prosekit/pm/model";
|
550
|
+
import "@prosekit/pm/state";
|
541
551
|
function addPlugin({ plugins }) {
|
542
552
|
if (typeof plugins === "function") {
|
543
553
|
return pluginFacet.extension([plugins]);
|
@@ -574,6 +584,7 @@ var inputRuleFacet = Facet.define({
|
|
574
584
|
// src/extensions/keymap.ts
|
575
585
|
import { baseKeymap, chainCommands } from "@prosekit/pm/commands";
|
576
586
|
import { keymap as createKeymapPlugin } from "@prosekit/pm/keymap";
|
587
|
+
import "@prosekit/pm/state";
|
577
588
|
function addKeymap(keymap) {
|
578
589
|
return keymapFacet.extension([keymap]);
|
579
590
|
}
|
@@ -624,7 +635,8 @@ var markSpecFacet = Facet.define({
|
|
624
635
|
});
|
625
636
|
|
626
637
|
// src/extensions/node-view.ts
|
627
|
-
import { Plugin as
|
638
|
+
import { Plugin as Plugin4 } from "@prosekit/pm/state";
|
639
|
+
import "@prosekit/pm/view";
|
628
640
|
function addNodeView(options) {
|
629
641
|
return nodeViewFacet.extension([options]);
|
630
642
|
}
|
@@ -636,7 +648,7 @@ var nodeViewFacet = Facet.define({
|
|
636
648
|
nodeViews[input.name] = input.constructor;
|
637
649
|
}
|
638
650
|
}
|
639
|
-
return () => [new
|
651
|
+
return () => [new Plugin4({ props: { nodeViews } })];
|
640
652
|
},
|
641
653
|
next: pluginFacet
|
642
654
|
});
|
@@ -667,6 +679,7 @@ function addText() {
|
|
667
679
|
}
|
668
680
|
|
669
681
|
// src/utils/get-node-type.ts
|
682
|
+
import "@prosekit/pm/model";
|
670
683
|
function getNodeType(schema, type) {
|
671
684
|
if (typeof type === "string") {
|
672
685
|
const nodeType = schema.nodes[type];
|
@@ -699,6 +712,7 @@ export {
|
|
699
712
|
defineExtension,
|
700
713
|
getMarkType,
|
701
714
|
getNodeType,
|
715
|
+
pluginFacet,
|
702
716
|
toggleMark,
|
703
717
|
withPriority
|
704
718
|
};
|
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.0.
|
4
|
+
"version": "0.0.4",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"dependencies": {
|
41
41
|
"@prosekit/pm": "^0.0.3",
|
42
42
|
"orderedmap": "^2.1.1",
|
43
|
-
"type-fest": "^3.
|
43
|
+
"type-fest": "^3.13.1"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@prosekit/dev": "*",
|
package/src/index.ts
CHANGED
@@ -12,7 +12,12 @@ export { addMarkSpec, type MarkSpecOptions } from './extensions/mark-spec'
|
|
12
12
|
export { addNodeSpec, type NodeSpecOptions } from './extensions/node-spec'
|
13
13
|
export { addNodeView, type NodeViewOptions } from './extensions/node-view'
|
14
14
|
export { addParagraph } from './extensions/paragraph'
|
15
|
-
export {
|
15
|
+
export {
|
16
|
+
addPlugin,
|
17
|
+
type PluginOptions,
|
18
|
+
type PluginFacetInput,
|
19
|
+
pluginFacet,
|
20
|
+
} from './extensions/plugin'
|
16
21
|
export { addText } from './extensions/text'
|
17
22
|
export { type CommandArgs as CommandArgs } from './types/command'
|
18
23
|
export * from './types/editor'
|