@lobehub/ui 1.86.4 → 1.87.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.
- package/es/ChatItem/components/MessageContent.js +1 -0
- package/es/EditableMessage/index.d.ts +1 -0
- package/es/EditableMessage/index.js +3 -1
- package/es/Form/components/style.js +1 -1
- package/es/Highlighter/FullFeatured.d.ts +15 -0
- package/es/Highlighter/FullFeatured.js +99 -0
- package/es/Highlighter/SyntaxHighlighter/index.d.ts +2 -1
- package/es/Highlighter/SyntaxHighlighter/index.js +10 -4
- package/es/Highlighter/index.d.ts +1 -0
- package/es/Highlighter/index.js +11 -2
- package/es/Highlighter/style.d.ts +2 -0
- package/es/Highlighter/style.js +4 -2
- package/es/Markdown/CodeBlock.d.ts +2 -2
- package/es/Markdown/CodeBlock.js +42 -7
- package/es/Markdown/index.d.ts +1 -0
- package/es/Markdown/index.js +4 -3
- package/es/MessageModal/index.js +1 -0
- package/es/MessageModal/style.d.ts +1 -0
- package/es/MessageModal/style.js +3 -2
- package/es/SearchBar/index.js +1 -1
- package/es/SearchBar/style.js +1 -1
- package/es/Snippet/index.js +5 -3
- package/package.json +1 -1
|
@@ -27,7 +27,8 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
27
|
height = _ref.height,
|
|
28
28
|
inputType = _ref.inputType,
|
|
29
29
|
editButtonSize = _ref.editButtonSize,
|
|
30
|
-
text = _ref.text
|
|
30
|
+
text = _ref.text,
|
|
31
|
+
fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock;
|
|
31
32
|
var _useControlledState = useControlledState(false, {
|
|
32
33
|
onChange: onEditingChange,
|
|
33
34
|
value: editing
|
|
@@ -68,6 +69,7 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
68
69
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
69
70
|
children: [!expand && isEdit ? input : /*#__PURE__*/_jsx(Markdown, {
|
|
70
71
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.markdown,
|
|
72
|
+
fullFeaturedCodeBlock: fullFeaturedCodeBlock,
|
|
71
73
|
style: _objectSpread({
|
|
72
74
|
height: isAutoSize ? 'unset' : height,
|
|
73
75
|
overflowX: 'hidden',
|
|
@@ -13,7 +13,7 @@ export var useStyles = createStyles(function (_ref, itemMinWidth) {
|
|
|
13
13
|
formTitle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: column;\n gap: 6px;\n\n text-align: left;\n\n > div {\n font-weight: 500;\n line-height: 1;\n }\n\n > small {\n display: block;\n\n line-height: 1;\n color: ", ";\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n\n .ant-tag {\n font-family: ", ";\n }\n "])), token.colorTextDescription, token.fontFamilyCode),
|
|
14
14
|
group: cx(isDarkMode && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-collapse-content {\n background: transparent;\n }\n\n .ant-collapse-header {\n background: ", ";\n }\n "])), token.colorFillTertiary), css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .ant-collapse-header {\n align-items: center !important;\n border-radius: 0 !important;\n }\n\n .ant-collapse-content-box {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n }\n\n .ant-form-item-label {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n "])))),
|
|
15
15
|
icon: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n transition: all 100ms ", ";\n "])), token.motionEaseOut),
|
|
16
|
-
item: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 8px 0;\n\n .ant-row {\n justify-content: space-between;\n\n > div {\n flex: unset !important;\n flex-grow: unset !important;\n }\n }\n\n ", "\n\n ", " {\n padding: 16px 0;\n\n .ant-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .ant-form-item-control {\n flex: 1;\n width: 100%;\n }\n }\n "])), itemMinWidth && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n .ant-form-item-control {\n width: ", ";\n }\n "])), isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth), responsive.mobile),
|
|
16
|
+
item: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 8px 0;\n\n .ant-row {\n justify-content: space-between;\n\n > div {\n flex: unset !important;\n flex-grow: unset !important;\n }\n }\n\n .ant-form-item-required::before {\n align-self: flex-start;\n }\n\n ", "\n\n ", " {\n padding: 16px 0;\n\n .ant-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .ant-form-item-control {\n flex: 1;\n width: 100%;\n }\n }\n "])), itemMinWidth && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n .ant-form-item-control {\n width: ", ";\n }\n "])), isNumber(itemMinWidth) ? "".concat(itemMinWidth, "px") : itemMinWidth), responsive.mobile),
|
|
17
17
|
title: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n gap: 8px;\n align-items: center;\n\n font-size: 16px;\n font-weight: 600;\n\n .anticon {\n color: ", ";\n }\n "])), token.colorPrimary)
|
|
18
18
|
};
|
|
19
19
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DivProps } from "../types";
|
|
3
|
+
export interface HighlighterProps extends DivProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description The code content to be highlighted
|
|
6
|
+
*/
|
|
7
|
+
children: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description The language of the code content
|
|
10
|
+
*/
|
|
11
|
+
language: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Highlighter: import("react").NamedExoticComponent<HighlighterProps>;
|
|
14
|
+
export default Highlighter;
|
|
15
|
+
export { default as SyntaxHighlighter, type SyntaxHighlighterProps } from './SyntaxHighlighter';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "language", "className", "style"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import { Select } from 'antd';
|
|
8
|
+
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
9
|
+
import { memo, useState } from 'react';
|
|
10
|
+
import { Flexbox } from 'react-layout-kit';
|
|
11
|
+
import ActionIcon from "../ActionIcon";
|
|
12
|
+
import CopyButton from "../CopyButton";
|
|
13
|
+
import { languageMap } from "../hooks/useHighlight";
|
|
14
|
+
import SyntaxHighlighter from "./SyntaxHighlighter";
|
|
15
|
+
import { useStyles } from "./style";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
var options = languageMap.map(function (item) {
|
|
19
|
+
return {
|
|
20
|
+
label: item,
|
|
21
|
+
value: item.toLowerCase()
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
25
|
+
var children = _ref.children,
|
|
26
|
+
_ref$language = _ref.language,
|
|
27
|
+
language = _ref$language === void 0 ? 'markdown' : _ref$language,
|
|
28
|
+
className = _ref.className,
|
|
29
|
+
style = _ref.style,
|
|
30
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
var _useState = useState(true),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
expand = _useState2[0],
|
|
34
|
+
setExpand = _useState2[1];
|
|
35
|
+
var _useState3 = useState(language),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
lang = _useState4[0],
|
|
38
|
+
setLang = _useState4[1];
|
|
39
|
+
var _useStyles = useStyles('block'),
|
|
40
|
+
styles = _useStyles.styles,
|
|
41
|
+
cx = _useStyles.cx;
|
|
42
|
+
var container = cx(styles.container, className);
|
|
43
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
44
|
+
className: container,
|
|
45
|
+
"data-code-type": "highlighter",
|
|
46
|
+
style: style
|
|
47
|
+
}, props), {}, {
|
|
48
|
+
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
49
|
+
align: 'center',
|
|
50
|
+
className: styles.header,
|
|
51
|
+
horizontal: true,
|
|
52
|
+
justify: 'space-between',
|
|
53
|
+
children: [/*#__PURE__*/_jsx(ActionIcon, {
|
|
54
|
+
icon: expand ? ChevronDown : ChevronRight,
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
return setExpand(!expand);
|
|
57
|
+
},
|
|
58
|
+
size: {
|
|
59
|
+
blockSize: 24,
|
|
60
|
+
fontSize: 14,
|
|
61
|
+
strokeWidth: 3
|
|
62
|
+
}
|
|
63
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
64
|
+
size: {
|
|
65
|
+
blockSize: 24
|
|
66
|
+
},
|
|
67
|
+
style: {
|
|
68
|
+
width: 'unset'
|
|
69
|
+
},
|
|
70
|
+
children: /*#__PURE__*/_jsx(Select, {
|
|
71
|
+
bordered: false,
|
|
72
|
+
className: styles.select,
|
|
73
|
+
onSelect: setLang,
|
|
74
|
+
options: options,
|
|
75
|
+
size: 'small',
|
|
76
|
+
suffixIcon: false,
|
|
77
|
+
value: lang.toLowerCase()
|
|
78
|
+
})
|
|
79
|
+
}), /*#__PURE__*/_jsx(CopyButton, {
|
|
80
|
+
content: children,
|
|
81
|
+
placement: "left",
|
|
82
|
+
size: {
|
|
83
|
+
blockSize: 24,
|
|
84
|
+
fontSize: 14,
|
|
85
|
+
strokeWidth: 2
|
|
86
|
+
}
|
|
87
|
+
})]
|
|
88
|
+
}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
89
|
+
language: lang === null || lang === void 0 ? void 0 : lang.toLowerCase(),
|
|
90
|
+
style: expand ? {} : {
|
|
91
|
+
height: 0,
|
|
92
|
+
overflow: 'hidden'
|
|
93
|
+
},
|
|
94
|
+
children: children === null || children === void 0 ? void 0 : children.trim()
|
|
95
|
+
})]
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
98
|
+
export default Highlighter;
|
|
99
|
+
export { default as SyntaxHighlighter } from "./SyntaxHighlighter";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type HighlighterCoreOptions } from 'shikiji';
|
|
3
|
-
|
|
3
|
+
import { DivProps } from "../../types";
|
|
4
|
+
export interface SyntaxHighlighterProps extends DivProps {
|
|
4
5
|
children: string;
|
|
5
6
|
language: string;
|
|
6
7
|
options?: HighlighterCoreOptions;
|
|
@@ -12,9 +12,12 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
12
12
|
var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
|
|
13
13
|
var children = _ref.children,
|
|
14
14
|
language = _ref.language,
|
|
15
|
-
options = _ref.options
|
|
15
|
+
options = _ref.options,
|
|
16
|
+
className = _ref.className,
|
|
17
|
+
style = _ref.style;
|
|
16
18
|
var _useStyles = useStyles(),
|
|
17
|
-
styles = _useStyles.styles
|
|
19
|
+
styles = _useStyles.styles,
|
|
20
|
+
cx = _useStyles.cx;
|
|
18
21
|
var _useThemeMode = useThemeMode(),
|
|
19
22
|
isDarkMode = _useThemeMode.isDarkMode;
|
|
20
23
|
var _useHighlight = useHighlight(function (s) {
|
|
@@ -28,12 +31,15 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
28
31
|
}, [options]);
|
|
29
32
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
30
33
|
children: [isLoading ? /*#__PURE__*/_jsx("code", {
|
|
34
|
+
className: className,
|
|
35
|
+
style: style,
|
|
31
36
|
children: children
|
|
32
37
|
}) : /*#__PURE__*/_jsx("div", {
|
|
33
|
-
className: styles.shiki,
|
|
38
|
+
className: cx(styles.shiki, className),
|
|
34
39
|
dangerouslySetInnerHTML: {
|
|
35
40
|
__html: codeToHtml(children, language, isDarkMode) || ''
|
|
36
|
-
}
|
|
41
|
+
},
|
|
42
|
+
style: style
|
|
37
43
|
}), isLoading && /*#__PURE__*/_jsxs(Center, {
|
|
38
44
|
className: styles.loading,
|
|
39
45
|
gap: 8,
|
package/es/Highlighter/index.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
|
|
3
|
+
var _excluded = ["fullFeatured", "copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
|
|
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 CopyButton from "../CopyButton";
|
|
8
8
|
import Spotlight from "../Spotlight";
|
|
9
9
|
import Tag from "../Tag";
|
|
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
15
|
export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
15
|
-
var
|
|
16
|
+
var fullFeatured = _ref.fullFeatured,
|
|
17
|
+
_ref$copyButtonSize = _ref.copyButtonSize,
|
|
16
18
|
copyButtonSize = _ref$copyButtonSize === void 0 ? 'site' : _ref$copyButtonSize,
|
|
17
19
|
children = _ref.children,
|
|
18
20
|
language = _ref.language,
|
|
@@ -30,6 +32,13 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
32
|
styles = _useStyles.styles,
|
|
31
33
|
cx = _useStyles.cx;
|
|
32
34
|
var container = cx(styles.container, className);
|
|
35
|
+
if (fullFeatured) return /*#__PURE__*/_jsx(FullFeatured, _objectSpread(_objectSpread({
|
|
36
|
+
className: className,
|
|
37
|
+
language: language,
|
|
38
|
+
style: style
|
|
39
|
+
}, props), {}, {
|
|
40
|
+
children: children
|
|
41
|
+
}));
|
|
33
42
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
34
43
|
className: container,
|
|
35
44
|
"data-code-type": "highlighter",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const useStyles: (props?: "block" | "ghost" | "pure" | undefined) => import("antd-style").ReturnStyles<{
|
|
2
2
|
button: string;
|
|
3
3
|
container: string;
|
|
4
|
+
header: import("antd-style").SerializedStyles;
|
|
4
5
|
lang: string;
|
|
6
|
+
select: import("antd-style").SerializedStyles;
|
|
5
7
|
}>;
|
package/es/Highlighter/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, type) {
|
|
5
5
|
var token = _ref.token,
|
|
@@ -14,6 +14,8 @@ export var useStyles = createStyles(function (_ref, type) {
|
|
|
14
14
|
return {
|
|
15
15
|
button: cx(buttonHoverCls, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n top: ", ";\n right: ", ";\n\n opacity: 0;\n "])), type === 'pure' ? 0 : '8px', type === 'pure' ? 0 : '8px')),
|
|
16
16
|
container: cx(prefix, type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: auto;\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding: ", " !important;\n background: none !important;\n }\n\n code {\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, buttonHoverCls, langHoverCls, type === 'pure' ? 0 : "16px 24px")),
|
|
17
|
-
|
|
17
|
+
header: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 4px 8px;\n background: ", ";\n "])), token.colorFillQuaternary),
|
|
18
|
+
lang: cx(langHoverCls, stylish.blur, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n right: 0;\n bottom: 8px;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary)),
|
|
19
|
+
select: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .ant-select-selection-item {\n min-width: 100px;\n padding-inline-end: 0 !important;\n color: ", ";\n text-align: center;\n }\n "])), token.colorTextDescription)
|
|
18
20
|
};
|
|
19
21
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const
|
|
3
|
-
export
|
|
2
|
+
export declare const CodeLite: import("react").MemoExoticComponent<(properties: any) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export declare const CodeFullFeatured: import("react").MemoExoticComponent<(properties: any) => import("react/jsx-runtime").JSX.Element>;
|
package/es/Markdown/CodeBlock.js
CHANGED
|
@@ -1,30 +1,65 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
1
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var
|
|
4
|
+
var _excluded = ["fullFeatured"];
|
|
5
|
+
var _templateObject, _templateObject2;
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
3
8
|
import { createStyles } from 'antd-style';
|
|
4
9
|
import { memo } from 'react';
|
|
5
10
|
import Highlighter from "../Highlighter";
|
|
11
|
+
import Snippet from "../Snippet";
|
|
6
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
13
|
var useStyles = createStyles(function (_ref) {
|
|
8
14
|
var css = _ref.css;
|
|
9
|
-
return
|
|
15
|
+
return {
|
|
16
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :not(:last-child) {\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0;\n margin-inline-end: 0;\n }\n "]))),
|
|
17
|
+
highlight: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pre {\n padding: 12px !important;\n }\n "])))
|
|
18
|
+
};
|
|
10
19
|
});
|
|
11
|
-
var
|
|
20
|
+
var countLines = function countLines(str) {
|
|
21
|
+
var regex = /\n/g;
|
|
22
|
+
var matches = str.match(regex);
|
|
23
|
+
return matches ? matches.length : 1;
|
|
24
|
+
};
|
|
25
|
+
var Code = /*#__PURE__*/memo(function (_ref2) {
|
|
26
|
+
var fullFeatured = _ref2.fullFeatured,
|
|
27
|
+
properties = _objectWithoutProperties(_ref2, _excluded);
|
|
12
28
|
var _useStyles = useStyles(),
|
|
13
|
-
styles = _useStyles.styles
|
|
29
|
+
styles = _useStyles.styles,
|
|
30
|
+
cx = _useStyles.cx;
|
|
14
31
|
if (!properties.children[0]) return;
|
|
15
32
|
var _properties$children$ = properties.children[0].props,
|
|
16
33
|
children = _properties$children$.children,
|
|
17
34
|
className = _properties$children$.className;
|
|
18
35
|
if (!children) return;
|
|
36
|
+
var content = Array.isArray(children) ? children[0] : children;
|
|
37
|
+
if (countLines(content) === 1 && content.length <= 60) {
|
|
38
|
+
return /*#__PURE__*/_jsx(Snippet, {
|
|
39
|
+
className: styles.container,
|
|
40
|
+
"data-code-type": "highlighter",
|
|
41
|
+
language: (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'markdown',
|
|
42
|
+
type: 'block',
|
|
43
|
+
children: content
|
|
44
|
+
});
|
|
45
|
+
}
|
|
19
46
|
return /*#__PURE__*/_jsx(Highlighter, {
|
|
20
|
-
className: styles,
|
|
47
|
+
className: cx(styles.container, styles.highlight),
|
|
21
48
|
copyButtonSize: {
|
|
22
49
|
blockSize: 28,
|
|
23
50
|
fontSize: 16
|
|
24
51
|
},
|
|
52
|
+
fullFeatured: fullFeatured,
|
|
25
53
|
language: (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'markdown',
|
|
26
54
|
type: "block",
|
|
27
|
-
children:
|
|
55
|
+
children: content
|
|
28
56
|
});
|
|
29
57
|
});
|
|
30
|
-
export
|
|
58
|
+
export var CodeLite = /*#__PURE__*/memo(function (properties) {
|
|
59
|
+
return /*#__PURE__*/_jsx(Code, _objectSpread({}, properties));
|
|
60
|
+
});
|
|
61
|
+
export var CodeFullFeatured = /*#__PURE__*/memo(function (properties) {
|
|
62
|
+
return /*#__PURE__*/_jsx(Code, _objectSpread({
|
|
63
|
+
fullFeatured: true
|
|
64
|
+
}, properties));
|
|
65
|
+
});
|
package/es/Markdown/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface MarkdownProps {
|
|
|
9
9
|
* @description The class name for the Markdown component
|
|
10
10
|
*/
|
|
11
11
|
className?: string;
|
|
12
|
+
fullFeaturedCodeBlock?: boolean;
|
|
12
13
|
style?: CSSProperties;
|
|
13
14
|
}
|
|
14
15
|
declare const Markdown: import("react").NamedExoticComponent<MarkdownProps>;
|
package/es/Markdown/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className", "style"];
|
|
3
|
+
var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock"];
|
|
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 { Collapse, Divider, Image, Typography } from 'antd';
|
|
@@ -12,13 +12,14 @@ import rehypeKatex from 'rehype-katex';
|
|
|
12
12
|
import rehypeRaw from 'rehype-raw';
|
|
13
13
|
import remarkGfm from 'remark-gfm';
|
|
14
14
|
import remarkMath from 'remark-math';
|
|
15
|
-
import
|
|
15
|
+
import { CodeFullFeatured, CodeLite } from "./CodeBlock";
|
|
16
16
|
import { useStyles } from "./style";
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
19
19
|
var children = _ref.children,
|
|
20
20
|
className = _ref.className,
|
|
21
21
|
style = _ref.style,
|
|
22
|
+
fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock,
|
|
22
23
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
24
|
var _useStyles = useStyles(),
|
|
24
25
|
styles = _useStyles.styles;
|
|
@@ -34,7 +35,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
34
35
|
});
|
|
35
36
|
},
|
|
36
37
|
img: Image,
|
|
37
|
-
pre:
|
|
38
|
+
pre: fullFeaturedCodeBlock ? CodeFullFeatured : CodeLite
|
|
38
39
|
};
|
|
39
40
|
return /*#__PURE__*/_jsx(Typography, {
|
|
40
41
|
className: className,
|
package/es/MessageModal/index.js
CHANGED
|
@@ -67,6 +67,7 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
67
67
|
children: (text === null || text === void 0 ? void 0 : text.title) || 'Prompt'
|
|
68
68
|
}),
|
|
69
69
|
width: 800,
|
|
70
|
+
wrapClassName: styles.root,
|
|
70
71
|
children: isEdit ? /*#__PURE__*/_jsx(MessageInput, {
|
|
71
72
|
defaultValue: value,
|
|
72
73
|
height: height,
|
package/es/MessageModal/style.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
prefixCls = _ref.prefixCls;
|
|
7
7
|
return {
|
|
8
8
|
body: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow-x: hidden;\n overflow-y: auto;\n max-height: 70vh;\n "]))),
|
|
9
|
-
modal: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-modal-content {\n padding: 16px;\n }\n .", "-modal-header {\n margin-bottom: 16px;\n }\n "])), prefixCls, prefixCls)
|
|
9
|
+
modal: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-modal-content {\n padding: 16px;\n }\n .", "-modal-header {\n margin-bottom: 16px;\n }\n "])), prefixCls, prefixCls),
|
|
10
|
+
root: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n backdrop-filter: blur(2px);\n "])))
|
|
10
11
|
};
|
|
11
12
|
});
|
package/es/SearchBar/index.js
CHANGED
|
@@ -5,12 +5,12 @@ var _excluded = ["spotlight", "className", "value", "onChange", "placeholder", "
|
|
|
5
5
|
var _navigator;
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
|
-
import { Tag } from 'antd';
|
|
9
8
|
import { Search } from 'lucide-react';
|
|
10
9
|
import { memo, useEffect, useRef, useState } from 'react';
|
|
11
10
|
import Icon from "../Icon";
|
|
12
11
|
import { Input } from "../Input";
|
|
13
12
|
import Spotlight from "../Spotlight";
|
|
13
|
+
import Tag from "../Tag";
|
|
14
14
|
import { useStyles } from "./style";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
package/es/SearchBar/style.js
CHANGED
|
@@ -8,6 +8,6 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
8
8
|
icon: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextPlaceholder),
|
|
9
9
|
input: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding: 0 8px 0 12px;\n "]))),
|
|
10
10
|
search: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n "]))),
|
|
11
|
-
tag: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 5;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n\n
|
|
11
|
+
tag: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 5;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n\n color: ", ";\n "])), token.colorTextDescription)
|
|
12
12
|
};
|
|
13
13
|
});
|
package/es/Snippet/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["symbol", "language", "children", "copyable", "type", "spotlight"];
|
|
3
|
+
var _excluded = ["symbol", "language", "children", "copyable", "type", "spotlight", "className"];
|
|
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';
|
|
@@ -20,11 +20,13 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
|
|
|
20
20
|
_ref$type = _ref.type,
|
|
21
21
|
type = _ref$type === void 0 ? 'ghost' : _ref$type,
|
|
22
22
|
spotlight = _ref.spotlight,
|
|
23
|
+
className = _ref.className,
|
|
23
24
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
25
|
var _useStyles = useStyles(type),
|
|
25
|
-
styles = _useStyles.styles
|
|
26
|
+
styles = _useStyles.styles,
|
|
27
|
+
cx = _useStyles.cx;
|
|
26
28
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
27
|
-
className: styles.container
|
|
29
|
+
className: cx(styles.container, className)
|
|
28
30
|
}, props), {}, {
|
|
29
31
|
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
30
32
|
language: language,
|