@lobehub/ui 1.1.0 → 1.3.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.
Files changed (190) hide show
  1. package/README.md +6 -3
  2. package/es/ActionIcon/index.d.ts +28 -10
  3. package/es/ActionIcon/index.js +29 -50
  4. package/es/ActionIcon/style.d.ts +6 -0
  5. package/es/ActionIcon/style.js +12 -0
  6. package/es/CopyButton/index.d.ts +34 -0
  7. package/es/CopyButton/index.js +49 -0
  8. package/es/DraggablePanel/index.d.ts +64 -4
  9. package/es/DraggablePanel/index.js +4 -4
  10. package/es/DraggablePanel/style.js +1 -1
  11. package/es/DraggablePanel/utils.d.ts +1 -1
  12. package/es/EditableText/ControlInput.d.ts +9 -0
  13. package/es/EditableText/ControlInput.js +88 -0
  14. package/es/EditableText/index.d.ts +5 -0
  15. package/es/EditableText/index.js +35 -0
  16. package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  17. package/es/Highlighter/SyntaxHighlighter/Prism.js +40 -0
  18. package/es/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  19. package/es/Highlighter/SyntaxHighlighter/index.js +58 -0
  20. package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  21. package/es/Highlighter/SyntaxHighlighter/style.js +15 -0
  22. package/es/Highlighter/index.d.ts +36 -0
  23. package/es/Highlighter/index.js +42 -0
  24. package/es/Highlighter/style.d.ts +5 -0
  25. package/es/Highlighter/style.js +18 -0
  26. package/es/Icon/index.d.ts +20 -0
  27. package/es/Icon/index.js +36 -0
  28. package/es/Logo/Divider.d.ts +3 -0
  29. package/es/Logo/Divider.js +22 -0
  30. package/es/Logo/Logo3D.d.ts +3 -4
  31. package/es/Logo/Logo3D.js +6 -4
  32. package/es/Logo/LogoFlat.d.ts +3 -4
  33. package/es/Logo/LogoFlat.js +6 -5
  34. package/es/Logo/LogoHighContrast.d.ts +3 -4
  35. package/es/Logo/LogoHighContrast.js +6 -5
  36. package/es/Logo/LogoText.d.ts +3 -4
  37. package/es/Logo/LogoText.js +6 -4
  38. package/es/Logo/index.d.ts +16 -4
  39. package/es/Logo/index.js +53 -9
  40. package/es/Logo/style.d.ts +4 -0
  41. package/es/Logo/style.js +10 -0
  42. package/es/Markdown/Code.d.ts +3 -0
  43. package/es/Markdown/Code.js +12 -0
  44. package/es/Markdown/CodeBlock.d.ts +3 -0
  45. package/es/Markdown/CodeBlock.js +27 -0
  46. package/es/Markdown/index.d.ts +13 -0
  47. package/es/Markdown/index.js +28 -0
  48. package/es/Markdown/style.d.ts +4 -0
  49. package/es/Markdown/style.js +12 -0
  50. package/es/MessageInput/index.d.ts +35 -0
  51. package/es/MessageInput/index.js +63 -0
  52. package/es/SearchBar/index.d.ts +5 -0
  53. package/es/SearchBar/index.js +27 -0
  54. package/es/SideNav/index.d.ts +15 -6
  55. package/es/SideNav/index.js +17 -20
  56. package/es/SideNav/style.d.ts +1 -0
  57. package/es/SideNav/style.js +8 -0
  58. package/es/Snippet/index.d.ts +29 -0
  59. package/es/Snippet/index.js +39 -0
  60. package/es/Snippet/style.d.ts +1 -0
  61. package/es/Snippet/style.js +9 -0
  62. package/es/StroyBook/index.d.ts +17 -0
  63. package/es/StroyBook/index.js +47 -0
  64. package/es/StroyBook/style.d.ts +8 -0
  65. package/es/StroyBook/style.js +14 -0
  66. package/es/Swatches/index.d.ts +8 -0
  67. package/es/Swatches/index.js +44 -0
  68. package/es/TabsNav/index.d.ts +22 -0
  69. package/es/{Template → TabsNav}/index.js +14 -9
  70. package/es/TabsNav/style.d.ts +3 -0
  71. package/es/TabsNav/style.js +14 -0
  72. package/es/ThemeProvider/GlobalStyle.js +1 -1
  73. package/es/ThemeProvider/index.d.ts +15 -0
  74. package/es/ThemeProvider/index.js +4 -0
  75. package/es/ThemeSwitch/index.d.ts +27 -0
  76. package/es/ThemeSwitch/index.js +60 -0
  77. package/es/Tooltip/index.d.ts +5 -0
  78. package/es/Tooltip/index.js +20 -0
  79. package/es/Tooltip/style.d.ts +3 -0
  80. package/es/Tooltip/style.js +10 -0
  81. package/es/hooks/useCopied.d.ts +4 -0
  82. package/es/hooks/useCopied.js +26 -0
  83. package/es/hooks/useHighlight.d.ts +36 -0
  84. package/es/hooks/useHighlight.js +63 -0
  85. package/es/index.d.ts +15 -3
  86. package/es/index.js +14 -2
  87. package/es/styles/theme/base.d.ts +2 -0
  88. package/es/styles/theme/base.js +15 -0
  89. package/es/styles/theme/dark.js +6 -14
  90. package/es/styles/theme/light.js +11 -12
  91. package/es/types/index.d.ts +14 -5
  92. package/lib/ActionIcon/index.d.ts +28 -10
  93. package/lib/ActionIcon/index.js +41 -83
  94. package/lib/ActionIcon/style.d.ts +6 -0
  95. package/lib/ActionIcon/style.js +64 -0
  96. package/lib/CopyButton/index.d.ts +34 -0
  97. package/lib/CopyButton/index.js +70 -0
  98. package/lib/DraggablePanel/index.d.ts +64 -4
  99. package/lib/DraggablePanel/index.js +160 -158
  100. package/lib/DraggablePanel/style.js +0 -1
  101. package/lib/DraggablePanel/utils.d.ts +1 -1
  102. package/lib/EditableText/ControlInput.d.ts +9 -0
  103. package/lib/EditableText/ControlInput.js +101 -0
  104. package/lib/EditableText/index.d.ts +5 -0
  105. package/lib/EditableText/index.js +52 -0
  106. package/lib/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  107. package/lib/Highlighter/SyntaxHighlighter/Prism.js +41 -0
  108. package/lib/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  109. package/lib/Highlighter/SyntaxHighlighter/index.js +55 -0
  110. package/lib/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  111. package/lib/Highlighter/SyntaxHighlighter/style.js +58 -0
  112. package/lib/Highlighter/index.d.ts +36 -0
  113. package/lib/Highlighter/index.js +62 -0
  114. package/lib/Highlighter/style.d.ts +5 -0
  115. package/lib/Highlighter/style.js +107 -0
  116. package/lib/Icon/index.d.ts +20 -0
  117. package/lib/Icon/index.js +49 -0
  118. package/lib/Logo/Divider.d.ts +3 -0
  119. package/lib/Logo/Divider.js +41 -0
  120. package/lib/Logo/Logo3D.d.ts +3 -4
  121. package/lib/Logo/Logo3D.js +4 -14
  122. package/lib/Logo/LogoFlat.d.ts +3 -4
  123. package/lib/Logo/LogoFlat.js +18 -28
  124. package/lib/Logo/LogoHighContrast.d.ts +3 -4
  125. package/lib/Logo/LogoHighContrast.js +8 -31
  126. package/lib/Logo/LogoText.d.ts +3 -4
  127. package/lib/Logo/LogoText.js +5 -15
  128. package/lib/Logo/index.d.ts +16 -4
  129. package/lib/Logo/index.js +18 -8
  130. package/lib/Logo/style.d.ts +4 -0
  131. package/lib/Logo/style.js +41 -0
  132. package/lib/Markdown/Code.d.ts +3 -0
  133. package/lib/Markdown/Code.js +33 -0
  134. package/lib/Markdown/CodeBlock.d.ts +3 -0
  135. package/lib/Markdown/CodeBlock.js +64 -0
  136. package/lib/Markdown/index.d.ts +13 -0
  137. package/lib/Markdown/index.js +48 -0
  138. package/lib/Markdown/style.d.ts +4 -0
  139. package/lib/Markdown/style.js +64 -0
  140. package/lib/MessageInput/index.d.ts +35 -0
  141. package/lib/MessageInput/index.js +58 -0
  142. package/lib/SearchBar/index.d.ts +5 -0
  143. package/lib/SearchBar/index.js +42 -0
  144. package/lib/SideNav/index.d.ts +15 -6
  145. package/lib/SideNav/index.js +7 -31
  146. package/lib/SideNav/style.d.ts +1 -0
  147. package/lib/SideNav/style.js +46 -0
  148. package/lib/Snippet/index.d.ts +29 -0
  149. package/lib/{Template → Snippet}/index.js +16 -10
  150. package/lib/Snippet/style.d.ts +1 -0
  151. package/lib/Snippet/style.js +71 -0
  152. package/lib/StroyBook/index.d.ts +17 -0
  153. package/lib/StroyBook/index.js +65 -0
  154. package/lib/StroyBook/style.d.ts +8 -0
  155. package/lib/StroyBook/style.js +81 -0
  156. package/lib/Swatches/index.d.ts +8 -0
  157. package/lib/Swatches/index.js +68 -0
  158. package/lib/TabsNav/index.d.ts +22 -0
  159. package/lib/TabsNav/index.js +34 -0
  160. package/lib/TabsNav/style.d.ts +3 -0
  161. package/lib/TabsNav/style.js +65 -0
  162. package/lib/ThemeProvider/GlobalStyle.js +10 -4
  163. package/lib/ThemeProvider/index.d.ts +15 -0
  164. package/lib/ThemeProvider/index.js +1 -1
  165. package/lib/ThemeSwitch/index.d.ts +27 -0
  166. package/lib/ThemeSwitch/index.js +50 -0
  167. package/lib/Tooltip/index.d.ts +5 -0
  168. package/lib/Tooltip/index.js +34 -0
  169. package/lib/Tooltip/style.d.ts +3 -0
  170. package/lib/Tooltip/style.js +51 -0
  171. package/lib/hooks/useCopied.d.ts +4 -0
  172. package/lib/hooks/useCopied.js +44 -0
  173. package/lib/hooks/useHighlight.d.ts +36 -0
  174. package/lib/hooks/useHighlight.js +76 -0
  175. package/lib/index.d.ts +15 -3
  176. package/lib/index.js +47 -5
  177. package/lib/styles/theme/base.d.ts +2 -0
  178. package/lib/styles/theme/base.js +43 -0
  179. package/lib/styles/theme/dark.js +5 -12
  180. package/lib/styles/theme/light.js +10 -10
  181. package/lib/types/index.d.ts +14 -5
  182. package/package.json +18 -9
  183. package/es/Template/index.d.ts +0 -7
  184. package/es/ThemeProvider/token.d.ts +0 -3
  185. package/es/ThemeProvider/token.js +0 -45
  186. package/es/types/index.js +0 -1
  187. package/lib/Template/index.d.ts +0 -7
  188. package/lib/ThemeProvider/token.d.ts +0 -3
  189. package/lib/ThemeProvider/token.js +0 -73
  190. package/lib/types/index.js +0 -17
