@lobehub/ui 1.2.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 (179) 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/CopyButton/index.d.ts +34 -0
  6. package/es/CopyButton/index.js +49 -0
  7. package/es/DraggablePanel/index.d.ts +4 -4
  8. package/es/DraggablePanel/index.js +4 -4
  9. package/es/DraggablePanel/style.js +2 -2
  10. package/es/DraggablePanel/utils.d.ts +1 -1
  11. package/es/EditableText/ControlInput.d.ts +9 -0
  12. package/es/EditableText/ControlInput.js +88 -0
  13. package/es/EditableText/index.d.ts +5 -0
  14. package/es/EditableText/index.js +35 -0
  15. package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  16. package/es/Highlighter/SyntaxHighlighter/Prism.js +40 -0
  17. package/es/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  18. package/es/Highlighter/SyntaxHighlighter/index.js +58 -0
  19. package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  20. package/es/Highlighter/SyntaxHighlighter/style.js +15 -0
  21. package/es/Highlighter/index.d.ts +36 -0
  22. package/es/Highlighter/index.js +42 -0
  23. package/es/Highlighter/style.d.ts +5 -0
  24. package/es/Highlighter/style.js +18 -0
  25. package/es/Icon/index.d.ts +2 -3
  26. package/es/Icon/index.js +2 -2
  27. package/es/Logo/Divider.d.ts +3 -3
  28. package/es/Logo/Divider.js +6 -4
  29. package/es/Logo/Logo3D.d.ts +3 -3
  30. package/es/Logo/Logo3D.js +6 -4
  31. package/es/Logo/LogoFlat.d.ts +3 -3
  32. package/es/Logo/LogoFlat.js +6 -4
  33. package/es/Logo/LogoHighContrast.d.ts +3 -3
  34. package/es/Logo/LogoHighContrast.js +6 -4
  35. package/es/Logo/LogoText.d.ts +3 -3
  36. package/es/Logo/LogoText.js +6 -4
  37. package/es/Logo/index.d.ts +3 -3
  38. package/es/Logo/index.js +5 -5
  39. package/es/Logo/style.js +1 -1
  40. package/es/Markdown/Code.d.ts +3 -0
  41. package/es/Markdown/Code.js +12 -0
  42. package/es/Markdown/CodeBlock.d.ts +3 -0
  43. package/es/Markdown/CodeBlock.js +27 -0
  44. package/es/Markdown/index.d.ts +13 -0
  45. package/es/Markdown/index.js +28 -0
  46. package/es/Markdown/style.d.ts +4 -0
  47. package/es/Markdown/style.js +12 -0
  48. package/es/MessageInput/index.d.ts +35 -0
  49. package/es/MessageInput/index.js +63 -0
  50. package/es/SearchBar/index.d.ts +5 -0
  51. package/es/SearchBar/index.js +27 -0
  52. package/es/SideNav/index.d.ts +6 -6
  53. package/es/SideNav/index.js +17 -20
  54. package/es/SideNav/style.d.ts +1 -0
  55. package/es/SideNav/style.js +8 -0
  56. package/es/Snippet/index.d.ts +29 -0
  57. package/es/Snippet/index.js +39 -0
  58. package/es/Snippet/style.d.ts +1 -0
  59. package/es/Snippet/style.js +9 -0
  60. package/es/StroyBook/index.d.ts +3 -4
  61. package/es/StroyBook/index.js +14 -7
  62. package/es/StroyBook/style.d.ts +4 -1
  63. package/es/StroyBook/style.js +7 -5
  64. package/es/Swatches/index.d.ts +8 -0
  65. package/es/Swatches/index.js +44 -0
  66. package/es/TabsNav/index.d.ts +3 -3
  67. package/es/TabsNav/index.js +4 -4
  68. package/es/ThemeProvider/GlobalStyle.js +1 -1
  69. package/es/ThemeProvider/index.d.ts +15 -0
  70. package/es/ThemeSwitch/index.d.ts +5 -5
  71. package/es/ThemeSwitch/index.js +5 -9
  72. package/es/Tooltip/index.d.ts +5 -0
  73. package/es/Tooltip/index.js +20 -0
  74. package/es/Tooltip/style.d.ts +3 -0
  75. package/es/Tooltip/style.js +10 -0
  76. package/es/hooks/useCopied.d.ts +4 -0
  77. package/es/hooks/useCopied.js +26 -0
  78. package/es/hooks/useHighlight.d.ts +36 -0
  79. package/es/hooks/useHighlight.js +63 -0
  80. package/es/index.d.ts +9 -0
  81. package/es/index.js +10 -1
  82. package/es/styles/theme/base.d.ts +2 -0
  83. package/es/styles/theme/base.js +15 -0
  84. package/es/styles/theme/dark.js +6 -14
  85. package/es/styles/theme/light.js +11 -12
  86. package/es/types/index.d.ts +14 -5
  87. package/lib/ActionIcon/index.d.ts +10 -5
  88. package/lib/ActionIcon/index.js +39 -50
  89. package/lib/ActionIcon/style.d.ts +4 -1
  90. package/lib/ActionIcon/style.js +29 -22
  91. package/lib/CopyButton/index.d.ts +34 -0
  92. package/lib/CopyButton/index.js +70 -0
  93. package/lib/DraggablePanel/index.d.ts +4 -4
  94. package/lib/DraggablePanel/index.js +160 -158
  95. package/lib/DraggablePanel/style.js +1 -2
  96. package/lib/DraggablePanel/utils.d.ts +1 -1
  97. package/lib/EditableText/ControlInput.d.ts +9 -0
  98. package/lib/EditableText/ControlInput.js +101 -0
  99. package/lib/EditableText/index.d.ts +5 -0
  100. package/lib/EditableText/index.js +52 -0
  101. package/lib/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  102. package/lib/Highlighter/SyntaxHighlighter/Prism.js +41 -0
  103. package/lib/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  104. package/lib/Highlighter/SyntaxHighlighter/index.js +55 -0
  105. package/lib/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  106. package/lib/Highlighter/SyntaxHighlighter/style.js +58 -0
  107. package/lib/Highlighter/index.d.ts +36 -0
  108. package/lib/Highlighter/index.js +62 -0
  109. package/lib/Highlighter/style.d.ts +5 -0
  110. package/lib/Highlighter/style.js +107 -0
  111. package/lib/Icon/index.d.ts +2 -3
  112. package/lib/Icon/index.js +3 -13
  113. package/lib/Logo/Divider.d.ts +3 -3
  114. package/lib/Logo/Divider.js +5 -15
  115. package/lib/Logo/Logo3D.d.ts +3 -3
  116. package/lib/Logo/Logo3D.js +4 -14
  117. package/lib/Logo/LogoFlat.d.ts +3 -3
  118. package/lib/Logo/LogoFlat.js +18 -28
  119. package/lib/Logo/LogoHighContrast.d.ts +3 -3
  120. package/lib/Logo/LogoHighContrast.js +4 -14
  121. package/lib/Logo/LogoText.d.ts +3 -3
  122. package/lib/Logo/LogoText.js +5 -15
  123. package/lib/Logo/index.d.ts +3 -3
  124. package/lib/Logo/index.js +11 -18
  125. package/lib/Logo/style.js +1 -1
  126. package/lib/Markdown/Code.d.ts +3 -0
  127. package/lib/Markdown/Code.js +33 -0
  128. package/lib/Markdown/CodeBlock.d.ts +3 -0
  129. package/lib/Markdown/CodeBlock.js +64 -0
  130. package/lib/Markdown/index.d.ts +13 -0
  131. package/lib/Markdown/index.js +48 -0
  132. package/lib/Markdown/style.d.ts +4 -0
  133. package/lib/Markdown/style.js +64 -0
  134. package/lib/MessageInput/index.d.ts +35 -0
  135. package/lib/MessageInput/index.js +58 -0
  136. package/lib/SearchBar/index.d.ts +5 -0
  137. package/lib/SearchBar/index.js +42 -0
  138. package/lib/SideNav/index.d.ts +6 -6
  139. package/lib/SideNav/index.js +7 -31
  140. package/lib/SideNav/style.d.ts +1 -0
  141. package/lib/SideNav/style.js +46 -0
  142. package/lib/Snippet/index.d.ts +29 -0
  143. package/lib/Snippet/index.js +47 -0
  144. package/lib/Snippet/style.d.ts +1 -0
  145. package/lib/Snippet/style.js +71 -0
  146. package/lib/StroyBook/index.d.ts +3 -4
  147. package/lib/StroyBook/index.js +20 -13
  148. package/lib/StroyBook/style.d.ts +4 -1
  149. package/lib/StroyBook/style.js +49 -43
  150. package/lib/Swatches/index.d.ts +8 -0
  151. package/lib/Swatches/index.js +68 -0
  152. package/lib/TabsNav/index.d.ts +3 -3
  153. package/lib/TabsNav/index.js +5 -15
  154. package/lib/ThemeProvider/GlobalStyle.js +7 -5
  155. package/lib/ThemeProvider/index.d.ts +15 -0
  156. package/lib/ThemeSwitch/index.d.ts +5 -5
  157. package/lib/ThemeSwitch/index.js +15 -32
  158. package/lib/Tooltip/index.d.ts +5 -0
  159. package/lib/Tooltip/index.js +34 -0
  160. package/lib/Tooltip/style.d.ts +3 -0
  161. package/lib/Tooltip/style.js +51 -0
  162. package/lib/hooks/useCopied.d.ts +4 -0
  163. package/lib/hooks/useCopied.js +44 -0
  164. package/lib/hooks/useHighlight.d.ts +36 -0
  165. package/lib/hooks/useHighlight.js +76 -0
  166. package/lib/index.d.ts +9 -0
  167. package/lib/index.js +29 -0
  168. package/lib/styles/theme/base.d.ts +2 -0
  169. package/lib/styles/theme/base.js +43 -0
  170. package/lib/styles/theme/dark.js +5 -12
  171. package/lib/styles/theme/light.js +10 -10
  172. package/lib/types/index.d.ts +14 -5
  173. package/package.json +12 -4
  174. package/es/ThemeProvider/token.d.ts +0 -3
  175. package/es/ThemeProvider/token.js +0 -45
  176. package/es/types/index.js +0 -1
  177. package/lib/ThemeProvider/token.d.ts +0 -3
  178. package/lib/ThemeProvider/token.js +0 -73
  179. package/lib/types/index.js +0 -17
