@lobehub/ui 1.2.0 → 1.4.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 (219) hide show
  1. package/es/ActionIcon/index.d.ts +10 -5
  2. package/es/ActionIcon/index.js +15 -7
  3. package/es/ActionIcon/style.d.ts +4 -1
  4. package/es/ActionIcon/style.js +5 -3
  5. package/es/Avatar/index.d.ts +10 -0
  6. package/es/Avatar/index.js +61 -0
  7. package/es/ContextMenu/MenuItem/icons.d.ts +4 -0
  8. package/es/ContextMenu/MenuItem/icons.js +73 -0
  9. package/es/ContextMenu/MenuItem/index.d.ts +12 -0
  10. package/es/ContextMenu/MenuItem/index.js +73 -0
  11. package/es/ContextMenu/MenuItem/style.d.ts +7 -0
  12. package/es/ContextMenu/MenuItem/style.js +16 -0
  13. package/es/ContextMenu/index.d.ts +9 -0
  14. package/es/ContextMenu/index.js +265 -0
  15. package/es/ContextMenu/style.d.ts +4 -0
  16. package/es/ContextMenu/style.js +12 -0
  17. package/es/ContextMenu/types/index.d.ts +5 -0
  18. package/es/ContextMenu/types/index.js +2 -0
  19. package/es/ContextMenu/types/menuItem.d.ts +21 -0
  20. package/es/CopyButton/index.d.ts +34 -0
  21. package/es/CopyButton/index.js +49 -0
  22. package/es/DraggablePanel/index.d.ts +10 -4
  23. package/es/DraggablePanel/index.js +10 -11
  24. package/es/DraggablePanel/style.js +2 -2
  25. package/es/EditableText/ControlInput.d.ts +9 -0
  26. package/es/EditableText/ControlInput.js +88 -0
  27. package/es/EditableText/index.d.ts +5 -0
  28. package/es/EditableText/index.js +35 -0
  29. package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  30. package/es/Highlighter/SyntaxHighlighter/Prism.js +40 -0
  31. package/es/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  32. package/es/Highlighter/SyntaxHighlighter/index.js +58 -0
  33. package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  34. package/es/Highlighter/SyntaxHighlighter/style.js +15 -0
  35. package/es/Highlighter/index.d.ts +36 -0
  36. package/es/Highlighter/index.js +42 -0
  37. package/es/Highlighter/style.d.ts +5 -0
  38. package/es/Highlighter/style.js +18 -0
  39. package/es/Icon/index.d.ts +2 -3
  40. package/es/Icon/index.js +2 -2
  41. package/es/List/ListItem/index.d.ts +64 -0
  42. package/es/List/ListItem/index.js +110 -0
  43. package/es/List/ListItem/time.d.ts +2 -0
  44. package/es/List/ListItem/time.js +10 -0
  45. package/es/List/index.d.ts +5 -0
  46. package/es/List/index.js +5 -0
  47. package/es/Logo/Divider.d.ts +3 -3
  48. package/es/Logo/Divider.js +6 -4
  49. package/es/Logo/Logo3D.d.ts +3 -3
  50. package/es/Logo/Logo3D.js +6 -4
  51. package/es/Logo/LogoFlat.d.ts +3 -3
  52. package/es/Logo/LogoFlat.js +6 -4
  53. package/es/Logo/LogoHighContrast.d.ts +3 -3
  54. package/es/Logo/LogoHighContrast.js +6 -4
  55. package/es/Logo/LogoText.d.ts +3 -3
  56. package/es/Logo/LogoText.js +6 -4
  57. package/es/Logo/index.d.ts +3 -3
  58. package/es/Logo/index.js +5 -5
  59. package/es/Logo/style.js +1 -1
  60. package/es/Markdown/Code.d.ts +3 -0
  61. package/es/Markdown/Code.js +12 -0
  62. package/es/Markdown/CodeBlock.d.ts +3 -0
  63. package/es/Markdown/CodeBlock.js +27 -0
  64. package/es/Markdown/index.d.ts +13 -0
  65. package/es/Markdown/index.js +28 -0
  66. package/es/Markdown/style.d.ts +4 -0
  67. package/es/Markdown/style.js +12 -0
  68. package/es/MessageInput/index.d.ts +35 -0
  69. package/es/MessageInput/index.js +63 -0
  70. package/es/SearchBar/index.d.ts +5 -0
  71. package/es/SearchBar/index.js +27 -0
  72. package/es/SideNav/index.d.ts +6 -6
  73. package/es/SideNav/index.js +17 -20
  74. package/es/SideNav/style.d.ts +1 -0
  75. package/es/SideNav/style.js +8 -0
  76. package/es/Snippet/index.d.ts +29 -0
  77. package/es/Snippet/index.js +39 -0
  78. package/es/Snippet/style.d.ts +1 -0
  79. package/es/Snippet/style.js +9 -0
  80. package/es/StroyBook/index.d.ts +3 -4
  81. package/es/StroyBook/index.js +14 -7
  82. package/es/StroyBook/style.d.ts +4 -1
  83. package/es/StroyBook/style.js +7 -5
  84. package/es/Swatches/index.d.ts +8 -0
  85. package/es/Swatches/index.js +44 -0
  86. package/es/TabsNav/index.d.ts +3 -3
  87. package/es/TabsNav/index.js +4 -4
  88. package/es/ThemeProvider/GlobalStyle.js +1 -1
  89. package/es/ThemeProvider/index.d.ts +15 -0
  90. package/es/ThemeSwitch/index.d.ts +5 -5
  91. package/es/ThemeSwitch/index.js +5 -9
  92. package/es/Tooltip/index.d.ts +5 -0
  93. package/es/Tooltip/index.js +20 -0
  94. package/es/Tooltip/style.d.ts +3 -0
  95. package/es/Tooltip/style.js +10 -0
  96. package/es/hooks/useCopied.d.ts +4 -0
  97. package/es/hooks/useCopied.js +26 -0
  98. package/es/hooks/useHighlight.d.ts +36 -0
  99. package/es/hooks/useHighlight.js +63 -0
  100. package/es/index.d.ts +12 -0
  101. package/es/index.js +13 -1
  102. package/es/styles/theme/base.d.ts +2 -0
  103. package/es/styles/theme/base.js +15 -0
  104. package/es/styles/theme/dark.js +6 -14
  105. package/es/styles/theme/light.js +11 -12
  106. package/es/types/index.d.ts +14 -5
  107. package/lib/ActionIcon/index.d.ts +10 -5
  108. package/lib/ActionIcon/index.js +39 -50
  109. package/lib/ActionIcon/style.d.ts +4 -1
  110. package/lib/ActionIcon/style.js +29 -22
  111. package/lib/Avatar/index.d.ts +10 -0
  112. package/lib/Avatar/index.js +74 -0
  113. package/lib/ContextMenu/MenuItem/icons.d.ts +4 -0
  114. package/lib/ContextMenu/MenuItem/icons.js +100 -0
  115. package/lib/ContextMenu/MenuItem/index.d.ts +12 -0
  116. package/lib/ContextMenu/MenuItem/index.js +72 -0
  117. package/lib/ContextMenu/MenuItem/style.d.ts +7 -0
  118. package/lib/ContextMenu/MenuItem/style.js +94 -0
  119. package/lib/ContextMenu/index.d.ts +9 -0
  120. package/lib/ContextMenu/index.js +254 -0
  121. package/lib/ContextMenu/style.d.ts +4 -0
  122. package/lib/ContextMenu/style.js +88 -0
  123. package/lib/ContextMenu/types/index.d.ts +5 -0
  124. package/lib/ContextMenu/types/index.js +19 -0
  125. package/lib/ContextMenu/types/menuItem.d.ts +21 -0
  126. package/lib/{types/index.js → ContextMenu/types/menuItem.js} +3 -3
  127. package/lib/CopyButton/index.d.ts +34 -0
  128. package/lib/CopyButton/index.js +70 -0
  129. package/lib/DraggablePanel/index.d.ts +10 -4
  130. package/lib/DraggablePanel/index.js +147 -147
  131. package/lib/DraggablePanel/style.js +1 -2
  132. package/lib/EditableText/ControlInput.d.ts +9 -0
  133. package/lib/EditableText/ControlInput.js +101 -0
  134. package/lib/EditableText/index.d.ts +5 -0
  135. package/lib/EditableText/index.js +52 -0
  136. package/lib/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  137. package/lib/Highlighter/SyntaxHighlighter/Prism.js +41 -0
  138. package/lib/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  139. package/lib/Highlighter/SyntaxHighlighter/index.js +55 -0
  140. package/lib/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  141. package/lib/Highlighter/SyntaxHighlighter/style.js +58 -0
  142. package/lib/Highlighter/index.d.ts +36 -0
  143. package/lib/Highlighter/index.js +62 -0
  144. package/lib/Highlighter/style.d.ts +5 -0
  145. package/lib/Highlighter/style.js +107 -0
  146. package/lib/Icon/index.d.ts +2 -3
  147. package/lib/Icon/index.js +3 -13
  148. package/lib/List/ListItem/index.d.ts +64 -0
  149. package/lib/List/ListItem/index.js +157 -0
  150. package/lib/List/ListItem/time.d.ts +2 -0
  151. package/lib/List/ListItem/time.js +50 -0
  152. package/lib/List/index.d.ts +5 -0
  153. package/lib/List/index.js +41 -0
  154. package/lib/Logo/Divider.d.ts +3 -3
  155. package/lib/Logo/Divider.js +5 -15
  156. package/lib/Logo/Logo3D.d.ts +3 -3
  157. package/lib/Logo/Logo3D.js +4 -14
  158. package/lib/Logo/LogoFlat.d.ts +3 -3
  159. package/lib/Logo/LogoFlat.js +18 -28
  160. package/lib/Logo/LogoHighContrast.d.ts +3 -3
  161. package/lib/Logo/LogoHighContrast.js +4 -14
  162. package/lib/Logo/LogoText.d.ts +3 -3
  163. package/lib/Logo/LogoText.js +5 -15
  164. package/lib/Logo/index.d.ts +3 -3
  165. package/lib/Logo/index.js +11 -18
  166. package/lib/Logo/style.js +1 -1
  167. package/lib/Markdown/Code.d.ts +3 -0
  168. package/lib/Markdown/Code.js +33 -0
  169. package/lib/Markdown/CodeBlock.d.ts +3 -0
  170. package/lib/Markdown/CodeBlock.js +64 -0
  171. package/lib/Markdown/index.d.ts +13 -0
  172. package/lib/Markdown/index.js +48 -0
  173. package/lib/Markdown/style.d.ts +4 -0
  174. package/lib/Markdown/style.js +64 -0
  175. package/lib/MessageInput/index.d.ts +35 -0
  176. package/lib/MessageInput/index.js +58 -0
  177. package/lib/SearchBar/index.d.ts +5 -0
  178. package/lib/SearchBar/index.js +42 -0
  179. package/lib/SideNav/index.d.ts +6 -6
  180. package/lib/SideNav/index.js +7 -31
  181. package/lib/SideNav/style.d.ts +1 -0
  182. package/lib/SideNav/style.js +46 -0
  183. package/lib/Snippet/index.d.ts +29 -0
  184. package/lib/Snippet/index.js +47 -0
  185. package/lib/Snippet/style.d.ts +1 -0
  186. package/lib/Snippet/style.js +71 -0
  187. package/lib/StroyBook/index.d.ts +3 -4
  188. package/lib/StroyBook/index.js +20 -13
  189. package/lib/StroyBook/style.d.ts +4 -1
  190. package/lib/StroyBook/style.js +49 -43
  191. package/lib/Swatches/index.d.ts +8 -0
  192. package/lib/Swatches/index.js +68 -0
  193. package/lib/TabsNav/index.d.ts +3 -3
  194. package/lib/TabsNav/index.js +5 -15
  195. package/lib/ThemeProvider/GlobalStyle.js +7 -5
  196. package/lib/ThemeProvider/index.d.ts +15 -0
  197. package/lib/ThemeSwitch/index.d.ts +5 -5
  198. package/lib/ThemeSwitch/index.js +15 -32
  199. package/lib/Tooltip/index.d.ts +5 -0
  200. package/lib/Tooltip/index.js +34 -0
  201. package/lib/Tooltip/style.d.ts +3 -0
  202. package/lib/Tooltip/style.js +51 -0
  203. package/lib/hooks/useCopied.d.ts +4 -0
  204. package/lib/hooks/useCopied.js +44 -0
  205. package/lib/hooks/useHighlight.d.ts +36 -0
  206. package/lib/hooks/useHighlight.js +76 -0
  207. package/lib/index.d.ts +12 -0
  208. package/lib/index.js +38 -0
  209. package/lib/styles/theme/base.d.ts +2 -0
  210. package/lib/styles/theme/base.js +43 -0
  211. package/lib/styles/theme/dark.js +5 -12
  212. package/lib/styles/theme/light.js +10 -10
  213. package/lib/types/index.d.ts +14 -5
  214. package/package.json +14 -4
  215. package/es/ThemeProvider/token.d.ts +0 -3
  216. package/es/ThemeProvider/token.js +0 -45
  217. package/lib/ThemeProvider/token.d.ts +0 -3
  218. package/lib/ThemeProvider/token.js +0 -73
  219. /package/es/{types/index.js → ContextMenu/types/menuItem.js} +0 -0