package/README.md CHANGED
@@ -66,17 +66,20 @@ $ pnpm start
66
66
 
67
67
  <!-- CONTRIBUTION GROUP -->
68
68
 
69
- > 📊 Total: <kbd>**3**</kbd>
69
+ > 📊 Total: <kbd>**4**</kbd>
70
70
 
71
71
  <a href="https://github.com/canisminor1990" title="canisminor1990">
72
72
  <img src="https://avatars.githubusercontent.com/u/17870709?v=4" width="50" />
73
73
  </a>
74
- <a href="https://github.com/actions-user" title="actions-user">
75
- <img src="https://avatars.githubusercontent.com/u/65916846?v=4" width="50" />
74
+ <a href="https://github.com/arvinxx" title="arvinxx">
75
+ <img src="https://avatars.githubusercontent.com/u/28616219?v=4" width="50" />
76
76
  </a>
77
77
  <a href="https://github.com/apps/dependabot" title="dependabot[bot]">
78
78
  <img src="https://avatars.githubusercontent.com/in/29110?v=4" width="50" />
79
79
  </a>
80
+ <a href="https://github.com/actions-user" title="actions-user">
81
+ <img src="https://avatars.githubusercontent.com/u/65916846?v=4" width="50" />
82
+ </a>
80
83
 
