@lobehub/ui 1.28.0 → 1.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/es/ActionIconGroup/index.d.ts +13 -2
  3. package/es/Avatar/index.js +9 -4
  4. package/es/Burger/index.d.ts +19 -0
  5. package/es/Burger/style.js +1 -1
  6. package/es/Chat/store/index.d.ts +0 -1
  7. package/es/Chat/store/index.js +1 -2
  8. package/es/ChatInputArea/index.d.ts +41 -0
  9. package/es/ColorScales/index.d.ts +9 -0
  10. package/es/Features/Item.d.ts +36 -2
  11. package/es/Features/index.d.ts +13 -0
  12. package/es/FluentEmoji/index.d.ts +20 -0
  13. package/es/FluentEmoji/index.js +84 -0
  14. package/es/FluentEmoji/style.d.ts +4 -0
  15. package/es/FluentEmoji/style.js +11 -0
  16. package/es/FontLoader/index.d.ts +3 -0
  17. package/es/Footer/index.d.ts +18 -4
  18. package/es/GradientButton/index.d.ts +4 -0
  19. package/es/Header/index.d.ts +27 -0
  20. package/es/Hero/index.d.ts +27 -0
  21. package/es/Input/index.d.ts +23 -4
  22. package/es/Layout/index.d.ts +31 -0
  23. package/es/Logo/index.js +9 -8
  24. package/es/Logo/style.d.ts +2 -0
  25. package/es/Logo/style.js +2 -0
  26. package/es/MessageInput/index.d.ts +15 -15
  27. package/es/MessageInput/index.js +0 -6
  28. package/es/ThemeProvider/GlobalStyle.js +1 -1
  29. package/es/ThemeProvider/index.d.ts +4 -0
  30. package/es/ThemeProvider/index.js +28 -25
  31. package/es/Toc/TocMobile.d.ts +30 -0
  32. package/es/Toc/index.d.ts +4 -0
  33. package/es/TokenTag/index.d.ts +6 -0
  34. package/es/TokenTag/index.js +5 -4
  35. package/es/TokenTag/style.d.ts +1 -1
  36. package/es/TokenTag/style.js +3 -4
  37. package/es/components/ControlInput.d.ts +12 -0
  38. package/es/hooks/useHighlight.d.ts +8 -8
  39. package/es/index.d.ts +1 -1
  40. package/es/index.js +1 -1
  41. package/es/styles/theme/base.js +1 -1
  42. package/es/utils/getEmojiByCharacter.d.ts +2 -0
  43. package/es/utils/getEmojiByCharacter.js +15 -0
  44. package/package.json +3 -2
  45. package/es/Chat/store/selectors.d.ts +0 -9
  46. package/es/Chat/store/selectors.js +0 -44
  47. package/es/Conversation/App.d.ts +0 -15
  48. package/es/Conversation/App.js +0 -43
  49. package/es/Conversation/ChatList/MessageItem/Content.d.ts +0 -8
  50. package/es/Conversation/ChatList/MessageItem/Content.js +0 -104
  51. package/es/Conversation/ChatList/MessageItem/Toolbar.d.ts +0 -10
  52. package/es/Conversation/ChatList/MessageItem/Toolbar.js +0 -91
  53. package/es/Conversation/ChatList/MessageItem/index.d.ts +0 -9
  54. package/es/Conversation/ChatList/MessageItem/index.js +0 -126
  55. package/es/Conversation/ChatList/index.d.ts +0 -14
  56. package/es/Conversation/ChatList/index.js +0 -62
  57. package/es/Conversation/InputArea/ActionBar.d.ts +0 -4
  58. package/es/Conversation/InputArea/ActionBar.js +0 -71
  59. package/es/Conversation/InputArea/index.d.ts +0 -4
  60. package/es/Conversation/InputArea/index.js +0 -99
  61. package/es/Conversation/StoreUpdater.d.ts +0 -7
  62. package/es/Conversation/StoreUpdater.js +0 -25
  63. package/es/Conversation/index.d.ts +0 -12
  64. package/es/Conversation/index.js +0 -28
  65. package/es/Logo/LogoFlat.d.ts +0 -3
  66. package/es/Logo/LogoFlat.js +0 -105
