@lobehub/ui 1.119.1 → 1.119.3
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/Markdown/index.js
CHANGED
|
@@ -6,6 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import { Collapse, Divider, Image, Typography } from 'antd';
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
|
9
10
|
import ReactMarkdown from 'react-markdown';
|
|
10
11
|
import rehypeKatex from 'rehype-katex';
|
|
11
12
|
import remarkGfm from 'remark-gfm';
|
|
@@ -41,7 +42,19 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
41
42
|
});
|
|
42
43
|
},
|
|
43
44
|
img: function img(props) {
|
|
44
|
-
return /*#__PURE__*/_jsx(
|
|
45
|
+
return /*#__PURE__*/_jsx(Flexbox, {
|
|
46
|
+
className: styles.imageWrapper,
|
|
47
|
+
children: /*#__PURE__*/_jsx(Image, _objectSpread({
|
|
48
|
+
preview: {
|
|
49
|
+
styles: {
|
|
50
|
+
mask: {
|
|
51
|
+
backdropFilter: 'blur(2px)'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
wrapperClassName: styles.image
|
|
56
|
+
}, props))
|
|
57
|
+
});
|
|
45
58
|
},
|
|
46
59
|
pre: fullFeaturedCodeBlock ? CodeFullFeatured : CodeLite
|
|
47
60
|
};
|
|
@@ -49,22 +62,31 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
49
62
|
className: className,
|
|
50
63
|
onDoubleClick: onDoubleClick,
|
|
51
64
|
style: style,
|
|
52
|
-
children: /*#__PURE__*/_jsx(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
children: /*#__PURE__*/_jsx(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
children: /*#__PURE__*/_jsx(Image.PreviewGroup, {
|
|
66
|
+
preview: {
|
|
67
|
+
styles: {
|
|
68
|
+
mask: {
|
|
69
|
+
backdropFilter: 'blur(2px)'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
children: /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
74
|
+
fallback: /*#__PURE__*/_jsx(ReactMarkdown, _objectSpread(_objectSpread({
|
|
75
|
+
className: styles.markdown,
|
|
76
|
+
components: components,
|
|
77
|
+
remarkPlugins: [remarkGfm]
|
|
78
|
+
}, rest), {}, {
|
|
79
|
+
children: children
|
|
80
|
+
})),
|
|
81
|
+
children: /*#__PURE__*/_jsx(ReactMarkdown, _objectSpread(_objectSpread({
|
|
82
|
+
className: styles.markdown,
|
|
83
|
+
components: components,
|
|
84
|
+
rehypePlugins: [rehypeKatex],
|
|
85
|
+
remarkPlugins: [remarkGfm, remarkMath]
|
|
86
|
+
}, rest), {}, {
|
|
87
|
+
children: children
|
|
88
|
+
}))
|
|
89
|
+
})
|
|
68
90
|
})
|
|
69
91
|
});
|
|
70
92
|
});
|
package/es/Markdown/style.d.ts
CHANGED
package/es/Markdown/style.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
1
3
|
import { createStyles } from 'antd-style';
|
|
4
|
+
import { rgba } from 'polished';
|
|
2
5
|
export var useStyles = createStyles(function (_ref) {
|
|
3
|
-
var stylish = _ref.stylish
|
|
6
|
+
var stylish = _ref.stylish,
|
|
7
|
+
token = _ref.token,
|
|
8
|
+
css = _ref.css;
|
|
4
9
|
return {
|
|
10
|
+
image: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n img {\n width: 100% !important;\n height: 100% !important;\n object-fit: contain;\n }\n "]))),
|
|
11
|
+
imageWrapper: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n margin-block: 0 1em;\n\n background: ", ";\n border-radius: ", "px;\n box-shadow: 0 0 0 1px ", ";\n "])), rgba(token.colorBgLayout, 0.25), token.borderRadius, token.colorFillTertiary),
|
|
5
12
|
markdown: stylish.markdown
|
|
6
13
|
};
|
|
7
14
|
});
|
|
@@ -13,7 +13,7 @@ export var generateCustomStylish = function generateCustomStylish(_ref) {
|
|
|
13
13
|
blurStrong: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n backdrop-filter: blur(36px);\n "]))),
|
|
14
14
|
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),
|
|
15
15
|
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),
|
|
16
|
-
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: 0 0;\n font-size: 14px;\n line-height: 2;\n color: ", ";\n\n + * {\n margin-block-end: 1em;\n }\n\n &:not(:last-child) {\n margin-bottom: 1.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 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 [data-code-type='highlighter'] {\n border: none;\n border-radius: ", "px;\n\n > code {\n padding: 0 !important;\n border: none !important;\n }\n }\n\n
|
|
16
|
+
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: 0 0;\n font-size: 14px;\n line-height: 2;\n color: ", ";\n\n + * {\n margin-block-end: 1em;\n }\n\n &:not(:last-child) {\n margin-bottom: 1.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 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 [data-code-type='highlighter'] {\n border: none;\n border-radius: ", "px;\n\n > code {\n padding: 0 !important;\n background: unset !important;\n border: none !important;\n border-radius: unset !important;\n }\n }\n\n *:not([data-code-type='highlighter'], pre) 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: 1em 1em;\n margin-inline: 0 0;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n\n code {\n display: inline-flex;\n }\n }\n\n th,\n td {\n padding-block: 10px 10px;\n padding-inline: 16px 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 > ol > li::marker {\n color: ", " !important;\n }\n\n > ul > li {\n line-height: 1.8;\n list-style-type: disc;\n\n &::marker {\n color: ", " !important;\n }\n }\n\n ol,\n ul {\n > li::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 "])), token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, token.borderRadius, token.fontSizeSM, cyanColor, cyanBackground, isDarkMode ? token.cyan1A : token.cyan6A, token.borderRadiusSM, token.colorBorderSecondary, token.borderRadius, token.colorFillTertiary, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, isDarkMode ? token.cyan9A : token.cyan10A, isDarkMode ? token.cyan9A : token.cyan10A, token.colorTextDescription, token.colorFillTertiary, token.colorBorderSecondary, token.borderRadiusLG, token.motionEaseOut, token.colorBorder),
|
|
17
17
|
markdownInChat: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n h1 {\n margin-top: 0;\n margin-block-start: 0;\n font-size: 1.6em;\n }\n\n h2 {\n margin-top: 0;\n margin-block-start: 0;\n font-size: 1.4em;\n }\n\n h3 {\n margin-top: 0;\n margin-block-start: 0;\n font-size: 1.2em;\n }\n\n h4 {\n margin-top: 0;\n margin-block-start: 0;\n font-size: 1.1em;\n }\n\n h5 {\n margin-top: 0;\n margin-block-start: 0;\n font-size: 1em;\n }\n\n > *:last-child {\n margin-bottom: 0 !important;\n }\n\n p {\n line-height: 1.8 !important;\n white-space: pre-wrap !important;\n\n + * {\n margin-block-end: 0.5em !important;\n }\n\n &:not(:last-child) {\n margin-bottom: 1em !important;\n }\n }\n "]))),
|
|
18
18
|
noScrollbar: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ::-webkit-scrollbar {\n display: none;\n width: 0;\n height: 0;\n background-color: transparent;\n }\n "]))),
|
|
19
19
|
resetLinkColor: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n "])), token.colorTextSecondary, token.colorText)
|