81
84
  <!-- CONTRIBUTION END -->
82
85
 
@@ -1,15 +1,33 @@
1
- import { DivProps } from "../types";
1
+ /// <reference types="react" />
2
2
  import { LucideIcon } from 'lucide-react';
3
- import React from 'react';
3
+ import { DivProps } from "../types";
4
+ export declare type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
5
+ blockSize?: number;
6
+ fontSize?: number;
7
+ strokeWidth?: number;
8
+ borderRadius?: number;
9
+ };
4
10
  export interface ActionIconProps extends DivProps {
11
+ /**
12
+ * @description Whether the icon is active or not
13
+ * @default false
14
+ */
5
15
  active?: boolean;
6
- size?: 'large' | 'normal' | 'small' | {
7
- blockSize: number;
8
- fontSize: number;
9
- strokeWidth: number;
10
- borderRadius: number;
11
- };
16
+ /**
17
+ * @description Size of the icon
18
+ * @default 'normal'
19
+ */
20
+ size?: ActionIconSize;
21
+ /**
22
+ * @description The icon element to be rendered
23
+ * @type LucideIcon
24
+ */
12
25
  icon: LucideIcon;
26
+ /**
27
+ * @description Glass blur style
28
+ * @default 'false'
29
+ */
30
+ glass?: boolean;
13
31
  }
