@lobehub/ui 1.11.3 → 1.12.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/ColorScales/ScaleRow.d.ts +7 -0
- package/es/ColorScales/ScaleRow.js +56 -0
- package/es/ColorScales/index.d.ts +8 -0
- package/es/ColorScales/index.js +59 -0
- package/es/ColorScales/style.d.ts +11 -0
- package/es/ColorScales/style.js +17 -0
- package/es/Highlighter/SyntaxHighlighter/index.js +1 -1
- package/es/Highlighter/theme.d.ts +1 -0
- package/es/Highlighter/theme.js +1819 -0
- package/es/hooks/useHighlight.d.ts +1 -11
- package/es/hooks/useHighlight.js +3 -6
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/es/styles/algorithms/generateColorPalette.js +3 -3
- package/es/styles/algorithms/generateCustomStylish.d.ts +2 -16
- package/es/styles/algorithms/generateCustomStylish.js +5 -7
- package/es/styles/algorithms/generateCustomToken.js +30 -29
- package/es/types/customStylish.d.ts +13 -0
- package/es/types/customToken.d.ts +68 -1015
- package/es/types/global.d.ts +5 -2
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Space, message } from 'antd';
|
|
2
|
+
import copy from 'copy-to-clipboard';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { alphaBg, useStyles } from "./style";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
var ScaleRow = /*#__PURE__*/memo(function (_ref) {
|
|
8
|
+
var title = _ref.title,
|
|
9
|
+
scale = _ref.scale;
|
|
10
|
+
var _useStyles = useStyles(),
|
|
11
|
+
styles = _useStyles.styles;
|
|
12
|
+
var style = {};
|
|
13
|
+
switch (title) {
|
|
14
|
+
case 'lightA':
|
|
15
|
+
style = {
|
|
16
|
+
backgroundColor: '#fff',
|
|
17
|
+
background: alphaBg.light
|
|
18
|
+
};
|
|
19
|
+
break;
|
|
20
|
+
case 'darkA':
|
|
21
|
+
style = {
|
|
22
|
+
backgroundColor: '#000',
|
|
23
|
+
background: alphaBg.dark
|
|
24
|
+
};
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/_jsxs(Space, {
|
|
30
|
+
size: 2,
|
|
31
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
32
|
+
className: styles.scaleRowTitle,
|
|
33
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
34
|
+
className: styles.text,
|
|
35
|
+
children: title
|
|
36
|
+
})
|
|
37
|
+
}, title), scale.map(function (color, index) {
|
|
38
|
+
return /*#__PURE__*/_jsx("div", {
|
|
39
|
+
className: styles.scaleBox,
|
|
40
|
+
title: color,
|
|
41
|
+
style: style,
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
copy(color);
|
|
44
|
+
message.success(color);
|
|
45
|
+
},
|
|
46
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
47
|
+
className: styles.scaleItem,
|
|
48
|
+
style: {
|
|
49
|
+
backgroundColor: color
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}, index);
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
export default ScaleRow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ColorScaleItem } from "../styles/colors";
|
|
3
|
+
export interface ColorScalesProps {
|
|
4
|
+
scale: ColorScaleItem;
|
|
5
|
+
midHighLight: number;
|
|
6
|
+
}
|
|
7
|
+
declare const ColorScales: import("react").NamedExoticComponent<ColorScalesProps>;
|
|
8
|
+
export default ColorScales;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Space } from 'antd';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import ScaleRow from "./ScaleRow";
|
|
4
|
+
import { useStyles } from "./style";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
var ColorScales = /*#__PURE__*/memo(function (_ref) {
|
|
8
|
+
var scale = _ref.scale,
|
|
9
|
+
midHighLight = _ref.midHighLight;
|
|
10
|
+
var _useStyles = useStyles(),
|
|
11
|
+
styles = _useStyles.styles;
|
|
12
|
+
return /*#__PURE__*/_jsx("div", {
|
|
13
|
+
className: styles.view,
|
|
14
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
15
|
+
style: {
|
|
16
|
+
padding: '8px 16px 32px 0'
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/_jsxs(Space, {
|
|
19
|
+
direction: 'vertical',
|
|
20
|
+
size: 2,
|
|
21
|
+
children: [/*#__PURE__*/_jsxs(Space, {
|
|
22
|
+
size: 2,
|
|
23
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
24
|
+
className: styles.scaleRowTitle
|
|
25
|
+
}, "scale-num"), new Array(scale.light.length).fill('').map(function (_, index) {
|
|
26
|
+
var isMidHighlight = midHighLight === index;
|
|
27
|
+
return /*#__PURE__*/_jsx("div", {
|
|
28
|
+
className: styles.scaleBox,
|
|
29
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
30
|
+
className: styles.scaleBox,
|
|
31
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
32
|
+
className: styles.scaleItem,
|
|
33
|
+
style: {
|
|
34
|
+
opacity: 0.5,
|
|
35
|
+
fontWeight: isMidHighlight ? 700 : 400
|
|
36
|
+
},
|
|
37
|
+
children: index + 1
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
}, 'num' + index);
|
|
41
|
+
})]
|
|
42
|
+
}, "scale-title"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
43
|
+
title: "light",
|
|
44
|
+
scale: scale.light
|
|
45
|
+
}, "light"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
46
|
+
title: "lightA",
|
|
47
|
+
scale: scale.lightA
|
|
48
|
+
}, "lightA"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
49
|
+
title: "dark",
|
|
50
|
+
scale: scale.dark
|
|
51
|
+
}, "dark"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
52
|
+
title: "darkA",
|
|
53
|
+
scale: scale.darkA
|
|
54
|
+
}, "darkA")]
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
export default ColorScales;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const alphaBg: {
|
|
2
|
+
light: string;
|
|
3
|
+
dark: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
6
|
+
view: import("antd-style").SerializedStyles;
|
|
7
|
+
scaleBox: import("antd-style").SerializedStyles;
|
|
8
|
+
scaleItem: import("antd-style").SerializedStyles;
|
|
9
|
+
scaleRowTitle: import("antd-style").SerializedStyles;
|
|
10
|
+
text: import("antd-style").SerializedStyles;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var alphaBg = {
|
|
5
|
+
light: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAFpJREFUWAntljEKADAIA23p6v//qQ+wfUEcCu1yriEgp0FHRJSJcnehmmWm1Dv/lO4HIg1AAAKjTqm03ea88zMCCEDgO4HV5bS757f+7wRoAAIQ4B9gByAAgQ3pfiDmXmAeEwAAAABJRU5ErkJggg==) 0% 0% / 26px',
|
|
6
|
+
dark: 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACPTkDJAAAAZUlEQVRIDe2VMQoAMAgDa9/g/1/oIzrpZBCh2dLFkkoDF0Fz99OdiOjks+2/7S8fRRmMMIVoRGSoYzvvqF8ZIMKlC1GhQBc6IkPzq32QmdAzkEGihpWOSPsAss8HegYySNSw0hE9WQ4StafZFqkAAAAASUVORK5CYII=) 0% 0% / 26px'
|
|
7
|
+
};
|
|
8
|
+
export var useStyles = createStyles(function (_ref) {
|
|
9
|
+
var css = _ref.css;
|
|
10
|
+
return {
|
|
11
|
+
view: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n "]))),
|
|
12
|
+
scaleBox: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: relative;\n\n width: 48px;\n height: 32px;\n\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n background-size: 16px 16px;\n &:active {\n transform: scale(0.95);\n }\n "]))),
|
|
13
|
+
scaleItem: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n "]))),
|
|
14
|
+
scaleRowTitle: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n width: 64px;\n height: 32px;\n "]))),
|
|
15
|
+
text: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n opacity: 0.5;\n "])))
|
|
16
|
+
};
|
|
17
|
+
});
|
|
@@ -39,7 +39,7 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
39
39
|
})
|
|
40
40
|
}) : /*#__PURE__*/_jsx("div", {
|
|
41
41
|
dangerouslySetInnerHTML: {
|
|
42
|
-
__html: codeToHtml(children, language,
|
|
42
|
+
__html: codeToHtml(children, language, isDarkMode) || ''
|
|
43
43
|
},
|
|
44
44
|
className: styles.shiki
|
|
45
45
|
}), isLoading && /*#__PURE__*/_jsxs(Center, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const themeConfig: any;
|