@touchvue/chat 1.0.0-beta.54 → 1.0.0-beta.55
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/README.md +70 -70
- package/es/node_modules/.pnpm/{dompurify@3.3.0 → dompurify@3.4.3}/node_modules/dompurify/dist/purify.es.mjs +299 -143
- package/es/node_modules/.pnpm/dompurify@3.4.3/node_modules/dompurify/dist/purify.es.mjs.map +1 -0
- package/es/package.json.css +1 -1
- package/es/package.json.mjs +1 -1
- package/es/packages/components/resolver.mjs.map +1 -1
- package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/AiRobot/letter.vue.mjs +1 -1
- package/es/packages/components/touchchat/component/AiRobot/letter.vue2.mjs +9 -9
- package/es/packages/components/touchchat/component/AiRobot/letter.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/AudioFile.vue.mjs +7 -0
- package/es/packages/components/touchchat/component/AudioFile.vue.mjs.map +1 -0
- package/es/packages/components/touchchat/component/AudioFile.vue2.mjs +111 -0
- package/es/packages/components/touchchat/component/AudioFile.vue2.mjs.map +1 -0
- package/es/packages/components/touchchat/component/FileContent.vue2.mjs +3 -3
- package/es/packages/components/touchchat/component/FileContent.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/FileView.vue2.mjs +2 -2
- package/es/packages/components/touchchat/component/FileView.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/HelloChat.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/ImageFile.vue2.mjs +6 -6
- package/es/packages/components/touchchat/component/ImageFile.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/ImageView.vue2.mjs +1 -1
- package/es/packages/components/touchchat/component/ImageView.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/LinkView.vue2.mjs +4 -4
- package/es/packages/components/touchchat/component/LinkView.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/MarkLayer.vue2.mjs +1 -1
- package/es/packages/components/touchchat/component/MarkLayer.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/ModuleSelect.vue2.mjs +56 -5
- package/es/packages/components/touchchat/component/ModuleSelect.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/PDFFile.vue2.mjs +10 -10
- package/es/packages/components/touchchat/component/PDFFile.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/QuoteContent.vue2.mjs +52 -10
- package/es/packages/components/touchchat/component/QuoteContent.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/RealtimeVoice.vue2.mjs +1 -1
- package/es/packages/components/touchchat/component/RealtimeVoice.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/UploadView.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/VideoFile.vue.mjs +1 -1
- package/es/packages/components/touchchat/component/VideoFile.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/component/VoiceView.vue2.mjs +13 -4
- package/es/packages/components/touchchat/component/VoiceView.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/AgentsView.vue2.mjs +1 -1
- package/es/packages/components/touchchat/src/AiChat/AgentsView.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/AiMessage.vue2.mjs +30 -30
- package/es/packages/components/touchchat/src/AiChat/AiMessage.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/Chat/types.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/Chat/useChat.mjs +11 -8
- package/es/packages/components/touchchat/src/AiChat/Chat/useChat.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/Chat/useCopy.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/Chat/useMessageRender.mjs +1 -1
- package/es/packages/components/touchchat/src/AiChat/Chat/useMessageRender.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/ChatInput.vue2.mjs +16 -11
- package/es/packages/components/touchchat/src/AiChat/ChatInput.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/HistoryList.vue2.mjs +1 -1
- package/es/packages/components/touchchat/src/AiChat/HistoryList.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.mjs +3 -3
- package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/MessageActions.vue2.mjs +11 -11
- package/es/packages/components/touchchat/src/AiChat/MessageActions.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/MessageViewed.vue.mjs +33 -0
- package/es/packages/components/touchchat/src/AiChat/MessageViewed.vue.mjs.map +1 -0
- package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue2.mjs +3 -3
- package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue2.mjs +1 -1
- package/es/packages/components/touchchat/src/AiChat/TouchChat.vue2.mjs +36 -0
- package/es/packages/components/touchchat/src/AiChat/TouchChat.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/AiChat/UserMessage.vue2.mjs +127 -75
- package/es/packages/components/touchchat/src/AiChat/UserMessage.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/src/index.vue2.mjs.map +1 -1
- package/es/packages/components/touchchat/utils/a2aService.mjs.map +1 -1
- package/es/packages/components/touchchat/utils/fetchStream.mjs.map +1 -1
- package/es/packages/components/touchchat/utils/markdown.mjs +1 -1
- package/lib/node_modules/.pnpm/{dompurify@3.3.0 → dompurify@3.4.3}/node_modules/dompurify/dist/purify.es.js +299 -143
- package/lib/node_modules/.pnpm/dompurify@3.4.3/node_modules/dompurify/dist/purify.es.js.map +1 -0
- package/lib/package.json.css +1 -1
- package/lib/package.json.js +1 -1
- package/lib/packages/components/resolver.js.map +1 -1
- package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/AiRobot/letter.vue.js +1 -1
- package/lib/packages/components/touchchat/component/AiRobot/letter.vue2.js +9 -9
- package/lib/packages/components/touchchat/component/AiRobot/letter.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/AudioFile.vue.js +11 -0
- package/lib/packages/components/touchchat/component/AudioFile.vue.js.map +1 -0
- package/lib/packages/components/touchchat/component/AudioFile.vue2.js +115 -0
- package/lib/packages/components/touchchat/component/AudioFile.vue2.js.map +1 -0
- package/lib/packages/components/touchchat/component/FileContent.vue2.js +3 -3
- package/lib/packages/components/touchchat/component/FileContent.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/FileView.vue2.js +2 -2
- package/lib/packages/components/touchchat/component/FileView.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/HelloChat.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/ImageFile.vue2.js +6 -6
- package/lib/packages/components/touchchat/component/ImageFile.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/ImageView.vue2.js +1 -1
- package/lib/packages/components/touchchat/component/ImageView.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/LinkView.vue2.js +4 -4
- package/lib/packages/components/touchchat/component/LinkView.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/MarkLayer.vue2.js +1 -1
- package/lib/packages/components/touchchat/component/MarkLayer.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/ModuleSelect.vue2.js +55 -4
- package/lib/packages/components/touchchat/component/ModuleSelect.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/PDFFile.vue2.js +10 -10
- package/lib/packages/components/touchchat/component/PDFFile.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/QuoteContent.vue2.js +51 -9
- package/lib/packages/components/touchchat/component/QuoteContent.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/RealtimeVoice.vue2.js +1 -1
- package/lib/packages/components/touchchat/component/RealtimeVoice.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/UploadView.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/VideoFile.vue.js +1 -1
- package/lib/packages/components/touchchat/component/VideoFile.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/component/VoiceView.vue2.js +13 -4
- package/lib/packages/components/touchchat/component/VoiceView.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue2.js +1 -1
- package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue2.js +30 -30
- package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/Chat/types.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/Chat/useChat.js +11 -8
- package/lib/packages/components/touchchat/src/AiChat/Chat/useChat.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/Chat/useCopy.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/Chat/useMessageRender.js +1 -1
- package/lib/packages/components/touchchat/src/AiChat/Chat/useMessageRender.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue2.js +16 -11
- package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue2.js +1 -1
- package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.js +3 -3
- package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue2.js +11 -11
- package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/MessageViewed.vue.js +37 -0
- package/lib/packages/components/touchchat/src/AiChat/MessageViewed.vue.js.map +1 -0
- package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue2.js +3 -3
- package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue2.js +1 -1
- package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue2.js +36 -0
- package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue2.js +126 -74
- package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/src/index.vue2.js.map +1 -1
- package/lib/packages/components/touchchat/utils/a2aService.js.map +1 -1
- package/lib/packages/components/touchchat/utils/fetchStream.js.map +1 -1
- package/lib/packages/components/touchchat/utils/markdown.js +1 -1
- package/package.json +83 -83
- package/theme/components/index.css +152 -3
- package/theme/font/iconfont.woff +0 -0
- package/theme/font/iconfont.woff2 +0 -0
- package/theme/index.css +152 -3
- package/theme/skin/default.css +152 -3
- package/es/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs.map +0 -1
- package/lib/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchStream.js","sources":["../../../../../../packages/components/touchchat/utils/fetchStream.ts"],"sourcesContent":["// 定义 FetchStream 所需的选项接口\ninterface FetchStreamOptions {\n\turl: string\n\trequestInit?: RequestInit\n\tonmessage?: (line: string, index: number) => void\n\tondone?: (allDataText: string) => void\n\tonerror?: (response: Response | Error) => void\n\tonabort?: () => void\n\tontimeout?: () => void\n}\n\nconst decoder = new TextDecoder('utf-8')\nlet partial = '' // 未完成的字节\n\n// 改进的handleChunk函数,更安全地处理UTF-8字符\nconst handleChunk = (chunk: Uint8Array): string => {\n\t// 将新数据块拼接到剩余字节\n\tconst data = partial + decoder.decode(chunk, { stream: true })\n\n\t// 查找最后一个完整行结束位置\n\tconst lastNewline = data.lastIndexOf('\\n')\n\n\tif (lastNewline >= 0) {\n\t\tpartial = data.slice(lastNewline + 1) // 保留不完整部分\n\t\treturn data.slice(0, lastNewline + 1) // 返回完整行\n\t}\n\n\t// 如果没有找到换行符,保留全部数据\n\tpartial = data\n\treturn ''\n}\n\n// FetchStream 类,用于处理流式请求\nexport class FetchStream {\n\turl: string\n\trequestInit: RequestInit\n\tonmessage?: (line: string, index: number) => void\n\tondone?: (allDataText: string) => void\n\tonerror?: (response: Response | Error) => void\n\tonabort?: () => void\n\tontimeout?: () => void\n\tcontroller: AbortController | null\n\ttimer: ReturnType<typeof setTimeout> | null\n\n\tconstructor(options: FetchStreamOptions) {\n\t\tif (!options.url) {\n\t\t\tthrow new Error('url argument must be provided')\n\t\t}\n\t\tthis.url = options.url\n\t\tthis.requestInit = options.requestInit || {}\n\t\tthis.onmessage = options.onmessage\n\t\tthis.ondone = options.ondone\n\t\tthis.onerror = options.onerror\n\t\tthis.onabort = options.onabort\n\t\tthis.ontimeout = options.ontimeout\n\n\t\tthis.controller = new AbortController()\n\t\tthis.timer = null\n\n\t\tthis.createFetchRequest()\n\t}\n\n\t// 创建 fetch 请求\n\tasync createFetchRequest(): Promise<void> {\n\t\tthis.timeout()\n\n\t\ttry {\n\t\t\tconst response = await fetch(this.url, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\tsignal: this.controller?.signal,\n\t\t\t\t...this.requestInit\n\t\t\t})\n\n\t\t\tif (this.timer) {\n\t\t\t\tclearTimeout(this.timer)\n\t\t\t}\n\n\t\t\tif (response.status === 200) {\n\t\t\t\tif (!response.body) {\n\t\t\t\t\tthrow new Error('Response body is null')\n\t\t\t\t}\n\t\t\t\tconst reader = response.body.getReader()\n\t\t\t\tlet allDataText = ''\n\t\t\t\tlet buffer = ''\n\t\t\t\tlet index = 0\n\n\t\t\t\tlet shouldContinue = true\n\t\t\t\twhile (shouldContinue) {\n\t\t\t\t\tconst { value, done } = await reader.read()\n\t\t\t\t\tif (done) {\n\t\t\t\t\t\tshouldContinue = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tconst dataText = handleChunk(value)\n\n\t\t\t\t\t\tif (dataText) {\n\t\t\t\t\t\t\tallDataText += dataText\n\t\t\t\t\t\t\tbuffer += dataText\n\n\t\t\t\t\t\t\t// 处理完整行\n\t\t\t\t\t\t\tlet lineEndIndex\n\t\t\t\t\t\t\twhile ((lineEndIndex = buffer.indexOf('\\n')) >= 0) {\n\t\t\t\t\t\t\t\tconst line = buffer.slice(0, lineEndIndex)\n\t\t\t\t\t\t\t\tbuffer = buffer.slice(lineEndIndex + 1)\n\t\t\t\t\t\t\t\tthis.onmessage?.(line, index++)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// 处理剩余数据\n\t\t\t\tif (buffer.length > 0) {\n\t\t\t\t\tthis.onmessage?.(buffer, index++)\n\t\t\t\t}\n\n\t\t\t\tthis.ondone?.(allDataText)\n\t\t\t} else {\n\t\t\t\t// 读取响应体中的错误信息\n\t\t\t\tconst errorBody = await response.text()\n\t\t\t\tthrow new Error(errorBody || `请求失败: ${response.status} ${response.statusText}`)\n\t\t\t}\n\t\t} catch (response) {\n\t\t\t// 如果是用户主动中止的错误,不调用onerror\n\t\t\tconst isAbortError = response instanceof Error && response.name === 'AbortError'\n\n\t\t\t// 如果不是用户主动中止的错误,则调用 onerror\n\t\t\tif (!isAbortError) {\n\t\t\t\tthis.onerror?.(response instanceof Response ? response : new Error(String(response)))\n\t\t\t} else if (this.onabort) {\n\t\t\t\t// 如果是中止错误且定义了 onabort 回调,则调用它\n\t\t\t\tthis.onabort()\n\t\t\t}\n\t\t}\n\t}\n\n\t// 中断 fetch 请求\n\tabort(): void {\n\t\ttry {\n\t\t\tthis.controller?.abort()\n\t\t\tthis.onabort?.()\n\t\t} catch (error) {\n\t\t\tconsole.error('Abort error:', error)\n\t\t}\n\t}\n\n\t// 超时中断\n\ttimeout(time: number = 60000): void {\n\t\tthis.timer = setTimeout(() => {\n\t\t\tthis.abort()\n\t\t\tthis.ontimeout?.()\n\t\t}, time)\n\t}\n}\n"],"names":[],"mappings":";;AAWA,MAAM,OAAA,GAAU,IAAI,WAAA,CAAY,OAAO,CAAA,CAAA;AACvC,IAAI,OAAU,GAAA,EAAA,CAAA;AAGd,MAAM,WAAA,GAAc,CAAC,KAA8B,KAAA;AAElD,EAAM,MAAA,IAAA,GAAO,UAAU,OAAQ,CAAA,MAAA,CAAO,OAAO,EAAE,MAAA,EAAQ,MAAM,CAAA,CAAA;AAG7D,EAAM,MAAA,WAAA,GAAc,IAAK,CAAA,WAAA,CAAY,IAAI,CAAA,CAAA;AAEzC,EAAA,IAAI,eAAe,CAAG,EAAA;AACrB,IAAU,OAAA,GAAA,IAAA,CAAK,KAAM,CAAA,WAAA,GAAc,CAAC,CAAA,CAAA;AACpC,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,CAAG,EAAA,WAAA,GAAc,CAAC,CAAA,CAAA;AAAA,GACrC;AAGA,EAAU,OAAA,GAAA,IAAA,CAAA;AACV,EAAO,OAAA,EAAA,CAAA;AACR,CAAA,CAAA;AAGO,MAAM,WAAY,CAAA;AAAA,EAWxB,YAAY,OAA6B,EAAA;AACxC,IAAI,IAAA,CAAC,QAAQ,GAAK,EAAA;AACjB,MAAM,MAAA,IAAI,MAAM,+BAA+B,CAAA,CAAA;AAAA,KAChD;AACA,IAAA,IAAA,CAAK,MAAM,OAAQ,CAAA,GAAA,CAAA;AACnB,IAAK,IAAA,CAAA,WAAA,GAAc,OAAQ,CAAA,WAAA,IAAe,EAAC,CAAA;AAC3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A,IAAA,EAAA,CAAA;AAqJG,MAAA,IAAA,CAAK,KAAM,EAAA,CAAA;AACX,MAAA,CAAA,EAAA,GAAA,IAAA,CAAK,SAAL,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AAAA,OACE,IAAI,CAAA,CAAA;AAAA,GACR;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"fetchStream.js","sources":["../../../../../../packages/components/touchchat/utils/fetchStream.ts"],"sourcesContent":["// 定义 FetchStream 所需的选项接口\r\ninterface FetchStreamOptions {\r\n\turl: string\r\n\trequestInit?: RequestInit\r\n\tonmessage?: (line: string, index: number) => void\r\n\tondone?: (allDataText: string) => void\r\n\tonerror?: (response: Response | Error) => void\r\n\tonabort?: () => void\r\n\tontimeout?: () => void\r\n}\r\n\r\nconst decoder = new TextDecoder('utf-8')\r\nlet partial = '' // 未完成的字节\r\n\r\n// 改进的handleChunk函数,更安全地处理UTF-8字符\r\nconst handleChunk = (chunk: Uint8Array): string => {\r\n\t// 将新数据块拼接到剩余字节\r\n\tconst data = partial + decoder.decode(chunk, { stream: true })\r\n\r\n\t// 查找最后一个完整行结束位置\r\n\tconst lastNewline = data.lastIndexOf('\\n')\r\n\r\n\tif (lastNewline >= 0) {\r\n\t\tpartial = data.slice(lastNewline + 1) // 保留不完整部分\r\n\t\treturn data.slice(0, lastNewline + 1) // 返回完整行\r\n\t}\r\n\r\n\t// 如果没有找到换行符,保留全部数据\r\n\tpartial = data\r\n\treturn ''\r\n}\r\n\r\n// FetchStream 类,用于处理流式请求\r\nexport class FetchStream {\r\n\turl: string\r\n\trequestInit: RequestInit\r\n\tonmessage?: (line: string, index: number) => void\r\n\tondone?: (allDataText: string) => void\r\n\tonerror?: (response: Response | Error) => void\r\n\tonabort?: () => void\r\n\tontimeout?: () => void\r\n\tcontroller: AbortController | null\r\n\ttimer: ReturnType<typeof setTimeout> | null\r\n\r\n\tconstructor(options: FetchStreamOptions) {\r\n\t\tif (!options.url) {\r\n\t\t\tthrow new Error('url argument must be provided')\r\n\t\t}\r\n\t\tthis.url = options.url\r\n\t\tthis.requestInit = options.requestInit || {}\r\n\t\tthis.onmessage = options.onmessage\r\n\t\tthis.ondone = options.ondone\r\n\t\tthis.onerror = options.onerror\r\n\t\tthis.onabort = options.onabort\r\n\t\tthis.ontimeout = options.ontimeout\r\n\r\n\t\tthis.controller = new AbortController()\r\n\t\tthis.timer = null\r\n\r\n\t\tthis.createFetchRequest()\r\n\t}\r\n\r\n\t// 创建 fetch 请求\r\n\tasync createFetchRequest(): Promise<void> {\r\n\t\tthis.timeout()\r\n\r\n\t\ttry {\r\n\t\t\tconst response = await fetch(this.url, {\r\n\t\t\t\tmethod: 'POST',\r\n\t\t\t\tsignal: this.controller?.signal,\r\n\t\t\t\t...this.requestInit\r\n\t\t\t})\r\n\r\n\t\t\tif (this.timer) {\r\n\t\t\t\tclearTimeout(this.timer)\r\n\t\t\t}\r\n\r\n\t\t\tif (response.status === 200) {\r\n\t\t\t\tif (!response.body) {\r\n\t\t\t\t\tthrow new Error('Response body is null')\r\n\t\t\t\t}\r\n\t\t\t\tconst reader = response.body.getReader()\r\n\t\t\t\tlet allDataText = ''\r\n\t\t\t\tlet buffer = ''\r\n\t\t\t\tlet index = 0\r\n\r\n\t\t\t\tlet shouldContinue = true\r\n\t\t\t\twhile (shouldContinue) {\r\n\t\t\t\t\tconst { value, done } = await reader.read()\r\n\t\t\t\t\tif (done) {\r\n\t\t\t\t\t\tshouldContinue = false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (value) {\r\n\t\t\t\t\t\tconst dataText = handleChunk(value)\r\n\r\n\t\t\t\t\t\tif (dataText) {\r\n\t\t\t\t\t\t\tallDataText += dataText\r\n\t\t\t\t\t\t\tbuffer += dataText\r\n\r\n\t\t\t\t\t\t\t// 处理完整行\r\n\t\t\t\t\t\t\tlet lineEndIndex\r\n\t\t\t\t\t\t\twhile ((lineEndIndex = buffer.indexOf('\\n')) >= 0) {\r\n\t\t\t\t\t\t\t\tconst line = buffer.slice(0, lineEndIndex)\r\n\t\t\t\t\t\t\t\tbuffer = buffer.slice(lineEndIndex + 1)\r\n\t\t\t\t\t\t\t\tthis.onmessage?.(line, index++)\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// 处理剩余数据\r\n\t\t\t\tif (buffer.length > 0) {\r\n\t\t\t\t\tthis.onmessage?.(buffer, index++)\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.ondone?.(allDataText)\r\n\t\t\t} else {\r\n\t\t\t\t// 读取响应体中的错误信息\r\n\t\t\t\tconst errorBody = await response.text()\r\n\t\t\t\tthrow new Error(errorBody || `请求失败: ${response.status} ${response.statusText}`)\r\n\t\t\t}\r\n\t\t} catch (response) {\r\n\t\t\t// 如果是用户主动中止的错误,不调用onerror\r\n\t\t\tconst isAbortError = response instanceof Error && response.name === 'AbortError'\r\n\r\n\t\t\t// 如果不是用户主动中止的错误,则调用 onerror\r\n\t\t\tif (!isAbortError) {\r\n\t\t\t\tthis.onerror?.(response instanceof Response ? response : new Error(String(response)))\r\n\t\t\t} else if (this.onabort) {\r\n\t\t\t\t// 如果是中止错误且定义了 onabort 回调,则调用它\r\n\t\t\t\tthis.onabort()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// 中断 fetch 请求\r\n\tabort(): void {\r\n\t\ttry {\r\n\t\t\tthis.controller?.abort()\r\n\t\t\tthis.onabort?.()\r\n\t\t} catch (error) {\r\n\t\t\tconsole.error('Abort error:', error)\r\n\t\t}\r\n\t}\r\n\r\n\t// 超时中断\r\n\ttimeout(time: number = 60000): void {\r\n\t\tthis.timer = setTimeout(() => {\r\n\t\t\tthis.abort()\r\n\t\t\tthis.ontimeout?.()\r\n\t\t}, time)\r\n\t}\r\n}\r\n"],"names":[],"mappings":";;AAWA,MAA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('../../../../node_modules/.pnpm/markdown-it-mark@4.0.0/node_modules/markdown-it-mark/index.js');
|
|
11
11
|
var index$7 = require('../../../../node_modules/.pnpm/markdown-it-sub@2.0.0/node_modules/markdown-it-sub/index.js');
|
|
12
12
|
var index$8 = require('../../../../node_modules/.pnpm/markdown-it-sup@2.0.0/node_modules/markdown-it-sup/index.js');
|
|
13
|
-
var purify_es = require('../../../../node_modules/.pnpm/dompurify@3.3
|
|
13
|
+
var purify_es = require('../../../../node_modules/.pnpm/dompurify@3.4.3/node_modules/dompurify/dist/purify.es.js');
|
|
14
14
|
var hightIt = require('./hight-it.js');
|
|
15
15
|
var index = require('../../../../node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/index.js');
|
|
16
16
|
var full = require('../../../../node_modules/.pnpm/markdown-it-emoji@3.0.0/node_modules/markdown-it-emoji/lib/full.js');
|
package/package.json
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@touchvue/chat",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "TouchVue Chat Component Library",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"module": "es/index.mjs",
|
|
7
|
-
"types": "types/index.d.ts",
|
|
8
|
-
"style": "theme/index.css",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./es/index.d.ts",
|
|
12
|
-
"import": "./es/index.mjs",
|
|
13
|
-
"require": "./lib/index.js"
|
|
14
|
-
},
|
|
15
|
-
"./global": {
|
|
16
|
-
"types": "./global.d.ts"
|
|
17
|
-
},
|
|
18
|
-
"./es": {
|
|
19
|
-
"types": "./es/index.d.ts",
|
|
20
|
-
"import": "./es/index.mjs"
|
|
21
|
-
},
|
|
22
|
-
"./lib": {
|
|
23
|
-
"types": "./lib/index.d.ts",
|
|
24
|
-
"require": "./lib/index.js"
|
|
25
|
-
},
|
|
26
|
-
"./es/*.mjs": {
|
|
27
|
-
"types": "./es/*.d.ts",
|
|
28
|
-
"import": "./es/*.mjs"
|
|
29
|
-
},
|
|
30
|
-
"./es/*": {
|
|
31
|
-
"types": [
|
|
32
|
-
"./es/*.d.ts",
|
|
33
|
-
"./es/*/index.d.ts"
|
|
34
|
-
],
|
|
35
|
-
"import": "./es/*.mjs"
|
|
36
|
-
},
|
|
37
|
-
"./lib/*.js": {
|
|
38
|
-
"types": "./lib/*.d.ts",
|
|
39
|
-
"require": "./lib/*.js"
|
|
40
|
-
},
|
|
41
|
-
"./lib/*": {
|
|
42
|
-
"types": [
|
|
43
|
-
"./lib/*.d.ts",
|
|
44
|
-
"./lib/*/index.d.ts"
|
|
45
|
-
],
|
|
46
|
-
"require": "./lib/*.js"
|
|
47
|
-
},
|
|
48
|
-
"./resolver": {
|
|
49
|
-
"types": "./es/resolver/index.d.ts",
|
|
50
|
-
"import": "./es/resolver/index.mjs",
|
|
51
|
-
"require": "./lib/resolver/index.js"
|
|
52
|
-
},
|
|
53
|
-
"./*": "./*"
|
|
54
|
-
},
|
|
55
|
-
"files": [
|
|
56
|
-
"lib",
|
|
57
|
-
"es",
|
|
58
|
-
"theme",
|
|
59
|
-
"types",
|
|
60
|
-
"global.d.ts",
|
|
61
|
-
"README.md"
|
|
62
|
-
],
|
|
63
|
-
"sideEffects": [
|
|
64
|
-
"*.css",
|
|
65
|
-
"*.less",
|
|
66
|
-
"theme/**/*"
|
|
67
|
-
],
|
|
68
|
-
"keywords": [
|
|
69
|
-
"vue",
|
|
70
|
-
"vue3",
|
|
71
|
-
"component",
|
|
72
|
-
"ui",
|
|
73
|
-
"library"
|
|
74
|
-
],
|
|
75
|
-
"author": "",
|
|
76
|
-
"license": "ISC",
|
|
77
|
-
"peerDependencies": {
|
|
78
|
-
"vue": "^3.3.0"
|
|
79
|
-
},
|
|
80
|
-
"publishConfig": {
|
|
81
|
-
"access": "public"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@touchvue/chat",
|
|
3
|
+
"version": "1.0.0-beta.55",
|
|
4
|
+
"description": "TouchVue Chat Component Library",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"module": "es/index.mjs",
|
|
7
|
+
"types": "types/index.d.ts",
|
|
8
|
+
"style": "theme/index.css",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./es/index.d.ts",
|
|
12
|
+
"import": "./es/index.mjs",
|
|
13
|
+
"require": "./lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./global": {
|
|
16
|
+
"types": "./global.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./es": {
|
|
19
|
+
"types": "./es/index.d.ts",
|
|
20
|
+
"import": "./es/index.mjs"
|
|
21
|
+
},
|
|
22
|
+
"./lib": {
|
|
23
|
+
"types": "./lib/index.d.ts",
|
|
24
|
+
"require": "./lib/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./es/*.mjs": {
|
|
27
|
+
"types": "./es/*.d.ts",
|
|
28
|
+
"import": "./es/*.mjs"
|
|
29
|
+
},
|
|
30
|
+
"./es/*": {
|
|
31
|
+
"types": [
|
|
32
|
+
"./es/*.d.ts",
|
|
33
|
+
"./es/*/index.d.ts"
|
|
34
|
+
],
|
|
35
|
+
"import": "./es/*.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./lib/*.js": {
|
|
38
|
+
"types": "./lib/*.d.ts",
|
|
39
|
+
"require": "./lib/*.js"
|
|
40
|
+
},
|
|
41
|
+
"./lib/*": {
|
|
42
|
+
"types": [
|
|
43
|
+
"./lib/*.d.ts",
|
|
44
|
+
"./lib/*/index.d.ts"
|
|
45
|
+
],
|
|
46
|
+
"require": "./lib/*.js"
|
|
47
|
+
},
|
|
48
|
+
"./resolver": {
|
|
49
|
+
"types": "./es/resolver/index.d.ts",
|
|
50
|
+
"import": "./es/resolver/index.mjs",
|
|
51
|
+
"require": "./lib/resolver/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./*": "./*"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"lib",
|
|
57
|
+
"es",
|
|
58
|
+
"theme",
|
|
59
|
+
"types",
|
|
60
|
+
"global.d.ts",
|
|
61
|
+
"README.md"
|
|
62
|
+
],
|
|
63
|
+
"sideEffects": [
|
|
64
|
+
"*.css",
|
|
65
|
+
"*.less",
|
|
66
|
+
"theme/**/*"
|
|
67
|
+
],
|
|
68
|
+
"keywords": [
|
|
69
|
+
"vue",
|
|
70
|
+
"vue3",
|
|
71
|
+
"component",
|
|
72
|
+
"ui",
|
|
73
|
+
"library"
|
|
74
|
+
],
|
|
75
|
+
"author": "",
|
|
76
|
+
"license": "ISC",
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"vue": "^3.3.0"
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1007,6 +1007,7 @@ table.touchchat-table tr:hover {
|
|
|
1007
1007
|
--action-icon-content: var(--quote-close-fill-content);
|
|
1008
1008
|
}
|
|
1009
1009
|
.touchchat-action-item.value-right-arrow {
|
|
1010
|
+
cursor: pointer;
|
|
1010
1011
|
--action-icon-content: var(--ai-may-like-item-icon-content);
|
|
1011
1012
|
color: var(--ai-may-like-item-icon-color);
|
|
1012
1013
|
}
|
|
@@ -1658,6 +1659,7 @@ table.touchchat-table tr:hover {
|
|
|
1658
1659
|
--user-avatar-pic-width: 2.5em;
|
|
1659
1660
|
--user-avatar-pic-height: auto;
|
|
1660
1661
|
--user-avatar-pic-radius: 50%;
|
|
1662
|
+
--user-file-avatar-padding-top: 4em;
|
|
1661
1663
|
--user-bubble-bg: var(--color-primary);
|
|
1662
1664
|
--user-bubble-color: #fff;
|
|
1663
1665
|
--user-bubble-padding: 1em 1.5em;
|
|
@@ -1708,6 +1710,27 @@ table.touchchat-table tr:hover {
|
|
|
1708
1710
|
--user-send-active-bg: #005fc7;
|
|
1709
1711
|
--user-send-active-color: var(--user-send-color);
|
|
1710
1712
|
--user-send-active-border: var(--user-send-border);
|
|
1713
|
+
--audio-icon-width: 2em;
|
|
1714
|
+
--audio-icon-height: 2em;
|
|
1715
|
+
--audio-icon-bg: #fff;
|
|
1716
|
+
--audio-icon-radius: 50%;
|
|
1717
|
+
--audio-icon-shadow: 0 0.2em 0.4em rgba(0, 0, 0, 0.1);
|
|
1718
|
+
--audio-icon-color: #0077fa;
|
|
1719
|
+
--audio-icon-size: 1em;
|
|
1720
|
+
--audio-duration-margin: 0 0 0 1em;
|
|
1721
|
+
--audio-wave-gap: 0.2em;
|
|
1722
|
+
--audio-wave-margin: 0 0 0 0.5em;
|
|
1723
|
+
--audio-wave-width: 0.2em;
|
|
1724
|
+
--audio-wave-height: 0.2em;
|
|
1725
|
+
--audio-wave-bg: #fff;
|
|
1726
|
+
--audio-wave-radius: 0.2em;
|
|
1727
|
+
--audio-wave-start-height: 0.2em;
|
|
1728
|
+
--audio-wave-end-height: 1.25em;
|
|
1729
|
+
--audio-wave-during: 0.2s;
|
|
1730
|
+
--viewed-color: var(--color-primary);
|
|
1731
|
+
--viewed-radius: 50%;
|
|
1732
|
+
--viewed-margin: 0 0 1.7em auto;
|
|
1733
|
+
--viewed-width: 1.5em;
|
|
1711
1734
|
}
|
|
1712
1735
|
.touchchat-user {
|
|
1713
1736
|
display: flex;
|
|
@@ -1729,7 +1752,7 @@ table.touchchat-table tr:hover {
|
|
|
1729
1752
|
order: 2;
|
|
1730
1753
|
}
|
|
1731
1754
|
.file-user-avatar {
|
|
1732
|
-
padding-top:
|
|
1755
|
+
padding-top: var(--user-file-avatar-padding-top);
|
|
1733
1756
|
}
|
|
1734
1757
|
.touchchat-user-avatar-pic {
|
|
1735
1758
|
width: var(--user-avatar-pic-width);
|
|
@@ -1737,7 +1760,7 @@ table.touchchat-table tr:hover {
|
|
|
1737
1760
|
border-radius: var(--user-avatar-pic-radius);
|
|
1738
1761
|
order: 2;
|
|
1739
1762
|
}
|
|
1740
|
-
.
|
|
1763
|
+
.touchchat-user-wrapper {
|
|
1741
1764
|
display: flex;
|
|
1742
1765
|
align-items: flex-end;
|
|
1743
1766
|
}
|
|
@@ -1762,6 +1785,15 @@ table.touchchat-table tr:hover {
|
|
|
1762
1785
|
background: var(--user-bubble-arrow-bg);
|
|
1763
1786
|
background-size: var(--user-bubble-arrow-bg-size);
|
|
1764
1787
|
}
|
|
1788
|
+
.touchchat-user-bubble.is-link {
|
|
1789
|
+
cursor: pointer;
|
|
1790
|
+
}
|
|
1791
|
+
.touchchat-user-bubble.is-link:hover {
|
|
1792
|
+
filter: brightness(1.2);
|
|
1793
|
+
}
|
|
1794
|
+
.touchchat-user-bubble.is-link:active {
|
|
1795
|
+
filter: brightness(0.8);
|
|
1796
|
+
}
|
|
1765
1797
|
.touchchat-user-bubble-text {
|
|
1766
1798
|
font-size: var(--user-bubble-text-size);
|
|
1767
1799
|
font-weight: var(--user-bubble-text-weight);
|
|
@@ -1844,6 +1876,93 @@ table.touchchat-table tr:hover {
|
|
|
1844
1876
|
.touchchat-user-send-text {
|
|
1845
1877
|
font-size: var(--user-send-size);
|
|
1846
1878
|
}
|
|
1879
|
+
.touchchat-audio {
|
|
1880
|
+
display: flex;
|
|
1881
|
+
align-items: center;
|
|
1882
|
+
}
|
|
1883
|
+
.touchchat-audio-icon {
|
|
1884
|
+
flex-shrink: 0;
|
|
1885
|
+
width: var(--audio-icon-width);
|
|
1886
|
+
height: var(--audio-icon-height);
|
|
1887
|
+
display: flex;
|
|
1888
|
+
align-items: center;
|
|
1889
|
+
justify-content: center;
|
|
1890
|
+
background: var(--audio-icon-bg);
|
|
1891
|
+
border-radius: var(--audio-icon-radius);
|
|
1892
|
+
box-shadow: var(--audio-icon-shadow);
|
|
1893
|
+
}
|
|
1894
|
+
.touchchat-audio-icon-play {
|
|
1895
|
+
font-family: 'touchchat-icon';
|
|
1896
|
+
font-size: var(--audio-icon-size);
|
|
1897
|
+
color: var(--audio-icon-color);
|
|
1898
|
+
}
|
|
1899
|
+
.touchchat-audio-icon-play:before {
|
|
1900
|
+
content: '\e619';
|
|
1901
|
+
}
|
|
1902
|
+
.touchchat-audio-icon-pause {
|
|
1903
|
+
font-family: 'touchchat-icon';
|
|
1904
|
+
font-size: var(--audio-icon-size);
|
|
1905
|
+
color: var(--audio-icon-color);
|
|
1906
|
+
}
|
|
1907
|
+
.touchchat-audio-icon-pause:before {
|
|
1908
|
+
content: '\e618';
|
|
1909
|
+
}
|
|
1910
|
+
.touchchat-audio-duration {
|
|
1911
|
+
margin: var(--audio-duration-margin);
|
|
1912
|
+
}
|
|
1913
|
+
.touchchat-audio-wave {
|
|
1914
|
+
display: flex;
|
|
1915
|
+
align-items: center;
|
|
1916
|
+
gap: var(--audio-wave-gap);
|
|
1917
|
+
margin: var(--audio-wave-margin);
|
|
1918
|
+
}
|
|
1919
|
+
.touchchat-audio-wave-bar {
|
|
1920
|
+
width: var(--audio-wave-width);
|
|
1921
|
+
height: var(--audio-wave-start-height);
|
|
1922
|
+
background: var(--audio-wave-bg);
|
|
1923
|
+
border-radius: var(--audio-wave-radius);
|
|
1924
|
+
transition: height var(--audio-wave-during);
|
|
1925
|
+
}
|
|
1926
|
+
.touchchat-audio-wave.is-playing .touchchat-audio-wave-bar {
|
|
1927
|
+
animation: wave 0.8s ease-in-out infinite;
|
|
1928
|
+
}
|
|
1929
|
+
.touchchat-audio-wave.is-playing .touchchat-audio-wave-bar:nth-child(1) {
|
|
1930
|
+
animation-delay: 0s;
|
|
1931
|
+
}
|
|
1932
|
+
.touchchat-audio-wave.is-playing .touchchat-audio-wave-bar:nth-child(2) {
|
|
1933
|
+
animation-delay: 0.1s;
|
|
1934
|
+
}
|
|
1935
|
+
.touchchat-audio-wave.is-playing .touchchat-audio-wave-bar:nth-child(3) {
|
|
1936
|
+
animation-delay: 0.2s;
|
|
1937
|
+
}
|
|
1938
|
+
.touchchat-audio-wave.is-playing .touchchat-audio-wave-bar:nth-child(4) {
|
|
1939
|
+
animation-delay: 0.3s;
|
|
1940
|
+
}
|
|
1941
|
+
@keyframes wave {
|
|
1942
|
+
0%,
|
|
1943
|
+
100% {
|
|
1944
|
+
height: var(--audio-wave-start-height);
|
|
1945
|
+
}
|
|
1946
|
+
50% {
|
|
1947
|
+
height: var(--audio-wave-end-height);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
.touchchat-viewed {
|
|
1951
|
+
padding: 0.15em;
|
|
1952
|
+
width: var(--viewed-width);
|
|
1953
|
+
height: var(--viewed-width);
|
|
1954
|
+
border: 0.15em solid var(--viewed-color);
|
|
1955
|
+
border-radius: var(--viewed-radius);
|
|
1956
|
+
margin: var(--viewed-margin);
|
|
1957
|
+
box-sizing: border-box;
|
|
1958
|
+
align-self: flex-end;
|
|
1959
|
+
}
|
|
1960
|
+
.touchchat-viewed-wrapper {
|
|
1961
|
+
width: 100%;
|
|
1962
|
+
height: 100%;
|
|
1963
|
+
border-radius: var(--viewed-radius);
|
|
1964
|
+
background: conic-gradient(var(--viewed-color) 0%, var(--viewed-color) var(--value), transparent var(--value), transparent 100%);
|
|
1965
|
+
}
|
|
1847
1966
|
.step-container {
|
|
1848
1967
|
font-family: Arial, sans-serif;
|
|
1849
1968
|
}
|
|
@@ -2325,12 +2444,25 @@ table.touchchat-table tr:hover {
|
|
|
2325
2444
|
gap: 0.75em;
|
|
2326
2445
|
}
|
|
2327
2446
|
.quote-content-text {
|
|
2447
|
+
cursor: pointer;
|
|
2328
2448
|
border-radius: 0.5em;
|
|
2329
2449
|
background: #eaecf0b3;
|
|
2330
2450
|
font-size: 1em;
|
|
2331
2451
|
padding: 0.625em 0.5em 0.6875em 0.875em;
|
|
2332
2452
|
color: #434c59;
|
|
2333
2453
|
}
|
|
2454
|
+
.quote-highlight {
|
|
2455
|
+
animation: quote-flash 1s ease-in-out 2;
|
|
2456
|
+
}
|
|
2457
|
+
@keyframes quote-flash {
|
|
2458
|
+
0%,
|
|
2459
|
+
100% {
|
|
2460
|
+
background-color: transparent;
|
|
2461
|
+
}
|
|
2462
|
+
50% {
|
|
2463
|
+
background-color: rgba(59, 130, 246, 0.15);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2334
2466
|
.image-file {
|
|
2335
2467
|
--image-file-pd: 0.75em;
|
|
2336
2468
|
}
|
|
@@ -2648,6 +2780,21 @@ table.touchchat-table tr:hover {
|
|
|
2648
2780
|
min-width: 8.125em;
|
|
2649
2781
|
font-size: 0.875em;
|
|
2650
2782
|
outline: none;
|
|
2783
|
+
white-space: nowrap;
|
|
2784
|
+
}
|
|
2785
|
+
.touchchat-custom-select .touchchat-select-measure {
|
|
2786
|
+
position: absolute;
|
|
2787
|
+
left: -9999px;
|
|
2788
|
+
top: -9999px;
|
|
2789
|
+
visibility: hidden;
|
|
2790
|
+
overflow: hidden;
|
|
2791
|
+
}
|
|
2792
|
+
.touchchat-custom-select .touchchat-select-measure .touchchat-select-measure-item {
|
|
2793
|
+
display: inline-block;
|
|
2794
|
+
white-space: nowrap;
|
|
2795
|
+
padding: 0.625em 0.875em;
|
|
2796
|
+
font-size: 0.875em;
|
|
2797
|
+
font-weight: 500;
|
|
2651
2798
|
}
|
|
2652
2799
|
.touchchat-custom-select .touchchat-select-trigger {
|
|
2653
2800
|
display: flex;
|
|
@@ -2690,7 +2837,8 @@ table.touchchat-table tr:hover {
|
|
|
2690
2837
|
.touchchat-custom-select .touchchat-select-dropdown {
|
|
2691
2838
|
position: absolute;
|
|
2692
2839
|
left: 0;
|
|
2693
|
-
|
|
2840
|
+
min-width: 100%;
|
|
2841
|
+
width: max-content;
|
|
2694
2842
|
background: white;
|
|
2695
2843
|
border: 1px solid #e0e0e0;
|
|
2696
2844
|
border-radius: 0.5em;
|
|
@@ -2714,6 +2862,7 @@ table.touchchat-table tr:hover {
|
|
|
2714
2862
|
cursor: pointer;
|
|
2715
2863
|
transition: background-color 0.2s ease;
|
|
2716
2864
|
color: #444;
|
|
2865
|
+
white-space: nowrap;
|
|
2717
2866
|
}
|
|
2718
2867
|
.touchchat-custom-select .touchchat-select-option:hover {
|
|
2719
2868
|
background-color: #f5f7fa;
|
package/theme/font/iconfont.woff
CHANGED
|
Binary file
|
|
Binary file
|