@lobehub/ui 1.43.0 → 1.45.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/ChatHeader/style.d.ts +1 -1
- package/es/ChatHeader/style.js +5 -2
- package/es/ChatInputArea/InputHighlight.d.ts +7 -0
- package/es/ChatInputArea/InputHighlight.js +32 -0
- package/es/ChatInputArea/index.d.ts +3 -0
- package/es/ChatInputArea/index.js +46 -37
- package/es/ChatInputArea/style.d.ts +2 -0
- package/es/ChatInputArea/style.js +6 -3
- package/es/ChatItem/style.js +4 -2
- package/es/CodeEditor/index.d.ts +0 -1
- package/es/CodeEditor/index.js +1 -3
- package/es/CodeEditor/style.js +4 -5
- package/es/DraggablePanel/index.d.ts +1 -0
- package/es/DraggablePanel/index.js +4 -2
- package/es/DraggablePanel/style.d.ts +1 -1
- package/es/DraggablePanel/style.js +5 -5
- package/es/EditableMessage/index.d.ts +12 -1
- package/es/EditableMessage/index.js +18 -6
- package/es/GradientButton/index.d.ts +3 -9
- package/es/Highlighter/SyntaxHighlighter/index.d.ts +0 -1
- package/es/Highlighter/SyntaxHighlighter/index.js +2 -7
- package/es/Highlighter/SyntaxHighlighter/style.js +1 -1
- package/es/Highlighter/index.d.ts +0 -5
- package/es/Highlighter/index.js +1 -3
- package/es/Highlighter/theme.js +9 -3
- package/es/Markdown/CodeBlock.js +1 -3
- package/es/Markdown/index.d.ts +2 -1
- package/es/Markdown/index.js +6 -4
- package/es/MessageInput/index.d.ts +4 -0
- package/es/MessageInput/index.js +12 -6
- package/es/styles/algorithms/generateCustomStylish.js +7 -6
- package/es/types/customStylish.d.ts +1 -0
- package/package.json +1 -1
package/es/ChatHeader/style.d.ts
CHANGED
package/es/ChatHeader/style.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
+
import { rgba } from 'polished';
|
|
4
5
|
export var useStyles = createStyles(function (_ref) {
|
|
5
6
|
var css = _ref.css,
|
|
6
|
-
token = _ref.token
|
|
7
|
+
token = _ref.token,
|
|
8
|
+
stylish = _ref.stylish,
|
|
9
|
+
cx = _ref.cx;
|
|
7
10
|
return {
|
|
8
|
-
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
11
|
+
container: cx(stylish.blurStrong, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n\n grid-area: header;\n align-self: stretch;\n\n width: 100%;\n height: 64px;\n\n background: linear-gradient(\n to bottom,\n ", ",\n ", "\n );\n border-bottom: 1px solid ", ";\n "])), rgba(token.colorBgLayout, 0.8), rgba(token.colorBgLayout, 0.4), token.colorSplit))
|
|
9
12
|
};
|
|
10
13
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useScroll, useSize } from 'ahooks';
|
|
2
|
+
import { memo, useEffect, useRef } from 'react';
|
|
3
|
+
import { SyntaxHighlighter } from "../Highlighter";
|
|
4
|
+
import { useStyles } from "./style";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
var InputHighlight = /*#__PURE__*/memo(function (_ref) {
|
|
7
|
+
var value = _ref.value,
|
|
8
|
+
target = _ref.target;
|
|
9
|
+
var ref = useRef(null);
|
|
10
|
+
var _useStyles = useStyles(),
|
|
11
|
+
styles = _useStyles.styles;
|
|
12
|
+
var nativeTextarea = document.querySelector("#".concat(target));
|
|
13
|
+
var size = useSize(nativeTextarea);
|
|
14
|
+
var scroll = useScroll(nativeTextarea);
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
ref.current.scroll(0, (scroll === null || scroll === void 0 ? void 0 : scroll.top) || 0);
|
|
17
|
+
}, [scroll === null || scroll === void 0 ? void 0 : scroll.top]);
|
|
18
|
+
return /*#__PURE__*/_jsx("div", {
|
|
19
|
+
className: styles.highlight,
|
|
20
|
+
"data-code-type": "highlighter",
|
|
21
|
+
ref: ref,
|
|
22
|
+
style: {
|
|
23
|
+
height: size === null || size === void 0 ? void 0 : size.height,
|
|
24
|
+
width: size === null || size === void 0 ? void 0 : size.width
|
|
25
|
+
},
|
|
26
|
+
children: /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
27
|
+
language: "markdown",
|
|
28
|
+
children: value.trim()
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
export default InputHighlight;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["textareaClassName", "style", "textareaStyle", "minHeight", "className", "actions", "footer", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange"];
|
|
4
|
+
var _excluded = ["text", "textareaClassName", "style", "textareaStyle", "minHeight", "className", "actions", "footer", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange"];
|
|
5
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
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
7
|
import { Button } from 'antd';
|
|
@@ -9,11 +9,13 @@ import { Maximize2, Minimize2 } from 'lucide-react';
|
|
|
9
9
|
import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
|
10
10
|
import ActionIcon from "../ActionIcon";
|
|
11
11
|
import { TextArea } from "../Input";
|
|
12
|
+
import InputHighlight from "./InputHighlight";
|
|
12
13
|
import { useStyles } from "./style";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
|
-
var
|
|
17
|
+
var text = _ref.text,
|
|
18
|
+
textareaClassName = _ref.textareaClassName,
|
|
17
19
|
style = _ref.style,
|
|
18
20
|
textareaStyle = _ref.textareaStyle,
|
|
19
21
|
_ref$minHeight = _ref.minHeight,
|
|
@@ -73,47 +75,54 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
73
75
|
onClick: handleExpandClick
|
|
74
76
|
})
|
|
75
77
|
})]
|
|
76
|
-
}), /*#__PURE__*/
|
|
77
|
-
className:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
78
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
79
|
+
className: styles.textareaContainer,
|
|
80
|
+
children: [/*#__PURE__*/_jsx(InputHighlight, {
|
|
81
|
+
target: 'lobe-chat-input-area',
|
|
82
|
+
value: value
|
|
83
|
+
}), /*#__PURE__*/_jsx(TextArea, _objectSpread(_objectSpread({
|
|
84
|
+
className: cx(styles.textarea, textareaClassName),
|
|
85
|
+
defaultValue: defaultValue,
|
|
86
|
+
id: 'lobe-chat-input-area',
|
|
87
|
+
ref: ref,
|
|
88
|
+
style: textareaStyle
|
|
89
|
+
}, props), {}, {
|
|
90
|
+
onBlur: function onBlur(e) {
|
|
91
|
+
if (_onBlur) _onBlur(e);
|
|
92
|
+
setValue(e.target.value);
|
|
93
|
+
},
|
|
94
|
+
onChange: function onChange(e) {
|
|
95
|
+
if (_onChange) _onChange(e);
|
|
96
|
+
setValue(e.target.value);
|
|
97
|
+
},
|
|
98
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
99
|
+
if (_onCompositionEnd) _onCompositionEnd(e);
|
|
100
|
+
isChineseInput.current = false;
|
|
101
|
+
},
|
|
102
|
+
onCompositionStart: function onCompositionStart(e) {
|
|
103
|
+
if (_onCompositionStart) _onCompositionStart(e);
|
|
104
|
+
isChineseInput.current = true;
|
|
105
|
+
},
|
|
106
|
+
onPressEnter: function onPressEnter(e) {
|
|
107
|
+
if (_onPressEnter) _onPressEnter(e);
|
|
108
|
+
if (!loading && !e.shiftKey && !isChineseInput.current) {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
handleSend();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
placeholder: placeholder,
|
|
114
|
+
resize: false,
|
|
115
|
+
type: "pure",
|
|
116
|
+
value: value
|
|
117
|
+
}))]
|
|
118
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
110
119
|
className: styles.footerBar,
|
|
111
120
|
children: [footer, /*#__PURE__*/_jsx(Button, {
|
|
112
121
|
disabled: disabled,
|
|
113
122
|
loading: loading,
|
|
114
123
|
onClick: handleSend,
|
|
115
124
|
type: "primary",
|
|
116
|
-
children:
|
|
125
|
+
children: (text === null || text === void 0 ? void 0 : text.send) || 'Send'
|
|
117
126
|
})]
|
|
118
127
|
})]
|
|
119
128
|
});
|
|
@@ -4,5 +4,7 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
4
4
|
actionsRight: import("antd-style").SerializedStyles;
|
|
5
5
|
container: import("antd-style").SerializedStyles;
|
|
6
6
|
footerBar: import("antd-style").SerializedStyles;
|
|
7
|
+
highlight: import("antd-style").SerializedStyles;
|
|
7
8
|
textarea: import("antd-style").SerializedStyles;
|
|
9
|
+
textareaContainer: import("antd-style").SerializedStyles;
|
|
8
10
|
}>;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
|
-
var css = _ref.css
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
6
7
|
return {
|
|
7
8
|
actionLeft: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n gap: 4px;\n align-items: center;\n justify-content: flex-start;\n "]))),
|
|
8
9
|
actionsBar: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex: none;\n align-items: center;\n justify-content: space-between;\n\n padding: 0 16px;\n "]))),
|
|
9
10
|
actionsRight: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0;\n gap: 4px;\n align-items: center;\n justify-content: flex-end;\n "]))),
|
|
10
11
|
container: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n height: 100%;\n padding: 12px 0 16px;\n "]))),
|
|
11
12
|
footerBar: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex: none;\n gap: 8px;\n align-items: center;\n justify-content: flex-end;\n\n padding: 0 24px;\n "]))),
|
|
12
|
-
|
|
13
|
+
highlight: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n inset: 0;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n padding: 0 24px;\n\n .shiki {\n margin: 0;\n }\n\n pre {\n font-family: ", " !important;\n line-height: 1.5;\n color: ", ";\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n "])), token.fontFamilyCode, token.colorSuccess),
|
|
14
|
+
textarea: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 100% !important;\n padding: 0 24px;\n\n font-family: ", " !important;\n line-height: 1.5;\n color: transparent;\n\n caret-color: ", ";\n "])), token.fontFamilyCode, token.colorText),
|
|
15
|
+
textareaContainer: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n flex: 1;\n "])))
|
|
13
16
|
};
|
|
14
17
|
});
|
package/es/ChatItem/style.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
+
import { rgba } from 'polished';
|
|
4
5
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
6
|
var cx = _ref.cx,
|
|
6
7
|
css = _ref.css,
|
|
7
|
-
token = _ref.token
|
|
8
|
+
token = _ref.token,
|
|
9
|
+
isDarkMode = _ref.isDarkMode;
|
|
8
10
|
var placement = _ref2.placement,
|
|
9
11
|
type = _ref2.type,
|
|
10
12
|
title = _ref2.title,
|
|
11
13
|
primary = _ref2.primary,
|
|
12
14
|
avatarSize = _ref2.avatarSize,
|
|
13
15
|
showTitle = _ref2.showTitle;
|
|
14
|
-
var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px 12px;\n background-color: ", ";\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n "])), primary ? token.colorFillSecondary : token.colorFillTertiary, token.borderRadiusLG, token.motionEaseOut);
|
|
16
|
+
var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px 12px;\n background-color: ", ";\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n "])), primary ? isDarkMode ? token.colorFillSecondary : rgba(token.colorPrimary, 0.08) : isDarkMode ? token.colorFillTertiary : token.colorBgContainer, token.borderRadiusLG, token.motionEaseOut);
|
|
15
17
|
var pureStylish = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-top: ", ";\n "])), title ? 0 : '6px');
|
|
16
18
|
var pureContainerStylish = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n transition: background-color 100ms ", ";\n "])), token.motionEaseOut);
|
|
17
19
|
var typeStylish = type === 'block' ? blockStylish : pureStylish;
|
package/es/CodeEditor/index.d.ts
CHANGED
package/es/CodeEditor/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 = ["style", "language", "
|
|
3
|
+
var _excluded = ["style", "language", "value", "onValueChange", "resize", "className", "textareaClassName", "type"];
|
|
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 { forwardRef } from 'react';
|
|
@@ -11,7 +11,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
var CodeEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
12
12
|
var style = _ref.style,
|
|
13
13
|
language = _ref.language,
|
|
14
|
-
theme = _ref.theme,
|
|
15
14
|
value = _ref.value,
|
|
16
15
|
onValueChange = _ref.onValueChange,
|
|
17
16
|
_ref$resize = _ref.resize,
|
|
@@ -35,7 +34,6 @@ var CodeEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
34
|
highlight: function highlight(code) {
|
|
36
35
|
return /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
37
36
|
language: language,
|
|
38
|
-
theme: theme,
|
|
39
37
|
children: code
|
|
40
38
|
});
|
|
41
39
|
},
|
package/es/CodeEditor/style.js
CHANGED
|
@@ -4,14 +4,13 @@ import { createStyles } from 'antd-style';
|
|
|
4
4
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
5
|
var cx = _ref.cx,
|
|
6
6
|
css = _ref.css,
|
|
7
|
-
token = _ref.token
|
|
8
|
-
isDarkMode = _ref.isDarkMode;
|
|
7
|
+
token = _ref.token;
|
|
9
8
|
var type = _ref2.type,
|
|
10
9
|
resize = _ref2.resize;
|
|
11
10
|
var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n\n transition:\n background-color 100ms ", ",\n border-color 200ms ", ";\n\n &:hover {\n background-color: ", ";\n border-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorderSecondary, token.borderRadius, token.motionEaseOut, token.motionEaseOut, type === 'block' ? token.colorFillSecondary : token.colorFillQuaternary, token.colorBorder);
|
|
12
11
|
return {
|
|
13
|
-
container: cx(type !== 'pure' && typeStylish, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow-x: hidden;\n overflow-y: auto;\n height: fit-content;\n "])))),
|
|
14
|
-
editor: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n resize: ", ";\n height: fit-content;\n font-family: ", " !important;\n\n pre {\n word-wrap: break-word;\n white-space: pre-wrap;\n\n &.shiki {\n margin: 0;\n }\n }\n "])), resize ? 'vertical' : 'none', token.fontFamilyCode),
|
|
15
|
-
textarea: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow-x: hidden;\n overflow-y: auto;\n height: 100% !important;\n\n
|
|
12
|
+
container: cx(type !== 'pure' && typeStylish, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow-x: hidden;\n overflow-y: auto;\n width: 100%;\n height: fit-content;\n "])))),
|
|
13
|
+
editor: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n resize: ", ";\n height: fit-content;\n min-height: 100%;\n font-family: ", " !important;\n\n textarea {\n min-height: 36px !important;\n }\n\n pre {\n min-height: 36px !important;\n word-wrap: break-word;\n white-space: pre-wrap;\n\n &.shiki {\n margin: 0;\n }\n }\n "])), resize ? 'vertical' : 'none', token.fontFamilyCode),
|
|
14
|
+
textarea: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow-x: hidden;\n overflow-y: auto;\n\n height: 100% !important;\n\n color: transparent !important;\n\n caret-color: ", ";\n\n -webkit-text-fill-color: unset !important;\n\n &::placeholder {\n color: ", ";\n }\n\n &:focus {\n border: none !important;\n outline: none !important;\n box-shadow: none !important;\n }\n "])), token.colorText, token.colorTextQuaternary)
|
|
16
15
|
};
|
|
17
16
|
});
|
|
@@ -15,7 +15,9 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
var DEFAULT_HEIGHT = 180;
|
|
16
16
|
var DEFAULT_WIDTH = 280;
|
|
17
17
|
var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
|
|
18
|
-
var
|
|
18
|
+
var _ref$headerHeight = _ref.headerHeight,
|
|
19
|
+
headerHeight = _ref$headerHeight === void 0 ? 0 : _ref$headerHeight,
|
|
20
|
+
fullscreen = _ref.fullscreen,
|
|
19
21
|
maxHeight = _ref.maxHeight,
|
|
20
22
|
_ref$pin = _ref.pin,
|
|
21
23
|
pin = _ref$pin === void 0 ? 'true' : _ref$pin,
|
|
@@ -48,7 +50,7 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
|
|
|
48
50
|
var reference = useRef();
|
|
49
51
|
var isHovering = useHover(reference);
|
|
50
52
|
var isVertical = placement === 'top' || placement === 'bottom';
|
|
51
|
-
var _useStyles = useStyles(),
|
|
53
|
+
var _useStyles = useStyles(headerHeight),
|
|
52
54
|
styles = _useStyles.styles,
|
|
53
55
|
cx = _useStyles.cx;
|
|
54
56
|
var _useControlledState = useControlledState(defaultExpand, {
|
|
@@ -5,7 +5,7 @@ var offset = 16;
|
|
|
5
5
|
var toggleLength = 40;
|
|
6
6
|
var toggleShort = 16;
|
|
7
7
|
var prefix = 'draggable-panel';
|
|
8
|
-
export var useStyles = createStyles(function (_ref) {
|
|
8
|
+
export var useStyles = createStyles(function (_ref, headerHeight) {
|
|
9
9
|
var token = _ref.token;
|
|
10
10
|
var commonHandle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n &::before {\n content: '';\n position: absolute;\n z-index: 50;\n transition: all 0.2s ", ";\n }\n\n &:hover,\n &:active {\n &::before {\n background: ", " !important;\n }\n }\n "])), token.motionEaseOut, token.colorPrimary);
|
|
11
11
|
var commonToggle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 101;\n opacity: 0;\n transition: all 0.2s ", ";\n\n &:hover {\n opacity: 1 !important;\n }\n\n &:active {\n opacity: 1 !important;\n }\n\n > div {\n cursor: pointer;\n\n position: absolute;\n\n color: ", ";\n\n background: ", ";\n border-color: ", ";\n border-style: solid;\n border-width: 1px;\n border-radius: 4px;\n\n transition: all 0.2s ", ";\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n\n &:active {\n color: ", ";\n background: ", ";\n }\n }\n "])), token.motionEaseOut, token.colorTextTertiary, token.colorFillTertiary, token.colorBorderSecondary, token.motionEaseOut, token.colorTextSecondary, token.colorFillSecondary, token.colorText, token.colorFill);
|
|
@@ -15,18 +15,18 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
15
15
|
bottomHandle: cx("".concat(prefix, "-bottom-handle"), css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", ";\n\n &::before {\n bottom: 50%;\n width: 100%;\n height: 2px;\n }\n "])), commonHandle)),
|
|
16
16
|
container: cx(prefix, css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n border: 0 solid ", ";\n\n &:hover {\n .", "-toggle {\n opacity: 1;\n }\n }\n "])), token.colorBorderSecondary, prefix)),
|
|
17
17
|
fixed: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n "]))),
|
|
18
|
-
fullscreen: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100
|
|
18
|
+
fullscreen: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: absolute;\n inset: ", "px 0 0 0;\n\n width: 100%;\n height: calc(100% - ", "px);\n\n background: ", ";\n "])), headerHeight, headerHeight, token.colorBgLayout),
|
|
19
19
|
handlerIcon: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ", ";\n "])), token.motionEaseOut),
|
|
20
|
-
leftFloat: cx(float, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n top:
|
|
20
|
+
leftFloat: cx(float, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n top: ", "px;\n bottom: 0;\n left: 0;\n height: calc(100% - ", "px);\n "])), headerHeight, headerHeight)),
|
|
21
21
|
leftHandle: cx(css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n ", ";\n\n &::before {\n left: 50%;\n width: 2px;\n height: 100%;\n }\n "])), commonHandle), "".concat(prefix, "-left-handle")),
|
|
22
22
|
panel: cx("".concat(prefix, "-fixed"), css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n overflow: hidden;\n transition: all 0.2s ", ";\n "])), token.motionEaseOut)),
|
|
23
|
-
rightFloat: cx(float, css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n top:
|
|
23
|
+
rightFloat: cx(float, css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n top: ", "px;\n right: 0;\n bottom: 0;\n height: calc(100% - ", "px);\n "])), headerHeight, headerHeight)),
|
|
24
24
|
rightHandle: cx(css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n ", ";\n &::before {\n right: 50%;\n width: 2px;\n height: 100%;\n }\n "])), commonHandle), "".concat(prefix, "-right-handle")),
|
|
25
25
|
toggleBottom: cx("".concat(prefix, "-toggle"), "".concat(prefix, "-toggle-bottom"), commonToggle, css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n bottom: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n left: 50%;\n\n width: ", "px;\n height: 16px;\n margin-left: -20px;\n\n border-radius: 0 0 4px 4px;\n }\n "])), offset, toggleShort, toggleLength)),
|
|
26
26
|
toggleLeft: cx("".concat(prefix, "-toggle"), "".concat(prefix, "-toggle-left"), commonToggle, css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n left: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n top: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-top: -20px;\n\n border-radius: 4px 0 0 4px;\n }\n "])), offset, toggleShort, toggleShort, toggleLength)),
|
|
27
27
|
toggleRight: cx("".concat(prefix, "-toggle"), "".concat(prefix, "-toggle-right"), commonToggle, css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n right: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n top: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-top: -20px;\n\n border-radius: 0 4px 4px 0;\n }\n "])), offset, toggleShort, toggleShort, toggleLength)),
|
|
28
28
|
toggleTop: cx("".concat(prefix, "-toggle"), "".concat(prefix, "-toggle-top"), commonToggle, css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n top: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n left: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-left: -20px;\n\n border-radius: 4px 4px 0 0;\n }\n "])), offset, toggleShort, toggleLength, toggleShort)),
|
|
29
|
-
topFloat: cx(float, css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n top:
|
|
29
|
+
topFloat: cx(float, css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n top: ", "px;\n right: 0;\n left: 0;\n width: 100%;\n "])), headerHeight)),
|
|
30
30
|
topHandle: cx("".concat(prefix, "-top-handle"), css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n ", ";\n\n &::before {\n top: 50%;\n width: 100%;\n height: 2px;\n }\n "])), commonHandle))
|
|
31
31
|
};
|
|
32
32
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
2
|
export interface EditableMessageProps {
|
|
3
3
|
/**
|
|
4
4
|
* @title The class name for the Markdown and MessageInput component
|
|
@@ -38,11 +38,22 @@ export interface EditableMessageProps {
|
|
|
38
38
|
* @default false
|
|
39
39
|
*/
|
|
40
40
|
openModal?: boolean;
|
|
41
|
+
placeholder?: string;
|
|
41
42
|
/**
|
|
42
43
|
* @title Whether to show the edit button when the text value is empty
|
|
43
44
|
* @default false
|
|
44
45
|
*/
|
|
45
46
|
showEditWhenEmpty?: boolean;
|
|
47
|
+
style?: {
|
|
48
|
+
/**
|
|
49
|
+
* @title The style for the MessageInput component
|
|
50
|
+
*/
|
|
51
|
+
input?: CSSProperties;
|
|
52
|
+
/**
|
|
53
|
+
* @title The style for the Markdown component
|
|
54
|
+
*/
|
|
55
|
+
markdown?: CSSProperties;
|
|
56
|
+
};
|
|
46
57
|
/**
|
|
47
58
|
* @title The current text value
|
|
48
59
|
*/
|
|
@@ -16,8 +16,11 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
16
16
|
editing = _ref.editing,
|
|
17
17
|
openModal = _ref.openModal,
|
|
18
18
|
onOpenChange = _ref.onOpenChange,
|
|
19
|
+
_ref$placeholder = _ref.placeholder,
|
|
20
|
+
placeholder = _ref$placeholder === void 0 ? 'Type something...' : _ref$placeholder,
|
|
19
21
|
_ref$showEditWhenEmpt = _ref.showEditWhenEmpty,
|
|
20
|
-
showEditWhenEmpty = _ref$showEditWhenEmpt === void 0 ? false : _ref$showEditWhenEmpt
|
|
22
|
+
showEditWhenEmpty = _ref$showEditWhenEmpt === void 0 ? false : _ref$showEditWhenEmpt,
|
|
23
|
+
style = _ref.style;
|
|
21
24
|
var _useControlledState = useControlledState(false, {
|
|
22
25
|
onChange: onEditingChange,
|
|
23
26
|
value: editing
|
|
@@ -33,11 +36,17 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
33
36
|
expand = _useControlledState4[0],
|
|
34
37
|
setExpand = _useControlledState4[1];
|
|
35
38
|
return !value && showEditWhenEmpty ? /*#__PURE__*/_jsx(MessageInput, {
|
|
36
|
-
className: classNames.input,
|
|
39
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
40
|
+
defaultValue: value,
|
|
41
|
+
onCancel: function onCancel() {
|
|
42
|
+
return setTyping(false);
|
|
43
|
+
},
|
|
37
44
|
onConfirm: function onConfirm(text) {
|
|
38
45
|
_onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
|
|
39
46
|
setTyping(false);
|
|
40
|
-
}
|
|
47
|
+
},
|
|
48
|
+
placeholder: placeholder,
|
|
49
|
+
style: style === null || style === void 0 ? void 0 : style.input
|
|
41
50
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
42
51
|
children: [/*#__PURE__*/_jsx(MessageModal, {
|
|
43
52
|
editing: isEdit,
|
|
@@ -49,7 +58,7 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
49
58
|
open: expand,
|
|
50
59
|
value: value
|
|
51
60
|
}), !expand && isEdit ? /*#__PURE__*/_jsx(MessageInput, {
|
|
52
|
-
className: classNames.input,
|
|
61
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
53
62
|
defaultValue: value,
|
|
54
63
|
onCancel: function onCancel() {
|
|
55
64
|
return setTyping(false);
|
|
@@ -57,9 +66,12 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
66
|
onConfirm: function onConfirm(text) {
|
|
58
67
|
_onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
|
|
59
68
|
setTyping(false);
|
|
60
|
-
}
|
|
69
|
+
},
|
|
70
|
+
placeholder: placeholder,
|
|
71
|
+
style: style === null || style === void 0 ? void 0 : style.input
|
|
61
72
|
}) : /*#__PURE__*/_jsx(Markdown, {
|
|
62
|
-
className: classNames.markdown,
|
|
73
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.markdown,
|
|
74
|
+
style: style === null || style === void 0 ? void 0 : style.markdown,
|
|
63
75
|
children: value
|
|
64
76
|
})]
|
|
65
77
|
});
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from 'antd';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
* @description Whether the button should spin or not
|
|
6
|
-
* @default false
|
|
7
|
-
*/
|
|
8
|
-
spin?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const GradientButton: import("react").NamedExoticComponent<GradientButtonProps>;
|
|
2
|
+
import { type ButtonProps } from 'antd';
|
|
3
|
+
export declare type GradientButtonProps = ButtonProps;
|
|
4
|
+
declare const GradientButton: import("react").NamedExoticComponent<ButtonProps>;
|
|
11
5
|
export default GradientButton;
|
|
@@ -4,7 +4,6 @@ export interface SyntaxHighlighterProps {
|
|
|
4
4
|
children: string;
|
|
5
5
|
language: string;
|
|
6
6
|
options?: HighlighterOptions;
|
|
7
|
-
theme?: 'dark' | 'light';
|
|
8
7
|
}
|
|
9
8
|
declare const SyntaxHighlighter: import("react").NamedExoticComponent<SyntaxHighlighterProps>;
|
|
10
9
|
export default SyntaxHighlighter;
|
|
@@ -28,13 +28,8 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
28
28
|
useHighlight.getState().initHighlighter(options);
|
|
29
29
|
}, [options]);
|
|
30
30
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
31
|
-
children: [isLoading ? /*#__PURE__*/_jsx("
|
|
32
|
-
|
|
33
|
-
children: /*#__PURE__*/_jsx("pre", {
|
|
34
|
-
children: /*#__PURE__*/_jsx("code", {
|
|
35
|
-
children: children
|
|
36
|
-
})
|
|
37
|
-
})
|
|
31
|
+
children: [isLoading ? /*#__PURE__*/_jsx("code", {
|
|
32
|
+
children: children
|
|
38
33
|
}) : /*#__PURE__*/_jsx("div", {
|
|
39
34
|
className: styles.shiki,
|
|
40
35
|
dangerouslySetInnerHTML: {
|
|
@@ -11,6 +11,6 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
11
11
|
return {
|
|
12
12
|
loading: cx(stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n top: 0;\n right: 0;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n height: 34px;\n padding: 0 8px;\n\n font-family: ", ";\n color: ", ";\n\n border-radius: ", ";\n "])), token.fontFamilyCode, token.colorTextTertiary, token.borderRadius)),
|
|
13
13
|
prism: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pre {\n overflow: auto;\n font-family: ", " !important;\n }\n "])), token.fontFamilyCode),
|
|
14
|
-
shiki: cx("".concat(prefix, "-shiki"), css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .shiki {\n overflow-x: auto;\n background: none !important;\n }\n "]))))
|
|
14
|
+
shiki: cx("".concat(prefix, "-shiki"), css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n\n .shiki {\n overflow-x: auto;\n margin: 0;\n padding: 0;\n background: none !important;\n }\n "]))))
|
|
15
15
|
};
|
|
16
16
|
});
|
|
@@ -24,11 +24,6 @@ export interface HighlighterProps extends DivProps {
|
|
|
24
24
|
* @default false
|
|
25
25
|
*/
|
|
26
26
|
spotlight?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* @description The theme of the code block
|
|
29
|
-
* @default 'light'
|
|
30
|
-
*/
|
|
31
|
-
theme?: 'dark' | 'light';
|
|
32
27
|
/**
|
|
33
28
|
* @description The type of the code block
|
|
34
29
|
* @default 'block'
|
package/es/Highlighter/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", "language", "className", "style", "
|
|
3
|
+
var _excluded = ["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';
|
|
@@ -15,7 +15,6 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
15
15
|
language = _ref.language,
|
|
16
16
|
className = _ref.className,
|
|
17
17
|
style = _ref.style,
|
|
18
|
-
theme = _ref.theme,
|
|
19
18
|
_ref$copyable = _ref.copyable,
|
|
20
19
|
copyable = _ref$copyable === void 0 ? true : _ref$copyable,
|
|
21
20
|
_ref$showLanguage = _ref.showLanguage,
|
|
@@ -44,7 +43,6 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
44
43
|
children: language.toLowerCase()
|
|
45
44
|
}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
46
45
|
language: language === null || language === void 0 ? void 0 : language.toLowerCase(),
|
|
47
|
-
theme: theme,
|
|
48
46
|
children: children.trim()
|
|
49
47
|
})]
|
|
50
48
|
}));
|
package/es/Highlighter/theme.js
CHANGED
|
@@ -2,7 +2,7 @@ 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];
|
|
5
|
-
|
|
5
|
+
// const colorTextSecondary = colorScales.gray[type][10];
|
|
6
6
|
var colorTextTertiary = colorScales.gray[type][7];
|
|
7
7
|
var colorRed = isDarkMode ? colorScales.red[type][9] : colorScales.volcano[type][9];
|
|
8
8
|
var colorOrange = isDarkMode ? colorScales.gold[type][9] : colorScales.orange[type][9];
|
|
@@ -10,7 +10,7 @@ export var themeConfig = function themeConfig(isDarkMode) {
|
|
|
10
10
|
var colorBlue = isDarkMode ? colorScales.blue[type][9] : colorScales.geekblue[type][9];
|
|
11
11
|
return {
|
|
12
12
|
colors: {
|
|
13
|
-
'editor.foreground':
|
|
13
|
+
'editor.foreground': colorText
|
|
14
14
|
},
|
|
15
15
|
name: type,
|
|
16
16
|
semanticHighlighting: true,
|
|
@@ -724,7 +724,13 @@ export var themeConfig = function themeConfig(isDarkMode) {
|
|
|
724
724
|
name: 'Headings',
|
|
725
725
|
scope: 'markup.heading',
|
|
726
726
|
settings: {
|
|
727
|
-
|
|
727
|
+
fontStyle: 'bold'
|
|
728
|
+
}
|
|
729
|
+
}, {
|
|
730
|
+
name: 'FencedCode',
|
|
731
|
+
scope: 'punctuation.definition.markdown, fenced_code.block.language.markdown',
|
|
732
|
+
settings: {
|
|
733
|
+
foreground: colorRed
|
|
728
734
|
}
|
|
729
735
|
}, {
|
|
730
736
|
name: 'Headings',
|
package/es/Markdown/CodeBlock.js
CHANGED
|
@@ -10,8 +10,7 @@ var useStyles = createStyles(function (_ref) {
|
|
|
10
10
|
});
|
|
11
11
|
var Code = /*#__PURE__*/memo(function (properties) {
|
|
12
12
|
var _useStyles = useStyles(),
|
|
13
|
-
styles = _useStyles.styles
|
|
14
|
-
theme = _useStyles.theme;
|
|
13
|
+
styles = _useStyles.styles;
|
|
15
14
|
if (!properties.children[0]) return;
|
|
16
15
|
var _properties$children$ = properties.children[0].props,
|
|
17
16
|
children = _properties$children$.children,
|
|
@@ -20,7 +19,6 @@ var Code = /*#__PURE__*/memo(function (properties) {
|
|
|
20
19
|
return /*#__PURE__*/_jsx(Highlighter, {
|
|
21
20
|
className: styles,
|
|
22
21
|
language: (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'markdown',
|
|
23
|
-
theme: theme.appearance,
|
|
24
22
|
type: "block",
|
|
25
23
|
children: Array.isArray(children) ? children[0] : children
|
|
26
24
|
});
|
package/es/Markdown/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
2
|
export interface MarkdownProps {
|
|
3
3
|
/**
|
|
4
4
|
* @description The markdown content to be rendered
|
|
@@ -8,6 +8,7 @@ export interface MarkdownProps {
|
|
|
8
8
|
* @description The class name for the Markdown component
|
|
9
9
|
*/
|
|
10
10
|
className?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
11
12
|
}
|
|
12
13
|
declare const Markdown: import("react").NamedExoticComponent<MarkdownProps>;
|
|
13
14
|
export default Markdown;
|
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"];
|
|
3
|
+
var _excluded = ["children", "className", "style"];
|
|
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, Typography } from 'antd';
|
|
@@ -15,10 +15,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
15
|
var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
16
16
|
var children = _ref.children,
|
|
17
17
|
className = _ref.className,
|
|
18
|
+
style = _ref.style,
|
|
18
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
20
|
var _useStyles = useStyles(),
|
|
20
|
-
styles = _useStyles.styles
|
|
21
|
-
cx = _useStyles.cx;
|
|
21
|
+
styles = _useStyles.styles;
|
|
22
22
|
var components = {
|
|
23
23
|
a: Typography.Link,
|
|
24
24
|
code: Code,
|
|
@@ -27,8 +27,10 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
27
|
pre: CodeBlock
|
|
28
28
|
};
|
|
29
29
|
return /*#__PURE__*/_jsx(Typography, {
|
|
30
|
+
className: className,
|
|
31
|
+
style: style,
|
|
30
32
|
children: /*#__PURE__*/_jsx(ReactMarkdown, _objectSpread(_objectSpread({
|
|
31
|
-
className:
|
|
33
|
+
className: styles.markdown,
|
|
32
34
|
components: components,
|
|
33
35
|
remarkPlugins: [remarkGfm]
|
|
34
36
|
}, props), {}, {
|
|
@@ -26,6 +26,10 @@ export interface MessageInputProps extends DivProps {
|
|
|
26
26
|
* @param text - The text input by the user.
|
|
27
27
|
*/
|
|
28
28
|
renderButtons?: (text: string) => ButtonProps[];
|
|
29
|
+
text?: {
|
|
30
|
+
cancel?: string;
|
|
31
|
+
confirm?: string;
|
|
32
|
+
};
|
|
29
33
|
textareaClassname?: string;
|
|
30
34
|
textareaStyle?: CSSProperties;
|
|
31
35
|
/**
|
package/es/MessageInput/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["type", "onCancel", "defaultValue", "onConfirm", "renderButtons", "textareaStyle", "textareaClassname", "placeholder", "height"];
|
|
4
|
+
var _excluded = ["text", "type", "onCancel", "defaultValue", "onConfirm", "renderButtons", "textareaStyle", "textareaClassname", "placeholder", "height"];
|
|
5
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
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
7
|
import { Button } from 'antd';
|
|
@@ -12,7 +12,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
15
|
-
var
|
|
15
|
+
var text = _ref.text,
|
|
16
|
+
_ref$type = _ref.type,
|
|
16
17
|
type = _ref$type === void 0 ? 'pure' : _ref$type,
|
|
17
18
|
onCancel = _ref.onCancel,
|
|
18
19
|
defaultValue = _ref.defaultValue,
|
|
@@ -30,7 +31,11 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
31
|
temporarySystemRole = _useState2[0],
|
|
31
32
|
setRole = _useState2[1];
|
|
32
33
|
return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
33
|
-
gap: 8
|
|
34
|
+
gap: 8,
|
|
35
|
+
style: {
|
|
36
|
+
flex: 1,
|
|
37
|
+
width: '100%'
|
|
38
|
+
}
|
|
34
39
|
}, props), {}, {
|
|
35
40
|
children: [/*#__PURE__*/_jsx(CodeEditor, {
|
|
36
41
|
className: textareaClassname,
|
|
@@ -41,7 +46,8 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
41
46
|
placeholder: placeholder,
|
|
42
47
|
resize: false,
|
|
43
48
|
style: _objectSpread({
|
|
44
|
-
height: height
|
|
49
|
+
height: height,
|
|
50
|
+
minHeight: '100%'
|
|
45
51
|
}, textareaStyle),
|
|
46
52
|
type: type,
|
|
47
53
|
value: temporarySystemRole
|
|
@@ -59,11 +65,11 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
59
65
|
},
|
|
60
66
|
size: "small",
|
|
61
67
|
type: "primary",
|
|
62
|
-
children:
|
|
68
|
+
children: (text === null || text === void 0 ? void 0 : text.confirm) || 'Confirm'
|
|
63
69
|
}), /*#__PURE__*/_jsx(Button, {
|
|
64
70
|
onClick: onCancel,
|
|
65
71
|
size: "small",
|
|
66
|
-
children:
|
|
72
|
+
children: (text === null || text === void 0 ? void 0 : text.cancel) || 'Cancel'
|
|
67
73
|
})]
|
|
68
74
|
})
|
|
69
75
|
})]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
3
3
|
import { keyframes } from 'antd-style';
|
|
4
4
|
export var generateCustomStylish = function generateCustomStylish(_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
@@ -8,10 +8,11 @@ export var generateCustomStylish = function generateCustomStylish(_ref) {
|
|
|
8
8
|
var gradient = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n background-position: 0% 50%;\n }\n 50% {\n background-position: 100% 50%;\n }\n 100% {\n background-position: 0% 50%;\n }\n "])));
|
|
9
9
|
return {
|
|
10
10
|
blur: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n backdrop-filter: saturate(180%) blur(10px);\n "]))),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
blurStrong: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n backdrop-filter: blur(36px);\n "]))),
|
|
12
|
+
bottomScrollbar: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ::-webkit-scrollbar {\n width: 0;\n height: 4px;\n background-color: transparent;\n\n &-thumb {\n background-color: ", ";\n border-radius: 4px;\n transition: background-color 500ms ", ";\n }\n\n &-corner {\n display: none;\n width: 0;\n height: 0;\n }\n }\n "])), token.colorFill, token.motionEaseOut),
|
|
13
|
+
gradientAnimation: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background-image: linear-gradient(\n -45deg,\n ", ",\n ", ",\n ", ",\n ", "\n );\n background-size: 400% 400%;\n border-radius: inherit;\n animation: 5s ", " 5s ease infinite;\n "])), token.gold, token.magenta, token.geekblue, token.cyan, gradient),
|
|
14
|
+
markdown: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: ", ";\n\n h1,\n h2,\n h3,\n h4,\n h5 {\n font-weight: 600;\n }\n\n p {\n margin-block-start: 0;\n margin-block-end: 0;\n\n font-size: 14px;\n line-height: 1.8;\n color: ", ";\n text-align: justify;\n word-break: break-all;\n word-wrap: break-word;\n\n + * {\n margin-block-end: 0.5em;\n }\n }\n\n blockquote {\n margin: 16px 0;\n padding: 0 12px;\n\n p {\n font-style: italic;\n color: ", ";\n }\n }\n\n p:not(:last-child) {\n margin-bottom: 1em;\n }\n\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n\n img {\n max-width: 100%;\n }\n\n pre {\n border: none;\n border-radius: ", "px;\n }\n\n > :not([data-code-type='highlighter']) code {\n padding: 2px 6px;\n\n font-size: ", "px;\n color: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n table {\n border-spacing: 0;\n\n width: 100%;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0;\n margin-inline-end: 0;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n th,\n td {\n padding-block-start: 10px;\n padding-block-end: 10px;\n padding-inline-start: 16px;\n padding-inline-end: 16px;\n }\n\n thead {\n tr {\n th {\n background: ", ";\n\n &:first-child {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n\n &:last-child {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n }\n\n li {\n line-height: 1.8;\n\n &::marker {\n color: ", ";\n }\n }\n\n details {\n margin-bottom: 1em;\n padding: 12px 16px;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n\n transition: all 400ms ", ";\n }\n\n details[open] {\n summary {\n padding-bottom: 12px;\n border-bottom: 1px solid ", ";\n }\n }\n "])), isDarkMode ? token.colorTextSecondary : token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, token.borderRadius, token.fontSizeSM, isDarkMode ? token.cyan9A : token.cyan10A, isDarkMode ? token.cyan1A : token.cyan3A, isDarkMode ? token.cyan1A : token.cyan4A, token.borderRadiusSM, token.colorBorderSecondary, token.borderRadius, token.colorFillTertiary, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, isDarkMode ? token.cyan9A : token.cyan10A, token.colorFillTertiary, token.colorBorderSecondary, token.borderRadiusLG, token.motionEaseOut, token.colorBorder),
|
|
15
|
+
noScrollbar: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ::-webkit-scrollbar {\n display: none;\n width: 0;\n height: 0;\n background-color: transparent;\n }\n "]))),
|
|
16
|
+
resetLinkColor: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n "])), token.colorTextSecondary, token.colorText)
|
|
16
17
|
};
|
|
17
18
|
};
|