@lobehub/ui 1.77.0 → 1.79.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/README.md +2 -2
- package/es/Highlighter/index.d.ts +2 -0
- package/es/Highlighter/index.js +8 -4
- package/es/Highlighter/style.js +4 -3
- package/es/Logo/index.js +28 -22
- package/es/Logo/style.d.ts +0 -1
- package/es/Logo/style.js +2 -3
- package/es/Markdown/CodeBlock.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
<img height="120" src="https://
|
|
5
|
+
<img height="120" src="https://registry.npmmirror.com/@lobehub/assets-logo/1.0.0/files/assets/logo-3d.webp">
|
|
6
6
|
<img height="120" src="https://gw.alipayobjects.com/zos/kitchen/qJ3l3EPsdW/split.svg">
|
|
7
|
-
<img height="120" src="https://
|
|
7
|
+
<img height="120" src="https://registry.npmmirror.com/@lobehub/assets-emoji/1.3.0/files/assets/lollipop.webp">
|
|
8
8
|
|
|
9
9
|
<h1>Lobe UI</h1>
|
|
10
10
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { type CopyButtonProps } from "../CopyButton";
|
|
2
3
|
import { DivProps } from "../types";
|
|
3
4
|
export interface HighlighterProps extends DivProps {
|
|
4
5
|
/**
|
|
5
6
|
* @description The code content to be highlighted
|
|
6
7
|
*/
|
|
7
8
|
children: string;
|
|
9
|
+
copyButtonSize?: CopyButtonProps['size'];
|
|
8
10
|
/**
|
|
9
11
|
* @description Whether to show the copy button
|
|
10
12
|
* @default true
|
package/es/Highlighter/index.js
CHANGED
|
@@ -1,17 +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 = ["children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
|
|
3
|
+
var _excluded = ["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
|
+
import Tag from "../Tag";
|
|
9
10
|
import SyntaxHighlighter from "./SyntaxHighlighter";
|
|
10
11
|
import { useStyles } from "./style";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
14
|
-
var
|
|
15
|
+
var _ref$copyButtonSize = _ref.copyButtonSize,
|
|
16
|
+
copyButtonSize = _ref$copyButtonSize === void 0 ? 'site' : _ref$copyButtonSize,
|
|
17
|
+
children = _ref.children,
|
|
15
18
|
language = _ref.language,
|
|
16
19
|
className = _ref.className,
|
|
17
20
|
style = _ref.style,
|
|
@@ -37,8 +40,9 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
37
40
|
}), copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
38
41
|
className: styles.button,
|
|
39
42
|
content: children,
|
|
40
|
-
placement: "left"
|
|
41
|
-
|
|
43
|
+
placement: "left",
|
|
44
|
+
size: copyButtonSize
|
|
45
|
+
}), showLanguage && language && /*#__PURE__*/_jsx(Tag, {
|
|
42
46
|
className: styles.lang,
|
|
43
47
|
children: language.toLowerCase()
|
|
44
48
|
}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
package/es/Highlighter/style.js
CHANGED
|
@@ -5,14 +5,15 @@ export var useStyles = createStyles(function (_ref, type) {
|
|
|
5
5
|
var token = _ref.token,
|
|
6
6
|
css = _ref.css,
|
|
7
7
|
cx = _ref.cx,
|
|
8
|
-
prefixCls = _ref.prefixCls
|
|
8
|
+
prefixCls = _ref.prefixCls,
|
|
9
|
+
stylish = _ref.stylish;
|
|
9
10
|
var prefix = "".concat(prefixCls, "-highlighter");
|
|
10
11
|
var buttonHoverCls = "".concat(prefix, "-hover-btn");
|
|
11
12
|
var langHoverCls = "".concat(prefix, "-hover-lang");
|
|
12
13
|
var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border: 1px solid ", ";\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, type === 'block' ? token.colorFillTertiary : token.colorFillQuaternary);
|
|
13
14
|
return {
|
|
14
|
-
button: cx(buttonHoverCls, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index:
|
|
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')),
|
|
15
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")),
|
|
16
|
-
lang: cx(langHoverCls, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index:
|
|
17
|
+
lang: cx(langHoverCls, stylish.blur, css(_templateObject4 || (_templateObject4 = _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))
|
|
17
18
|
};
|
|
18
19
|
});
|
package/es/Logo/index.js
CHANGED
|
@@ -5,6 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
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 { useTheme } from 'antd-style';
|
|
7
7
|
import { memo } from 'react';
|
|
8
|
+
import { Flexbox } from 'react-layout-kit';
|
|
8
9
|
import Divider from "./Divider";
|
|
9
10
|
import LogoHighContrast from "./LogoHighContrast";
|
|
10
11
|
import LogoText from "./LogoText";
|
|
@@ -23,13 +24,12 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
23
24
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
25
|
var theme = useTheme();
|
|
25
26
|
var _useStyles = useStyles(),
|
|
26
|
-
styles = _useStyles.styles
|
|
27
|
-
cx = _useStyles.cx;
|
|
27
|
+
styles = _useStyles.styles;
|
|
28
28
|
var logoComponent;
|
|
29
29
|
switch (type) {
|
|
30
30
|
case '3d':
|
|
31
31
|
{
|
|
32
|
-
|
|
32
|
+
logoComponent = /*#__PURE__*/_jsx("img", _objectSpread({
|
|
33
33
|
alt: "lobehub",
|
|
34
34
|
src: LOGO_3D,
|
|
35
35
|
style: _objectSpread({
|
|
@@ -37,10 +37,11 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
37
37
|
width: size
|
|
38
38
|
}, style)
|
|
39
39
|
}, props));
|
|
40
|
+
break;
|
|
40
41
|
}
|
|
41
42
|
case 'flat':
|
|
42
43
|
{
|
|
43
|
-
|
|
44
|
+
logoComponent = /*#__PURE__*/_jsx("img", {
|
|
44
45
|
alt: "lobehub",
|
|
45
46
|
src: LOGO_FLAT,
|
|
46
47
|
style: _objectSpread({
|
|
@@ -48,25 +49,28 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
48
49
|
width: size
|
|
49
50
|
}, style)
|
|
50
51
|
});
|
|
52
|
+
break;
|
|
51
53
|
}
|
|
52
54
|
case 'high-contrast':
|
|
53
55
|
{
|
|
54
|
-
|
|
56
|
+
logoComponent = /*#__PURE__*/_jsx(LogoHighContrast, _objectSpread({
|
|
55
57
|
style: _objectSpread({
|
|
56
58
|
height: size,
|
|
57
59
|
width: size
|
|
58
60
|
}, style)
|
|
59
61
|
}, props));
|
|
62
|
+
break;
|
|
60
63
|
}
|
|
61
64
|
case 'text':
|
|
62
65
|
{
|
|
63
|
-
|
|
66
|
+
logoComponent = /*#__PURE__*/_jsx(LogoText, _objectSpread({
|
|
64
67
|
className: className,
|
|
65
68
|
style: _objectSpread({
|
|
66
69
|
height: size,
|
|
67
70
|
width: 'auto'
|
|
68
71
|
}, style)
|
|
69
72
|
}, props));
|
|
73
|
+
break;
|
|
70
74
|
}
|
|
71
75
|
case 'combine':
|
|
72
76
|
{
|
|
@@ -86,27 +90,29 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
86
90
|
}
|
|
87
91
|
})]
|
|
88
92
|
});
|
|
93
|
+
break;
|
|
89
94
|
}
|
|
90
95
|
}
|
|
96
|
+
if (!extra) return logoComponent;
|
|
91
97
|
var extraSize = Math.round(size / 3 * 1.9);
|
|
92
|
-
return /*#__PURE__*/_jsxs(
|
|
93
|
-
|
|
98
|
+
return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
99
|
+
align: 'center',
|
|
100
|
+
className: className,
|
|
101
|
+
horizontal: true,
|
|
94
102
|
style: style
|
|
95
103
|
}, props), {}, {
|
|
96
|
-
children: [logoComponent,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
children: extra
|
|
109
|
-
})]
|
|
104
|
+
children: [logoComponent, /*#__PURE__*/_jsx(Divider, {
|
|
105
|
+
style: {
|
|
106
|
+
color: theme.colorFill,
|
|
107
|
+
height: extraSize,
|
|
108
|
+
width: extraSize
|
|
109
|
+
}
|
|
110
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
111
|
+
className: styles.extraTitle,
|
|
112
|
+
style: {
|
|
113
|
+
fontSize: extraSize
|
|
114
|
+
},
|
|
115
|
+
children: extra
|
|
110
116
|
})]
|
|
111
117
|
}));
|
|
112
118
|
});
|
package/es/Logo/style.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ export declare const LOGO_3D: string;
|
|
|
2
2
|
export declare const LOGO_FLAT: string;
|
|
3
3
|
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
4
4
|
extraTitle: import("antd-style").SerializedStyles;
|
|
5
|
-
flexCenter: import("antd-style").SerializedStyles;
|
|
6
5
|
}>;
|
package/es/Logo/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject
|
|
2
|
+
var _templateObject;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
import { genCdnUrl } from "../utils/genCdnUrl";
|
|
5
5
|
export var LOGO_3D = genCdnUrl({
|
|
@@ -15,7 +15,6 @@ export var LOGO_FLAT = genCdnUrl({
|
|
|
15
15
|
export var useStyles = createStyles(function (_ref) {
|
|
16
16
|
var css = _ref.css;
|
|
17
17
|
return {
|
|
18
|
-
extraTitle: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-weight: 300;\n white-space: nowrap;\n "])))
|
|
19
|
-
flexCenter: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n "])))
|
|
18
|
+
extraTitle: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-weight: 300;\n white-space: nowrap;\n "])))
|
|
20
19
|
};
|
|
21
20
|
});
|
package/es/Markdown/CodeBlock.js
CHANGED
|
@@ -18,6 +18,10 @@ var Code = /*#__PURE__*/memo(function (properties) {
|
|
|
18
18
|
if (!children) return;
|
|
19
19
|
return /*#__PURE__*/_jsx(Highlighter, {
|
|
20
20
|
className: styles,
|
|
21
|
+
copyButtonSize: {
|
|
22
|
+
blockSize: 28,
|
|
23
|
+
fontSize: 16
|
|
24
|
+
},
|
|
21
25
|
language: (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'markdown',
|
|
22
26
|
type: "block",
|
|
23
27
|
children: Array.isArray(children) ? children[0] : children
|