@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
@@ -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;
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
  import { ActionIcon, Icon } from "./..";
7
7
  import { Dropdown } from 'antd';
8
8
  import { Monitor, Moon, Sun } from 'lucide-react';
9
- import React from 'react';
9
+ import { memo } from 'react';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  var icons = {
12
12
  auto: Monitor,
@@ -35,13 +35,9 @@ var items = [{
35
35
  }),
36
36
  key: 'dark'
37
37
  }];
38
- var ThemeSwitch = function ThemeSwitch(_ref) {
38
+ var ThemeSwitch = /*#__PURE__*/memo(function (_ref) {
39
39
  var _ref$size = _ref.size,
40
- size = _ref$size === void 0 ? {
41
- blockSize: 34,
42
- fontSize: 20,
43
- strokeWidth: 1.5
44
- } : _ref$size,
40
+ size = _ref$size === void 0 ? 'site' : _ref$size,
45
41
  themeMode = _ref.themeMode,
46
42
  onThemeSwitch = _ref.onThemeSwitch,
47
43
  props = _objectWithoutProperties(_ref, _excluded);
@@ -60,5 +56,5 @@ var ThemeSwitch = function ThemeSwitch(_ref) {
60
56
  icon: icons[themeMode]
61
57
  })
62
58
  }));
63
- };
64
- export default /*#__PURE__*/React.memo(ThemeSwitch);
59
+ });
60
+ export default ThemeSwitch;
@@ -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,20 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className"];
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 { Tooltip as AntdTooltip } from 'antd';
7
+ import { memo } from 'react';
8
+ import { useStyles } from "./style";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ var Tooltip = /*#__PURE__*/memo(function (_ref) {
11
+ var className = _ref.className,
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
+ var _useStyles = useStyles(),
14
+ styles = _useStyles.styles,
15
+ cx = _useStyles.cx;
16
+ return /*#__PURE__*/_jsx(AntdTooltip, _objectSpread({
17
+ overlayClassName: cx(styles.tooltip, className)
18
+ }, props));
19
+ });
20
+ export default Tooltip;
@@ -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,10 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css,
6
+ token = _ref.token;
7
+ return {
8
+ tooltip: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tooltip-inner {\n background-color: ", ";\n color: ", ";\n padding: 4px 8px;\n border-radius: ", "px;\n min-height: unset;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .ant-tooltip-arrow {\n &:before,\n &:after {\n background: ", ";\n }\n }\n "])), token.colorText, token.colorBgLayout, token.borderRadiusSM, token.colorText)
9
+ };
10
+ });
@@ -0,0 +1,4 @@
1
+ export declare const useCopied: () => {
2
+ copied: boolean;
3
+ setCopied: () => void;
4
+ };
@@ -0,0 +1,26 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useCallback, useEffect, useMemo, useState } from 'react';
3
+ export var useCopied = function useCopied() {
4
+ var _useState = useState(false),
5
+ _useState2 = _slicedToArray(_useState, 2),
6
+ copied = _useState2[0],
7
+ setCopy = _useState2[1];
8
+ useEffect(function () {
9
+ if (!copied) return;
10
+ var timer = setTimeout(function () {
11
+ setCopy(false);
12
+ }, 2000);
13
+ return function () {
14
+ clearTimeout(timer);
15
+ };
16
+ }, [copied]);
17
+ var setCopied = useCallback(function () {
18
+ return setCopy(true);
19
+ }, []);
20
+ return useMemo(function () {
21
+ return {
22
+ copied: copied,
23
+ setCopied: setCopied
24
+ };
25
+ }, [copied]);
26
+ };
@@ -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,63 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { getHighlighter } from 'shiki-es';
4
+ import { create } from 'zustand';
5
+ var THEME = {
6
+ dark: 'material-darker',
7
+ light: 'material-lighter'
8
+ };
9
+ export var languageMap = ['javascript', 'js', 'jsx', 'json', 'markdown', 'md', 'less', 'css', 'typescript', 'ts', 'tsx', 'diff', 'bash'];
10
+
11
+ /**
12
+ * @title 代码高亮的存储对象
13
+ */
14
+
15
+ export var useHighlight = create(function (set, get) {
16
+ return {
17
+ highlighter: undefined,
18
+ initHighlighter: function () {
19
+ var _initHighlighter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
20
+ var highlighter;
21
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
22
+ while (1) switch (_context.prev = _context.next) {
23
+ case 0:
24
+ if (get().highlighter) {
25
+ _context.next = 5;
26
+ break;
27
+ }
28
+ _context.next = 3;
29
+ return getHighlighter({
30
+ langs: languageMap,
31
+ themes: Object.values(THEME)
32
+ });
33
+ case 3:
34
+ highlighter = _context.sent;
35
+ set({
36
+ highlighter: highlighter
37
+ });
38
+ case 5:
39
+ case "end":
40
+ return _context.stop();
41
+ }
42
+ }, _callee);
43
+ }));
44
+ function initHighlighter() {
45
+ return _initHighlighter.apply(this, arguments);
46
+ }
47
+ return initHighlighter;
48
+ }(),
49
+ codeToHtml: function codeToHtml(text, language, isDarkMode) {
50
+ var _get = get(),
51
+ highlighter = _get.highlighter;
52
+ if (!highlighter) return '';
53
+ try {
54
+ return highlighter === null || highlighter === void 0 ? void 0 : highlighter.codeToHtml(text, {
55
+ lang: language,
56
+ theme: isDarkMode ? THEME.dark : THEME.light
57
+ });
58
+ } catch (e) {
59
+ return text;
60
+ }
61
+ }
62
+ };
63
+ });
package/es/index.d.ts CHANGED
@@ -1,9 +1,21 @@
1
1
  export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