@@ -0,0 +1,101 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/EditableText/ControlInput.tsx
20
+ var ControlInput_exports = {};
21
+ __export(ControlInput_exports, {
22
+ ControlInput: () => ControlInput
23
+ });
24
+ module.exports = __toCommonJS(ControlInput_exports);
25
+ var import_antd = require("antd");
26
+ var import_react = require("react");
27
+ var ControlInput = (0, import_react.memo)(
28
+ ({ value, onChange, onValueChanging, onChangeEnd, ...props }) => {
29
+ const [input, setInput] = (0, import_react.useState)(value || "");
30
+ const inputRef = (0, import_react.useRef)(null);
31
+ const isChineseInput = (0, import_react.useRef)(false);
32
+ const isFocusing = (0, import_react.useRef)(false);
33
+ const updateValue = (0, import_react.useCallback)(() => {
34
+ onChange == null ? void 0 : onChange(input);
35
+ }, [input]);
36
+ (0, import_react.useEffect)(() => {
37
+ if (typeof value !== "undefined")
38
+ setInput(value);
39
+ }, [value]);
40
+ return /* @__PURE__ */ React.createElement(
41
+ import_antd.Input,
42
+ {
43
+ ref: inputRef,
44
+ ...props,
45
+ value: input,
46
+ onCompositionStart: () => {
47
+ isChineseInput.current = true;
48
+ },
49
+ onCompositionEnd: () => {
50
+ isChineseInput.current = false;
51
+ },
52
+ onFocus: () => {
53
+ isFocusing.current = true;
54
+ },
55
+ onBlur: () => {
56
+ isFocusing.current = false;
57
+ onChangeEnd == null ? void 0 : onChangeEnd(input);
58
+ },
59
+ onChange: (e) => {
60
+ setInput(e.target.value);
61
+ onValueChanging == null ? void 0 : onValueChanging(e.target.value);
62
+ },
63
+ onPressEnter: (e) => {
64
+ if (!e.shiftKey && !isChineseInput.current) {
65
+ e.preventDefault();
66
+ updateValue();
67
+ isFocusing.current = false;
68
+ onChangeEnd == null ? void 0 : onChangeEnd(input);
69
+ }
70
+ },
71
+ suffix: value === input ? /* @__PURE__ */ React.createElement("span", null) : /* @__PURE__ */ React.createElement(import_antd.ConfigProvider, { theme: { token: { fontSize: 14 } } }, /* @__PURE__ */ React.createElement(
72
+ import_antd.Button,
73
+ {
74
+ type: "link",
75
+ size: "small",
76
+ onClick: () => {
77
+ setInput(value);
78
+ },
79
+ style: { padding: 0 }
80
+ },
81
+ "重置"
82
+ ), /* @__PURE__ */ React.createElement(
83
+ import_antd.Button,
84
+ {
85
+ type: "link",
86
+ size: "small",
87
+ style: { padding: 0 },
88
+ onClick: () => {
89
+ updateValue();
90
+ }
91
+ },
92
+ "保存 ↵"
93
+ ))
94
+ }
95
+ );
96
+ }
97
+ );
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ ControlInput
101
+ });
@@ -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,52 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/EditableText/index.tsx
20
+ var EditableText_exports = {};
21
+ __export(EditableText_exports, {
22
+ default: () => EditableText_default
23
+ });
24
+ module.exports = __toCommonJS(EditableText_exports);
25
+ var import_icons = require("@ant-design/icons");
26
+ var import_antd = require("antd");
27
+ var import_react = require("react");
28
+ var import_react_layout_kit = require("react-layout-kit");
29
+ var import_ControlInput = require("./ControlInput");
30
+ var EditableText = (0, import_react.memo)(({ value, onChange }) => {
31
+ const [edited, setEdited] = (0, import_react.useState)(false);
32
+ return edited ? /* @__PURE__ */ React.createElement(
33
+ import_ControlInput.ControlInput,
34
+ {
35
+ value,
36
+ onChangeEnd: () => {
37
+ setEdited(false);
38
+ },
39
+ onChange
40
+ }
41
+ ) : /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, gap: 8 }, value, /* @__PURE__ */ React.createElement(import_antd.Tooltip, { title: "编辑" }, /* @__PURE__ */ React.createElement(
42
+ import_icons.EditOutlined,
43
+ {
44
+ onClick: () => {
45
+ setEdited(!edited);
46
+ }
47
+ }
48
+ )));
49
+ });
50
+ var EditableText_default = EditableText;
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {});
@@ -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,41 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/Highlighter/SyntaxHighlighter/Prism.tsx
20
+ var Prism_exports = {};
21
+ __export(Prism_exports, {
22
+ Prism: () => Prism
23
+ });
24
+ module.exports = __toCommonJS(Prism_exports);
25
+ var import_prism_react_renderer = require("prism-react-renderer");
26
+ var import_react = require("react");
27
+ var Prism = (0, import_react.memo)(({ children, language, isDarkMode }) => {
28
+ return /* @__PURE__ */ React.createElement(
29
+ import_prism_react_renderer.Highlight,
30
+ {
31
+ theme: isDarkMode ? import_prism_react_renderer.themes.jettwaveDark : import_prism_react_renderer.themes.jettwaveLight,
32
+ code: children,
33
+ language
34
+ },
35
+ ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React.createElement("pre", { className, style }, tokens.map((line, i) => /* @__PURE__ */ React.createElement("div", { key: i, ...getLineProps({ line, key: i }) }, line.map((token, key) => /* @__PURE__ */ React.createElement("span", { key: i, ...getTokenProps({ token, key }) })))))
36
+ );
37
+ });
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ Prism
41
+ });
@@ -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;
@@ -0,0 +1,55 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/Highlighter/SyntaxHighlighter/index.tsx
20
+ var SyntaxHighlighter_exports = {};
21
+ __export(SyntaxHighlighter_exports, {
22
+ default: () => SyntaxHighlighter_default
23
+ });
24
+ module.exports = __toCommonJS(SyntaxHighlighter_exports);
25
+ var import_useHighlight = require("../../hooks/useHighlight");
26
+ var import_icons = require("@ant-design/icons");
27
+ var import_react = require("react");
28
+ var import_react_layout_kit = require("react-layout-kit");
29
+ var import_shallow = require("zustand/shallow");
30
+ var import_Prism = require("./Prism");
31
+ var import_antd_style = require("antd-style");
32
+ var import_style = require("./style");
33
+ var SyntaxHighlighter = (0, import_react.memo)(
34
+ ({ children, language, theme: appearance }) => {
35
+ const { styles, theme } = (0, import_style.useStyles)();
36
+ const { isDarkMode } = (0, import_antd_style.useThemeMode)();
37
+ const isDarkTheme = appearance ? appearance === "dark" : isDarkMode;
38
+ const [codeToHtml, isLoading] = (0, import_useHighlight.useHighlight)((s) => [s.codeToHtml, !s.highlighter], import_shallow.shallow);
39
+ (0, import_react.useEffect)(() => {
40
+ import_useHighlight.useHighlight.getState().initHighlighter();
41
+ }, []);
42
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, isLoading ? /* @__PURE__ */ React.createElement("div", { className: styles.prism }, /* @__PURE__ */ React.createElement(import_Prism.Prism, { language, isDarkMode: isDarkTheme }, children)) : /* @__PURE__ */ React.createElement(
43
+ "div",
44
+ {
45
+ dangerouslySetInnerHTML: {
46
+ __html: codeToHtml(children, language, isDarkTheme) || ""
47
+ },
48
+ className: styles.shiki
49
+ }
50
+ ), isLoading && /* @__PURE__ */ React.createElement(import_react_layout_kit.Center, { horizontal: true, gap: 8, className: styles.loading }, /* @__PURE__ */ React.createElement(import_icons.Loading3QuartersOutlined, { spin: true, style: { color: theme.colorTextTertiary } }), "shiki rendering..."));
51
+ }
52
+ );
53
+ var SyntaxHighlighter_default = SyntaxHighlighter;
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {});
@@ -0,0 +1,5 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ shiki: string;
3
+ prism: import("antd-style").SerializedStyles;
4
+ loading: import("antd-style").SerializedStyles;
5
+ }>;
@@ -0,0 +1,58 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/Highlighter/SyntaxHighlighter/style.ts
20
+ var style_exports = {};
21
+ __export(style_exports, {
22
+ useStyles: () => useStyles
23
+ });
24
+ module.exports = __toCommonJS(style_exports);
25
+ var import_antd_style = require("antd-style");
26
+ var useStyles = (0, import_antd_style.createStyles)(({ css, token, cx, prefixCls }) => {
27
+ const prefix = `${prefixCls}-highlighter`;
28
+ return {
29
+ shiki: cx(
30
+ `${prefix}-shiki`,
31
+ css`
32
+ .shiki {
33
+ overflow-x: scroll;
34
+ background: none !important;
35
+ }
36
+ `
37
+ ),
38
+ prism: css`
39
+ pre {
40
+ overflow-x: scroll;
41
+ font-family: ${token.fontFamilyCode} !important;
42
+ }
43
+ `,
44
+ loading: css`
45
+ position: absolute;
46
+ top: 0;
47
+ right: 0;
48
+ color: ${token.colorTextTertiary};
49
+ padding: 4px 8px;
50
+ backdrop-filter: saturate(180%) blur(10px);
51
+ border-radius: ${token.borderRadiusSM};
52
+ `
53
+ };
54
+ });
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ useStyles
58
+ });
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "../types";
3
+ import SyntaxHighlighter, { type SyntaxHighlighterProps } from './SyntaxHighlighter';
4
+ export { SyntaxHighlighter, SyntaxHighlighterProps };
5
+ export interface HighlighterProps extends DivProps {
6
+ /**
7
+ * @description The code content to be highlighted
8
+ */
9
+ children: string;
10
+ /**
11
+ * @description The language of the code content
12
+ */
13
+ language: string;
14
+ /**
15
+ * @description Whether to show language tag
16
+ * @default true
17
+ */
18
+ showLanguage?: boolean;
19
+ /**
20
+ * @description Whether to show the copy button
21
+ * @default true
22
+ */
23
+ copyable?: boolean;
24
+ /**
25
+ * @description The theme of the code block
26
+ * @default 'light'
27
+ */
28
+ theme?: 'dark' | 'light';
29
+ /**
30
+ * @description The type of the code block
31
+ * @default 'block'
32
+ */
33
+ type?: 'ghost' | 'block' | 'prue';
34
+ }
35
+ export declare const Highlighter: import("react").NamedExoticComponent<HighlighterProps>;
36
+ export default Highlighter;
@@ -0,0 +1,62 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/Highlighter/index.tsx
30
+ var Highlighter_exports = {};
31
+ __export(Highlighter_exports, {
32
+ Highlighter: () => Highlighter,
33
+ SyntaxHighlighter: () => import_SyntaxHighlighter.default,
34
+ default: () => Highlighter_default
35
+ });
36
+ module.exports = __toCommonJS(Highlighter_exports);
37
+ var import_react = require("react");
38
+ var import_CopyButton = __toESM(require("../CopyButton"));
39
+ var import_SyntaxHighlighter = __toESM(require("./SyntaxHighlighter"));
40
+ var import_style = require("./style");
41
+ var Highlighter = (0, import_react.memo)(
42
+ ({
43
+ children,
44
+ language,
45
+ className,
46
+ style,
47
+ theme,
48
+ copyable = true,
49
+ showLanguage = true,
50
+ type = "block"
51
+ }) => {
52
+ const { styles, cx } = (0, import_style.useStyles)(type);
53
+ const container = cx(styles.container, className);
54
+ return /* @__PURE__ */ React.createElement("div", { "data-code-type": "highlighter", className: container, style }, copyable && /* @__PURE__ */ React.createElement(import_CopyButton.default, { placement: "left", content: children, className: styles.button }), showLanguage && language && /* @__PURE__ */ React.createElement("div", { className: styles.lang }, language.toLowerCase()), /* @__PURE__ */ React.createElement(import_SyntaxHighlighter.default, { theme, language: language == null ? void 0 : language.toLowerCase() }, children.trim()));
55
+ }
56
+ );
57
+ var Highlighter_default = Highlighter;
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ Highlighter,
61
+ SyntaxHighlighter
62
+ });
@@ -0,0 +1,5 @@
1
+ export declare const useStyles: (props?: "block" | "ghost" | "prue" | undefined) => import("antd-style").ReturnStyles<{
2
+ container: string;
3
+ button: string;
4
+ lang: string;
5
+ }>;
@@ -0,0 +1,107 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/Highlighter/style.ts
20
+ var style_exports = {};
21
+ __export(style_exports, {
22
+ useStyles: () => useStyles
23
+ });
24
+ module.exports = __toCommonJS(style_exports);
25
+ var import_antd_style = require("antd-style");
26
+ var import_polished = require("polished");
27
+ var useStyles = (0, import_antd_style.createStyles)(
28
+ ({ token, css, cx, prefixCls }, type) => {
29
+ const prefix = `${prefixCls}-highlighter`;
30
+ const buttonHoverCls = `${prefix}-hover-btn`;
31
+ const langHoverCls = `${prefix}-hover-lang`;
32
+ return {
33
+ container: cx(
34
+ prefix,
35
+ css`
36
+ overflow: auto;
37
+ position: relative;
38
+ transition: background-color 100ms ${token.motionEaseOut};
39
+ background-color: ${type === "block" ? (0, import_polished.rgba)(token.colorBgElevated, 0.6) : "transparent"};
40
+ border-radius: ${token.borderRadius}px;
41
+
42
+ ${type === "ghost" && css`
43
+ border: 1px solid ${token.colorBorder};
44
+ `}
45
+
46
+ &:hover {
47
+ background-color: ${type === "prue" ? "transparent" : token.colorFillTertiary};
48
+ }
49
+
50
+ .prism-code {
51
+ background: none !important;
52
+ }
53
+
54
+ pre {
55
+ margin: 0 !important;
56
+ padding: ${type === "prue" ? 0 : `16px 24px`} !important;
57
+ background: none !important;
58
+ }
59
+
60
+ code {
61
+ background: transparent !important;
62
+ }
63
+
64
+ &:hover {
65
+ .${buttonHoverCls} {
66
+ opacity: 1;
67
+ }
68
+
69
+ .${langHoverCls} {
70
+ opacity: 1;
71
+ }
72
+ }
73
+ `
74
+ ),
75
+ button: cx(
76
+ buttonHoverCls,
77
+ css`
78
+ position: absolute;
79
+ z-index: 51;
80
+ top: 8px;
81
+ right: 8px;
82
+
83
+ opacity: 0;
84
+ `
85
+ ),
86
+ lang: cx(
87
+ langHoverCls,
88
+ css`
89
+ position: absolute;
90
+ z-index: 50;
91
+ right: 8px;
92
+ bottom: 8px;
93
+
94
+ color: ${token.colorTextPlaceholder};
95
+
96
+ opacity: 0;
97
+
98
+ transition: opacity 0.1s;
99
+ `
100
+ )
101
+ };
102
+ }
103
+ );
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ useStyles
107
+ });
@@ -1,6 +1,5 @@
1
- import { SvgProps } from "../types";
1
+ /// <reference types="react" />
2
2
  import { LucideIcon } from 'lucide-react';