14
- declare const _default: React.NamedExoticComponent<ActionIconProps>;
15
- export default _default;
32
+ declare const ActionIcon: import("react").NamedExoticComponent<ActionIconProps>;
33
+ export default ActionIcon;
@@ -1,74 +1,53 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
- var _excluded = ["active", "icon", "size", "style"];
5
- var _templateObject;
3
+ var _excluded = ["className", "active", "icon", "size", "style", "glass"];
6
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; }
7
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; }
8
- import React from 'react';
9
- import styled from 'styled-components';
6
+ import { Icon } from "./..";
7
+ import { memo } from 'react';
8
+ import { useStyles } from "./style";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
- var Block = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition: all 0.2s ", ";\n\n &:hover {\n background: ", ";\n }\n\n &:active {\n color: ", ";\n background: ", ";\n }\n"])), function (_ref) {
12
- var active = _ref.active,
13
- theme = _ref.theme;
14
- return active ? theme.colorText : theme.colorTextQuaternary;
15
- }, function (_ref2) {
16
- var active = _ref2.active,
17
- theme = _ref2.theme;
18
- return active ? theme.colorFill : 'transparent';
19
- }, function (_ref3) {
20
- var theme = _ref3.theme;
21
- return theme.motionEaseOut;
22
- }, function (_ref4) {
23
- var theme = _ref4.theme;
24
- return theme.colorFillTertiary;
25
- }, function (_ref5) {
26
- var theme = _ref5.theme;
27
- return theme.colorText;
28
- }, function (_ref6) {
29
- var theme = _ref6.theme;
30
- return theme.colorFill;
31
- });
32
- var ActionIcon = function ActionIcon(_ref7) {
33
- var active = _ref7.active,
34
- icon = _ref7.icon,
35
- _ref7$size = _ref7.size,
36
- size = _ref7$size === void 0 ? 'normal' : _ref7$size,
37
- style = _ref7.style,
38
- props = _objectWithoutProperties(_ref7, _excluded);
10
+ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
11
+ var className = _ref.className,
12
+ active = _ref.active,
13
+ icon = _ref.icon,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 'normal' : _ref$size,
16
+ style = _ref.style,
17
+ glass = _ref.glass,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ var _useStyles = useStyles({
20
+ active: Boolean(active),
21
+ glass: Boolean(glass)
22
+ }),
23
+ styles = _useStyles.styles,
24
+ cx = _useStyles.cx;
39
25
  var blockSize;
40
- var fontSize;
41
- var strokeWidth;
42
26
  var borderRadius;
43
- var Icon = icon;
44
27
  switch (size) {
45
28
  case 'large':
46
29
  blockSize = 44;
47
- fontSize = 24;
48
- strokeWidth = 2;
49
30
  borderRadius = 8;
50
31
  break;
51
32
  case 'normal':
52
33
  blockSize = 36;
53
- fontSize = 24;
54
- strokeWidth = 2;
55
34
  borderRadius = 5;
56
35
  break;
57
36
  case 'small':
58
37
  blockSize = 28;
59
- fontSize = 20;
60
- strokeWidth = 1.5;
38
+ borderRadius = 5;
39
+ break;
40
+ case 'site':
41
+ blockSize = 34;
61
42
  borderRadius = 5;
62
43
  break;
63
44
  default:
64
45
  blockSize = (size === null || size === void 0 ? void 0 : size.blockSize) || 36;
65
- fontSize = (size === null || size === void 0 ? void 0 : size.fontSize) || 24;
66
- strokeWidth = (size === null || size === void 0 ? void 0 : size.strokeWidth) || 2;
67
46
  borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
68
47
  break;
69
48
  }
70
- return /*#__PURE__*/_jsx(Block, _objectSpread(_objectSpread({
71
- active: active,
49
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
50
+ className: cx(styles.block, className),
72
51
  style: _objectSpread({
73
52
  width: blockSize,
74
53
  height: blockSize,
@@ -76,9 +55,9 @@ var ActionIcon = function ActionIcon(_ref7) {
76
55
  }, style)
77
56
  }, props), {}, {
78
57
  children: /*#__PURE__*/_jsx(Icon, {
79
- size: fontSize,
80
- strokeWidth: strokeWidth
58
+ size: size === 'site' ? 'small' : size,
59
+ icon: icon
81
60
  })
82
61
  }));
83
- };
84
- export default /*#__PURE__*/React.memo(ActionIcon);
62
+ });
63
+ export default ActionIcon;
@@ -0,0 +1,6 @@
1
+ export declare const useStyles: (props?: {
2
+ active: boolean;
3
+ glass: boolean;
4
+ } | undefined) => import("antd-style").ReturnStyles<{
5
+ block: import("antd-style").SerializedStyles;
6
+ }>;
@@ -0,0 +1,12 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref, _ref2) {
5
+ var css = _ref.css,
6
+ token = _ref.token;
7
+ var active = _ref2.active,
8
+ glass = _ref2.glass;
9
+ return {
10
+ block: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition: color 600ms ", ",\n background-color 100ms ", ";\n\n ", "\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n "])), active ? token.colorText : token.colorTextQuaternary, active ? token.colorFillTertiary : 'transparent', token.motionEaseOut, token.motionEaseOut, glass && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n backdrop-filter: saturate(180%) blur(10px);\n "]))), token.colorText, active ? token.colorFillSecondary : token.colorFillTertiary, token.colorText, token.colorFill)
11
+ };
12
+ });
@@ -0,0 +1,34 @@
1
+ import { ActionIconSize, TooltipProps } from "../index";
2
+ import { DivProps } from "../types";
3
+ import { ReactNode } from 'react';
4
+ export interface CopyButtonProps extends DivProps {
5
+ /**
6
+ * @description The text content to be copied
7
+ */
8
+ content: string;
9
+ /**
10
+ * @description The size of the icon
11
+ * @enum ['large', 'normal', 'small', 'site']
12
+ * @default 'site'
13
+ */
14
+ size?: ActionIconSize;
15
+ /**
16
+ * @description Additional class name
17
+ */
18
+ className?: string;
19
+ /**
20
+ * @description The placement of the tooltip
21
+ * @enum ['top', 'left', 'right', 'bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight', 'leftTop', 'leftBottom', 'rightTop', 'rightBottom']
22
+ * @default 'right'
23
+ */
24
+ placement?: TooltipProps['placement'];
25
+ /**
26
+ * @description A function that returns the children to be rendered
27
+
28
+ */
29
+ render?: (props: {
30
+ handleCopy: () => void;
31
+ }) => ReactNode;
32
+ }
33
+ declare const CopyButton: ({ content, className, placement, size, render, ...props }: CopyButtonProps) => import("react/jsx-runtime").JSX.Element;
34
+ export default CopyButton;
@@ -0,0 +1,49 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["content", "className", "placement", "size", "render"];
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
+ 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
+ import { useCopied } from "../hooks/useCopied";
7
+ import { ActionIcon, Tooltip } from "./..";
8
+ import copy from 'copy-to-clipboard';
9
+ import { Copy } from 'lucide-react';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ var CopyButton = function CopyButton(_ref) {
13
+ var content = _ref.content,
14
+ className = _ref.className,
15
+ _ref$placement = _ref.placement,
16
+ placement = _ref$placement === void 0 ? 'right' : _ref$placement,
17
+ _ref$size = _ref.size,
18
+ size = _ref$size === void 0 ? 'site' : _ref$size,
19
+ render = _ref.render,
20
+ props = _objectWithoutProperties(_ref, _excluded);
21
+ var _useCopied = useCopied(),
22
+ copied = _useCopied.copied,
23
+ setCopied = _useCopied.setCopied;
24
+ var handleCopy = function handleCopy() {
25
+ copy(content);
26
+ setCopied();
27
+ };
28
+ var children = render ? render({
29
+ handleCopy: handleCopy
30
+ }) : /*#__PURE__*/_jsx(ActionIcon, _objectSpread(_objectSpread({}, props), {}, {
31
+ icon: Copy,
32
+ className: className,
33
+ size: size,
34
+ glass: true,
35
+ onClick: function onClick() {
36
+ copy(content);
37
+ setCopied();
38
+ }
39
+ }));
40
+ return /*#__PURE__*/_jsx(Tooltip, {
41
+ arrow: false,
42
+ placement: placement,
43
+ title: copied ? /*#__PURE__*/_jsx(_Fragment, {
44
+ children: "\u2705 Success"
45
+ }) : 'Copy',
46
+ children: children
47
+ });
48
+ };
49
+ export default CopyButton;
@@ -1,26 +1,86 @@
1
- import type { DivProps } from "../types";
1
+ /// <reference types="react" />
2
2
  import type { NumberSize, Size } from 're-resizable';
