@lobehub/ui 1.95.1-beta.1 → 1.96.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.
Files changed (40) hide show
  1. package/es/ChatList/HistoryDivider.d.ts +9 -0
  2. package/es/ChatList/HistoryDivider.js +25 -0
  3. package/es/ChatList/Item.d.ts +1 -0
  4. package/es/ChatList/index.d.ts +2 -0
  5. package/es/ChatList/index.js +27 -9
  6. package/es/ColorScales/index.d.ts +1 -1
  7. package/es/FontLoader/index.js +2 -5
  8. package/es/Giscus/style.js +1 -1
  9. package/es/Highlighter/theme.js +1 -1
  10. package/es/ThemeProvider/GlobalStyle/antdOverride.js +1 -2
  11. package/es/ThemeProvider/index.d.ts +23 -8
  12. package/es/ThemeProvider/index.js +10 -22
  13. package/es/styles/{colors → algorithms}/generateColorPalette.d.ts +1 -1
  14. package/es/styles/algorithms/generateCustomTheme.d.ts +9 -0
  15. package/es/styles/{theme/algorithms/lightAlgorithm.js → algorithms/generateCustomTheme.js} +17 -15
  16. package/es/styles/{theme/customToken.js → algorithms/generateCustomToken.js} +3 -1
  17. package/es/styles/algorithms/generateTheme.d.ts +5 -0
  18. package/es/styles/{theme/antdTheme.js → algorithms/generateTheme.js} +16 -22
  19. package/es/styles/customTheme.js +2 -2
  20. package/es/styles/index.d.ts +8 -6
  21. package/es/styles/index.js +8 -6
  22. package/es/styles/theme/{token/dark.js → dark.js} +4 -3
  23. package/es/styles/theme/{token/light.js → light.js} +4 -3
  24. package/package.json +1 -1
  25. package/es/styles/theme/algorithms/darkAlgorithm.d.ts +0 -2
  26. package/es/styles/theme/algorithms/darkAlgorithm.js +0 -32
  27. package/es/styles/theme/algorithms/lightAlgorithm.d.ts +0 -2
  28. package/es/styles/theme/antdTheme.d.ts +0 -15
  29. /package/es/styles/{colors → algorithms}/generateColorPalette.js +0 -0
  30. /package/es/styles/{theme/customStylish.d.ts → algorithms/generateCustomStylish.d.ts} +0 -0
  31. /package/es/styles/{theme/customStylish.js → algorithms/generateCustomStylish.js} +0 -0
  32. /package/es/styles/{theme/customToken.d.ts → algorithms/generateCustomToken.d.ts} +0 -0
  33. /package/es/styles/{colors/colors.d.ts → colors.d.ts} +0 -0
  34. /package/es/styles/{colors/colors.js → colors.js} +0 -0
  35. /package/es/styles/{colors/neutralColors.d.ts → neutralColors.d.ts} +0 -0
  36. /package/es/styles/{colors/neutralColors.js → neutralColors.js} +0 -0
  37. /package/es/styles/theme/{token/base.d.ts → base.d.ts} +0 -0
  38. /package/es/styles/theme/{token/base.js → base.js} +0 -0
  39. /package/es/styles/theme/{token/dark.d.ts → dark.d.ts} +0 -0
  40. /package/es/styles/theme/{token/light.d.ts → light.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface HistoryDividerProps {
3
+ enable?: boolean;
4
+ text?: {
5
+ history?: string;
6
+ };
7
+ }
8
+ declare const HistoryDivider: import("react").NamedExoticComponent<HistoryDividerProps>;
9
+ export default HistoryDivider;
@@ -0,0 +1,25 @@
1
+ import { Divider } from 'antd';
2
+ import { Timer } from 'lucide-react';
3
+ import { memo } from 'react';
4
+ import Icon from "../Icon";
5
+ import Tag from "../Tag";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ var HistoryDivider = /*#__PURE__*/memo(function (_ref) {
8
+ var enable = _ref.enable,
9
+ text = _ref.text;
10
+ if (!enable) return null;
11
+ return /*#__PURE__*/_jsx("div", {
12
+ style: {
13
+ padding: '0 20px'
14
+ },
15
+ children: /*#__PURE__*/_jsx(Divider, {
16
+ children: /*#__PURE__*/_jsx(Tag, {
17
+ icon: /*#__PURE__*/_jsx(Icon, {
18
+ icon: Timer
19
+ }),
20
+ children: (text === null || text === void 0 ? void 0 : text.history) || 'History Message'
21
+ })
22
+ })
23
+ });
24
+ });
25
+ export default HistoryDivider;
@@ -45,6 +45,7 @@ export interface ListItemProps {
45
45
  */
46
46
  text?: ChatItemProps['text'] & ActionsBarProps['text'] & {
47
47
  copySuccess?: string;
48
+ history?: string;
48
49
  };
49
50
  /**
50
51
  * @description 聊天列表的类型
@@ -6,6 +6,8 @@ export interface ChatListProps extends DivProps, ListItemProps {
6
6
  * @description Data of chat messages to be displayed
7
7
  */
8
8
  data: ChatMessage[];
9
+ enableHistoryCount?: boolean;
10
+ historyCount?: number;
9
11
  loadingId?: string;
10
12
  }
11
13
  export type { OnActionClick, OnMessageChange, RenderErrorMessage, RenderMessage } from './Item';
@@ -1,13 +1,16 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["onActionClick", "renderMessageExtra", "className", "data", "type", "text", "showTitle", "onMessageChange", "renderMessage", "renderErrorMessage", "loadingId", "renderItem"];
3
+ var _excluded = ["onActionClick", "renderMessageExtra", "className", "data", "type", "text", "showTitle", "onMessageChange", "renderMessage", "renderErrorMessage", "loadingId", "renderItem", "enableHistoryCount", "historyCount"];
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
7
  import Group from "./Group";
8
+ import HistoryDivider from "./HistoryDivider";
8
9
  import Item from "./Item";
9
10
  import { useStyles } from "./style";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
14
  var ChatList = /*#__PURE__*/memo(function (_ref) {
12
15
  var onActionClick = _ref.onActionClick,
13
16
  MessageExtra = _ref.renderMessageExtra,
@@ -22,6 +25,9 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
22
25
  renderErrorMessage = _ref.renderErrorMessage,
23
26
  loadingId = _ref.loadingId,
24
27
  renderItem = _ref.renderItem,
28
+ enableHistoryCount = _ref.enableHistoryCount,
29
+ _ref$historyCount = _ref.historyCount,
30
+ historyCount = _ref$historyCount === void 0 ? 0 : _ref$historyCount,
25
31
  props = _objectWithoutProperties(_ref, _excluded);
26
32
  var _useStyles = useStyles(),
27
33
  cx = _useStyles.cx,
@@ -29,7 +35,7 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
29
35
  return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
30
36
  className: cx(styles.container, className)
31
37
  }, props), {}, {
32
- children: data.map(function (item) {
38
+ children: data.map(function (item, index) {
33
39
  var _item$children;
34
40
  var props = {
35
41
  loading: loadingId === item.id,
@@ -43,15 +49,27 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
43
49
  text: text,
44
50
  type: type
45
51
  };
52
+ var historyLength = data.length;
53
+ var enableHistoryDivider = enableHistoryCount && historyLength > historyCount && historyCount === historyLength - index + 1;
46
54
  if (item.children && ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0) {
47
- return /*#__PURE__*/_jsx(Group, {
48
- data: item.children.map(function (childrenItem) {
49
- return _objectSpread(_objectSpread({}, props), childrenItem);
50
- }),
51
- meta: item.meta
52
- }, item.children[0].id);
55
+ return /*#__PURE__*/_jsxs(_Fragment, {
56
+ children: [/*#__PURE__*/_jsx(HistoryDivider, {
57
+ enable: enableHistoryDivider,
58
+ text: text
59
+ }), /*#__PURE__*/_jsx(Group, {
60
+ data: item.children.map(function (childrenItem) {
61
+ return _objectSpread(_objectSpread({}, props), childrenItem);
62
+ }),
63
+ meta: item.meta
64
+ }, item.children[0].id)]
65
+ });
53
66
  }
54
- return /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({}, props), item), item.id);
67
+ return /*#__PURE__*/_jsxs(_Fragment, {
68
+ children: [/*#__PURE__*/_jsx(HistoryDivider, {
69
+ enable: enableHistoryDivider,
70
+ text: text
71
+ }), /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({}, props), item), item.id)]
72
+ });
55
73
  })
