@platejs/ai 49.0.0
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/README.md +7 -0
- package/dist/BaseAIPlugin-DyivsvyQ.d.mts +36 -0
- package/dist/BaseAIPlugin-DyivsvyQ.d.ts +36 -0
- package/dist/index.d.mts +44 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +992 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +953 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react/index.d.mts +435 -0
- package/dist/react/index.d.ts +435 -0
- package/dist/react/index.js +1215 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +1174 -0
- package/dist/react/index.mjs.map +1 -0
- package/package.json +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as platejs from 'platejs';
|
|
2
|
+
import { SlateEditor, Descendant, Path, TLocation, PluginConfig, OmitFirst } from 'platejs';
|
|
3
|
+
|
|
4
|
+
declare const insertAINodes: (editor: SlateEditor, nodes: Descendant[], { target, }?: {
|
|
5
|
+
target?: Path;
|
|
6
|
+
}) => void;
|
|
7
|
+
|
|
8
|
+
declare const removeAIMarks: (editor: SlateEditor, { at }?: {
|
|
9
|
+
at?: TLocation;
|
|
10
|
+
}) => void;
|
|
11
|
+
|
|
12
|
+
declare const removeAINodes: (editor: SlateEditor, { at }?: {
|
|
13
|
+
at?: Path;
|
|
14
|
+
}) => void;
|
|
15
|
+
|
|
16
|
+
type BaseAIPluginConfig = PluginConfig<'ai', {}, {}, {
|
|
17
|
+
ai: {
|
|
18
|
+
insertNodes: OmitFirst<typeof insertAINodes>;
|
|
19
|
+
removeMarks: OmitFirst<typeof removeAIMarks>;
|
|
20
|
+
removeNodes: OmitFirst<typeof removeAINodes>;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
declare const BaseAIPlugin: platejs.SlatePlugin<PluginConfig<any, {}, {}, Record<any, {
|
|
24
|
+
insertNodes: (nodes: platejs.Descendant[], args_1?: {
|
|
25
|
+
target?: platejs.Path;
|
|
26
|
+
} | undefined) => void;
|
|
27
|
+
removeMarks: (args_0?: {
|
|
28
|
+
at?: platejs.TLocation;
|
|
29
|
+
} | undefined) => void;
|
|
30
|
+
removeNodes: (args_0?: {
|
|
31
|
+
at?: platejs.Path;
|
|
32
|
+
} | undefined) => void;
|
|
33
|
+
undo: () => void;
|
|
34
|
+
}>, {}>>;
|
|
35
|
+
|
|
36
|
+
export { type BaseAIPluginConfig as B, BaseAIPlugin as a, removeAINodes as b, insertAINodes as i, removeAIMarks as r };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as platejs from 'platejs';
|
|
2
|
+
import { SlateEditor, Descendant, Path, TLocation, PluginConfig, OmitFirst } from 'platejs';
|
|
3
|
+
|
|
4
|
+
declare const insertAINodes: (editor: SlateEditor, nodes: Descendant[], { target, }?: {
|
|
5
|
+
target?: Path;
|
|
6
|
+
}) => void;
|
|
7
|
+
|
|
8
|
+
declare const removeAIMarks: (editor: SlateEditor, { at }?: {
|
|
9
|
+
at?: TLocation;
|
|
10
|
+
}) => void;
|
|
11
|
+
|
|
12
|
+
declare const removeAINodes: (editor: SlateEditor, { at }?: {
|
|
13
|
+
at?: Path;
|
|
14
|
+
}) => void;
|
|
15
|
+
|
|
16
|
+
type BaseAIPluginConfig = PluginConfig<'ai', {}, {}, {
|
|
17
|
+
ai: {
|
|
18
|
+
insertNodes: OmitFirst<typeof insertAINodes>;
|
|
19
|
+
removeMarks: OmitFirst<typeof removeAIMarks>;
|
|
20
|
+
removeNodes: OmitFirst<typeof removeAINodes>;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
declare const BaseAIPlugin: platejs.SlatePlugin<PluginConfig<any, {}, {}, Record<any, {
|
|
24
|
+
insertNodes: (nodes: platejs.Descendant[], args_1?: {
|
|
25
|
+
target?: platejs.Path;
|
|
26
|
+
} | undefined) => void;
|
|
27
|
+
removeMarks: (args_0?: {
|
|
28
|
+
at?: platejs.TLocation;
|
|
29
|
+
} | undefined) => void;
|
|
30
|
+
removeNodes: (args_0?: {
|
|
31
|
+
at?: platejs.Path;
|
|
32
|
+
} | undefined) => void;
|
|
33
|
+
undo: () => void;
|
|
34
|
+
}>, {}>>;
|
|
35
|
+
|
|
36
|
+
export { type BaseAIPluginConfig as B, BaseAIPlugin as a, removeAINodes as b, insertAINodes as i, removeAIMarks as r };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export { a as BaseAIPlugin, B as BaseAIPluginConfig, i as insertAINodes, r as removeAIMarks, b as removeAINodes } from './BaseAIPlugin-DyivsvyQ.mjs';
|
|
2
|
+
import * as platejs from 'platejs';
|
|
3
|
+
import { SlateEditor, History, TElement, TText, Descendant } from 'platejs';
|
|
4
|
+
import { PlateEditor } from 'platejs/react';
|
|
5
|
+
import { DeserializeMdOptions, SerializeMdOptions } from '@platejs/markdown';
|
|
6
|
+
|
|
7
|
+
declare const undoAI: (editor: SlateEditor) => void;
|
|
8
|
+
|
|
9
|
+
type AIBatch = History['undos'][number] & {
|
|
10
|
+
ai?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const withAIBatch: (editor: SlateEditor, fn: () => void, { split, }?: {
|
|
13
|
+
split?: boolean;
|
|
14
|
+
}) => void;
|
|
15
|
+
|
|
16
|
+
declare const streamDeserializeInlineMd: (editor: PlateEditor, text: string, options?: DeserializeMdOptions) => platejs.Descendant[];
|
|
17
|
+
|
|
18
|
+
declare const streamDeserializeMd: (editor: PlateEditor, data: string, options?: DeserializeMdOptions) => any;
|
|
19
|
+
|
|
20
|
+
interface SteamInsertChunkOptions {
|
|
21
|
+
elementProps?: any;
|
|
22
|
+
textProps?: any;
|
|
23
|
+
}
|
|
24
|
+
/** @experimental */
|
|
25
|
+
declare function streamInsertChunk(editor: PlateEditor, chunk: string, options?: SteamInsertChunkOptions): void;
|
|
26
|
+
declare const getCurrentBlockPath: (editor: SlateEditor) => platejs.Path;
|
|
27
|
+
|
|
28
|
+
declare const streamSerializeMd: (editor: PlateEditor, options: SerializeMdOptions, chunk: string) => string;
|
|
29
|
+
|
|
30
|
+
declare const escapeInput: (data: string) => string;
|
|
31
|
+
|
|
32
|
+
declare const getListNode: (editor: PlateEditor, node: TElement) => TElement;
|
|
33
|
+
|
|
34
|
+
declare const isSameNode: (editor: PlateEditor, node1: TElement | TText, node2: TElement | TText) => boolean;
|
|
35
|
+
|
|
36
|
+
declare const nodesWithProps: (editor: PlateEditor, nodes: Descendant[], options: SteamInsertChunkOptions) => Descendant[];
|
|
37
|
+
|
|
38
|
+
declare const getChunkTrimmed: (chunk: string, { direction, }?: {
|
|
39
|
+
direction?: "left" | "right";
|
|
40
|
+
}) => string;
|
|
41
|
+
declare function isCompleteCodeBlock(str: string): boolean;
|
|
42
|
+
declare function isCompleteMath(str: string): boolean;
|
|
43
|
+
|
|
44
|
+
export { type AIBatch, type SteamInsertChunkOptions, escapeInput, getChunkTrimmed, getCurrentBlockPath, getListNode, isCompleteCodeBlock, isCompleteMath, isSameNode, nodesWithProps, streamDeserializeInlineMd, streamDeserializeMd, streamInsertChunk, streamSerializeMd, undoAI, withAIBatch };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export { a as BaseAIPlugin, B as BaseAIPluginConfig, i as insertAINodes, r as removeAIMarks, b as removeAINodes } from './BaseAIPlugin-DyivsvyQ.js';
|
|
2
|
+
import * as platejs from 'platejs';
|
|
3
|
+
import { SlateEditor, History, TElement, TText, Descendant } from 'platejs';
|
|
4
|
+
import { PlateEditor } from 'platejs/react';
|
|
5
|
+
import { DeserializeMdOptions, SerializeMdOptions } from '@platejs/markdown';
|
|
6
|
+
|
|
7
|
+
declare const undoAI: (editor: SlateEditor) => void;
|
|
8
|
+
|
|
9
|
+
type AIBatch = History['undos'][number] & {
|
|
10
|
+
ai?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const withAIBatch: (editor: SlateEditor, fn: () => void, { split, }?: {
|
|
13
|
+
split?: boolean;
|
|
14
|
+
}) => void;
|
|
15
|
+
|
|
16
|
+
declare const streamDeserializeInlineMd: (editor: PlateEditor, text: string, options?: DeserializeMdOptions) => platejs.Descendant[];
|
|
17
|
+
|
|
18
|
+
declare const streamDeserializeMd: (editor: PlateEditor, data: string, options?: DeserializeMdOptions) => any;
|
|
19
|
+
|
|
20
|
+
interface SteamInsertChunkOptions {
|
|
21
|
+
elementProps?: any;
|
|
22
|
+
textProps?: any;
|
|
23
|
+
}
|
|
24
|
+
/** @experimental */
|
|
25
|
+
declare function streamInsertChunk(editor: PlateEditor, chunk: string, options?: SteamInsertChunkOptions): void;
|
|
26
|
+
declare const getCurrentBlockPath: (editor: SlateEditor) => platejs.Path;
|
|
27
|
+
|
|
28
|
+
declare const streamSerializeMd: (editor: PlateEditor, options: SerializeMdOptions, chunk: string) => string;
|
|
29
|
+
|
|
30
|
+
declare const escapeInput: (data: string) => string;
|
|
31
|
+
|
|
32
|
+
declare const getListNode: (editor: PlateEditor, node: TElement) => TElement;
|
|
33
|
+
|
|
34
|
+
declare const isSameNode: (editor: PlateEditor, node1: TElement | TText, node2: TElement | TText) => boolean;
|
|
35
|
+
|
|
36
|
+
declare const nodesWithProps: (editor: PlateEditor, nodes: Descendant[], options: SteamInsertChunkOptions) => Descendant[];
|
|
37
|
+
|
|
38
|
+
declare const getChunkTrimmed: (chunk: string, { direction, }?: {
|
|
39
|
+
direction?: "left" | "right";
|
|
40
|
+
}) => string;
|
|
41
|
+
declare function isCompleteCodeBlock(str: string): boolean;
|
|
42
|
+
declare function isCompleteMath(str: string): boolean;
|
|
43
|
+
|
|
44
|
+
export { type AIBatch, type SteamInsertChunkOptions, escapeInput, getChunkTrimmed, getCurrentBlockPath, getListNode, isCompleteCodeBlock, isCompleteMath, isSameNode, nodesWithProps, streamDeserializeInlineMd, streamDeserializeMd, streamInsertChunk, streamSerializeMd, undoAI, withAIBatch };
|