@lobehub/ui 1.11.4 → 1.13.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.
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export interface IScaleRow {
3
+ name: string;
4
+ title: 'light' | 'lightA' | 'dark' | 'darkA';
5
+ scale: string[];
6
+ }
7
+ declare const ScaleRow: import("react").NamedExoticComponent<IScaleRow>;
8
+ export default ScaleRow;
@@ -0,0 +1,61 @@
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 name = _ref.name,
9
+ title = _ref.title,
10
+ scale = _ref.scale;
11
+ var _useStyles = useStyles(),
12
+ styles = _useStyles.styles;
13
+ var style = {};
14
+ var isAlpha = false;
15
+ switch (title) {
16
+ case 'lightA':
17
+ style = {
18
+ backgroundColor: '#fff',
19
+ background: alphaBg.light
20
+ };
21
+ isAlpha = true;
22
+ break;
23
+ case 'darkA':
24
+ style = {
25
+ backgroundColor: '#000',
26
+ background: alphaBg.dark
27
+ };
28
+ isAlpha = true;
29
+ break;
30
+ default:
31
+ break;
32
+ }
33
+ return /*#__PURE__*/_jsxs(Space, {
34
+ size: 2,
35
+ children: [/*#__PURE__*/_jsx("div", {
36
+ className: styles.scaleRowTitle,
37
+ children: /*#__PURE__*/_jsx("div", {
38
+ className: styles.text,
39
+ children: title
40
+ })
41
+ }, title), scale.map(function (color, index) {
42
+ return /*#__PURE__*/_jsx("div", {
43
+ className: styles.scaleBox,
44
+ title: color,
45
+ style: style,
46
+ onClick: function onClick() {
47
+ var content = "token.".concat(name).concat(index + 1).concat(isAlpha ? 'A' : '', " /* ").concat(color, " */");
48
+ copy(content);
49
+ message.success(content);
50
+ },
51
+ children: /*#__PURE__*/_jsx("div", {
52
+ className: styles.scaleItem,
53
+ style: {
54
+ backgroundColor: color
55
+ }
56
+ })
57
+ }, index);
58
+ })]
59
+ });
60
+ });
61
+ export default ScaleRow;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ColorScaleItem } from "../styles/colors";
3
+ export interface ColorScalesProps {
4
+ name: string;
5
+ scale: ColorScaleItem;
6
+ midHighLight: number;
7
+ }
8
+ declare const ColorScales: import("react").NamedExoticComponent<ColorScalesProps>;
9
+ export default ColorScales;
@@ -0,0 +1,64 @@
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 name = _ref.name,
9
+ scale = _ref.scale,
10
+ midHighLight = _ref.midHighLight;
11
+ var _useStyles = useStyles(),
12
+ styles = _useStyles.styles;
13
+ return /*#__PURE__*/_jsx("div", {
14
+ className: styles.view,
15
+ children: /*#__PURE__*/_jsx("div", {
16
+ style: {
17
+ padding: '8px 16px 32px 0'
18
+ },
19
+ children: /*#__PURE__*/_jsxs(Space, {
20
+ direction: 'vertical',
21
+ size: 2,
22
+ children: [/*#__PURE__*/_jsxs(Space, {
23
+ size: 2,
24
+ children: [/*#__PURE__*/_jsx("div", {
25
+ className: styles.scaleRowTitle
26
+ }, "scale-num"), new Array(scale.light.length).fill('').map(function (_, index) {
27
+ var isMidHighlight = midHighLight === index;
28
+ return /*#__PURE__*/_jsx("div", {
29
+ className: styles.scaleBox,
30
+ children: /*#__PURE__*/_jsx("div", {
31
+ className: styles.scaleBox,
32
+ children: /*#__PURE__*/_jsx("div", {
33
+ className: styles.scaleItem,
34
+ style: {
35
+ opacity: 0.5,
36
+ fontWeight: isMidHighlight ? 700 : 400
37
+ },
38
+ children: index + 1
39
+ })
40
+ })
41
+ }, 'num' + index);
42
+ })]
43
+ }, "scale-title"), /*#__PURE__*/_jsx(ScaleRow, {
44
+ name: name,
45
+ title: "light",
46
+ scale: scale.light
47
+ }, "light"), /*#__PURE__*/_jsx(ScaleRow, {
48
+ name: name,
49
+ title: "lightA",
50
+ scale: scale.lightA
51
+ }, "lightA"), /*#__PURE__*/_jsx(ScaleRow, {
52
+ name: name,
53
+ title: "dark",
54
+ scale: scale.dark
55
+ }, "dark"), /*#__PURE__*/_jsx(ScaleRow, {
56
+ name: name,
57
+ title: "darkA",
58
+ scale: scale.darkA
59
+ }, "darkA")]
60
+ })
61
+ })
62
+ });
63
+ });
64
+ 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
+ });
@@ -4,7 +4,6 @@ import { Loading3QuartersOutlined as Loading } from '@ant-design/icons';
4
4
  import { memo, useEffect } from 'react';
5
5
  import { Center } from 'react-layout-kit';
6
6
  import { shallow } from 'zustand/shallow';
7
- import { Prism } from "./Prism";
8
7
  import { useThemeMode } from 'antd-style';
9
8
  import { useStyles } from "./style";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -12,14 +11,12 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
12
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
12
  var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
14
13
  var children = _ref.children,
15
- language = _ref.language,
16
- appearance = _ref.theme;
14
+ language = _ref.language;
17
15
  var _useStyles = useStyles(),
18
16
  styles = _useStyles.styles,
19
17
  theme = _useStyles.theme;
20
18
  var _useThemeMode = useThemeMode(),
21
19
  isDarkMode = _useThemeMode.isDarkMode;
22
- var isDarkTheme = appearance ? appearance === 'dark' : isDarkMode;
23
20
  var _useHighlight = useHighlight(function (s) {
24
21
  return [s.codeToHtml, !s.highlighter];
25
22
  }, shallow),
@@ -32,10 +29,10 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
32
29
  return /*#__PURE__*/_jsxs(_Fragment, {
33
30
  children: [isLoading ? /*#__PURE__*/_jsx("div", {
34
31
  className: styles.prism,
35
- children: /*#__PURE__*/_jsx(Prism, {
36
- language: language,
37
- isDarkMode: isDarkTheme,
38
- children: children
32
+ children: /*#__PURE__*/_jsx("pre", {
33
+ children: /*#__PURE__*/_jsx("code", {
34
+ children: children
35
+ })
39
36
  })
40
37
  }) : /*#__PURE__*/_jsx("div", {
41
38
  dangerouslySetInnerHTML: {