@blueking/chat-x 0.0.1-beta.3 → 0.0.1-beta.5
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/ag-ui/types/constants.d.ts +38 -0
- package/dist/ag-ui/types/contents.d.ts +29 -0
- package/dist/ag-ui/types/index.d.ts +3 -0
- package/dist/ag-ui/types/messages.d.ts +113 -0
- package/dist/common/constants.d.ts +30 -0
- package/dist/common/icon.d.ts +14 -0
- package/dist/common/index.d.ts +5 -0
- package/dist/common/lang.d.ts +1 -0
- package/dist/common/markdown.d.ts +5 -0
- package/dist/common/shortcut.d.ts +2 -0
- package/dist/components/ai-buttons/scroll-btn/scroll-btn.vue.d.ts +19 -0
- package/dist/components/ai-buttons/tool-btn/tool-btn.vue.d.ts +8 -0
- package/dist/components/ai-selection/ai-selection.vue.d.ts +39 -0
- package/dist/components/ai-shortcut/shortcut-btn/shortcut-btn.vue.d.ts +26 -0
- package/dist/components/ai-shortcut/shortcut-btns/shortcut-btns.vue.d.ts +12 -0
- package/dist/components/ai-shortcut/shortcut-render/shortcut-render.vue.d.ts +10 -0
- package/dist/components/animation-text/animation-text.vue.d.ts +6 -0
- package/dist/components/chat-content/cite-content/cite-content.vue.d.ts +7 -0
- package/dist/components/chat-content/common-error-content/common-error-content.vue.d.ts +6 -0
- package/dist/components/chat-content/content-render/content-render.vue.d.ts +26 -0
- package/dist/components/chat-content/key-value-content/key-value-content.vue.d.ts +10 -0
- package/dist/components/chat-content/markdown-content/markdown-content.vue.d.ts +11 -0
- package/dist/components/chat-content/reference-content/reference-content.vue.d.ts +7 -0
- package/dist/components/chat-content/text-content/text-content.vue.d.ts +6 -0
- package/dist/components/chat-content/vnode-renderer.d.ts +27 -0
- package/dist/components/chat-content/x-content/x-content.vue.d.ts +17 -0
- package/dist/components/chat-input/ai-slash-editor/ai-slash-editor.vue.d.ts +28 -0
- package/dist/components/chat-input/ai-slash-editor/theme.d.ts +24 -0
- package/dist/components/chat-input/ai-slash-input/ai-prompt-list/ai-prompt-list.vue.d.ts +7 -0
- package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +49 -0
- package/dist/components/chat-input/ai-slash-input/ai-slash-menu/ai-slash-menu.vue.d.ts +8 -0
- package/dist/components/chat-input/ai-slash-input/command.d.ts +6 -0
- package/dist/components/chat-input/ai-slash-input/constants.d.ts +11 -0
- package/dist/components/chat-input/chat-input.vue.d.ts +72 -0
- package/dist/components/chat-input/input-attachment/input-attachment.vue.d.ts +25 -0
- package/dist/components/chat-message/activity-message/activity-message.vue.d.ts +13 -0
- package/dist/components/chat-message/assistant-message/assistant-message.vue.d.ts +16 -0
- package/dist/components/chat-message/flow-message/flow-detail.vue.d.ts +11 -0
- package/dist/components/chat-message/flow-message/flow-message.vue.d.ts +4 -0
- package/dist/components/chat-message/flow-message/flow-node-group.vue.d.ts +12 -0
- package/dist/components/chat-message/flow-message/flow-node-item.vue.d.ts +11 -0
- package/dist/components/chat-message/flow-message/flow-status-icons.d.ts +36 -0
- package/dist/components/chat-message/flow-message/index.d.ts +6 -0
- package/dist/components/chat-message/flow-message/mock.d.ts +13 -0
- package/dist/components/chat-message/flow-message/types.d.ts +132 -0
- package/dist/components/chat-message/info-message/info-message.vue.d.ts +4 -0
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +11484 -0
- package/dist/components/chat-message/message-render/message-render.vue.d.ts +21 -0
- package/dist/components/chat-message/reasoning-message/reasoning-message.vue.d.ts +13 -0
- package/dist/components/chat-message/tool-message/tool-message.vue.d.ts +4 -0
- package/dist/components/chat-message/user-message/user-message.vue.d.ts +6 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/markdown-token/code-content/code-content.vue.d.ts +15 -0
- package/dist/components/markdown-token/image-content/image-content.vue.d.ts +7 -0
- package/dist/components/markdown-token/index.d.ts +5 -0
- package/dist/components/markdown-token/latex-content/latex-content.vue.d.ts +8 -0
- package/dist/components/markdown-token/mermaid-content/mermaid-content.vue.d.ts +15 -0
- package/dist/components/message-tools/message-tools.vue.d.ts +18 -0
- package/dist/components/message-tools/user-feedback/user-feedback.vue.d.ts +13 -0
- package/dist/components/tool-call/desc-panel/desc-panel.vue.d.ts +7 -0
- package/dist/components/tool-call/toolcall-render/toolcall-render.vue.d.ts +10 -0
- package/dist/composables/index.d.ts +8 -0
- package/dist/composables/use-animation-text.d.ts +16 -0
- package/dist/composables/use-clipboard.d.ts +3 -0
- package/dist/composables/use-command-selection.d.ts +11 -0
- package/dist/composables/use-container-scroll.d.ts +15 -0
- package/dist/composables/use-global-config.d.ts +11 -0
- package/dist/composables/use-menu-keydown.d.ts +8 -0
- package/dist/composables/use-observer-visible-list.d.ts +10 -0
- package/dist/composables/use-parent-scrolling.d.ts +16 -0
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/overflow-tips.d.ts +15 -0
- package/dist/edix/commands.d.ts +6 -0
- package/dist/edix/doc/edit.d.ts +55 -0
- package/dist/edix/doc/position.d.ts +19 -0
- package/dist/edix/doc/types.d.ts +15 -0
- package/dist/edix/doc/utils.d.ts +9 -0
- package/dist/edix/dom/default.d.ts +4 -0
- package/dist/edix/dom/index.d.ts +42 -0
- package/dist/edix/dom/parser.d.ts +63 -0
- package/dist/edix/editor.d.ts +55 -0
- package/dist/edix/history.d.ts +10 -0
- package/dist/edix/index.d.ts +6 -0
- package/dist/edix/mutation.d.ts +8 -0
- package/dist/edix/plugins/singleline.d.ts +5 -0
- package/dist/edix/schema/index.d.ts +3 -0
- package/dist/edix/schema/plain.d.ts +7 -0
- package/dist/edix/schema/structured.d.ts +35 -0
- package/dist/edix/schema/types.d.ts +13 -0
- package/dist/edix/utils.d.ts +8 -0
- package/dist/icons/ai.d.ts +3 -0
- package/dist/icons/content.d.ts +21 -0
- package/dist/icons/index.d.ts +5 -0
- package/dist/icons/messages.d.ts +36 -0
- package/dist/icons/shortcuts.d.ts +12 -0
- package/dist/icons/tools.d.ts +51 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +10834 -0
- package/dist/index.js.map +1 -0
- package/dist/lang/lang.d.ts +70 -0
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/markdown-animation-attrs.d.ts +6 -0
- package/dist/plugins/markdown-latex.d.ts +19 -0
- package/dist/plugins/markdown-mermaid.d.ts +7 -0
- package/dist/types/editor.d.ts +20 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/input.d.ts +18 -0
- package/dist/types/shortcut.d.ts +64 -0
- package/dist/types/tool.d.ts +6 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/markdown-completer.d.ts +37 -0
- package/dist/utils/stream-markdown-completer.d.ts +17 -0
- package/dist/utils/tokens-to-vnodes.d.ts +28 -0
- package/dist/utils/utils.d.ts +7 -0
- package/package.json +32 -7
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type VNode } from 'vue';
|
|
2
|
+
import type { Message, MessageStatus } from '../../../ag-ui/types';
|
|
3
|
+
import type { MessageToolsProps } from '../../message-tools/message-tools.vue';
|
|
4
|
+
type __VLS_Slots = {
|
|
5
|
+
default: (props: {
|
|
6
|
+
content: string;
|
|
7
|
+
status: MessageStatus;
|
|
8
|
+
}) => VNode;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Props = Pick<MessageToolsProps, 'onAction'> & {
|
|
11
|
+
message: Partial<Message>;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReasoningMessage } from '../../../ag-ui/types/messages';
|
|
2
|
+
type __VLS_Props = Partial<ReasoningMessage>;
|
|
3
|
+
type __VLS_ModelProps = {
|
|
4
|
+
'collapsed'?: boolean;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:collapsed": (value: boolean) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
10
|
+
"onUpdate:collapsed"?: ((value: boolean) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolMessage } from '../../../ag-ui/types/messages';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<Partial<ToolMessage>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Partial<ToolMessage>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type MessageToolsProps } from '../../message-tools/message-tools.vue';
|
|
2
|
+
import type { UserMessage } from '../../../ag-ui/types/messages';
|
|
3
|
+
type __VLS_Props = Partial<UserMessage> & Pick<MessageToolsProps, 'onAction'>;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import AiSelection from './ai-selection/ai-selection.vue';
|
|
2
|
+
import ShortcutBtn from './ai-shortcut/shortcut-btn/shortcut-btn.vue';
|
|
3
|
+
import ShortcutBtns from './ai-shortcut/shortcut-btns/shortcut-btns.vue';
|
|
4
|
+
import ShortcutRender from './ai-shortcut/shortcut-render/shortcut-render.vue';
|
|
5
|
+
import ContentRender from './chat-content/content-render/content-render.vue';
|
|
6
|
+
import ChatInput from './chat-input/chat-input.vue';
|
|
7
|
+
import MessageContainer from './chat-message/message-container/message-container.vue';
|
|
8
|
+
import MessageRender from './chat-message/message-render/message-render.vue';
|
|
9
|
+
import MessageTools from './message-tools/message-tools.vue';
|
|
10
|
+
import MessageUserFeedback from './message-tools/user-feedback/user-feedback.vue';
|
|
11
|
+
export { AiSelection, ChatInput, ContentRender, MessageContainer, MessageRender, MessageTools, MessageUserFeedback, ShortcutBtn, ShortcutBtns, ShortcutRender, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Token } from '../../../markdown-it';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
token: Token[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
mounted: (payload: {
|
|
7
|
+
el: HTMLElement | null;
|
|
8
|
+
}) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onMounted?: ((payload: {
|
|
11
|
+
el: HTMLElement | null;
|
|
12
|
+
}) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
alt?: string;
|
|
3
|
+
src: string;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import CodeContent from './code-content/code-content.vue';
|
|
2
|
+
import ImageContent from './image-content/image-content.vue';
|
|
3
|
+
import LatexContent from './latex-content/latex-content.vue';
|
|
4
|
+
import MermaidContent from './mermaid-content/mermaid-content.vue';
|
|
5
|
+
export { CodeContent, ImageContent, LatexContent, MermaidContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Token } from '../../../markdown-it';
|
|
2
|
+
import 'katex/dist/katex.min.css';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
token: Token[];
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Token } from '../../../markdown-it';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
token: Token[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
mounted: (payload: {
|
|
7
|
+
el: HTMLElement | null;
|
|
8
|
+
}) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onMounted?: ((payload: {
|
|
11
|
+
el: HTMLElement | null;
|
|
12
|
+
}) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type TippyOptions } from 'vue-tippy';
|
|
2
|
+
import type { IToolBtn } from '../../types';
|
|
3
|
+
export type MessageToolsProps = {
|
|
4
|
+
messageTools?: IToolBtn[];
|
|
5
|
+
onAction?: (tool: IToolBtn) => Promise<string[] | void>;
|
|
6
|
+
tippyOptions?: Partial<Omit<TippyOptions, 'content' | 'getReferenceClientRect' | 'triggerTarget'>>;
|
|
7
|
+
updateTools?: IToolBtn[];
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<MessageToolsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
10
|
+
feedback: (tool: IToolBtn, reasonList: string[], otherReason: string) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<MessageToolsProps> & Readonly<{
|
|
12
|
+
onFeedback?: ((tool: IToolBtn, reasonList: string[], otherReason: string) => any) | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
messageTools: IToolBtn[];
|
|
15
|
+
updateTools: IToolBtn[];
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
reasonList: string[];
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
cancel: () => any;
|
|
7
|
+
submit: (reasonList: string[], otherReason: string) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onCancel?: (() => any) | undefined;
|
|
10
|
+
onSubmit?: ((reasonList: string[], otherReason: string) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
desc?: string;
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MessageStatus } from '../../../ag-ui/types/constants';
|
|
2
|
+
import type { ToolCall } from '../../../ag-ui/types/messages';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
duration?: number;
|
|
5
|
+
status?: MessageStatus;
|
|
6
|
+
toolCall?: ToolCall;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './use-animation-text';
|
|
2
|
+
export * from './use-clipboard';
|
|
3
|
+
export * from './use-command-selection';
|
|
4
|
+
export * from './use-container-scroll';
|
|
5
|
+
export * from './use-global-config';
|
|
6
|
+
export * from './use-menu-keydown';
|
|
7
|
+
export * from './use-observer-visible-list';
|
|
8
|
+
export * from './use-parent-scrolling';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MaybeRef } from 'vue';
|
|
2
|
+
export interface AnimationConfig {
|
|
3
|
+
easing?: string;
|
|
4
|
+
fadeDuration?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface UseAnimationTextOptions {
|
|
7
|
+
animationConfig?: AnimationConfig;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const useAnimationText: (text: MaybeRef<string>, options?: AnimationConfig) => {
|
|
11
|
+
chunks: import("vue").Ref<string[], string[]>;
|
|
12
|
+
animationStyle: import("vue").ComputedRef<{
|
|
13
|
+
animation: string;
|
|
14
|
+
color: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EditorCommand } from '../edix';
|
|
2
|
+
export declare const useCommandSelection: () => {
|
|
3
|
+
commandSelection: import("vue").ShallowRef<{
|
|
4
|
+
column: number;
|
|
5
|
+
line: number;
|
|
6
|
+
}, {
|
|
7
|
+
column: number;
|
|
8
|
+
line: number;
|
|
9
|
+
}>;
|
|
10
|
+
GetCursorPosition: EditorCommand<[]>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComputedRef, type MaybeRef } from 'vue';
|
|
2
|
+
export declare const CONTAINER_SCROLL_TOKEN: unique symbol;
|
|
3
|
+
export type ContainerScrollData = {
|
|
4
|
+
isScrollBottom: boolean;
|
|
5
|
+
scrollBottomHeight: number;
|
|
6
|
+
toScrollBottom: () => void;
|
|
7
|
+
toScrollTop: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const useContainerScrollProvider: (containerRef: MaybeRef<HTMLElement | null>, bottomRef: MaybeRef<HTMLElement | null>) => {
|
|
10
|
+
isScrollBottom: import("vue").ShallowRef<boolean, boolean>;
|
|
11
|
+
scrollBottomHeight: import("vue").ShallowRef<number, number>;
|
|
12
|
+
toScrollBottom: () => void;
|
|
13
|
+
toScrollTop: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const useContainerScrollConsumer: () => ComputedRef<ContainerScrollData> | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ComputedRef } from 'vue';
|
|
2
|
+
export declare const MESSAGE_SLOT_ID = "ai-blueking-message-slot";
|
|
3
|
+
export declare const AI_BLUEKING_MESSAGE_SLOT_ID: unique symbol;
|
|
4
|
+
export declare const getMessageSlotId: () => ComputedRef<string> | undefined;
|
|
5
|
+
export declare const useGlobalConfig: () => {
|
|
6
|
+
messageSlotId: ComputedRef<string>;
|
|
7
|
+
readonly rawMessageSlotId: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const useMessageSlotId: () => {
|
|
10
|
+
messageSlotId: import("vue").ShallowRef<string | undefined, string | undefined>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ShallowRef, type TemplateRef } from 'vue';
|
|
2
|
+
import type { ShortcutBtn } from '../components';
|
|
3
|
+
export declare const useObserverVisibleList: <T>(containerRef: TemplateRef<HTMLElement>, itemRefs: ShallowRef<(HTMLElement | null)[]>, params: {
|
|
4
|
+
gap: number;
|
|
5
|
+
items: T[];
|
|
6
|
+
moreItemRef?: TemplateRef<InstanceType<typeof ShortcutBtn>>;
|
|
7
|
+
}) => {
|
|
8
|
+
visibleItems: ShallowRef<T[], T[]>;
|
|
9
|
+
calculateVisibleMenuItems: () => Promise<void>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MaybeRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 递归获取滚动父级
|
|
4
|
+
* @param node - 节点
|
|
5
|
+
* @returns 滚动父级
|
|
6
|
+
*/
|
|
7
|
+
export declare const getScrollParent: (node: HTMLElement | null | ParentNode) => HTMLElement | null;
|
|
8
|
+
/**
|
|
9
|
+
* 监听父级滚动
|
|
10
|
+
* @param domRef - 节点
|
|
11
|
+
* @returns 是否滚动
|
|
12
|
+
*/
|
|
13
|
+
export declare const useParentScrolling: (domRef: MaybeRef<HTMLElement | null>) => {
|
|
14
|
+
isScrolling: import("vue").ShallowRef<boolean, boolean>;
|
|
15
|
+
scrollParent: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './overflow-tips';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ObjectDirective } from 'vue';
|
|
2
|
+
import { type Props } from 'tippy.js';
|
|
3
|
+
import { type noop } from '../types';
|
|
4
|
+
import 'tippy.js/dist/tippy.css';
|
|
5
|
+
type MouseEnterFunc = (e?: MouseEvent) => void;
|
|
6
|
+
type OverflowElement = HTMLElement & {
|
|
7
|
+
mouseEnterFunc?: MouseEnterFunc;
|
|
8
|
+
mouseLeaveFunc?: MouseEnterFunc;
|
|
9
|
+
unObserverFunc?: typeof noop;
|
|
10
|
+
};
|
|
11
|
+
export declare const OverflowTips: ObjectDirective<OverflowElement, Partial<Props> & {
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
text?: string;
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Transaction } from './doc/edit.js';
|
|
2
|
+
import { type DocFragment, type SelectionSnapshot } from './doc/types.js';
|
|
3
|
+
export type EditorCommand<A extends unknown[]> = (doc: DocFragment, selection: SelectionSnapshot, ...args: A) => Transaction | void;
|
|
4
|
+
export declare const Delete: EditorCommand<[]>;
|
|
5
|
+
export declare const InsertText: EditorCommand<[text: string]>;
|
|
6
|
+
export declare const ReplaceAll: EditorCommand<[text: string]>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DocFragment, DocLine, DocNode, Position, SelectionSnapshot, Writeable } from './types.js';
|
|
2
|
+
declare const TYPE_DELETE = 1;
|
|
3
|
+
type DeleteOperation = Readonly<{
|
|
4
|
+
_end: Position;
|
|
5
|
+
_start: Position;
|
|
6
|
+
_type: typeof TYPE_DELETE;
|
|
7
|
+
}>;
|
|
8
|
+
declare const TYPE_INSERT = 2;
|
|
9
|
+
type InsertOperation = Readonly<{
|
|
10
|
+
_fragment: DocFragment;
|
|
11
|
+
_pos: Position;
|
|
12
|
+
_type: typeof TYPE_INSERT;
|
|
13
|
+
}>;
|
|
14
|
+
declare const TYPE_SELECT = 3;
|
|
15
|
+
export type Operation = EditOperation | SelectOperataion;
|
|
16
|
+
type EditOperation = DeleteOperation | InsertOperation;
|
|
17
|
+
type SelectOperataion = Readonly<{
|
|
18
|
+
_anchor: Position | undefined;
|
|
19
|
+
_focus: Position | undefined;
|
|
20
|
+
_type: typeof TYPE_SELECT;
|
|
21
|
+
}>;
|
|
22
|
+
export declare class Transaction extends Array<Operation> {
|
|
23
|
+
static from(tr: ReadonlyArray<Operation>): Transaction;
|
|
24
|
+
delete(start: Position, end: Position): this;
|
|
25
|
+
insert(start: Position, fragment: DocFragment): this;
|
|
26
|
+
select(anchor?: Position, focus?: Position): this;
|
|
27
|
+
transform(position: Position): Position;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare const isDocEqual: (docA: DocFragment, docB: DocFragment) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare const isTextNode: (node: DocNode) => node is Readonly<{
|
|
37
|
+
text: string;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare const getLineSize: (line: DocLine) => number;
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare const merge: (a: DocLine, b: DocLine) => DocLine;
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare const sliceDoc: (doc: DocFragment, start: Position, end: Position) => DocFragment;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare const applyTransaction: (doc: Writeable<DocFragment>, selection: Writeable<SelectionSnapshot>, tr: Transaction) => void;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Position, PositionRange } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* 0 : same
|
|
5
|
+
* 1 : A is before B (forward)
|
|
6
|
+
* -1: A is after B (backward)
|
|
7
|
+
*/
|
|
8
|
+
export declare const compareLine: ([lineA]: Position, [lineB]: Position) => -1 | 0 | 1;
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* 0 : same
|
|
12
|
+
* 1 : A is before B (forward)
|
|
13
|
+
* -1: A is after B (backward)
|
|
14
|
+
*/
|
|
15
|
+
export declare const comparePosition: (posA: Position, posB: Position) => -1 | 0 | 1;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare const range: ([a, b]: readonly [Position, Position]) => PositionRange;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type DocFragment = readonly DocLine[];
|
|
2
|
+
export type DocLine = readonly DocNode[];
|
|
3
|
+
export type DocNode = TextNode | VoidNode;
|
|
4
|
+
export type Position = readonly [line: number, offset: number];
|
|
5
|
+
export type PositionRange = readonly [start: Position, end: Position];
|
|
6
|
+
export type SelectionSnapshot = readonly [anchor: Position, focus: Position];
|
|
7
|
+
export type TextNode = Readonly<{
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type VoidNode = Readonly<{
|
|
11
|
+
data: Record<string, unknown>;
|
|
12
|
+
}>;
|
|
13
|
+
export type Writeable<T> = {
|
|
14
|
+
-readonly [key in keyof T]: T[key];
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DocFragment, type VoidNode } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const docToString: (doc: DocFragment, voidToString?: (node: VoidNode) => string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const stringToDoc: (text: string) => DocFragment;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ParserConfig } from './parser.js';
|
|
2
|
+
import type { DocFragment, Position, PositionRange, SelectionSnapshot } from '../doc/types.js';
|
|
3
|
+
export { defaultIsBlockNode } from './default.js';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const getCurrentDocument: (node: Element) => Document;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare const getDOMSelection: (element: Element) => Selection;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const getSelectionRangeInEditor: (selection: Selection, root: Element) => Range | void;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare const setSelectionToDOM: (document: Document, root: Element, [anchor, focus]: SelectionSnapshot, config: ParserConfig) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare const serializeRange: (root: Element, config: ParserConfig, { startOffset, startContainer, endOffset, endContainer }: AbstractRange) => PositionRange;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare const getEmptySelectionSnapshot: () => SelectionSnapshot;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare const takeSelectionSnapshot: (root: Element, config: ParserConfig) => SelectionSnapshot;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare const readDom: (root: Node, config: ParserConfig, serializeVoid: (node: Element) => Record<string, unknown> | void, option?: {
|
|
36
|
+
_end: [Node, number];
|
|
37
|
+
_start: [Node, number] | undefined;
|
|
38
|
+
}) => DocFragment;
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare const getPointedCaretPosition: (document: Document, root: Element, { clientX, clientY }: MouseEvent, config: ParserConfig) => Position | void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface ParserConfig {
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
_document: Document;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
_isBlock: (node: Element) => boolean;
|
|
10
|
+
}
|
|
11
|
+
interface ParserOption {
|
|
12
|
+
_endNode?: Node;
|
|
13
|
+
_excludeEnd?: boolean;
|
|
14
|
+
_startNode?: Node;
|
|
15
|
+
}
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare const TOKEN_TEXT = 1;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const TOKEN_VOID = 2;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare const TOKEN_SOFT_BREAK = 3;
|
|
22
|
+
/** @internal */
|
|
23
|
+
export declare const TOKEN_BLOCK = 4;
|
|
24
|
+
declare const TOKEN_EMPTY_BLOCK_ANCHOR = 5;
|
|
25
|
+
declare const TOKEN_INVALID_SOFT_BREAK = 6;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export type TokenType = typeof TOKEN_BLOCK | typeof TOKEN_EMPTY_BLOCK_ANCHOR | typeof TOKEN_INVALID_SOFT_BREAK | typeof TOKEN_SOFT_BREAK | typeof TOKEN_TEXT | typeof TOKEN_VOID;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare const isTextNode: (node: Node) => node is Text;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare const isElementNode: (node: Node) => node is Element;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare const isCommentNode: (node: Node) => node is Comment;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare const isVoidNode: (node: Element) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare const getDomNode: <T extends TokenType | void>() => T extends typeof TOKEN_TEXT ? Text : T extends TokenType ? Element : Element | Text;
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare const getNodeSize: () => number;
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export declare const moveToBlock: (index: number) => void;
|
|
58
|
+
declare const readNext: () => TokenType | void;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare const parse: <T>(scopeFn: (read: typeof readNext) => T, root: Node, { _document: document, _isBlock: isBlock }: ParserConfig, option?: ParserOption) => T;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { EditorCommand } from './commands.js';
|
|
2
|
+
import type { DocSchema } from './schema/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Methods of editor instance.
|
|
5
|
+
*/
|
|
6
|
+
export interface Editor {
|
|
7
|
+
/**
|
|
8
|
+
* Dispatches editing command.
|
|
9
|
+
* @param fn command function
|
|
10
|
+
* @param args arguments of command
|
|
11
|
+
*/
|
|
12
|
+
command: <A extends unknown[]>(fn: EditorCommand<A>, ...args: A) => void;
|
|
13
|
+
/**
|
|
14
|
+
* A function to make DOM editable.
|
|
15
|
+
* @returns A function to stop subscribing DOM changes and restores previous DOM state.
|
|
16
|
+
*/
|
|
17
|
+
input: (element: HTMLElement) => () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Changes editor's read-only state.
|
|
20
|
+
* @param value `true` to read-only. `false` to editable.
|
|
21
|
+
*/
|
|
22
|
+
readonly: (value: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Options of {@link createEditor}.
|
|
26
|
+
*/
|
|
27
|
+
export interface EditorOptions<T> {
|
|
28
|
+
/**
|
|
29
|
+
* Initial document state.
|
|
30
|
+
*/
|
|
31
|
+
doc: T;
|
|
32
|
+
/**
|
|
33
|
+
* TODO
|
|
34
|
+
*/
|
|
35
|
+
schema: DocSchema<T>;
|
|
36
|
+
/**
|
|
37
|
+
* TODO
|
|
38
|
+
*/
|
|
39
|
+
isBlock?: (node: HTMLElement) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Callback invoked when document state changes.
|
|
42
|
+
*/
|
|
43
|
+
onChange: (doc: T) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Callback invoked when `keydown` events are dispatched.
|
|
46
|
+
*
|
|
47
|
+
* Return `true` if you want to cancel the editor's default behavior.
|
|
48
|
+
*/
|
|
49
|
+
onKeyDown?: (keyboard: KeyboardPayload) => boolean | void;
|
|
50
|
+
}
|
|
51
|
+
export type KeyboardPayload = Pick<KeyboardEvent, 'altKey' | 'code' | 'ctrlKey' | 'key' | 'metaKey' | 'shiftKey'>;
|
|
52
|
+
/**
|
|
53
|
+
* A function to initialize editor.
|
|
54
|
+
*/
|
|
55
|
+
export declare const createEditor: <T>({ schema: { single: isSingleline, js: docToJS, doc: jsToDoc, copy, paste }, doc: initialDoc, isBlock, onChange, onKeyDown: onKeyDownCallback, }: EditorOptions<T>) => Editor;
|