whyuzeim 1.1.56 → 1.1.57

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.
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var img = "data:image/svg+xml,%3csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2.02273 10C2.02273 5.59427 5.59427 2.02273 10 2.02273C12.7648 2.02273 15.2025 3.42934 16.6342 5.56818H15.3182V7.34091H19.75V2.90909H17.9773V4.39303C16.2134 1.88804 13.2987 0.25 10 0.25C4.61522 0.25 0.25 4.61522 0.25 10H2.02273Z' fill='white' fill-opacity='0.4'/%3e%3cpath d='M9.99995 19.75C15.3847 19.75 19.75 15.3848 19.75 10H17.9772C17.9772 14.4057 14.4057 17.9773 9.99995 17.9773C7.23516 17.9773 4.79749 16.5707 3.36579 14.4318H4.68182V12.6591H0.25V17.0909H2.02273V15.607C3.7866 18.112 6.70132 19.75 9.99995 19.75Z' fill='white' fill-opacity='0.4'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.30758 5.23249L6.40385 13.4225C6.37904 13.5052 6.40799 13.5466 6.49072 13.5466H8.11631C8.19904 13.5466 8.25281 13.5052 8.27763 13.4225L8.74917 11.9458H11.7025L12.1865 13.4225C12.2113 13.5052 12.2651 13.5466 12.3478 13.5466H13.961C14.0437 13.5466 14.0727 13.5052 14.0479 13.4225L11.1938 5.23249C11.1689 5.14976 11.1152 5.1084 11.0324 5.1084H9.4689C9.38617 5.1084 9.3324 5.14976 9.30758 5.23249ZM11.2062 10.3947H9.25795L10.2134 7.44131H10.2507L11.2062 10.3947Z' fill='white' fill-opacity='0.4'/%3e%3c/svg%3e";
4
+
5
+ module.exports = img;
@@ -1,7 +1,8 @@
1
1
  import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
2
2
  import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
3
- import 'highlight.js/styles/monokai.css';
3
+ import 'highlight.js/styles/default.css';
4
4
  import React from "react";
5
+ import "./style/index.moduel.scss";
5
6
  interface ICodeMsg {
6
7
  msg: ChatSDK.MessageBody | NoticeMessageBody;
7
8
  isMySelf: boolean;
@@ -4,12 +4,13 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/esm/slicedToArray')
4
4
  var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
5
5
  var agoraChatUikit = require('agora-chat-uikit');
6
6
  var hljs = require('highlight.js');
7
- require('highlight.js/styles/monokai.css');
7
+ require('highlight.js/styles/default.css');
8
8
  var React = require('react');
9
9
  var copy = require('copy-to-clipboard');
10
+ require('./style/index.moduel.scss');
10
11
 
11
12
  var CodeMsg = function CodeMsg(props) {
12
- var _msg$customExts, _msg$customExts2;
13
+ var _msg$customExts, _msg$customExts2, _msg$customExts3;
13
14
  var msg = props.msg,
14
15
  isMySelf = props.isMySelf,
15
16
  avatar = props.avatar,
@@ -18,10 +19,11 @@ var CodeMsg = function CodeMsg(props) {
18
19
  _useState2 = _slicedToArray(_useState, 2),
19
20
  copyStatus = _useState2[0],
20
21
  setCopyStatus = _useState2[1];
21
- if (!((_msg$customExts = msg.customExts) !== null && _msg$customExts !== void 0 && _msg$customExts.code)) {
22
+ var codeType = ((_msg$customExts = msg.customExts) === null || _msg$customExts === void 0 ? void 0 : _msg$customExts.code_type) || "python";
23
+ if (!((_msg$customExts2 = msg.customExts) !== null && _msg$customExts2 !== void 0 && _msg$customExts2.code)) {
22
24
  return /*#__PURE__*/React.createElement(React.Fragment, null);
23
25
  }
24
- var rawCode = (_msg$customExts2 = msg.customExts) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.code) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\n/g, "\n")) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\"/g, '"')) === null || _msg$customExts2 === void 0 ? void 0 : _msg$customExts2.replace(/\\\\/g, "\\");
26
+ var rawCode = (_msg$customExts3 = msg.customExts) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.code) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\n/g, "\n")) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\"/g, '"')) === null || _msg$customExts3 === void 0 ? void 0 : _msg$customExts3.replace(/\\\\/g, "\\");
25
27
  // 复制代码到剪贴板
