@lobehub/ui 1.116.2 → 1.117.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Alert/index.d.ts +8 -0
- package/es/Alert/index.js +70 -0
- package/es/Alert/style.d.ts +11 -0
- package/es/Alert/style.js +20 -0
- package/es/ChatItem/components/ErrorContent.js +2 -1
- package/es/ChatItem/index.js +6 -11
- package/es/ChatItem/type.d.ts +1 -1
- package/es/EditableMessage/index.d.ts +2 -2
- package/es/EditableMessage/index.js +40 -50
- package/es/EmojiPicker/index.js +28 -53
- package/es/Giscus/index.d.ts +1 -1
- package/es/Highlighter/index.js +4 -9
- package/es/List/ListItem/index.js +6 -3
- package/es/SearchBar/index.js +3 -8
- package/es/Snippet/index.js +3 -8
- package/es/ThemeProvider/GlobalStyle/antdOverride.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/types/chatMessage.d.ts +1 -2
- package/package.json +1 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type AlertProps as AntAlertProps } from 'antd';
|
|
3
|
+
export interface AlertProps extends AntAlertProps {
|
|
4
|
+
colorfulText?: boolean;
|
|
5
|
+
styleType?: 'block' | 'ghost' | 'pure';
|
|
6
|
+
}
|
|
7
|
+
declare const Alert: import("react").NamedExoticComponent<AlertProps>;
|
|
8
|
+
export default Alert;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["closeIcon", "closable", "description", "showIcon", "type", "styleType", "icon", "colorfulText", "style"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import { Alert as AntdAlert } from 'antd';
|
|
7
|
+
import { camelCase } from 'lodash-es';
|
|
8
|
+
import { AlertTriangle, CheckCircle, Info, X, XCircle } from 'lucide-react';
|
|
9
|
+
import { memo } from 'react';
|
|
10
|
+
import ActionIcon from "../ActionIcon";
|
|
11
|
+
import Icon from "../Icon";
|
|
12
|
+
import { useStyles } from "./style";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
var typeIcons = {
|
|
15
|
+
error: XCircle,
|
|
16
|
+
info: Info,
|
|
17
|
+
success: CheckCircle,
|
|
18
|
+
warning: AlertTriangle
|
|
19
|
+
};
|
|
20
|
+
var colors = function colors(theme) {
|
|
21
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'info';
|
|
22
|
+
for (var _len = arguments.length, keys = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
23
|
+
keys[_key - 2] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
return theme[camelCase(['color', type].concat(keys).join('-'))];
|
|
26
|
+
};
|
|
27
|
+
var Alert = /*#__PURE__*/memo(function (_ref) {
|
|
28
|
+
var closeIcon = _ref.closeIcon,
|
|
29
|
+
closable = _ref.closable,
|
|
30
|
+
description = _ref.description,
|
|
31
|
+
showIcon = _ref.showIcon,
|
|
32
|
+
_ref$type = _ref.type,
|
|
33
|
+
type = _ref$type === void 0 ? 'info' : _ref$type,
|
|
34
|
+
styleType = _ref.styleType,
|
|
35
|
+
icon = _ref.icon,
|
|
36
|
+
_ref$colorfulText = _ref.colorfulText,
|
|
37
|
+
colorfulText = _ref$colorfulText === void 0 ? true : _ref$colorfulText,
|
|
38
|
+
style = _ref.style,
|
|
39
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
var _useStyles = useStyles({
|
|
41
|
+
closable: !!closable,
|
|
42
|
+
hasTitle: !!description,
|
|
43
|
+
showIcon: !!showIcon
|
|
44
|
+
}),
|
|
45
|
+
theme = _useStyles.theme,
|
|
46
|
+
styles = _useStyles.styles,
|
|
47
|
+
cx = _useStyles.cx;
|
|
48
|
+
return /*#__PURE__*/_jsx(AntdAlert, _objectSpread({
|
|
49
|
+
className: cx(styles.container, colorfulText && styles.colorfulText, styleType === 'block' && styles.styleBlock, styleType === 'ghost' && styles.styleGhost, styleType === 'pure' && styles.stylePure),
|
|
50
|
+
closable: closable,
|
|
51
|
+
closeIcon: closeIcon || /*#__PURE__*/_jsx(ActionIcon, {
|
|
52
|
+
color: colors(theme, type),
|
|
53
|
+
icon: X,
|
|
54
|
+
size: 'small'
|
|
55
|
+
}),
|
|
56
|
+
description: description,
|
|
57
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
58
|
+
icon: typeIcons[type] || icon,
|
|
59
|
+
size: {
|
|
60
|
+
fontSize: description ? 24 : 18
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
showIcon: showIcon,
|
|
64
|
+
style: _objectSpread({
|
|
65
|
+
color: colorfulText ? colors(theme, type) : undefined
|
|
66
|
+
}, style),
|
|
67
|
+
type: type
|
|
68
|
+
}, rest));
|
|
69
|
+
});
|
|
70
|
+
export default Alert;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const useStyles: (props?: {
|
|
2
|
+
closable?: boolean | undefined;
|
|
3
|
+
hasTitle?: boolean | undefined;
|
|
4
|
+
showIcon?: boolean | undefined;
|
|
5
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
6
|
+
colorfulText: import("antd-style").SerializedStyles;
|
|
7
|
+
container: string;
|
|
8
|
+
styleBlock: import("antd-style").SerializedStyles;
|
|
9
|
+
styleGhost: import("antd-style").SerializedStyles;
|
|
10
|
+
stylePure: import("antd-style").SerializedStyles;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
|
+
var cx = _ref.cx,
|
|
6
|
+
css = _ref.css,
|
|
7
|
+
prefixCls = _ref.prefixCls;
|
|
8
|
+
var closable = _ref2.closable,
|
|
9
|
+
hasTitle = _ref2.hasTitle,
|
|
10
|
+
showIcon = _ref2.showIcon;
|
|
11
|
+
var baseBlockPadding = hasTitle ? 16 : 8;
|
|
12
|
+
var baseInlinePadding = hasTitle ? 16 : 12;
|
|
13
|
+
return {
|
|
14
|
+
colorfulText: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-alert-message,.", "-alert-description {\n color: inherit;\n }\n "])), prefixCls, prefixCls),
|
|
15
|
+
container: cx(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n gap: ", "px;\n align-items: flex-start;\n\n padding-right: ", "px;\n padding-left: ", "px;\n padding-block: ", "px;\n\n .", "-alert-message {\n font-weight: ", ";\n line-height: 24px;\n word-break: break-all;\n }\n .", "-alert-icon {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0;\n }\n .", "-alert-close-icon {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0;\n }\n "])), hasTitle ? 12 : 8, closable ? baseInlinePadding : baseInlinePadding * 1.5, showIcon ? baseInlinePadding : baseInlinePadding * 1.5, baseBlockPadding, prefixCls, hasTitle ? 600 : 400, prefixCls, prefixCls), hasTitle && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-alert-description {\n line-height: 1.5;\n word-break: break-all;\n opacity: 0.75;\n }\n "])), prefixCls)),
|
|
16
|
+
styleBlock: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border: none;\n "]))),
|
|
17
|
+
styleGhost: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: transparent;\n "]))),
|
|
18
|
+
stylePure: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 0 !important;\n background: transparent;\n border: none;\n "])))
|
|
19
|
+
};
|
|
20
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { Alert } from 'antd';
|
|
5
4
|
import { memo } from 'react';
|
|
6
5
|
import { Flexbox } from 'react-layout-kit';
|
|
6
|
+
import Alert from "../../Alert";
|
|
7
7
|
import { useStyles } from "../style";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -19,6 +19,7 @@ var ErrorContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
19
19
|
className: styles.errorContent,
|
|
20
20
|
gap: 8,
|
|
21
21
|
children: [/*#__PURE__*/_jsx(Alert, _objectSpread({
|
|
22
|
+
closable: false,
|
|
22
23
|
showIcon: true,
|
|
23
24
|
type: 'error'
|
|
24
25
|
}, error)), message]
|
package/es/ChatItem/index.js
CHANGED
|
@@ -4,19 +4,17 @@ var _excluded = ["avatarAddon", "onAvatarClick", "actions", "className", "primar
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { useResponsive } from 'antd-style';
|
|
7
|
-
import {
|
|
7
|
+
import { memo } from 'react';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
9
|
import Actions from "./components/Actions";
|
|
10
10
|
import Avatar from "./components/Avatar";
|
|
11
11
|
import BorderSpacing from "./components/BorderSpacing";
|
|
12
|
+
import ErrorContent from "./components/ErrorContent";
|
|
12
13
|
import MessageContent from "./components/MessageContent";
|
|
13
14
|
import Title from "./components/Title";
|
|
14
15
|
import { useStyles } from "./style";
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
var ErrorContent = /*#__PURE__*/lazy(function () {
|
|
18
|
-
return import("./components/ErrorContent");
|
|
19
|
-
});
|
|
20
18
|
var MOBILE_AVATAR_SIZE = 32;
|
|
21
19
|
var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
22
20
|
var avatarAddon = _ref.avatarAddon,
|
|
@@ -80,13 +78,10 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
80
78
|
className: styles.messageContent,
|
|
81
79
|
direction: type === 'block' ? placement === 'left' ? 'horizontal' : 'horizontal-reverse' : 'vertical',
|
|
82
80
|
gap: 8,
|
|
83
|
-
children: [error ? /*#__PURE__*/_jsx(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
message: errorMessage,
|
|
88
|
-
placement: placement
|
|
89
|
-
})
|
|
81
|
+
children: [error ? /*#__PURE__*/_jsx(ErrorContent, {
|
|
82
|
+
error: error,
|
|
83
|
+
message: errorMessage,
|
|
84
|
+
placement: placement
|
|
90
85
|
}) : /*#__PURE__*/_jsx(MessageContent, {
|
|
91
86
|
editing: editing,
|
|
92
87
|
message: message,
|
package/es/ChatItem/type.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
2
|
+
import { type MessageInputProps } from "../MessageInput";
|
|
3
|
+
import { type MessageModalProps } from "../MessageModal";
|
|
4
4
|
export interface EditableMessageProps {
|
|
5
5
|
/**
|
|
6
6
|
* @title The class name for the Markdown and MessageInput component
|
|
@@ -3,18 +3,14 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import { createStyles } from 'antd-style';
|
|
6
|
-
import {
|
|
6
|
+
import { memo } from 'react';
|
|
7
7
|
import useControlledState from 'use-merge-value';
|
|
8
8
|
import Markdown from "../Markdown";
|
|
9
|
+
import MessageInput from "../MessageInput";
|
|
10
|
+
import MessageModal from "../MessageModal";
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
var MessageInput = /*#__PURE__*/lazy(function () {
|
|
13
|
-
return import("../MessageInput");
|
|
14
|
-
});
|
|
15
|
-
var MessageModal = /*#__PURE__*/lazy(function () {
|
|
16
|
-
return import("../MessageModal");
|
|
17
|
-
});
|
|
18
14
|
var useStyles = createStyles(function (_ref) {
|
|
19
15
|
var stylish = _ref.stylish;
|
|
20
16
|
return {
|
|
@@ -59,29 +55,26 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref2) {
|
|
|
59
55
|
expand = _useControlledState4[0],
|
|
60
56
|
setExpand = _useControlledState4[1];
|
|
61
57
|
var isAutoSize = height === 'auto';
|
|
62
|
-
var input = /*#__PURE__*/_jsx(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
textareaClassname: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
83
|
-
type: inputType
|
|
84
|
-
})
|
|
58
|
+
var input = /*#__PURE__*/_jsx(MessageInput, {
|
|
59
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
60
|
+
classNames: {
|
|
61
|
+
textarea: classNames === null || classNames === void 0 ? void 0 : classNames.textarea
|
|
62
|
+
},
|
|
63
|
+
defaultValue: value,
|
|
64
|
+
editButtonSize: editButtonSize,
|
|
65
|
+
height: height,
|
|
66
|
+
onCancel: function onCancel() {
|
|
67
|
+
return setTyping(false);
|
|
68
|
+
},
|
|
69
|
+
onConfirm: function onConfirm(text) {
|
|
70
|
+
_onChange === null || _onChange === void 0 || _onChange(text);
|
|
71
|
+
setTyping(false);
|
|
72
|
+
},
|
|
73
|
+
placeholder: placeholder,
|
|
74
|
+
style: stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.input,
|
|
75
|
+
text: text,
|
|
76
|
+
textareaClassname: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
77
|
+
type: inputType
|
|
85
78
|
});
|
|
86
79
|
if (!value && showEditWhenEmpty) return input;
|
|
87
80
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -94,26 +87,23 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref2) {
|
|
|
94
87
|
overflowY: 'auto'
|
|
95
88
|
}, stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.markdown),
|
|
96
89
|
children: value || placeholder
|
|
97
|
-
}), /*#__PURE__*/_jsx(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
text: text,
|
|
115
|
-
value: value
|
|
116
|
-
})
|
|
90
|
+
}), /*#__PURE__*/_jsx(MessageModal, {
|
|
91
|
+
editing: isEdit,
|
|
92
|
+
extra: model === null || model === void 0 ? void 0 : model.extra,
|
|
93
|
+
footer: model === null || model === void 0 ? void 0 : model.footer,
|
|
94
|
+
height: height,
|
|
95
|
+
onChange: function onChange(text) {
|
|
96
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
|
|
97
|
+
},
|
|
98
|
+
onEditingChange: setTyping,
|
|
99
|
+
onOpenChange: function onOpenChange(e) {
|
|
100
|
+
setExpand(e);
|
|
101
|
+
setTyping(false);
|
|
102
|
+
},
|
|
103
|
+
open: expand,
|
|
104
|
+
placeholder: placeholder,
|
|
105
|
+
text: text,
|
|
106
|
+
value: value
|
|
117
107
|
})]
|
|
118
108
|
});
|
|
119
109
|
});
|
package/es/EmojiPicker/index.js
CHANGED
|
@@ -1,53 +1,32 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import data from '@emoji-mart/data';
|
|
5
|
-
import
|
|
5
|
+
import Picker from '@emoji-mart/react';
|
|
6
6
|
import { Avatar } from "./..";
|
|
7
7
|
import { Popover } from 'antd';
|
|
8
|
-
import {
|
|
8
|
+
import { memo } from 'react';
|
|
9
9
|
import useSWR from 'swr';
|
|
10
10
|
import useMergeState from 'use-merge-value';
|
|
11
11
|
import { useStyles } from "./style";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
var Picker = /*#__PURE__*/lazy(function () {
|
|
14
|
-
return import('@emoji-mart/react');
|
|
15
|
-
});
|
|
16
|
-
var DEFAULT_EMOJI = '🤖';
|
|
17
|
-
var DEFAULT_LOCALE = 'en-US';
|
|
18
|
-
var DEFAULT_BACKGROUND_COLOR = 'rgba(0,0,0,0)';
|
|
19
|
-
var formatLocale = function formatLocale(locale) {
|
|
20
|
-
return locale.split('-')[0];
|
|
21
|
-
};
|
|
22
13
|
var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
23
14
|
var value = _ref.value,
|
|
24
15
|
_ref$defaultAvatar = _ref.defaultAvatar,
|
|
25
|
-
defaultAvatar = _ref$defaultAvatar === void 0 ?
|
|
16
|
+
defaultAvatar = _ref$defaultAvatar === void 0 ? '🤖' : _ref$defaultAvatar,
|
|
26
17
|
_ref$backgroundColor = _ref.backgroundColor,
|
|
27
|
-
backgroundColor = _ref$backgroundColor === void 0 ?
|
|
18
|
+
backgroundColor = _ref$backgroundColor === void 0 ? 'rgba(0,0,0,0)' : _ref$backgroundColor,
|
|
28
19
|
onChange = _ref.onChange,
|
|
29
20
|
_ref$locale = _ref.locale,
|
|
30
|
-
locale = _ref$locale === void 0 ?
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_useMergeState2 = _slicedToArray(_useMergeState, 2),
|
|
35
|
-
emojiLocale = _useMergeState2[0],
|
|
36
|
-
setEmojiLocale = _useMergeState2[1];
|
|
37
|
-
var _useMergeState3 = useMergeState('🤖', {
|
|
38
|
-
defaultValue: defaultAvatar,
|
|
39
|
-
onChange: onChange,
|
|
40
|
-
value: value
|
|
41
|
-
}),
|
|
42
|
-
_useMergeState4 = _slicedToArray(_useMergeState3, 2),
|
|
43
|
-
ava = _useMergeState4[0],
|
|
44
|
-
setAva = _useMergeState4[1];
|
|
45
|
-
var _useSWR = useSWR(emojiLocale === DEFAULT_LOCALE ? null : emojiLocale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
locale = _ref$locale === void 0 ? 'en-US' : _ref$locale;
|
|
22
|
+
var _useStyles = useStyles(),
|
|
23
|
+
styles = _useStyles.styles;
|
|
24
|
+
var _useSWR = useSWR(locale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
46
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
47
26
|
while (1) switch (_context.prev = _context.next) {
|
|
48
27
|
case 0:
|
|
49
28
|
_context.next = 2;
|
|
50
|
-
return import("@emoji-mart/data/i18n/".concat(
|
|
29
|
+
return import("@emoji-mart/data/i18n/".concat(locale.split('-')[0], ".json"));
|
|
51
30
|
case 2:
|
|
52
31
|
return _context.abrupt("return", _context.sent);
|
|
53
32
|
case 3:
|
|
@@ -55,32 +34,28 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
55
34
|
return _context.stop();
|
|
56
35
|
}
|
|
57
36
|
}, _callee);
|
|
58
|
-
})),
|
|
59
|
-
onError: function onError() {
|
|
60
|
-
return setEmojiLocale(DEFAULT_LOCALE);
|
|
61
|
-
},
|
|
62
|
-
onErrorRetry: function onErrorRetry() {
|
|
63
|
-
return setEmojiLocale(DEFAULT_LOCALE);
|
|
64
|
-
}
|
|
65
|
-
}),
|
|
37
|
+
}))),
|
|
66
38
|
i18n = _useSWR.data;
|
|
67
|
-
var
|
|
68
|
-
|
|
39
|
+
var _useMergeState = useMergeState('🤖', {
|
|
40
|
+
defaultValue: defaultAvatar,
|
|
41
|
+
onChange: onChange,
|
|
42
|
+
value: value
|
|
43
|
+
}),
|
|
44
|
+
_useMergeState2 = _slicedToArray(_useMergeState, 2),
|
|
45
|
+
ava = _useMergeState2[0],
|
|
46
|
+
setAva = _useMergeState2[1];
|
|
69
47
|
return /*#__PURE__*/_jsx(Popover, {
|
|
70
48
|
content: /*#__PURE__*/_jsx("div", {
|
|
71
49
|
className: styles.picker,
|
|
72
|
-
children: /*#__PURE__*/_jsx(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
skinTonePosition: 'none',
|
|
82
|
-
theme: 'auto'
|
|
83
|
-
})
|
|
50
|
+
children: /*#__PURE__*/_jsx(Picker, {
|
|
51
|
+
data: data,
|
|
52
|
+
i18n: i18n,
|
|
53
|
+
locale: locale.split('-')[0],
|
|
54
|
+
onEmojiSelect: function onEmojiSelect(e) {
|
|
55
|
+
return setAva(e.native);
|
|
56
|
+
},
|
|
57
|
+
skinTonePosition: 'none',
|
|
58
|
+
theme: 'auto'
|
|
84
59
|
})
|
|
85
60
|
}),
|
|
86
61
|
placement: 'left',
|
package/es/Giscus/index.d.ts
CHANGED
package/es/Highlighter/index.js
CHANGED
|
@@ -3,17 +3,15 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["fullFeatured", "copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import {
|
|
6
|
+
import { memo } from 'react';
|
|
7
7
|
import CopyButton from "../CopyButton";
|
|
8
|
+
import Spotlight from "../Spotlight";
|
|
8
9
|
import Tag from "../Tag";
|
|
9
10
|
import FullFeatured from "./FullFeatured";
|
|
10
11
|
import SyntaxHighlighter from "./SyntaxHighlighter";
|
|
11
12
|
import { useStyles } from "./style";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
var Spotlight = /*#__PURE__*/lazy(function () {
|
|
15
|
-
return import("../Spotlight");
|
|
16
|
-
});
|
|
17
15
|
export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
18
16
|
var fullFeatured = _ref.fullFeatured,
|
|
19
17
|
_ref$copyButtonSize = _ref.copyButtonSize,
|
|
@@ -46,11 +44,8 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
46
44
|
"data-code-type": "highlighter",
|
|
47
45
|
style: style
|
|
48
46
|
}, rest), {}, {
|
|
49
|
-
children: [/*#__PURE__*/_jsx(
|
|
50
|
-
|
|
51
|
-
children: spotlight && /*#__PURE__*/_jsx(Spotlight, {
|
|
52
|
-
size: 240
|
|
53
|
-
})
|
|
47
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {
|
|
48
|
+
size: 240
|
|
54
49
|
}), copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
55
50
|
className: styles.button,
|
|
56
51
|
content: children,
|
|
@@ -3,9 +3,10 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["active", "avatar", "loading", "description", "date", "title", "onHoverChange", "actions", "className", "style", "showAction", "children", "classNames", "addon", "pin"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import {
|
|
6
|
+
import { Loader2, MessageSquare } from 'lucide-react';
|
|
7
7
|
import { forwardRef } from 'react';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
|
+
import Icon from "../../Icon";
|
|
9
10
|
import { useStyles } from "./style";
|
|
10
11
|
import { getChatItemTime } from "./time";
|
|
11
12
|
|
|
@@ -56,7 +57,8 @@ var ListItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
56
57
|
children: /*#__PURE__*/_jsx("div", {
|
|
57
58
|
className: styles.triangle
|
|
58
59
|
})
|
|
59
|
-
}), avatar !== null && avatar !== void 0 ? avatar : /*#__PURE__*/_jsx(
|
|
60
|
+
}), avatar !== null && avatar !== void 0 ? avatar : /*#__PURE__*/_jsx(Icon, {
|
|
61
|
+
icon: MessageSquare,
|
|
60
62
|
style: {
|
|
61
63
|
marginTop: 4
|
|
62
64
|
}
|
|
@@ -74,7 +76,8 @@ var ListItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
74
76
|
className: styles.desc,
|
|
75
77
|
children: description
|
|
76
78
|
}), addon]
|
|
77
|
-
}), loading ? /*#__PURE__*/_jsx(
|
|
79
|
+
}), loading ? /*#__PURE__*/_jsx(Icon, {
|
|
80
|
+
icon: Loader2,
|
|
78
81
|
spin: true
|
|
79
82
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
80
83
|
children: [showAction && /*#__PURE__*/_jsx(Flexbox, {
|
package/es/SearchBar/index.js
CHANGED
|
@@ -5,17 +5,15 @@ var _excluded = ["defaultValue", "spotlight", "className", "value", "onInputChan
|
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import { Search } from 'lucide-react';
|
|
8
|
-
import {
|
|
8
|
+
import { memo, useEffect, useRef, useState } from 'react';
|
|
9
9
|
import useControlledState from 'use-merge-value';
|
|
10
10
|
import Icon from "../Icon";
|
|
11
11
|
import { Input } from "../Input";
|
|
12
|
+
import Spotlight from "../Spotlight";
|
|
12
13
|
import Tag from "../Tag";
|
|
13
14
|
import { useStyles } from "./style";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
var Spotlight = /*#__PURE__*/lazy(function () {
|
|
17
|
-
return import("../Spotlight");
|
|
18
|
-
});
|
|
19
17
|
var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
20
18
|
var defaultValue = _ref.defaultValue,
|
|
21
19
|
spotlight = _ref.spotlight,
|
|
@@ -68,10 +66,7 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
68
66
|
}, []);
|
|
69
67
|
return /*#__PURE__*/_jsxs("div", {
|
|
70
68
|
className: cx(styles.search, className),
|
|
71
|
-
children: [/*#__PURE__*/_jsx(
|
|
72
|
-
fallback: null,
|
|
73
|
-
children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
|
|
74
|
-
}), /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
69
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
75
70
|
allowClear: true,
|
|
76
71
|
className: styles.input,
|
|
77
72
|
onBlur: function onBlur() {
|
package/es/Snippet/index.js
CHANGED
|
@@ -3,15 +3,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["symbol", "language", "children", "copyable", "type", "spotlight", "className"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import {
|
|
6
|
+
import { memo } from 'react';
|
|
7
7
|
import CopyButton from "../CopyButton";
|
|
8
8
|
import SyntaxHighlighter from "../Highlighter/SyntaxHighlighter";
|
|
9
|
+
import Spotlight from "../Spotlight";
|
|
9
10
|
import { useStyles } from "./style";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
var Spotlight = /*#__PURE__*/lazy(function () {
|
|
13
|
-
return import("../Spotlight");
|
|
14
|
-
});
|
|
15
13
|
var Snippet = /*#__PURE__*/memo(function (_ref) {
|
|
16
14
|
var symbol = _ref.symbol,
|
|
17
15
|
_ref$language = _ref.language,
|
|
@@ -30,10 +28,7 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
28
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
31
29
|
className: cx(styles.container, className)
|
|
32
30
|
}, rest), {}, {
|
|
33
|
-
children: [/*#__PURE__*/_jsx(
|
|
34
|
-
fallback: null,
|
|
35
|
-
children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
|
|
36
|
-
}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
31
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
37
32
|
language: language,
|
|
38
33
|
children: [symbol, children].filter(Boolean).join(' ')
|
|
39
34
|
}), copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
@@ -3,5 +3,5 @@ var _templateObject;
|
|
|
3
3
|
import { css } from 'antd-style';
|
|
4
4
|
import { readableColor } from 'polished';
|
|
5
5
|
export default (function (token) {
|
|
6
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-btn {\n box-shadow: none;\n }\n\n .", "-btn-primary {\n color: ", " !important;\n\n &:hover {\n color: ", " !important;\n }\n\n &:active {\n color: ", " !important;\n }\n }\n\n .", "-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 .", "-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n\n .", "-switch-handle::before {\n background: ", " !important;\n }\n\n
|
|
6
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-btn {\n box-shadow: none;\n }\n\n .", "-btn-primary {\n color: ", " !important;\n\n &:hover {\n color: ", " !important;\n }\n\n &:active {\n color: ", " !important;\n }\n }\n\n .", "-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 .", "-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n\n .", "-switch-handle::before {\n background: ", " !important;\n }\n\n @media (max-width: 575px) {\n .", "-tooltip {\n display: none !important;\n }\n }\n"])), token.prefixCls, token.prefixCls, readableColor(token.colorPrimary), readableColor(token.colorPrimary), readableColor(token.colorPrimaryActive), token.prefixCls, token.colorBgLayout, token.colorText, token.borderRadiusSM, token.prefixCls, token.colorText, token.prefixCls, token.colorBgContainer, token.prefixCls);
|
|
7
7
|
});
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
|
|
2
2
|
export { default as ActionIconGroup, type ActionIconGroupProps } from './ActionIconGroup';
|
|
3
|
+
export { default as Alert, type AlertProps } from './Alert';
|
|
3
4
|
export { default as Avatar, type AvatarProps } from './Avatar';
|
|
4
5
|
export { default as BackBottom, type BackBottomProps } from './BackBottom';
|
|
5
6
|
export { default as Burger, type BurgerProps } from './Burger';
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as ActionIcon } from "./ActionIcon";
|
|
2
2
|
export { default as ActionIconGroup } from "./ActionIconGroup";
|
|
3
|
+
export { default as Alert } from "./Alert";
|
|
3
4
|
export { default as Avatar } from "./Avatar";
|
|
4
5
|
export { default as BackBottom } from "./BackBottom";
|
|
5
6
|
export { default as Burger } from "./Burger";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
|
|
2
1
|
import { ErrorType } from './error';
|
|
3
2
|
import { LLMRoleType } from './llm';
|
|
4
3
|
import { BaseDataModel } from './meta';
|
|
@@ -29,7 +28,7 @@ export interface ChatMessage extends BaseDataModel {
|
|
|
29
28
|
function_call?: OpenAIFunctionCall;
|
|
30
29
|
name?: string;
|
|
31
30
|
parentId?: string;
|
|
32
|
-
plugin?:
|
|
31
|
+
plugin?: any;
|
|
33
32
|
quotaId?: string;
|
|
34
33
|
/**
|
|
35
34
|
* 角色
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.117.0",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"@emoji-mart/react": "^1",
|
|
78
78
|
"@floating-ui/react": "^0",
|
|
79
79
|
"@giscus/react": "^2",
|
|
80
|
-
"@lobehub/chat-plugin-sdk": "latest",
|
|
81
80
|
"@lobehub/emojilib": "latest",
|
|
82
81
|
"@react-spring/web": "^9",
|
|
83
82
|
"@splinetool/react-spline": "^2.2.6",
|