@@ -1,5 +1,5 @@
1
+ /// <reference types="react" />
1
2
  import { TabsProps } from 'antd';
2
- import React from 'react';
3
3
  export interface TabsNavProps {
4
4
  /**
5
5
  * @description Additional className to apply to the component
@@ -18,5 +18,5 @@ export interface TabsNavProps {
18
18
  */
19
19
  activeKey?: TabsProps['activeKey'];
20
20
  }
21
- declare const _default: React.NamedExoticComponent<TabsNavProps>;
22
- export default _default;
21
+ declare const TabsNav: import("react").NamedExoticComponent<TabsNavProps>;
22
+ export default TabsNav;
@@ -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/TabsNav/index.tsx
@@ -33,12 +23,12 @@ __export(TabsNav_exports, {
33
23
  });
34
24
  module.exports = __toCommonJS(TabsNav_exports);
35
25
  var import_antd = require("antd");
36
- var import_react = __toESM(require("react"));
26
+ var import_react = require("react");
37
27
  var import_style = require("./style");
38
- var TabsNav = ({ className, ...props }) => {
28
+ var TabsNav = (0, import_react.memo)(({ className, ...props }) => {
39
29
  const { styles, cx } = (0, import_style.useStyles)();
40
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Tabs, { className: cx(styles.tabs, className), ...props });
41
- };
42
- var TabsNav_default = import_react.default.memo(TabsNav);
30
+ return /* @__PURE__ */ React.createElement(import_antd.Tabs, { className: cx(styles.tabs, className), ...props });
31
+ });
32
+ var TabsNav_default = TabsNav;
43
33
  // Annotate the CommonJS export names for ESM import in node:
44
34
  0 && (module.exports = {});
@@ -26,7 +26,7 @@ var import_antd_style = require("antd-style");
26
26
  var GlobalStyle = import_antd_style.createGlobalStyle`
27
27
 
28
28
  body {
29
- font-family: 'Segoe UI', SegoeUI, AliPuHui, ${({ theme }) => theme.fontFamily};
29
+ font-family: ${({ theme }) => theme.fontFamily};
30
30
  font-size: ${({ theme }) => theme.fontSize}px;
31
31
  line-height: 1;
32
32
  color: ${({ theme }) => theme.colorTextBase};
@@ -34,15 +34,17 @@ var GlobalStyle = import_antd_style.createGlobalStyle`
34
34
  margin: 0;
35
35
  padding: 0;
36
36
  background-color: ${(p) => p.theme.colorBgLayout};
37
+
38
+ -webkit-font-smoothing: antialiased;
39
+ -moz-osx-font-smoothing: grayscale;
37
40
  }
38
41
 
39
42
  * {
40
43
  box-sizing: border-box;
41
44
  }
42
-
45
+
43
46
  #root {
44
47
  min-height: 100vh;
45
- width: 100vw;
46
48
  }
47
49
 
48
50
  @font-face {
@@ -64,8 +66,8 @@ var GlobalStyle = import_antd_style.createGlobalStyle`
64
66
 
65
67
  /* 定义滚动槽的样式 */
66
68
  ::-webkit-scrollbar {
67
- width: 6px;
68
- height: 6px;
69
+ width: 0;
70
+ height: 4px;
69
71
  margin-right: 4px;
70
72
  background-color: transparent; // 定义滚动槽的背景色
71
73
 
@@ -1,10 +1,25 @@
1
1
  import { extractStaticStyle, type ThemeMode } from 'antd-style';
2
2
  import React from 'react';
3
3
  export interface ThemeProviderProps {
4
+ /**
5
+ * @description Custom tokens to be used in the theme
6
+ */
4
7
  token?: any;
8
+ /**
9
+ * @description The children of the ThemeProvider component
10
+ */
5
11
  children: React.ReactNode;
12
+ /**
13
+ * @description The mode of the theme (light or dark)
14
+ */
6
15
  themeMode?: ThemeMode;
16
+ /**
17
+ * @description Whether to inline the styles on server-side rendering or not
18
+ */
7
19
  ssrInline?: boolean;
20
+ /**
21
+ * @description Cache for the extracted static styles
22
+ */
8
23
  cache?: typeof extractStaticStyle.cache;
9
24
  }
10
25
  declare const ThemeProvider: React.FC<ThemeProviderProps>;
@@ -1,7 +1,7 @@
1
- import { type ActionIconSize } from "../index";
2
- import { DivProps } from "../types";
1
+ /// <reference types="react" />
2
+ import { type ActionIconSize } from "..";
3
3
  import { ThemeMode } from 'antd-style';
4
- import React from 'react';
4
+ import { DivProps } from "../types";
5
5
  export interface ThemeSwitchProps extends DivProps {
6
6
  /**
7
7
  * @description Size of the action icon
@@ -23,5 +23,5 @@ export interface ThemeSwitchProps extends DivProps {
23
23
  */
24
24
  onThemeSwitch: (themeMode: ThemeMode) => void;
25
25
  }
26
- declare const _default: React.NamedExoticComponent<ThemeSwitchProps>;
27
- export default _default;
26
+ declare const ThemeSwitch: import("react").NamedExoticComponent<ThemeSwitchProps>;
27
+ export default ThemeSwitch;
@@ -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/ThemeSwitch/index.tsx
@@ -32,36 +22,29 @@ __export(ThemeSwitch_exports, {
32
22
  default: () => ThemeSwitch_default
33
23
  });
34
24
  module.exports = __toCommonJS(ThemeSwitch_exports);
35
- var import__ = require("../index");
25
+ var import_ui = require("..");
36
26
  var import_antd = require("antd");
37
27
  var import_lucide_react = require("lucide-react");
38
- var import_react = __toESM(require("react"));
28
+ var import_react = require("react");
39
29
  var icons = {
40
30
  auto: import_lucide_react.Monitor,
41
31
  light: import_lucide_react.Sun,
42
32
  dark: import_lucide_react.Moon
43
33
  };
44
34
  var items = [
45
- { label: "System", icon: /* @__PURE__ */ import_react.default.createElement(import__.Icon, { size: "small", icon: icons.auto }), key: "auto" },
46
- { label: "Light", icon: /* @__PURE__ */ import_react.default.createElement(import__.Icon, { size: "small", icon: icons.light }), key: "light" },
47
- { label: "Dark", icon: /* @__PURE__ */ import_react.default.createElement(import__.Icon, { size: "small", icon: icons.dark }), key: "dark" }
35
+ { label: "System", icon: /* @__PURE__ */ React.createElement(import_ui.Icon, { size: "small", icon: icons.auto }), key: "auto" },
36
+ { label: "Light", icon: /* @__PURE__ */ React.createElement(import_ui.Icon, { size: "small", icon: icons.light }), key: "light" },
37
+ { label: "Dark", icon: /* @__PURE__ */ React.createElement(import_ui.Icon, { size: "small", icon: icons.dark }), key: "dark" }
48
38
  ];
49
- var ThemeSwitch = ({
50
- size = {
51
- blockSize: 34,
52
- fontSize: 20,
53
- strokeWidth: 1.5
54
- },
55
- themeMode,
56
- onThemeSwitch,
57
- ...props
58
- }) => {
59
- const menuProps = {
60
- items,
61
- onClick: (e) => onThemeSwitch(e.key)
62
- };
63
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { menu: menuProps, trigger: ["click"], ...props }, /* @__PURE__ */ import_react.default.createElement(import__.ActionIcon, { size, icon: icons[themeMode] }));
64
- };
65
- var ThemeSwitch_default = import_react.default.memo(ThemeSwitch);
39
+ var ThemeSwitch = (0, import_react.memo)(
40
+ ({ size = "site", themeMode, onThemeSwitch, ...props }) => {
41
+ const menuProps = {
42
+ items,
43
+ onClick: (e) => onThemeSwitch(e.key)
44
+ };
45
+ return /* @__PURE__ */ React.createElement(import_antd.Dropdown, { menu: menuProps, trigger: ["click"], ...props }, /* @__PURE__ */ React.createElement(import_ui.ActionIcon, { size, icon: icons[themeMode] }));
46
+ }
47
+ );
48
+ var ThemeSwitch_default = ThemeSwitch;
66
49
  // Annotate the CommonJS export names for ESM import in node:
67
50
  0 && (module.exports = {});
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { TooltipProps as AntdTooltipProps } from 'antd';
3
+ export declare type TooltipProps = AntdTooltipProps;
4
+ declare const Tooltip: import("react").NamedExoticComponent<AntdTooltipProps>;
5
+ export default Tooltip;
@@ -0,0 +1,34 @@
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/Tooltip/index.tsx
20
+ var Tooltip_exports = {};
21
+ __export(Tooltip_exports, {
22
+ default: () => Tooltip_default
23
+ });
24
+ module.exports = __toCommonJS(Tooltip_exports);
25
+ var import_antd = require("antd");
26
+ var import_react = require("react");
27
+ var import_style = require("./style");
28
+ var Tooltip = (0, import_react.memo)(({ className, ...props }) => {
29
+ const { styles, cx } = (0, import_style.useStyles)();
30
+ return /* @__PURE__ */ React.createElement(import_antd.Tooltip, { overlayClassName: cx(styles.tooltip, className), ...props });
31
+ });
32
+ var Tooltip_default = Tooltip;
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {});
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ tooltip: import("antd-style").SerializedStyles;
3
+ }>;
@@ -0,0 +1,51 @@
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/Tooltip/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 }) => {
27
+ return {
28
+ tooltip: css`
29
+ .ant-tooltip-inner {
30
+ background-color: ${token.colorText};
31
+ color: ${token.colorBgLayout};
32
+ padding: 4px 8px;
33
+ border-radius: ${token.borderRadiusSM}px;
34
+ min-height: unset;
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ }
39
+ .ant-tooltip-arrow {
40
+ &:before,
41
+ &:after {
42
+ background: ${token.colorText};
43
+ }
44
+ }
45
+ `
46
+ };
47
+ });
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ useStyles
51
+ });
@@ -0,0 +1,4 @@
1
+ export declare const useCopied: () => {
2
+ copied: boolean;
3
+ setCopied: () => void;
4
+ };
@@ -0,0 +1,44 @@
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/hooks/useCopied.ts
20
+ var useCopied_exports = {};
21
+ __export(useCopied_exports, {
22
+ useCopied: () => useCopied
23
+ });
24
+ module.exports = __toCommonJS(useCopied_exports);
25
+ var import_react = require("react");
26
+ var useCopied = () => {
27
+ const [copied, setCopy] = (0, import_react.useState)(false);
28
+ (0, import_react.useEffect)(() => {
29
+ if (!copied)
30
+ return;
31
+ const timer = setTimeout(() => {
32
+ setCopy(false);
33
+ }, 2e3);
34
+ return () => {
35
+ clearTimeout(timer);
36
+ };
37
+ }, [copied]);
38
+ const setCopied = (0, import_react.useCallback)(() => setCopy(true), []);
39
+ return (0, import_react.useMemo)(() => ({ copied, setCopied }), [copied]);
40
+ };
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ useCopied
44
+ });
@@ -0,0 +1,36 @@
1
+ import { Highlighter, Theme } from 'shiki-es';
2
+ export interface ShikiSyntaxTheme {
3
+ /**
4
+ * @title 暗色模式主题
5
+ */
6
+ dark: Theme;
7
+ /**
8
+ * @title 亮色模式主题
9
+ */
10
+ light: Theme;
11
+ }
12
+ export declare const languageMap: readonly ["javascript", "js", "jsx", "json", "markdown", "md", "less", "css", "typescript", "ts", "tsx", "diff", "bash"];
13
+ /**
14
+ * @title 代码高亮的存储对象
15
+ */
16
+ interface Store {
17
+ /**
18
+ * @title 高亮器对象
19
+ */
20
+ highlighter?: Highlighter;
21
+ /**
22
+ * @title 初始化高亮器对象
23
+ * @returns 初始化 Promise 对象
24
+ */
25
+ initHighlighter: () => Promise<void>;
26
+ /**
27
+ * @title 将代码转化为 HTML 字符串
28
+ * @param text - 代码文本
29
+ * @param language - 代码语言
30
+ * @param isDarkMode - 是否为暗黑模式
31
+ * @returns HTML 字符串
32
+ */
33
+ codeToHtml: (text: string, language: string, isDarkMode: boolean) => string;
34
+ }
35
+ export declare const useHighlight: import("zustand").UseBoundStore<import("zustand").StoreApi<Store>>;
36
+ export {};
@@ -0,0 +1,76 @@
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/hooks/useHighlight.ts
20
+ var useHighlight_exports = {};
21
+ __export(useHighlight_exports, {
22
+ languageMap: () => languageMap,
23
+ useHighlight: () => useHighlight
24
+ });
25
+ module.exports = __toCommonJS(useHighlight_exports);
26
+ var import_shiki_es = require("shiki-es");
27
+ var import_zustand = require("zustand");
28
+ var THEME = {
29
+ dark: "material-darker",
30
+ light: "material-lighter"
31
+ };
32
+ var languageMap = [
33
+ "javascript",
34
+ "js",
35
+ "jsx",
36
+ "json",
37
+ "markdown",
38
+ "md",
39
+ "less",
40
+ "css",
41
+ "typescript",
42
+ "ts",
43
+ "tsx",
44
+ "diff",
45
+ "bash"
46
+ ];
47
+ var useHighlight = (0, import_zustand.create)((set, get) => ({
48
+ highlighter: void 0,
49
+ initHighlighter: async () => {
50
+ if (!get().highlighter) {
51
+ const highlighter = await (0, import_shiki_es.getHighlighter)({
52
+ langs: languageMap,
53
+ themes: Object.values(THEME)
54
+ });
55
+ set({ highlighter });
56
+ }
57
+ },
58
+ codeToHtml: (text, language, isDarkMode) => {
59
+ const { highlighter } = get();
60
+ if (!highlighter)
61
+ return "";
62
+ try {
63
+ return highlighter == null ? void 0 : highlighter.codeToHtml(text, {
64
+ lang: language,
65
+ theme: isDarkMode ? THEME.dark : THEME.light
66
+ });
67
+ } catch (e) {
68
+ return text;
69
+ }
70
+ }
71
+ }));
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {
74
+ languageMap,
75
+ useHighlight
76
+ });
package/lib/index.d.ts CHANGED
@@ -1,9 +1,18 @@
1
1
  export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
2
+ export { default as CopyButton, type CopyButtonProps } from './CopyButton';
2
3
  export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
4
+ export { default as EditableText, type EditableTextProps } from './EditableText';
5
+ export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
3
6
  export { default as Icon, type IconProps, type IconSize } from './Icon';
4
7
  export { default as Logo, type LogoProps } from './Logo';
8
+ export { default as Markdown, type MarkdownProps } from './Markdown';
9
+ export { default as MessageInput, type MessageInputProps } from './MessageInput';
10
+ export { default as SearchBar, type SearchBarProps } from './SearchBar';
5
11
  export { default as SideNav, type SideNavProps } from './SideNav';
12
+ export { default as Snippet, type SnippetProps } from './Snippet';
6
13
  export { default as StroyBook, useControls, useCreateStore, type StroyBookProps, } from './StroyBook';
14
+ export { default as Swatches, type SwatchesProps } from './Swatches';
7
15
  export { default as TabsNav, type TabsNavProps } from './TabsNav';
8
16
  export { default as ThemeProvider } from './ThemeProvider';
9
17
  export { default as ThemeSwitch, type ThemeSwitchProps } from './ThemeSwitch';
18
+ export { default as Tooltip, type TooltipProps } from './Tooltip';
package/lib/index.js CHANGED
@@ -30,38 +30,67 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var src_exports = {};
31
31
  __export(src_exports, {
32
32
  ActionIcon: () => import_ActionIcon.default,
33
+ CopyButton: () => import_CopyButton.default,
33
34
  DraggablePanel: () => import_DraggablePanel.default,
35
+ EditableText: () => import_EditableText.default,
36
+ Highlighter: () => import_Highlighter.default,
34
37
  Icon: () => import_Icon.default,
35
38
  Logo: () => import_Logo.default,
39
+ Markdown: () => import_Markdown.default,
40
+ MessageInput: () => import_MessageInput.default,
41
+ SearchBar: () => import_SearchBar.default,
36
42
  SideNav: () => import_SideNav.default,
43
+ Snippet: () => import_Snippet.default,
37
44
  StroyBook: () => import_StroyBook.default,
45
+ Swatches: () => import_Swatches.default,
46
+ SyntaxHighlighter: () => import_Highlighter.SyntaxHighlighter,
38
47
  TabsNav: () => import_TabsNav.default,
39
48
  ThemeProvider: () => import_ThemeProvider.default,
40
49
  ThemeSwitch: () => import_ThemeSwitch.default,
50
+ Tooltip: () => import_Tooltip.default,
41
51
  useControls: () => import_StroyBook.useControls,
42
52
  useCreateStore: () => import_StroyBook.useCreateStore
43
53
  });
44
54
  module.exports = __toCommonJS(src_exports);
45
55
  var import_ActionIcon = __toESM(require("./ActionIcon"));
56
+ var import_CopyButton = __toESM(require("./CopyButton"));
46
57
  var import_DraggablePanel = __toESM(require("./DraggablePanel"));
58
+ var import_EditableText = __toESM(require("./EditableText"));
59
+ var import_Highlighter = __toESM(require("./Highlighter"));
47
60
  var import_Icon = __toESM(require("./Icon"));
48
61
  var import_Logo = __toESM(require("./Logo"));
62
+ var import_Markdown = __toESM(require("./Markdown"));
63
+ var import_MessageInput = __toESM(require("./MessageInput"));
64
+ var import_SearchBar = __toESM(require("./SearchBar"));
49
65
  var import_SideNav = __toESM(require("./SideNav"));
66
+ var import_Snippet = __toESM(require("./Snippet"));
50
67
  var import_StroyBook = __toESM(require("./StroyBook"));
68
+ var import_Swatches = __toESM(require("./Swatches"));
51
69
  var import_TabsNav = __toESM(require("./TabsNav"));
52
70
  var import_ThemeProvider = __toESM(require("./ThemeProvider"));
53
71
  var import_ThemeSwitch = __toESM(require("./ThemeSwitch"));
72
+ var import_Tooltip = __toESM(require("./Tooltip"));
54
73
  // Annotate the CommonJS export names for ESM import in node:
55
74
  0 && (module.exports = {
56
75
  ActionIcon,
76
+ CopyButton,
57
77
  DraggablePanel,
78
+ EditableText,
79
+ Highlighter,
58
80
  Icon,
59
81
  Logo,
82
+ Markdown,
83
+ MessageInput,
84
+ SearchBar,
60
85
  SideNav,
86
+ Snippet,
61
87
  StroyBook,
88
+ Swatches,
89
+ SyntaxHighlighter,
62
90
  TabsNav,
63
91
  ThemeProvider,
64
92
  ThemeSwitch,
93
+ Tooltip,
65
94
  useControls,
66
95
  useCreateStore
67
96
  });
@@ -0,0 +1,2 @@
1
+ import { ThemeConfig } from 'antd';
2
+ export declare const baseTheme: ThemeConfig;
@@ -0,0 +1,43 @@
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/styles/theme/base.ts
20
+ var base_exports = {};
21
+ __export(base_exports, {
22
+ baseTheme: () => baseTheme
23
+ });
24
+ module.exports = __toCommonJS(base_exports);
25
+ var baseTheme = {
26
+ token: {
27
+ colorInfo: "#0070f3",
28
+ colorSuccess: "#50e3c2",
29
+ colorWarning: "#f5a623",
30
+ colorError: "#ee0000",
31
+ borderRadius: 5,
32
+ borderRadiusXS: 3,
33
+ borderRadiusSM: 3,
34
+ borderRadiusLG: 8,
35
+ controlHeight: 36,
36
+ fontFamily: `'Segoe UI', SegoeUI, AliPuHui, -apple-system ,BlinkMacSystemFont,Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'`,
37
+ fontFamilyCode: `'Hack Nerd Font Mono', 'Hack', 'Fira Code', 'Fira Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace`
38
+ }
39
+ };
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ baseTheme
43
+ });
@@ -25,6 +25,7 @@ __export(dark_exports, {
25
25
  module.exports = __toCommonJS(dark_exports);
26
26
  var import_antd = require("antd");
27
27
  var import_algorithms = require("../algorithms");
28
+ var import_base = require("./base");
28
29
  var cyanColors = [
29
30
  "rgba(0, 225, 242, 0.12)",
30
31
  "rgba(0, 232, 245, 0.22)",
@@ -94,6 +95,7 @@ var darkAlgorithm = (seedToken, mapToken) => ({
94
95
  });
95
96
  var darkTheme = {
96
97
  token: {
98
+ ...import_base.baseTheme.token,
97
99
  colorTextLightSolid: "#000000",
98
100
  colorBgLayout: "#000000",
99
101
  colorBgContainer: "#111111",
@@ -106,21 +108,12 @@ var darkTheme = {
106
108
  colorTextTertiary: "#888888",
107
109
  colorTextQuaternary: "#666666",
108
110
  colorPrimary: "#ffffff",
109
- colorInfo: "#0070f3",
110
- colorSuccess: "#50e3c2",
111
- colorWarning: "#f5a623",
112
- colorError: "#ee0000",
113
111
  colorFillQuaternary: "rgba(0,0,0,0)",
114
- borderRadius: 5,
115
- borderRadiusXS: 3,
116
- borderRadiusSM: 3,
117
- borderRadiusLG: 8,
118
- controlHeight: 36,
119
112
  boxShadow: "0 12px 20px 6px rgb(0 0 0 / 0.08)",
120
113
  boxShadowSecondary: "0 2px 8px 2px rgb(0 0 0 / 0.07), 0 2px 4px -1px rgb(0 0 0 / 0.04)",
121
- colorLinkHover: darkColorPalettes.primary[7],
122
- colorLink: darkColorPalettes.primary[6],
123
- colorLinkActive: darkColorPalettes.primary[5]
114
+ colorLinkHover: "#3291ff",
115
+ colorLink: "#0070f3",
116
+ colorLinkActive: "#0761d1"
124
117
  },
125
118
  algorithm: darkAlgorithm
126
119
  };