56
74
  }));
57
75
  });
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ColorScaleItem } from "../styles/colors/colors";
2
+ import { ColorScaleItem } from "../styles/colors";
3
3
  export interface ColorScalesProps {
4
4
  /**
5
5
  * @description Index of the mid highlight color in the scale
@@ -1,4 +1,4 @@
1
- import { memo, useEffect, useRef } from 'react';
1
+ import { memo, useEffect } from 'react';
2
2
  var createElement = function createElement(url) {
3
3
  var element = document.createElement('link');
4
4
  element.rel = 'stylesheet';
@@ -7,13 +7,10 @@ var createElement = function createElement(url) {
7
7
  };
8
8
  var FontLoader = /*#__PURE__*/memo(function (_ref) {
9
9
  var url = _ref.url;
10
- var loadRef = useRef(false);
11
10
  useEffect(function () {
12
- if (loadRef.current) return;
13
- loadRef.current = true;
14
11
  var element = createElement(url);
15
12
  document.head.append(element);
16
13
  }, []);
17
- return null;
14
+ return false;
18
15
  });
19
16
  export default FontLoader;
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
2
2
  var _templateObject;
3
3
  import { css } from 'antd-style';
4
4
  import { readableColor, rgba } from 'polished';
5
- import { colorScales } from "../styles/colors/colors";
5
+ import { colorScales } from "../styles/colors";
6
6
  export var genStyles = function genStyles(token, isDarkMode) {
7
7
  var type = isDarkMode ? 'dark' : 'light';
8
8
  var colorText = colorScales.gray[type][11];
@@ -1,4 +1,4 @@
1
- import { colorScales } from "../styles/colors/colors";
1
+ import { colorScales } from "../styles/colors";
2
2
  export var themeConfig = function themeConfig(isDarkMode) {
3
3
  var type = isDarkMode ? 'dark' : 'light';
4
4
  var colorText = colorScales.gray[type][11];
@@ -1,7 +1,6 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject;
3
3
  import { css } from 'antd-style';
4
- import { readableColor } from 'polished';
5
4
  export default (function (token) {
6
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-btn-primary {\n color: ", " !important;\n }\n\n .ant-tooltip-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding: 4px 8px;\n\n color: ", " !important;\n\n background-color: ", " !important;\n border-radius: ", "px !important;\n }\n\n .ant-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n\n .ant-switch-handle::before {\n background: ", " !important;\n }\n"])), readableColor(token.colorPrimary), token.colorBgLayout, token.colorText, token.borderRadiusSM, token.colorText, token.colorBgContainer);
5
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tooltip-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding: 4px 8px;\n\n color: ", " !important;\n\n background-color: ", " !important;\n border-radius: ", "px !important;\n }\n\n .ant-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n\n .ant-switch-handle::before {\n background: ", " !important;\n }\n"])), token.colorBgLayout, token.colorText, token.borderRadiusSM, token.colorText, token.colorBgContainer);
7
6
  });
@@ -1,14 +1,21 @@
1
- /// <reference types="react" />
2
- import { ThemeProviderProps as AntdThemeProviderProps, CustomStylishParams, CustomTokenParams } from 'antd-style';
3
- import { NeutralColors, PrimaryColors } from "../styles";
4
- export interface ThemeProviderProps extends Omit<AntdThemeProviderProps<any>, 'theme'> {
1
+ import { type ThemeMode, extractStaticStyle } from 'antd-style';
2
+ import type { CustomStylishParams, CustomTokenParams } from 'antd-style/lib/types/function';
3
+ import { type ReactNode } from 'react';
4
+ export interface ThemeProviderProps {
5
+ /**
6
+ * @description Cache for the extracted static styles
7
+ */
8
+ cache?: typeof extractStaticStyle.cache;
9
+ /**
10
+ * @description The children of the ThemeProvider component
11
+ */
12
+ children: ReactNode;
13
+ /**
14
+ * @description Custom stylish
15
+ */
5
16
  customStylish?: (theme: CustomStylishParams) => {
6
17
  [key: string]: any;
7
18
  };
8
- customTheme?: {
9
- neutralColor?: NeutralColors;
10
- primaryColor?: PrimaryColors;
11
- };
12
19
  /**
13
20
  * @description Custom extra token
14
21
  */
@@ -16,6 +23,14 @@ export interface ThemeProviderProps extends Omit<AntdThemeProviderProps<any>, 't
16
23
  [key: string]: any;
17
24
  };
18
25
  enableWebfonts?: boolean;
26
+ /**
27
+ * @description Whether to inline the styles on server-side rendering or not
28
+ */
29
+ ssrInline?: boolean;
30
+ /**
31
+ * @description The mode of the theme (light or dark)
32
+ */
33
+ themeMode?: ThemeMode;
19
34
  /**
20
35
  * @description Webfont loader css strings
21
36
  */
@@ -1,6 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["children", "customStylish", "customToken", "enableWebfonts", "webfonts", "customTheme"];
4
2
  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
3
  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
4
  import { App } from 'antd';
@@ -9,22 +7,19 @@ import { memo, useCallback, useEffect } from 'react';
9
7
  import { ThemeContext } from 'styled-components';
10
8
  import { useCdnFn } from "../ConfigProvider";
11
9
  import FontLoader from "../FontLoader";
12
- import { lobeCustomStylish, lobeCustomToken } from "../styles";
13
- import { createLobeAntdTheme } from "../styles/theme/antdTheme";
10
+ import { lobeCustomStylish, lobeCustomToken, lobeTheme } from "../styles";
14
11
  import GlobalStyle from "./GlobalStyle";
15
12
  import { jsx as _jsx } from "react/jsx-runtime";
16
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
14
  import { Fragment as _Fragment } from "react/jsx-runtime";
18
15
  var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
19
16
  var children = _ref.children,
17
+ themeMode = _ref.themeMode,
20
18
  customStylish = _ref.customStylish,
21
19
  customToken = _ref.customToken,
22
20
  _ref$enableWebfonts = _ref.enableWebfonts,
23
21
  enableWebfonts = _ref$enableWebfonts === void 0 ? true : _ref$enableWebfonts,
24
- webfonts = _ref.webfonts,
25
- _ref$customTheme = _ref.customTheme,
26
- customTheme = _ref$customTheme === void 0 ? {} : _ref$customTheme,
27
- res = _objectWithoutProperties(_ref, _excluded);
22
+ webfonts = _ref.webfonts;
28
23
  var genCdnUrl = useCdnFn();
29
24
  var webfontUrls = webfonts || [genCdnUrl({
30
25
  path: 'css/index.css',
@@ -54,25 +49,18 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
54
49
  var token = useCallback(function (theme) {
55
50
  return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), customToken === null || customToken === void 0 ? void 0 : customToken(theme));
56
51
  }, [customToken]);
57
- var theme = useCallback(function (appearance) {
58
- return createLobeAntdTheme({
59
- appearance: appearance,
60
- neutralColor: customTheme.neutralColor,
61
- primaryColor: customTheme.primaryColor
62
- });
63
- }, [customTheme.primaryColor, customTheme.neutralColor]);
64
52
  return /*#__PURE__*/_jsxs(_Fragment, {
65
- children: [enableWebfonts && (webfontUrls === null || webfontUrls === void 0 ? void 0 : webfontUrls.length) > 0 && webfontUrls.map(function (webfont) {
53
+ children: [enableWebfonts && (webfontUrls === null || webfontUrls === void 0 ? void 0 : webfontUrls.length) > 0 && webfontUrls.map(function (webfont, index) {
66
54
  return /*#__PURE__*/_jsx(FontLoader, {
67
55
  url: webfont
68
- }, webfont);
56
+ }, index);
69
57
  }), /*#__PURE__*/_jsx(StyleProvider, {
70
58
  speedy: process.env.NODE_ENV === 'production',
71
- children: /*#__PURE__*/_jsxs(AntdThemeProvider, _objectSpread(_objectSpread({
59
+ children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
72
60
  customStylish: stylish,
73
- customToken: token
74
- }, res), {}, {
75
- theme: theme,
61
+ customToken: token,
62
+ theme: lobeTheme,
63
+ themeMode: themeMode,
76
64
  children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
77
65
  style: {
78
66
  minHeight: 'inherit',
@@ -80,7 +68,7 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
80
68
  },
81
69
  children: children
82
70
  })]
83
- }))
71
+ })
84
72
  })]
85
73
  });