26
28
  var copyToClipboard = function copyToClipboard() {
27
29
  if (!rawCode) return;
@@ -65,13 +67,13 @@ var CodeMsg = function CodeMsg(props) {
65
67
  }, /*#__PURE__*/React.createElement("div", {
66
68
  className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
67
69
  }, /*#__PURE__*/React.createElement("div", {
70
+ className: "inline-block w-full rounded-lg overflow-hidden relative mb-2",
68
71
  style: {
69
72
  background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
70
73
  borderRadius: "9px",
71
74
  padding: "10px 12px",
72
75
  color: isMySelf ? "var(--im-msg-bubble-right-font-color)" : "var(--im-msg-bubble-font-color)"
73
- },
74
- className: "inline-block w-full"
76
+ }
75
77
  }, /*#__PURE__*/React.createElement("div", {
76
78
  className: "flex-1 flex justify-between items-center"
77
79
  }, /*#__PURE__*/React.createElement("div", {
@@ -88,8 +90,8 @@ var CodeMsg = function CodeMsg(props) {
88
90
  d: "M8 0.0214844H2.58333V2.5396H0.0214844V8.01198H2.58333V10.5301H8V8.01198H10.5618V2.5396H8V0.0214844Z",
89
91
  fill: "#0083FF"
90
92
  })), /*#__PURE__*/React.createElement("span", {
91
- className: "text-[#fff]"
92
- }, "main.py")), /*#__PURE__*/React.createElement("button", {
93
+ className: "filename-text"
94
+ }, codeType)), /*#__PURE__*/React.createElement("button", {
93
95
  onClick: function onClick() {
94
96
  onApply && onApply(msg.customExts.code);
95
97
  !onApply && copyToClipboard();
@@ -101,28 +103,20 @@ var CodeMsg = function CodeMsg(props) {
101
103
  className: "code-scroll-container w-full max-h-[300px] overflow-y-auto"
102
104
  }, /*#__PURE__*/React.createElement("pre", {
103
105
  className: "bg-transparent w-full h-full"
104
- }, /*#__PURE__*/React.createElement("code", {
105
- className: "language-python hljs",
106
+ }, /*#__PURE__*/React.createElement("div", {
107
+ className: "code-block-container",
106
108
  style: {
107
- display: "block",
108
- overflow: "auto",
109
- background: "transparent",
110
- fontSize: "14px",
111
- lineHeight: "1.5",
112
- fontFamily: "Monaco, Consolas, monospace",
113
- whiteSpace: "pre-wrap",
114
- wordWrap: "break-word",
115
- width: "100%",
116
- maxWidth: "100%",
117
- padding: "0.5rem"
118
- },
109
+ border: "none"
110
+ }
111
+ }, /*#__PURE__*/React.createElement("code", {
112
+ className: "language-".concat(codeType, " hljs"),
119
113
  dangerouslySetInnerHTML: {
120
114
  __html: hljs.highlight(rawCode, {
121
- language: "python",
115
+ language: codeType,
122
116
  ignoreIllegals: true
123
117
  }).value
124
118
  }
125
- })))))));
119
+ }))))))));
126
120
  };
127
121
 
128
122
  module.exports = CodeMsg;