package/es/Logo/index.js CHANGED
@@ -6,10 +6,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
  import { useTheme } from 'antd-style';
7
7
  import { memo } from 'react';
8
8
  import Divider from "./Divider";
9
- import LogoFlat from "./LogoFlat";
10
9
  import LogoHighContrast from "./LogoHighContrast";
11
10
  import LogoText from "./LogoText";
12
- import { useStyles } from "./style";
11
+ import { LOGO_3D, LOGO_FLAT, useStyles } from "./style";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  import { Fragment as _Fragment } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -32,7 +31,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
32
31
  {
33
32
  return /*#__PURE__*/_jsx("img", _objectSpread({
34
33
  alt: "lobehub",
35
- src: "https://npm.elemecdn.com/@lobehub/assets/logo/logo-3d.webp",
34
+ src: LOGO_3D,
36
35
  style: _objectSpread({
37
36
  height: size,
38
37
  width: size
@@ -41,12 +40,14 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
41
40
  }
42
41
  case 'flat':
43
42
  {
44
- return /*#__PURE__*/_jsx(LogoFlat, _objectSpread({
43
+ return /*#__PURE__*/_jsx("img", {
44
+ alt: "lobehub",
45
+ src: LOGO_FLAT,
45
46
  style: _objectSpread({
46
47
  height: size,
47
48
  width: size
48
49
  }, style)
49
- }, props));
50
+ });
50
51
  }
51
52
  case 'high-contrast':
52
53
  {
@@ -71,11 +72,11 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
71
72
  logoComponent = /*#__PURE__*/_jsxs(_Fragment, {
72
73
  children: [/*#__PURE__*/_jsx("img", {
73
74
  alt: "lobehub",
74
- src: "https://npm.elemecdn.com/@lobehub/assets/logo/logo-3d.webp",
75
- style: _objectSpread({
75
+ src: LOGO_3D,
76
+ style: {
76
77
  height: size,
77
78
  width: size
78
- }, style)
79
+ }
79
80
  }), /*#__PURE__*/_jsx(LogoText, {
80
81
  style: {
81
82
  height: size,
@@ -1,3 +1,5 @@
1
+ export declare const LOGO_3D = "https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-3d.webp";
2
+ export declare const LOGO_FLAT = "https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-flat.svg";
1
3
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
4
  extraTitle: import("antd-style").SerializedStyles;
3
5
  flexCenter: import("antd-style").SerializedStyles;
package/es/Logo/style.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2;
3
3
  import { createStyles } from 'antd-style';
4
+ export var LOGO_3D = 'https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-3d.webp';
5
+ export var LOGO_FLAT = 'https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-flat.svg';
4
6
  export var useStyles = createStyles(function (_ref) {
5
7
  var css = _ref.css;
6
8
  return {
@@ -1,36 +1,36 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from 'antd';
3
3
  import { type TextAreaProps } from "../Input";
4
- /**
5
- * @title MessageInputProps
6
- * @category Props
7
- * @description MessageInput 组件的 Props
8
- */
9
4
  export interface MessageInputProps {
5
+ /**
6
+ * @description Additional className to apply to the component.
7
+ */
10
8
  className?: string;
11
9
  /**
12
- * @title 默认值
13
- * @description 输入框的默认值
10
+ * @description The default value of the input box.
14
11
  */
15
12
  defaultValue?: string;
13
+ /**
14
+ * @description The height of the input box.
15
+ */
16
16
  height?: number;
17
17
  /**
18
- * @title 取消回调函数
19
- * @description 用户点击取消按钮后的回调函数
18
+ * @description Callback function triggered when user clicks on the cancel button.
20
19
  */
21
20
  onCancel?: () => void;
22
21
  /**
23
- * @title 确认回调函数
24
- * @description 用户点击确认按钮后的回调函数
25
- * @param text - 用户输入的文本
22
+ * @description Callback function triggered when user clicks on the confirm button.
23
+ * @param text - The text input by the user.
26
24
  */
27
25
  onConfirm?: (text: string) => void;
28
26
  /**
29
- * @title 渲染按钮
30
- * @description 自定义渲染底部按钮
31
- * @param text - 用户输入的文本
27
+ * @description Custom rendering of the bottom buttons.
28
+ * @param text - The text input by the user.
32
29
  */
33
30
  renderButtons?: (text: string) => ButtonProps[];
31
+ /**
32
+ * @description The type of the input box.
33
+ */
34
34
  type?: TextAreaProps['type'];
35
35
  }
36
36
  declare const MessageInput: import("react").NamedExoticComponent<MessageInputProps>;
@@ -7,12 +7,6 @@ import { cx } from 'antd-style';
7
7
  import { memo, useState } from 'react';
8
8
  import { Flexbox } from 'react-layout-kit';
9
9
  import { TextArea } from "../Input";
10
-
11
- /**
12
- * @title MessageInputProps
13
- * @category Props
14
- * @description MessageInput 组件的 Props
15
- */
16
10
  import { jsx as _jsx } from "react/jsx-runtime";
17
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
18
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject;
3
3
  import { createGlobalStyle } from 'antd-style';
4
- var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n html,body {\n --font-settings: \"cv01\", \"tnum\", \"kern\";\n --font-variations: \"opsz\" auto, tabular-nums;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n vertical-align: baseline;\n\n color-scheme: dark;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-overflow-scrolling:touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n body {\n overflow-x: hidden;\n height: 100vh;\n }\n\n #root {\n min-height: 100vh;\n }\n\n code {\n font-family: ", " !important;\n\n span {\n font-family: ", " !important;\n }\n }\n\n p {\n text-align: justify;\n word-wrap: break-word;\n }\n\n ::selection {\n color: #000;\n background: ", ";\n }\n\n * {\n\t box-sizing: border-box;\n\t vertical-align: baseline;\n }\n\n @media only screen and (min-width: 574px) {\n * {\n ::-webkit-scrollbar {\n cursor: pointer;\n width: 4px;\n height: 4px;\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n cursor: pointer;\n background-color: transparent;\n border-radius: 2px;\n transition: background-color 500ms ", ";\n\n &:hover {\n background-color: ", ";\n }\n }\n\n ::-webkit-scrollbar-corner {\n display: none;\n width: 0;\n height: 0;\n }\n\n &:hover {\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n }\n }\n }\n }\n"])), function (_ref) {
4
+ var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n html,body {\n --font-settings: \"cv01\", \"tnum\", \"kern\";\n --font-variations: \"opsz\" auto, tabular-nums;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n vertical-align: baseline;\n\n color-scheme: dark;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-overflow-scrolling:touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n body {\n overflow-x: hidden;\n height: 100vh;\n }\n\n #root {\n min-height: 100vh;\n }\n\n code {\n font-family: ", " !important;\n\n span {\n font-family: ", " !important;\n }\n }\n\n p {\n text-align: justify;\n word-wrap: break-word;\n }\n\n ::selection {\n color: #000;\n background: ", ";\n\n\t -webkit-text-fill-color: unset !important;\n }\n\n * {\n\t box-sizing: border-box;\n\t vertical-align: baseline;\n }\n\n @media only screen and (min-width: 574px) {\n * {\n ::-webkit-scrollbar {\n cursor: pointer;\n width: 4px;\n height: 4px;\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n cursor: pointer;\n background-color: transparent;\n border-radius: 2px;\n transition: background-color 500ms ", ";\n\n &:hover {\n background-color: ", ";\n }\n }\n\n ::-webkit-scrollbar-corner {\n display: none;\n width: 0;\n height: 0;\n }\n\n &:hover {\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n }\n }\n }\n }\n"])), function (_ref) {
5
5
  var theme = _ref.theme;
6
6
  return theme.fontFamily;
7
7
  }, function (_ref2) {
@@ -30,6 +30,10 @@ export interface ThemeProviderProps {
30
30
  * @description The mode of the theme (light or dark)
31
31
  */
32
32
  themeMode?: ThemeMode;
33
+ /**
34
+ * @description Webfont loader css strings
35
+ */
36
+ webfonts?: string[];
33
37
  }
34
38
  declare const ThemeProvider: import("react").NamedExoticComponent<ThemeProviderProps>;
35
39
  export default ThemeProvider;
@@ -10,6 +10,7 @@ import { lobeCustomStylish, lobeCustomToken, lobeTheme } from "../styles";
10
10
  import GlobalStyle from "./GlobalStyle";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
14
  var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
14
15
  var children = _ref.children,
15
16
  themeMode = _ref.themeMode,
@@ -20,35 +21,37 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
20
21
  _ref$customToken = _ref.customToken,
21
22
  _customToken = _ref$customToken === void 0 ? function () {
22
23
  return {};
23
- } : _ref$customToken;
24
+ } : _ref$customToken,
25
+ _ref$webfonts = _ref.webfonts,
26
+ webfonts = _ref$webfonts === void 0 ? ['https://npm.elemecdn.com/@lobehub/webfont-mono/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans-sc/css/index.css'] : _ref$webfonts;
24
27
  setupStyled({
25
28
  ThemeContext: ThemeContext
26
29
  });
27
- return /*#__PURE__*/_jsx(StyleProvider, {
28
- speedy: process.env.NODE_ENV === 'production',
29
- children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
30
- customStylish: function customStylish(theme) {
31
- return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), _customStylish(theme));
32
- },
33
- customToken: function customToken(theme) {
34
- return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), _customToken(theme));
35
- },
36
- theme: lobeTheme,
37
- themeMode: themeMode,
38
- children: [/*#__PURE__*/_jsx(FontLoader, {
39
- url: "https://npm.elemecdn.com/@lobehub/assets@1.2.0/webfonts/css/hack-nerd-font-mono.css"
40
- }), /*#__PURE__*/_jsx(FontLoader, {
41
- url: "https://npm.elemecdn.com/@lobehub/assets@1.2.0/webfonts/css/harmonyos-sans.css"
42
- }), /*#__PURE__*/_jsx(FontLoader, {
43
- url: "https://npm.elemecdn.com/@lobehub/assets@1.2.0/webfonts/css/harmonyos-sans-sc.css"
44
- }), /*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
45
- style: {
46
- minHeight: 'inherit',
47
- width: 'inherit'
30
+ return /*#__PURE__*/_jsxs(_Fragment, {
31
+ children: [webfonts && webfonts.map(function (webfont, index) {
32
+ return /*#__PURE__*/_jsx(FontLoader, {
33
+ url: webfont
34
+ }, index);
35
+ }), /*#__PURE__*/_jsx(StyleProvider, {
36
+ speedy: process.env.NODE_ENV === 'production',
37
+ children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
38
+ customStylish: function customStylish(theme) {
39
+ return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), _customStylish(theme));
48
40
  },
49
- children: children
50
- })]
51
- })
41
+ customToken: function customToken(theme) {
42
+ return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), _customToken(theme));
43
+ },
44
+ theme: lobeTheme,
45
+ themeMode: themeMode,
46
+ children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
47
+ style: {
48
+ minHeight: 'inherit',
49
+ width: 'inherit'
50
+ },
51
+ children: children
52
+ })]
53
+ })
54
+ })]
52
55
  });
