tuikit-atomicx-vue3 4.4.0-beta.1 → 4.4.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.
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-D1G-LitO.js → MessageInput.vue_vue_type_script_setup_true_lang-D9jiYNFu.js} +31 -31
- package/dist/chat/index.d.ts +35 -35
- package/dist/chat/server.js +15 -15
- package/dist/components/ContactList/ContactInfo/BlacklistInfo/BlacklistInfo.js +6 -6
- package/dist/components/ContactList/ContactInfo/ContactInfo.js +1 -1
- package/dist/components/ContactList/ContactInfo/FriendApplicationInfo/FriendApplicationInfo.js +1 -1
- package/dist/components/ContactList/ContactInfo/FriendInfo/FriendInfo.js +9 -9
- package/dist/components/ContactList/ContactInfo/GroupApplicationInfo/GroupApplicationInfo.js +1 -1
- package/dist/components/ContactList/ContactInfo/GroupInfo/GroupInfo.js +4 -4
- package/dist/components/ContactList/ContactInfo/SearchGroupInfo/SearchGroupInfo.js +8 -8
- package/dist/components/ContactList/ContactInfo/SearchUserInfo/SearchUserInfo.js +7 -7
- package/dist/components/ContactList/ContactList.js +7 -7
- package/dist/components/ContactList/ContactListItem/BlacklistItem/BlacklistItem.js +8 -8
- package/dist/components/ContactList/ContactListItem/FriendApplicationItem/FriendApplicationItem.js +5 -5
- package/dist/components/ContactList/ContactListItem/FriendItem/FriendItem.js +5 -5
- package/dist/components/ContactList/ContactListItem/GroupApplicationItem/GroupApplicationItem.js +1 -1
- package/dist/components/ContactList/ContactListItem/GroupItem/GroupItem.js +1 -1
- package/dist/components/ContactList/ContactSearch/ContactSearch.js +6 -6
- package/dist/components/ConversationList/ConversationCreate/ConversationCreate.js +9 -9
- package/dist/components/ConversationList/ConversationList.js +4 -4
- package/dist/components/ConversationList/ConversationList.vue.d.ts +10 -10
- package/dist/components/ConversationList/ConversationPreview/ConversationPreview.vue.d.ts +10 -10
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUI.js +20 -20
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUI.vue.d.ts +2 -2
- package/dist/components/ConversationList/ConversationPreview/index.js +1 -1
- package/dist/components/ConversationList/index.d.ts +30 -30
- package/dist/components/MessageInput/EmojiPicker/EmojiPicker.js +88 -84
- package/dist/components/MessageInput/MessageInput.js +1 -1
- package/dist/components/MessageInput/MessageInput.vue.d.ts +2 -2
- package/dist/components/MessageInput/TextEditor/EditorCore.d.ts +2 -1
- package/dist/components/MessageInput/TextEditor/EditorCore.js +23 -21
- package/dist/components/MessageInput/TextEditor/TextEditor.vue.d.ts +2 -2
- package/dist/components/MessageInput/TextEditor/index.js +32 -31
- package/dist/components/MessageInput/index.d.ts +6 -6
- package/dist/components/MessageInput/index.js +1 -1
- package/dist/components/MessageList/Message/AudioMessage/WaveForm.js +24 -34
- package/dist/components/MessageList/Message/CustomMessage/CallMessage/CallMessage.js +29 -28
- package/dist/components/MessageList/Message/Message.vue.d.ts +1 -1
- package/dist/components/MessageList/MessageList.js +8 -6
- package/dist/components/MessageList/index.d.ts +2 -2
- package/dist/hooks/useAudioControl.d.ts +3 -3
- package/dist/hooks/useAudioControl.js +32 -30
- package/dist/rtc/server.js +45 -40
- package/dist/states/LoginState.d.ts +23 -0
- package/dist/states/LoginState.js +34 -39
- package/dist/states/MessageInputState/MessageInputState.d.ts +41 -7
- package/dist/states/MessageInputState/MessageInputState.js +60 -59
- package/dist/states/MessageInputState/utils.d.ts +8 -1
- package/dist/states/MessageInputState/utils.js +30 -10
- package/dist/styles/index.css +1 -1
- package/dist/utils/call.js +1 -1
- package/package.json +2 -2
- package/src/chat/server.ts +0 -1
- package/src/components/ContactList/ContactInfo/BlacklistInfo/BlacklistInfo.vue +1 -1
- package/src/components/ContactList/ContactInfo/ContactInfo.vue +1 -1
- package/src/components/ContactList/ContactInfo/FriendApplicationInfo/FriendApplicationInfo.vue +1 -1
- package/src/components/ContactList/ContactInfo/FriendInfo/FriendInfo.vue +1 -1
- package/src/components/ContactList/ContactInfo/GroupApplicationInfo/GroupApplicationInfo.vue +1 -1
- package/src/components/ContactList/ContactInfo/GroupInfo/GroupInfo.vue +1 -1
- package/src/components/ContactList/ContactInfo/SearchGroupInfo/SearchGroupInfo.vue +1 -1
- package/src/components/ContactList/ContactInfo/SearchUserInfo/SearchUserInfo.vue +1 -1
- package/src/components/ContactList/ContactList.vue +1 -1
- package/src/components/ContactList/ContactListItem/BlacklistItem/BlacklistItem.vue +1 -1
- package/src/components/ContactList/ContactListItem/FriendApplicationItem/FriendApplicationItem.vue +1 -1
- package/src/components/ContactList/ContactListItem/FriendItem/FriendItem.vue +1 -1
- package/src/components/ContactList/ContactListItem/GroupApplicationItem/GroupApplicationItem.vue +1 -1
- package/src/components/ContactList/ContactListItem/GroupItem/GroupItem.vue +1 -1
- package/src/components/ContactList/ContactSearch/ContactSearch.vue +1 -1
- package/src/components/ConversationList/ConversationActions/ConversationActions.vue +1 -1
- package/src/components/ConversationList/ConversationCreate/ConversationCreate.vue +2 -2
- package/src/components/ConversationList/ConversationCreate/ConversationCreateButton/ConversationCreateButton.vue +1 -1
- package/src/components/ConversationList/ConversationCreate/ConversationCreateGroupDetail/ConversationCreateGroupDetail.vue +1 -1
- package/src/components/ConversationList/ConversationCreate/ConversationCreateUserSelectList/ConversationCreateUserSelectList.vue +1 -1
- package/src/components/ConversationList/ConversationCreate/ConversationGroupTypeInfo/ConversationGroupTypeInfo.vue +1 -1
- package/src/components/ConversationList/ConversationList.vue +2 -2
- package/src/components/ConversationList/ConversationListContent/ConversationListContent.vue +1 -1
- package/src/components/ConversationList/ConversationListHeader/ConversationListHeader.vue +1 -1
- package/src/components/ConversationList/ConversationPlaceHolder/ConversationPlaceHolder.vue +1 -1
- package/src/components/ConversationList/ConversationPreview/ConversationPreview.vue +1 -1
- package/src/components/ConversationList/ConversationPreview/ConversationPreviewAbstract.vue +1 -1
- package/src/components/ConversationList/ConversationPreview/ConversationPreviewTimestamp.vue +1 -1
- package/src/components/ConversationList/ConversationPreview/ConversationPreviewTitle.vue +1 -1
- package/src/components/ConversationList/ConversationPreview/ConversationPreviewUI.vue +3 -3
- package/src/components/ConversationList/ConversationPreview/ConversationPreviewUnread.vue +1 -1
- package/src/components/ConversationList/ConversationSearch/ConversationSearch.vue +1 -1
- package/src/components/MessageInput/EmojiPicker/EmojiPicker.vue +7 -3
- package/src/components/MessageInput/MessageInput.module.scss +1 -0
- package/src/components/MessageInput/MessageInput.vue +1 -1
- package/src/components/MessageInput/TextEditor/EditorCore.ts +4 -2
- package/src/components/MessageInput/TextEditor/TextEditor.vue +3 -4
- package/src/components/MessageList/Message/AudioMessage/WaveForm.vue +20 -37
- package/src/components/MessageList/Message/CustomMessage/CallMessage/CallMessage.vue +1 -1
- package/src/components/MessageList/Message/Message.vue +1 -1
- package/src/components/MessageList/MessageList.vue +2 -0
- package/src/components/Search/Search.vue +1 -1
- package/src/components/Search/SearchAdvanced/DateRangePicker/DateRangePicker.vue +1 -1
- package/src/components/Search/SearchAdvanced/MessageAdvanced/MessageAdvanced.vue +1 -1
- package/src/components/Search/SearchAdvanced/SearchAdvanced.vue +1 -1
- package/src/components/Search/SearchAdvanced/SearchTab/SearchTab.vue +1 -1
- package/src/components/Search/SearchAdvanced/Slider/Slider.vue +1 -1
- package/src/components/Search/SearchAdvanced/UserAdvanced/UserAdvanced.vue +1 -1
- package/src/components/Search/SearchBar/SearchBar.vue +1 -1
- package/src/components/Search/SearchResults/EmptyResult/EmptyResult.vue +1 -1
- package/src/components/Search/SearchResults/Loading/Loading.vue +1 -1
- package/src/components/Search/SearchResults/SearchResults.vue +1 -1
- package/src/components/Search/SearchResults/SearchResultsItem/Conversation/Conversation.vue +1 -1
- package/src/components/Search/SearchResults/SearchResultsItem/Group/Group.vue +1 -1
- package/src/components/Search/SearchResults/SearchResultsItem/Message/Message.vue +1 -1
- package/src/components/Search/SearchResults/SearchResultsItem/SearchResultsItem.vue +1 -1
- package/src/components/Search/SearchResults/SearchResultsItem/User/User.vue +1 -1
- package/src/hooks/useAudioControl.ts +17 -4
- package/src/rtc/server.ts +4 -0
- package/src/utils/call.ts +2 -2
package/dist/utils/call.js
CHANGED
|
@@ -82,7 +82,7 @@ function H(a) {
|
|
|
82
82
|
let s = c || a.nameCard || a.nick || n;
|
|
83
83
|
switch (s = S(s), t.actionType) {
|
|
84
84
|
case 1:
|
|
85
|
-
return (((d = e == null ? void 0 : e.data) == null ? void 0 : d.cmd) === "audioCall" || ((g = e == null ? void 0 : e.data) == null ? void 0 : g.cmd) === "videoCall") && t.groupID ? i.t("CallMessage.start_call", { messageSender: s }) : ((_ = e == null ? void 0 : e.data) == null ? void 0 : _.cmd) === "hangup" ? t.groupID ? i.t("CallMessage.call_ended") : `${i.t("CallMessage.call_duration")}: ${N(e == null ? void 0 : e.call_end)}` : ((m = e == null ? void 0 : e.data) == null ? void 0 : m.cmd) === "switchToAudio" ? i.t("CallMessage.switch_to_audio_call") : ((p = e == null ? void 0 : e.data) == null ? void 0 : p.cmd) === "switchToVideo" ? i.t("CallMessage.switch_to_video_call") : i.t("CallMessage.start_call");
|
|
85
|
+
return (((d = e == null ? void 0 : e.data) == null ? void 0 : d.cmd) === "audioCall" || ((g = e == null ? void 0 : e.data) == null ? void 0 : g.cmd) === "videoCall") && t.groupID ? i.t("CallMessage.start_call", { messageSender: s }) : ((_ = e == null ? void 0 : e.data) == null ? void 0 : _.cmd) === "hangup" ? t.groupID ? i.t("CallMessage.call_ended") : `${i.t("CallMessage.call_duration")}: ${N(e == null ? void 0 : e.call_end)}` : ((m = e == null ? void 0 : e.data) == null ? void 0 : m.cmd) === "switchToAudio" ? i.t("CallMessage.switch_to_audio_call") : ((p = e == null ? void 0 : e.data) == null ? void 0 : p.cmd) === "switchToVideo" ? i.t("CallMessage.switch_to_video_call") : i.t("CallMessage.start_call", { messageSender: "" });
|
|
86
86
|
case 2:
|
|
87
87
|
return t.groupID ? `${s} ${i.t("CallMessage.cancel_call")}` : t.inviter === l ? i.t("CallMessage.canceled") : i.t("CallMessage.canceled_by_recipient");
|
|
88
88
|
case 3:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tuikit-atomicx-vue3",
|
|
3
|
-
"version": "4.4.0
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@tencentcloud/chat": "^3.5.8",
|
|
53
53
|
"@tencentcloud/chat-uikit-engine": "~2.5.6",
|
|
54
54
|
"@tencentcloud/tui-core": "latest",
|
|
55
|
-
"@tencentcloud/tuiroom-engine-js": "~3.
|
|
55
|
+
"@tencentcloud/tuiroom-engine-js": "~3.4.3",
|
|
56
56
|
"@tencentcloud/uikit-base-component-vue3": "1.1.1",
|
|
57
57
|
"vue": "^3.4.21"
|
|
58
58
|
},
|
package/src/chat/server.ts
CHANGED
|
@@ -195,7 +195,7 @@ const handleCreateGroupConversation = async () => {
|
|
|
195
195
|
|
|
196
196
|
const generateGroupName = (userList: Friend[]) => {
|
|
197
197
|
const selfName = loginUserInfo.value?.userName || loginUserInfo.value?.userId || '';
|
|
198
|
-
const name = `${selfName}
|
|
198
|
+
const name = `${selfName}、${userList.map(item => item?.remark || item?.nick || item?.userID).join('、')}`;
|
|
199
199
|
return name.length >= GROUP_NAME_LIMIT ? name.slice(0, GROUP_NAME_LIMIT) : name;
|
|
200
200
|
};
|
|
201
201
|
|
|
@@ -231,5 +231,5 @@ const handleCancel = () => {
|
|
|
231
231
|
</script>
|
|
232
232
|
|
|
233
233
|
<style lang="scss" scoped>
|
|
234
|
-
@
|
|
234
|
+
@use './ConversationCreate.scss';
|
|
235
235
|
</style>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
:Preview="Preview"
|
|
45
45
|
:ConversationActions="ConversationActions"
|
|
46
46
|
:actions-config="actionsConfig"
|
|
47
|
-
@select="handleSelectConversation"
|
|
47
|
+
@select-conversation="handleSelectConversation"
|
|
48
48
|
/>
|
|
49
49
|
</component>
|
|
50
50
|
</div>
|
|
@@ -185,5 +185,5 @@ const handleCreated = (conversation: ConversationModel) => {
|
|
|
185
185
|
</script>
|
|
186
186
|
|
|
187
187
|
<style lang="scss" module>
|
|
188
|
-
@
|
|
188
|
+
@use './ConversationList.scss';
|
|
189
189
|
</style>
|
|
@@ -96,7 +96,7 @@ const props = withDefaults(defineProps<ConversationPreviewUIProps>(), {
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
const emit = defineEmits<{
|
|
99
|
-
|
|
99
|
+
selectConversation: [conversation: ConversationModel];
|
|
100
100
|
}>();
|
|
101
101
|
|
|
102
102
|
const { activeConversation, setActiveConversation } = useConversationListState();
|
|
@@ -120,7 +120,7 @@ watch(isHovered, (newValue) => {
|
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
const handleClick = () => {
|
|
123
|
-
emit('
|
|
123
|
+
emit('selectConversation', props.conversation);
|
|
124
124
|
setActiveConversation(props.conversation.conversationID);
|
|
125
125
|
};
|
|
126
126
|
|
|
@@ -130,5 +130,5 @@ const handleCloseActionsModal = () => {
|
|
|
130
130
|
</script>
|
|
131
131
|
|
|
132
132
|
<style lang="scss" module>
|
|
133
|
-
@
|
|
133
|
+
@use './ConversationPreview.scss';
|
|
134
134
|
</style>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<PopoverRoot
|
|
2
|
+
<View>
|
|
3
|
+
<PopoverRoot
|
|
4
|
+
:open="isOpen"
|
|
5
|
+
@update:open="handleOpenChange"
|
|
6
|
+
>
|
|
4
7
|
<PopoverTrigger
|
|
5
8
|
as="div"
|
|
6
9
|
:disabled="props.disabled"
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
</PopoverContent>
|
|
46
49
|
</PopoverPortal>
|
|
47
50
|
</PopoverRoot>
|
|
48
|
-
</
|
|
51
|
+
</View>
|
|
49
52
|
</template>
|
|
50
53
|
|
|
51
54
|
<script setup lang="ts">
|
|
@@ -53,6 +56,7 @@ import { onMounted, defineProps, useCssModule, ref } from 'vue';
|
|
|
53
56
|
import { useUIKit, IconEmoji } from '@tencentcloud/uikit-base-component-vue3';
|
|
54
57
|
import cs from 'classnames';
|
|
55
58
|
import { PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from 'reka-ui';
|
|
59
|
+
import { View } from '../../../baseComp/View';
|
|
56
60
|
import { emojiUrlMap, emojiBaseUrl } from '../../../constants/emoji';
|
|
57
61
|
import { useMessageInputState, MessageContentType } from '../../../states/MessageInputState';
|
|
58
62
|
import { transformTextWithEmojiKeyToName } from '../../../utils/emoji';
|
|
@@ -76,7 +76,7 @@ const props = withDefaults(defineProps<MessageInputProps>(), {
|
|
|
76
76
|
autoFocus: true,
|
|
77
77
|
disabled: false,
|
|
78
78
|
hideSendButton: false,
|
|
79
|
-
placeholder:
|
|
79
|
+
placeholder: undefined,
|
|
80
80
|
attachmentPickerMode: 'collapsed',
|
|
81
81
|
actions: () => ['EmojiPicker', 'ImagePicker', 'FilePicker', 'VideoPicker'],
|
|
82
82
|
});
|
|
@@ -4,8 +4,7 @@ import StarterKit from '@tiptap/starter-kit';
|
|
|
4
4
|
import { Extension, Editor } from '@tiptap/vue-3';
|
|
5
5
|
import { MessageContentType } from '../../../states/MessageInputState';
|
|
6
6
|
import type { InputContent } from '../../../states/MessageInputState';
|
|
7
|
-
import type { JSONContent } from '@tiptap/vue-3';
|
|
8
|
-
import type { EditorOptions as TiptapEditorOptions } from '@tiptap/vue-3';
|
|
7
|
+
import type { JSONContent, EditorOptions as TiptapEditorOptions } from '@tiptap/vue-3';
|
|
9
8
|
import './Editor.scss';
|
|
10
9
|
|
|
11
10
|
function createEmojiExtension() {
|
|
@@ -111,6 +110,7 @@ interface EditorOptions {
|
|
|
111
110
|
placeholder?: string;
|
|
112
111
|
autoFocus?: boolean;
|
|
113
112
|
disabled?: boolean;
|
|
113
|
+
isPlaceholderOnlyShowWhenEditable?: boolean;
|
|
114
114
|
onUpdate?: (content: InputContent[]) => void;
|
|
115
115
|
onEnter?: () => void;
|
|
116
116
|
onFocus?: () => void;
|
|
@@ -122,6 +122,7 @@ function createEditor({
|
|
|
122
122
|
placeholder = '',
|
|
123
123
|
autoFocus = false,
|
|
124
124
|
disabled = false,
|
|
125
|
+
isPlaceholderOnlyShowWhenEditable = true,
|
|
125
126
|
onUpdate,
|
|
126
127
|
onEnter,
|
|
127
128
|
onFocus,
|
|
@@ -134,6 +135,7 @@ function createEditor({
|
|
|
134
135
|
createImageExtension(),
|
|
135
136
|
Placeholder.configure({
|
|
136
137
|
placeholder,
|
|
138
|
+
showOnlyWhenEditable: isPlaceholderOnlyShowWhenEditable,
|
|
137
139
|
}),
|
|
138
140
|
];
|
|
139
141
|
|
|
@@ -32,7 +32,7 @@ interface TextEditorProps {
|
|
|
32
32
|
const props = withDefaults(defineProps<TextEditorProps>(), {
|
|
33
33
|
autoFocus: true,
|
|
34
34
|
disabled: false,
|
|
35
|
-
placeholder:
|
|
35
|
+
placeholder: undefined,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
const { t } = useUIKit();
|
|
@@ -42,8 +42,6 @@ const { updateRawValue, sendMessage, setEditorInstance, setContent } = useMessag
|
|
|
42
42
|
const editorDomRef = ref<HTMLDivElement | null>(null);
|
|
43
43
|
const isFocused = ref(props.autoFocus);
|
|
44
44
|
|
|
45
|
-
const placeholderText = computed(() => (props.disabled ? '' : props.placeholder || t('MessageInput.enter_a_message')));
|
|
46
|
-
|
|
47
45
|
let editorInstance: Editor | null = null;
|
|
48
46
|
|
|
49
47
|
onMounted(() => {
|
|
@@ -57,7 +55,8 @@ onMounted(() => {
|
|
|
57
55
|
if (!element.dataset.editorCreated) {
|
|
58
56
|
editorInstance = createEditor({
|
|
59
57
|
element,
|
|
60
|
-
placeholder:
|
|
58
|
+
placeholder: props.placeholder ?? t('MessageInput.enter_a_message'),
|
|
59
|
+
isPlaceholderOnlyShowWhenEditable: props.placeholder === undefined,
|
|
61
60
|
autoFocus: props.autoFocus,
|
|
62
61
|
disabled: props.disabled,
|
|
63
62
|
onUpdate: (content) => {
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="wave-form"
|
|
4
|
-
@click="handleClick"
|
|
5
4
|
:style="waveFormStyle"
|
|
5
|
+
@click="handleClick"
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
8
8
|
v-for="(height, index) in waveBarHeights"
|
|
9
9
|
:key="index"
|
|
10
10
|
class="wave-form__bar"
|
|
11
|
-
:class="{ 'wave-form__bar--active':
|
|
11
|
+
:class="{ 'wave-form__bar--active': activeStates[index] }"
|
|
12
12
|
:style="{ height: `${height}px` }"
|
|
13
13
|
/>
|
|
14
|
-
<div
|
|
15
|
-
class="wave-form__cursor"
|
|
16
|
-
:style="cursorStyle"
|
|
17
|
-
/>
|
|
18
14
|
</div>
|
|
19
15
|
</template>
|
|
20
16
|
|
|
21
17
|
<script lang="ts" setup>
|
|
22
|
-
import {
|
|
18
|
+
import { computed } from 'vue';
|
|
23
19
|
|
|
24
20
|
interface WaveFormProps {
|
|
25
21
|
progress: number | undefined;
|
|
@@ -29,7 +25,7 @@ interface WaveFormProps {
|
|
|
29
25
|
|
|
30
26
|
const props = withDefaults(defineProps<WaveFormProps>(), {
|
|
31
27
|
barsCount: 30,
|
|
32
|
-
width: '100%'
|
|
28
|
+
width: '100%',
|
|
33
29
|
});
|
|
34
30
|
|
|
35
31
|
const emit = defineEmits<{
|
|
@@ -38,32 +34,27 @@ const emit = defineEmits<{
|
|
|
38
34
|
|
|
39
35
|
// Calculate wave form container style
|
|
40
36
|
const waveFormStyle = computed(() => ({
|
|
41
|
-
width: typeof props.width === 'number' ? `${props.width}px` : props.width
|
|
37
|
+
width: typeof props.width === 'number' ? `${props.width}px` : props.width,
|
|
42
38
|
}));
|
|
43
39
|
|
|
44
40
|
// Generate fixed wave bar heights array to avoid height changes on re-render
|
|
45
|
-
const waveBarHeights =
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
const waveBarHeights = Array.from({ length: props.barsCount }, () => Math.random() * 16 + 4);
|
|
42
|
+
|
|
43
|
+
// Compute active states for all bars
|
|
44
|
+
const activeStates = computed(() => {
|
|
45
|
+
const currentProgress = props.progress || 0;
|
|
46
|
+
|
|
47
|
+
if (currentProgress === 0) {
|
|
48
|
+
return Array(props.barsCount).fill(false);
|
|
53
49
|
}
|
|
54
|
-
waveBarHeights.value = heights;
|
|
55
|
-
});
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
51
|
+
const _activeStates = Array.from({ length: props.barsCount }, (_, index) => {
|
|
52
|
+
const barProgress = index / props.barsCount;
|
|
53
|
+
return currentProgress >= barProgress;
|
|
54
|
+
});
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
left: `${(props.progress || 0) * 100}%`
|
|
66
|
-
}));
|
|
56
|
+
return _activeStates;
|
|
57
|
+
});
|
|
67
58
|
|
|
68
59
|
// Handle click event, calculate new progress
|
|
69
60
|
const handleClick = (event: MouseEvent) => {
|
|
@@ -71,7 +62,7 @@ const handleClick = (event: MouseEvent) => {
|
|
|
71
62
|
const rect = waveElement.getBoundingClientRect();
|
|
72
63
|
const offsetX = event.clientX - rect.left;
|
|
73
64
|
const newProgress = offsetX / rect.width;
|
|
74
|
-
|
|
65
|
+
|
|
75
66
|
// Ensure progress value is between 0-1
|
|
76
67
|
const validProgress = Math.max(0, Math.min(1, newProgress));
|
|
77
68
|
emit('seek', validProgress);
|
|
@@ -102,13 +93,5 @@ const handleClick = (event: MouseEvent) => {
|
|
|
102
93
|
}
|
|
103
94
|
}
|
|
104
95
|
|
|
105
|
-
&__cursor {
|
|
106
|
-
position: absolute;
|
|
107
|
-
top: 0;
|
|
108
|
-
width: 2px;
|
|
109
|
-
height: 100%;
|
|
110
|
-
background-color: rgba(0, 0, 0, 20%);
|
|
111
|
-
pointer-events: none;
|
|
112
|
-
}
|
|
113
96
|
}
|
|
114
97
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { MessageLayout } from './MessageLayout';
|
|
3
3
|
import type { MessageAction } from '../../../hooks/useMessageActions';
|
|
4
|
-
import type {
|
|
4
|
+
import type { MessageModel } from '../../../types/engine';
|
|
5
5
|
|
|
6
6
|
interface MessageProps {
|
|
7
7
|
message: MessageModel;
|