86
74
  });
@@ -1,5 +1,5 @@
1
1
  import { AliasToken } from 'antd/es/theme/interface';
2
- import { ColorScaleItem } from "./colors";
2
+ import { ColorScaleItem } from "../colors";
3
3
  export declare const generateColorPalette: ({ type, scale, appearance, }: {
4
4
  appearance: 'light' | 'dark';
5
5
  scale: ColorScaleItem;
@@ -0,0 +1,9 @@
1
+ import { AliasToken } from 'antd/es/theme/interface';
2
+ import { type NeutralColors, type PrimaryColors } from '../customTheme';
3
+ interface generateCustomThemeProps {
4
+ isDarkMode: boolean;
5
+ neutralColor?: NeutralColors | '';
6
+ primaryColor?: PrimaryColors | '';
7
+ }
8
+ export declare const generateCustomTheme: ({ primaryColor, neutralColor, isDarkMode, }: generateCustomThemeProps) => Partial<AliasToken>;
9
+ export {};
@@ -1,28 +1,30 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  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; }
3
3
  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; }
4
- import { generateColorNeutralPalette, generateColorPalette, neutralColorScales } from "../..";
5
- import { colorScales } from "../../colors/colors";
6
- import lightBaseToken from "../token/light";
7
- export var lightAlgorithm = function lightAlgorithm(seedToken, mapToken) {
8
- var primaryColor = seedToken.colorPrimary;
9
- var neutralColor = seedToken.colorBgBase;
4
+ import { colorScales } from "../colors";
5
+ import { neutralColorScales } from "../neutralColors";
6
+ import { generateColorNeutralPalette, generateColorPalette } from "./generateColorPalette";
7
+ export var generateCustomTheme = function generateCustomTheme(_ref) {
8
+ var primaryColor = _ref.primaryColor,
9
+ neutralColor = _ref.neutralColor,
10
+ isDarkMode = _ref.isDarkMode;
11
+ var appearance = isDarkMode ? 'dark' : 'light';
10
12
  var primaryTokens = {};
11
13
  var neutralTokens = {};
12
- var primaryScale = colorScales[primaryColor];
13
- if (primaryScale) {
14
+ if (primaryColor) {
15
+ var scale = colorScales[primaryColor];
14
16
  primaryTokens = generateColorPalette({
15
- appearance: 'light',
16
- scale: primaryScale,
17
+ appearance: appearance,
18
+ scale: scale,
17
19
  type: 'Primary'
18
20
  });
19
21
  }
20
- var neutralScale = neutralColorScales[neutralColor];
21
- if (neutralScale) {
22
+ if (neutralColor) {
23
+ var _scale = neutralColorScales[neutralColor];
22
24
  neutralTokens = generateColorNeutralPalette({
23
- appearance: 'light',
24
- scale: neutralScale
25
+ appearance: appearance,
26
+ scale: _scale
25
27
  });
26
28
  }
27
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, mapToken), lightBaseToken), primaryTokens), neutralTokens);
29
+ return _objectSpread(_objectSpread({}, primaryTokens), neutralTokens);
28
30
  };