2
+ export { default as Avatar, type AvatarProps } from './Avatar';
3
+ export { default as ContextMenu, type ContextMenuProps } from './ContextMenu';
4
+ export { default as CopyButton, type CopyButtonProps } from './CopyButton';
2
5
  export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
6
+ export { default as EditableText, type EditableTextProps } from './EditableText';
7
+ export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
3
8
  export { default as Icon, type IconProps, type IconSize } from './Icon';
9
+ export { default as List } from './List';
4
10
  export { default as Logo, type LogoProps } from './Logo';
11
+ export { default as Markdown, type MarkdownProps } from './Markdown';
12
+ export { default as MessageInput, type MessageInputProps } from './MessageInput';
13
+ export { default as SearchBar, type SearchBarProps } from './SearchBar';
5
14
  export { default as SideNav, type SideNavProps } from './SideNav';
15
+ export { default as Snippet, type SnippetProps } from './Snippet';
6
16
  export { default as StroyBook, useControls, useCreateStore, type StroyBookProps, } from './StroyBook';
17
+ export { default as Swatches, type SwatchesProps } from './Swatches';
7
18
  export { default as TabsNav, type TabsNavProps } from './TabsNav';
8
19
  export { default as ThemeProvider } from './ThemeProvider';
9
20
  export { default as ThemeSwitch, type ThemeSwitchProps } from './ThemeSwitch';
21
+ export { default as Tooltip, type TooltipProps } from './Tooltip';
package/es/index.js CHANGED
@@ -1,9 +1,21 @@
1
1
  export { default as ActionIcon } from "./ActionIcon";
2
+ export { default as Avatar } from "./Avatar";
3
+ export { default as ContextMenu } from "./ContextMenu";
4
+ export { default as CopyButton } from "./CopyButton";
2
5
  export { default as DraggablePanel } from "./DraggablePanel";
6
+ export { default as EditableText } from "./EditableText";
7
+ export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
3
8
  export { default as Icon } from "./Icon";
9
+ export { default as List } from "./List";
4
10
  export { default as Logo } from "./Logo";
11
+ export { default as Markdown } from "./Markdown";
12
+ export { default as MessageInput } from "./MessageInput";
13
+ export { default as SearchBar } from "./SearchBar";
5
14
  export { default as SideNav } from "./SideNav";
15
+ export { default as Snippet } from "./Snippet";
6
16
  export { default as StroyBook, useControls, useCreateStore } from "./StroyBook";
17
+ export { default as Swatches } from "./Swatches";
7
18
  export { default as TabsNav } from "./TabsNav";
8
19
  export { default as ThemeProvider } from "./ThemeProvider";
