@mobilon-dev/chotto 0.3.19 → 0.3.21
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/{CreateChat-CwRkMnM3.js → CreateChat-DoNHuQv0.js} +1 -1
- package/dist/{CreateChat2-Cxy5KpkU.js → CreateChat2-DpYCA_v_.js} +1 -1
- package/dist/{CreateDialog-CR1QOWmo.js → CreateDialog-BOnzLE6I.js} +1 -1
- package/dist/{ModalVideoRecorder-DjqHMgX1.js → ModalVideoRecorder-BY3428rE.js} +1 -1
- package/dist/{SelectUser2-C-M3Ca0V.js → SelectUser2-CanippyB.js} +1 -1
- package/dist/chotto.css +1 -1
- package/dist/{index-BR7f4lUX.js → index-D4aZYJgw.js} +6837 -6506
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/apps/data/chats.d.ts +1 -1
- package/dist/types/apps/data/messages.d.ts +121 -0
- package/dist/types/components/1_atoms/Tooltip/stories/Tooltip.stories.d.ts +8 -2
- package/dist/types/components/2_chatinput_elements/ButtonEmojiPicker/stories/ButtonEmojiPicker.stories.d.ts +4 -3
- package/dist/types/components/2_elements/ContactInfo/stories/ContactInfo.stories.d.ts +8 -16
- package/dist/types/components/2_feed_elements/AudioMessage/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/DateMessageSticky/stories/DateMessageSticky.stories.d.ts +5 -18
- package/dist/types/components/2_feed_elements/FeedKeyboard/stories/FeedKeyboard.stories.d.ts +5 -36
- package/dist/types/components/2_feed_elements/FileMessage/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/ImageMessage/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/ReplyAudioMessage/stories/ReplyAudioMessage.stories.d.ts +6 -17
- package/dist/types/components/2_feed_elements/ReplyCallMessage/stories/ReplyCallMessage.stories.d.ts +6 -17
- package/dist/types/components/2_feed_elements/ReplyFileMessage/stories/ReplyFileMessage.stories.d.ts +7 -17
- package/dist/types/components/2_feed_elements/ReplyImageMessage/stories/ReplyImageMessage.stories.d.ts +7 -17
- package/dist/types/components/2_feed_elements/ReplyTextMessage/stories/ReplyTextMessage.stories.d.ts +8 -17
- package/dist/types/components/2_feed_elements/ReplyVideoMessage/stories/ReplyVideoMessage.stories.d.ts +7 -17
- package/dist/types/components/2_feed_elements/TextMessage/stories/TextMessage.stories.d.ts +2 -0
- package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/VideoMessage/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/types/messages.d.ts +5 -0
- package/dist/types/components/3_compounds/ChatList/ChatList.vue.d.ts +2 -0
- package/dist/types/components/3_compounds/Feed/Feed.vue.d.ts +9 -9
- package/dist/types/components/3_compounds/Feed/composables/index.d.ts +10 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedButton.d.ts +20 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedComponents.d.ts +6 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedGrouping.d.ts +33 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedKeyboard.d.ts +15 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedLoadMore.d.ts +23 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedMessageVisibility.d.ts +16 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedReply.d.ts +37 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedScroll.d.ts +26 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedScrollTo.d.ts +14 -0
- package/dist/types/components/3_compounds/Feed/composables/useStickyDate.d.ts +16 -0
- package/dist/types/functions/getMessageClass.d.ts +11 -0
- package/dist/types/functions/getStatusMessage.d.ts +1 -0
- package/dist/types/functions/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +2 -1
- package/dist/types/hooks/messages/index.d.ts +2 -0
- package/dist/types/hooks/messages/useMessageActions.d.ts +56 -0
- package/dist/types/hooks/messages/useMessageLinks.d.ts +13 -0
- package/dist/types/hooks/{useMessage.d.ts → useMessageDraft.d.ts} +4 -4
- package/dist/types/hooks/validators/index.d.ts +1 -0
- package/dist/types/hooks/validators/messages/types.d.ts +2 -1
- package/dist/types/hooks/validators/useValidation.d.ts +84 -0
- package/dist/vuessages.es.js +53 -48
- package/dist/vuessages.umd.js +28 -28
- package/package.json +1 -1
- package/dist/types/components/1_atoms/Tooltip/Tooltip.stories.d.ts +0 -6
package/dist/types/components/2_feed_elements/ReplyTextMessage/stories/ReplyTextMessage.stories.d.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/vue3-vite';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
-
message: {
|
|
6
|
-
type: () => import("../../types/messages.ts").ITextMessage;
|
|
7
|
-
required: true;
|
|
8
|
-
};
|
|
9
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
-
message: {
|
|
11
|
-
type: () => import("../../types/messages.ts").ITextMessage;
|
|
12
|
-
required: true;
|
|
13
|
-
};
|
|
14
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
-
args: {};
|
|
16
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import ReplyTextMessage from '../ReplyTextMessage.vue';
|
|
3
|
+
declare const meta: Meta<typeof ReplyTextMessage>;
|
|
17
4
|
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof
|
|
5
|
+
type Story = StoryObj<typeof ReplyTextMessage>;
|
|
19
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const WithHeader: Story;
|
|
8
|
+
export declare const LongText: Story;
|
|
9
|
+
export declare const WithLink: Story;
|
|
10
|
+
export declare const RightPosition: Story;
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/vue3-vite';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
-
message: {
|
|
6
|
-
type: () => import("../../types/messages.ts").IVideoMessage;
|
|
7
|
-
required: true;
|
|
8
|
-
};
|
|
9
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
-
message: {
|
|
11
|
-
type: () => import("../../types/messages.ts").IVideoMessage;
|
|
12
|
-
required: true;
|
|
13
|
-
};
|
|
14
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
-
args: {};
|
|
16
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import ReplyVideoMessage from '../ReplyVideoMessage.vue';
|
|
3
|
+
declare const meta: Meta<typeof ReplyVideoMessage>;
|
|
17
4
|
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof
|
|
5
|
+
type Story = StoryObj<typeof ReplyVideoMessage>;
|
|
19
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const WithHeaderAndText: Story;
|
|
8
|
+
export declare const LongText: Story;
|
|
9
|
+
export declare const RightPosition: Story;
|
|
@@ -19,6 +19,8 @@ export declare const RightMessageWithoutTime: Story;
|
|
|
19
19
|
export declare const RightMessageStatusSent: Story;
|
|
20
20
|
export declare const RightMessageStatusReceived: Story;
|
|
21
21
|
export declare const RightMessageStatusRead: Story;
|
|
22
|
+
export declare const RightMessageStatusPending: Story;
|
|
23
|
+
export declare const RightMessageStatusError: Story;
|
|
22
24
|
export declare const RightMessageWithActions: Story;
|
|
23
25
|
export declare const RightMessageWithAvatar: Story;
|
|
24
26
|
export declare const RightMessageWithLongTime: Story;
|
|
@@ -90,6 +90,10 @@ export interface TextMessageThemeCSSVariables {
|
|
|
90
90
|
'--chotto-textmessage-status-read-color': string;
|
|
91
91
|
/** Отрицательный отступ первой иконки статуса "прочитано" */
|
|
92
92
|
'--chotto-textmessage-status-read-first-child-margin-right': string;
|
|
93
|
+
/** Цвет статуса "в ожидании" */
|
|
94
|
+
'--chotto-textmessage-status-pending-color': string;
|
|
95
|
+
/** Цвет статуса "ошибка" */
|
|
96
|
+
'--chotto-textmessage-status-error-color': string;
|
|
93
97
|
/** Размер шрифта текста сообщения */
|
|
94
98
|
'--chotto-textmessage-text-font-size': string;
|
|
95
99
|
/** Правила перевода строк текста */
|
|
@@ -76,6 +76,10 @@ export interface VideoMessageThemeCSSVariables {
|
|
|
76
76
|
'--chotto-videomessage-status-read-color': string;
|
|
77
77
|
/** Отрицательный отступ для иконки "прочитано" */
|
|
78
78
|
'--chotto-videomessage-status-read-first-child-margin-right': string;
|
|
79
|
+
/** Цвет иконок статуса "в ожидании" */
|
|
80
|
+
'--chotto-videomessage-status-pending-color': string;
|
|
81
|
+
/** Цвет иконок статуса "ошибка" */
|
|
82
|
+
'--chotto-videomessage-status-error-color': string;
|
|
79
83
|
/** Ряд грида для аватара */
|
|
80
84
|
'--chotto-videomessage-avatar-grid-row': string;
|
|
81
85
|
/** Выравнивание аватара относительно себя */
|
|
@@ -28,6 +28,7 @@ export interface IAudioMessage {
|
|
|
28
28
|
time: string;
|
|
29
29
|
url: string;
|
|
30
30
|
status: string;
|
|
31
|
+
statusMsg?: string;
|
|
31
32
|
avatar?: string;
|
|
32
33
|
header?: string;
|
|
33
34
|
subText?: string;
|
|
@@ -69,6 +70,7 @@ export interface IFileMessage {
|
|
|
69
70
|
time: string;
|
|
70
71
|
url: string;
|
|
71
72
|
status: string;
|
|
73
|
+
statusMsg?: string;
|
|
72
74
|
avatar?: string;
|
|
73
75
|
header?: string;
|
|
74
76
|
subText?: string;
|
|
@@ -87,6 +89,7 @@ export interface IImageMessage {
|
|
|
87
89
|
url: string;
|
|
88
90
|
alt?: string;
|
|
89
91
|
status: string;
|
|
92
|
+
statusMsg?: string;
|
|
90
93
|
avatar?: string;
|
|
91
94
|
header?: string;
|
|
92
95
|
subText?: string;
|
|
@@ -107,6 +110,7 @@ export interface ITextMessage {
|
|
|
107
110
|
text: string;
|
|
108
111
|
position: string;
|
|
109
112
|
status: string;
|
|
113
|
+
statusMsg?: string;
|
|
110
114
|
time: string;
|
|
111
115
|
avatar?: string;
|
|
112
116
|
header?: string;
|
|
@@ -126,6 +130,7 @@ export interface IVideoMessage {
|
|
|
126
130
|
messageId: string;
|
|
127
131
|
position: string;
|
|
128
132
|
status: string;
|
|
133
|
+
statusMsg?: string;
|
|
129
134
|
time: string;
|
|
130
135
|
url: string;
|
|
131
136
|
alt?: string;
|
|
@@ -5,6 +5,7 @@ type __VLS_WithSlots<T, S> = T & (new () => {
|
|
|
5
5
|
});
|
|
6
6
|
declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
7
7
|
$emit: (event: "search" | "select" | "action" | "expand" | "tab-click" | "loadMoreChats" | "clear-search", ...args: any[]) => void;
|
|
8
|
+
title: string;
|
|
8
9
|
chats: unknown[];
|
|
9
10
|
searchQuery: string;
|
|
10
11
|
titleEnabled: boolean;
|
|
@@ -16,6 +17,7 @@ declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
|
16
17
|
searchProgress: string;
|
|
17
18
|
searchStats: Record<string, any>;
|
|
18
19
|
$props: {
|
|
20
|
+
readonly title?: string | undefined;
|
|
19
21
|
readonly chats?: unknown[] | undefined;
|
|
20
22
|
readonly searchQuery?: string | undefined;
|
|
21
23
|
readonly titleEnabled?: boolean | undefined;
|
|
@@ -71,13 +71,13 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
71
71
|
};
|
|
72
72
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
73
73
|
loadMore: (...args: any[]) => void;
|
|
74
|
-
|
|
74
|
+
keyboardAction: (...args: any[]) => void;
|
|
75
|
+
feedAction: (...args: any[]) => void;
|
|
75
76
|
loadMoreDown: (...args: any[]) => void;
|
|
76
|
-
|
|
77
|
+
messageAction: (...args: any[]) => void;
|
|
77
78
|
clickRepliedMessage: (...args: any[]) => void;
|
|
79
|
+
messageVisible: (...args: any[]) => void;
|
|
78
80
|
forceScrollToBottom: (...args: any[]) => void;
|
|
79
|
-
keyboardAction: (...args: any[]) => void;
|
|
80
|
-
feedAction: (...args: any[]) => void;
|
|
81
81
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
82
82
|
objects: {
|
|
83
83
|
type: {
|
|
@@ -146,20 +146,20 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
146
146
|
};
|
|
147
147
|
}>> & Readonly<{
|
|
148
148
|
onLoadMore?: ((...args: any[]) => any) | undefined;
|
|
149
|
-
|
|
149
|
+
onKeyboardAction?: ((...args: any[]) => any) | undefined;
|
|
150
|
+
onFeedAction?: ((...args: any[]) => any) | undefined;
|
|
150
151
|
onLoadMoreDown?: ((...args: any[]) => any) | undefined;
|
|
151
|
-
|
|
152
|
+
onMessageAction?: ((...args: any[]) => any) | undefined;
|
|
152
153
|
onClickRepliedMessage?: ((...args: any[]) => any) | undefined;
|
|
154
|
+
onMessageVisible?: ((...args: any[]) => any) | undefined;
|
|
153
155
|
onForceScrollToBottom?: ((...args: any[]) => any) | undefined;
|
|
154
|
-
onKeyboardAction?: ((...args: any[]) => any) | undefined;
|
|
155
|
-
onFeedAction?: ((...args: any[]) => any) | undefined;
|
|
156
156
|
}>, {
|
|
157
157
|
typing: boolean | IFeedTyping;
|
|
158
158
|
chatBackground: string;
|
|
159
159
|
applyStyle: Function;
|
|
160
|
+
enableDoubleClickReply: boolean;
|
|
160
161
|
buttonParams: IFeedUnreadButton;
|
|
161
162
|
scrollToBottom: boolean;
|
|
162
|
-
enableDoubleClickReply: boolean;
|
|
163
163
|
scrollTo: string;
|
|
164
164
|
keyboardAlign: "left" | "right" | "center";
|
|
165
165
|
feedKeyboards: IFeedKeyboard[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './useFeedButton';
|
|
2
|
+
export * from './useFeedComponents';
|
|
3
|
+
export * from './useFeedGrouping';
|
|
4
|
+
export * from './useFeedKeyboard';
|
|
5
|
+
export * from './useFeedLoadMore';
|
|
6
|
+
export * from './useFeedMessageVisibility';
|
|
7
|
+
export * from './useFeedReply';
|
|
8
|
+
export * from './useFeedScroll';
|
|
9
|
+
export * from './useFeedScrollTo';
|
|
10
|
+
export * from './useStickyDate';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
interface UseFeedButtonOptions {
|
|
3
|
+
feedRef: Ref<HTMLElement | null>;
|
|
4
|
+
keyboardRef: Ref<{
|
|
5
|
+
refKeyboard: {
|
|
6
|
+
clientHeight: number;
|
|
7
|
+
};
|
|
8
|
+
} | null>;
|
|
9
|
+
onButtonShow?: () => void;
|
|
10
|
+
onKeyboardPlace?: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Композабл для управления кнопкой "прокрутить вниз" и позиционированием клавиатуры
|
|
14
|
+
*/
|
|
15
|
+
export declare function useFeedButton({ feedRef, keyboardRef, onButtonShow, onKeyboardPlace }: UseFeedButtonOptions): {
|
|
16
|
+
isShowButton: Ref<boolean, boolean>;
|
|
17
|
+
isKeyboardPlace: Ref<boolean, boolean>;
|
|
18
|
+
checkButtonVisibility: () => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { IFeedObject } from '@/types';
|
|
3
|
+
interface UseFeedGroupingOptions {
|
|
4
|
+
objects: ComputedRef<IFeedObject[]>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Композабл для группировки сообщений в серии (по отправителю)
|
|
8
|
+
*/
|
|
9
|
+
export declare function useFeedGrouping({ objects }: UseFeedGroupingOptions): {
|
|
10
|
+
groupedObjects: ComputedRef<{
|
|
11
|
+
isFirstInSeries: boolean;
|
|
12
|
+
messageId: string;
|
|
13
|
+
type: string;
|
|
14
|
+
header?: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
position?: string;
|
|
17
|
+
status?: string;
|
|
18
|
+
time?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
alt?: string;
|
|
21
|
+
filename?: string;
|
|
22
|
+
avatar?: string;
|
|
23
|
+
subtext?: string;
|
|
24
|
+
actions?: import("@/types").IAction[];
|
|
25
|
+
views?: number;
|
|
26
|
+
callDuration?: string;
|
|
27
|
+
isMissedCall?: boolean;
|
|
28
|
+
reply?: import("@/types").Reply;
|
|
29
|
+
linkPreview?: import("@/types").ILinkPreview;
|
|
30
|
+
keyboard?: import("@/types").IKeyBoard[];
|
|
31
|
+
}[]>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
interface UseFeedKeyboardOptions {
|
|
3
|
+
isKeyboardPlace: Ref<boolean>;
|
|
4
|
+
objects: Ref<any[]>;
|
|
5
|
+
emit: (event: 'keyboardAction' | 'feedAction', payload: any) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Композабл для управления видимостью и действиями клавиатур
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFeedKeyboard({ isKeyboardPlace, objects, emit }: UseFeedKeyboardOptions): {
|
|
11
|
+
showKeyboard: import("vue").ComputedRef<boolean>;
|
|
12
|
+
keyboardAction: (action: string | (() => void)) => void;
|
|
13
|
+
feedKeyboardAction: (action: string | (() => void)) => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
interface UseFeedLoadMoreOptions {
|
|
3
|
+
feedRef: Ref<HTMLElement | null>;
|
|
4
|
+
emit?: (event: 'loadMore' | 'loadMoreDown', ...args: unknown[]) => void;
|
|
5
|
+
isLoadingMoreRef?: Ref<boolean>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Композабл для управления подгрузкой сообщений сверху/снизу и восстановлением позиции скролла
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFeedLoadMore({ feedRef, emit, isLoadingMoreRef }: UseFeedLoadMoreOptions): {
|
|
11
|
+
allowLoadMoreTop: Ref<boolean, boolean>;
|
|
12
|
+
allowLoadMoreBottom: Ref<boolean, boolean>;
|
|
13
|
+
movingDown: Ref<boolean, boolean>;
|
|
14
|
+
isScrollByMouseButton: Ref<boolean, boolean>;
|
|
15
|
+
pendingTopRestore: Ref<boolean, boolean>;
|
|
16
|
+
topLoadJustHappened: Ref<boolean, boolean>;
|
|
17
|
+
checkScrollPosition: (allowLoadMore?: boolean) => void;
|
|
18
|
+
restoreScrollPosition: (delay?: number) => void;
|
|
19
|
+
startScrollWatch: (event: MouseEvent) => void;
|
|
20
|
+
stopScrollWatch: () => void;
|
|
21
|
+
resetAllowFlags: () => void;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
interface UseFeedMessageVisibilityOptions<T = unknown> {
|
|
3
|
+
feedRef: Ref<HTMLElement | null>;
|
|
4
|
+
trackingObjects: Ref<NodeListOf<Element> | undefined>;
|
|
5
|
+
chatAppId: string;
|
|
6
|
+
onMessageVisible: (message: T) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Композабл для отслеживания видимости сообщений с помощью Intersection Observer
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFeedMessageVisibility<T = unknown>({ trackingObjects, chatAppId, onMessageVisible, }: UseFeedMessageVisibilityOptions<T>): {
|
|
12
|
+
observer: IntersectionObserver;
|
|
13
|
+
observeMessages: () => void;
|
|
14
|
+
restartObserving: () => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IFeedObject } from '@/types';
|
|
2
|
+
interface UseFeedReplyOptions {
|
|
3
|
+
enableDoubleClickReply: boolean;
|
|
4
|
+
emit: (event: 'messageAction' | 'clickRepliedMessage', payload: IFeedObject | string) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Композабл для обработки ответов на сообщения
|
|
8
|
+
*/
|
|
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
|
+
forceSend: boolean;
|
|
30
|
+
isRecording: boolean;
|
|
31
|
+
};
|
|
32
|
+
messageAction: (message: IFeedObject) => void;
|
|
33
|
+
handleClickReplied: (messageId: string) => void;
|
|
34
|
+
feedObjectDoubleClick: (event: MouseEvent, object: IFeedObject) => void;
|
|
35
|
+
handleResetReply: () => void;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Композабл для управления скроллом ленты сообщений.
|
|
4
|
+
* Инкапсулирует типичные сценарии: принудительный скролл вниз,
|
|
5
|
+
* гарантирование положения внизу, первичную инициализацию и
|
|
6
|
+
* плавную прокрутку (например, по кнопке «вниз»).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Параметры и зависимости композабла.
|
|
10
|
+
*/
|
|
11
|
+
interface UseFeedScrollOptions<T = unknown> {
|
|
12
|
+
/** Ссылка на DOM-элемент контейнера ленты */
|
|
13
|
+
feedRef: Ref<HTMLElement | null>;
|
|
14
|
+
/** Реактивный список объектов ленты (для определения, когда есть контент) */
|
|
15
|
+
objectsRef: Ref<T[]>;
|
|
16
|
+
/** Внешний флаг, который триггерит прокрутку вниз */
|
|
17
|
+
scrollToBottomRef: Ref<boolean>;
|
|
18
|
+
}
|
|
19
|
+
export declare function useFeedScroll<T = unknown>({ feedRef, objectsRef, scrollToBottomRef }: UseFeedScrollOptions<T>): {
|
|
20
|
+
isInitialized: Ref<boolean, boolean>;
|
|
21
|
+
performScrollToBottom: () => void;
|
|
22
|
+
ensureScrollToBottom: () => void;
|
|
23
|
+
initializeScroll: () => void;
|
|
24
|
+
smoothScrollToBottom: () => void;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
interface UseFeedScrollToOptions {
|
|
3
|
+
/** ID целевого элемента для прокрутки */
|
|
4
|
+
targetIdRef: Ref<string | null>;
|
|
5
|
+
/** ID контейнера ленты */
|
|
6
|
+
feedContainerId: string;
|
|
7
|
+
/** CSS-класс для фокуса на сообщении */
|
|
8
|
+
focusClass?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Композабл для прокрутки к определённому сообщению с подсветкой
|
|
12
|
+
*/
|
|
13
|
+
export declare function useFeedScrollTo({ targetIdRef, feedContainerId, focusClass }: UseFeedScrollToOptions): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
interface UseStickyDateOptions {
|
|
3
|
+
feedRef: Ref<HTMLElement | null>;
|
|
4
|
+
trackingObjects: Ref<NodeListOf<Element> | undefined>;
|
|
5
|
+
autoHideDelay?: number;
|
|
6
|
+
onUpdate?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useStickyDate(options: UseStickyDateOptions): {
|
|
9
|
+
showStickyDate: Ref<boolean, boolean>;
|
|
10
|
+
stickyDateText: Ref<string, string>;
|
|
11
|
+
updateStickyDate: () => void;
|
|
12
|
+
show: () => void;
|
|
13
|
+
hide: () => void;
|
|
14
|
+
cleanup: () => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Возвращает CSS-класс для сообщения в зависимости от позиции
|
|
3
|
+
*
|
|
4
|
+
* Используется в компонентах сообщений, чтобы единообразно формировать
|
|
5
|
+
* классы вида `<prefix>__left` и `<prefix>__right`.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} position - позиция сообщения: 'left' | 'right'
|
|
8
|
+
* @param {string} prefix - префикс CSS-блока (например, 'text-message')
|
|
9
|
+
* @returns {string} CSS-класс с учетом позиции
|
|
10
|
+
*/
|
|
11
|
+
export declare function getMessageClass(position: string, prefix: string): string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from './uploadFile';
|
|
2
2
|
export * from './useDelayDebouncedRef';
|
|
3
3
|
export * from './useImmediateDebouncedRef';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './useMessageDraft';
|
|
5
5
|
export * from './useSearchModel';
|
|
6
6
|
export * from './useTheme';
|
|
7
7
|
export * from './modals';
|
|
8
8
|
export * from './validators';
|
|
9
|
+
export * from './messages';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Полезная нагрузка для событий действия сообщения
|
|
3
|
+
* @typedef ActionPayload
|
|
4
|
+
* @property {string} messageId - Идентификатор сообщения
|
|
5
|
+
* @property {string} type - Тип действия (например, 'menu' | 'views')
|
|
6
|
+
*/
|
|
7
|
+
type ActionPayload = {
|
|
8
|
+
messageId: string;
|
|
9
|
+
type: string;
|
|
10
|
+
} & Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Тип эмиттера событий компонентов сообщений
|
|
13
|
+
* @typedef EmitFn
|
|
14
|
+
* @param {'action' | 'reply'} event - Имя события
|
|
15
|
+
* @param {ActionPayload | string} payload - Данные события
|
|
16
|
+
*/
|
|
17
|
+
type EmitFn = (event: 'action' | 'reply', payload: ActionPayload | string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Минимально необходимая структура сообщения для работы composable
|
|
20
|
+
* @interface MessageWithMeta
|
|
21
|
+
* @property {string} messageId - Идентификатор сообщения
|
|
22
|
+
* @property {unknown} [actions] - Описание доступных действий (передается в `ContextMenu`)
|
|
23
|
+
*/
|
|
24
|
+
export interface MessageWithMeta {
|
|
25
|
+
messageId: string;
|
|
26
|
+
actions?: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Composable для унификации поведения контекстного меню и связанных действий у сообщений ленты
|
|
30
|
+
*
|
|
31
|
+
* Предоставляет реактивные флаги и обработчики действий: показать/скрыть меню, клик по пункту меню,
|
|
32
|
+
* клик по просмотрам, эмит события ответа.
|
|
33
|
+
*
|
|
34
|
+
* @template T Расширяет {@link MessageWithMeta}
|
|
35
|
+
* @param {T} message - Сообщение с `messageId` (и опционально `actions`)
|
|
36
|
+
* @param {EmitFn} emit - Эмиттер событий из компонента сообщения
|
|
37
|
+
*
|
|
38
|
+
* @returns {object} Объект с состояниями и методами
|
|
39
|
+
* @returns {import('vue').Ref<boolean>} returns.isOpenMenu - Открыт ли контекстное меню
|
|
40
|
+
* @returns {import('vue').Ref<boolean>} returns.buttonMenuVisible - Видна ли кнопка вызова меню
|
|
41
|
+
* @returns {Function} returns.showMenu - Показать кнопку меню
|
|
42
|
+
* @returns {Function} returns.hideMenu - Скрыть кнопку и закрыть меню
|
|
43
|
+
* @returns {Function} returns.clickAction - Обработчик клика по пункту контекстного меню
|
|
44
|
+
* @returns {Function} returns.viewsAction - Обработчик клика по просмотрам
|
|
45
|
+
* @returns {Function} returns.handleClickReplied - Эмит события ответа по `replyMessageId`
|
|
46
|
+
*/
|
|
47
|
+
export declare const useMessageActions: <T extends MessageWithMeta>(message: T, emit: EmitFn) => {
|
|
48
|
+
isOpenMenu: import("vue").Ref<boolean, boolean>;
|
|
49
|
+
buttonMenuVisible: import("vue").Ref<boolean, boolean>;
|
|
50
|
+
showMenu: () => void;
|
|
51
|
+
hideMenu: () => void;
|
|
52
|
+
clickAction: (action: Record<string, unknown>) => void;
|
|
53
|
+
viewsAction: () => void;
|
|
54
|
+
handleClickReplied: (replyMessageId: string) => void;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Создает вычисляемое HTML-представление текста с автоссылками и обработчик
|
|
3
|
+
* открытия ссылок в новой вкладке
|
|
4
|
+
*
|
|
5
|
+
* @param {() => string | undefined} getText - функция, возвращающая исходный текст
|
|
6
|
+
* @returns {{ linkedHtml: import('vue').ComputedRef<string>, inNewWindow: (event: Event) => void }}
|
|
7
|
+
* - linkedHtml: вычисляемый HTML с проставленными ссылками
|
|
8
|
+
* - inNewWindow: обработчик клика, открывающий ссылки в новой вкладке
|
|
9
|
+
*/
|
|
10
|
+
export declare const useMessageLinks: (getText: () => string | undefined) => {
|
|
11
|
+
linkedHtml: import("vue").ComputedRef<string>;
|
|
12
|
+
inNewWindow: (event: Event) => void;
|
|
13
|
+
};
|
|
@@ -37,10 +37,10 @@ interface UploadedFile {
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* // Базовое использование в компоненте
|
|
40
|
-
* import {
|
|
40
|
+
* import { useMessageDraft } from '@/hooks';
|
|
41
41
|
*
|
|
42
42
|
* const chatAppId = 'chat-123';
|
|
43
|
-
* const { getMessage, setMessageText, setMessageFile, resetMessage } =
|
|
43
|
+
* const { getMessage, setMessageText, setMessageFile, resetMessage } = useMessageDraft(chatAppId);
|
|
44
44
|
*
|
|
45
45
|
* // Установить текст
|
|
46
46
|
* setMessageText('Привет!');
|
|
@@ -62,7 +62,7 @@ interface UploadedFile {
|
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* // Работа с ответами
|
|
65
|
-
* const { setReply, resetReply } =
|
|
65
|
+
* const { setReply, resetReply } = useMessageDraft(chatAppId);
|
|
66
66
|
*
|
|
67
67
|
* setReply({
|
|
68
68
|
* id: 'msg-456',
|
|
@@ -73,7 +73,7 @@ interface UploadedFile {
|
|
|
73
73
|
* // Удалить ответ
|
|
74
74
|
* resetReply();
|
|
75
75
|
*/
|
|
76
|
-
export declare const
|
|
76
|
+
export declare const useMessageDraft: (outId: string) => {
|
|
77
77
|
getMessage: () => {
|
|
78
78
|
id: string;
|
|
79
79
|
text: string;
|
|
@@ -45,7 +45,8 @@ export interface Message {
|
|
|
45
45
|
type: string;
|
|
46
46
|
timestamp: string | number;
|
|
47
47
|
direction?: 'incoming' | 'outgoing';
|
|
48
|
-
status?: 'read' | 'sent' | 'received';
|
|
48
|
+
status?: 'read' | 'sent' | 'received' | 'pending' | 'error';
|
|
49
|
+
statusMsg?: string;
|
|
49
50
|
text?: string;
|
|
50
51
|
header?: string;
|
|
51
52
|
subText?: string;
|