@@ -0,0 +1,202 @@
1
+ /* 代码高亮样式,支持暗色和亮色主题 */
2
+
3
+ /* 通用样式 */
4
+ .code-block-container {
5
+ border-radius: 4px;
6
+ margin: 4px 0;
7
+ padding: 8px 4px;
8
+ background: transparent !important;
9
+ border: none !important;
10
+ }
11
+
12
+ /* 通用代码样式 */
13
+ code.hljs {
14
+ display: block;
15
+ overflow: auto;
16
+ background: transparent !important;
17
+ font-size: 13px;
18
+ line-height: 1.4;
19
+ font-family: Monaco, Consolas, 'Courier New', monospace;
20
+ white-space: pre-wrap;
21
+ word-wrap: break-word;
22
+ width: 100%;
23
+ max-width: 100%;
24
+ padding: 0;
25
+ }
26
+
27
+ /* 深色主题下的代码高亮 - 适用于深蓝/黑色背景 */
28
+ .im-dark, .im-custom {
29
+ /* 基础文本颜色 */
30
+ .hljs {
31
+ color: #f8f8f2 !important;
32
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
33
+ }
34
+
35
+ /* 关键字 */
36
+ .hljs-keyword,
37
+ .hljs-selector-tag,
38
+ .hljs-tag,
39
+ .hljs-name {
40
+ color: #ff79c6 !important;
41
+ font-weight: bold;
42
+ }
43
+
44
+ /* 字符串 */
45
+ .hljs-string,
46
+ .hljs-title,
47
+ .hljs-section,
48
+ .hljs-attribute,
49
+ .hljs-literal,
50
+ .hljs-template-tag,
51
+ .hljs-template-variable,
52
+ .hljs-type,
53
+ .hljs-addition {
54
+ color: #f1fa8c !important;
55
+ }
56
+
57
+ /* 数字、布尔值 */
58
+ .hljs-number,
59
+ .hljs-selector-attr,
60
+ .hljs-selector-pseudo,
61
+ .hljs-meta-string,
62
+ .hljs-built_in {
63
+ color: #bd93f9 !important;
64
+ }
65
+
66
+ /* 属性、变量 */
67
+ .hljs-attr,
68
+ .hljs-variable,
69
+ .hljs-property,
70
+ .hljs-params,
71
+ .hljs-class .hljs-title {
72
+ color: #8be9fd !important;
73
+ }
74
+
75
+ /* 注释 */
76
+ .hljs-comment,
77
+ .hljs-quote,
78
+ .hljs-doctag {
79
+ color: #6272a4 !important;
80
+ font-style: italic;
81
+ }
82
+
83
+ /* 函数 */
84
+ .hljs-function .hljs-title {
85
+ color: #50fa7b !important;
86
+ font-weight: bold;
87
+ }
88
+
89
+ /* 操作符 */
90
+ .hljs-operator,
91
+ .hljs-entity,
92
+ .hljs-url,
93
+ .language-css .hljs-string,
94
+ .style .hljs-string {
95
+ color: #ff79c6 !important;
96
+ }
97
+ }
98
+
99
+ /* 浅色主题下的代码高亮 - 适用于浅色/蓝色背景 */
100
+ .im-light {
101
+ /* 基础文本颜色 */
102
+ .hljs {
103
+ color: #24292e !important;
104
+ }
105
+
106
+ /* 关键字 */
107
+ .hljs-keyword,
108
+ .hljs-selector-tag,
109
+ .hljs-tag,
110
+ .hljs-name {
111
+ color: #d73a49 !important;
112
+ font-weight: bold;
113
+ }
114
+
115
+ /* 字符串 */
116
+ .hljs-string,
117
+ .hljs-title,
118
+ .hljs-section,
119
+ .hljs-attribute,
120
+ .hljs-literal,
121
+ .hljs-template-tag,
122
+ .hljs-template-variable,
123
+ .hljs-type,
124
+ .hljs-addition {
125
+ color: #032f62 !important;
126
+ }
127
+
128
+ /* 数字、布尔值 */
129
+ .hljs-number,
130
+ .hljs-selector-attr,
131
+ .hljs-selector-pseudo,
132
+ .hljs-meta-string,
133
+ .hljs-built_in {
134
+ color: #005cc5 !important;
135
+ }
136
+
137
+ /* 属性、变量 */
138
+ .hljs-attr,
139
+ .hljs-variable,
140
+ .hljs-property,
141
+ .hljs-params,
142
+ .hljs-class .hljs-title {
143
+ color: #6f42c1 !important;
144
+ }
145
+
146
+ /* 注释 */
147
+ .hljs-comment,
148
+ .hljs-quote,
149
+ .hljs-doctag {
150
+ color: #6a737d !important;
151
+ font-style: italic;
152
+ }
153
+
154
+ /* 函数 */
155
+ .hljs-function .hljs-title {
156
+ color: #6f42c1 !important;
157
+ font-weight: bold;
158
+ }
159
+
160
+ /* 操作符 */
161
+ .hljs-operator,
162
+ .hljs-entity,
163
+ .hljs-url,
164
+ .language-css .hljs-string,
165
+ .style .hljs-string {
166
+ color: #d73a49 !important;
167
+ }
168
+ }
169
+
170
+ /* 强调 */
171
+ .hljs-emphasis {
172
+ font-style: italic;
173
+ }
174
+
175
+ .hljs-strong {
176
+ font-weight: bold;
177
+ }
178
+
179
+ /* 确保pre元素和其他容器也没有边框 */
180
+ pre, .code-scroll-container {
181
+ border: none !important;
182
+ outline: none !important;
183
+ background: transparent !important;
184
+ }
185
+
186
+ /* 文件名样式,根据主题自动调整颜色 */
187
+ .filename-text {
188
+ font-size: 10px;
189
+ font-weight: 500;
190
+
191
+ /* 深色模式 - 白色文本 */
192
+ .im-dark &, .im-custom & {
193
+ color: white;
194
+ text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
195
+ }
196
+
197
+ /* 浅色模式 - 黑色文本 */
198
+ .im-light & {
199
+ color: #000000;
200
+ text-shadow: 0px 0px 1px rgba(255, 255, 255, 0.5);
201
+ }
202
+ }
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z' fill='black'/%3e%3c/svg%3e";
4
+
5
+ module.exports = img;
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg id='ic_search'%3e%3cpath id='Vector' d='M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z' fill='black'/%3e%3c/g%3e%3c/svg%3e";
4
+
5
+ module.exports = img;
@@ -0,0 +1,4 @@
1
+ import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
2
+ export declare class IMUtility {
3
+ static isFromSelfWithMessage(msg: ChatSDK.MessageBody | NoticeMessageBody, userUid?: string): boolean;
4
+ }
package/cjs/utility.js ADDED
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/esm/asyncToGenerator');
4
+ var _classCallCheck = require('@babel/runtime-corejs3/helpers/esm/classCallCheck');
5
+ var _createClass = require('@babel/runtime-corejs3/helpers/esm/createClass');
6
+ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
7
+ var agoraChatUikit = require('agora-chat-uikit');
8
+ var SDK = require('agora-chat-uikit/types/module/SDK');
9
+
10
+ var IMUtility = /*#__PURE__*/function () {
11
+ function IMUtility() {
12
+ _classCallCheck(this, IMUtility);
13
+ }
14
+ return _createClass(IMUtility, null, [{
15
+ key: "isFromSelfWithMessage",
16
+ value: function isFromSelfWithMessage(msg, userUid) {
17
+ return (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === (userUid === null || userUid === void 0 ? void 0 : userUid.toLowerCase());
18
+ }
19
+ /*发送文本消息
20
+ * @param chatChat - 私聊 or 群聊
21
+ * @param msg - 消息内容
22
+ * @param to - 发送目标对象(私聊用户ID或群ID)
23
+ * @param ext - 扩展数据*/
24
+ }, {
25
+ key: "sendTxtMessage",
26
+ value: (function () {
27
+ var _sendTxtMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(chatType, msg, to, ext) {
28
+ var customMessage;
29
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
30
+ while (1) switch (_context.prev = _context.next) {
31
+ case 0:
32
+ customMessage = SDK.ChatSDK.message.create({
33
+ type: 'txt',
34
+ msg: msg,
35
+ to: to,
36
+ // Need to be the user ID of the current conversation
37
+ chatType: chatType,
38
+ ext: ext
39
+ });
40
+ _context.next = 3;
41
+ return agoraChatUikit.rootStore.messageStore.sendMessage(customMessage);
42
+ case 3:
43
+ case "end":
44
+ return _context.stop();
45
+ }
46
+ }, _callee);
47
+ }));
48
+ function sendTxtMessage(_x, _x2, _x3, _x4) {
49
+ return _sendTxtMessage.apply(this, arguments);
50
+ }
51
+ return sendTxtMessage;
52
+ }())
53
+ }]);
54
+ }();
55
+
56
+ exports.IMUtility = IMUtility;
@@ -0,0 +1,3 @@
1
+ var img = "data:image/svg+xml,%3csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2.02273 10C2.02273 5.59427 5.59427 2.02273 10 2.02273C12.7648 2.02273 15.2025 3.42934 16.6342 5.56818H15.3182V7.34091H19.75V2.90909H17.9773V4.39303C16.2134 1.88804 13.2987 0.25 10 0.25C4.61522 0.25 0.25 4.61522 0.25 10H2.02273Z' fill='white' fill-opacity='0.4'/%3e%3cpath d='M9.99995 19.75C15.3847 19.75 19.75 15.3848 19.75 10H17.9772C17.9772 14.4057 14.4057 17.9773 9.99995 17.9773C7.23516 17.9773 4.79749 16.5707 3.36579 14.4318H4.68182V12.6591H0.25V17.0909H2.02273V15.607C3.7866 18.112 6.70132 19.75 9.99995 19.75Z' fill='white' fill-opacity='0.4'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.30758 5.23249L6.40385 13.4225C6.37904 13.5052 6.40799 13.5466 6.49072 13.5466H8.11631C8.19904 13.5466 8.25281 13.5052 8.27763 13.4225L8.74917 11.9458H11.7025L12.1865 13.4225C12.2113 13.5052 12.2651 13.5466 12.3478 13.5466H13.961C14.0437 13.5466 14.0727 13.5052 14.0479 13.4225L11.1938 5.23249C11.1689 5.14976 11.1152 5.1084 11.0324 5.1084H9.4689C9.38617 5.1084 9.3324 5.14976 9.30758 5.23249ZM11.2062 10.3947H9.25795L10.2134 7.44131H10.2507L11.2062 10.3947Z' fill='white' fill-opacity='0.4'/%3e%3c/svg%3e";
2
+
3
+ export { img as default };
@@ -1,7 +1,8 @@
1
1
  import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