@@ -6,7 +6,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
6
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
7
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
8
  import { camelCase } from 'lodash-es';
9
- import { colorScales } from "../colors/colors";
9
+ import { colorScales } from "../colors";
10
10
  var generateColorPalette = function generateColorPalette(_ref) {
11
11
  var _ref2;
12
12
  var name = _ref.name,
@@ -55,6 +55,8 @@ var generateCustomColorPalette = function generateCustomColorPalette(_ref3) {
55
55
  scale: scale
56
56
  }));
57
57
  };
58
+
59
+ // @ts-ignore
58
60
  export var generateCustomToken = function generateCustomToken(_ref4) {
59
61
  var isDarkMode = _ref4.isDarkMode;
60
62
  var colorCustomToken = {};
@@ -0,0 +1,5 @@
1
+ import { ThemeConfig } from 'antd';
2
+ import { GetAntdTheme } from 'antd-style';
3
+ export declare const lightTheme: ThemeConfig;
4
+ export declare const darkTheme: ThemeConfig;
5
+ export declare const generateTheme: GetAntdTheme;
@@ -1,26 +1,20 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  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; }
3
3
  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; }
4
- import { darkAlgorithm } from "./algorithms/darkAlgorithm";
5
- import { lightAlgorithm } from "./algorithms/lightAlgorithm";
6
- import { baseToken } from "./token/base";
7
- /**
8
- * create A LobeHub Style Antd Theme Object
9
- * @param neutralColor
10
- * @param appearance
11
- * @param primaryColor
12
- */
13
- export var createLobeAntdTheme = function createLobeAntdTheme(_ref) {
14
- var neutralColor = _ref.neutralColor,
15
- appearance = _ref.appearance,
16
- primaryColor = _ref.primaryColor;
17
- var isDark = appearance === 'dark';
18
- return {
19
- algorithm: isDark ? darkAlgorithm : lightAlgorithm,
20
- token: _objectSpread(_objectSpread({}, baseToken), {}, {
21
- // @ts-ignore
22
- neutralColor: neutralColor,
23
- primaryColor: primaryColor
24
- })
25
- };
4
+ import darkBaseToken from "../theme/dark";
5
+ import lightBaseToken from "../theme/light";
6
+ export var lightTheme = {
7
+ algorithm: function algorithm(seedToken, mapToken) {
8
+ return _objectSpread(_objectSpread({}, mapToken), lightBaseToken);
9
+ },
10
+ token: lightBaseToken
11
+ };
12
+ export var darkTheme = {
13
+ algorithm: function algorithm(seedToken, mapToken) {
14
+ return _objectSpread(_objectSpread({}, mapToken), darkBaseToken);
15
+ },
16
+ token: darkBaseToken
17
+ };
18
+ export var generateTheme = function generateTheme(appearance) {
19
+ return appearance === 'dark' ? darkTheme : lightTheme;
26
20
  };
@@ -1,5 +1,5 @@
1
- import { colorScales } from "./colors/colors";
2
- import { neutralColorScales } from "./colors/neutralColors";
1
+ import { colorScales } from "./colors";
2
+ import { neutralColorScales } from "./neutralColors";
3
3
  export var primaryColors = {
4
4
  blue: colorScales.blue.dark[9],
5
5
  cyan: colorScales.cyan.dark[9],
@@ -1,7 +1,9 @@
1
- export { colorScales as colors } from './colors/colors';
2
- export { colorScales } from './colors/colors';
3
- export { generateColorNeutralPalette, generateColorPalette } from './colors/generateColorPalette';
4
- export { neutralColorScales } from './colors/neutralColors';
1
+ export { generateColorNeutralPalette, generateColorPalette, } from './algorithms/generateColorPalette';
2
+ export { generateCustomStylish as lobeCustomStylish } from './algorithms/generateCustomStylish';
3
+ export { generateCustomTheme as lobeCustomTheme } from './algorithms/generateCustomTheme';
4
+ export { generateCustomToken as lobeCustomToken } from './algorithms/generateCustomToken';
5
+ export { generateTheme as lobeTheme } from './algorithms/generateTheme';
6
+ export { colorScales as colors } from './colors';
7
+ export { colorScales } from './colors';
5
8
  export * from './customTheme';
6
- export { generateCustomStylish as lobeCustomStylish } from './theme/customStylish';
7
- export { generateCustomToken as lobeCustomToken } from './theme/customToken';
9
+ export { neutralColorScales } from './neutralColors';
@@ -1,7 +1,9 @@
1
- export { colorScales as colors } from "./colors/colors";
2
- export { colorScales } from "./colors/colors";
3
- export { generateColorNeutralPalette, generateColorPalette } from "./colors/generateColorPalette";
4
- export { neutralColorScales } from "./colors/neutralColors";
1
+ export { generateColorNeutralPalette, generateColorPalette } from "./algorithms/generateColorPalette";
2
+ export { generateCustomStylish as lobeCustomStylish } from "./algorithms/generateCustomStylish";
3
+ export { generateCustomTheme as lobeCustomTheme } from "./algorithms/generateCustomTheme";
4
+ export { generateCustomToken as lobeCustomToken } from "./algorithms/generateCustomToken";
5
+ export { generateTheme as lobeTheme } from "./algorithms/generateTheme";
6
+ export { colorScales as colors } from "./colors";
7
+ export { colorScales } from "./colors";
5
8
  export * from "./customTheme";
6
- export { generateCustomStylish as lobeCustomStylish } from "./theme/customStylish";
7
- export { generateCustomToken as lobeCustomToken } from "./theme/customToken";
9
+ export { neutralColorScales } from "./neutralColors";
@@ -1,8 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  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; }
3
3
  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; }
