@tencentcloud/chat-uikit-react 3.4.8 → 4.5.3
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/CHANGELOG.md +15 -0
- package/dist/components/Chat/Chat.js +13 -13
- package/dist/components/ChatHeader/AudioCallPicker/AudioCallPicker.js +12 -12
- package/dist/components/ChatHeader/ChatHeader.d.ts +1 -1
- package/dist/components/ChatHeader/ChatHeader.js +7 -7
- package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.d.ts +1 -1
- package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.js +1 -1
- package/dist/components/ChatHeader/VideoCallPicker/VideoCallPicker.js +18 -18
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Input/Input.js +6 -6
- package/dist/components/Modal/Modal.js +13 -13
- package/dist/components/Model/index.js +1 -1
- package/dist/components/Plugins/index.js +1 -1
- package/dist/components/Popup/index.js +1 -1
- package/dist/components/PopupNew/Popup.js +11 -11
- package/dist/components/Profile/Profile.js +5 -5
- package/dist/components/Profile/ProfileDefault.d.ts +1 -1
- package/dist/components/Profile/ProfileDefault.js +25 -25
- package/dist/components/Profile/myProfile/MyProfile.js +5 -5
- package/dist/context/ContactContext.js +2 -2
- package/dist/external_modules/{react-vendors-3raCpd-g.js → react-vendors-x_iUMC12.js} +69 -70
- package/dist/hooks/useChatHeader.d.ts +1 -1
- package/dist/hooks/useChatHeader.js +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +49 -114
- package/dist/locales/en-US/TUIConversation.d.ts +2 -0
- package/dist/locales/en-US/TUIConversation.js +3 -1
- package/dist/locales/en-US/index.d.ts +2 -0
- package/dist/locales/ja-JP/TUIConversation.d.ts +2 -0
- package/dist/locales/ja-JP/TUIConversation.js +3 -1
- package/dist/locales/ja-JP/index.d.ts +2 -0
- package/dist/locales/ko-KR/TUIConversation.d.ts +2 -0
- package/dist/locales/ko-KR/TUIConversation.js +3 -1
- package/dist/locales/ko-KR/index.d.ts +2 -0
- package/dist/locales/zh-CN/TUIConversation.d.ts +2 -0
- package/dist/locales/zh-CN/TUIConversation.js +3 -1
- package/dist/locales/zh-CN/index.d.ts +2 -0
- package/dist/locales/zh-TW/TUIConversation.d.ts +2 -0
- package/dist/locales/zh-TW/TUIConversation.js +3 -1
- package/dist/locales/zh-TW/index.d.ts +2 -0
- package/dist/states/UIManagerState.js +7 -6
- package/dist/styles/index.css +1 -1
- package/dist/styles/index2.css +1 -1
- package/dist/styles/index3.css +1 -1
- package/dist/styles/index4.css +1 -1
- package/dist/styles/index5.css +1 -1
- package/package.json +3 -3
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/ChatHeader/AudioCallPicker/AudioCallPicker.tsx +2 -2
- package/src/components/ChatHeader/ChatHeader.tsx +2 -2
- package/src/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.tsx +2 -2
- package/src/components/ChatHeader/VideoCallPicker/VideoCallPicker.tsx +2 -2
- package/src/components/Profile/ProfileDefault.tsx +2 -2
- package/src/components/Profile/myProfile/MyProfile.tsx +3 -3
- package/src/hooks/useChatHeader.ts +2 -2
- package/src/index.ts +11 -2
- package/src/locales/en-US/TUIConversation.ts +2 -0
- package/src/locales/ja-JP/TUIConversation.ts +2 -0
- package/src/locales/ko-KR/TUIConversation.ts +2 -0
- package/src/locales/zh-CN/TUIConversation.ts +2 -0
- package/src/locales/zh-TW/TUIConversation.ts +2 -0
- package/vite.config.ts +32 -18
- package/dist/external_modules/mui-BhvHeL5-.js +0 -2253
- package/dist/external_modules/zustand-CDmQR4co.js +0 -24
- package/dist/index-BLFl-K0_-DzfAZFZt.js +0 -32905
- package/dist/styles/index-BLFl-K0_.css +0 -1
|
@@ -38,7 +38,9 @@ const e = {
|
|
|
38
38
|
"You have been removed from the group by the group administrator": "您已被群管理员移出该群",
|
|
39
39
|
"The group chat has been disbanded": "该群已解散",
|
|
40
40
|
"You have left the group chat": "您已退出该群",
|
|
41
|
-
Me: "我"
|
|
41
|
+
Me: "我",
|
|
42
|
+
someone_at_me: "有人@你",
|
|
43
|
+
at_all: "@所有人"
|
|
42
44
|
};
|
|
43
45
|
export {
|
|
44
46
|
e as default
|
|
@@ -38,7 +38,9 @@ const e = {
|
|
|
38
38
|
"You have been removed from the group by the group administrator": "您已被群管理員移除",
|
|
39
39
|
"The group chat has been disbanded": "該群已解散",
|
|
40
40
|
"You have left the group chat": "您已離開該群",
|
|
41
|
-
Me: "我"
|
|
41
|
+
Me: "我",
|
|
42
|
+
someone_at_me: "有人@你",
|
|
43
|
+
at_all: "@所有人"
|
|
42
44
|
};
|
|
43
45
|
export {
|
|
44
46
|
e as default
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TUIConversationService as r, TUIStore as a, StoreName as i } from "@tencentcloud/chat-uikit-engine-lite";
|
|
2
2
|
import { TUILogin as s } from "@tencentcloud/tui-core-lite";
|
|
3
|
-
import {
|
|
3
|
+
import { useStore as n } from "zustand";
|
|
4
|
+
import { createStore as c } from "zustand/vanilla";
|
|
4
5
|
const o = c()((e) => ({
|
|
5
6
|
chat: null,
|
|
6
7
|
myProfile: void 0,
|
|
@@ -19,7 +20,7 @@ const o = c()((e) => ({
|
|
|
19
20
|
setTUIManageShow: (t) => e(() => ({ TUIManageShow: t })),
|
|
20
21
|
setUserStatusMap: (t) => e(() => ({ userStatusMap: t }))
|
|
21
22
|
}));
|
|
22
|
-
function
|
|
23
|
+
function C(...e) {
|
|
23
24
|
return {
|
|
24
25
|
chat: s.getContext().chat,
|
|
25
26
|
myProfile: n(o, (t) => t.myProfile),
|
|
@@ -36,7 +37,7 @@ function u(...e) {
|
|
|
36
37
|
switchConversation: n(o, (t) => t.switchConversation)
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function g() {
|
|
40
41
|
return n(o, (e) => {
|
|
41
42
|
var t;
|
|
42
43
|
return (t = e.conversation) == null ? void 0 : t.conversationID;
|
|
@@ -71,6 +72,6 @@ function U(e) {
|
|
|
71
72
|
o.getState().setUserStatusMap(t);
|
|
72
73
|
}
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
g as useCurrentConversationID,
|
|
76
|
+
C as useUIManagerState
|
|
76
77
|
};
|
package/dist/styles/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,*:after,*:before{box-sizing:border-box}ul,li{list-style:none;padding:0;margin:0}picture,img,video,canvas,svg{display:block;max-width:100%}img{max-width:100%;height:auto;vertical-align:middle;image-rendering:-webkit-optimize-contrast;aspect-ratio:attr(width)/attr(height);display:inline-block;-webkit-user-drag:none;-webkit-user-select:none;user-select:none}img:not([src],[srcset]){visibility:hidden}
|
package/dist/styles/index2.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.checkbox{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;position:relative}.checkbox-default{box-sizing:border-box;width:14px;height:14px;border-radius:14px;border:1px solid #DDDDDD}.checkbox-input{margin:0;padding:0;position:absolute;top:0;left:0;z-index:1;width:100%;height:100%;opacity:0}[data-uikit-theme=light] .info{background-color:var(--uikit-theme-light-bg-color-operate);color:var(--uikit-theme-light-text-color-primary);transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}[data-uikit-theme=dark] .info{background-color:var(--uikit-theme-dark-bg-color-operate);color:var(--uikit-theme-dark-text-color-primary);transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}[data-uikit-theme=light] .warn{background-color:var(--uikit-theme-light-text-color-warning);color:#fff;transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}[data-uikit-theme=dark] .warn{background-color:var(--uikit-theme-dark-text-color-warning);color:#fff;transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}[data-uikit-theme=light] .error{background-color:var(--uikit-theme-light-text-color-error);color:#fff;transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}[data-uikit-theme=dark] .error{background-color:var(--uikit-theme-dark-text-color-error);color:#fff;transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}
|
package/dist/styles/index3.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.model{background:#00000080;position:fixed;z-index:5;width:100vw;top:0;left:0;bottom:0;display:flex;justify-content:center;align-items:center}
|
package/dist/styles/index4.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.popup{
|
|
1
|
+
.plugin{display:flex;align-items:center;height:100%;padding:0 8px;gap:8px}.plugin-popup{height:100%;display:flex;align-items:center;position:relative}.plugin-popup-box{position:absolute;z-index:5;bottom:100%}.plugin-popup-box{border-radius:8px;overflow:hidden}[data-uikit-theme=light] .plugin-popup-box{background-color:var(--uikit-theme-light-dropdown-color-default);box-shadow:0 0 10px 0 var(--uikit-theme-light-shadow-color);transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}[data-uikit-theme=dark] .plugin-popup-box{background-color:var(--uikit-theme-dark-dropdown-color-default);box-shadow:0 0 10px 0 var(--uikit-theme-dark-shadow-color);transition:color .3s ease-out,border-color .3s ease-out,background-color .3s ease-out}
|
package/dist/styles/index5.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
.popup{opacity:0}.popup-show{opacity:1}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencentcloud/chat-uikit-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@mui/base": "5.0.0-beta.66",
|
|
46
|
-
"tuikit-atomicx-react": "4.
|
|
46
|
+
"tuikit-atomicx-react": "^4.5.3",
|
|
47
47
|
"classnames": "^2.5.1",
|
|
48
48
|
"react-transition-group": "^4.4.5",
|
|
49
49
|
"zustand": "^5.0.0"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@tencentcloud/lite-chat": "^1.6.3",
|
|
103
103
|
"@tencentcloud/tui-core-lite": "~1.0.0",
|
|
104
104
|
"@tencentcloud/chat-uikit-engine-lite": "~1.0.3",
|
|
105
|
-
"@tencentcloud/uikit-base-component-react": "1.1.
|
|
105
|
+
"@tencentcloud/uikit-base-component-react": "^1.1.3",
|
|
106
106
|
"@tencentcloud/universal-api": "^2.4.0"
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import { View, useConversationListState } from 'tuikit-atomicx-react';
|
|
3
2
|
import cs from 'classnames';
|
|
3
|
+
import { View, useConversationListState } from 'tuikit-atomicx-react/chat';
|
|
4
4
|
import { ChatProvider } from '../../context/ChatContext';
|
|
5
5
|
import classes from './Chat.module.scss';
|
|
6
6
|
import type { IChatProps as IChatContextProps } from '../../context/ChatContext';
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
startCall,
|
|
15
15
|
UserPicker,
|
|
16
16
|
useLoginState,
|
|
17
|
-
} from 'tuikit-atomicx-react';
|
|
17
|
+
} from 'tuikit-atomicx-react/chat';
|
|
18
18
|
import classes from './AudioCallPicker.module.scss';
|
|
19
|
-
import type { IUserPickerRef } from 'tuikit-atomicx-react';
|
|
19
|
+
import type { IUserPickerRef } from 'tuikit-atomicx-react/chat';
|
|
20
20
|
|
|
21
21
|
interface AudioCallPickerProps {
|
|
22
22
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { TUIUserService } from '@tencentcloud/chat-uikit-engine-lite';
|
|
4
|
-
import { useMessageInputState } from 'tuikit-atomicx-react';
|
|
4
|
+
import { useMessageInputState } from 'tuikit-atomicx-react/chat';
|
|
5
5
|
import { useChatHeader } from '../../hooks';
|
|
6
6
|
import ChatHeaderUI from './ChatHeaderUI';
|
|
7
|
-
import type { AvatarProps } from 'tuikit-atomicx-react';
|
|
7
|
+
import type { AvatarProps } from 'tuikit-atomicx-react/chat';
|
|
8
8
|
|
|
9
9
|
interface ChatHeaderProps {
|
|
10
10
|
/** Custom title, if not provided, will use conversation info */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { useUIKit } from '@tencentcloud/uikit-base-component-react';
|
|
3
3
|
import cs from 'classnames';
|
|
4
|
-
import { View, Avatar as DefaultAvatar } from 'tuikit-atomicx-react';
|
|
4
|
+
import { View, Avatar as DefaultAvatar } from 'tuikit-atomicx-react/chat';
|
|
5
5
|
import { AudioCallPicker } from '../AudioCallPicker';
|
|
6
6
|
import { VideoCallPicker } from '../VideoCallPicker';
|
|
7
7
|
import classes from './ChatHeaderUI.module.scss';
|
|
8
8
|
import type { UserStatus } from '../../../types/user';
|
|
9
|
-
import type { ConversationModel } from 'tuikit-atomicx-react';
|
|
9
|
+
import type { ConversationModel } from 'tuikit-atomicx-react/chat';
|
|
10
10
|
|
|
11
11
|
interface ChatHeaderUIProps {
|
|
12
12
|
/** Custom title, if not provided, will use conversation info */
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
startCall,
|
|
15
15
|
UserPicker,
|
|
16
16
|
useLoginState,
|
|
17
|
-
} from 'tuikit-atomicx-react';
|
|
17
|
+
} from 'tuikit-atomicx-react/chat';
|
|
18
18
|
import classes from './VideoCallPicker.module.scss';
|
|
19
|
-
import type { IUserPickerRef } from 'tuikit-atomicx-react';
|
|
19
|
+
import type { IUserPickerRef } from 'tuikit-atomicx-react/chat';
|
|
20
20
|
|
|
21
21
|
interface VideoCallPickerProps {
|
|
22
22
|
/**
|
|
@@ -2,11 +2,11 @@ import type { PropsWithChildren } from 'react';
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import TUIChatEngine from '@tencentcloud/chat-uikit-engine-lite';
|
|
4
4
|
import { IconChevronLeft, useUIKit } from '@tencentcloud/uikit-base-component-react';
|
|
5
|
-
import { Avatar } from 'tuikit-atomicx-react';
|
|
5
|
+
import { Avatar } from 'tuikit-atomicx-react/chat';
|
|
6
6
|
import { DivWithEdit } from '../DivWithEdit';
|
|
7
7
|
import { DatePicker } from './DatePicker';
|
|
8
|
-
import type { Profile } from '@tencentcloud/lite-chat';
|
|
9
8
|
import type { UpdateMyProfileParams } from '@tencentcloud/chat-uikit-engine-lite';
|
|
9
|
+
import type { Profile } from '@tencentcloud/lite-chat';
|
|
10
10
|
|
|
11
11
|
const gender: any = {
|
|
12
12
|
[TUIChatEngine.TYPES.GENDER_UNKNOWN]: 'Unknown',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './styles/index.scss';
|
|
3
|
+
import { IconHorizontalMoreTwo } from '@tencentcloud/uikit-base-component-react';
|
|
4
|
+
import { Avatar } from 'tuikit-atomicx-react/chat';
|
|
3
5
|
import { defaultUserAvatar } from '../../../constant/avatar';
|
|
4
6
|
import type { Profile as TProfile } from '@tencentcloud/lite-chat';
|
|
5
|
-
import { Avatar } from 'tuikit-atomicx-react';
|
|
6
|
-
import { IconHorizontalMoreTwo } from '@tencentcloud/uikit-base-component-react';
|
|
7
7
|
|
|
8
8
|
export interface ProfileProps {
|
|
9
9
|
profile?: TProfile | undefined;
|
|
@@ -19,7 +19,7 @@ export function MyProfile<T extends ProfileProps>(props: T) {
|
|
|
19
19
|
<div className="profile-name">{profile.nick || profile.userID}</div>
|
|
20
20
|
</div>
|
|
21
21
|
<div className="profile-more" onClick={handleAvatar}>
|
|
22
|
-
<IconHorizontalMoreTwo size=
|
|
22
|
+
<IconHorizontalMoreTwo size="24px" />
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useConversationListState, ConversationType } from 'tuikit-atomicx-react';
|
|
2
|
+
import { useConversationListState, ConversationType } from 'tuikit-atomicx-react/chat';
|
|
3
3
|
import { useUIManagerState } from '../states';
|
|
4
4
|
import type { UserStatus } from '../types/user';
|
|
5
|
-
import type { ConversationModel } from 'tuikit-atomicx-react';
|
|
5
|
+
import type { ConversationModel } from 'tuikit-atomicx-react/chat';
|
|
6
6
|
|
|
7
7
|
interface UseChatHeaderStoreReturn {
|
|
8
8
|
/** im avatar can't be undefined */
|
package/src/index.ts
CHANGED
|
@@ -2,13 +2,22 @@ import { UIKitProvider, useUIKit } from '@tencentcloud/uikit-base-component-reac
|
|
|
2
2
|
import './locales';
|
|
3
3
|
import './styles/index.scss';
|
|
4
4
|
|
|
5
|
+
// version info
|
|
6
|
+
declare const __CHAT_UIKIT_VERSION__: string;
|
|
7
|
+
declare const __CHAT_UIKIT_NAME__: string;
|
|
8
|
+
|
|
9
|
+
export const version = __CHAT_UIKIT_VERSION__;
|
|
10
|
+
|
|
11
|
+
if (typeof window !== 'undefined') {
|
|
12
|
+
(window as any).__CHAT_UIKIT_REACT__ = { name: __CHAT_UIKIT_NAME__, version: __CHAT_UIKIT_VERSION__ };
|
|
13
|
+
console.log(`[${__CHAT_UIKIT_NAME__}] v${__CHAT_UIKIT_VERSION__}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
export * from './components';
|
|
6
17
|
export * from './context';
|
|
7
18
|
export * from './hooks';
|
|
8
19
|
export * from './states';
|
|
9
20
|
export * from 'tuikit-atomicx-react/chat';
|
|
10
|
-
export * from 'tuikit-atomicx-react/types';
|
|
11
|
-
export { Avatar, useLoginState, LoginStatus, startCall } from 'tuikit-atomicx-react';
|
|
12
21
|
|
|
13
22
|
export {
|
|
14
23
|
UIKitProvider,
|
|
@@ -41,6 +41,8 @@ const TUIConversation = {
|
|
|
41
41
|
'The group chat has been disbanded': 'The group chat has been disbanded',
|
|
42
42
|
'You have left the group chat': 'You have left the group chat',
|
|
43
43
|
'Me': 'Me',
|
|
44
|
+
'someone_at_me': 'You were mentioned',
|
|
45
|
+
'at_all': '@All',
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
export default TUIConversation;
|
package/vite.config.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
6
6
|
import { defineConfig } from 'vite';
|
|
7
7
|
import dts from 'vite-plugin-dts';
|
|
8
8
|
import { libInjectCss } from 'vite-plugin-lib-inject-css';
|
|
9
|
+
import { version, name } from './package.json';
|
|
9
10
|
|
|
10
11
|
// https://vite.dev/config/
|
|
11
12
|
export default defineConfig(({ mode }) => {
|
|
@@ -13,24 +14,43 @@ export default defineConfig(({ mode }) => {
|
|
|
13
14
|
const isDevelopment = mode === 'development';
|
|
14
15
|
|
|
15
16
|
return {
|
|
17
|
+
define: {
|
|
18
|
+
__CHAT_UIKIT_VERSION__: JSON.stringify(version),
|
|
19
|
+
__CHAT_UIKIT_NAME__: JSON.stringify(name),
|
|
20
|
+
},
|
|
21
|
+
resolve: {
|
|
22
|
+
alias: {
|
|
23
|
+
'@': resolve(__dirname, 'src'),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
16
26
|
build: {
|
|
17
27
|
lib: {
|
|
18
28
|
entry: resolve(__dirname, 'src/index.ts'),
|
|
19
29
|
formats: ['es'],
|
|
20
30
|
},
|
|
21
31
|
rollupOptions: {
|
|
22
|
-
external:
|
|
23
|
-
|
|
24
|
-
'react/jsx-runtime'
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
external: (id) => {
|
|
33
|
+
// external react and react-dom
|
|
34
|
+
if (id === 'react' || id === 'react/jsx-runtime' || id.startsWith('react-dom')) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
// external tuikit-atomicx-react and its sub-paths
|
|
38
|
+
if (id === 'tuikit-atomicx-react' || id.startsWith('tuikit-atomicx-react/')) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
// external other peer dependencies
|
|
42
|
+
const externalPeers = [
|
|
43
|
+
'@tencentcloud/lite-chat',
|
|
44
|
+
'@tencentcloud/tui-core-lite',
|
|
45
|
+
'@tencentcloud/universal-api',
|
|
46
|
+
'@tencentcloud/chat-uikit-engine-lite',
|
|
47
|
+
'@tencentcloud/call-uikit-react',
|
|
48
|
+
'@tencentcloud/uikit-base-component-react',
|
|
49
|
+
'zustand',
|
|
50
|
+
'@mui/base',
|
|
51
|
+
];
|
|
52
|
+
return externalPeers.some(peer => id === peer || id.startsWith(`${peer}/`));
|
|
53
|
+
},
|
|
34
54
|
input: getInputEntries(),
|
|
35
55
|
output: {
|
|
36
56
|
format: 'es',
|
|
@@ -45,12 +65,6 @@ export default defineConfig(({ mode }) => {
|
|
|
45
65
|
'external_modules/react-vendors': [
|
|
46
66
|
'react-transition-group',
|
|
47
67
|
],
|
|
48
|
-
'external_modules/mui': [
|
|
49
|
-
'@mui/base',
|
|
50
|
-
],
|
|
51
|
-
'external_modules/zustand': [
|
|
52
|
-
'zustand',
|
|
53
|
-
],
|
|
54
68
|
},
|
|
55
69
|
},
|
|
56
70
|
treeshake: true,
|