2
2
  import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
3
- import 'highlight.js/styles/monokai.css';
3
+ import 'highlight.js/styles/default.css';
4
4
  import React from "react";
5
+ import "./style/index.moduel.scss";
5
6
  interface ICodeMsg {
6
7
  msg: ChatSDK.MessageBody | NoticeMessageBody;
7
8
  isMySelf: boolean;
@@ -2,12 +2,13 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
2
2
  import _setTimeout from '@babel/runtime-corejs3/core-js-stable/set-timeout';
3
3
  import { BaseMessage } from 'agora-chat-uikit';
4
4
  import hljs from 'highlight.js';
5
- import 'highlight.js/styles/monokai.css';
5
+ import 'highlight.js/styles/default.css';
6
6
  import React, { useState } from 'react';
7
7
  import copy from 'copy-to-clipboard';
8
+ import './style/index.moduel.scss';
8
9
 
9
10
  var CodeMsg = function CodeMsg(props) {
10
- var _msg$customExts, _msg$customExts2;
11
+ var _msg$customExts, _msg$customExts2, _msg$customExts3;
11
12
  var msg = props.msg,
12
13
  isMySelf = props.isMySelf,
13
14
  avatar = props.avatar,
@@ -16,10 +17,11 @@ var CodeMsg = function CodeMsg(props) {
16
17
  _useState2 = _slicedToArray(_useState, 2),
17
18
  copyStatus = _useState2[0],
18
19
  setCopyStatus = _useState2[1];
19
- if (!((_msg$customExts = msg.customExts) !== null && _msg$customExts !== void 0 && _msg$customExts.code)) {
20
+ var codeType = ((_msg$customExts = msg.customExts) === null || _msg$customExts === void 0 ? void 0 : _msg$customExts.code_type) || "python";
21
+ if (!((_msg$customExts2 = msg.customExts) !== null && _msg$customExts2 !== void 0 && _msg$customExts2.code)) {
20
22
  return /*#__PURE__*/React.createElement(React.Fragment, null);
21
23
  }
22
- var rawCode = (_msg$customExts2 = msg.customExts) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.code) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\n/g, "\n")) === null || _msg$customExts2 === void 0 || (_msg$customExts2 = _msg$customExts2.replace(/\\"/g, '"')) === null || _msg$customExts2 === void 0 ? void 0 : _msg$customExts2.replace(/\\\\/g, "\\");
24
+ var rawCode = (_msg$customExts3 = msg.customExts) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.code) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\n/g, "\n")) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\"/g, '"')) === null || _msg$customExts3 === void 0 ? void 0 : _msg$customExts3.replace(/\\\\/g, "\\");
23
25
  // 复制代码到剪贴板