9
- export { default as ThemeSwitch } from "./ThemeSwitch";
20
+ export { default as ThemeSwitch } from "./ThemeSwitch";
21
+ export { default as Tooltip } from "./Tooltip";
@@ -0,0 +1,2 @@
1
+ import { ThemeConfig } from 'antd';
2
+ export declare const baseTheme: ThemeConfig;
@@ -0,0 +1,15 @@
1
+ export var baseTheme = {
2
+ token: {
3
+ colorInfo: '#0070f3',
4
+ colorSuccess: '#50e3c2',
5
+ colorWarning: '#f5a623',
6
+ colorError: '#ee0000',
7
+ borderRadius: 5,
8
+ borderRadiusXS: 3,
9
+ borderRadiusSM: 3,
10
+ borderRadiusLG: 8,
11
+ controlHeight: 36,
12
+ 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'",
13
+ fontFamilyCode: "'Hack Nerd Font Mono', 'Hack', 'Fira Code', 'Fira Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
14
+ }
15
+ };
@@ -3,6 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
3
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
4
  import { theme } from 'antd';
5
5
  import { genMapTokenAlgorithm } from "../algorithms";
6
+ import { baseTheme } from "./base";
6
7
  var cyanColors = ['rgba(0, 225, 242, 0.12)', 'rgba(0, 232, 245, 0.22)', 'rgba(0, 237, 250, 0.32)', 'rgba(0, 243, 255, 0.42)', 'rgba(0, 247, 255, 0.53)', 'rgba(0, 246, 254, 0.65)', 'rgba(0, 247, 253, 0.77)', 'rgba(0, 245, 255, 0.75)', 'rgba(0, 244, 255, 0.73)', 'rgba(0, 239, 253, 0.72)', 'rgba(0, 237, 253, 0.7)'];
7
8
  var darkModeRelationship = function darkModeRelationship(type) {
8
9
  var _ref;
@@ -49,7 +50,7 @@ var darkAlgorithm = function darkAlgorithm(seedToken, mapToken) {
49
50
  });
50
51
  };
