@coze-editor/preset-chat 0.1.0-alpha.1e5e87

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.
@@ -0,0 +1,63 @@
1
+ import { ReactNode } from 'react';
2
+ import * as _codemirror_view from '@codemirror/view';
3
+ import * as _codemirror_state from '@codemirror/state';
4
+ import * as _coze_editor_core from '@coze-editor/core';
5
+ import { InferEditorAPIFromPlugins } from '@coze-editor/core';
6
+
7
+ interface EditorElement<Attrs = Record<string, any>> {
8
+ type: 'element';
9
+ tagName: string;
10
+ attributes: Attrs;
11
+ raw?: string;
12
+ }
13
+ interface EditorText {
14
+ type: 'text';
15
+ value: string;
16
+ }
17
+ type EditorNode = EditorElement | EditorText;
18
+ declare const schemaUtils: {
19
+ toJSON(text: string): EditorNode[];
20
+ fromJSON(elements: EditorNode[]): string;
21
+ };
22
+
23
+ interface ElementDefinition<Attrs = any> {
24
+ render: (props: Attrs) => ReactNode;
25
+ toString?: (element: EditorElement<Attrs>) => string;
26
+ }
27
+ interface ElementsDefinition {
28
+ [key: string]: ElementDefinition;
29
+ }
30
+ declare const CUSTOM_CLIPBOARD_MIMETYPE = "application/x-with-elements";
31
+
32
+ declare function useCurrentElement(): {
33
+ isSelected: boolean;
34
+ select: () => void;
35
+ remove: () => void;
36
+ };
37
+
38
+ declare const preset: (_coze_editor_core.ExtensionPluginSpec | _coze_editor_core.OptionPluginSpec<"fontSize", number> | _coze_editor_core.OptionPluginSpec<"placeholder", string | HTMLElement> | _coze_editor_core.OptionPluginSpec<"readOnly", boolean> | _coze_editor_core.OptionPluginSpec<"editable", boolean> | _coze_editor_core.OptionPluginSpec<"lineWrapping", boolean> | _coze_editor_core.OptionPluginSpec<"height", string | number> | _coze_editor_core.OptionPluginSpec<"minHeight", string | number> | _coze_editor_core.OptionPluginSpec<"maxHeight", string | number> | _coze_editor_core.APIPluginSpec<"getValue", [], string> | _coze_editor_core.APIPluginSpec<"setValue", [value: string], void> | _coze_editor_core.APIPluginSpec<"replaceText", [options: {
39
+ from: number;
40
+ to: number;
41
+ text: string;
42
+ cursorOffset?: number;
43
+ scrollIntoView?: boolean;
44
+ userEvent?: string;
45
+ }], void> | _coze_editor_core.APIPluginSpec<"getCursorPosition", [], number> | _coze_editor_core.APIPluginSpec<"setCursorPosition", [pos: number], void> | _coze_editor_core.APIPluginSpec<"focus", [], void> | _coze_editor_core.APIPluginSpec<"blur", [], void> | _coze_editor_core.APIPluginSpec<"disableKeybindings", [keys: string[]], void> | _coze_editor_core.APIPluginSpec<"updateASTDecorations", [], void> | _coze_editor_core.APIPluginSpec<"undo", [], void> | _coze_editor_core.APIPluginSpec<"redo", [], void> | _coze_editor_core.APIPluginSpec<"transformTextInSelection", [transformer: (text: string) => string | undefined], void> | _coze_editor_core.APIPluginSpec<"getSelection", [], {
46
+ from: number;
47
+ to: number;
48
+ anchor: number;
49
+ head: number;
50
+ }> | _coze_editor_core.APIPluginSpec<"getLineInfoAtPosition", [pos: number], _codemirror_state.Line> | _coze_editor_core.EventPluginSpec<"selectionChange", {
51
+ selection: {
52
+ from: number;
53
+ to: number;
54
+ head: number;
55
+ anchor: number;
56
+ };
57
+ update: _codemirror_view.ViewUpdate;
58
+ }> | _coze_editor_core.EventPluginSpec<"change", {
59
+ value: string;
60
+ }> | _coze_editor_core.EventPluginSpec<"focus", symbol> | _coze_editor_core.EventPluginSpec<"blur", symbol> | _coze_editor_core.DOMEventHandlerPluginSpec<"mousedown"> | _coze_editor_core.DOMEventHandlerPluginSpec<"mouseup"> | _coze_editor_core.APIPluginSpec<"insertElement", [element: Omit<EditorElement<Record<string, any>>, "type">], void> | _coze_editor_core.OptionPluginSpec<"elements", ElementsDefinition>)[];
61
+ type EditorAPI = InferEditorAPIFromPlugins<typeof preset>;
62
+
63
+ export { CUSTOM_CLIPBOARD_MIMETYPE, type EditorAPI, type EditorElement, type EditorNode, type EditorText, type ElementDefinition, preset as default, schemaUtils, useCurrentElement };
@@ -0,0 +1,63 @@
1
+ import { ReactNode } from 'react';
2
+ import * as _codemirror_view from '@codemirror/view';
3
+ import * as _codemirror_state from '@codemirror/state';
4
+ import * as _coze_editor_core from '@coze-editor/core';
5
+ import { InferEditorAPIFromPlugins } from '@coze-editor/core';
6
+
7
+ interface EditorElement<Attrs = Record<string, any>> {
8
+ type: 'element';
9
+ tagName: string;
10
+ attributes: Attrs;
11
+ raw?: string;
12
+ }
13
+ interface EditorText {
14
+ type: 'text';
15
+ value: string;
16
+ }
17
+ type EditorNode = EditorElement | EditorText;
18
+ declare const schemaUtils: {
19
+ toJSON(text: string): EditorNode[];
20
+ fromJSON(elements: EditorNode[]): string;
21
+ };
22
+
23
+ interface ElementDefinition<Attrs = any> {
24
+ render: (props: Attrs) => ReactNode;
25
+ toString?: (element: EditorElement<Attrs>) => string;
26
+ }
27
+ interface ElementsDefinition {
28
+ [key: string]: ElementDefinition;
29
+ }
30
+ declare const CUSTOM_CLIPBOARD_MIMETYPE = "application/x-with-elements";
31
+
32
+ declare function useCurrentElement(): {
33
+ isSelected: boolean;
34
+ select: () => void;
35
+ remove: () => void;
36
+ };
37
+
38
+ declare const preset: (_coze_editor_core.ExtensionPluginSpec | _coze_editor_core.OptionPluginSpec<"fontSize", number> | _coze_editor_core.OptionPluginSpec<"placeholder", string | HTMLElement> | _coze_editor_core.OptionPluginSpec<"readOnly", boolean> | _coze_editor_core.OptionPluginSpec<"editable", boolean> | _coze_editor_core.OptionPluginSpec<"lineWrapping", boolean> | _coze_editor_core.OptionPluginSpec<"height", string | number> | _coze_editor_core.OptionPluginSpec<"minHeight", string | number> | _coze_editor_core.OptionPluginSpec<"maxHeight", string | number> | _coze_editor_core.APIPluginSpec<"getValue", [], string> | _coze_editor_core.APIPluginSpec<"setValue", [value: string], void> | _coze_editor_core.APIPluginSpec<"replaceText", [options: {
39
+ from: number;
40
+ to: number;
41
+ text: string;
42
+ cursorOffset?: number;
43
+ scrollIntoView?: boolean;
44
+ userEvent?: string;
45
+ }], void> | _coze_editor_core.APIPluginSpec<"getCursorPosition", [], number> | _coze_editor_core.APIPluginSpec<"setCursorPosition", [pos: number], void> | _coze_editor_core.APIPluginSpec<"focus", [], void> | _coze_editor_core.APIPluginSpec<"blur", [], void> | _coze_editor_core.APIPluginSpec<"disableKeybindings", [keys: string[]], void> | _coze_editor_core.APIPluginSpec<"updateASTDecorations", [], void> | _coze_editor_core.APIPluginSpec<"undo", [], void> | _coze_editor_core.APIPluginSpec<"redo", [], void> | _coze_editor_core.APIPluginSpec<"transformTextInSelection", [transformer: (text: string) => string | undefined], void> | _coze_editor_core.APIPluginSpec<"getSelection", [], {
46
+ from: number;
47
+ to: number;
48
+ anchor: number;
49
+ head: number;
50
+ }> | _coze_editor_core.APIPluginSpec<"getLineInfoAtPosition", [pos: number], _codemirror_state.Line> | _coze_editor_core.EventPluginSpec<"selectionChange", {
51
+ selection: {
52
+ from: number;
53
+ to: number;
54
+ head: number;
55
+ anchor: number;
56
+ };
57
+ update: _codemirror_view.ViewUpdate;
58
+ }> | _coze_editor_core.EventPluginSpec<"change", {
59
+ value: string;
60
+ }> | _coze_editor_core.EventPluginSpec<"focus", symbol> | _coze_editor_core.EventPluginSpec<"blur", symbol> | _coze_editor_core.DOMEventHandlerPluginSpec<"mousedown"> | _coze_editor_core.DOMEventHandlerPluginSpec<"mouseup"> | _coze_editor_core.APIPluginSpec<"insertElement", [element: Omit<EditorElement<Record<string, any>>, "type">], void> | _coze_editor_core.OptionPluginSpec<"elements", ElementsDefinition>)[];
61
+ type EditorAPI = InferEditorAPIFromPlugins<typeof preset>;
62
+
63
+ export { CUSTOM_CLIPBOARD_MIMETYPE, type EditorAPI, type EditorElement, type EditorNode, type EditorText, type ElementDefinition, preset as default, schemaUtils, useCurrentElement };