4
- import { generateColorNeutralPalette, generateColorPalette } from "../../colors/generateColorPalette";
5
- import { colorScales } from "../../colors/colors";
4
+ import { generateColorNeutralPalette, generateColorPalette } from "../algorithms/generateColorPalette";
5
+ import { colorScales } from "../colors";
6
+ import { baseToken } from "./base";
6
7
  var primaryToken = generateColorPalette({
7
8
  appearance: 'dark',
8
9
  scale: colorScales.bnw,
@@ -32,7 +33,7 @@ var infoToken = generateColorPalette({
32
33
  scale: colorScales.blue,
33
34
  type: 'Info'
34
35
  });
35
- var darkBaseToken = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, primaryToken), neutralToken), successToken), warningToken), errorToken), infoToken), {}, {
36
+ var darkBaseToken = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, baseToken), primaryToken), neutralToken), successToken), warningToken), errorToken), infoToken), {}, {
36
37
  boxShadow: '0 12px 20px 6px rgb(0 0 0 / 0.08)',
37
38
  boxShadowSecondary: '0 2px 8px 2px rgb(0 0 0 / 0.07), 0 2px 4px -1px rgb(0 0 0 / 0.04)',
38
39
  colorLink: infoToken.colorInfoText,
@@ -1,8 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  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; }
3
3
  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; }