24
26
  var copyToClipboard = function copyToClipboard() {
25
27
  if (!rawCode) return;
@@ -63,13 +65,13 @@ var CodeMsg = function CodeMsg(props) {
63
65
  }, /*#__PURE__*/React.createElement("div", {
64
66
  className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
65
67
  }, /*#__PURE__*/React.createElement("div", {
68
+ className: "inline-block w-full rounded-lg overflow-hidden relative mb-2",
66
69
  style: {
67
70
  background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
68
71
  borderRadius: "9px",
69
72
  padding: "10px 12px",
70
73
  color: isMySelf ? "var(--im-msg-bubble-right-font-color)" : "var(--im-msg-bubble-font-color)"
71
- },
72
- className: "inline-block w-full"
74
+ }
73
75
  }, /*#__PURE__*/React.createElement("div", {
74
76
  className: "flex-1 flex justify-between items-center"
75
77
  }, /*#__PURE__*/React.createElement("div", {
@@ -86,8 +88,8 @@ var CodeMsg = function CodeMsg(props) {
86
88
  d: "M8 0.0214844H2.58333V2.5396H0.0214844V8.01198H2.58333V10.5301H8V8.01198H10.5618V2.5396H8V0.0214844Z",
87
89
  fill: "#0083FF"
88
90
  })), /*#__PURE__*/React.createElement("span", {
89
- className: "text-[#fff]"
90
- }, "main.py")), /*#__PURE__*/React.createElement("button", {
91
+ className: "filename-text"
92
+ }, codeType)), /*#__PURE__*/React.createElement("button", {
91
93
  onClick: function onClick() {
92
94
  onApply && onApply(msg.customExts.code);
93
95
  !onApply && copyToClipboard();
@@ -99,28 +101,20 @@ var CodeMsg = function CodeMsg(props) {
99
101
  className: "code-scroll-container w-full max-h-[300px] overflow-y-auto"
100
102
  }, /*#__PURE__*/React.createElement("pre", {
101
103
  className: "bg-transparent w-full h-full"
102
- }, /*#__PURE__*/React.createElement("code", {
103
- className: "language-python hljs",
104
+ }, /*#__PURE__*/React.createElement("div", {
105
+ className: "code-block-container",
104
106
  style: {
105
- display: "block",
106
- overflow: "auto",
107
- background: "transparent",
108
- fontSize: "14px",
109
- lineHeight: "1.5",
110
- fontFamily: "Monaco, Consolas, monospace",
111
- whiteSpace: "pre-wrap",
112
- wordWrap: "break-word",
113
- width: "100%",
114
- maxWidth: "100%",
115
- padding: "0.5rem"
116
- },
107
+ border: "none"
108
+ }
109
+ }, /*#__PURE__*/React.createElement("code", {
110
+ className: "language-".concat(codeType, " hljs"),
117
111
  dangerouslySetInnerHTML: {
118
112
  __html: hljs.highlight(rawCode, {
119
- language: "python",
113
+ language: codeType,
120
114
  ignoreIllegals: true
121
115
  }).value
122
116
  }
123
- })))))));
117
+ }))))))));
124
118
  };
