koishi-plugin-chat-patch 3.0.2 → 5.0.1
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/client/vue/index.vue +60 -634
- package/client/web/dist/assets/AppIcon-DIku6-h0.png +0 -0
- package/client/web/dist/assets/AppIconDark-BYymN71t.png +0 -0
- package/client/web/dist/assets/CapacitorAppIcon-CSZwNhvi.png +0 -0
- package/client/web/dist/assets/CapacitorAppIconDark-BMvMOzsg.png +0 -0
- package/client/web/dist/assets/Chat-CTdyeaX2.css +1 -0
- package/client/web/dist/assets/Chat-DkZvD7d8.js +28 -0
- package/client/web/dist/assets/MealHungryPan-Beos3lRI.js +1 -0
- package/client/web/dist/assets/MsgBody-aZ4_aija.js +1 -0
- package/client/web/dist/assets/MsgBody.vue_vue_type_script_setup_true_lang-CPZjRLp6.js +67 -0
- package/client/web/dist/assets/NapcatAppIcon-C7VOAkW9.png +0 -0
- package/client/web/dist/assets/Vue-lEhHouxB.png +0 -0
- package/client/web/dist/assets/append_darwin-CqBNU62J.css +1 -0
- package/client/web/dist/assets/append_full_vibrancy-j0D2LM9m.css +1 -0
- package/client/web/dist/assets/append_linux-uhxeBqeC.css +1 -0
- package/client/web/dist/assets/append_linux_vibrancy-COiZq8MS.css +1 -0
- package/client/web/dist/assets/append_napcat-DV8CAyAd.css +1 -0
- package/client/web/dist/assets/append_new-407Lo5_V.css +1 -0
- package/client/web/dist/assets/append_vibrancy-6FHctkOY.css +1 -0
- package/client/web/dist/assets/append_win32-srmD-78y.css +1 -0
- package/client/web/dist/assets/cakes-CxTVKdnK.svg +189 -0
- package/client/web/dist/assets/core-DhEqZVGG.js +1 -0
- package/client/web/dist/assets/event-Cadp6m6J.js +1 -0
- package/client/web/dist/assets/index-CPTXiemn.js +4045 -0
- package/client/web/dist/assets/index-Cg_esKB0.js +1 -0
- package/client/web/dist/assets/index-Cln012sP.css +1 -0
- package/client/web/dist/assets//346/226/271/346/255/243/345/226/265/345/221/234/344/275/223-CJKIKBn3.ttf +0 -0
- package/client/web/dist/assets//346/234/237/345/276/205-C90_OY60.png +0 -0
- package/client/web/dist/bcui/css/color-dark.css +35 -0
- package/client/web/dist/bcui/css/color-light.css +35 -0
- package/client/web/dist/bcui/css/style.css +468 -0
- package/client/web/dist/bcui/js/main.js +193 -0
- package/client/web/dist/css/append-dark.css +13 -0
- package/client/web/dist/css/append-light.css +13 -0
- package/client/web/dist/css/append-napcat-dark.css +14 -0
- package/client/web/dist/css/append-napcat-light.css +14 -0
- package/client/web/dist/favicon.ico +0 -0
- package/client/web/dist/img/icons/icon-for-fuck-apple.png +0 -0
- package/client/web/dist/img/icons/icon-maskable.png +0 -0
- package/client/web/dist/img/icons/icon.png +0 -0
- package/client/web/dist/img/icons/icon.svg +10 -0
- package/client/web/dist/index.html +22 -0
- package/client/web/dist/robots.txt +2 -0
- package/client/web/dist/sw.js +58 -0
- package/client/web/env.d.ts +56 -0
- package/client/web/index.html +21 -0
- package/client/web/package-lock.json +3419 -0
- package/client/web/package.json +62 -0
- package/client/web/public/bcui/css/color-dark.css +35 -0
- package/client/web/public/bcui/css/color-light.css +35 -0
- package/client/web/public/bcui/css/style.css +468 -0
- package/client/web/public/bcui/js/main.js +193 -0
- package/client/web/public/css/append-dark.css +13 -0
- package/client/web/public/css/append-light.css +13 -0
- package/client/web/public/css/append-napcat-dark.css +14 -0
- package/client/web/public/css/append-napcat-light.css +14 -0
- package/client/web/public/favicon.ico +0 -0
- package/client/web/public/img/icons/icon-for-fuck-apple.png +0 -0
- package/client/web/public/img/icons/icon-maskable.png +0 -0
- package/client/web/public/img/icons/icon.png +0 -0
- package/client/web/public/img/icons/icon.svg +10 -0
- package/client/web/public/robots.txt +2 -0
- package/client/web/public/sw.js +58 -0
- package/client/web/scripts/copy-bcui.mjs +17 -0
- package/client/web/src/App.vue +1127 -0
- package/client/web/src/assets/css/append/append_darwin.css +68 -0
- package/client/web/src/assets/css/append/append_full_vibrancy.css +290 -0
- package/client/web/src/assets/css/append/append_linux.css +125 -0
- package/client/web/src/assets/css/append/append_linux_vibrancy.css +22 -0
- package/client/web/src/assets/css/append/append_napcat.css +35 -0
- package/client/web/src/assets/css/append/append_new.css +843 -0
- package/client/web/src/assets/css/append/append_vibrancy.css +113 -0
- package/client/web/src/assets/css/append/append_win32.css +109 -0
- package/client/web/src/assets/css/append/mobile/append_mobile_horizontal.css +349 -0
- package/client/web/src/assets/css/append/mobile/append_mobile_vertical.css +96 -0
- package/client/web/src/assets/css/chat.css +2104 -0
- package/client/web/src/assets/css/msg.css +941 -0
- package/client/web/src/assets/css/options.css +811 -0
- package/client/web/src/assets/css/sys_notice.css +62 -0
- package/client/web/src/assets/css/view.css +2105 -0
- package/client/web/src/assets/font//346/226/271/346/255/243/345/226/265/345/221/234/344/275/223.ttf +0 -0
- package/client/web/src/assets/img/Vue.png +0 -0
- package/client/web/src/assets/img/cakes.svg +189 -0
- package/client/web/src/assets/img/icons/AppIcon.png +0 -0
- package/client/web/src/assets/img/icons/AppIconDark.png +0 -0
- package/client/web/src/assets/img/icons/CapacitorAppIcon.png +0 -0
- package/client/web/src/assets/img/icons/CapacitorAppIconDark.png +0 -0
- package/client/web/src/assets/img/icons/NapcatAppIcon.png +0 -0
- package/client/web/src/assets/img/icons/NapcatAppIconDark.png +0 -0
- package/client/web/src/assets/img/icons/exit.png +0 -0
- package/client/web/src/assets/img/icons/pen.png +0 -0
- package/client/web/src/assets/img/stars.svg +89 -0
- package/client/web/src/assets/img//346/234/237/345/276/205.png +0 -0
- package/client/web/src/assets/l10n/_About I10n.md +35 -0
- package/client/web/src/assets/l10n/_l10nconfig.json +7 -0
- package/client/web/src/assets/l10n/zh-CN.po +1941 -0
- package/client/web/src/assets/logo.png +0 -0
- package/client/web/src/assets/pathMap/LLOneBot.yaml +2 -0
- package/client/web/src/assets/pathMap/Lagrange.OneBot.yaml +180 -0
- package/client/web/src/assets/pathMap/NapCat.Onebot.yaml +224 -0
- package/client/web/src/assets/pathMap/SnowLuma.yaml +80 -0
- package/client/web/src/assets/qed.txt +1 -0
- package/client/web/src/components/AboutPan.vue +197 -0
- package/client/web/src/components/BulletinBody.vue +129 -0
- package/client/web/src/components/DepPan.vue +310 -0
- package/client/web/src/components/EmojiFace.vue +32 -0
- package/client/web/src/components/FacePan.vue +461 -0
- package/client/web/src/components/FileBody.vue +129 -0
- package/client/web/src/components/FileManager.vue +532 -0
- package/client/web/src/components/FriendBody.vue +54 -0
- package/client/web/src/components/GlobalSessionSearchBar.vue +301 -0
- package/client/web/src/components/History.vue +49 -0
- package/client/web/src/components/LazyLottie.vue +82 -0
- package/client/web/src/components/MergePan.vue +127 -0
- package/client/web/src/components/MsgBody.vue +1478 -0
- package/client/web/src/components/MusicPlayer.vue +549 -0
- package/client/web/src/components/NoticeBody.vue +168 -0
- package/client/web/src/components/QzonePermissionPan.vue +150 -0
- package/client/web/src/components/RawMsgRenderPreviewPan.vue +190 -0
- package/client/web/src/components/ThemeColorPickerPan.vue +420 -0
- package/client/web/src/components/TinySessionBody.vue +51 -0
- package/client/web/src/components/UmamiInfoPan.vue +1549 -0
- package/client/web/src/components/UpdatePan.vue +263 -0
- package/client/web/src/components/ViewerCom.vue +1360 -0
- package/client/web/src/components/VoiceMsg.vue +626 -0
- package/client/web/src/components/WelPan.vue +894 -0
- package/client/web/src/components/msg-body/.gitkeep +0 -0
- package/client/web/src/components/msg-component/JsonSegComp.vue +138 -0
- package/client/web/src/components/msg-component/XmlSegComp.vue +132 -0
- package/client/web/src/components/msg-component/jsonComp/AutoReply.vue +97 -0
- package/client/web/src/components/msg-component/jsonComp/Contact.lua.vue +129 -0
- package/client/web/src/components/msg-component/jsonComp/Feed.lua.vue +94 -0
- package/client/web/src/components/msg-component/jsonComp/Forum.vue +84 -0
- package/client/web/src/components/msg-component/jsonComp/Mannounce.vue +111 -0
- package/client/web/src/components/msg-component/jsonComp/Map.vue +52 -0
- package/client/web/src/components/msg-component/jsonComp/Miniapp.lua.vue +53 -0
- package/client/web/src/components/msg-component/jsonComp/Miniapp.vue +69 -0
- package/client/web/src/components/msg-component/jsonComp/Music.lua.vue +135 -0
- package/client/web/src/components/msg-component/jsonComp/Tuwen.lua.vue +56 -0
- package/client/web/src/components/notice-component/.gitkeep +0 -0
- package/client/web/src/components/notice-component/MealHungryPan.vue +119 -0
- package/client/web/src/components/tooltip/CustomFaceTooltip.vue +22 -0
- package/client/web/src/components/tooltip/Tooltip.vue +50 -0
- package/client/web/src/components/tooltip/Tooltips.vue +14 -0
- package/client/web/src/components/tooltip/UserInfoTooltip.vue +69 -0
- package/client/web/src/function/base.ts +238 -0
- package/client/web/src/function/connect.ts +2042 -0
- package/client/web/src/function/debug.ts +10 -0
- package/client/web/src/function/elements/information.ts +141 -0
- package/client/web/src/function/elements/system.ts +101 -0
- package/client/web/src/function/elements/vueComp.ts +62 -0
- package/client/web/src/function/favicon.ts +76 -0
- package/client/web/src/function/input.ts +69 -0
- package/client/web/src/function/model/emoji.ts +127 -0
- package/client/web/src/function/model/img.ts +150 -0
- package/client/web/src/function/model/msg-body.ts +51 -0
- package/client/web/src/function/msg.ts +2674 -0
- package/client/web/src/function/notify.ts +225 -0
- package/client/web/src/function/option.ts +749 -0
- package/client/web/src/function/satori-model.ts +818 -0
- package/client/web/src/function/satori.ts +325 -0
- package/client/web/src/function/sender.ts +178 -0
- package/client/web/src/function/tooltip.ts +49 -0
- package/client/web/src/function/utils/appUtil.ts +2288 -0
- package/client/web/src/function/utils/avatarUtil.ts +31 -0
- package/client/web/src/function/utils/backgroundUtil.ts +110 -0
- package/client/web/src/function/utils/linkViewUtil.ts +101 -0
- package/client/web/src/function/utils/localHistoryUtil.ts +517 -0
- package/client/web/src/function/utils/msgUtil.ts +1242 -0
- package/client/web/src/function/utils/pinyin.ts +141 -0
- package/client/web/src/function/utils/recordUtil.ts +187 -0
- package/client/web/src/function/utils/sessionUtil.ts +114 -0
- package/client/web/src/function/utils/systemUtil.ts +664 -0
- package/client/web/src/main.ts +91 -0
- package/client/web/src/pages/Chat.vue +3453 -0
- package/client/web/src/pages/Friends.vue +636 -0
- package/client/web/src/pages/Info.vue +717 -0
- package/client/web/src/pages/Messages.vue +875 -0
- package/client/web/src/pages/Options.vue +82 -0
- package/client/web/src/pages/Qzone.vue +1178 -0
- package/client/web/src/pages/chat-view/ChatDanmaku.vue +759 -0
- package/client/web/src/pages/chat-view/ChatGlagame.vue +642 -0
- package/client/web/src/pages/chat-view/ChatTerminal.vue +1044 -0
- package/client/web/src/pages/chat-view/SystemNotice.vue +171 -0
- package/client/web/src/pages/options/OptAccount.vue +107 -0
- package/client/web/src/pages/options/OptAddon.vue +185 -0
- package/client/web/src/pages/options/OptDev.vue +704 -0
- package/client/web/src/pages/options/OptFunction.vue +403 -0
- package/client/web/src/pages/options/OptInfo.vue +165 -0
- package/client/web/src/pages/options/OptView.vue +846 -0
- package/client/web/src/runtime/backend.ts +310 -0
- package/client/web/src/state/auth.ts +14 -0
- package/client/web/src/state/chat.ts +36 -0
- package/client/web/src/state/connection.ts +20 -0
- package/client/web/src/state/contact.ts +37 -0
- package/client/web/src/state/qzone.ts +18 -0
- package/client/web/src/state/sessionHistory.ts +25 -0
- package/client/web/src/state/settings.ts +18 -0
- package/client/web/src/state/sticker.ts +10 -0
- package/client/web/src/state/ui.ts +56 -0
- package/client/web/tsconfig.json +27 -0
- package/client/web/tsconfig.tsbuildinfo +1 -0
- package/client/web/vite.config.ts +33 -0
- package/dist/index.js +1 -12
- package/dist/style.css +1 -1
- package/lib/index.js +2070 -2077
- package/package.json +15 -2
- package/readme.md +0 -22
- package/src/bootstrap.ts +71 -0
- package/src/cache.ts +319 -0
- package/src/config.ts +23 -35
- package/src/database.ts +650 -0
- package/src/index.ts +27 -59
- package/src/media.ts +302 -0
- package/src/recorder.ts +175 -0
- package/src/self-message.ts +456 -0
- package/src/server.d.ts +26 -0
- package/src/types.ts +108 -48
- package/src/web.ts +712 -0
- package/client/vue/chat-logic.ts +0 -683
- package/client/vue/composables/useChatActions.ts +0 -61
- package/client/vue/composables/useChatData.ts +0 -185
- package/client/vue/composables/useImageCache.ts +0 -281
- package/client/vue/composables/useVideoCache.ts +0 -125
- package/client/vue/types.ts +0 -72
- package/lib/api-handlers.d.ts +0 -25
- package/lib/config.d.ts +0 -14
- package/lib/file-manager.d.ts +0 -124
- package/lib/index.d.ts +0 -17
- package/lib/logger.d.ts +0 -9
- package/lib/message-handler.d.ts +0 -35
- package/lib/types.d.ts +0 -57
- package/lib/utils.d.ts +0 -18
- package/src/api-handlers.ts +0 -646
- package/src/file-manager.ts +0 -1436
- package/src/message-handler.ts +0 -507
- package/src/utils.ts +0 -189
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="theme-color-picker-pan">
|
|
3
|
+
<div class="theme-color-preview">
|
|
4
|
+
<label :for="colorHexInputId" class="sr-only">{{ $t('主题颜色值') }}</label>
|
|
5
|
+
<div class="theme-color-preview-chip" :style="{ background: colorHex }" />
|
|
6
|
+
<input :id="colorHexInputId"
|
|
7
|
+
v-model="inputValue"
|
|
8
|
+
class="ss-input theme-color-preview-input"
|
|
9
|
+
type="text"
|
|
10
|
+
inputmode="text"
|
|
11
|
+
maxlength="7"
|
|
12
|
+
spellcheck="false"
|
|
13
|
+
placeholder="#RRGGBB"
|
|
14
|
+
@change="commitHexInput"
|
|
15
|
+
@blur="commitHexInput">
|
|
16
|
+
</div>
|
|
17
|
+
<div class="theme-color-main">
|
|
18
|
+
<div class="theme-color-main-left">
|
|
19
|
+
<div ref="boardRef"
|
|
20
|
+
class="theme-color-board"
|
|
21
|
+
:style="{ '--theme-picker-hue': `hsl(${hue} 100% 50%)` }"
|
|
22
|
+
@pointerdown.prevent="startBoardDrag">
|
|
23
|
+
<div class="theme-color-board-white" />
|
|
24
|
+
<div class="theme-color-board-black" />
|
|
25
|
+
<div class="theme-color-board-thumb"
|
|
26
|
+
:style="{
|
|
27
|
+
left: `${saturation}%`,
|
|
28
|
+
top: `${100 - value}%`,
|
|
29
|
+
background: colorHex,
|
|
30
|
+
}" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div v-if="historyColors.length > 0" class="theme-color-history">
|
|
34
|
+
<button v-for="color in historyColors"
|
|
35
|
+
:key="color"
|
|
36
|
+
class="theme-color-preset"
|
|
37
|
+
type="button"
|
|
38
|
+
:title="color"
|
|
39
|
+
:style="{ background: color }"
|
|
40
|
+
@click="applyPreset(color)" />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="ss-range theme-color-hue-range"
|
|
44
|
+
:style="{ '--range-precent': `${(hue / 360) * 100}%` }">
|
|
45
|
+
<label :for="colorHueInputId" class="sr-only">{{ $t('主题色相') }}</label>
|
|
46
|
+
<input :id="colorHueInputId"
|
|
47
|
+
v-model="hue"
|
|
48
|
+
class="theme-color-hue"
|
|
49
|
+
type="range"
|
|
50
|
+
min="0"
|
|
51
|
+
max="360"
|
|
52
|
+
step="1">
|
|
53
|
+
<div />
|
|
54
|
+
</div>
|
|
55
|
+
<div class="tip">
|
|
56
|
+
<font-awesome-icon icon="exclamation-triangle" />
|
|
57
|
+
<span>{{ $t('实际颜色将由颜色转换器处理为更适应风格的颜色,可能与选色存在差异。') }}</span>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script setup lang="ts">
|
|
63
|
+
import { computed, ref, watch } from 'vue'
|
|
64
|
+
import { i18n } from '../main'
|
|
65
|
+
|
|
66
|
+
defineOptions({ name: 'ThemeColorPickerPan' })
|
|
67
|
+
|
|
68
|
+
const props = withDefaults(defineProps<{
|
|
69
|
+
modelValue: string
|
|
70
|
+
onChange?: (value: string) => void
|
|
71
|
+
historyColors?: string[]
|
|
72
|
+
}>(), {
|
|
73
|
+
onChange: undefined,
|
|
74
|
+
historyColors: () => [],
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const emit = defineEmits<{
|
|
78
|
+
'update:modelValue': [value: string]
|
|
79
|
+
}>()
|
|
80
|
+
|
|
81
|
+
const $t = i18n.global.t
|
|
82
|
+
const boardRef = ref<HTMLDivElement | null>(null)
|
|
83
|
+
const hue = ref(0)
|
|
84
|
+
const saturation = ref(100)
|
|
85
|
+
const value = ref(100)
|
|
86
|
+
const inputValue = ref('#FFFFFF')
|
|
87
|
+
const isSyncing = ref(false)
|
|
88
|
+
const colorHexInputId = `theme-color-preview-input-${Math.random().toString(36).slice(2, 9)}`
|
|
89
|
+
const colorHueInputId = `theme-color-hue-input-${Math.random().toString(36).slice(2, 9)}`
|
|
90
|
+
|
|
91
|
+
const colorHex = computed(() => {
|
|
92
|
+
return hsvToHex(hue.value, saturation.value, value.value)
|
|
93
|
+
})
|
|
94
|
+
const historyColors = computed(() => {
|
|
95
|
+
return props.historyColors.map((item) => normalizeHexColor(item))
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
watch(
|
|
99
|
+
() => props.modelValue,
|
|
100
|
+
(nextColor) => {
|
|
101
|
+
syncFromHex(nextColor)
|
|
102
|
+
},
|
|
103
|
+
{ immediate: true },
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
watch(
|
|
107
|
+
[hue, saturation, value],
|
|
108
|
+
() => {
|
|
109
|
+
if (isSyncing.value) {
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
emitColor()
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
function startBoardDrag(event: PointerEvent) {
|
|
117
|
+
updateBoardValue(event)
|
|
118
|
+
const target = event.currentTarget as HTMLDivElement | null
|
|
119
|
+
if (!target) {
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
target.setPointerCapture(event.pointerId)
|
|
123
|
+
target.addEventListener('pointermove', updateBoardValue)
|
|
124
|
+
target.addEventListener('pointerup', stopBoardDrag, { once: true })
|
|
125
|
+
target.addEventListener('pointercancel', stopBoardDrag, { once: true })
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function stopBoardDrag(event: PointerEvent) {
|
|
129
|
+
const target = event.currentTarget as HTMLDivElement | null
|
|
130
|
+
if (!target) {
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
target.removeEventListener('pointermove', updateBoardValue)
|
|
134
|
+
if (target.hasPointerCapture(event.pointerId)) {
|
|
135
|
+
target.releasePointerCapture(event.pointerId)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function updateBoardValue(event: PointerEvent) {
|
|
140
|
+
if (!boardRef.value) {
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
const rect = boardRef.value.getBoundingClientRect()
|
|
144
|
+
const nextSaturation = ((event.clientX - rect.left) / rect.width) * 100
|
|
145
|
+
const nextValue = 100 - (((event.clientY - rect.top) / rect.height) * 100)
|
|
146
|
+
saturation.value = clamp(nextSaturation, 0, 100)
|
|
147
|
+
value.value = clamp(nextValue, 0, 100)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function applyPreset(color: string) {
|
|
151
|
+
syncFromHex(color, true)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function commitHexInput() {
|
|
155
|
+
syncFromHex(inputValue.value, true)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function syncFromHex(color: string, notify = false) {
|
|
159
|
+
const normalized = normalizeHexColor(color)
|
|
160
|
+
const hsv = hexToHsv(normalized)
|
|
161
|
+
isSyncing.value = true
|
|
162
|
+
hue.value = Math.round(hsv.h)
|
|
163
|
+
saturation.value = Math.round(hsv.s)
|
|
164
|
+
value.value = Math.round(hsv.v)
|
|
165
|
+
inputValue.value = normalized
|
|
166
|
+
isSyncing.value = false
|
|
167
|
+
if (notify) {
|
|
168
|
+
emitColor()
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function emitColor() {
|
|
173
|
+
const nextColor = colorHex.value
|
|
174
|
+
inputValue.value = nextColor
|
|
175
|
+
emit('update:modelValue', nextColor)
|
|
176
|
+
props.onChange?.(nextColor)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function normalizeHexColor(color: string | undefined) {
|
|
180
|
+
const value = (color ?? '').trim()
|
|
181
|
+
const match = value.match(/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/)
|
|
182
|
+
if (!match) {
|
|
183
|
+
return '#FFFFFF'
|
|
184
|
+
}
|
|
185
|
+
const hex = match[1]
|
|
186
|
+
if (hex.length === 3) {
|
|
187
|
+
return '#' + hex.split('').map((item) => item + item).join('').toUpperCase()
|
|
188
|
+
}
|
|
189
|
+
return '#' + hex.toUpperCase()
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function hexToHsv(color: string) {
|
|
193
|
+
const normalized = normalizeHexColor(color).slice(1)
|
|
194
|
+
const r = parseInt(normalized.slice(0, 2), 16) / 255
|
|
195
|
+
const g = parseInt(normalized.slice(2, 4), 16) / 255
|
|
196
|
+
const b = parseInt(normalized.slice(4, 6), 16) / 255
|
|
197
|
+
const max = Math.max(r, g, b)
|
|
198
|
+
const min = Math.min(r, g, b)
|
|
199
|
+
const diff = max - min
|
|
200
|
+
|
|
201
|
+
let h = 0
|
|
202
|
+
if (diff !== 0) {
|
|
203
|
+
switch (max) {
|
|
204
|
+
case r:
|
|
205
|
+
h = 60 * (((g - b) / diff) % 6)
|
|
206
|
+
break
|
|
207
|
+
case g:
|
|
208
|
+
h = 60 * (((b - r) / diff) + 2)
|
|
209
|
+
break
|
|
210
|
+
default:
|
|
211
|
+
h = 60 * (((r - g) / diff) + 4)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
h: h < 0 ? h + 360 : h,
|
|
217
|
+
s: max === 0 ? 0 : (diff / max) * 100,
|
|
218
|
+
v: max * 100,
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function hsvToHex(h: number, s: number, v: number) {
|
|
223
|
+
const hueValue = ((h % 360) + 360) % 360
|
|
224
|
+
const saturationValue = clamp(s, 0, 100) / 100
|
|
225
|
+
const brightnessValue = clamp(v, 0, 100) / 100
|
|
226
|
+
const chroma = brightnessValue * saturationValue
|
|
227
|
+
const x = chroma * (1 - Math.abs(((hueValue / 60) % 2) - 1))
|
|
228
|
+
const m = brightnessValue - chroma
|
|
229
|
+
|
|
230
|
+
let r = 0
|
|
231
|
+
let g = 0
|
|
232
|
+
let b = 0
|
|
233
|
+
|
|
234
|
+
if (hueValue < 60) {
|
|
235
|
+
r = chroma
|
|
236
|
+
g = x
|
|
237
|
+
} else if (hueValue < 120) {
|
|
238
|
+
r = x
|
|
239
|
+
g = chroma
|
|
240
|
+
} else if (hueValue < 180) {
|
|
241
|
+
g = chroma
|
|
242
|
+
b = x
|
|
243
|
+
} else if (hueValue < 240) {
|
|
244
|
+
g = x
|
|
245
|
+
b = chroma
|
|
246
|
+
} else if (hueValue < 300) {
|
|
247
|
+
r = x
|
|
248
|
+
b = chroma
|
|
249
|
+
} else {
|
|
250
|
+
r = chroma
|
|
251
|
+
b = x
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return '#' + [r, g, b].map((channel) => {
|
|
255
|
+
return Math.round((channel + m) * 255).toString(16).padStart(2, '0')
|
|
256
|
+
}).join('').toUpperCase()
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function clamp(value: number, min: number, max: number) {
|
|
260
|
+
return Math.min(Math.max(value, min), max)
|
|
261
|
+
}
|
|
262
|
+
</script>
|
|
263
|
+
|
|
264
|
+
<style scoped>
|
|
265
|
+
.theme-color-picker-pan {
|
|
266
|
+
width: min(420px, 70vw);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.tip {
|
|
270
|
+
align-items: center;
|
|
271
|
+
color: var(--color-font-2);
|
|
272
|
+
display: flex;
|
|
273
|
+
gap: 6px;
|
|
274
|
+
font-size: 12px;
|
|
275
|
+
margin-top: 12px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.theme-color-preview {
|
|
279
|
+
align-items: center;
|
|
280
|
+
display: flex;
|
|
281
|
+
gap: 12px;
|
|
282
|
+
margin-bottom: 14px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.theme-color-preview-chip {
|
|
286
|
+
border: 2px solid rgb(255 255 255 / 55%);
|
|
287
|
+
border-radius: 10px;
|
|
288
|
+
height: 30px;
|
|
289
|
+
flex-shrink: 0;
|
|
290
|
+
width: 64px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.theme-color-preview-input {
|
|
294
|
+
border-bottom: 1px solid var(--color-font-2);
|
|
295
|
+
background: var(--color-card-1);
|
|
296
|
+
box-sizing: border-box;
|
|
297
|
+
font-family: monospace;
|
|
298
|
+
letter-spacing: 0.08em;
|
|
299
|
+
text-transform: uppercase;
|
|
300
|
+
height: 30px;
|
|
301
|
+
width: 100%;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.theme-color-main {
|
|
305
|
+
align-items: stretch;
|
|
306
|
+
display: flex;
|
|
307
|
+
gap: 12px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.theme-color-main-left {
|
|
311
|
+
flex: 1;
|
|
312
|
+
min-width: 0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.theme-color-board {
|
|
316
|
+
background: var(--theme-picker-hue);
|
|
317
|
+
border-radius: 10px;
|
|
318
|
+
cursor: crosshair;
|
|
319
|
+
height: 200px;
|
|
320
|
+
overflow: hidden;
|
|
321
|
+
position: relative;
|
|
322
|
+
touch-action: none;
|
|
323
|
+
width: 100%;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.theme-color-board-white,
|
|
327
|
+
.theme-color-board-black,
|
|
328
|
+
.theme-color-board-thumb {
|
|
329
|
+
pointer-events: none;
|
|
330
|
+
position: absolute;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.theme-color-board-white,
|
|
334
|
+
.theme-color-board-black {
|
|
335
|
+
inset: 0;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.theme-color-board-white {
|
|
339
|
+
background: linear-gradient(90deg, #fff 0%, rgb(255 255 255 / 0%) 100%);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.theme-color-board-black {
|
|
343
|
+
background: linear-gradient(180deg, rgb(0 0 0 / 0%) 0%, #000 100%);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.theme-color-board-thumb {
|
|
347
|
+
border: 2px solid #fff;
|
|
348
|
+
border-radius: 999px;
|
|
349
|
+
box-shadow: 0 0 0 1px rgb(0 0 0 / 20%);
|
|
350
|
+
height: 18px;
|
|
351
|
+
transform: translate(-50%, -50%);
|
|
352
|
+
width: 18px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.theme-color-hue-range {
|
|
356
|
+
margin-top: 16px;
|
|
357
|
+
width: 100%;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.theme-color-hue-range > input.theme-color-hue {
|
|
361
|
+
background-color: transparent;
|
|
362
|
+
background-image: linear-gradient(90deg,
|
|
363
|
+
#ff0000 0%,
|
|
364
|
+
#ffff00 17%,
|
|
365
|
+
#00ff00 33%,
|
|
366
|
+
#00ffff 50%,
|
|
367
|
+
#0000ff 67%,
|
|
368
|
+
#ff00ff 83%,
|
|
369
|
+
#ff0000 100%);
|
|
370
|
+
background-size: 100% 100%;
|
|
371
|
+
min-width: 100%;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.theme-color-hue-range > div {
|
|
375
|
+
background: var(--color-main);
|
|
376
|
+
border-color: var(--color-card);
|
|
377
|
+
box-shadow: 0 0 5px rgb(0 0 0 / 18%);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.theme-color-history {
|
|
381
|
+
display: grid;
|
|
382
|
+
gap: 8px;
|
|
383
|
+
grid-auto-rows: 34px;
|
|
384
|
+
grid-template-columns: 1fr;
|
|
385
|
+
max-height: 256px;
|
|
386
|
+
overflow-y: auto;
|
|
387
|
+
padding-right: 2px;
|
|
388
|
+
width: 46px;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.theme-color-preset {
|
|
392
|
+
border: 2px solid rgb(255 255 255 / 55%);
|
|
393
|
+
border-radius: 10px;
|
|
394
|
+
cursor: pointer;
|
|
395
|
+
height: 34px;
|
|
396
|
+
padding: 0;
|
|
397
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
398
|
+
width: 100%;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
@media (max-width: 500px) {
|
|
402
|
+
.theme-color-picker-pan {
|
|
403
|
+
width: calc(100% - 20px);
|
|
404
|
+
padding: 10px !important;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.theme-color-main {
|
|
408
|
+
flex-direction: column;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.theme-color-board {
|
|
412
|
+
height: 150px;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.theme-color-history {
|
|
416
|
+
max-height: 236px;
|
|
417
|
+
width: 42px;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @FileDescription: 搜索列表用的会话本体
|
|
3
|
+
* @Author: Mr.Lee
|
|
4
|
+
* @Date:
|
|
5
|
+
* 2025/08/02
|
|
6
|
+
* @Version:
|
|
7
|
+
* 1.0 - 初始版本
|
|
8
|
+
* @Description:
|
|
9
|
+
* 该组件用于展示会话列表的元素。转发和收纳盒设置需要用。直接套用FriendBody开销太大,这个更轻量级
|
|
10
|
+
-->
|
|
11
|
+
<template>
|
|
12
|
+
<div :key=" 'tiny-' + String(session.group_id ?? session.user_id)"
|
|
13
|
+
class="tiny-session-body"
|
|
14
|
+
:class="{
|
|
15
|
+
'selected': selected,
|
|
16
|
+
}">
|
|
17
|
+
<div />
|
|
18
|
+
<img loading="lazy"
|
|
19
|
+
:title="getShowName(session.group_name || session.nickname, session.remark)"
|
|
20
|
+
:src="session.avatar || '/img/icons/icon.svg'">
|
|
21
|
+
<div>
|
|
22
|
+
<p>
|
|
23
|
+
{{ getShowName(session.group_name || session.nickname, session.remark) }}
|
|
24
|
+
</p>
|
|
25
|
+
<div v-if="from === 'global-search' && session.raw_msg">
|
|
26
|
+
<span>{{ session.raw_msg }}</span>
|
|
27
|
+
</div>
|
|
28
|
+
<div v-else>
|
|
29
|
+
<span v-if="session.group_id">{{ $t('群组') }}</span>
|
|
30
|
+
<span v-else-if="session.user_id">{{ $t('好友') }}</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { UserGroupElem, UserFriendElem } from '../function/elements/information'
|
|
38
|
+
import { getShowName } from '../function/utils/msgUtil'
|
|
39
|
+
|
|
40
|
+
type Session = UserGroupElem & UserFriendElem
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
session,
|
|
44
|
+
selected = false,
|
|
45
|
+
from,
|
|
46
|
+
} = defineProps<{
|
|
47
|
+
session: Session,
|
|
48
|
+
selected?: boolean,
|
|
49
|
+
from?: 'global-search'
|
|
50
|
+
}>()
|
|
51
|
+
</script>
|