@platejs/ai 49.2.15 → 50.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.
@@ -33,4 +33,26 @@ declare const BaseAIPlugin: platejs.SlatePlugin<PluginConfig<any, {}, {}, Record
33
33
  undo: () => void;
34
34
  }>, {}>>;
35
35
 
36
- export { type BaseAIPluginConfig as B, BaseAIPlugin as a, removeAINodes as b, insertAINodes as i, removeAIMarks as r };
36
+ type AIToolName = 'comment' | 'edit' | 'generate' | null;
37
+ type AIMode = 'chat' | 'insert';
38
+
39
+ type EditorPrompt = ((params: EditorPromptParams) => string) | PromptConfig | string;
40
+ interface EditorPromptParams {
41
+ editor: SlateEditor;
42
+ isBlockSelecting: boolean;
43
+ isSelecting: boolean;
44
+ }
45
+ type MarkdownType = 'block' | 'blockSelection' | 'blockSelectionWithBlockId' | 'blockWithBlockId' | 'editor' | 'editorWithBlockId';
46
+ interface PromptConfig {
47
+ default: string;
48
+ blockSelecting?: string;
49
+ selecting?: string;
50
+ }
51
+ declare const replacePlaceholders: (editor: SlateEditor, text: string, { prompt, }?: {
52
+ prompt?: string;
53
+ }) => string;
54
+ declare const getEditorPrompt: (editor: SlateEditor, { prompt, }: {
55
+ prompt?: EditorPrompt;
56
+ }) => string;
57
+
58
+ export { type AIToolName as A, type BaseAIPluginConfig as B, type EditorPrompt as E, type MarkdownType as M, type PromptConfig as P, BaseAIPlugin as a, type AIMode as b, removeAINodes as c, type EditorPromptParams as d, replacePlaceholders as e, getEditorPrompt as g, insertAINodes as i, removeAIMarks as r };
@@ -33,4 +33,26 @@ declare const BaseAIPlugin: platejs.SlatePlugin<PluginConfig<any, {}, {}, Record
33
33
  undo: () => void;
34
34
  }>, {}>>;
35
35
 
36
- export { type BaseAIPluginConfig as B, BaseAIPlugin as a, removeAINodes as b, insertAINodes as i, removeAIMarks as r };
36
+ type AIToolName = 'comment' | 'edit' | 'generate' | null;
37
+ type AIMode = 'chat' | 'insert';
38
+
39
+ type EditorPrompt = ((params: EditorPromptParams) => string) | PromptConfig | string;
40
+ interface EditorPromptParams {
41
+ editor: SlateEditor;
42
+ isBlockSelecting: boolean;
43
+ isSelecting: boolean;
44
+ }
45
+ type MarkdownType = 'block' | 'blockSelection' | 'blockSelectionWithBlockId' | 'blockWithBlockId' | 'editor' | 'editorWithBlockId';
46
+ interface PromptConfig {
47
+ default: string;
48
+ blockSelecting?: string;
49
+ selecting?: string;
50
+ }
51
+ declare const replacePlaceholders: (editor: SlateEditor, text: string, { prompt, }?: {
52
+ prompt?: string;
53
+ }) => string;
54
+ declare const getEditorPrompt: (editor: SlateEditor, { prompt, }: {
55
+ prompt?: EditorPrompt;
56
+ }) => string;
57
+
58
+ export { type AIToolName as A, type BaseAIPluginConfig as B, type EditorPrompt as E, type MarkdownType as M, type PromptConfig as P, BaseAIPlugin as a, type AIMode as b, removeAINodes as c, type EditorPromptParams as d, replacePlaceholders as e, getEditorPrompt as g, insertAINodes as i, removeAIMarks as r };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,6 @@
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, Path, TElement, TText, Descendant } from 'platejs';
4
- import { PlateEditor } from 'platejs/react';
5
- import { DeserializeMdOptions, SerializeMdOptions } from '@platejs/markdown';
1
+ import { M as MarkdownType } from './getEditorPrompt-FgyoD13L.mjs';
2
+ export { b as AIMode, A as AIToolName, a as BaseAIPlugin, B as BaseAIPluginConfig, E as EditorPrompt, d as EditorPromptParams, P as PromptConfig, g as getEditorPrompt, i as insertAINodes, r as removeAIMarks, c as removeAINodes, e as replacePlaceholders } from './getEditorPrompt-FgyoD13L.mjs';
3
+ import { SlateEditor, History } from 'platejs';
6
4
 
7
5
  declare const undoAI: (editor: SlateEditor) => void;
8
6
 
@@ -13,32 +11,8 @@ declare const withAIBatch: (editor: SlateEditor, fn: () => void, { split, }?: {
13
11
  split?: boolean;
14
12
  }) => void;
15
13
 
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) => 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";
14
+ declare const getMarkdown: (editor: SlateEditor, { type, }: {
15
+ type: MarkdownType;
40
16
  }) => string;
41
- declare function isCompleteCodeBlock(str: string): boolean;
42
- declare function isCompleteMath(str: string): boolean;
43
17
 
44
- export { type AIBatch, type SteamInsertChunkOptions, escapeInput, getChunkTrimmed, getCurrentBlockPath, getListNode, isCompleteCodeBlock, isCompleteMath, isSameNode, nodesWithProps, streamDeserializeInlineMd, streamDeserializeMd, streamInsertChunk, streamSerializeMd, undoAI, withAIBatch };
18
+ export { type AIBatch, MarkdownType, getMarkdown, undoAI, withAIBatch };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
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, Path, TElement, TText, Descendant } from 'platejs';
4
- import { PlateEditor } from 'platejs/react';
5
- import { DeserializeMdOptions, SerializeMdOptions } from '@platejs/markdown';
1
+ import { M as MarkdownType } from './getEditorPrompt-FgyoD13L.js';
2
+ export { b as AIMode, A as AIToolName, a as BaseAIPlugin, B as BaseAIPluginConfig, E as EditorPrompt, d as EditorPromptParams, P as PromptConfig, g as getEditorPrompt, i as insertAINodes, r as removeAIMarks, c as removeAINodes, e as replacePlaceholders } from './getEditorPrompt-FgyoD13L.js';
3
+ import { SlateEditor, History } from 'platejs';
6
4
 
7
5
  declare const undoAI: (editor: SlateEditor) => void;
8
6
 
@@ -13,32 +11,8 @@ declare const withAIBatch: (editor: SlateEditor, fn: () => void, { split, }?: {
13
11
  split?: boolean;
14
12
  }) => void;
15
13
 
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) => 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";
14
+ declare const getMarkdown: (editor: SlateEditor, { type, }: {
15
+ type: MarkdownType;
40
16
  }) => string;
41
- declare function isCompleteCodeBlock(str: string): boolean;
42
- declare function isCompleteMath(str: string): boolean;
43
17
 
44
- export { type AIBatch, type SteamInsertChunkOptions, escapeInput, getChunkTrimmed, getCurrentBlockPath, getListNode, isCompleteCodeBlock, isCompleteMath, isSameNode, nodesWithProps, streamDeserializeInlineMd, streamDeserializeMd, streamInsertChunk, streamSerializeMd, undoAI, withAIBatch };
18
+ export { type AIBatch, MarkdownType, getMarkdown, undoAI, withAIBatch };