125
119
 
126
120
  export { CodeMsg as default };
@@ -0,0 +1,202 @@
1
+ /* 代码高亮样式,支持暗色和亮色主题 */
2
+
3
+ /* 通用样式 */
4
+ .code-block-container {
5
+ border-radius: 4px;
6
+ margin: 4px 0;
7
+ padding: 8px 4px;
8
+ background: transparent !important;
9
+ border: none !important;
10
+ }
11
+
12
+ /* 通用代码样式 */
13
+ code.hljs {
14
+ display: block;
15
+ overflow: auto;
16
+ background: transparent !important;
17
+ font-size: 13px;
18
+ line-height: 1.4;
19
+ font-family: Monaco, Consolas, 'Courier New', monospace;
20
+ white-space: pre-wrap;
21
+ word-wrap: break-word;
22
+ width: 100%;
23
+ max-width: 100%;
24
+ padding: 0;
25
+ }
26
+
27
+ /* 深色主题下的代码高亮 - 适用于深蓝/黑色背景 */
28
+ .im-dark, .im-custom {
29
+ /* 基础文本颜色 */
30
+ .hljs {
31
+ color: #f8f8f2 !important;
32
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
33
+ }
34
+
35
+ /* 关键字 */
36
+ .hljs-keyword,
37
+ .hljs-selector-tag,
38
+ .hljs-tag,
39
+ .hljs-name {
40
+ color: #ff79c6 !important;
41
+ font-weight: bold;
42
+ }
43
+
44
+ /* 字符串 */
45
+ .hljs-string,
46
+ .hljs-title,
47
+ .hljs-section,
48
+ .hljs-attribute,
49
+ .hljs-literal,
50
+ .hljs-template-tag,
51
+ .hljs-template-variable,
52
+ .hljs-type,
53
+ .hljs-addition {
54
+ color: #f1fa8c !important;
55
+ }
56
+
57
+ /* 数字、布尔值 */
58
+ .hljs-number,
59
+ .hljs-selector-attr,
60
+ .hljs-selector-pseudo,
61
+ .hljs-meta-string,
62
+ .hljs-built_in {
63
+ color: #bd93f9 !important;
64
+ }
65
+
66
+ /* 属性、变量 */
67
+ .hljs-attr,
68
+ .hljs-variable,
69
+ .hljs-property,
70
+ .hljs-params,
71
+ .hljs-class .hljs-title {
72
+ color: #8be9fd !important;
73
+ }
74
+
75
+ /* 注释 */
76
+ .hljs-comment,
77
+ .hljs-quote,
78
+ .hljs-doctag {
79
+ color: #6272a4 !important;
80
+ font-style: italic;
81
+ }
82
+
83
+ /* 函数 */
84
+ .hljs-function .hljs-title {
85
+ color: #50fa7b !important;
86
+ font-weight: bold;
87
+ }
88
+
89
+ /* 操作符 */
90
+ .hljs-operator,
91
+ .hljs-entity,
92
+ .hljs-url,
93
+ .language-css .hljs-string,
94
+ .style .hljs-string {
95
+ color: #ff79c6 !important;
96
+ }
97
+ }
98
+
99
+ /* 浅色主题下的代码高亮 - 适用于浅色/蓝色背景 */
100
+ .im-light {
101
+ /* 基础文本颜色 */
102
+ .hljs {
103
+ color: #24292e !important;
104
+ }
105
+
106
+ /* 关键字 */
107
+ .hljs-keyword,
108
+ .hljs-selector-tag,
109
+ .hljs-tag,
110
+ .hljs-name {
111
+ color: #d73a49 !important;
112
+ font-weight: bold;
113
+ }
114
+
115
+ /* 字符串 */
116
+ .hljs-string,
117
+ .hljs-title,
118
+ .hljs-section,
119
+ .hljs-attribute,
120
+ .hljs-literal,
121
+ .hljs-template-tag,
122
+ .hljs-template-variable,
123
+ .hljs-type,
124
+ .hljs-addition {
125
+ color: #032f62 !important;
126
+ }
127
+
128
+ /* 数字、布尔值 */
129
+ .hljs-number,
130
+ .hljs-selector-attr,
131
+ .hljs-selector-pseudo,
132
+ .hljs-meta-string,
133
+ .hljs-built_in {
134
+ color: #005cc5 !important;
135
+ }
136
+
137
+ /* 属性、变量 */
138
+ .hljs-attr,
139
+ .hljs-variable,
140
+ .hljs-property,
141
+ .hljs-params,
142
+ .hljs-class .hljs-title {
143
+ color: #6f42c1 !important;
144
+ }
145
+
146
+ /* 注释 */
147
+ .hljs-comment,
148
+ .hljs-quote,
149
+ .hljs-doctag {
150
+ color: #6a737d !important;
151
+ font-style: italic;
152
+ }
153
+
154
+ /* 函数 */
155
+ .hljs-function .hljs-title {
156
+ color: #6f42c1 !important;
157
+ font-weight: bold;
158
+ }
159
+
160
+ /* 操作符 */
161
+ .hljs-operator,
162
+ .hljs-entity,
163
+ .hljs-url,
164
+ .language-css .hljs-string,
165
+ .style .hljs-string {
166
+ color: #d73a49 !important;
167
+ }
168
+ }
169
+
170
+ /* 强调 */
171
+ .hljs-emphasis {
172
+ font-style: italic;
173
+ }
174
+
175
+ .hljs-strong {
176
+ font-weight: bold;
177
+ }
178
+
179
+ /* 确保pre元素和其他容器也没有边框 */
180
+ pre, .code-scroll-container {
181
+ border: none !important;
182
+ outline: none !important;
183
+ background: transparent !important;
184
+ }
185
+
186
+ /* 文件名样式,根据主题自动调整颜色 */
187
+ .filename-text {
188
+ font-size: 10px;
189
+ font-weight: 500;
190
+
191
+ /* 深色模式 - 白色文本 */
192
+ .im-dark &, .im-custom & {
193
+ color: white;
194
+ text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
195
+ }
196
+
197
+ /* 浅色模式 - 黑色文本 */
198
+ .im-light & {
199
+ color: #000000;
200
+ text-shadow: 0px 0px 1px rgba(255, 255, 255, 0.5);
201
+ }
202
+ }
@@ -0,0 +1,3 @@
1
+ var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z' fill='black'/%3e%3c/svg%3e";
2
+
3
+ export { img as default };
@@ -0,0 +1,3 @@
1
+ var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg id='ic_search'%3e%3cpath id='Vector' d='M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z' fill='black'/%3e%3c/g%3e%3c/svg%3e";
2
+
3
+ export { img as default };
@@ -0,0 +1,4 @@
1
+ import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
2
+ export declare class IMUtility {
3
+ static isFromSelfWithMessage(msg: ChatSDK.MessageBody | NoticeMessageBody, userUid?: string): boolean;
4
+ }
package/es/utility.js ADDED
@@ -0,0 +1,54 @@
1
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
2
+ import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
3
+ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
4
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
5
+ import { rootStore } from 'agora-chat-uikit';
6
+ import { ChatSDK } from 'agora-chat-uikit/types/module/SDK';
7
+
8
+ var IMUtility = /*#__PURE__*/function () {
9
+ function IMUtility() {
10
+ _classCallCheck(this, IMUtility);
11
+ }
12
+ return _createClass(IMUtility, null, [{
13
+ key: "isFromSelfWithMessage",
14
+ value: function isFromSelfWithMessage(msg, userUid) {
15
+ return (msg === null || msg === void 0 ? void 0 : msg.bySelf) === true || (msg === null || msg === void 0 ? void 0 : msg.from.toLowerCase()) === (userUid === null || userUid === void 0 ? void 0 : userUid.toLowerCase());
16
+ }
17
+ /*发送文本消息
18
+ * @param chatChat - 私聊 or 群聊
19
+ * @param msg - 消息内容
20
+ * @param to - 发送目标对象(私聊用户ID或群ID)
21
+ * @param ext - 扩展数据*/
22
+ }, {
23
+ key: "sendTxtMessage",
24
+ value: (function () {
25
+ var _sendTxtMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(chatType, msg, to, ext) {
26
+ var customMessage;
27
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
28
+ while (1) switch (_context.prev = _context.next) {
29
+ case 0:
30
+ customMessage = ChatSDK.message.create({
31
+ type: 'txt',
32
+ msg: msg,
33
+ to: to,
34
+ // Need to be the user ID of the current conversation
35
+ chatType: chatType,
36
+ ext: ext
37
+ });
38
+ _context.next = 3;
39
+ return rootStore.messageStore.sendMessage(customMessage);
40
+ case 3:
41
+ case "end":
42
+ return _context.stop();
43
+ }
44
+ }, _callee);
45
+ }));
46
+ function sendTxtMessage(_x, _x2, _x3, _x4) {
47
+ return _sendTxtMessage.apply(this, arguments);
48
+ }
49
+ return sendTxtMessage;
50
+ }())
51
+ }]);
52
+ }();
53
+
54
+ export { IMUtility };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whyuzeim",
3
- "version": "1.1.56",
3
+ "version": "1.1.57",
4
4
  "description": "im componenets",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",