@prosekit/core 0.0.0-next-20230709094459 → 0.0.0-next-20231120040948
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 +1022 -0
- package/dist/prosekit-core.d.ts +66 -283
- package/dist/prosekit-core.js +1137 -392
- package/dist/style.css +4 -1
- package/package.json +6 -6
- package/src/index.ts +56 -15
package/dist/prosekit-core.d.ts
CHANGED
@@ -1,283 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
};
|
22
|
-
|
23
|
-
|
24
|
-
};
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
|
67
|
-
*/
|
68
|
-
type ExtractTyping<E extends Extension> = E extends Extension<infer T> ? T : never;
|
69
|
-
/**
|
70
|
-
* @public
|
71
|
-
*/
|
72
|
-
type ExtractNodes<E extends Extension> = ExtractNodesFromTyping<ExtractTyping<E>>;
|
73
|
-
/**
|
74
|
-
* @public
|
75
|
-
*/
|
76
|
-
type ExtractMarks<E extends Extension> = ExtractMarksFromTyping<ExtractTyping<E>>;
|
77
|
-
/**
|
78
|
-
* @internal
|
79
|
-
*/
|
80
|
-
type ExtractCommandArgs<E extends Extension> = ExtractCommandArgsFromTyping<ExtractTyping<E>>;
|
81
|
-
/**
|
82
|
-
* @public
|
83
|
-
*/
|
84
|
-
type ExtractCommandCreators<E extends Extension> = ToCommandCreators<ExtractCommandArgs<E>>;
|
85
|
-
/**
|
86
|
-
* @public
|
87
|
-
*/
|
88
|
-
type ExtractCommandDispatchers<E extends Extension> = ToCommandDispatcher<ExtractCommandArgs<E>>;
|
89
|
-
/**
|
90
|
-
* @internal
|
91
|
-
*/
|
92
|
-
type SimplifyExtension<E extends Extension | Extension[]> = E extends Extension[] ? Extension<ExceptEmptyValue<{
|
93
|
-
NODES: ExtractNodes<E[number]>;
|
94
|
-
MARKS: ExtractMarks<E[number]>;
|
95
|
-
COMMAND_ARGS: SimplifyUnion<ExtractCommandArgs<E[number]>>;
|
96
|
-
}>> : E;
|
97
|
-
|
98
|
-
/** @public */
|
99
|
-
interface EditorOptions<E extends Extension> {
|
100
|
-
extension: E;
|
101
|
-
}
|
102
|
-
/** @public */
|
103
|
-
declare function createEditor<E extends Extension>({ extension, }: EditorOptions<E>): Editor<E>;
|
104
|
-
/** @public */
|
105
|
-
declare class Editor<E extends Extension = any> {
|
106
|
-
private instance;
|
107
|
-
private constructor();
|
108
|
-
private afterMounted;
|
109
|
-
/** @internal */
|
110
|
-
static create(instance: any): Editor<any>;
|
111
|
-
get mounted(): boolean;
|
112
|
-
get view(): EditorView;
|
113
|
-
get schema(): Schema<ExtractNodes<E>, ExtractMarks<E>>;
|
114
|
-
get commands(): ExtractCommandDispatchers<E>;
|
115
|
-
mount(place: HTMLElement | null | undefined | void): void;
|
116
|
-
unmount(): void;
|
117
|
-
use(extension: Extension): VoidFunction;
|
118
|
-
}
|
119
|
-
|
120
|
-
/** @public */
|
121
|
-
interface FacetOptions<Input, Output> {
|
122
|
-
combine: (inputs: Input[]) => Output;
|
123
|
-
next: Facet<Output, any>;
|
124
|
-
}
|
125
|
-
/** @public */
|
126
|
-
declare class Facet<Input, Output> {
|
127
|
-
/** @internal */
|
128
|
-
readonly index: number;
|
129
|
-
/** @internal */
|
130
|
-
readonly combine: (inputs: Input[]) => Output;
|
131
|
-
/** @internal */
|
132
|
-
readonly next: Facet<Output, any> | null;
|
133
|
-
private constructor();
|
134
|
-
static define<Input, Output>({ combine, next }: FacetOptions<Input, Output>): Facet<Input, Output>;
|
135
|
-
/** @internal */
|
136
|
-
static defineSlot<Input>({ combine, }: Omit<FacetOptions<Input, Input>, 'next'>): Facet<Input, Input>;
|
137
|
-
extension(inputs: Input[]): FacetExtension<Input, Output>;
|
138
|
-
}
|
139
|
-
/** @public */
|
140
|
-
declare class FacetExtension<Input, Output> {
|
141
|
-
readonly facet: Facet<Input, Output>;
|
142
|
-
readonly inputs: Input[];
|
143
|
-
extension: Extension;
|
144
|
-
constructor(facet: Facet<Input, Output>, inputs: Input[]);
|
145
|
-
}
|
146
|
-
|
147
|
-
declare function defineExtension<E extends Extension | Extension[]>(extension: E): SimplifyExtension<E>;
|
148
|
-
|
149
|
-
/** @public */
|
150
|
-
declare function withPriority<T extends Extension>(extension: T, priority: Priority): T;
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Base class for all ProseKit errors.
|
154
|
-
*/
|
155
|
-
declare class ProseKitError extends Error {
|
156
|
-
}
|
157
|
-
|
158
|
-
declare function addCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
|
159
|
-
COMMAND_ARGS: {
|
160
|
-
[K in keyof T]: Parameters<T[K]>;
|
161
|
-
};
|
162
|
-
}>;
|
163
|
-
/**
|
164
|
-
* Add some base commands
|
165
|
-
*
|
166
|
-
* @public
|
167
|
-
*/
|
168
|
-
declare function addBaseCommands(): Extension<{
|
169
|
-
COMMAND_ARGS: {
|
170
|
-
insertText: [{
|
171
|
-
text: string;
|
172
|
-
from?: number | undefined;
|
173
|
-
to?: number | undefined;
|
174
|
-
}];
|
175
|
-
insertNode: [{
|
176
|
-
node: ProseMirrorNode;
|
177
|
-
pos?: number | undefined;
|
178
|
-
}];
|
179
|
-
wrap: [{
|
180
|
-
nodeType: NodeType;
|
181
|
-
attrs?: Attrs | null | undefined;
|
182
|
-
}];
|
183
|
-
setBlockType: [{
|
184
|
-
nodeType: NodeType;
|
185
|
-
attrs?: Attrs | null | undefined;
|
186
|
-
from?: number | undefined;
|
187
|
-
to?: number | undefined;
|
188
|
-
}];
|
189
|
-
selectAll: [];
|
190
|
-
};
|
191
|
-
}>;
|
192
|
-
|
193
|
-
/** @public */
|
194
|
-
declare function addDoc(): Extension<{
|
195
|
-
NODES: "doc";
|
196
|
-
}>;
|
197
|
-
|
198
|
-
/** @public */
|
199
|
-
declare function addInputRule(rules: (context: {
|
200
|
-
schema: Schema;
|
201
|
-
}) => InputRule[]): Extension;
|
202
|
-
|
203
|
-
/** @public */
|
204
|
-
interface Keymap {
|
205
|
-
[key: string]: Command;
|
206
|
-
}
|
207
|
-
/** @public */
|
208
|
-
declare function addKeymap(keymap: Keymap): Extension;
|
209
|
-
/** @public */
|
210
|
-
declare function addBaseKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
211
|
-
|
212
|
-
/**
|
213
|
-
* @public
|
214
|
-
*/
|
215
|
-
interface MarkSpecOptions<M extends string = string> {
|
216
|
-
name: M;
|
217
|
-
spec: MarkSpec;
|
218
|
-
}
|
219
|
-
/**
|
220
|
-
* @public
|
221
|
-
*/
|
222
|
-
declare function addMarkSpec<Mark extends string>(options: MarkSpecOptions<Mark>): Extension<{
|
223
|
-
MARKS: Mark;
|
224
|
-
}>;
|
225
|
-
|
226
|
-
/**
|
227
|
-
* @public
|
228
|
-
*/
|
229
|
-
interface NodeSpecOptions<N extends string = string> {
|
230
|
-
name: N;
|
231
|
-
spec: NodeSpec;
|
232
|
-
topNode?: boolean;
|
233
|
-
}
|
234
|
-
/**
|
235
|
-
* @public
|
236
|
-
*/
|
237
|
-
declare function addNodeSpec<Node extends string>(options: NodeSpecOptions<Node>): Extension<{
|
238
|
-
NODES: Node;
|
239
|
-
}>;
|
240
|
-
|
241
|
-
interface NodeViewOptions {
|
242
|
-
name: string;
|
243
|
-
constructor: NodeViewConstructor;
|
244
|
-
}
|
245
|
-
declare function addNodeView(options: NodeViewOptions): Extension;
|
246
|
-
|
247
|
-
/** @public */
|
248
|
-
declare function addParagraph(): Extension<{
|
249
|
-
NODES: "paragraph";
|
250
|
-
}>;
|
251
|
-
|
252
|
-
interface StateConfigContext {
|
253
|
-
schema: Schema;
|
254
|
-
}
|
255
|
-
type StateConfigCallback = (ctx: StateConfigContext) => EditorStateConfig;
|
256
|
-
type ViewProps = Omit<DirectEditorProps, 'state'>;
|
257
|
-
|
258
|
-
/** @public */
|
259
|
-
interface PluginOptions {
|
260
|
-
plugins: Plugin[] | ((context: {
|
261
|
-
schema: Schema;
|
262
|
-
}) => Plugin[]);
|
263
|
-
}
|
264
|
-
/** @public */
|
265
|
-
declare function addPlugin({ plugins }: PluginOptions): Extension;
|
266
|
-
|
267
|
-
/** @public */
|
268
|
-
declare function addText(): Extension<{
|
269
|
-
NODES: "text";
|
270
|
-
}>;
|
271
|
-
|
272
|
-
/**
|
273
|
-
* @intneral
|
274
|
-
*/
|
275
|
-
type SimplifyUnion<T> = Simplify<UnionToIntersection<T>>;
|
276
|
-
|
277
|
-
/** @internal */
|
278
|
-
declare function getMarkType(schema: Schema, type: string | MarkType): MarkType;
|
279
|
-
|
280
|
-
/** @internal */
|
281
|
-
declare function getNodeType(schema: Schema, type: string | NodeType): NodeType;
|
282
|
-
|
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 };
|
1
|
+
export { addMark } from './_tsup-dts-rollup';
|
2
|
+
export { insertNode } from './_tsup-dts-rollup';
|
3
|
+
export { removeMark } from './_tsup-dts-rollup';
|
4
|
+
export { setBlockType } from './_tsup-dts-rollup';
|
5
|
+
export { toggleMark } from './_tsup-dts-rollup';
|
6
|
+
export { toggleNode } from './_tsup-dts-rollup';
|
7
|
+
export { Editor } from './_tsup-dts-rollup';
|
8
|
+
export { createEditor } from './_tsup-dts-rollup';
|
9
|
+
export { EditorOptions } from './_tsup-dts-rollup';
|
10
|
+
export { union } from './_tsup-dts-rollup';
|
11
|
+
export { withPriority } from './_tsup-dts-rollup';
|
12
|
+
export { ProseKitError_alias_1 as ProseKitError } from './_tsup-dts-rollup';
|
13
|
+
export { defineBaseCommands } from './_tsup-dts-rollup';
|
14
|
+
export { defineCommands } from './_tsup-dts-rollup';
|
15
|
+
export { defineDefaultState } from './_tsup-dts-rollup';
|
16
|
+
export { DefaultStateOptions } from './_tsup-dts-rollup';
|
17
|
+
export { defineDoc } from './_tsup-dts-rollup';
|
18
|
+
export { defineHistory } from './_tsup-dts-rollup';
|
19
|
+
export { defineInputRule } from './_tsup-dts-rollup';
|
20
|
+
export { defineBaseKeymap } from './_tsup-dts-rollup';
|
21
|
+
export { defineKeymap } from './_tsup-dts-rollup';
|
22
|
+
export { Keymap } from './_tsup-dts-rollup';
|
23
|
+
export { defineMarkSpec } from './_tsup-dts-rollup';
|
24
|
+
export { MarkSpecOptions } from './_tsup-dts-rollup';
|
25
|
+
export { defineNodeSpec } from './_tsup-dts-rollup';
|
26
|
+
export { NodeSpecOptions } from './_tsup-dts-rollup';
|
27
|
+
export { defineNodeView } from './_tsup-dts-rollup';
|
28
|
+
export { NodeViewOptions } from './_tsup-dts-rollup';
|
29
|
+
export { defineNodeViewEffect } from './_tsup-dts-rollup';
|
30
|
+
export { NodeViewEffectOptions } from './_tsup-dts-rollup';
|
31
|
+
export { defineParagraph } from './_tsup-dts-rollup';
|
32
|
+
export { definePlugin } from './_tsup-dts-rollup';
|
33
|
+
export { pluginFacet } from './_tsup-dts-rollup';
|
34
|
+
export { PluginPayload } from './_tsup-dts-rollup';
|
35
|
+
export { defineText } from './_tsup-dts-rollup';
|
36
|
+
export { defineUpdateHandler } from './_tsup-dts-rollup';
|
37
|
+
export { Facet } from './_tsup-dts-rollup';
|
38
|
+
export { FacetOptions } from './_tsup-dts-rollup';
|
39
|
+
export { CommandArgs } from './_tsup-dts-rollup';
|
40
|
+
export { Extension } from './_tsup-dts-rollup';
|
41
|
+
export { ExtractCommandAppliers } from './_tsup-dts-rollup';
|
42
|
+
export { ExtractCommandCreators } from './_tsup-dts-rollup';
|
43
|
+
export { ExtractMarks } from './_tsup-dts-rollup';
|
44
|
+
export { ExtractNodes } from './_tsup-dts-rollup';
|
45
|
+
export { SimplifyExtension } from './_tsup-dts-rollup';
|
46
|
+
export { ExtensionTyping } from './_tsup-dts-rollup';
|
47
|
+
export { NodeJSON } from './_tsup-dts-rollup';
|
48
|
+
export { SelectionJSON } from './_tsup-dts-rollup';
|
49
|
+
export { StateJSON } from './_tsup-dts-rollup';
|
50
|
+
export { Priority } from './_tsup-dts-rollup';
|
51
|
+
export { SimplifyUnion } from './_tsup-dts-rollup';
|
52
|
+
export { getMarkType } from './_tsup-dts-rollup';
|
53
|
+
export { getNodeType } from './_tsup-dts-rollup';
|
54
|
+
export { jsonFromElement } from './_tsup-dts-rollup';
|
55
|
+
export { jsonFromHTML } from './_tsup-dts-rollup';
|
56
|
+
export { jsonFromNode } from './_tsup-dts-rollup';
|
57
|
+
export { jsonFromState } from './_tsup-dts-rollup';
|
58
|
+
export { nodeFromElement } from './_tsup-dts-rollup';
|
59
|
+
export { nodeFromHTML } from './_tsup-dts-rollup';
|
60
|
+
export { nodeFromJSON } from './_tsup-dts-rollup';
|
61
|
+
export { stateFromJSON } from './_tsup-dts-rollup';
|
62
|
+
export { isAllSelection } from './_tsup-dts-rollup';
|
63
|
+
export { isMark } from './_tsup-dts-rollup';
|
64
|
+
export { isNodeSelection } from './_tsup-dts-rollup';
|
65
|
+
export { isProseMirrorNode } from './_tsup-dts-rollup';
|
66
|
+
export { isTextSelection } from './_tsup-dts-rollup';
|