51
52
  export var darkTheme = {
52
- token: {
53
+ token: _objectSpread(_objectSpread({}, baseTheme.token), {}, {
53
54
  colorTextLightSolid: '#000000',
54
55
  colorBgLayout: '#000000',
55
56
  colorBgContainer: '#111111',
@@ -62,21 +63,12 @@ export var darkTheme = {
62
63
  colorTextTertiary: '#888888',
63
64
  colorTextQuaternary: '#666666',
64
65
  colorPrimary: '#ffffff',
65
- colorInfo: '#0070f3',
66
- colorSuccess: '#50e3c2',
67
- colorWarning: '#f5a623',
68
- colorError: '#ee0000',
69
66
  colorFillQuaternary: 'rgba(0,0,0,0)',
70
- borderRadius: 5,
71
- borderRadiusXS: 3,
72
- borderRadiusSM: 3,
73
- borderRadiusLG: 8,
74
- controlHeight: 36,
75
67
  boxShadow: '0 12px 20px 6px rgb(0 0 0 / 0.08)',
76
68
  boxShadowSecondary: '0 2px 8px 2px rgb(0 0 0 / 0.07), 0 2px 4px -1px rgb(0 0 0 / 0.04)',
77
- colorLinkHover: darkColorPalettes.primary[7],
78
- colorLink: darkColorPalettes.primary[6],
79
- colorLinkActive: darkColorPalettes.primary[5]
80
- },
69
+ colorLinkHover: '#3291ff',
70
+ colorLink: '#0070f3',
71
+ colorLinkActive: '#0761d1'
72
+ }),
81
73
  algorithm: darkAlgorithm
82
74
  };
@@ -2,13 +2,14 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
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
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
4
  import { genMapTokenAlgorithm } from "../algorithms";
5
+ import { baseTheme } from "./base";
5
6
  var lightMode = genMapTokenAlgorithm('light');
6
7
  export var lightColorPalettes = lightMode.palettes;
7
8
  export var lightTheme = {
8
- token: {
9
+ token: _objectSpread(_objectSpread({}, baseTheme.token), {}, {
9
10
  colorTextLightSolid: '#ffffff',
10
- colorBgLayout: '#ffffff',
11
- colorBgContainer: '#fafafa',
11
+ colorBgLayout: '#fafafa',
12
+ colorBgContainer: '#ffffff',
12
13
  colorBgElevated: '#f2f2f2',
13
14
  colorBgSpotlight: '#999999',
14
15
  colorBorder: '#eaeaea',
@@ -18,18 +19,16 @@ export var lightTheme = {
18
19
  colorTextTertiary: '#666666',
19
20
  colorTextQuaternary: '#888888',
20
21
  colorPrimary: '#000000',
22
+ colorFill: 'rgba(0,0,0,0.1)',
23
+ colorFillSecondary: 'rgba(0,0,0,0.075)',
24
+ colorFillTertiary: 'rgba(0,0,0,0.05)',
21
25
  colorFillQuaternary: 'rgba(0,0,0,0)',
22
- borderRadius: 5,
23
- borderRadiusXS: 3,
24
- borderRadiusSM: 3,
25
- borderRadiusLG: 8,
26
- controlHeight: 36,
27
26
  boxShadow: '0 12px 20px 6px rgb(104 112 118 / 0.08)',
28
27
  boxShadowSecondary: '0 2px 8px 2px rgb(104 112 118 / 0.07), 0 2px 4px -1px rgb(104 112 118 / 0.04)',
29
- colorLinkHover: lightColorPalettes.primary[5],
30
- colorLink: lightColorPalettes.primary[6],
31
- colorLinkActive: lightColorPalettes.primary[7]
32
- },
28
+ colorLinkHover: '#3291ff',
29
+ colorLink: '#0070f3',
30
+ colorLinkActive: '#0761d1'
31
+ }),
33
32
  algorithm: function algorithm(seedToken, mapToken) {
34
33
  return _objectSpread(_objectSpread({}, mapToken), lightMode.tokens);
35
34
  }
@@ -1,9 +1,18 @@
1
1
  import { Theme as AntdStyleTheme } from 'antd-style';
2
2
  import React from 'react';
3
+
3
4
  declare module 'styled-components' {
4
- interface DefaultTheme extends AntdStyleTheme {
5
- }
5
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
6
+ export interface DefaultTheme extends AntdStyleTheme {}
7
+ }
8
+
9
+ export type DivProps = React.DetailedHTMLProps<
10
+ React.HTMLAttributes<HTMLDivElement>,
11
+ HTMLDivElement
12
+ >;
13
+
14
+ declare global {
15
+ type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
16
+
17
+ type ImgProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLImageElement>, HTMLImageElement>;
6
18
  }
7
- export declare type DivProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
8
- export declare type SvgProps = React.DetailedHTMLProps<React.HTMLAttributes<SVGSVGElement>, SVGSVGElement>;
9
- export declare type ImgProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLImageElement>, HTMLImageElement>;
@@ -1,7 +1,7 @@
1
- import { DivProps } from "../types";
1
+ /// <reference types="react" />
2
2
  import { LucideIcon } from 'lucide-react';
3
- import React from 'react';
4
- export declare type ActionIconSize = 'large' | 'normal' | 'small' | {
3
+ import { DivProps } from "../types";
4
+ export declare type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
5
5
  blockSize?: number;
6
6
  fontSize?: number;
7
7
  strokeWidth?: number;
@@ -23,6 +23,11 @@ export interface ActionIconProps extends DivProps {
23
23
  * @type LucideIcon
24
24
  */
25
25
  icon: LucideIcon;
26
+ /**
27
+ * @description Glass blur style
28
+ * @default 'false'
29
+ */
30
+ glass?: boolean;
26
31
  }
27
- declare const _default: React.NamedExoticComponent<ActionIconProps>;
28
- export default _default;
32
+ declare const ActionIcon: import("react").NamedExoticComponent<ActionIconProps>;
33
+ export default ActionIcon;
@@ -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/ActionIcon/index.tsx
@@ -33,47 +23,46 @@ __export(ActionIcon_exports, {
33
23
  });
34
24
  module.exports = __toCommonJS(ActionIcon_exports);
35
25
  var import__ = require("../index");
36
- var import_react = __toESM(require("react"));
26
+ var import_react = require("react");
37
27
  var import_style = require("./style");
38
- var ActionIcon = ({
39
- className,
40
- active,
41
- icon,
42
- size = "normal",
43
- style,
44
- ...props
45
- }) => {
46
- const { styles, cx } = (0, import_style.useStyles)(active);
47
- let blockSize;
48
- let borderRadius;
49
- switch (size) {
50
- case "large":
51
- blockSize = 44;
52
- borderRadius = 8;
53
- break;
54
- case "normal":
55
- blockSize = 36;
56
- borderRadius = 5;
57
- break;
58
- case "small":
59
- blockSize = 28;
60
- borderRadius = 5;
61
- break;
62
- default:
63
- blockSize = (size == null ? void 0 : size.blockSize) || 36;
64
- borderRadius = (size == null ? void 0 : size.borderRadius) || 5;
65
- break;
28
+ var ActionIcon = (0, import_react.memo)(
29
+ ({ className, active, icon, size = "normal", style, glass, ...props }) => {
30
+ const { styles, cx } = (0, import_style.useStyles)({ active: Boolean(active), glass: Boolean(glass) });
31
+ let blockSize;
32
+ let borderRadius;
33
+ switch (size) {
34
+ case "large":
35
+ blockSize = 44;
36
+ borderRadius = 8;
37
+ break;
38
+ case "normal":
39
+ blockSize = 36;
40
+ borderRadius = 5;
41
+ break;
42
+ case "small":
43
+ blockSize = 28;
44
+ borderRadius = 5;
45
+ break;
46
+ case "site":
47
+ blockSize = 34;
48
+ borderRadius = 5;
49
+ break;
50
+ default:
51
+ blockSize = (size == null ? void 0 : size.blockSize) || 36;
52
+ borderRadius = (size == null ? void 0 : size.borderRadius) || 5;
53
+ break;
54
+ }
55
+ return /* @__PURE__ */ React.createElement(
56
+ "div",
57
+ {
58
+ className: cx(styles.block, className),
59
+ style: { width: blockSize, height: blockSize, borderRadius, ...style },
60
+ ...props
61
+ },
62
+ /* @__PURE__ */ React.createElement(import__.Icon, { size: size === "site" ? "small" : size, icon })
63
+ );
66
64
  }
67
- return /* @__PURE__ */ import_react.default.createElement(
68
- "div",
69
- {
70
- className: cx(styles.block, className),
71
- style: { width: blockSize, height: blockSize, borderRadius, ...style },
72
- ...props
73
- },
74
- /* @__PURE__ */ import_react.default.createElement(import__.Icon, { size, icon })
75
- );
76
- };
77
- var ActionIcon_default = import_react.default.memo(ActionIcon);
65
+ );
66
+ var ActionIcon_default = ActionIcon;
78
67
  // Annotate the CommonJS export names for ESM import in node:
79
68
  0 && (module.exports = {});
@@ -1,3 +1,6 @@
1
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
1
+ export declare const useStyles: (props?: {
2
+ active: boolean;
3
+ glass: boolean;
4
+ } | undefined) => import("antd-style").ReturnStyles<{
2
5
  block: import("antd-style").SerializedStyles;
3
6
  }>;
@@ -23,34 +23,41 @@ __export(style_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(style_exports);
25
25
  var import_antd_style = require("antd-style");
26
- var useStyles = (0, import_antd_style.createStyles)(({ css, token }, active) => {
27
- return {
28
- block: css`
29
- cursor: pointer;
26
+ var useStyles = (0, import_antd_style.createStyles)(
27
+ ({ css, token }, { active, glass }) => {
28
+ return {
29
+ block: css`
30
+ cursor: pointer;
30
31
 
31
- display: flex;
32
- flex: none;
33
- align-items: center;
34
- justify-content: center;
32
+ display: flex;
33
+ flex: none;
34
+ align-items: center;
35
+ justify-content: center;
35
36
 
36
- color: ${active ? token.colorText : token.colorTextQuaternary};
37
+ color: ${active ? token.colorText : token.colorTextQuaternary};
37
38
 
38
- background: ${active ? token.colorFill : "transparent"};
39
+ background: ${active ? token.colorFillTertiary : "transparent"};
39
40
 
40
- transition: color 600ms ${token.motionEaseOut}, background-color 100ms ${token.motionEaseOut};
41
+ transition: color 600ms ${token.motionEaseOut},
42
+ background-color 100ms ${token.motionEaseOut};
41
43
 
42
- &:hover {
43
- color: ${token.colorText};
44
- background-color: ${token.colorFillTertiary};
45
- }
44
+ ${glass && css`
45
+ backdrop-filter: saturate(180%) blur(10px);
46
+ `}
46
47
 
47
- &:active {
48
- color: ${token.colorText};
49
- background-color: ${token.colorFill};
50
- }
51
- `
52
- };
53
- });
48
+ &:hover {
49
+ color: ${token.colorText};
50
+ background-color: ${active ? token.colorFillSecondary : token.colorFillTertiary};
51
+ }
52
+
53
+ &:active {
54
+ color: ${token.colorText};
55
+ background-color: ${token.colorFill};
56
+ }
57
+ `
58
+ };
59
+ }
60
+ );
54
61
  // Annotate the CommonJS export names for ESM import in node:
55
62
  0 && (module.exports = {
56
63
  useStyles