@guokit-dev/im-react 0.0.0-stage → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +158 -2
- package/dist/index.cjs +5279 -0
- package/dist/index.mjs +5257 -0
- package/dist/style.css +571 -0
- package/dist/types/core/chatController.d.ts +121 -0
- package/dist/types/core/externalStore.d.ts +25 -0
- package/dist/types/core/features.d.ts +8 -0
- package/dist/types/core/format.d.ts +32 -0
- package/dist/types/core/groupAvatarCache.d.ts +37 -0
- package/dist/types/core/imStore.d.ts +13 -0
- package/dist/types/core/index.d.ts +11 -0
- package/dist/types/core/media.d.ts +37 -0
- package/dist/types/core/memberCache.d.ts +31 -0
- package/dist/types/core/mention.d.ts +31 -0
- package/dist/types/core/pinyinIndex.d.ts +15 -0
- package/dist/types/core/strings.d.ts +315 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/ui/chat/ChatPage.d.ts +11 -0
- package/dist/types/ui/chat/Composer.d.ts +29 -0
- package/dist/types/ui/chat/MessageList.d.ts +17 -0
- package/dist/types/ui/chat/MessageRow.d.ts +24 -0
- package/dist/types/ui/chat/bubbles.d.ts +26 -0
- package/dist/types/ui/chat/emojis.d.ts +2 -0
- package/dist/types/ui/contacts/AddFriendDialog.d.ts +2 -0
- package/dist/types/ui/contacts/ContactsPage.d.ts +9 -0
- package/dist/types/ui/contacts/FriendGroups.d.ts +6 -0
- package/dist/types/ui/contacts/FriendSettings.d.ts +4 -0
- package/dist/types/ui/contacts/NewFriendsPage.d.ts +2 -0
- package/dist/types/ui/contacts/UserCard.d.ts +8 -0
- package/dist/types/ui/contacts/index.d.ts +5 -0
- package/dist/types/ui/contacts/routes.d.ts +4 -0
- package/dist/types/ui/contacts/shared.d.ts +33 -0
- package/dist/types/ui/context.d.ts +44 -0
- package/dist/types/ui/conversation/ConversationList.d.ts +13 -0
- package/dist/types/ui/group/GroupChats.d.ts +2 -0
- package/dist/types/ui/group/GroupInfo.d.ts +9 -0
- package/dist/types/ui/group/GroupMembers.d.ts +11 -0
- package/dist/types/ui/group/GroupNotice.d.ts +8 -0
- package/dist/types/ui/group/SelectFriends.d.ts +8 -0
- package/dist/types/ui/group/routes.d.ts +4 -0
- package/dist/types/ui/group/shared.d.ts +47 -0
- package/dist/types/ui/hooks.d.ts +9 -0
- package/dist/types/ui/layout/ImWorkspace.d.ts +8 -0
- package/dist/types/ui/layout/Layers.d.ts +19 -0
- package/dist/types/ui/layout/frame.d.ts +14 -0
- package/dist/types/ui/layout/useWide.d.ts +4 -0
- package/dist/types/ui/menu/Report.d.ts +7 -0
- package/dist/types/ui/navigator.d.ts +111 -0
- package/dist/types/ui/privacy/PrivacyPage.d.ts +7 -0
- package/dist/types/ui/privacy/routes.d.ts +4 -0
- package/dist/types/ui/routes.d.ts +7 -0
- package/dist/types/ui/theme.d.ts +30 -0
- package/dist/types/ui/types.d.ts +44 -0
- package/dist/types/ui/viewer/ImageViewer.d.ts +6 -0
- package/dist/types/ui/viewer/VideoPlayer.d.ts +5 -0
- package/dist/types/ui/widgets/Avatar.d.ts +16 -0
- package/dist/types/ui/widgets/GroupAvatar.d.ts +21 -0
- package/dist/types/ui/widgets/Icon.d.ts +43 -0
- package/dist/types/ui/widgets/IndexedList.d.ts +14 -0
- package/dist/types/ui/widgets/Menu.d.ts +36 -0
- package/dist/types/ui/widgets/Page.d.ts +16 -0
- package/dist/types/ui/widgets/UnreadBadge.d.ts +11 -0
- package/dist/types/ui/widgets/feedback.d.ts +23 -0
- package/dist/types/ui/widgets/useFocusTrap.d.ts +2 -0
- package/package.json +54 -4
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
export interface ImUiStrings {
|
|
2
|
+
conversationsTitle: string;
|
|
3
|
+
markAllRead: string;
|
|
4
|
+
disconnected: string;
|
|
5
|
+
emptyConversations: string;
|
|
6
|
+
/** 群名为空时的兜底名称。 */
|
|
7
|
+
groupChat: string;
|
|
8
|
+
/** 会话摘要前缀:群里有人 @ 我。 */
|
|
9
|
+
atMe: string;
|
|
10
|
+
pin: string;
|
|
11
|
+
unpin: string;
|
|
12
|
+
mute: string;
|
|
13
|
+
unmute: string;
|
|
14
|
+
deleteConversation: string;
|
|
15
|
+
deleteConversationConfirm: string;
|
|
16
|
+
cancel: string;
|
|
17
|
+
confirm: string;
|
|
18
|
+
yesterday: string;
|
|
19
|
+
/** 周一到周日。 */
|
|
20
|
+
weekdays: readonly string[];
|
|
21
|
+
operationFailed: string;
|
|
22
|
+
/** 单聊标题栏副标题。 */
|
|
23
|
+
typing: string;
|
|
24
|
+
/** 已退群时替代输入框的提示。 */
|
|
25
|
+
notInGroup: string;
|
|
26
|
+
read: string;
|
|
27
|
+
unreadMark: string;
|
|
28
|
+
/** 客服机器人消息的标注。 */
|
|
29
|
+
aiGenerated: string;
|
|
30
|
+
send: string;
|
|
31
|
+
/** 被拒收(rejected)且服务端没给原因时的提示。 */
|
|
32
|
+
sendRejected: string;
|
|
33
|
+
/** 撤回、群提示里指代人:本人、单聊对方、管理员、系统。 */
|
|
34
|
+
you: string;
|
|
35
|
+
peer: string;
|
|
36
|
+
admin: string;
|
|
37
|
+
system: string;
|
|
38
|
+
/** 撤回提示,`{name}` 换成撤回人。 */
|
|
39
|
+
recalled: string;
|
|
40
|
+
/** 没有专门气泡时的兜底文字。 */
|
|
41
|
+
image: string;
|
|
42
|
+
voice: string;
|
|
43
|
+
video: string;
|
|
44
|
+
file: string;
|
|
45
|
+
location: string;
|
|
46
|
+
unsupported: string;
|
|
47
|
+
/** 群变动提示:`{op}` 操作人,`{targets}` 被操作的人(顿号连接),`{name}` 新群名。 */
|
|
48
|
+
tipCreate: string;
|
|
49
|
+
tipJoin: string;
|
|
50
|
+
tipQuit: string;
|
|
51
|
+
tipKick: string;
|
|
52
|
+
tipDismiss: string;
|
|
53
|
+
tipUpdate: string;
|
|
54
|
+
tipRename: string;
|
|
55
|
+
tipNotice: string;
|
|
56
|
+
tipAdminOn: string;
|
|
57
|
+
tipAdminOff: string;
|
|
58
|
+
tipTransfer: string;
|
|
59
|
+
tipMute: string;
|
|
60
|
+
tipUnmute: string;
|
|
61
|
+
tipOther: string;
|
|
62
|
+
/** @ 选成员面板。 */
|
|
63
|
+
mentionTitle: string;
|
|
64
|
+
search: string;
|
|
65
|
+
atAll: string;
|
|
66
|
+
/** 输入栏按钮的无障碍标签。 */
|
|
67
|
+
emoji: string;
|
|
68
|
+
keyboard: string;
|
|
69
|
+
more: string;
|
|
70
|
+
/** 业务卡片 `kind` 的显示名;不在表里的显示 [cardKindOther]。 */
|
|
71
|
+
cardKinds: Readonly<Record<string, string>>;
|
|
72
|
+
cardKindOther: string;
|
|
73
|
+
/** 「+」面板内置项。 */
|
|
74
|
+
album: string;
|
|
75
|
+
camera: string;
|
|
76
|
+
fileItem: string;
|
|
77
|
+
/** 按住说话。 */
|
|
78
|
+
holdToTalk: string;
|
|
79
|
+
releaseToSend: string;
|
|
80
|
+
slideUpToCancel: string;
|
|
81
|
+
releaseToCancel: string;
|
|
82
|
+
tooShort: string;
|
|
83
|
+
noMicPermission: string;
|
|
84
|
+
voiceInput: string;
|
|
85
|
+
/** 超过站点上限,`{mb}` 换成上限。 */
|
|
86
|
+
fileTooLarge: string;
|
|
87
|
+
videoUnreadable: string;
|
|
88
|
+
/** 长按消息菜单。 */
|
|
89
|
+
copy: string;
|
|
90
|
+
copied: string;
|
|
91
|
+
recall: string;
|
|
92
|
+
report: string;
|
|
93
|
+
/** 举报原因显示名,key 是 SDK `reportReasons`;举报弹窗按 SDK 列表顺序显示。 */
|
|
94
|
+
reportReasons: Readonly<Record<string, string>>;
|
|
95
|
+
alsoBlock: string;
|
|
96
|
+
submit: string;
|
|
97
|
+
reported: string;
|
|
98
|
+
reportDuplicated: string;
|
|
99
|
+
done: string;
|
|
100
|
+
/** 首字母索引条的无障碍标签。 */
|
|
101
|
+
indexBar: string;
|
|
102
|
+
/** 没有昵称时的显示名,`{id}` 换成 userId。 */
|
|
103
|
+
unknownUser: string;
|
|
104
|
+
rateLimited: string;
|
|
105
|
+
startGroupChat: string;
|
|
106
|
+
addFriend: string;
|
|
107
|
+
contactsTitle: string;
|
|
108
|
+
contactsSearchHint: string;
|
|
109
|
+
newFriends: string;
|
|
110
|
+
/** 通讯录入口与群聊列表页标题。 */
|
|
111
|
+
groupChats: string;
|
|
112
|
+
blocklist: string;
|
|
113
|
+
/** 分组 chips 的第一项。 */
|
|
114
|
+
allFriends: string;
|
|
115
|
+
emptyContacts: string;
|
|
116
|
+
emptyGroupChats: string;
|
|
117
|
+
requestsIn: string;
|
|
118
|
+
requestsOut: string;
|
|
119
|
+
accept: string;
|
|
120
|
+
reject: string;
|
|
121
|
+
/** 发出的申请还没处理。 */
|
|
122
|
+
requestPending: string;
|
|
123
|
+
requestAccepted: string;
|
|
124
|
+
requestRejected: string;
|
|
125
|
+
requestExpired: string;
|
|
126
|
+
requestsTip: string;
|
|
127
|
+
emptyRequests: string;
|
|
128
|
+
addFriendHint: string;
|
|
129
|
+
addFriendTip: string;
|
|
130
|
+
/** 搜到的卡片副标题,`{q}` 换成输入的内容。 */
|
|
131
|
+
matchedByUserId: string;
|
|
132
|
+
matchedBySearchKey: string;
|
|
133
|
+
view: string;
|
|
134
|
+
userNotFound: string;
|
|
135
|
+
userNotFoundTip: string;
|
|
136
|
+
searchSelf: string;
|
|
137
|
+
userCardTitle: string;
|
|
138
|
+
/** 有备注时显示的昵称行。 */
|
|
139
|
+
nicknameLabel: string;
|
|
140
|
+
accountLabel: string;
|
|
141
|
+
remarkAndGroups: string;
|
|
142
|
+
friendSince: string;
|
|
143
|
+
sendMessage: string;
|
|
144
|
+
blockUser: string;
|
|
145
|
+
blockConfirm: string;
|
|
146
|
+
deleteFriend: string;
|
|
147
|
+
deleteFriendConfirm: string;
|
|
148
|
+
addToContacts: string;
|
|
149
|
+
friendRequestTitle: string;
|
|
150
|
+
/** 申请附言默认值,`{name}` 换成本人昵称;本人昵称为空时附言留空。 */
|
|
151
|
+
friendRequestDefault: string;
|
|
152
|
+
sendRequest: string;
|
|
153
|
+
requestSent: string;
|
|
154
|
+
becameFriends: string;
|
|
155
|
+
addDenied: string;
|
|
156
|
+
/** 双方有拉黑关系时(`IM_BLOCKED`)。 */
|
|
157
|
+
addBlocked: string;
|
|
158
|
+
remark: string;
|
|
159
|
+
remarkTip: string;
|
|
160
|
+
clearRemark: string;
|
|
161
|
+
friendGroupsMulti: string;
|
|
162
|
+
manageFriendGroups: string;
|
|
163
|
+
newFriendGroup: string;
|
|
164
|
+
friendGroupName: string;
|
|
165
|
+
friendGroupsTitle: string;
|
|
166
|
+
friendGroupsTip: string;
|
|
167
|
+
rename: string;
|
|
168
|
+
deleteFriendGroup: string;
|
|
169
|
+
deleteFriendGroupConfirm: string;
|
|
170
|
+
dragToSort: string;
|
|
171
|
+
groupInfoTitle: string;
|
|
172
|
+
groupIdAndCount: string;
|
|
173
|
+
inviteMember: string;
|
|
174
|
+
removeMember: string;
|
|
175
|
+
viewAllMembers: string;
|
|
176
|
+
groupNameLabel: string;
|
|
177
|
+
groupNotice: string;
|
|
178
|
+
notSet: string;
|
|
179
|
+
pinChat: string;
|
|
180
|
+
groupManage: string;
|
|
181
|
+
muteAll: string;
|
|
182
|
+
muteAllTip: string;
|
|
183
|
+
inviteAdminOnly: string;
|
|
184
|
+
groupAdmins: string;
|
|
185
|
+
peopleCount: string;
|
|
186
|
+
transferOwner: string;
|
|
187
|
+
clearHistory: string;
|
|
188
|
+
clearHistoryConfirm: string;
|
|
189
|
+
quitGroup: string;
|
|
190
|
+
quitGroupConfirm: string;
|
|
191
|
+
ownerQuitTip: string;
|
|
192
|
+
dismissGroup: string;
|
|
193
|
+
dismissGroupConfirm: string;
|
|
194
|
+
/** 群角色标签。 */
|
|
195
|
+
roleOwner: string;
|
|
196
|
+
roleAdmin: string;
|
|
197
|
+
roleMember: string;
|
|
198
|
+
groupMembersTitle: string;
|
|
199
|
+
searchMembers: string;
|
|
200
|
+
mutedRemaining: string;
|
|
201
|
+
joinedAt: string;
|
|
202
|
+
viewProfile: string;
|
|
203
|
+
setAdmin: string;
|
|
204
|
+
unsetAdmin: string;
|
|
205
|
+
muteMember: string;
|
|
206
|
+
unmuteMember: string;
|
|
207
|
+
/** 禁言时长选项:秒数 → 显示名,按表里顺序列出。 */
|
|
208
|
+
muteDurations: Readonly<Record<string, string>>;
|
|
209
|
+
/** 剩余时长。 */
|
|
210
|
+
durationMinutes: string;
|
|
211
|
+
durationHours: string;
|
|
212
|
+
durationDays: string;
|
|
213
|
+
kickMember: string;
|
|
214
|
+
kickConfirm: string;
|
|
215
|
+
transferTo: string;
|
|
216
|
+
transferConfirm: string;
|
|
217
|
+
selectFriendsTitle: string;
|
|
218
|
+
doneWithCount: string;
|
|
219
|
+
/** 选择好友对话框右栏,`{n}` 已选人数、`{max}` 上限。Web 新键。 */
|
|
220
|
+
selectedCount: string;
|
|
221
|
+
/** 资料卡陌生人形态的标签。Web 新键。 */
|
|
222
|
+
notFriendYet: string;
|
|
223
|
+
/** 原地新建分组的确认按钮。Web 新键。 */
|
|
224
|
+
add: string;
|
|
225
|
+
searchFriends: string;
|
|
226
|
+
alreadyInGroup: string;
|
|
227
|
+
inviteToGroup: string;
|
|
228
|
+
skippedMembers: string;
|
|
229
|
+
/** 发起群聊的默认群名用它连接「我的昵称、前两位所选的昵称」。 */
|
|
230
|
+
groupNameSeparator: string;
|
|
231
|
+
editNotice: string;
|
|
232
|
+
publish: string;
|
|
233
|
+
noticePublishedAt: string;
|
|
234
|
+
noticeEditTip: string;
|
|
235
|
+
noticeHint: string;
|
|
236
|
+
noticePublishTip: string;
|
|
237
|
+
emptyNotice: string;
|
|
238
|
+
privacyTitle: string;
|
|
239
|
+
addMeWhen: string;
|
|
240
|
+
/** 加好友方式,下标即 `addPolicy`:0 需要验证、1 任何人直接加、2 不允许。 */
|
|
241
|
+
addPolicyTitles: readonly string[];
|
|
242
|
+
addPolicyTips: readonly string[];
|
|
243
|
+
blocklistTip: string;
|
|
244
|
+
unblock: string;
|
|
245
|
+
blockedAt: string;
|
|
246
|
+
emptyBlocklist: string;
|
|
247
|
+
searchContacts: string;
|
|
248
|
+
searchGroups: string;
|
|
249
|
+
searchMessagesTitle: string;
|
|
250
|
+
searchMore: string;
|
|
251
|
+
/** 一个会话里命中的条数;还有下一页时 `{n}` 是「已加载数+」,如「20+」。 */
|
|
252
|
+
searchRelated: string;
|
|
253
|
+
searchLoadMore: string;
|
|
254
|
+
searchNoResult: string;
|
|
255
|
+
searchFailed: string;
|
|
256
|
+
searchNoMore: string;
|
|
257
|
+
findChatHistory: string;
|
|
258
|
+
/** 搜索结果推不出会话对方(本机没有这个会话、命中的是自己发的)时的提示。 */
|
|
259
|
+
conversationGone: string;
|
|
260
|
+
backToLatest: string;
|
|
261
|
+
csTitle: string;
|
|
262
|
+
csBot: string;
|
|
263
|
+
csHandoff: string;
|
|
264
|
+
/** 排队中,`{n}` 是排在自己前面的人数。 */
|
|
265
|
+
csQueued: string;
|
|
266
|
+
csQueuedNext: string;
|
|
267
|
+
csOffline: string;
|
|
268
|
+
csOfflineWait: string;
|
|
269
|
+
csActive: string;
|
|
270
|
+
csLeave: string;
|
|
271
|
+
leaveTitle: string;
|
|
272
|
+
leaveTip: string;
|
|
273
|
+
leaveName: string;
|
|
274
|
+
leavePhone: string;
|
|
275
|
+
leaveEmail: string;
|
|
276
|
+
leaveOptional: string;
|
|
277
|
+
leaveContactTip: string;
|
|
278
|
+
leaveDone: string;
|
|
279
|
+
ratingTitle: string;
|
|
280
|
+
/** 1–5 星各自的说法,下标 0 是 1 星。 */
|
|
281
|
+
ratingLevels: readonly string[];
|
|
282
|
+
ratingScore: string;
|
|
283
|
+
ratingComment: string;
|
|
284
|
+
ratingCommentHint: string;
|
|
285
|
+
ratingSubmit: string;
|
|
286
|
+
ratingDone: string;
|
|
287
|
+
back: string;
|
|
288
|
+
close: string;
|
|
289
|
+
/** 输入框占位。 */
|
|
290
|
+
inputPlaceholder: string;
|
|
291
|
+
/** 发送按钮旁的按键提示。 */
|
|
292
|
+
enterToSend: string;
|
|
293
|
+
/** 拖文件进聊天区时的遮罩,`{name}` 是会话名。 */
|
|
294
|
+
dropToSend: string;
|
|
295
|
+
removeAttachment: string;
|
|
296
|
+
sendImageOrVideo: string;
|
|
297
|
+
sendFile: string;
|
|
298
|
+
zoomIn: string;
|
|
299
|
+
zoomOut: string;
|
|
300
|
+
prevImage: string;
|
|
301
|
+
nextImage: string;
|
|
302
|
+
openOriginal: string;
|
|
303
|
+
/** 导航条「消息」。 */
|
|
304
|
+
navMessages: string;
|
|
305
|
+
selectConversation: string;
|
|
306
|
+
/** 站点没开放这一类文件。 */
|
|
307
|
+
fileNotAllowed: string;
|
|
308
|
+
/** 图片预览的张数,`{n}` 当前第几张、`{total}` 共几张。 */
|
|
309
|
+
imageIndex: string;
|
|
310
|
+
}
|
|
311
|
+
export declare const defaultStrings: ImUiStrings;
|
|
312
|
+
/** 浅合并:传了的键整体覆盖(数组、对象也是整个替换)。 */
|
|
313
|
+
export declare function mergeStrings(over?: Partial<ImUiStrings>): ImUiStrings;
|
|
314
|
+
/** 替换占位符 `{key}`;没给的保持原样。 */
|
|
315
|
+
export declare function fill(template: string, vars: Record<string, string | number>): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { GuokitImUi, useIm, type GuokitImUiProps } from './ui/context';
|
|
2
|
+
export { ImWorkspace, type ImWorkspaceProps } from './ui/layout/ImWorkspace';
|
|
3
|
+
export { useImNavigator, type ImNavigator, type ImRoute, type ChatRouteTarget } from './ui/navigator';
|
|
4
|
+
export { useConversations, useTotalUnread, useConnection, useFriends } from './ui/hooks';
|
|
5
|
+
export { ImUnreadBadge } from './ui/widgets/UnreadBadge';
|
|
6
|
+
export { ImConversationList, type ImConversationListProps } from './ui/conversation/ConversationList';
|
|
7
|
+
export { ImChat, type ImChatProps } from './ui/chat/ChatPage';
|
|
8
|
+
export { Avatar as ImAvatar, type AvatarProps as ImAvatarProps } from './ui/widgets/Avatar';
|
|
9
|
+
export { ImGroupAvatar, type ImGroupAvatarProps } from './ui/widgets/GroupAvatar';
|
|
10
|
+
export type { ImUiTheme, ImAvatarShape } from './ui/theme';
|
|
11
|
+
export type { ImChatTarget, ImMoreItem, ImMenuItem, ImUiCallbacks, ImMessageRenderer, ImMe } from './ui/types';
|
|
12
|
+
export { defaultStrings, type ImUiStrings } from './core/strings';
|
|
13
|
+
export { ImGroupInfo, type ImGroupInfoProps } from './ui/group/GroupInfo';
|
|
14
|
+
export { ImContacts, ImUserCard, type ImContactsProps, type ImUserCardProps } from './ui/contacts';
|
|
15
|
+
export { ImPrivacy } from './ui/privacy/PrivacyPage';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ImConversation } from '@guokit-dev/im';
|
|
2
|
+
export interface ImChatProps {
|
|
3
|
+
/** 从会话列表进来。 */
|
|
4
|
+
conversation?: ImConversation;
|
|
5
|
+
/** 按对方 userId 打开,还没有会话时也能发。 */
|
|
6
|
+
peer?: string;
|
|
7
|
+
/** 按群号打开。 */
|
|
8
|
+
group?: string;
|
|
9
|
+
}
|
|
10
|
+
/** 聊天页:单聊、群聊共用(C 期再加客服与定位到消息)。同 Flutter `ImChatPage`。 */
|
|
11
|
+
export declare function ImChat(props: ImChatProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ImFeatures, ImGroupMember } from '@guokit-dev/im';
|
|
2
|
+
import { type MediaKind } from '../../core/media';
|
|
3
|
+
import type { ImChatTarget } from '../types';
|
|
4
|
+
export interface Attachment {
|
|
5
|
+
id: number;
|
|
6
|
+
file: File;
|
|
7
|
+
kind: MediaKind;
|
|
8
|
+
}
|
|
9
|
+
export interface ComposerHandle {
|
|
10
|
+
/** 拖进聊天区的文件:先进附件条。 */
|
|
11
|
+
addFiles(files: File[]): void;
|
|
12
|
+
}
|
|
13
|
+
export interface ComposerProps {
|
|
14
|
+
/** 发文字(at 是 userId 列表,`@all` 为所有人)。 */
|
|
15
|
+
onSend: (text: string, at: string[]) => Promise<void>;
|
|
16
|
+
/** 逐个发附件,按附件条顺序。 */
|
|
17
|
+
onSendFile: (a: Attachment) => Promise<void>;
|
|
18
|
+
onTyping?: () => void;
|
|
19
|
+
/** 非 null 时禁用输入区并显示提示(已退群)。 */
|
|
20
|
+
disabledHint?: string | null;
|
|
21
|
+
features: ImFeatures | null;
|
|
22
|
+
/** 群成员;非 null 时输入「@」弹出选成员。 */
|
|
23
|
+
members: readonly ImGroupMember[] | null;
|
|
24
|
+
/** 群主、管理员可以 @所有人。 */
|
|
25
|
+
canAtAll: boolean;
|
|
26
|
+
target: ImChatTarget | null;
|
|
27
|
+
}
|
|
28
|
+
/** 输入区:工具栏(表情、图片 / 视频、文件、「+」)、待发送附件条、@ 选成员、Enter 发送。设计稿 04。 */
|
|
29
|
+
export declare const Composer: import("react").ForwardRefExoticComponent<ComposerProps & import("react").RefAttributes<ComposerHandle>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ImMessage } from '@guokit-dev/im';
|
|
3
|
+
import type { ChatController, ChatSnapshot } from '../../core/chatController';
|
|
4
|
+
export interface MessageListProps {
|
|
5
|
+
ctl: ChatController;
|
|
6
|
+
snap: ChatSnapshot;
|
|
7
|
+
isGroup: boolean;
|
|
8
|
+
nameOf: (userId: string) => string;
|
|
9
|
+
renderRow: (m: ImMessage) => ReactNode;
|
|
10
|
+
/** 由聊天页调:滚到最新(发送后、本人在别处发的、停在底部附近时来新消息)。 */
|
|
11
|
+
scrollRef: React.MutableRefObject<(() => void) | null>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 消息列表:`column-reverse` 的滚动容器,贴底与往前插入保持位置都由浏览器处理;
|
|
15
|
+
* 滚到离顶部 200px 内翻页。每行带 `content-visibility: auto`,代替虚拟滚动。
|
|
16
|
+
*/
|
|
17
|
+
export declare function MessageList({ ctl, snap, isGroup, nameOf, renderRow, scrollRef }: MessageListProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ImMessage } from '@guokit-dev/im';
|
|
3
|
+
import { type BubbleProps } from './bubbles';
|
|
4
|
+
/** 居中灰色提示:撤回、群变动、时间分隔共用。 */
|
|
5
|
+
export declare function CenterTip({ text }: {
|
|
6
|
+
text: string;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export interface MessageRowProps extends Omit<BubbleProps, 'message'> {
|
|
9
|
+
message: ImMessage;
|
|
10
|
+
senderName: string;
|
|
11
|
+
senderAvatarUrl: string;
|
|
12
|
+
/** 群聊里对方的消息在气泡上方显示名字。 */
|
|
13
|
+
showName: boolean;
|
|
14
|
+
/** 本人已确认消息的已读状态;null 不显示。 */
|
|
15
|
+
read: boolean | null;
|
|
16
|
+
onResend?: (m: ImMessage) => void;
|
|
17
|
+
onAvatarClick?: (userId: string) => void;
|
|
18
|
+
/** 右键 / 触屏长按气泡。 */
|
|
19
|
+
onMenu?: (m: ImMessage, x: number, y: number) => void;
|
|
20
|
+
/** 悬停操作条(A4),由聊天页按消息生成。 */
|
|
21
|
+
hoverBar?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/** 聊天页的一条普通消息:头像、群里对方的名字、气泡、发送状态、已读 / 未读、「AI 生成」。同 Flutter `ImMessageRow`。 */
|
|
24
|
+
export declare const MessageRow: import("react").NamedExoticComponent<MessageRowProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ImMessage } from '@guokit-dev/im';
|
|
3
|
+
export interface BubbleProps {
|
|
4
|
+
message: ImMessage;
|
|
5
|
+
/** 本设备刚发的附件的 objectURL,上传完成前做占位。 */
|
|
6
|
+
localUrl?: string | null;
|
|
7
|
+
/** 上传进度 0–1;null 表示没在上传。 */
|
|
8
|
+
progress?: number | null;
|
|
9
|
+
/** 这条语音正在播放。 */
|
|
10
|
+
playing?: boolean;
|
|
11
|
+
onImageClick?: (m: ImMessage) => void;
|
|
12
|
+
onVideoClick?: (m: ImMessage) => void;
|
|
13
|
+
onVoiceClick?: (m: ImMessage) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function formatFileSize(bytes: number | null): string;
|
|
16
|
+
export declare function formatDuration(sec: number | null): string;
|
|
17
|
+
/** 新标签页打开;跨域时 `<a download>` 会被浏览器忽略,所以文件也走新标签页。 */
|
|
18
|
+
export declare function openExternal(url: string): void;
|
|
19
|
+
/** 带底色的文字气泡。群消息里 `@昵称` 高亮。 */
|
|
20
|
+
export declare function TextBubble({ message: m, text, children }: {
|
|
21
|
+
message: ImMessage;
|
|
22
|
+
text?: string;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
25
|
+
/** 气泡内容:宿主 messageRenderers 优先,返回 null 走默认。 */
|
|
26
|
+
export declare function MessageContent(props: BubbleProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ImContactsProps {
|
|
2
|
+
/** 点好友。不传时:宿主传了 `onAvatarTap` 走宿主;否则 ImWorkspace 宽屏在主区打开资料卡,其他情况打开资料卡抽屉。 */
|
|
3
|
+
onSelect?: (userId: string) => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 通讯录:本地搜索(备注、昵称)、「新的朋友 / 群聊 / 黑名单」入口、分组筛选、好友按首字母分节 + 索引条
|
|
7
|
+
* (设计稿 07,口径同 FB §4.3)。好友来自内存快照,冷启动先空,对账完刷新。
|
|
8
|
+
*/
|
|
9
|
+
export declare function ImContacts({ onSelect }: ImContactsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ImUserCardProps {
|
|
2
|
+
userId: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* 资料卡:好友与陌生人两种形态(设计稿 07 主区、09 抽屉,口径同 FB §4.3)。好友看内存好友表,推送来了就地切换。
|
|
6
|
+
* 陌生人的资料 SDK 拿不到:用 `rememberUser` 记下的昵称头像,或单聊会话里的对方资料;都没有只显示 userId。
|
|
7
|
+
*/
|
|
8
|
+
export declare function ImUserCard({ userId }: ImUserCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ImContacts, type ImContactsProps } from './ContactsPage';
|
|
2
|
+
export { ImUserCard, type ImUserCardProps } from './UserCard';
|
|
3
|
+
export { ImNewFriends } from './NewFriendsPage';
|
|
4
|
+
export { ImAddFriend } from './AddFriendDialog';
|
|
5
|
+
export { rememberUser } from './shared';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type GuokitIm, type ImFriend, type ImFriendGroup } from '@guokit-dev/im';
|
|
2
|
+
import type { ImUiCallbacks } from '../types';
|
|
3
|
+
import type { ImNavigator } from '../navigator';
|
|
4
|
+
/** 好友显示名:备注 > 昵称 > userId(同 Flutter `friendDisplayName`)。 */
|
|
5
|
+
export declare function friendDisplayName(f: ImFriend): string;
|
|
6
|
+
/** 接口错误的提示:服务端给了原因就用它,否则兜底文案。 */
|
|
7
|
+
export declare function errorText(e: unknown, fallback: string): string;
|
|
8
|
+
/** 本地时区 yyyy/MM/dd,同 Flutter `imDate`。 */
|
|
9
|
+
export declare function ymd(ms: number): string;
|
|
10
|
+
/** 未登录时 SDK 读取方法同步抛错,这里吞掉返回兜底值。 */
|
|
11
|
+
export declare function safe<T>(f: () => T, fallback: T): T;
|
|
12
|
+
export interface UserHint {
|
|
13
|
+
nickname: string;
|
|
14
|
+
avatarUrl: string;
|
|
15
|
+
}
|
|
16
|
+
/** 打开资料卡前记下对方昵称与头像(陌生人用);空串不覆盖已有的。 */
|
|
17
|
+
export declare function rememberUser(im: GuokitIm, userId: string, hint: Partial<UserHint>): void;
|
|
18
|
+
export declare function userHint(im: GuokitIm, userId: string): UserHint;
|
|
19
|
+
/** 打开某人的资料卡:自己不响应;宿主传了 `onAvatarTap` 走宿主,否则打开内置资料卡(同 Flutter `openUserCard`)。 */
|
|
20
|
+
export declare function openUserCard(ctx: {
|
|
21
|
+
im: GuokitIm;
|
|
22
|
+
callbacks: ImUiCallbacks;
|
|
23
|
+
nav: ImNavigator;
|
|
24
|
+
}, userId: string, hint?: Partial<UserHint>, route?: 'userCard' | 'contactProfile'): void;
|
|
25
|
+
type Channel = 'groups' | 'pending';
|
|
26
|
+
export declare function notifyContacts(im: GuokitIm, ch: Channel): void;
|
|
27
|
+
/** 按 sort、再按 id 排。 */
|
|
28
|
+
export declare function sortGroups(g: readonly ImFriendGroup[]): ImFriendGroup[];
|
|
29
|
+
/** 好友分组:挂载时拉一次,`friendGroupsChanged` 或本设备改过分组时重拉。null 表示还没拉到。 */
|
|
30
|
+
export declare function useFriendGroups(im: GuokitIm): [ImFriendGroup[] | null, () => Promise<void>];
|
|
31
|
+
/** 待处理的好友申请数:收到的第一页(50 条)里 pending 的条数(同 FB §4.3)。 */
|
|
32
|
+
export declare function usePendingCount(im: GuokitIm): number;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import type { GuokitIm, ImMessage } from '@guokit-dev/im';
|
|
3
|
+
import { type ImUiStrings } from '../core/strings';
|
|
4
|
+
import { type ChatRouteTarget } from './navigator';
|
|
5
|
+
import { type ImUiTheme } from './theme';
|
|
6
|
+
import type { ImChatTarget, ImMe, ImMenuItem, ImMessageRenderer, ImMoreItem, ImUiCallbacks } from './types';
|
|
7
|
+
export interface GuokitImUiProps {
|
|
8
|
+
/** SDK 实例,由宿主 new、login、销毁;组件只订阅。 */
|
|
9
|
+
im: GuokitIm;
|
|
10
|
+
me?: ImMe;
|
|
11
|
+
theme?: ImUiTheme;
|
|
12
|
+
/** 部分覆盖默认中文文案,浅合并。 */
|
|
13
|
+
strings?: Partial<ImUiStrings>;
|
|
14
|
+
callbacks?: ImUiCallbacks;
|
|
15
|
+
/** 按消息 type 覆盖气泡,返回 null 走默认。 */
|
|
16
|
+
messageRenderers?: Record<string, ImMessageRenderer>;
|
|
17
|
+
/** 「+」菜单的宿主扩展项;没有时「+」按钮隐藏。 */
|
|
18
|
+
moreItems?: ImMoreItem[];
|
|
19
|
+
/** 追加到消息「更多」与右键菜单末尾。 */
|
|
20
|
+
menuItems?: (message: ImMessage) => ImMenuItem[];
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export interface ImUiContextValue {
|
|
26
|
+
im: GuokitIm;
|
|
27
|
+
me: ImMe;
|
|
28
|
+
strings: ImUiStrings;
|
|
29
|
+
callbacks: ImUiCallbacks;
|
|
30
|
+
messageRenderers: Record<string, ImMessageRenderer>;
|
|
31
|
+
moreItems: ImMoreItem[];
|
|
32
|
+
menuItems?: (message: ImMessage) => ImMenuItem[];
|
|
33
|
+
}
|
|
34
|
+
/** 把打开聊天的路由目标换成交给宿主的 `ImChatTarget`。 */
|
|
35
|
+
export declare function chatTargetOf(t: ChatRouteTarget): ImChatTarget;
|
|
36
|
+
/**
|
|
37
|
+
* IM 组件的根,对应 Flutter 的 `GuokitImUi`。下面放 `ImWorkspace`(整页)或单页组件。
|
|
38
|
+
* 单页组件模式下,抽屉、对话框类页面由这里自带的浮层宿主渲染;主区、列表栏类走回调。
|
|
39
|
+
*/
|
|
40
|
+
export declare function GuokitImUi(props: GuokitImUiProps): import("react").JSX.Element;
|
|
41
|
+
/** 组件内部用:取 Provider 数据。 */
|
|
42
|
+
export declare function useImUi(): ImUiContextValue;
|
|
43
|
+
/** 当前的 SDK 实例。 */
|
|
44
|
+
export declare function useIm(): GuokitIm;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ImConversation } from '@guokit-dev/im';
|
|
2
|
+
export interface ImConversationListProps {
|
|
3
|
+
/** 点会话。不传时:在 ImWorkspace 里主区打开聊天,单页组件模式下走 `callbacks.onOpenConversation`。 */
|
|
4
|
+
onOpen?: (conversation: ImConversation) => void;
|
|
5
|
+
/** 标题栏「+」菜单:发起群聊、添加朋友(B 期)。 */
|
|
6
|
+
showAddMenu?: boolean;
|
|
7
|
+
/** 顶部搜索框(C 期接全局搜索)。 */
|
|
8
|
+
showSearch?: boolean;
|
|
9
|
+
/** 当前选中的会话 id(宽屏高亮);ImWorkspace 里自动取主区打开的会话。 */
|
|
10
|
+
selectedId?: number | null;
|
|
11
|
+
}
|
|
12
|
+
/** 会话列表:置顶、未读、免打扰、断线横条、右键(触屏长按)置顶 / 免打扰 / 删除、全部已读。同 Flutter `ImConversationListPage`。 */
|
|
13
|
+
export declare function ImConversationList({ onOpen, showAddMenu, showSearch, selectedId }: ImConversationListProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ImGroupInfoProps {
|
|
2
|
+
groupId: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* 群资料(设计稿 10,口径同 Flutter `ImGroupInfoPage`):九宫格头像、群名、群号与人数、成员格、群名与公告、
|
|
6
|
+
* 免打扰与置顶、群管理、清空记录、退群 / 解散。点成员打开资料卡;成员操作在群成员页。
|
|
7
|
+
* 群资料与成员不缓存,进来拉一次,收到本群的 `groupChanged` 再拉。
|
|
8
|
+
*/
|
|
9
|
+
export declare function ImGroupInfo({ groupId }: ImGroupInfoProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface GroupMembersPageProps {
|
|
2
|
+
groupId: string;
|
|
3
|
+
/** 测试用:固定「现在」(毫秒)。 */
|
|
4
|
+
now?: () => number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 群成员(设计稿 16,口径同 Flutter `ImGroupMembersPage`):本地搜索已加载的成员(最多 500)、角色与禁言标签。
|
|
8
|
+
* 悬停行出「…」,点开操作菜单:查看资料、设 / 取消管理员(群主)、禁言(二级时长)/ 解除禁言、转让群主(群主,二次确认)、
|
|
9
|
+
* 移出群聊(群主对所有人、管理员对普通成员,二次确认)。窄屏点整行同样弹菜单。
|
|
10
|
+
*/
|
|
11
|
+
export declare function GroupMembersPage({ groupId, now }: GroupMembersPageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 群公告(设计稿 17,口径同 Flutter `ImGroupNoticePage`):查看发布人、时间、正文;群主和管理员点「编辑」
|
|
3
|
+
* 在同一页切到编辑态(≤1000 字带计数),「发布」调 `updateGroup({notice})`,服务端会在群里发提示消息。
|
|
4
|
+
* 接入方后端发布的(noticeBy 为 `@system`)显示「系统」。
|
|
5
|
+
*/
|
|
6
|
+
export declare function GroupNoticePage({ groupId }: {
|
|
7
|
+
groupId: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 选择好友(设计稿 11,口径同 Flutter `ImSelectFriendsPage`):左边首字母分节勾选、右边已选。
|
|
3
|
+
* 不传 groupId 是发起群聊(选 1–50 人,建好打开群聊);传了是邀请进群(已在群里的置灰)。
|
|
4
|
+
* 有人没能加入时提示「N 人未能加入」。
|
|
5
|
+
*/
|
|
6
|
+
export declare function SelectFriendsDialog({ groupId }: {
|
|
7
|
+
groupId?: string;
|
|
8
|
+
}): import("react").JSX.Element;
|