3
- import React from 'react';
4
3
  export declare type IconSize = 'large' | 'normal' | 'small' | {
5
4
  fontSize?: number;
6
5
  strokeWidth?: number;
@@ -17,5 +16,5 @@ export interface IconProps extends SvgProps {
17
16
  */
18
17
  icon: LucideIcon;
19
18
  }
20
- declare const _default: React.NamedExoticComponent<IconProps>;
19
+ declare const _default: import("react").NamedExoticComponent<IconProps>;
21
20
  export default _default;
package/lib/Icon/index.js CHANGED
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/Icon/index.tsx
@@ -32,7 +22,7 @@ __export(Icon_exports, {
32
22
  default: () => Icon_default
33
23
  });
34
24
  module.exports = __toCommonJS(Icon_exports);
35
- var import_react = __toESM(require("react"));
25
+ var import_react = require("react");
36
26
  var Icon = ({ icon, size = "normal", ...props }) => {
37
27
  let fontSize;
38
28
  let strokeWidth;
@@ -52,8 +42,8 @@ var Icon = ({ icon, size = "normal", ...props }) => {
52
42
  strokeWidth = (size == null ? void 0 : size.strokeWidth) || 2;
53
43
  break;
54
44
  }
55
- return /* @__PURE__ */ import_react.default.createElement(SvgIcon, { size: fontSize, strokeWidth, ...props });
45
+ return /* @__PURE__ */ React.createElement(SvgIcon, { size: fontSize, strokeWidth, ...props });
56
46
  };
57
- var Icon_default = import_react.default.memo(Icon);
47
+ var Icon_default = (0, import_react.memo)(Icon);
58
48
  // Annotate the CommonJS export names for ESM import in node:
59
49
  0 && (module.exports = {});
@@ -0,0 +1,64 @@
1
+ import { CSSProperties, HTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * 卡片列表项的属性
4
+ */
5
+ export interface ListItemProps {
6
+ /**
7
+ * 是否处于激活状态
8
+ */
9
+ active: boolean;
10
+ /**
11
+ * 是否处于加载状态
12
+ */
13
+ loading?: boolean;
14
+ /**
15
+ * 标题
16
+ */
17
+ title: string;
18
+ /**
19
+ * 描述信息
20
+ */
21
+ description?: string;
22
+ /**
23
+ * 日期时间戳
24
+ */
25
+ date?: number;
26
+ /**
27
+ * 点击事件回调函数
28
+ */
29
+ onClick?: () => void;
30
+ /**
31
+ * 鼠标悬停状态变化事件回调函数
32
+ * @param hover - 是否悬停
33
+ */
34
+ onHoverChange?: (hover: boolean) => void;
35
+ /**
36
+ * 渲染操作区域的 React 节点
37
+ */
38
+ renderActions?: ReactNode;
39
+ /**
40
+ * 头像的 React 节点
41
+ */
42
+ avatar?: ReactNode;
43
+ /**
44
+ * 自定义样式类名
45
+ */
46
+ className?: string;
47
+ /**
48
+ * 自定义样式对象
49
+ */
50
+ style?: CSSProperties;
51
+ /**
52
+ * 是否显示操作区域
53
+ */
54
+ showAction?: boolean;
55
+ /**
56
+ * 自定义样式类名对象
57
+ * @property time - 时间的样式类名
58
+ */
59
+ classNames?: {
60
+ time?: string;
61
+ };
62
+ }
63
+ declare const ListItem: import("react").ForwardRefExoticComponent<ListItemProps & HTMLAttributes<any> & import("react").RefAttributes<HTMLElement>>;
64
+ export default ListItem;