@lobehub/ui 1.12.0 → 1.14.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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export interface IScaleRow {
3
+ name: string;
3
4
  title: 'light' | 'lightA' | 'dark' | 'darkA';
4
5
  scale: string[];
5
6
  }
@@ -5,23 +5,27 @@ import { alphaBg, useStyles } from "./style";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  var ScaleRow = /*#__PURE__*/memo(function (_ref) {
8
- var title = _ref.title,
8
+ var name = _ref.name,
9
+ title = _ref.title,
9
10
  scale = _ref.scale;
10
11
  var _useStyles = useStyles(),
11
12
  styles = _useStyles.styles;
12
13
  var style = {};
14
+ var isAlpha = false;
13
15
  switch (title) {
14
16
  case 'lightA':
15
17
  style = {
16
18
  backgroundColor: '#fff',
17
19
  background: alphaBg.light
18
20
  };
21
+ isAlpha = true;
19
22
  break;
20
23
  case 'darkA':
21
24
  style = {
22
25
  backgroundColor: '#000',
23
26
  background: alphaBg.dark
24
27
  };
28
+ isAlpha = true;
25
29
  break;
26
30
  default:
27
31
  break;
@@ -35,13 +39,15 @@ var ScaleRow = /*#__PURE__*/memo(function (_ref) {
35
39
  children: title
36
40
  })
37
41
  }, title), scale.map(function (color, index) {
42
+ if (index === 0 || index === 12) return null;
38
43
  return /*#__PURE__*/_jsx("div", {
39
44
  className: styles.scaleBox,
40
45
  title: color,
41
46
  style: style,
42
47
  onClick: function onClick() {
43
- copy(color);
44
- message.success(color);
48
+ var content = "token.".concat(name).concat(index).concat(isAlpha ? 'A' : '', " /* ").concat(color, " */");
49
+ copy(content);
50
+ message.success(content);
45
51
  },
46
52
  children: /*#__PURE__*/_jsx("div", {
47
53
  className: styles.scaleItem,
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ColorScaleItem } from "../styles/colors";
3
3
  export interface ColorScalesProps {
4
+ name: string;
4
5
  scale: ColorScaleItem;
5
6
  midHighLight: number;
6
7
  }
@@ -5,7 +5,8 @@ import { useStyles } from "./style";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  var ColorScales = /*#__PURE__*/memo(function (_ref) {
8
- var scale = _ref.scale,
8
+ var name = _ref.name,
9
+ scale = _ref.scale,
9
10
  midHighLight = _ref.midHighLight;
10
11
  var _useStyles = useStyles(),
11
12
  styles = _useStyles.styles;
@@ -23,6 +24,7 @@ var ColorScales = /*#__PURE__*/memo(function (_ref) {
23
24
  children: [/*#__PURE__*/_jsx("div", {
24
25
  className: styles.scaleRowTitle
25
26
  }, "scale-num"), new Array(scale.light.length).fill('').map(function (_, index) {
27
+ if (index === 0 || index === 12) return null;
26
28
  var isMidHighlight = midHighLight === index;
27
29
  return /*#__PURE__*/_jsx("div", {
28
30
  className: styles.scaleBox,
@@ -34,21 +36,25 @@ var ColorScales = /*#__PURE__*/memo(function (_ref) {
34
36
  opacity: 0.5,
35
37
  fontWeight: isMidHighlight ? 700 : 400
36
38
  },
37
- children: index + 1
39
+ children: index
38
40
  })
39
41
  })
40
42
  }, 'num' + index);
41
43
  })]
42
44
  }, "scale-title"), /*#__PURE__*/_jsx(ScaleRow, {
45
+ name: name,
43
46
  title: "light",
44
47
  scale: scale.light
45
48
  }, "light"), /*#__PURE__*/_jsx(ScaleRow, {
49
+ name: name,
46
50
  title: "lightA",
47
51
  scale: scale.lightA
48
52
  }, "lightA"), /*#__PURE__*/_jsx(ScaleRow, {
53
+ name: name,
49
54
  title: "dark",
50
55
  scale: scale.dark
51
56
  }, "dark"), /*#__PURE__*/_jsx(ScaleRow, {
57
+ name: name,
52
58
  title: "darkA",
53
59
  scale: scale.darkA
54
60
  }, "darkA")]
@@ -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: {