tuikit-atomicx-vue3 3.4.1 → 4.3.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/.eslintrc.cjs +1 -0
- package/dist/baseComp/Modal/Modal.js +431 -23
- package/dist/chat/index.d.ts +18 -18
- package/dist/components/AudioSetting/AudioMediaControl.js +39 -41
- package/dist/components/AudioSetting/AudioSettingTab.js +10 -10
- package/dist/components/AudioSetting/MicrophoneSelect.js +8 -8
- package/dist/components/AudioSetting/SpeakerSelect.js +9 -9
- package/dist/components/AudioSettingPanel/i18n/en-US/index.d.ts +1 -0
- package/dist/components/AudioSettingPanel/i18n/en-US/index.js +2 -1
- package/dist/components/AudioSettingPanel/i18n/zh-CN/index.d.ts +1 -0
- package/dist/components/AudioSettingPanel/i18n/zh-CN/index.js +2 -1
- package/dist/components/AudioSettingPanel/index.js +81 -73
- package/dist/components/BarrageInput/BarrageInputH5.js +9 -9
- package/dist/components/BarrageInput/EmojiPicker/EmojiPicker.js +3 -3
- package/dist/components/BarrageInput/MessageInputState.d.ts +28 -0
- package/dist/components/BarrageInput/MessageInputState.js +82 -0
- package/dist/components/BarrageInput/TextEditor/CharacterCountExtension.js +1 -1
- package/dist/components/BarrageInput/TextEditor/EditorCore.js +2 -2
- package/dist/components/BarrageInput/TextEditor/index.js +7 -7
- package/dist/components/BarrageInput/type.d.ts +17 -0
- package/dist/components/BarrageInput/type.js +4 -0
- package/dist/components/BarrageInput/utils.d.ts +30 -0
- package/dist/components/BarrageInput/utils.js +41 -0
- package/dist/components/BarrageList/BarrageList.js +80 -110
- package/dist/components/BarrageList/BarrageList.vue.d.ts +0 -29
- package/dist/components/BarrageList/BarrageListH5.js +95 -122
- package/dist/components/BarrageList/BarrageListH5.vue.d.ts +0 -29
- package/dist/components/BarrageList/BarrageListState.d.ts +58 -0
- package/dist/components/BarrageList/BarrageListState.js +106 -0
- package/dist/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.js +16 -24
- package/dist/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.vue.d.ts +5 -5
- package/dist/components/BarrageList/Message/MessageLayout/MessageLayout.js +48 -73
- package/dist/components/BarrageList/Message/MessageLayout/MessageLayout.vue.d.ts +5 -7
- package/dist/components/BarrageList/Message/TextMessage/TextMessage.js +70 -76
- package/dist/components/BarrageList/Message/TextMessage/TextMessage.vue.d.ts +6 -6
- package/dist/components/BarrageList/Message/TextMessage/emoji.d.ts +5 -0
- package/dist/components/BarrageList/Message/TextMessage/emoji.js +134 -0
- package/dist/components/BarrageList/index.d.ts +0 -36
- package/dist/components/CameraButton/index.js +18 -19
- package/dist/components/CoGuestPanel/CoGuestPanel.js +60 -60
- package/dist/components/CoHostPanel/BattlePanel.js +25 -25
- package/dist/components/CoHostPanel/CoHostPanel.js +60 -55
- package/dist/components/CoHostPanel/ConfigSettingPanel.js +49 -55
- package/dist/components/CoHostPanel/ConnectionPanel.js +129 -120
- package/dist/components/CoHostPanel/RecommendHostList.js +39 -36
- package/dist/components/CoHostPanel/constants.d.ts +3 -0
- package/dist/components/CoHostPanel/constants.js +6 -0
- package/dist/components/CoHostPanel/i18n/en-US/index.d.ts +1 -0
- package/dist/components/CoHostPanel/i18n/en-US/index.js +2 -1
- package/dist/components/CoHostPanel/i18n/zh-CN/index.d.ts +1 -0
- package/dist/components/CoHostPanel/i18n/zh-CN/index.js +3 -2
- package/dist/components/LiveAudienceList/LiveAudienceList.js +44 -45
- package/dist/components/LiveAudienceList/LiveAudienceListH5.js +7 -7
- package/dist/components/LiveAudienceList/UserActionMenu.js +57 -64
- package/dist/components/LiveList/LiveList.js +23 -23
- package/dist/components/LiveList/LiveListH5.js +38 -38
- package/dist/components/LiveScenePanel/CameraSettingDialog.js +10 -10
- package/dist/components/LiveScenePanel/MaterialItem.js +15 -15
- package/dist/components/LiveScenePanel/index.js +4 -4
- package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/BattleDecorate.js +58 -58
- package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/BattleUserDecorate.js +56 -49
- package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/CoHostDecorate.js +6 -6
- package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/LiveCoreDecorate.js +1 -1
- package/dist/components/{LiveCoreView → LiveView}/DefaultStreamViewUI.js +46 -43
- package/dist/components/{LiveCoreView → LiveView}/PlayerControl/AudioControl.js +23 -23
- package/dist/components/LiveView/PlayerControl/MultiResolution.js +79 -0
- package/dist/components/LiveView/PlayerControl/MultiResolution.vue.d.ts +8 -0
- package/dist/components/LiveView/PlayerControl/PlayerControl.js +172 -0
- package/dist/components/LiveView/PlayerControl/PlayerControlState.js +263 -0
- package/dist/components/{LiveCoreView → LiveView}/PlayerControl/utils/domHelpers.d.ts +6 -0
- package/dist/components/LiveView/PlayerControl/utils/domHelpers.js +131 -0
- package/dist/components/{LiveCoreView/i18n/zh-CN → LiveView/i18n/en-US}/index.d.ts +3 -2
- package/dist/components/{LiveCoreView → LiveView}/i18n/en-US/index.js +4 -3
- package/dist/components/{LiveCoreView/i18n/en-US → LiveView/i18n/zh-CN}/index.d.ts +3 -2
- package/dist/components/{LiveCoreView → LiveView}/i18n/zh-CN/index.js +4 -3
- package/dist/components/LiveView/index.d.ts +79 -0
- package/dist/components/{LiveCoreView → LiveView}/index.js +44 -42
- package/dist/components/MessageInput/TextEditor/EditorCore.js +2 -2
- package/dist/components/MessageList/MessageList.vue.d.ts +2 -2
- package/dist/components/MessageList/index.d.ts +18 -18
- package/dist/components/MicButton/index.js +11 -11
- package/dist/components/StreamMixer/LocalMixer/MixerControl.js +12 -12
- package/dist/components/StreamMixer/LocalMixer/index.js +66 -63
- package/dist/components/StreamMixer/index.js +6 -6
- package/dist/components/StreamView/Layout/CustomLayout.js +8 -8
- package/dist/components/StreamView/Layout/FloatLayout.js +124 -127
- package/dist/components/StreamView/Layout/GridLayout.js +5 -5
- package/dist/components/StreamView/index.js +25 -33
- package/dist/components/StreamView/manager/mediaManager.js +54 -60
- package/dist/components/VideoSetting/CameraSelect.js +8 -8
- package/dist/components/VideoSetting/VideoMediaControl.js +10 -10
- package/dist/components/VideoSetting/VideoPreview.js +9 -9
- package/dist/components/VideoSetting/VideoProfile.js +6 -6
- package/dist/components/VideoSetting/VideoSettingTab.js +40 -39
- package/dist/components/VideoSettingPanel/CameraSelect.js +8 -8
- package/dist/components/VideoSettingPanel/VideoPreview.js +1 -1
- package/dist/components/VideoSettingPanel/VideoProfile.js +18 -18
- package/dist/hooks/useRoomEngine.js +6 -6
- package/dist/{index-D88ja_7_.js → index-BfIEeWMg.js} +1767 -1757
- package/dist/{index-D-KJvDvy.js → index-DTi1fL-x.js} +460 -457
- package/dist/index.js +177 -157
- package/dist/report/MetricsKey.d.ts +16 -0
- package/dist/report/MetricsKey.js +4 -0
- package/dist/report/dataReport.d.ts +12 -0
- package/dist/report/dataReport.js +45 -0
- package/dist/report/index.d.ts +4 -0
- package/dist/report/index.js +6 -0
- package/dist/rtc/index.d.ts +6 -81
- package/dist/rtc/index.js +53 -52
- package/dist/states/BarrageState/BarrageState.d.ts +74 -0
- package/dist/states/BarrageState/BarrageState.js +80 -0
- package/dist/states/BarrageState/index.d.ts +1 -0
- package/dist/states/BarrageState/index.js +5 -0
- package/dist/states/{BattleState.d.ts → BattleState/BattleState.d.ts} +10 -11
- package/dist/states/BattleState/BattleState.js +203 -0
- package/dist/states/BattleState/index.d.ts +1 -0
- package/dist/states/BattleState/index.js +4 -0
- package/dist/states/CoGuestState.d.ts +24 -94
- package/dist/states/CoGuestState.js +297 -189
- package/dist/states/CoHostState/CoHostState.d.ts +2 -2
- package/dist/states/CoHostState/CoHostState.js +135 -131
- package/dist/states/{DeviceState.d.ts → DeviceState/DeviceState.d.ts} +25 -13
- package/dist/states/DeviceState/DeviceState.js +314 -0
- package/dist/states/DeviceState/index.d.ts +1 -0
- package/dist/states/DeviceState/index.js +4 -0
- package/dist/states/LiveAudienceState.d.ts +3 -1
- package/dist/states/LiveAudienceState.js +106 -63
- package/dist/states/{LiveState/index.d.ts → LiveListState/LiveListState.d.ts} +13 -8
- package/dist/states/LiveListState/LiveListState.js +285 -0
- package/dist/states/LiveListState/index.d.ts +1 -0
- package/dist/states/LiveListState/index.js +4 -0
- package/dist/states/LiveMonitorState/api/http.js +147 -129
- package/dist/states/LiveMonitorState/index.js +67 -62
- package/dist/states/LiveSeatState/index.d.ts +46 -11
- package/dist/states/LiveSeatState/index.js +34 -15
- package/dist/states/LiveSeatState/seatEventManager.d.ts +2 -0
- package/dist/states/LiveSeatState/seatEventManager.js +63 -42
- package/dist/states/LiveSeatState/seatManager.d.ts +34 -5
- package/dist/states/LiveSeatState/seatManager.js +131 -29
- package/dist/states/LiveSeatState/store.d.ts +5 -5
- package/dist/states/LiveSeatState/store.js +12 -10
- package/dist/states/LiveSeatState/usePlayStream/RTCStreamManager.js +1 -1
- package/dist/states/LiveSeatState/usePlayStream/RTCStreamPlayer.js +1 -1
- package/dist/states/LiveSeatState/usePlayStream/index.js +30 -28
- package/dist/states/LoginState.js +39 -34
- package/dist/states/SeatStore.js +82 -83
- package/dist/states/{VideoMixerState.d.ts → VideoMixerState/VideoMixerState.d.ts} +1 -1
- package/dist/states/VideoMixerState/VideoMixerState.js +269 -0
- package/dist/states/VideoMixerState/index.d.ts +1 -0
- package/dist/states/VideoMixerState/index.js +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/audience.d.ts +21 -0
- package/dist/types/audience.js +4 -1
- package/dist/types/battle.d.ts +75 -3
- package/dist/types/battle.js +5 -1
- package/dist/types/coGuest.d.ts +72 -5
- package/dist/types/coGuest.js +4 -2
- package/dist/types/device.d.ts +38 -17
- package/dist/types/device.js +10 -8
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +96 -80
- package/dist/types/live.d.ts +36 -21
- package/dist/types/live.js +6 -4
- package/dist/types/seat.d.ts +23 -4
- package/dist/types/seat.js +7 -1
- package/dist/utils/eventCenter.d.ts +88 -0
- package/dist/utils/eventCenter.js +161 -0
- package/package.json +2 -2
- package/src/components/AudioSetting/AudioMediaControl.vue +1 -3
- package/src/components/AudioSetting/AudioSettingTab.vue +1 -2
- package/src/components/AudioSetting/MicrophoneSelect.vue +1 -2
- package/src/components/AudioSetting/SpeakerSelect.vue +1 -2
- package/src/components/AudioSettingPanel/i18n/en-US/index.ts +1 -0
- package/src/components/AudioSettingPanel/i18n/zh-CN/index.ts +1 -0
- package/src/components/AudioSettingPanel/index.vue +4 -2
- package/src/components/BarrageInput/BarrageInputH5.vue +1 -1
- package/src/components/BarrageInput/EmojiPicker/EmojiPicker.vue +1 -1
- package/src/components/BarrageInput/MessageInputState.ts +160 -0
- package/src/components/BarrageInput/TextEditor/TextEditor.vue +1 -1
- package/src/components/BarrageInput/type.ts +26 -0
- package/src/components/BarrageInput/utils.ts +45 -0
- package/src/components/BarrageList/BarrageList.vue +61 -117
- package/src/components/BarrageList/BarrageListH5.vue +75 -159
- package/src/components/BarrageList/BarrageListState.ts +223 -0
- package/src/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.vue +8 -55
- package/src/components/BarrageList/Message/MessageLayout/MessageLayout.vue +19 -44
- package/src/components/BarrageList/Message/TextMessage/TextMessage.vue +69 -96
- package/src/components/BarrageList/Message/TextMessage/emoji.ts +132 -0
- package/src/components/CameraButton/index.vue +0 -1
- package/src/components/CoGuestPanel/CoGuestPanel.vue +16 -91
- package/src/components/CoHostPanel/BattlePanel.vue +4 -7
- package/src/components/CoHostPanel/CoHostPanel.vue +11 -3
- package/src/components/CoHostPanel/ConfigSettingPanel.vue +2 -8
- package/src/components/CoHostPanel/ConnectionPanel.vue +41 -37
- package/src/components/CoHostPanel/RecommendHostList.vue +12 -13
- package/src/components/CoHostPanel/constants.ts +3 -0
- package/src/components/CoHostPanel/i18n/en-US/index.ts +1 -0
- package/src/components/CoHostPanel/i18n/zh-CN/index.ts +2 -1
- package/src/components/LiveAudienceList/LiveAudienceList.vue +4 -5
- package/src/components/LiveAudienceList/LiveAudienceListH5.vue +2 -2
- package/src/components/LiveAudienceList/UserActionMenu.vue +7 -48
- package/src/components/LiveList/LiveList.vue +5 -5
- package/src/components/LiveList/LiveListH5.vue +6 -6
- package/src/components/LiveScenePanel/index.vue +2 -2
- package/src/components/{LiveCoreView → LiveView}/CoreViewDecorate/BattleDecorate.vue +10 -15
- package/src/components/{LiveCoreView → LiveView}/CoreViewDecorate/BattleUserDecorate.vue +30 -31
- package/src/components/{LiveCoreView → LiveView}/DefaultStreamViewUI.vue +5 -3
- package/src/components/{LiveCoreView → LiveView}/PlayerControl/AudioControl.vue +1 -1
- package/src/components/{LiveCoreView → LiveView}/PlayerControl/MultiResolution.vue +9 -3
- package/src/components/{LiveCoreView → LiveView}/PlayerControl/PlayerControl.vue +10 -2
- package/src/components/{LiveCoreView → LiveView}/PlayerControl/PlayerControlState.ts +233 -259
- package/src/components/{LiveCoreView → LiveView}/PlayerControl/utils/domHelpers.ts +64 -0
- package/src/components/{LiveCoreView → LiveView}/i18n/en-US/index.ts +3 -2
- package/src/components/{LiveCoreView → LiveView}/i18n/zh-CN/index.ts +3 -2
- package/src/components/{LiveCoreView → LiveView}/index.ts +5 -2
- package/src/components/{LiveCoreView → LiveView}/index.vue +3 -3
- package/src/components/MicButton/index.vue +3 -3
- package/src/components/StreamMixer/LocalMixer/index.vue +6 -8
- package/src/components/StreamMixer/index.vue +1 -1
- package/src/components/StreamView/Layout/CustomLayout.vue +2 -2
- package/src/components/StreamView/Layout/FloatLayout.vue +88 -83
- package/src/components/StreamView/index.vue +28 -14
- package/src/components/StreamView/manager/mediaManager.ts +38 -42
- package/src/components/VideoSetting/CameraSelect.vue +1 -2
- package/src/components/VideoSetting/VideoMediaControl.vue +1 -1
- package/src/components/VideoSetting/VideoPreview.vue +1 -2
- package/src/components/VideoSetting/VideoProfile.vue +1 -1
- package/src/components/VideoSetting/VideoSettingTab.vue +9 -5
- package/src/components/VideoSettingPanel/CameraSelect.vue +1 -2
- package/src/components/VideoSettingPanel/VideoProfile.vue +7 -7
- package/src/hooks/useRoomEngine.ts +1 -1
- package/src/report/MetricsKey.ts +16 -0
- package/src/report/dataReport.ts +55 -0
- package/src/report/index.ts +7 -0
- package/src/rtc/index.ts +8 -10
- package/src/types/audience.ts +27 -1
- package/src/types/battle.ts +87 -4
- package/src/types/coGuest.ts +87 -5
- package/src/types/device.ts +41 -16
- package/src/types/index.ts +2 -2
- package/src/types/live.ts +41 -22
- package/src/types/seat.ts +28 -4
- package/src/utils/eventCenter.ts +249 -0
- package/dist/DialogPortal-CvJcEAsn.js +0 -417
- package/dist/components/BarrageList/Message/FaceMessage/FaceMessage.js +0 -23
- package/dist/components/BarrageList/Message/FaceMessage/FaceMessage.vue.d.ts +0 -30
- package/dist/components/BarrageList/Message/FaceMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/FaceMessage/index.js +0 -4
- package/dist/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.js +0 -4
- package/dist/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.vue.d.ts +0 -16
- package/dist/components/BarrageList/Message/GroupTipMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/GroupTipMessage/index.js +0 -25
- package/dist/components/BarrageList/Message/ImageMessage/ImageMessage.js +0 -71
- package/dist/components/BarrageList/Message/ImageMessage/ImageMessage.vue.d.ts +0 -34
- package/dist/components/BarrageList/Message/ImageMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/ImageMessage/index.js +0 -4
- package/dist/components/BarrageList/Message/MergerMessage/MergerMessage.js +0 -9
- package/dist/components/BarrageList/Message/MergerMessage/MergerMessage.vue.d.ts +0 -2
- package/dist/components/BarrageList/Message/MergerMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/MergerMessage/index.js +0 -4
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.js +0 -40
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.vue.d.ts +0 -54
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.js +0 -26
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.vue.d.ts +0 -15
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/index.js +0 -4
- package/dist/components/BarrageList/Message/RecalledMessage/RecalledMessage.js +0 -41
- package/dist/components/BarrageList/Message/RecalledMessage/RecalledMessage.vue.d.ts +0 -35
- package/dist/components/BarrageList/Message/RecalledMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/RecalledMessage/index.js +0 -4
- package/dist/components/BarrageList/MessageForward/ForwardListItem.js +0 -45
- package/dist/components/BarrageList/MessageForward/ForwardListItem.vue.d.ts +0 -17
- package/dist/components/BarrageList/MessageForward/MessageForward.js +0 -203
- package/dist/components/BarrageList/MessageForward/MessageForward.vue.d.ts +0 -2
- package/dist/components/BarrageList/MessageForward/index.d.ts +0 -3
- package/dist/components/BarrageList/MessageForward/index.js +0 -4
- package/dist/components/LiveCoreView/PlayerControl/MultiResolution.js +0 -78
- package/dist/components/LiveCoreView/PlayerControl/MultiResolution.vue.d.ts +0 -2
- package/dist/components/LiveCoreView/PlayerControl/PlayerControl.js +0 -168
- package/dist/components/LiveCoreView/PlayerControl/PlayerControlState.js +0 -267
- package/dist/components/LiveCoreView/PlayerControl/utils/domHelpers.js +0 -99
- package/dist/components/LiveCoreView/index.d.ts +0 -4
- package/dist/components/StreamView/Layout/MixLayout.js +0 -89
- package/dist/components/StreamView/Layout/MixLayout.vue.d.ts +0 -31
- package/dist/states/BarrageListState/BarrageListState.d.ts +0 -26
- package/dist/states/BarrageListState/BarrageListState.js +0 -122
- package/dist/states/BarrageListState/index.d.ts +0 -1
- package/dist/states/BarrageListState/index.js +0 -4
- package/dist/states/BattleState.js +0 -117
- package/dist/states/DeviceState.js +0 -296
- package/dist/states/LiveState/index.js +0 -254
- package/dist/states/VideoMixerState.js +0 -260
- package/src/components/BarrageList/Message/FaceMessage/FaceMessage.vue +0 -43
- package/src/components/BarrageList/Message/FaceMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.vue +0 -55
- package/src/components/BarrageList/Message/GroupTipMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/ImageMessage/ImageMessage.vue +0 -181
- package/src/components/BarrageList/Message/ImageMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/MergerMessage/MergerMessage.vue +0 -6
- package/src/components/BarrageList/Message/MergerMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.vue +0 -70
- package/src/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.vue +0 -40
- package/src/components/BarrageList/Message/MessageLayout/MessageMeta/index.ts +0 -3
- package/src/components/BarrageList/Message/RecalledMessage/RecalledMessage.vue +0 -82
- package/src/components/BarrageList/Message/RecalledMessage/index.ts +0 -3
- package/src/components/BarrageList/MessageForward/ForwardListItem.vue +0 -67
- package/src/components/BarrageList/MessageForward/MessageForward.vue +0 -388
- package/src/components/BarrageList/MessageForward/index.ts +0 -3
- package/src/components/StreamView/Layout/MixLayout.vue +0 -144
- /package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/BattleDecorate.vue.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/BattleUserDecorate.vue.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/CoHostDecorate.vue.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/CoreViewDecorate/LiveCoreDecorate.vue.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/DefaultStreamViewUI.vue.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/AudioControl.vue.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/PlayerControl.vue.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/PlayerControlState.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/index.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/index.js +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/utils/deviceDetection.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/utils/deviceDetection.js +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/utils/fullscreenManager.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/PlayerControl/utils/fullscreenManager.js +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/i18n/index.d.ts +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/i18n/index.js +0 -0
- /package/dist/components/{LiveCoreView → LiveView}/index.vue.d.ts +0 -0
- /package/src/components/{LiveCoreView → LiveView}/CoreViewDecorate/CoHostDecorate.vue +0 -0
- /package/src/components/{LiveCoreView → LiveView}/CoreViewDecorate/LiveCoreDecorate.vue +0 -0
- /package/src/components/{LiveCoreView → LiveView}/PlayerControl/PlayerControl.module.scss +0 -0
- /package/src/components/{LiveCoreView → LiveView}/PlayerControl/index.ts +0 -0
- /package/src/components/{LiveCoreView → LiveView}/PlayerControl/utils/deviceDetection.ts +0 -0
- /package/src/components/{LiveCoreView → LiveView}/PlayerControl/utils/fullscreenManager.ts +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/img/defeat.png +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/img/draw.png +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/img/victory.png +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/svg/BattleOrdinaryBadge.svg +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/svg/BattleTopBadge.svg +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/svg/blueBkg.svg +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/svg/redBkg.svg +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/svg/s.svg +0 -0
- /package/src/components/{LiveCoreView → LiveView}/assets/svg/v.svg +0 -0
- /package/src/components/{LiveCoreView → LiveView}/i18n/index.ts +0 -0
|
@@ -2,34 +2,21 @@
|
|
|
2
2
|
<script lang="ts" setup>
|
|
3
3
|
import { ref, onMounted, onUnmounted, nextTick, watch, provide, useSlots, withDefaults, defineProps } from 'vue';
|
|
4
4
|
import type { Component, CSSProperties } from 'vue';
|
|
5
|
-
import {
|
|
6
|
-
import { throttle } from '../../utils/lodash';
|
|
5
|
+
import { useUIKit } from '@tencentcloud/uikit-base-component-vue3';
|
|
7
6
|
import { useScroll } from '../../hooks/useScroll';
|
|
8
|
-
import {
|
|
7
|
+
import { useLiveListState } from '../../states/LiveListState';
|
|
8
|
+
import { useLoginState } from '../../states/LoginState';
|
|
9
|
+
import { throttle } from '../../utils/lodash';
|
|
10
|
+
import { useBarrageListState } from './BarrageListState';
|
|
11
|
+
import UserActionMenu from './ClickAction/UserActionMenu.vue';
|
|
9
12
|
import { Message as DefaultMessage } from './Message';
|
|
10
|
-
import { MessageForward } from './MessageForward';
|
|
11
13
|
import { MessageListContextSymbol } from './MessageListContext';
|
|
12
|
-
import type {
|
|
13
|
-
import { useUIKit } from '@tencentcloud/uikit-base-component-vue3';
|
|
14
|
-
import UserActionMenu from './ClickAction/UserActionMenu.vue';
|
|
15
|
-
import { useLoginState } from '../../states/LoginState';
|
|
16
|
-
import { useLiveState } from '../../states/LiveState';
|
|
14
|
+
import type { Barrage } from '../../states/BarrageState';
|
|
17
15
|
|
|
18
16
|
const { t } = useUIKit();
|
|
19
17
|
|
|
20
18
|
interface IMessageListProps {
|
|
21
|
-
/** message actions e.g. recall, delete, etc. */
|
|
22
|
-
// messageActionList?: IMessageAction[] | undefined;
|
|
23
|
-
/** max time between message group */
|
|
24
|
-
messageAggregationTime?: number | undefined;
|
|
25
|
-
/** custom filter function */
|
|
26
|
-
filter?: ((message: IMessageModel) => boolean) | undefined;
|
|
27
|
-
/** custom message component */
|
|
28
19
|
Message?: Component | undefined;
|
|
29
|
-
/** custom message timeline component */
|
|
30
|
-
MessageTimeDivider?: Component | undefined;
|
|
31
|
-
/** custom local notification message component */
|
|
32
|
-
LocalNoticeMessage?: Component | undefined;
|
|
33
20
|
containerStyle?: CSSProperties | undefined;
|
|
34
21
|
itemStyle?: CSSProperties | undefined;
|
|
35
22
|
height?: string;
|
|
@@ -37,24 +24,26 @@ interface IMessageListProps {
|
|
|
37
24
|
}
|
|
38
25
|
|
|
39
26
|
const props = withDefaults(defineProps<IMessageListProps>(), {
|
|
40
|
-
/** props */
|
|
41
|
-
filter: undefined,
|
|
42
|
-
enableReadReceipt: false,
|
|
43
|
-
messageAggregationTime: 5 * 60,
|
|
44
|
-
/** custom components */
|
|
45
27
|
Message: undefined,
|
|
46
|
-
MessageTimeDivider: undefined,
|
|
47
|
-
LocalNoticeMessage: undefined,
|
|
48
28
|
});
|
|
49
29
|
|
|
50
30
|
const slots = useSlots();
|
|
51
31
|
const { loginUserInfo } = useLoginState();
|
|
52
|
-
const { currentLive } =
|
|
53
|
-
const currentMessage = ref<
|
|
32
|
+
const { currentLive } = useLiveListState();
|
|
33
|
+
const currentMessage = ref<Barrage>();
|
|
54
34
|
const showActionMenu = ref<boolean>(false);
|
|
55
35
|
const actionMenuStyle = ref<CSSProperties>({});
|
|
56
36
|
|
|
57
37
|
const nickClickTarget = ref<HTMLElement | null>(null);
|
|
38
|
+
const autoScrollThreshold = 150;
|
|
39
|
+
const isFinishFirstRender = ref<boolean>(false);
|
|
40
|
+
const isDisableAutoScroll = ref<boolean>(false);
|
|
41
|
+
const distanceToBottom = ref<number>(0);
|
|
42
|
+
const scrollContainer = ref<HTMLElement | null>(null);
|
|
43
|
+
|
|
44
|
+
const { messageList, messageGroupTip } = useBarrageListState();
|
|
45
|
+
|
|
46
|
+
const { scrollToBottom } = useScroll();
|
|
58
47
|
|
|
59
48
|
// Calculate action menu position to prevent overflow beyond scrollContainer boundaries
|
|
60
49
|
const calculateActionMenuPosition = (targetRect: DOMRect) => {
|
|
@@ -96,10 +85,10 @@ const calculateActionMenuPosition = (targetRect: DOMRect) => {
|
|
|
96
85
|
|
|
97
86
|
provide(MessageListContextSymbol, {
|
|
98
87
|
slots,
|
|
99
|
-
nickClick: (
|
|
100
|
-
const { message, event } =
|
|
88
|
+
nickClick: (data: { message: Barrage; event: MouseEvent }) => {
|
|
89
|
+
const { message, event } = data;
|
|
101
90
|
const isOwner = loginUserInfo.value?.userId === currentLive.value?.liveOwner.userId;
|
|
102
|
-
const isMe = loginUserInfo.value?.userId === message.
|
|
91
|
+
const isMe = loginUserInfo.value?.userId === message.sender.userId;
|
|
103
92
|
if (!isOwner || isMe) {
|
|
104
93
|
return;
|
|
105
94
|
}
|
|
@@ -111,25 +100,14 @@ provide(MessageListContextSymbol, {
|
|
|
111
100
|
},
|
|
112
101
|
});
|
|
113
102
|
|
|
114
|
-
const autoScrollThreshold = 150;
|
|
115
|
-
const isFinishFirstRender = ref<boolean>(false);
|
|
116
|
-
const isDisableAutoScroll = ref<boolean>(false);
|
|
117
|
-
const distanceToBottom = ref<number>(0);
|
|
118
|
-
const isLoadingHistory = ref<boolean>(false);
|
|
119
|
-
const scrollContainer = ref<HTMLElement | null>(null);
|
|
120
|
-
|
|
121
|
-
const { messageGroupTip, messageList, loadMoreMessage, currentConversationID } = useBarrageListState();
|
|
122
|
-
|
|
123
|
-
const { scrollToBottom } = useScroll();
|
|
124
|
-
|
|
125
103
|
// Monitor scroll events
|
|
126
104
|
const handleScroll = throttle(() => {
|
|
127
105
|
if (!scrollContainer.value) {
|
|
128
106
|
return;
|
|
129
107
|
}
|
|
130
108
|
|
|
131
|
-
distanceToBottom.value
|
|
132
|
-
scrollContainer.value.scrollHeight - scrollContainer.value.scrollTop - scrollContainer.value.clientHeight;
|
|
109
|
+
distanceToBottom.value
|
|
110
|
+
= scrollContainer.value.scrollHeight - scrollContainer.value.scrollTop - scrollContainer.value.clientHeight;
|
|
133
111
|
|
|
134
112
|
if (distanceToBottom.value > autoScrollThreshold) {
|
|
135
113
|
isDisableAutoScroll.value = true;
|
|
@@ -147,52 +125,15 @@ const initializeMessageList = async () => {
|
|
|
147
125
|
isDisableAutoScroll.value = false;
|
|
148
126
|
};
|
|
149
127
|
|
|
150
|
-
|
|
151
|
-
const loadMoreHistory = async () => {
|
|
152
|
-
// Skip if initial loading or already loading
|
|
153
|
-
if (!isFinishFirstRender.value || isLoadingHistory.value || !messageList.value?.length) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
isLoadingHistory.value = true;
|
|
158
|
-
|
|
159
|
-
// Record current distance from bottom
|
|
160
|
-
if (!scrollContainer.value) {
|
|
161
|
-
isLoadingHistory.value = false;
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Calculate distance from bottom before loading
|
|
166
|
-
const distanceFromBottom =
|
|
167
|
-
scrollContainer.value.scrollHeight - scrollContainer.value.scrollTop - scrollContainer.value.clientHeight;
|
|
168
|
-
|
|
169
|
-
// Load more messages
|
|
170
|
-
await loadMoreMessage();
|
|
171
|
-
|
|
172
|
-
// Wait for DOM update
|
|
173
|
-
await nextTick();
|
|
174
|
-
|
|
175
|
-
// Restore scroll position to maintain the same distance from bottom
|
|
176
|
-
if (scrollContainer.value) {
|
|
177
|
-
const newScrollTop = scrollContainer.value.scrollHeight - scrollContainer.value.clientHeight - distanceFromBottom;
|
|
178
|
-
|
|
179
|
-
// Ensure scroll position is within valid range
|
|
180
|
-
scrollContainer.value.scrollTop = Math.max(
|
|
181
|
-
0,
|
|
182
|
-
Math.min(scrollContainer.value.scrollHeight - scrollContainer.value.clientHeight, newScrollTop)
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
isLoadingHistory.value = false;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
watch(currentConversationID, () => {
|
|
128
|
+
watch(() => currentLive.value?.liveId, () => {
|
|
190
129
|
initializeMessageList();
|
|
191
130
|
});
|
|
192
131
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
132
|
+
watch(() => messageList.value?.length, (length) => {
|
|
133
|
+
const newMessage = messageList.value[length - 1];
|
|
134
|
+
const oldMessage = messageList.value[length - 2];
|
|
135
|
+
|
|
136
|
+
if (oldMessage === undefined && newMessage && !isFinishFirstRender.value) {
|
|
196
137
|
// Switch to a new conversation
|
|
197
138
|
nextTick(() => {
|
|
198
139
|
scrollToBottom({ behavior: 'instant' });
|
|
@@ -200,15 +141,13 @@ watch(messageList, (newMessages, oldMessages) => {
|
|
|
200
141
|
});
|
|
201
142
|
}
|
|
202
143
|
|
|
203
|
-
if (!
|
|
144
|
+
if (!oldMessage || !newMessage || !length) {
|
|
204
145
|
return;
|
|
205
146
|
}
|
|
206
147
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const shouldAutoScroll =
|
|
211
|
-
newLastMessage.flow === 'out' || (!isDisableAutoScroll.value && distanceToBottom.value < autoScrollThreshold);
|
|
148
|
+
if (newMessage?.sequence !== oldMessage?.sequence) {
|
|
149
|
+
const shouldAutoScroll
|
|
150
|
+
= newMessage.sender.userId === loginUserInfo.value?.userId || (!isDisableAutoScroll.value && distanceToBottom.value < autoScrollThreshold);
|
|
212
151
|
if (shouldAutoScroll) {
|
|
213
152
|
scrollToBottom({ behavior: 'smooth' });
|
|
214
153
|
} else {
|
|
@@ -217,6 +156,13 @@ watch(messageList, (newMessages, oldMessages) => {
|
|
|
217
156
|
}
|
|
218
157
|
});
|
|
219
158
|
|
|
159
|
+
const handleTouchStart = () => {
|
|
160
|
+
const activeElement = document.activeElement as HTMLElement;
|
|
161
|
+
if (activeElement && typeof activeElement.blur === 'function') {
|
|
162
|
+
activeElement.blur();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
220
166
|
onMounted(() => {
|
|
221
167
|
if (scrollContainer.value) {
|
|
222
168
|
scrollContainer.value.addEventListener('scroll', handleScroll);
|
|
@@ -233,47 +179,42 @@ onUnmounted(() => {
|
|
|
233
179
|
|
|
234
180
|
<template>
|
|
235
181
|
<div class="message-list" :style="{ height: props.height, ...props.style }">
|
|
236
|
-
<div
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<div id="loadMore"></div>
|
|
244
|
-
</ObserverView>
|
|
245
|
-
|
|
182
|
+
<div
|
|
183
|
+
id="messageScrollList"
|
|
184
|
+
ref="scrollContainer"
|
|
185
|
+
class="message-list-container"
|
|
186
|
+
:style="props.containerStyle"
|
|
187
|
+
@touchstart="handleTouchStart"
|
|
188
|
+
>
|
|
246
189
|
<div class="message-chunk">
|
|
247
|
-
<template v-for="message in messageList" :key="message.
|
|
190
|
+
<template v-for="message in messageList" :key="message.sequence + message.timestampInSecond">
|
|
248
191
|
<component
|
|
249
|
-
class="message-item"
|
|
250
|
-
:style="props.itemStyle"
|
|
251
192
|
:is="props.Message || DefaultMessage"
|
|
193
|
+
:style="props.itemStyle"
|
|
252
194
|
:message="message"
|
|
253
195
|
:is-last-in-chunk="true"
|
|
254
196
|
/>
|
|
255
197
|
</template>
|
|
256
198
|
</div>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
199
|
+
<div v-if="messageGroupTip" class="message-group-tip">
|
|
200
|
+
<div class="message-group-tip-name">
|
|
201
|
+
{{ messageGroupTip?.nameCard || messageGroupTip?.userName || messageGroupTip?.userId }}
|
|
202
|
+
</div>
|
|
203
|
+
<div class="message-group-tip-action">
|
|
204
|
+
{{ messageGroupTip?.displayAction === 'enter' ? t('Come in') : t('Leave') }}
|
|
205
|
+
</div>
|
|
264
206
|
</div>
|
|
265
207
|
</div>
|
|
208
|
+
<UserActionMenu
|
|
209
|
+
v-if="showActionMenu && currentMessage"
|
|
210
|
+
:user-id="currentMessage?.sender.userId"
|
|
211
|
+
:user-name="currentMessage?.sender.nameCard || currentMessage?.sender.userName || currentMessage?.sender.userId"
|
|
212
|
+
:avatar-url="currentMessage?.sender.avatarUrl"
|
|
213
|
+
:style="actionMenuStyle"
|
|
214
|
+
:click-target="nickClickTarget"
|
|
215
|
+
@close="showActionMenu = false"
|
|
216
|
+
/>
|
|
266
217
|
</div>
|
|
267
|
-
<MessageForward />
|
|
268
|
-
<UserActionMenu
|
|
269
|
-
v-if="showActionMenu"
|
|
270
|
-
:user-id="currentMessage.from"
|
|
271
|
-
:user-name="currentMessage.nameCard || currentMessage.nick || currentMessage.from"
|
|
272
|
-
:avatar-url="currentMessage.avatar"
|
|
273
|
-
:style="actionMenuStyle"
|
|
274
|
-
:click-target="nickClickTarget"
|
|
275
|
-
@close="showActionMenu = false"
|
|
276
|
-
/>
|
|
277
218
|
</template>
|
|
278
219
|
|
|
279
220
|
<style lang="scss" scoped>
|
|
@@ -287,20 +228,24 @@ onUnmounted(() => {
|
|
|
287
228
|
height: 100%;
|
|
288
229
|
overflow: hidden;
|
|
289
230
|
}
|
|
231
|
+
|
|
290
232
|
.message-list-container {
|
|
291
233
|
flex: 1;
|
|
292
234
|
height: 100%;
|
|
293
235
|
padding: 10px;
|
|
294
236
|
@include scrollbar.scrollbar-thin();
|
|
295
237
|
}
|
|
238
|
+
|
|
296
239
|
.message-chunk--container {
|
|
297
240
|
margin-top: 10px;
|
|
298
241
|
}
|
|
242
|
+
|
|
299
243
|
.message-chunk {
|
|
300
244
|
display: flex;
|
|
301
245
|
flex-direction: column;
|
|
302
246
|
gap: 12px;
|
|
303
247
|
}
|
|
248
|
+
|
|
304
249
|
.empty-message {
|
|
305
250
|
text-align: center;
|
|
306
251
|
color: var(--text-color-secondary);
|
|
@@ -310,47 +255,16 @@ onUnmounted(() => {
|
|
|
310
255
|
align-items: center;
|
|
311
256
|
height: 100%;
|
|
312
257
|
}
|
|
258
|
+
|
|
313
259
|
.message-action-mask {
|
|
314
260
|
position: absolute;
|
|
315
261
|
width: 100%;
|
|
316
262
|
height: 100%;
|
|
317
263
|
background: transparent;
|
|
318
264
|
}
|
|
319
|
-
.message-action-container {
|
|
320
|
-
position: absolute;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.highlight-shadow {
|
|
324
|
-
@keyframes shadow-blink {
|
|
325
|
-
50% {
|
|
326
|
-
box-shadow: rgba(255, 156, 25, 1) 0 0 10px 0;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
& {
|
|
331
|
-
box-shadow: rgba(255, 156, 25, 0) 0 0 10px 0;
|
|
332
|
-
animation: shadow-blink 1s linear 3;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
265
|
|
|
336
|
-
.
|
|
266
|
+
.message-action-container {
|
|
337
267
|
position: absolute;
|
|
338
|
-
bottom: 20px;
|
|
339
|
-
left: 50%;
|
|
340
|
-
transform: translateX(-50%);
|
|
341
|
-
background-color: var(--primary-color, #006eff);
|
|
342
|
-
color: white;
|
|
343
|
-
padding: 8px 16px;
|
|
344
|
-
border-radius: 20px;
|
|
345
|
-
font-size: 14px;
|
|
346
|
-
cursor: pointer;
|
|
347
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
348
|
-
z-index: 10;
|
|
349
|
-
transition: all 0.3s ease;
|
|
350
|
-
|
|
351
|
-
&:hover {
|
|
352
|
-
background-color: var(--primary-color-hover, #0057cc);
|
|
353
|
-
}
|
|
354
268
|
}
|
|
355
269
|
|
|
356
270
|
.message-group-tip {
|
|
@@ -367,14 +281,16 @@ onUnmounted(() => {
|
|
|
367
281
|
.message-group-tip-name {
|
|
368
282
|
color: var(--uikit-color-theme-8);
|
|
369
283
|
}
|
|
370
|
-
|
|
371
|
-
}
|
|
284
|
+
|
|
285
|
+
.message-group-tip-action {}
|
|
372
286
|
}
|
|
287
|
+
|
|
373
288
|
:deep(.message-bubble) {
|
|
374
289
|
background-color: var(--uikit-color-black-6);
|
|
375
290
|
border-radius: 12px;
|
|
376
291
|
padding: 2px 6px;
|
|
377
292
|
}
|
|
293
|
+
|
|
378
294
|
:deep(.message-chunk) {
|
|
379
295
|
gap: 4px;
|
|
380
296
|
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { ref, watch, onUnmounted } from 'vue';
|
|
2
|
+
import { TUIRoomEvents } from '@tencentcloud/tuiroom-engine-js';
|
|
3
|
+
import { useRoomEngine } from '../../hooks/useRoomEngine';
|
|
4
|
+
import { useBarrageState } from '../../states/BarrageState';
|
|
5
|
+
import { useLiveListState } from '../../states/LiveListState';
|
|
6
|
+
import type { Barrage } from '../../states/BarrageState';
|
|
7
|
+
|
|
8
|
+
interface IMessageGroupTip {
|
|
9
|
+
avatarUrl: string;
|
|
10
|
+
nameCard: string;
|
|
11
|
+
roomCustomInfo: Record<string, any>;
|
|
12
|
+
userId: string;
|
|
13
|
+
userName: string;
|
|
14
|
+
userRole: number;
|
|
15
|
+
displayAction: 'enter' | 'leave';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const roomEngine = useRoomEngine();
|
|
19
|
+
|
|
20
|
+
const { currentLive } = useLiveListState();
|
|
21
|
+
const { messageList } = useBarrageState();
|
|
22
|
+
|
|
23
|
+
const messageGroupTipRef = ref<IMessageGroupTip>();
|
|
24
|
+
const messageListRef = ref<Barrage[]>([]);
|
|
25
|
+
|
|
26
|
+
const messageListCursor = ref<number>(0);
|
|
27
|
+
const messageUpdateQueue = ref<Barrage[][]>([]);
|
|
28
|
+
const isProcessingQueue = ref<boolean>(false);
|
|
29
|
+
|
|
30
|
+
const messageGroupTipQueue = ref<IMessageGroupTip[]>([]);
|
|
31
|
+
const isProcessingMessageGroupTipQueue = ref<boolean>(false);
|
|
32
|
+
|
|
33
|
+
const MAX_MESSAGE_COUNT = 1000;
|
|
34
|
+
const MESSAGE_GROUP_TIP_AUTO_CLEAR_DELAY = 2000;
|
|
35
|
+
const MESSAGE_QUEUE_PROCESS_DELAY = 1000;
|
|
36
|
+
const BATCH_SIZE = 20;
|
|
37
|
+
// const MAX_WAIT_TIME = 1000; todo
|
|
38
|
+
const MESSAGE_GROUP_TIP_QUEUE_MAX_LENGTH = 10;
|
|
39
|
+
const MESSAGE_GROUP_TIP_QUEUE_REMAIN_LENGTH = 2;
|
|
40
|
+
|
|
41
|
+
let enterRoomListener: ((params: any) => void) | null = null;
|
|
42
|
+
let leaveRoomListener: ((params: any) => void) | null = null;
|
|
43
|
+
|
|
44
|
+
const clearEventListeners = () => {
|
|
45
|
+
if (roomEngine.instance && enterRoomListener) {
|
|
46
|
+
roomEngine.instance.off(TUIRoomEvents.onRemoteUserEnterRoom, enterRoomListener);
|
|
47
|
+
enterRoomListener = null;
|
|
48
|
+
}
|
|
49
|
+
if (roomEngine.instance && leaveRoomListener) {
|
|
50
|
+
roomEngine.instance.off(TUIRoomEvents.onRemoteUserLeaveRoom, leaveRoomListener);
|
|
51
|
+
leaveRoomListener = null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const truncateMessageList = (messages: Barrage[]) => {
|
|
56
|
+
if (messages.length <= MAX_MESSAGE_COUNT) {
|
|
57
|
+
return messages;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const excessCount = messages.length - MAX_MESSAGE_COUNT;
|
|
61
|
+
const cleanedMessages = messages.slice(excessCount);
|
|
62
|
+
|
|
63
|
+
return cleanedMessages;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const processMessageQueue = async () => {
|
|
67
|
+
if (isProcessingQueue.value || messageUpdateQueue.value.length === 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
isProcessingQueue.value = true;
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
let currentBatch: Barrage[] = [];
|
|
75
|
+
let lastUpdateTime = Date.now();
|
|
76
|
+
|
|
77
|
+
while (messageUpdateQueue.value.length > 0) {
|
|
78
|
+
const messages = messageUpdateQueue.value.splice(0, 1)[0];
|
|
79
|
+
currentBatch.push(...messages);
|
|
80
|
+
// while (
|
|
81
|
+
// currentBatch.length < BATCH_SIZE &&
|
|
82
|
+
// messageUpdateQueue.value.length > 0 &&
|
|
83
|
+
// Date.now() - lastUpdateTime < MAX_WAIT_TIME
|
|
84
|
+
// ) {
|
|
85
|
+
// const nextMessages = messageUpdateQueue.value.splice(0, 1)[0];
|
|
86
|
+
// currentBatch.push(...nextMessages);
|
|
87
|
+
// }
|
|
88
|
+
|
|
89
|
+
const newMessageList = [...(messageListRef.value || []), ...currentBatch];
|
|
90
|
+
messageListRef.value = truncateMessageList(newMessageList);
|
|
91
|
+
|
|
92
|
+
currentBatch = [];
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
94
|
+
lastUpdateTime = Date.now();
|
|
95
|
+
|
|
96
|
+
if (messageUpdateQueue.value.length > 0) {
|
|
97
|
+
// eslint-disable-next-line no-await-in-loop, no-promise-executor-return
|
|
98
|
+
await new Promise(resolve => setTimeout(resolve, MESSAGE_QUEUE_PROCESS_DELAY));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
} finally {
|
|
102
|
+
isProcessingQueue.value = false;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const processedMessageListUpdate = (list: Barrage[]) => {
|
|
107
|
+
const newList = list.slice(messageListCursor.value);
|
|
108
|
+
messageListCursor.value = list.length;
|
|
109
|
+
|
|
110
|
+
if (newList.length === 0) {
|
|
111
|
+
messageListRef.value = list;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
for (let i = 0; i < newList.length; i += BATCH_SIZE) {
|
|
116
|
+
messageUpdateQueue.value.push(newList.slice(i, i + BATCH_SIZE));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
processMessageQueue();
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const processMessageGroupTipQueue = async () => {
|
|
123
|
+
if (isProcessingMessageGroupTipQueue.value || messageGroupTipQueue.value.length === 0) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
isProcessingMessageGroupTipQueue.value = true;
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
while (messageGroupTipQueue.value.length > 0) {
|
|
131
|
+
const tip = messageGroupTipQueue.value.splice(0, 1)[0];
|
|
132
|
+
messageGroupTipRef.value = tip;
|
|
133
|
+
// eslint-disable-next-line no-await-in-loop, @stylistic/block-spacing, @stylistic/brace-style, @stylistic/max-statements-per-line
|
|
134
|
+
await new Promise((resolve) => {setTimeout(resolve, MESSAGE_GROUP_TIP_AUTO_CLEAR_DELAY);});
|
|
135
|
+
messageGroupTipRef.value = undefined;
|
|
136
|
+
}
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error('[BarrageListState] processMessageGroupTipQueue error', error);
|
|
139
|
+
} finally {
|
|
140
|
+
isProcessingMessageGroupTipQueue.value = false;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const processMessageGroupTipUpdate = (tip: IMessageGroupTip) => {
|
|
145
|
+
messageGroupTipQueue.value.push(tip);
|
|
146
|
+
if (messageGroupTipQueue.value.length > MESSAGE_GROUP_TIP_QUEUE_MAX_LENGTH) {
|
|
147
|
+
messageGroupTipQueue.value = messageGroupTipQueue.value.slice(-MESSAGE_GROUP_TIP_QUEUE_REMAIN_LENGTH);
|
|
148
|
+
}
|
|
149
|
+
processMessageGroupTipQueue();
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const initWatchers = () => {
|
|
153
|
+
clearEventListeners();
|
|
154
|
+
|
|
155
|
+
enterRoomListener = ({ userInfo }) => {
|
|
156
|
+
processMessageGroupTipUpdate({
|
|
157
|
+
avatarUrl: userInfo.avatarUrl,
|
|
158
|
+
nameCard: userInfo.nameCard,
|
|
159
|
+
roomCustomInfo: userInfo.roomCustomInfo,
|
|
160
|
+
userId: userInfo.userId,
|
|
161
|
+
userName: userInfo.userName,
|
|
162
|
+
userRole: userInfo.userRole,
|
|
163
|
+
displayAction: 'enter',
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
leaveRoomListener = ({ userInfo }) => {
|
|
168
|
+
processMessageGroupTipUpdate({
|
|
169
|
+
avatarUrl: userInfo.avatarUrl,
|
|
170
|
+
nameCard: userInfo.nameCard,
|
|
171
|
+
roomCustomInfo: userInfo.roomCustomInfo,
|
|
172
|
+
userId: userInfo.userId,
|
|
173
|
+
userName: userInfo.userName,
|
|
174
|
+
userRole: userInfo.userRole,
|
|
175
|
+
displayAction: 'leave',
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
if (enterRoomListener) {
|
|
180
|
+
roomEngine.instance?.on(TUIRoomEvents.onRemoteUserEnterRoom, enterRoomListener);
|
|
181
|
+
}
|
|
182
|
+
if (leaveRoomListener) {
|
|
183
|
+
roomEngine.instance?.on(TUIRoomEvents.onRemoteUserLeaveRoom, leaveRoomListener);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
watch(() => messageList.value.length, (length) => {
|
|
188
|
+
if (length > 0) {
|
|
189
|
+
processedMessageListUpdate(messageList.value);
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
immediate: true,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const resetState = () => {
|
|
196
|
+
messageListRef.value = [];
|
|
197
|
+
messageListCursor.value = 0;
|
|
198
|
+
messageUpdateQueue.value = [];
|
|
199
|
+
isProcessingQueue.value = false;
|
|
200
|
+
messageGroupTipRef.value = undefined;
|
|
201
|
+
messageGroupTipQueue.value = [];
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
watch(() => currentLive.value?.liveId, (newVal, oldVal) => {
|
|
205
|
+
if (!newVal && oldVal) {
|
|
206
|
+
resetState();
|
|
207
|
+
} else {
|
|
208
|
+
initWatchers();
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
onUnmounted(() => {
|
|
213
|
+
clearEventListeners();
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
function useBarrageListState() {
|
|
217
|
+
return {
|
|
218
|
+
messageList: messageListRef,
|
|
219
|
+
messageGroupTip: messageGroupTipRef,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { useBarrageListState };
|
|
@@ -5,48 +5,33 @@
|
|
|
5
5
|
cs({
|
|
6
6
|
[`bubble-${flow}`]: flow && true,
|
|
7
7
|
'all-round-radius': !isLastInChunk,
|
|
8
|
-
'no-background': MEDIA_MESSAGE_TYPE.includes(message.type),
|
|
9
|
-
'highlight--normal': isHighlighted,
|
|
10
|
-
'highlight--media': isHighlighted && isMediaMessage,
|
|
11
8
|
})
|
|
12
9
|
"
|
|
13
10
|
>
|
|
14
|
-
<
|
|
15
|
-
{{ t('This message contains risky content') }}
|
|
16
|
-
</div>
|
|
17
|
-
<slot></slot>
|
|
11
|
+
<slot />
|
|
18
12
|
</div>
|
|
19
13
|
</template>
|
|
20
14
|
|
|
21
15
|
<script lang="ts" setup>
|
|
22
|
-
import { toRefs,
|
|
23
|
-
import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
|
|
16
|
+
import { toRefs, defineProps, withDefaults } from 'vue';
|
|
24
17
|
import cs from 'classnames';
|
|
25
|
-
import {
|
|
26
|
-
import type {
|
|
27
|
-
import { useUIKit } from '@tencentcloud/uikit-base-component-vue3';
|
|
18
|
+
import { useLoginState } from '../../../../../states/LoginState';
|
|
19
|
+
import type { Barrage } from '../../../../../states/BarrageState';
|
|
28
20
|
|
|
29
21
|
interface IMessageBubbleProps {
|
|
30
|
-
message:
|
|
22
|
+
message: Barrage;
|
|
31
23
|
isLastInChunk: boolean;
|
|
32
24
|
}
|
|
33
25
|
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
const MEDIA_MESSAGE_TYPE = [TUIChatEngine.TYPES.MSG_IMAGE, TUIChatEngine.TYPES.MSG_VIDEO];
|
|
26
|
+
const { loginUserInfo } = useLoginState();
|
|
37
27
|
|
|
38
28
|
const props = withDefaults(defineProps<IMessageBubbleProps>(), {
|
|
39
|
-
message: () => ({}) as
|
|
29
|
+
message: () => ({}) as Barrage,
|
|
40
30
|
isLastInChunk: false,
|
|
41
31
|
});
|
|
42
32
|
|
|
43
33
|
const { message, isLastInChunk } = toRefs(props);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const isMediaMessage = computed(() => MEDIA_MESSAGE_TYPE.includes(message.value.type));
|
|
47
|
-
const isHighlighted = computed(() => highlightMessageIDList.value.includes(message.value.ID));
|
|
48
|
-
|
|
49
|
-
const { flow } = message.value;
|
|
34
|
+
const flow = message.value.sender.userId === loginUserInfo.value?.userId ? 'in' : 'out';
|
|
50
35
|
</script>
|
|
51
36
|
|
|
52
37
|
<style lang="scss" scoped>
|
|
@@ -68,36 +53,4 @@ $message-bubble-border-radius: 8px;
|
|
|
68
53
|
.bubble-out {
|
|
69
54
|
border-top-right-radius: 0px;
|
|
70
55
|
}
|
|
71
|
-
|
|
72
|
-
.no-background {
|
|
73
|
-
background: none;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.has-risk-content {
|
|
77
|
-
padding: 8px;
|
|
78
|
-
background-color: #fa515129;
|
|
79
|
-
color: var(--text-color-error);
|
|
80
|
-
font-size: 14px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.highlight {
|
|
84
|
-
&--normal {
|
|
85
|
-
animation: background-highlight 1s ease-in-out infinite;
|
|
86
|
-
}
|
|
87
|
-
&--media {
|
|
88
|
-
animation: media-highlight 1s ease-in-out infinite;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@keyframes background-highlight {
|
|
93
|
-
50% {
|
|
94
|
-
background-color: rgba(255, 156, 25, 1);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@keyframes media-highlight {
|
|
99
|
-
50% {
|
|
100
|
-
box-shadow: 0 1px 20px 0 rgb(255, 150, 13);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
56
|
</style>
|