53
56
  });
54
57
  export default ThemeProvider;
@@ -1,16 +1,46 @@
1
1
  /// <reference types="react" />
2
2
  import { AnchorProps } from 'antd';
3
3
  export interface AnchorItem {
4
+ /**
5
+ * @description The children of the anchor item
6
+ */
4
7
  children?: AnchorItem[];
8
+ /**
9
+ * @description The ID of the anchor item
10
+ */
5
11
  id: string;
12
+ /**
13
+ * @description The title of the anchor item
14
+ */
6
15
  title: string;
7
16
  }
8
17
  export interface TocMobileProps {
18
+ /**
19
+ * @description The active key of the TocMobile component
20
+ * @default undefined
21
+ */
9
22
  activeKey?: string;
23
+ /**
24
+ * @description The function to get the container of the anchor
25
+ */
10
26
  getContainer?: AnchorProps['getContainer'];
27
+ /**
28
+ * @description The height of the header
29
+ * @default 64
30
+ */
11
31
  headerHeight?: number;
32
+ /**
33
+ * @description The array of anchor items to be displayed
34
+ */
12
35
  items: AnchorItem[];
36
+ /**
37
+ * @description The function to be called when the active key changes
38
+ */
13
39
  onChange?: (activeKey: string) => void;
40
+ /**
41
+ * @description The width of the toc
42
+ * @default 176
43
+ */
14
44
  tocWidth?: number;
15
45
  }
