rt-chat-input 1.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.
@@ -0,0 +1,92 @@
1
+ import { ChatInputProps } from '../types';
2
+ declare const _default: import('vue').DefineComponent<ChatInputProps, {
3
+ focus: () => void;
4
+ blur: () => void;
5
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
+ error: (message: string) => any;
7
+ stop: () => any;
8
+ send: (text: string, files: File[]) => any;
9
+ blur: (e: FocusEvent) => any;
10
+ change: (text: string) => any;
11
+ focus: (e: FocusEvent) => any;
12
+ voice: (audio: Blob, duration: number) => any;
13
+ attach: (files: File[]) => any;
14
+ }, string, import('vue').PublicProps, Readonly<ChatInputProps> & Readonly<{
15
+ onError?: ((message: string) => any) | undefined;
16
+ onStop?: (() => any) | undefined;
17
+ onSend?: ((text: string, files: File[]) => any) | undefined;
18
+ onBlur?: ((e: FocusEvent) => any) | undefined;
19
+ onChange?: ((text: string) => any) | undefined;
20
+ onFocus?: ((e: FocusEvent) => any) | undefined;
21
+ onVoice?: ((audio: Blob, duration: number) => any) | undefined;
22
+ onAttach?: ((files: File[]) => any) | undefined;
23
+ }>, {
24
+ fixed: boolean;
25
+ disabled: boolean;
26
+ placeholder: string;
27
+ wsUrl: string;
28
+ loading: boolean;
29
+ maxVoiceDuration: number;
30
+ theme: "light" | "dark" | "auto";
31
+ showVoiceButton: boolean;
32
+ showAttachmentButton: boolean;
33
+ acceptFileTypes: string;
34
+ bottomOffset: number | string;
35
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
36
+ textareaRef: HTMLTextAreaElement;
37
+ voiceRecorderRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').VoiceRecorderProps> & Readonly<{
38
+ onError?: ((message: string) => any) | undefined;
39
+ onVoiceRecorded?: ((audioBlob: Blob, duration: number) => any) | undefined;
40
+ onUpdateText?: ((text: string) => any) | undefined;
41
+ onEditText?: ((text: string) => any) | undefined;
42
+ }>, {
43
+ startExternalRecording: () => Promise<void>;
44
+ stopExternalRecording: (gesture?: "send" | "cancel" | "edit") => void;
45
+ setExternalStartPoint: (x: number, y: number) => void;
46
+ updateExternalGesture: (clientX: number, clientY: number) => void;
47
+ getGestureState: () => "cancel" | "send" | "edit";
48
+ isRecording: import('vue').Ref<boolean, boolean>;
49
+ isPreparing: import('vue').Ref<boolean, boolean>;
50
+ gestureState: import('vue').Ref<"cancel" | "send" | "edit", "cancel" | "send" | "edit">;
51
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
52
+ error: (message: string) => any;
53
+ voiceRecorded: (audioBlob: Blob, duration: number) => any;
54
+ updateText: (text: string) => any;
55
+ editText: (text: string) => any;
56
+ }, import('vue').PublicProps, {
57
+ disabled: boolean;
58
+ maxDuration: number;
59
+ variant: "icon" | "block";
60
+ realtime: boolean;
61
+ }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
62
+ cancelAreaRef: HTMLDivElement;
63
+ editAreaRef: HTMLDivElement;
64
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
65
+ P: {};
66
+ B: {};
67
+ D: {};
68
+ C: {};
69
+ M: {};
70
+ Defaults: {};
71
+ }, Readonly<import('..').VoiceRecorderProps> & Readonly<{
72
+ onError?: ((message: string) => any) | undefined;
73
+ onVoiceRecorded?: ((audioBlob: Blob, duration: number) => any) | undefined;
74
+ onUpdateText?: ((text: string) => any) | undefined;
75
+ onEditText?: ((text: string) => any) | undefined;
76
+ }>, {
77
+ startExternalRecording: () => Promise<void>;
78
+ stopExternalRecording: (gesture?: "send" | "cancel" | "edit") => void;
79
+ setExternalStartPoint: (x: number, y: number) => void;
80
+ updateExternalGesture: (clientX: number, clientY: number) => void;
81
+ getGestureState: () => "cancel" | "send" | "edit";
82
+ isRecording: import('vue').Ref<boolean, boolean>;
83
+ isPreparing: import('vue').Ref<boolean, boolean>;
84
+ gestureState: import('vue').Ref<"cancel" | "send" | "edit", "cancel" | "send" | "edit">;
85
+ }, {}, {}, {}, {
86
+ disabled: boolean;
87
+ maxDuration: number;
88
+ variant: "icon" | "block";
89
+ realtime: boolean;
90
+ }> | null;
91
+ }, HTMLDivElement>;
92
+ export default _default;
@@ -0,0 +1,44 @@
1
+ interface Props {
2
+ modelValue: boolean;
3
+ title?: string;
4
+ content?: string;
5
+ showClose?: boolean;
6
+ showFooter?: boolean;
7
+ closeOnClickModal?: boolean;
8
+ confirmText?: string;
9
+ cancelText?: string;
10
+ }
11
+ declare function __VLS_template(): {
12
+ attrs: Partial<{}>;
13
+ slots: {
14
+ default?(_: {}): any;
15
+ footer?(_: {}): any;
16
+ };
17
+ refs: {};
18
+ rootEl: any;
19
+ };
20
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
21
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
+ "update:modelValue": (value: boolean) => any;
23
+ confirm: () => any;
24
+ cancel: () => any;
25
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
26
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
27
+ onConfirm?: (() => any) | undefined;
28
+ onCancel?: (() => any) | undefined;
29
+ }>, {
30
+ title: string;
31
+ content: string;
32
+ showClose: boolean;
33
+ showFooter: boolean;
34
+ closeOnClickModal: boolean;
35
+ confirmText: string;
36
+ cancelText: string;
37
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
38
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
+ export default _default;
40
+ type __VLS_WithTemplateSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,6 @@
1
+ import { ToastType } from '../types';
2
+ declare const _default: import('vue').DefineComponent<{}, {
3
+ add: (message: string, type?: ToastType, duration?: number) => void;
4
+ remove: (id: number) => void;
5
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
@@ -0,0 +1,30 @@
1
+ import { VoiceRecorderProps } from '../types';
2
+ declare const _default: import('vue').DefineComponent<VoiceRecorderProps, {
3
+ startExternalRecording: () => Promise<void>;
4
+ stopExternalRecording: (gesture?: "send" | "cancel" | "edit") => void;
5
+ setExternalStartPoint: (x: number, y: number) => void;
6
+ updateExternalGesture: (clientX: number, clientY: number) => void;
7
+ getGestureState: () => "cancel" | "send" | "edit";
8
+ isRecording: import('vue').Ref<boolean, boolean>;
9
+ isPreparing: import('vue').Ref<boolean, boolean>;
10
+ gestureState: import('vue').Ref<"cancel" | "send" | "edit", "cancel" | "send" | "edit">;
11
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
+ error: (message: string) => any;
13
+ voiceRecorded: (audioBlob: Blob, duration: number) => any;
14
+ updateText: (text: string) => any;
15
+ editText: (text: string) => any;
16
+ }, string, import('vue').PublicProps, Readonly<VoiceRecorderProps> & Readonly<{
17
+ onError?: ((message: string) => any) | undefined;
18
+ onVoiceRecorded?: ((audioBlob: Blob, duration: number) => any) | undefined;
19
+ onUpdateText?: ((text: string) => any) | undefined;
20
+ onEditText?: ((text: string) => any) | undefined;
21
+ }>, {
22
+ disabled: boolean;
23
+ maxDuration: number;
24
+ variant: "icon" | "block";
25
+ realtime: boolean;
26
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
27
+ cancelAreaRef: HTMLDivElement;
28
+ editAreaRef: HTMLDivElement;
29
+ }, HTMLDivElement>;
30
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { ToastOptions } from '../types';
2
+ export declare function useToast(): {
3
+ success: (message: string, duration?: number) => void;
4
+ error: (message: string, duration?: number) => void;
5
+ warning: (message: string, duration?: number) => void;
6
+ info: (message: string, duration?: number) => void;
7
+ show: (options: ToastOptions) => void;
8
+ };
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ size?: number | string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ size: number | string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ export { default as MicrophoneIcon } from './MicrophoneIcon.vue';
2
+ export { default as LoadingIcon } from './LoadingIcon.vue';
3
+ export { default as SendIcon } from './SendIcon.vue';
4
+ export { default as AttachmentIcon } from './AttachmentIcon.vue';
5
+ export { default as KeyboardIcon } from './KeyboardIcon.vue';
6
+ export { default as PlayIcon } from './PlayIcon.vue';
7
+ export { default as ArrowUpIcon } from './ArrowUpIcon.vue';
8
+ export { default as StopIcon } from './StopIcon.vue';
@@ -0,0 +1,11 @@
1
+ import { default as ChatInput } from './components/ChatInput.vue';
2
+ import { default as VoiceRecorder } from './components/VoiceRecorder.vue';
3
+ import { useToast } from './composables/useToast';
4
+ import { App } from 'vue';
5
+ export { ChatInput, VoiceRecorder };
6
+ export { useToast };
7
+ export type { ChatInputProps, VoiceRecorderProps } from './types';
8
+ declare const _default: {
9
+ install(app: App): void;
10
+ };
11
+ export default _default;
@@ -0,0 +1,42 @@
1
+ export interface ChatInputProps {
2
+ /** 占位文字 */
3
+ placeholder?: string;
4
+ /** 是否禁用 */
5
+ disabled?: boolean;
6
+ /** 是否处于加载/流式输出状态 */
7
+ loading?: boolean;
8
+ /** 最大录音时长(秒) */
9
+ maxVoiceDuration?: number;
10
+ /** WebSocket 地址(用于实时语音转写) */
11
+ wsUrl?: string;
12
+ /** 主题 */
13
+ theme?: "light" | "dark" | "auto";
14
+ /** 是否显示语音按钮 */
15
+ showVoiceButton?: boolean;
16
+ /** 是否显示附件按钮 */
17
+ showAttachmentButton?: boolean;
18
+ /** 接受的文件类型 */
19
+ acceptFileTypes?: string;
20
+ /** 是否使用固定底部定位布局(开箱即用模式) */
21
+ fixed?: boolean;
22
+ /** 底部偏移量(仅 fixed=true 时生效),默认 36px */
23
+ bottomOffset?: number | string;
24
+ }
25
+ export interface VoiceRecorderProps {
26
+ /** 最大录音时长(秒) */
27
+ maxDuration?: number;
28
+ /** 是否禁用 */
29
+ disabled?: boolean;
30
+ /** 显示模式: icon=小图标, block=块状按钮 */
31
+ variant?: "icon" | "block";
32
+ /** 是否开启实时转写 */
33
+ realtime?: boolean;
34
+ /** WebSocket 地址(用于实时语音转写) */
35
+ wsUrl?: string;
36
+ }
37
+ export type ToastType = "success" | "error" | "warning" | "info";
38
+ export interface ToastOptions {
39
+ message: string;
40
+ type?: ToastType;
41
+ duration?: number;
42
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "rt-chat-input",
3
+ "version": "1.0.0",
4
+ "description": "AI聊天输入框组件,支持文本输入、语音录制、文件上传",
5
+ "type": "module",
6
+ "main": "./dist/chat-input.umd.js",
7
+ "module": "./dist/chat-input.es.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/chat-input.es.js",
13
+ "require": "./dist/chat-input.umd.js"
14
+ },
15
+ "./style.css": "./dist/style.css"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "dev": "vite",
22
+ "build": "vue-tsc --noEmit && vite build",
23
+ "preview": "vite preview"
24
+ },
25
+ "peerDependencies": {
26
+ "vue": "^3.3.0"
27
+ },
28
+ "devDependencies": {
29
+ "@vitejs/plugin-vue": "^5.2.1",
30
+ "typescript": "~5.6.2",
31
+ "vite": "^6.0.5",
32
+ "vite-plugin-dts": "^4.4.0",
33
+ "vue": "^3.5.13",
34
+ "vue-tsc": "^2.2.0"
35
+ },
36
+ "keywords": [
37
+ "vue",
38
+ "vue3",
39
+ "chat",
40
+ "input",
41
+ "voice",
42
+ "recorder",
43
+ "AI"
44
+ ],
45
+ "license": "MIT"
46
+ }