@mobilon-dev/chotto 0.3.90 → 0.3.92
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/chotto.css +1 -1
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.js +1 -1
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +23 -23
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +3 -3
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +87 -103
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +218 -182
- package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue.js +2 -2
- package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +52 -79
- package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue.js +2 -2
- package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +35 -64
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +4 -0
- package/dist/components/2_feed_elements/CallMessage/CallMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/CallMessage/CallMessage.vue2.js +4 -0
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +33 -29
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +62 -58
- package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue2.js +27 -23
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +49 -41
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +105 -101
- package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
- package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +224 -138
- package/dist/components/3_compounds/ChatList/composables/useChatListFilter.js +18 -13
- package/dist/functions/renderAppleEmojis.js +127 -70
- package/dist/hooks/uploadFile/generatePreview.js +23 -11
- package/dist/hooks/useMessageDraft.js +73 -39
- package/dist/index.js +116 -114
- package/dist/locale/en.js +1 -0
- package/dist/locale/ru.js +1 -0
- package/dist/node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js +106 -106
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/apps/data/messages.d.ts +52 -0
- package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -2
- package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +2 -2
- package/dist/types/components/2_chatlist_elements/ChatItem/styles/types.d.ts +6 -0
- package/dist/types/components/2_feed_elements/AudioMessage/styles/types.d.ts +34 -0
- package/dist/types/components/2_feed_elements/CallMessage/styles/types.d.ts +26 -0
- package/dist/types/components/2_feed_elements/FileMessage/styles/types.d.ts +30 -0
- package/dist/types/components/2_feed_elements/ImageMessage/styles/types.d.ts +34 -0
- package/dist/types/components/2_feed_elements/StickerMessage/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +38 -2
- package/dist/types/components/2_feed_elements/TypingMessage/styles/types.d.ts +2 -0
- package/dist/types/components/2_feed_elements/VideoMessage/styles/types.d.ts +34 -0
- package/dist/types/components/3_compounds/ChatInput/ChatInput.vue.d.ts +3 -3
- package/dist/types/components/3_compounds/ChatInput/styles/types.d.ts +2 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedReply.d.ts +1 -27
- package/dist/types/functions/renderAppleEmojis.d.ts +17 -2
- package/dist/types/hooks/uploadFile/generatePreview.d.ts +2 -0
- package/dist/types/hooks/uploadFile/uploadFile.d.ts +9 -17
- package/dist/types/hooks/useMessageDraft.d.ts +30 -29
- package/dist/types/locale/en.d.ts +1 -0
- package/dist/types/locale/ru.d.ts +1 -0
- package/package.json +2 -2
|
@@ -7,33 +7,7 @@ interface UseFeedReplyOptions {
|
|
|
7
7
|
* Композабл для обработки ответов и редактирования сообщений
|
|
8
8
|
*/
|
|
9
9
|
export declare function useFeedReply({ enableDoubleClickReply, emit }: UseFeedReplyOptions): {
|
|
10
|
-
getMessage: () =>
|
|
11
|
-
id: string;
|
|
12
|
-
text: string;
|
|
13
|
-
file?: {
|
|
14
|
-
url: string;
|
|
15
|
-
name?: string | undefined;
|
|
16
|
-
size?: number | undefined;
|
|
17
|
-
type?: string | undefined;
|
|
18
|
-
} | undefined;
|
|
19
|
-
reply?: {
|
|
20
|
-
messageId: string;
|
|
21
|
-
type: string;
|
|
22
|
-
text?: string | undefined;
|
|
23
|
-
url?: string | undefined;
|
|
24
|
-
filename?: string | undefined;
|
|
25
|
-
header?: string | undefined;
|
|
26
|
-
callDuration?: string | undefined;
|
|
27
|
-
isMissedCall?: boolean | undefined;
|
|
28
|
-
} | undefined;
|
|
29
|
-
edit?: {
|
|
30
|
-
messageId: string;
|
|
31
|
-
type: string;
|
|
32
|
-
text?: string | undefined;
|
|
33
|
-
} | undefined;
|
|
34
|
-
forceSend: boolean;
|
|
35
|
-
isRecording: boolean;
|
|
36
|
-
};
|
|
10
|
+
getMessage: () => import("@/hooks").MessageDraft;
|
|
37
11
|
messageAction: (message: IFeedObject) => void;
|
|
38
12
|
handleClickReplied: (messageId: string) => void;
|
|
39
13
|
feedObjectDoubleClick: (event: MouseEvent, object: IFeedObject) => void;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Рендер Unicode-эмодзi картинками Apple (тот же CDN, что vue3-emoji-picker-ru при native=false).
|
|
3
3
|
*/
|
|
4
4
|
export declare const APPLE_EMOJI_CDN = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64";
|
|
5
|
+
/** Ближайшая граница графемы (чтобы caret не попадал внутрь surrogate pair / ZWJ). */
|
|
6
|
+
export declare function snapIndexToGrapheme(text: string, index: number, prefer?: 'before' | 'after' | 'nearest'): number;
|
|
7
|
+
export declare function nextGraphemeIndex(text: string, index: number): number;
|
|
8
|
+
export declare function previousGraphemeIndex(text: string, index: number): number;
|
|
5
9
|
/** Имена файлов emoji-datasource совпадают с полем u: все codepoints через дефис, включая fe0f/fe0e */
|
|
6
10
|
export declare function emojiToAppleCode(emoji: string, options?: {
|
|
7
11
|
stripVariationSelectors?: boolean;
|
|
@@ -9,9 +13,20 @@ export declare function emojiToAppleCode(emoji: string, options?: {
|
|
|
9
13
|
export declare function getAppleEmojiUrl(emoji: string): string;
|
|
10
14
|
/** Альтернативный URL, если основной codepoint не совпал с именем файла в emoji-datasource */
|
|
11
15
|
export declare function getAppleEmojiFallbackUrl(emoji: string): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Слот: скрытый системный эмодзи задаёт ширину (как в textarea),
|
|
18
|
+
* поверх — Apple-картинка. Так caret совпадает с картинками.
|
|
19
|
+
*/
|
|
12
20
|
export declare function createAppleEmojiImgHtml(emoji: string): string;
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
export declare function createAppleEmojiSlotElement(emoji: string): HTMLElement;
|
|
22
|
+
/**
|
|
23
|
+
* Plain text → HTML с Apple-эмодзi (для зеркала инпута).
|
|
24
|
+
* Опционально подсвечивает выделенный диапазон (индексы как в textarea: UTF-16).
|
|
25
|
+
*/
|
|
26
|
+
export declare function textToAppleEmojiHtml(text: string, selection?: {
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
} | null): string;
|
|
15
30
|
export declare function textContainsEmoji(text: string): boolean;
|
|
16
31
|
/** HTML → HTML, эмодзi в текстовых узлах заменяются на img */
|
|
17
32
|
export declare function replaceEmojisInHtml(html: string): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IFilePreview } from '@/types';
|
|
1
2
|
export declare const generatePreview: (file: File) => {
|
|
2
3
|
isImage: boolean;
|
|
3
4
|
isVideo: boolean;
|
|
@@ -5,3 +6,4 @@ export declare const generatePreview: (file: File) => {
|
|
|
5
6
|
previewUrl: string;
|
|
6
7
|
fileSize: string;
|
|
7
8
|
};
|
|
9
|
+
export declare function buildFilePreview(name: string | undefined, preview: ReturnType<typeof generatePreview> | undefined): IFilePreview | undefined;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { generatePreview } from './generatePreview';
|
|
2
|
+
type UploadFileResult = {
|
|
3
|
+
url: string;
|
|
3
4
|
name: string;
|
|
4
5
|
size: number;
|
|
5
6
|
type: string;
|
|
6
|
-
status:
|
|
7
|
-
preview:
|
|
8
|
-
isImage: boolean;
|
|
9
|
-
isVideo: boolean;
|
|
10
|
-
isAudio: boolean;
|
|
11
|
-
previewUrl: string;
|
|
12
|
-
fileSize: string;
|
|
13
|
-
};
|
|
7
|
+
status: 'success';
|
|
8
|
+
preview: ReturnType<typeof generatePreview>;
|
|
14
9
|
} | {
|
|
15
|
-
status:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type?: undefined;
|
|
20
|
-
preview?: undefined;
|
|
21
|
-
}>;
|
|
10
|
+
status: 'error';
|
|
11
|
+
};
|
|
12
|
+
export declare const uploadFile: (filebumpUrl: string | null, selectedFile: File) => Promise<UploadFileResult>;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
import { Edit, Reply } from '@/types';
|
|
1
|
+
import { Edit, IFilePreview, Reply } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Структура сообщения с черновиком текста, файлами и метаданными
|
|
4
|
+
* @interface MessageDraft
|
|
5
|
+
* @property {string} id - Уникальный идентификатор сообщения (обычно chatAppId)
|
|
6
|
+
* @property {string} text - Текст сообщения
|
|
7
|
+
* @property {UploadedFile} [file] - Прикрепленный файл
|
|
8
|
+
* @property {Reply} [reply] - Ответ на другое сообщение
|
|
9
|
+
* @property {Edit} [edit] - Редактируемое сообщение
|
|
10
|
+
* @property {boolean} forceSend - Флаг принудительной отправки сообщения
|
|
11
|
+
* @property {boolean} isRecording - Флаг активной записи (аудио/видео)
|
|
12
|
+
* @property {number} [inputHeight] - Высота поля ввода для этого черновика
|
|
13
|
+
*/
|
|
14
|
+
export interface MessageDraft {
|
|
15
|
+
id: string;
|
|
16
|
+
text: string;
|
|
17
|
+
file?: UploadedFile;
|
|
18
|
+
reply?: Reply;
|
|
19
|
+
edit?: Edit;
|
|
20
|
+
forceSend: boolean;
|
|
21
|
+
isRecording: boolean;
|
|
22
|
+
inputHeight?: number;
|
|
23
|
+
}
|
|
2
24
|
/**
|
|
3
25
|
* Структура загруженного файла
|
|
4
26
|
* @interface UploadedFile
|
|
@@ -6,13 +28,16 @@ import { Edit, Reply } from '@/types';
|
|
|
6
28
|
* @property {string} [name] - Имя файла
|
|
7
29
|
* @property {number} [size] - Размер файла в байтах
|
|
8
30
|
* @property {string} [type] - MIME-тип файла
|
|
31
|
+
* @property {IFilePreview} [preview] - Превью для строки файла в ChatInput
|
|
9
32
|
*/
|
|
10
33
|
interface UploadedFile {
|
|
11
34
|
url: string;
|
|
12
35
|
name?: string;
|
|
13
36
|
size?: number;
|
|
14
37
|
type?: string;
|
|
38
|
+
preview?: IFilePreview;
|
|
15
39
|
}
|
|
40
|
+
export declare function getChatDraft(chatAppId: string, chatId: string | number | null | undefined): MessageDraft | undefined;
|
|
16
41
|
/**
|
|
17
42
|
* Composable для управления состоянием черновика сообщения в конкретном чате
|
|
18
43
|
*
|
|
@@ -20,7 +45,9 @@ interface UploadedFile {
|
|
|
20
45
|
*
|
|
21
46
|
* Предоставляет методы для работы с текстом, файлами, ответами и флагами сообщения.
|
|
22
47
|
* Автоматически создает новый черновик, если сообщение с указанным ID не существует.
|
|
23
|
-
*
|
|
48
|
+
* Черновики разделяются по контакту (selectedChat.chatId): при переключении
|
|
49
|
+
* на другого контакта текст не переносится, а при возврате восстанавливается.
|
|
50
|
+
* Переключение диалога внутри контакта (MAX → TG) сохраняет тот же черновик.
|
|
24
51
|
*
|
|
25
52
|
* @param {string} outId - Уникальный идентификатор чата (chatAppId)
|
|
26
53
|
*
|
|
@@ -76,33 +103,7 @@ interface UploadedFile {
|
|
|
76
103
|
* resetReply();
|
|
77
104
|
*/
|
|
78
105
|
export declare const useMessageDraft: (outId: string) => {
|
|
79
|
-
getMessage: () =>
|
|
80
|
-
id: string;
|
|
81
|
-
text: string;
|
|
82
|
-
file?: {
|
|
83
|
-
url: string;
|
|
84
|
-
name?: string | undefined;
|
|
85
|
-
size?: number | undefined;
|
|
86
|
-
type?: string | undefined;
|
|
87
|
-
} | undefined;
|
|
88
|
-
reply?: {
|
|
89
|
-
messageId: string;
|
|
90
|
-
type: string;
|
|
91
|
-
text?: string | undefined;
|
|
92
|
-
url?: string | undefined;
|
|
93
|
-
filename?: string | undefined;
|
|
94
|
-
header?: string | undefined;
|
|
95
|
-
callDuration?: string | undefined;
|
|
96
|
-
isMissedCall?: boolean | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
edit?: {
|
|
99
|
-
messageId: string;
|
|
100
|
-
type: string;
|
|
101
|
-
text?: string | undefined;
|
|
102
|
-
} | undefined;
|
|
103
|
-
forceSend: boolean;
|
|
104
|
-
isRecording: boolean;
|
|
105
|
-
};
|
|
106
|
+
getMessage: () => MessageDraft;
|
|
106
107
|
resetMessage: () => void;
|
|
107
108
|
setMessageFile: (file: UploadedFile) => void;
|
|
108
109
|
resetMessageFile: () => void;
|
|
@@ -3,6 +3,7 @@ export const en: {
|
|
|
3
3
|
'component.ChatFilter.InputPlaceholder': string;
|
|
4
4
|
'layout.ChatWrapper.noSelectedChat': string;
|
|
5
5
|
'component.ChatItem.typing': string;
|
|
6
|
+
'component.ChatItem.draft': string;
|
|
6
7
|
'component.ChatInput.InputPlaceholder': string;
|
|
7
8
|
'component.ChatInput.TelegramInputPlaceholder': string;
|
|
8
9
|
'component.ChatInput.WhatsappInputPlaceholder': string;
|
|
@@ -3,6 +3,7 @@ export const ru: {
|
|
|
3
3
|
'component.ChatFilter.InputPlaceholder': string;
|
|
4
4
|
'layout.ChatWrapper.noSelectedChat': string;
|
|
5
5
|
'component.ChatItem.typing': string;
|
|
6
|
+
'component.ChatItem.draft': string;
|
|
6
7
|
'component.ChatInput.InputPlaceholder': string;
|
|
7
8
|
'component.ChatInput.WhatsappInputPlaceholder': string;
|
|
8
9
|
'component.ChatInput.TelegramInputPlaceholder': string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobilon-dev/chotto",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.92",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"primeicons": "^7.0.0",
|
|
44
44
|
"sass-embedded": "^1.96.0",
|
|
45
45
|
"vue": "^3.5.25",
|
|
46
|
-
"vue3-emoji-picker-ru": "^1.1.
|
|
46
|
+
"vue3-emoji-picker-ru": "^1.1.10"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@chromatic-com/storybook": "^4.1.3",
|