@lobehub/ui 1.72.0 → 1.72.2
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/es/Highlighter/SyntaxHighlighter/index.js +1 -2
- package/es/List/ListItem/index.d.ts +1 -1
- package/es/List/ListItem/index.js +7 -8
- package/es/List/ListItem/style.d.ts +1 -1
- package/es/List/ListItem/style.js +3 -3
- package/es/List/index.d.ts +1 -1
- package/es/hooks/useHighlight.d.ts +1 -1
- package/es/hooks/useHighlight.js +4 -3
- package/package.json +3 -3
|
@@ -3,7 +3,6 @@ import { useThemeMode } from 'antd-style';
|
|
|
3
3
|
import { Loader2 } from 'lucide-react';
|
|
4
4
|
import { memo, useEffect } from 'react';
|
|
5
5
|
import { Center } from 'react-layout-kit';
|
|
6
|
-
import { shallow } from 'zustand/shallow';
|
|
7
6
|
import Icon from "../../Icon";
|
|
8
7
|
import { useHighlight } from "../../hooks/useHighlight";
|
|
9
8
|
import { useStyles } from "./style";
|
|
@@ -20,7 +19,7 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
20
19
|
isDarkMode = _useThemeMode.isDarkMode;
|
|
21
20
|
var _useHighlight = useHighlight(function (s) {
|
|
22
21
|
return [s.codeToHtml, !s.highlighter];
|
|
23
|
-
}
|
|
22
|
+
}),
|
|
24
23
|
_useHighlight2 = _slicedToArray(_useHighlight, 2),
|
|
25
24
|
codeToHtml = _useHighlight2[0],
|
|
26
25
|
isLoading = _useHighlight2[1];
|
|
@@ -62,5 +62,5 @@ export interface ListItemProps {
|
|
|
62
62
|
*/
|
|
63
63
|
title: ReactNode;
|
|
64
64
|
}
|
|
65
|
-
declare const ListItem: import("react").
|
|
65
|
+
declare const ListItem: import("react").ForwardRefExoticComponent<ListItemProps & HTMLAttributes<any> & import("react").RefAttributes<HTMLDivElement>>;
|
|
66
66
|
export default ListItem;
|
|
@@ -4,7 +4,7 @@ var _excluded = ["active", "avatar", "loading", "description", "date", "title",
|
|
|
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 { LoadingOutlined, MessageOutlined } from '@ant-design/icons';
|
|
7
|
-
import { forwardRef
|
|
7
|
+
import { forwardRef } from 'react';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
9
|
import { useStyles } from "./style";
|
|
10
10
|
import { getChatItemTime } from "./time";
|
|
@@ -15,7 +15,7 @@ import { getChatItemTime } from "./time";
|
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
-
var ListItem = /*#__PURE__*/
|
|
18
|
+
var ListItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
19
19
|
var active = _ref.active,
|
|
20
20
|
avatar = _ref.avatar,
|
|
21
21
|
loading = _ref.loading,
|
|
@@ -28,16 +28,15 @@ var ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
28
28
|
style = _ref.style,
|
|
29
29
|
showAction = _ref.showAction,
|
|
30
30
|
children = _ref.children,
|
|
31
|
-
|
|
32
|
-
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
31
|
+
classNames = _ref.classNames,
|
|
33
32
|
addon = _ref.addon,
|
|
34
33
|
pin = _ref.pin,
|
|
35
34
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
-
var _useStyles = useStyles(
|
|
35
|
+
var _useStyles = useStyles(),
|
|
37
36
|
styles = _useStyles.styles,
|
|
38
37
|
cx = _useStyles.cx;
|
|
39
38
|
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
40
|
-
className: cx(styles.container, active && styles.active, className),
|
|
39
|
+
className: cx(styles.container, active && styles.active, pin && styles.pin, className),
|
|
41
40
|
onMouseEnter: function onMouseEnter() {
|
|
42
41
|
onHoverChange === null || onHoverChange === void 0 ? void 0 : onHoverChange(true);
|
|
43
42
|
},
|
|
@@ -88,7 +87,7 @@ var ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
88
87
|
},
|
|
89
88
|
children: actions
|
|
90
89
|
}), date && /*#__PURE__*/_jsx("div", {
|
|
91
|
-
className: cx(styles.time, classNames.time),
|
|
90
|
+
className: cx(styles.time, classNames === null || classNames === void 0 ? void 0 : classNames.time),
|
|
92
91
|
style: showAction ? {
|
|
93
92
|
opacity: 0
|
|
94
93
|
} : {},
|
|
@@ -97,5 +96,5 @@ var ListItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
97
96
|
}), children]
|
|
98
97
|
})
|
|
99
98
|
}));
|
|
100
|
-
})
|
|
99
|
+
});
|
|
101
100
|
export default ListItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const useStyles: (props?:
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
2
|
actions: import("antd-style").SerializedStyles;
|
|
3
3
|
active: import("antd-style").SerializedStyles;
|
|
4
4
|
container: import("antd-style").SerializedStyles;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
export var useStyles = createStyles(function (_ref
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
return {
|
|
8
8
|
actions: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n right: 16px;\n transform: translateY(-50%);\n "]))),
|
|
9
9
|
active: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n }\n "])), token.colorText, token.colorFillSecondary, token.colorFill),
|
|
10
|
-
container: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n background:
|
|
10
|
+
container: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n background: transparent;\n transition: background-color 200ms ", ";\n\n &:active {\n background-color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), token.colorTextTertiary, token.motionEaseOut, token.colorFillSecondary, token.colorFillTertiary),
|
|
11
11
|
content: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n flex: 1;\n padding-top: 6px;\n "]))),
|
|
12
12
|
desc: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n width: 100%;\n\n font-size: 12px;\n line-height: 1;\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.colorTextDescription),
|
|
13
|
-
pin: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorFillTertiary),
|
|
13
|
+
pin: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background-color: ", ";\n\n &:active {\n background-color: ", " !important;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), token.colorFillTertiary, token.colorFill, token.colorFill),
|
|
14
14
|
time: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 12px;\n color: ", ";\n "])), token.colorTextPlaceholder),
|
|
15
15
|
title: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n width: 100%;\n\n font-size: 16px;\n line-height: 1;\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.colorText)
|
|
16
16
|
};
|
package/es/List/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const List: {
|
|
3
|
-
Item: import("react").
|
|
3
|
+
Item: import("react").ForwardRefExoticComponent<import("./ListItem").ListItemProps & import("react").HTMLAttributes<any> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
4
|
};
|
|
5
5
|
export default List;
|
|
@@ -22,5 +22,5 @@ interface Store {
|
|
|
22
22
|
*/
|
|
23
23
|
initHighlighter: (options?: HighlighterOptions) => Promise<void>;
|
|
24
24
|
}
|
|
25
|
-
export declare const useHighlight: import("zustand").
|
|
25
|
+
export declare const useHighlight: import("zustand/traditional").UseBoundStoreWithEqualityFn<import("zustand/vanilla").StoreApi<Store>>;
|
|
26
26
|
export {};
|
package/es/hooks/useHighlight.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { getHighlighter } from 'shiki-es';
|
|
4
|
-
import {
|
|
4
|
+
import { shallow } from 'zustand/shallow';
|
|
5
|
+
import { createWithEqualityFn } from 'zustand/traditional';
|
|
5
6
|
import { themeConfig } from "../Highlighter/theme";
|
|
6
7
|
export var languageMap = ['javascript', 'js', 'jsx', 'json', 'markdown', 'md', 'less', 'css', 'typescript', 'ts', 'tsx', 'diff', 'bash'];
|
|
7
8
|
|
|
@@ -9,7 +10,7 @@ export var languageMap = ['javascript', 'js', 'jsx', 'json', 'markdown', 'md', '
|
|
|
9
10
|
* @title 代码高亮的存储对象
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
export var useHighlight =
|
|
13
|
+
export var useHighlight = createWithEqualityFn(function (set, get) {
|
|
13
14
|
return {
|
|
14
15
|
codeToHtml: function codeToHtml(text, language, isDarkMode) {
|
|
15
16
|
var _get = get(),
|
|
@@ -57,4 +58,4 @@ export var useHighlight = create(function (set, get) {
|
|
|
57
58
|
return initHighlighter;
|
|
58
59
|
}()
|
|
59
60
|
};
|
|
60
|
-
});
|
|
61
|
+
}, shallow);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.72.
|
|
3
|
+
"version": "1.72.2",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"three": "^0.150",
|
|
106
106
|
"ts-md5": "^1",
|
|
107
107
|
"use-merge-value": "^1",
|
|
108
|
-
"zustand": "^4",
|
|
109
|
-
"zustand-utils": "^1"
|
|
108
|
+
"zustand": "^4.4.1",
|
|
109
|
+
"zustand-utils": "^1.3.1"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@commitlint/cli": "^17",
|