3
- import React from 'react';
4
3
  import type { Props as RndProps } from 'react-rnd';
4
+ import { DivProps } from "../types";
5
5
  export declare type placementType = 'right' | 'left' | 'top' | 'bottom';
6
6
  export interface DraggablePanelProps extends DivProps {
7
+ /**
8
+ * @description Whether the panel can be pinned or not
9
+ * @default true
10
+ */
7
11
  pin?: boolean;
12
+ /**
13
+ * @description The mode of the panel, fixed or float
14
+ * @default 'fixed'
15
+ */
8
16
  mode?: 'fixed' | 'float';
17
+ /**
18
+ * @description The placement of the panel, right, left, top or bottom
19
+ * @default 'right'
20
+ */
9
21
  placement: placementType;
22
+ /**
23
+ * @description The minimum width of the panel
24
+ */
10
25
  minWidth?: number;
26
+ /**
27
+ * @description The minimum height of the panel
28
+ */
11
29
  minHeight?: number;
30
+ /**
31
+ * @description Whether the panel can be resized or not
32
+ * @default true
33
+ */
12
34
  resize?: RndProps['enableResizing'];
35
+ /**
36
+ * @description The size of the panel
37
+ */
13
38
  size?: Partial<Size>;
39
+ /**
40
+ * @description Callback function when the size of the panel changes
41
+ */
14
42
  onSizeChange?: (delta: NumberSize, size?: Size) => void;
43
+ /**
44
+ * @description Callback function when the panel is being resized
45
+ */
15
46
  onSizeDragging?: (delta: NumberSize, size?: Size) => void;
47
+ /**
48
+ * @description Whether the panel is expandable or not
49
+ * @default true
50
+ */
16
51
  expandable?: boolean;
52
+ /**
53
+ * @description Whether the panel is expanded or not
54
+ */
17
55
  expand?: boolean;
56
+ /**
57
+ * @description The default expand state of the panel
58
+ * @default true
59
+ */
18
60
  defaultExpand?: boolean;
61
+ /**
62
+ * @description Callback function when the expand state of the panel changes
63
+ */
19
64
  onExpandChange?: (expand: boolean) => void;
65
+ /**
66
+ * @description The default size of the panel
67
+ */
20
68
  defaultSize?: Partial<Size>;
69
+ /**
70
+ * @description Whether the panel should be destroyed when closed or not
71
+ * @default false
72
+ */
21
73
  destroyOnClose?: boolean;
74
+ /**
75
+ * @description Whether the panel handler should be shown when unexpanded or not
76
+ * @default true
77
+ */
22
78
  showHandlerWhenUnexpand?: boolean;
79
+ /**
80
+ * @description The style of the panel handler
81
+ * @type CSSProperties
82
+ */
23
83
  hanlderStyle?: React.CSSProperties;
24
84
  }