16
46
  export declare const mapItems: (items: AnchorItem[]) => {
package/es/Toc/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { type TocMobileProps } from './TocMobile';
3
3
  export interface TocProps extends TocMobileProps {
4
+ /**
5
+ * @description Whether the component is being rendered on a mobile device or not
6
+ * @default false
7
+ */
4
8
  isMobile?: boolean;
5
9
  }
6
10
  declare const Toc: import("react").NamedExoticComponent<TocProps>;
@@ -1,7 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { DivProps } from "../types";
3
3
  export interface TokenTagProps extends DivProps {
4
+ /**
5
+ * @description Maximum value for the token
6
+ */
4
7
  maxValue: number;
8
+ /**
9
+ * @description Current value of the token
10
+ */
5
11
  value: number;
6
12
  }
7
13
  declare const TokenTag: import("react").NamedExoticComponent<TokenTagProps>;
@@ -4,7 +4,8 @@ var _excluded = ["className", "maxValue", "value"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import { memo } from 'react';
7
- import { useStyles } from "./style";
7
+ import FluentEmoji from "../FluentEmoji";
8
+ import { ICON_SIZE, useStyles } from "./style";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
11
  var TokenTag = /*#__PURE__*/memo(function (_ref) {
@@ -32,9 +33,9 @@ var TokenTag = /*#__PURE__*/memo(function (_ref) {
32
33
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
33
34
  className: cx(styles.container, className)
34
35
  }, props), {}, {
35
- children: [/*#__PURE__*/_jsx("span", {
36
- className: styles.emoji,
37
- children: emoji
36
+ children: [/*#__PURE__*/_jsx(FluentEmoji, {
37
+ emoji: emoji,
38
+ size: ICON_SIZE
38
39
  }), valueLeft > 0 ? "Tokens ".concat(valueLeft) : "Overload"]
39
40
  }));
40
41
  });
@@ -1,4 +1,4 @@
1
+ export declare const ICON_SIZE = 20;
1
2
  export declare const useStyles: (props?: "normal" | "low" | "overload" | undefined) => import("antd-style").ReturnStyles<{
2
3
  container: string;
3
- emoji: import("antd-style").SerializedStyles;
4
4
  }>;
@@ -1,8 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
3
  import { createStyles } from 'antd-style';
4
4
  var HEIGHT = 28;
5
- var ICON_SIZE = 20;
5
+ export var ICON_SIZE = 20;
6
6
  export var useStyles = createStyles(function (_ref, type) {
7
7
  var cx = _ref.cx,
8
8
  css = _ref.css,
@@ -26,7 +26,6 @@ export var useStyles = createStyles(function (_ref, type) {
26
26
  }
27
27
  }
28
28
  return {
29
- container: cx(percentStyle, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: flex;\n gap: 4px;\n align-items: center;\n\n height: ", "px;\n padding: 0 ", "px 0 ", "px;\n\n background: ", ";\n border-radius: ", "px;\n "])), HEIGHT, HEIGHT - ICON_SIZE, (HEIGHT - ICON_SIZE) / 2, token.colorFillSecondary, HEIGHT / 2)),
30
- emoji: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: ", "px;\n "])), ICON_SIZE)
29
+ container: cx(percentStyle, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n user-select: none;\n\n overflow: hidden;\n display: flex;\n gap: 4px;\n align-items: center;\n\n height: ", "px;\n padding: 0 ", "px 0 ", "px;\n\n font-family: ", ";\n\n background: ", ";\n border-radius: ", "px;\n "])), HEIGHT, (HEIGHT - ICON_SIZE) * 1.2, (HEIGHT - ICON_SIZE) / 2, token.fontFamilyCode, token.colorFillSecondary, HEIGHT / 2))
31
30
  };
32
31
  });
@@ -1,9 +1,21 @@
1
1
  /// <reference types="react" />
2
2
  import { InputProps } from "../Input";
3
3
  export interface ControlInputProps extends Omit<InputProps, 'onChange' | 'value' | 'onAbort'> {
4
+ /**
5
+ * @description Callback function that is triggered when the input value changes
6
+ */
4
7
  onChange?: (value: string) => void;
8
+ /**
9
+ * @description Callback function that is triggered when the input value has stopped changing
10
+ */
5
11
  onChangeEnd?: (value: string) => void;
12
+ /**
13
+ * @description Callback function that is triggered when the input value is changing
14
+ */
6
15
  onValueChanging?: (value: string) => void;
16
+ /**
17
+ * @description The initial value of the input
18
+ */
7
19
  value?: string;
8
20
  }
9
21
  export declare const ControlInput: import("react").NamedExoticComponent<ControlInputProps>;
@@ -5,20 +5,20 @@ export declare const languageMap: readonly ["javascript", "js", "jsx", "json", "
5
5
  */
6
6
  interface Store {
7
7
  /**
8
- * @title 将代码转化为 HTML 字符串
9
- * @param text - 代码文本
10
- * @param language - 代码语言
11
- * @param isDarkMode - 是否为暗黑模式
12
- * @returns HTML 字符串
8
+ * @title Convert code to HTML string
9
+ * @param text - The code text
10
+ * @param language - The language of the code
11
+ * @param isDarkMode - Whether it's in dark mode or not
12
+ * @returns HTML string
13
13
  */
14
14
  codeToHtml: (text: string, language: string, isDarkMode: boolean) => string;
15
15
  /**
16
- * @title 高亮器对象
16
+ * @title Highlighter object
17
17
  */
18
18
  highlighter?: Highlighter;
19
19
  /**
20
- * @title 初始化高亮器对象
21
- * @returns 初始化 Promise 对象
20
+ * @title Initialize the highlighter object
21
+ * @returns Initialization promise object
22
22
  */
23
23
  initHighlighter: () => Promise<void>;
24
24
  }
package/es/index.d.ts CHANGED
@@ -8,13 +8,13 @@ export { default as ChatItem, type ChatItemProps } from './ChatItem';
8
8
  export { default as ChatList, type ChatListProps } from './ChatList';
9
9
  export { default as ColorScales, type ColorScalesProps } from './ColorScales';
10
10
  export { default as ContextMenu, type ContextMenuProps } from './ContextMenu';
11
- export { default as Conversation, type ConversationProps } from './Conversation';
12
11
  export { default as CopyButton, type CopyButtonProps } from './CopyButton';
13
12
  export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
14
13
  export { default as EditableMessage, type EditableMessageProps } from './EditableMessage';
15
14
  export { default as EditableMessageList, type EditableMessageListProps, } from './EditableMessageList';
16
15
  export { default as EditableText, type EditableTextProps } from './EditableText';
17
16
  export { type FeatureItem, default as Features, type FeaturesProps } from './Features';
17
+ export { default as FluentEmoji, type FluentEmojiProps } from './FluentEmoji';
18
18
  export { default as FontLoader, type FontLoaderProps } from './FontLoader';
19
19
  export { default as Footer, type FooterProps } from './Footer';
20
20
  export { default as GradientButton, type GradientButtonProps } from './GradientButton';
package/es/index.js CHANGED
@@ -7,13 +7,13 @@ export { default as ChatItem } from "./ChatItem";
7
7
  export { default as ChatList } from "./ChatList";
8
8
  export { default as ColorScales } from "./ColorScales";
9
9
  export { default as ContextMenu } from "./ContextMenu";
10
- export { default as Conversation } from "./Conversation";
11
10
  export { default as CopyButton } from "./CopyButton";
12
11
  export { default as DraggablePanel } from "./DraggablePanel";
13
12
  export { default as EditableMessage } from "./EditableMessage";
14
13
  export { default as EditableMessageList } from "./EditableMessageList";
15
14
  export { default as EditableText } from "./EditableText";
16
15
  export { default as Features } from "./Features";
16
+ export { default as FluentEmoji } from "./FluentEmoji";
17
17
  export { default as FontLoader } from "./FontLoader";
18
18
  export { default as Footer } from "./Footer";
19
19
  export { default as GradientButton } from "./GradientButton";
@@ -1,7 +1,7 @@
1
1
  var FONT_EMOJI = "\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Apple Color Emoji\",\"Twemoji Mozilla\",\"Noto Color Emoji\",\"Android Emoji\"";
2
2
  var FONT_EN = "\"HarmonyOS Sans\",\"Segoe UI\",\"SF Pro Display\",-apple-system,BlinkMacSystemFont,Roboto,Oxygen,Ubuntu,Cantarell,\"Open Sans\",\"Helvetica Neue\",sans-serif";
3
3
  var FONT_CN = "\"HarmonyOS Sans SC\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft Yahei UI\",\"Microsoft Yahei\",\"Source Han Sans CN\",sans-serif";
4
- var FONT_CODE = "\"Hack Nerd Font Mono\",ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace";
4
+ var FONT_CODE = "Hack,ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace";
5
5
  export var baseToken = {
6
6
  borderRadius: 5,
7
7
  borderRadiusLG: 8,
@@ -0,0 +1,2 @@
1
+ export declare const getEmoji: (emoji: string) => string | undefined;
2
+ export declare const getEmojiNameByCharacter: (emoji: string) => string | undefined;
@@ -0,0 +1,15 @@
1
+ import emojiRegex from 'emoji-regex';
2
+ import emojilib from 'emojilib';
3
+ export var getEmoji = function getEmoji(emoji) {
4
+ var _emoji$match;
5
+ var regex = emojiRegex();
6
+ var pureEmoji = (_emoji$match = emoji.match(regex)) === null || _emoji$match === void 0 ? void 0 : _emoji$match[0];
7
+ return pureEmoji;
8
+ };
9
+ export var getEmojiNameByCharacter = function getEmojiNameByCharacter(emoji) {
10
+ var _EmojiLab$pureEmoji;
11
+ var pureEmoji = getEmoji(emoji);
12
+ if (!pureEmoji) return;
13
+ var EmojiLab = emojilib;
14
+ return EmojiLab === null || EmojiLab === void 0 ? void 0 : (_EmojiLab$pureEmoji = EmojiLab[pureEmoji]) === null || _EmojiLab$pureEmoji === void 0 ? void 0 : _EmojiLab$pureEmoji[0];
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.28.0",
3
+ "version": "1.29.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building chatbot web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -73,7 +73,6 @@
73
73
  "@ant-design/colors": "^7",
74
74
  "@ant-design/icons": "^5",
75
75
  "@babel/runtime": "^7",
76
- "@dqbd/tiktoken": "^1",
77
76
  "@floating-ui/react": "^0",
78
77
  "@react-spring/web": "^9",
79
78
  "ahooks": "^3",
@@ -81,6 +80,8 @@
81
80
  "chroma-js": "^2",
82
81
  "copy-to-clipboard": "^3",
83
82
  "dayjs": "^1",
83
+ "emoji-regex": "^10",
84
+ "emojilib": "^3",
84
85
  "fast-deep-equal": "^3",
85
86
  "immer": "^10",
86
87
  "leva": "^0",
@@ -1,9 +0,0 @@
1
- import type { ChatStore } from './store';
2
- export declare const chatSelectors: {
3
- agentTokenCount: (s: ChatStore) => number;
4
- disableInput: (s: ChatStore) => boolean;
5
- messagesTokenCount: (s: ChatStore) => number;
6
- messagesTokens: (s: ChatStore) => number[];
7
- totalTokenCount: (s: ChatStore) => number;
8
- totalTokens: (s: ChatStore) => number[];
9
- };
@@ -1,44 +0,0 @@
1
- import { get_encoding } from '@dqbd/tiktoken';
2
- var tiktoken = get_encoding('cl100k_base');
3
- var encode = function encode(text) {
4
- if (!text) return [];
5
- var tokens = tiktoken.encode(text);
6
- return tokens;
7
- };
8
- var disableInputSel = function disableInputSel(s) {
9
- return s.changingSystemRole;
10
- };
11
- var messagesTokens = function messagesTokens(s) {
12
- return encode(s.messages.map(function (m) {
13
- return m.content;
14
- }).join(''));
15
- };
16
- var agentContentTokens = function agentContentTokens(s) {
17
- return encode(s.messages.filter(function (s) {
18
- return s.role === 'system';
19
- }).map(function (c) {
20
- return c.content;
21
- }).join('') || '');
22
- };
23
- var totalTokens = function totalTokens(s) {
24
- return encode(s.messages.map(function (m) {
25
- return m.content;
26
- }).join(''));
27
- };
28
- var totalTokenCount = function totalTokenCount(s) {
29
- return totalTokens(s).length;
30
- };
31
- var agentTokenCount = function agentTokenCount(s) {
32
- return agentContentTokens(s).length;
33
- };
34
- var messagesTokenCount = function messagesTokenCount(s) {
35
- return messagesTokens(s).length;
36
- };
37
- export var chatSelectors = {
38
- agentTokenCount: agentTokenCount,
39
- disableInput: disableInputSel,
40
- messagesTokenCount: messagesTokenCount,
41
- messagesTokens: messagesTokens,
42
- totalTokenCount: totalTokenCount,
43
- totalTokens: totalTokens
44
- };
@@ -1,15 +0,0 @@
1
- /// <reference types="react" />
2
- export interface AppProps {
3
- /**
4
- * @description Whether to include system messages in the chat.
5
- * @default true
6
- */
7
- includeSystem?: boolean;
8
- /**
9
- * @description Whether the component is in readonly mode.
10
- * @default false
11
- */
12
- readonly?: boolean;
13
- }
14
- declare const _default: import("react").NamedExoticComponent<AppProps>;
15
- export default _default;
@@ -1,43 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { Typography } from 'antd';
3
- import isEqual from 'fast-deep-equal';
4
- import { memo } from 'react';
5
- import { Flexbox } from 'react-layout-kit';
6
- import { useStore } from "../Chat/store";
7
- import ChatList from "./ChatList";
8
- import InputArea from "./InputArea";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
- var ChatContainer = function ChatContainer(_ref) {
12
- var readonly = _ref.readonly,
13
- _ref$includeSystem = _ref.includeSystem,
14
- includeSystem = _ref$includeSystem === void 0 ? true : _ref$includeSystem;
15
- var _useStore = useStore(function (s) {
16
- return [!s.changingSystemRole, s.title, s.description];
17
- }, isEqual),
18
- _useStore2 = _slicedToArray(_useStore, 3),
19
- showInput = _useStore2[0],
20
- title = _useStore2[1],
21
- description = _useStore2[2];
22
- if (readonly) return /*#__PURE__*/_jsx(ChatList, {
23
- includeSystem: includeSystem,
24
- readonly: true
25
- });
26
- return /*#__PURE__*/_jsxs(Flexbox, {
27
- gap: 24,
28
- height: '100%',
29
- width: '100%',
30
- children: [title || description ? /*#__PURE__*/_jsxs(Flexbox, {
31
- children: [/*#__PURE__*/_jsx(Typography.Title, {
32
- level: 4,
33
- children: title
34
- }), /*#__PURE__*/_jsx(Typography.Text, {
35
- type: 'secondary',
36
- children: description
37
- })]
38
- }) : undefined, /*#__PURE__*/_jsx(ChatList, {
39
- includeSystem: includeSystem
40
- }), showInput ? /*#__PURE__*/_jsx(InputArea, {}) : undefined]
41
- });
42
- };
43
- export default /*#__PURE__*/memo(ChatContainer);
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- import { ChatMessage } from "../../../Chat/types";
3
- export interface ContentProps extends Pick<ChatMessage, 'content' | 'role' | 'error'> {
4
- index: number;
5
- loading: boolean;
6
- }
7
- declare const Content: FC<ContentProps>;
8
- export default Content;