4
- import { generateColorNeutralPalette, generateColorPalette } from "../../colors/generateColorPalette";
5
- import { colorScales } from "../../colors/colors";
4
+ import { generateColorNeutralPalette, generateColorPalette } from "../algorithms/generateColorPalette";
5
+ import { colorScales } from "../colors";
6
+ import { baseToken } from "./base";
6
7
  var primaryToken = generateColorPalette({
7
8
  appearance: 'light',
8
9
  scale: colorScales.bnw,
@@ -32,7 +33,7 @@ var infoToken = generateColorPalette({
32
33
  scale: colorScales.geekblue,
33
34
  type: 'Info'
34
35
  });
35
- var lightBaseToken = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, primaryToken), neutralToken), successToken), warningToken), errorToken), infoToken), {}, {
36
+ var lightBaseToken = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, baseToken), primaryToken), neutralToken), successToken), warningToken), errorToken), infoToken), {}, {
36
37
  boxShadow: '0 12px 20px 6px rgb(104 112 118 / 0.08)',
37
38
  boxShadowSecondary: '0 2px 8px 2px rgb(104 112 118 / 0.07), 0 2px 4px -1px rgb(104 112 118 / 0.04)',
38
39
  colorLink: infoToken.colorInfoText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.95.1-beta.1",
3
+ "version": "1.96.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -1,2 +0,0 @@
1
- import { MappingAlgorithm } from 'antd/es/theme/interface';
2
- export declare const darkAlgorithm: MappingAlgorithm;
@@ -1,32 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- 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; }
3
- 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; }
4
- import { generateColorNeutralPalette, generateColorPalette, neutralColorScales } from "../..";
5
- import { colorScales } from "../../colors/colors";
6
- import darkBaseToken from "../token/dark";
7
- export var darkAlgorithm = function darkAlgorithm(seedToken, mapToken) {
8
- var primaryColor = seedToken.primaryColor;
9
- var neutralColor = seedToken.neutralColor;
10
- var primaryTokens = {};
11
- var neutralTokens = {};
12
-
13
- // generate primary color Token with colorPrimary
14
- var primaryScale = colorScales[primaryColor];
15
- if (primaryScale) {
16
- primaryTokens = generateColorPalette({
17
- appearance: 'dark',
18
- scale: primaryScale,
19
- type: 'Primary'
20
- });
21
- }
22
-
23
- // generate neutral color Token with colorBgBase
24
- var neutralScale = neutralColorScales[neutralColor];
25
- if (neutralScale) {
26
- neutralTokens = generateColorNeutralPalette({
27
- appearance: 'dark',
28
- scale: neutralScale
29
- });
30
- }
31
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, mapToken), darkBaseToken), primaryTokens), neutralTokens);
32
- };
@@ -1,2 +0,0 @@
1
- import { MappingAlgorithm } from 'antd/es/theme/interface';
2
- export declare const lightAlgorithm: MappingAlgorithm;
@@ -1,15 +0,0 @@
1
- import { ThemeConfig } from 'antd';
2
- import { ThemeAppearance } from 'antd-style';
3
- import { NeutralColors, PrimaryColors } from "..";
4
- export interface LobeAntdThemeParams {
5
- appearance: ThemeAppearance;
6
- neutralColor?: NeutralColors;
7
- primaryColor?: PrimaryColors;
8
- }
9
- /**
10
- * create A LobeHub Style Antd Theme Object
11
- * @param neutralColor
12
- * @param appearance
13
- * @param primaryColor
14
- */
15
- export declare const createLobeAntdTheme: ({ neutralColor, appearance, primaryColor, }: LobeAntdThemeParams) => ThemeConfig;
File without changes
File without changes
File without changes
File without changes
File without changes