25
- declare const _default: React.NamedExoticComponent<DraggablePanelProps>;
26
- export default _default;
85
+ declare const DraggablePanel: import("react").NamedExoticComponent<DraggablePanelProps>;
86
+ export default DraggablePanel;
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  import { useHover } from 'ahooks';
6
6
  import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from 'lucide-react';
7
7
  import { Resizable } from 're-resizable';
8
- import React, { useEffect, useMemo, useRef, useState } from 'react';
8
+ import { memo, useEffect, useMemo, useRef, useState } from 'react';
9
9
  import { Center } from 'react-layout-kit';
10
10
  import useControlledState from 'use-merge-value';
11
11
  import { useStyle } from "./style";
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  var DEFAULT_HEIGHT = 180;
16
16
  var DEFAULT_WIDTH = 280;
17
- var DraggablePanel = function DraggablePanel(_ref) {
17
+ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
18
18
  var _ref$pin = _ref.pin,
19
19
  pin = _ref$pin === void 0 ? 'true' : _ref$pin,
20
20
  _ref$mode = _ref.mode,
@@ -193,5 +193,5 @@ var DraggablePanel = function DraggablePanel(_ref) {
193
193
  style: _defineProperty({}, "border".concat(arrowPlacement, "Width"), 1),
194
194
  children: [expandable && showExpand && handler, destroyOnClose ? isExpand && inner : inner]
195
195
  });
196
- };
197
- export default /*#__PURE__*/React.memo(DraggablePanel);
196
+ });
197
+ export default DraggablePanel;
@@ -20,7 +20,7 @@ export var useStyle = createStyles(function (_ref, prefix) {
20
20
  toggleRight: cx("".concat(prefix, "-toggle"), "".concat(prefix, "-toggle-right"), commonToggle, css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n right: -", "px;\n width: ", "px;\n height: 100%;\n > div {\n top: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-top: -20px;\n\n border-radius: 0 4px 4px 0;\n }\n "])), offset, toggleShort, toggleShort, toggleLength)),
21
21
  toggleTop: cx("".concat(prefix, "-toggle"), "".concat(prefix, "-toggle-top"), commonToggle, css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n top: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n left: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-left: -20px;\n\n border-radius: 4px 4px 0 0;\n }\n "])), offset, toggleShort, toggleLength, toggleShort)),
22
22
  toggleBottom: cx("".concat(prefix, "-toggle"), "".concat(prefix, "-toggle-bottom"), commonToggle, css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n bottom: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n left: 50%;\n\n width: ", "px;\n height: 16px;\n margin-left: -20px;\n\n border-radius: 0 0 4px 4px;\n }\n "])), offset, toggleShort, toggleLength)),
23
- panel: cx("".concat(prefix, "-fixed"), css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n overflow: hidden;\n background: ", ";\n transition: all 0.2s ", ";\n "])), token.colorBgContainer, token.motionEaseOut)),
23
+ panel: cx("".concat(prefix, "-fixed"), css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n overflow: hidden;\n transition: all 0.2s ", ";\n "])), token.motionEaseOut)),
24
24
  handlerIcon: css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ", ";\n "])), token.motionEaseOut),
25
25
  leftHandle: cx(css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n ", ";\n\n &::before {\n left: 50%;\n width: 2px;\n height: 100%;\n }\n "])), commonHandle), "".concat(prefix, "-left-handle")),
26
26
  rightHandle: cx(css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n ", ";\n &::before {\n right: 50%;\n width: 2px;\n height: 100%;\n }\n "])), commonHandle), "".concat(prefix, "-right-handle")),
@@ -1,2 +1,2 @@
1
1
  import { placementType } from './index';
2
- export declare const revesePlacement: (placement: placementType) => "left" | "right" | "bottom" | "top";
2
+ export declare const revesePlacement: (placement: placementType) => "top" | "left" | "right" | "bottom";
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { InputProps } from 'antd';
3
+ export interface ControlInputProps extends Omit<InputProps, 'onChange' | 'value' | 'onAbort'> {
4
+ onChange?: (value: string) => void;
5
+ onValueChanging?: (value: string) => void;
6
+ value?: string;
7
+ onChangeEnd?: (value: string) => void;
8
+ }
9
+ export declare const ControlInput: import("react").NamedExoticComponent<ControlInputProps>;
@@ -0,0 +1,88 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["value", "onChange", "onValueChanging", "onChangeEnd"];
5
+ 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; }
6
+ 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; }
7
+ import { Button, ConfigProvider, Input } from 'antd';
8
+ import { memo, useCallback, useEffect, useRef, useState } from 'react';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ export var ControlInput = /*#__PURE__*/memo(function (_ref) {
12
+ var value = _ref.value,
13
+ onChange = _ref.onChange,
14
+ onValueChanging = _ref.onValueChanging,
15
+ onChangeEnd = _ref.onChangeEnd,
16
+ props = _objectWithoutProperties(_ref, _excluded);
17
+ var _useState = useState(value || ''),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ input = _useState2[0],
20
+ setInput = _useState2[1];
21
+ var inputRef = useRef(null);
22
+ var isChineseInput = useRef(false);
23
+ var isFocusing = useRef(false);
24
+ var updateValue = useCallback(function () {
25
+ onChange === null || onChange === void 0 ? void 0 : onChange(input);
26
+ }, [input]);
27
+ useEffect(function () {
28
+ if (typeof value !== 'undefined') setInput(value);
29
+ }, [value]);
30
+ return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({
31
+ ref: inputRef
32
+ }, props), {}, {
33
+ value: input,
34
+ onCompositionStart: function onCompositionStart() {
35
+ isChineseInput.current = true;
36
+ },
37
+ onCompositionEnd: function onCompositionEnd() {
38
+ isChineseInput.current = false;
39
+ },
40
+ onFocus: function onFocus() {
41
+ isFocusing.current = true;
42
+ },
43
+ onBlur: function onBlur() {
44
+ isFocusing.current = false;
45
+ onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd(input);
46
+ },
47
+ onChange: function onChange(e) {
48
+ setInput(e.target.value);
49
+ onValueChanging === null || onValueChanging === void 0 ? void 0 : onValueChanging(e.target.value);
50
+ },
51
+ onPressEnter: function onPressEnter(e) {
52
+ if (!e.shiftKey && !isChineseInput.current) {
53
+ e.preventDefault();
54
+ updateValue();
55
+ isFocusing.current = false;
56
+ onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd(input);
57
+ }
58
+ },
59
+ suffix: value === input ? /*#__PURE__*/_jsx("span", {}) : /*#__PURE__*/_jsxs(ConfigProvider, {
60
+ theme: {
61
+ token: {
62
+ fontSize: 14
63
+ }
64
+ },
65
+ children: [/*#__PURE__*/_jsx(Button, {
66
+ type: 'link',
67
+ size: 'small',
68
+ onClick: function onClick() {
69
+ setInput(value);
70
+ },
71
+ style: {
72
+ padding: 0
73
+ },
74
+ children: "\u91CD\u7F6E"
75
+ }), /*#__PURE__*/_jsx(Button, {
76
+ type: 'link',
77
+ size: 'small',
78
+ style: {
79
+ padding: 0
80
+ },
81
+ onClick: function onClick() {
82
+ updateValue();
83
+ },
84
+ children: "\u4FDD\u5B58 \u21B5"
85
+ })]
86
+ })
87
+ }));
88
+ });
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ControlInputProps } from './ControlInput';
3
+ export declare type EditableTextProps = ControlInputProps;
4
+ declare const EditableText: import("react").NamedExoticComponent<ControlInputProps>;
5
+ export default EditableText;
@@ -0,0 +1,35 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { EditOutlined } from '@ant-design/icons';
3
+ import { Tooltip } from 'antd';
4
+ import { memo, useState } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
6
+ import { ControlInput } from "./ControlInput";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ var EditableText = /*#__PURE__*/memo(function (_ref) {
10
+ var value = _ref.value,
11
+ onChange = _ref.onChange;
12
+ var _useState = useState(false),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ edited = _useState2[0],
15
+ setEdited = _useState2[1];
16
+ return edited ? /*#__PURE__*/_jsx(ControlInput, {
17
+ value: value,
18
+ onChangeEnd: function onChangeEnd() {
19
+ setEdited(false);
20
+ },
21
+ onChange: onChange
22
+ }) : /*#__PURE__*/_jsxs(Flexbox, {
23
+ horizontal: true,
24
+ gap: 8,
25
+ children: [value, /*#__PURE__*/_jsx(Tooltip, {
26
+ title: '编辑',
27
+ children: /*#__PURE__*/_jsx(EditOutlined, {
28
+ onClick: function onClick() {
29
+ setEdited(!edited);
30
+ }
31
+ })
32
+ })]
33
+ });
34
+ });
35
+ export default EditableText;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export interface PrismProps {
3
+ children: string;
4
+ language: string;
5
+ isDarkMode: boolean;
6
+ }
7
+ export declare const Prism: import("react").NamedExoticComponent<PrismProps>;
@@ -0,0 +1,40 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ 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; }
3
+ 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; }
4
+ import { Highlight, themes } from 'prism-react-renderer';
5
+ import { memo } from 'react';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export var Prism = /*#__PURE__*/memo(function (_ref) {
8
+ var children = _ref.children,
9
+ language = _ref.language,
10
+ isDarkMode = _ref.isDarkMode;
11
+ return /*#__PURE__*/_jsx(Highlight, {
12
+ theme: isDarkMode ? themes.jettwaveDark : themes.jettwaveLight,
13
+ code: children,
14
+ language: language,
15
+ children: function children(_ref2) {
16
+ var className = _ref2.className,
17
+ style = _ref2.style,
18
+ tokens = _ref2.tokens,
19
+ getLineProps = _ref2.getLineProps,
20
+ getTokenProps = _ref2.getTokenProps;
21
+ return /*#__PURE__*/_jsx("pre", {
22
+ className: className,
23
+ style: style,
24
+ children: tokens.map(function (line, i) {
25
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, getLineProps({
26
+ line: line,
27
+ key: i
28
+ })), {}, {
29
+ children: line.map(function (token, key) {
30
+ return /*#__PURE__*/_jsx("span", _objectSpread({}, getTokenProps({
31
+ token: token,
32
+ key: key
33
+ })), i);
34
+ })
35
+ }), i);
36
+ })
37
+ });
38
+ }
39
+ });
40
+ });
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { HighlighterProps } from '../index';
3
+ export declare type SyntaxHighlighterProps = Pick<HighlighterProps, 'language' | 'children' | 'theme'>;
4
+ declare const SyntaxHighlighter: import("react").NamedExoticComponent<SyntaxHighlighterProps>;
5
+ export default SyntaxHighlighter;