@yuntijs/ui 1.0.0-beta.10 → 1.0.0-beta.101

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 (257) hide show
  1. package/es/App/index.d.ts +7 -0
  2. package/es/App/index.js +19 -0
  3. package/es/ButtonGroup/index.d.ts +24 -0
  4. package/es/ButtonGroup/index.js +66 -0
  5. package/es/CardList/Item/index.d.ts +4 -0
  6. package/es/CardList/Item/index.js +43 -0
  7. package/es/CardList/Item/style.d.ts +0 -0
  8. package/es/CardList/Item/style.js +0 -0
  9. package/es/CardList/index.d.ts +2 -0
  10. package/es/CardList/index.js +39 -0
  11. package/es/ChatInputArea/desktop/ChatInputArea.d.ts +19 -0
  12. package/es/ChatInputArea/desktop/ChatInputArea.js +72 -0
  13. package/es/ChatInputArea/index.d.ts +6 -0
  14. package/es/ChatInputArea/index.js +6 -0
  15. package/es/ChatItem/components/Actions.d.ts +10 -0
  16. package/es/ChatItem/components/Actions.js +23 -0
  17. package/es/ChatItem/components/MessageContent.d.ts +21 -0
  18. package/es/ChatItem/components/MessageContent.js +59 -0
  19. package/es/ChatItem/index.d.ts +4 -0
  20. package/es/ChatItem/index.js +120 -0
  21. package/es/ChatItem/style.d.ts +25 -0
  22. package/es/ChatItem/style.js +39 -0
  23. package/es/ChatItem/type.d.ts +86 -0
  24. package/es/ChatItem/type.js +1 -0
  25. package/es/ChatMarkdown/MarkdownElements/AntThinking/Component.d.ts +7 -0
  26. package/es/ChatMarkdown/MarkdownElements/AntThinking/Component.js +65 -0
  27. package/es/ChatMarkdown/MarkdownElements/AntThinking/index.d.ts +8 -0
  28. package/es/ChatMarkdown/MarkdownElements/AntThinking/index.js +10 -0
  29. package/es/ChatMarkdown/MarkdownElements/AntThinking/rehypePlugin.d.ts +3 -0
  30. package/es/ChatMarkdown/MarkdownElements/AntThinking/rehypePlugin.js +32 -0
  31. package/es/ChatMarkdown/MarkdownElements/AntThinking/remarkPlugin.d.ts +1 -0
  32. package/es/ChatMarkdown/MarkdownElements/AntThinking/remarkPlugin.js +59 -0
  33. package/es/ChatMarkdown/MarkdownElements/index.d.ts +7 -0
  34. package/es/ChatMarkdown/MarkdownElements/index.js +2 -0
  35. package/es/ChatMarkdown/index.d.ts +10 -0
  36. package/es/ChatMarkdown/index.js +40 -0
  37. package/es/ChatMarkdown/utils.d.ts +1 -0
  38. package/es/ChatMarkdown/utils.js +10 -0
  39. package/es/CollapseGroup/index.d.ts +4 -0
  40. package/es/CollapseGroup/index.js +23 -0
  41. package/es/CollapseGroup/style.d.ts +3 -0
  42. package/es/CollapseGroup/style.js +11 -0
  43. package/es/ConfigProvider/index.d.ts +3 -0
  44. package/es/ConfigProvider/index.js +17 -11
  45. package/es/Descriptions/index.d.ts +14 -0
  46. package/es/Descriptions/index.js +31 -0
  47. package/es/Descriptions/style.d.ts +4 -0
  48. package/es/Descriptions/style.js +24 -0
  49. package/es/Divider/index.d.ts +38 -0
  50. package/es/Divider/index.js +66 -0
  51. package/es/Divider/style.d.ts +3 -0
  52. package/es/Divider/style.js +12 -0
  53. package/es/DragPanel/index.d.ts +10 -0
  54. package/es/DragPanel/index.js +97 -0
  55. package/es/DragPanel/style.d.ts +7 -0
  56. package/es/DragPanel/style.js +15 -0
  57. package/es/Drawer/index.d.ts +13 -0
  58. package/es/Drawer/index.js +20 -0
  59. package/es/Drawer/style.d.ts +4 -0
  60. package/es/Drawer/style.js +16 -0
  61. package/es/Dropdown/index.d.ts +14 -0
  62. package/es/Dropdown/index.js +59 -0
  63. package/es/Dropdown/style.d.ts +7 -0
  64. package/es/Dropdown/style.js +13 -0
  65. package/es/EditableMessage/index.d.ts +76 -0
  66. package/es/EditableMessage/index.js +100 -0
  67. package/es/Form/collapse-list/hooks.d.ts +12 -0
  68. package/es/Form/collapse-list/hooks.js +90 -0
  69. package/es/Form/collapse-list/index.d.ts +47 -0
  70. package/es/Form/collapse-list/index.js +257 -0
  71. package/es/Form/collapse-list/style.d.ts +5 -0
  72. package/es/Form/collapse-list/style.js +13 -0
  73. package/es/Form/collapse-list/utils.d.ts +10 -0
  74. package/es/Form/collapse-list/utils.js +33 -0
  75. package/es/Form/index.d.ts +8 -0
  76. package/es/Form/index.js +5 -0
  77. package/es/FormHelper/autoFocus.d.ts +10 -0
  78. package/es/FormHelper/autoFocus.js +38 -0
  79. package/es/FormHelper/index.d.ts +13 -0
  80. package/es/FormHelper/index.js +41 -0
  81. package/es/Highlighter/FullFeatured.d.ts +18 -0
  82. package/es/Highlighter/FullFeatured.js +102 -0
  83. package/es/Highlighter/SyntaxHighlighter/index.d.ts +7 -0
  84. package/es/Highlighter/SyntaxHighlighter/index.js +51 -0
  85. package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  86. package/es/Highlighter/SyntaxHighlighter/style.js +16 -0
  87. package/es/Highlighter/index.d.ts +50 -0
  88. package/es/Highlighter/index.js +77 -0
  89. package/es/Highlighter/style.d.ts +9 -0
  90. package/es/Highlighter/style.js +23 -0
  91. package/es/Highlighter/theme.d.ts +1 -0
  92. package/es/Highlighter/theme.js +1661 -0
  93. package/es/JsonViewer/index.d.ts +30 -0
  94. package/es/JsonViewer/index.js +125 -0
  95. package/es/JsonViewer/style.d.ts +7 -0
  96. package/es/JsonViewer/style.js +19 -0
  97. package/es/LogViewer/index.d.ts +10 -0
  98. package/es/LogViewer/index.js +141 -0
  99. package/es/LogViewer/style.d.ts +6 -0
  100. package/es/LogViewer/style.js +16 -0
  101. package/es/LogViewer/types.d.ts +235 -0
  102. package/es/LogViewer/types.js +1 -0
  103. package/es/Mentions/constants.d.ts +6 -0
  104. package/es/Mentions/constants.js +28 -0
  105. package/es/Mentions/hooks.d.ts +20 -0
  106. package/es/Mentions/hooks.js +133 -0
  107. package/es/Mentions/index.d.ts +23 -0
  108. package/es/Mentions/index.js +157 -0
  109. package/es/Mentions/plugins/OnBlurBlockPlugin.d.ts +7 -0
  110. package/es/Mentions/plugins/OnBlurBlockPlugin.js +35 -0
  111. package/es/Mentions/plugins/custom-text/node.d.ts +11 -0
  112. package/es/Mentions/plugins/custom-text/node.js +72 -0
  113. package/es/Mentions/plugins/editable.d.ts +4 -0
  114. package/es/Mentions/plugins/editable.js +13 -0
  115. package/es/Mentions/plugins/mention-node/component.d.ts +6 -0
  116. package/es/Mentions/plugins/mention-node/component.js +64 -0
  117. package/es/Mentions/plugins/mention-node/index.d.ts +9 -0
  118. package/es/Mentions/plugins/mention-node/index.js +32 -0
  119. package/es/Mentions/plugins/mention-node/node.d.ts +22 -0
  120. package/es/Mentions/plugins/mention-node/node.js +100 -0
  121. package/es/Mentions/plugins/mention-node/replacement.d.ts +5 -0
  122. package/es/Mentions/plugins/mention-node/replacement.js +43 -0
  123. package/es/Mentions/plugins/mention-node/style.d.ts +8 -0
  124. package/es/Mentions/plugins/mention-node/style.js +47 -0
  125. package/es/Mentions/plugins/mention-node/utils.d.ts +4 -0
  126. package/es/Mentions/plugins/mention-node/utils.js +10 -0
  127. package/es/Mentions/plugins/mention-picker/hooks.d.ts +5 -0
  128. package/es/Mentions/plugins/mention-picker/hooks.js +65 -0
  129. package/es/Mentions/plugins/mention-picker/index.d.ts +39 -0
  130. package/es/Mentions/plugins/mention-picker/index.js +137 -0
  131. package/es/Mentions/plugins/mention-picker/menu-item.d.ts +12 -0
  132. package/es/Mentions/plugins/mention-picker/menu-item.js +73 -0
  133. package/es/Mentions/plugins/mention-picker/menu.d.ts +10 -0
  134. package/es/Mentions/plugins/mention-picker/menu.js +31 -0
  135. package/es/Mentions/plugins/mention-picker/style.d.ts +11 -0
  136. package/es/Mentions/plugins/mention-picker/style.js +19 -0
  137. package/es/Mentions/plugins/mention-picker/utils.d.ts +31 -0
  138. package/es/Mentions/plugins/mention-picker/utils.js +66 -0
  139. package/es/Mentions/provider.d.ts +12 -0
  140. package/es/Mentions/provider.js +15 -0
  141. package/es/Mentions/style.d.ts +11 -0
  142. package/es/Mentions/style.js +22 -0
  143. package/es/Mentions/types.d.ts +12 -0
  144. package/es/Mentions/types.js +1 -0
  145. package/es/Mentions/utils.d.ts +9 -0
  146. package/es/Mentions/utils.js +95 -0
  147. package/es/Modal/index.d.ts +19 -0
  148. package/es/Modal/index.js +36 -0
  149. package/es/Modal/style.d.ts +4 -0
  150. package/es/Modal/style.js +17 -0
  151. package/es/MonacoEditor/base/controller.d.ts +17 -0
  152. package/es/MonacoEditor/base/controller.js +49 -0
  153. package/es/MonacoEditor/base/helper.d.ts +65 -0
  154. package/es/MonacoEditor/base/helper.js +324 -0
  155. package/es/MonacoEditor/base/index.d.ts +39 -0
  156. package/es/MonacoEditor/base/index.js +238 -0
  157. package/es/MonacoEditor/base/monaco.d.ts +6 -0
  158. package/es/MonacoEditor/base/monaco.js +64 -0
  159. package/es/MonacoEditor/{style.d.ts → base/style.d.ts} +4 -1
  160. package/es/MonacoEditor/base/style.js +43 -0
  161. package/es/MonacoEditor/index.d.ts +5 -4
  162. package/es/MonacoEditor/index.js +26 -62
  163. package/es/Page/Breadcrumb/index.d.ts +9 -0
  164. package/es/Page/Breadcrumb/index.js +56 -0
  165. package/es/Page/Content/index.d.ts +4 -0
  166. package/es/Page/Content/index.js +59 -0
  167. package/es/Page/Content/style.d.ts +3 -0
  168. package/es/Page/Content/style.js +12 -0
  169. package/es/Page/Footer/index.d.ts +2 -0
  170. package/es/Page/Footer/index.js +6 -0
  171. package/es/Page/Header/Icon.d.ts +17 -0
  172. package/es/Page/Header/Icon.js +42 -0
  173. package/es/Page/Header/index.d.ts +43 -0
  174. package/es/Page/Header/index.js +202 -0
  175. package/es/Page/Header/style.d.ts +12 -0
  176. package/es/Page/Header/style.js +21 -0
  177. package/es/Page/Page.d.ts +9 -0
  178. package/es/Page/Page.js +49 -0
  179. package/es/Page/PageContext.d.ts +15 -0
  180. package/es/Page/PageContext.js +21 -0
  181. package/es/Page/Title/index.d.ts +5 -0
  182. package/es/Page/Title/index.js +18 -0
  183. package/es/Page/Title/style.d.ts +3 -0
  184. package/es/Page/Title/style.js +10 -0
  185. package/es/Page/index.d.ts +18 -0
  186. package/es/Page/index.js +15 -0
  187. package/es/Page/style.d.ts +3 -0
  188. package/es/Page/style.js +10 -0
  189. package/es/ProCard/Card/index.d.ts +6 -0
  190. package/es/ProCard/Card/index.js +25 -0
  191. package/es/ProCard/Card/style.d.ts +7 -0
  192. package/es/ProCard/Card/style.js +15 -0
  193. package/es/ProCard/Content/index.d.ts +4 -0
  194. package/es/ProCard/Content/index.js +24 -0
  195. package/es/ProCard/Content/style.d.ts +3 -0
  196. package/es/ProCard/Content/style.js +10 -0
  197. package/es/ProCard/Descriptions/index.d.ts +4 -0
  198. package/es/ProCard/Descriptions/index.js +28 -0
  199. package/es/ProCard/Descriptions/style.d.ts +3 -0
  200. package/es/ProCard/Descriptions/style.js +12 -0
  201. package/es/ProCard/Header/index.d.ts +15 -0
  202. package/es/ProCard/Header/index.js +86 -0
  203. package/es/ProCard/Header/style.d.ts +12 -0
  204. package/es/ProCard/Header/style.js +21 -0
  205. package/es/ProCard/index.d.ts +13 -0
  206. package/es/ProCard/index.js +8 -0
  207. package/es/SelectCard/index.d.ts +33 -0
  208. package/es/SelectCard/index.js +132 -0
  209. package/es/SelectCard/style.d.ts +10 -0
  210. package/es/SelectCard/style.js +42 -0
  211. package/es/SliderInput/index.js +2 -2
  212. package/es/Status/index.d.ts +7 -0
  213. package/es/Status/index.js +39 -0
  214. package/es/Status/style.d.ts +4 -0
  215. package/es/Status/style.js +14 -0
  216. package/es/Table/collapse/index.d.ts +9 -0
  217. package/es/Table/collapse/index.js +39 -0
  218. package/es/Table/collapse/style.d.ts +3 -0
  219. package/es/Table/collapse/style.js +11 -0
  220. package/es/Table/index.d.ts +20 -0
  221. package/es/Table/index.js +56 -0
  222. package/es/Typography/index.d.ts +32 -0
  223. package/es/Typography/index.js +77 -0
  224. package/es/WaveformIcon/index.d.ts +9 -0
  225. package/es/WaveformIcon/index.js +51 -0
  226. package/es/hooks/languageMap.d.ts +1 -0
  227. package/es/hooks/languageMap.js +1 -0
  228. package/es/hooks/useHighlight.d.ts +5 -0
  229. package/es/hooks/useHighlight.js +78 -0
  230. package/es/index.d.ts +37 -4
  231. package/es/index.js +47 -4
  232. package/es/notification/index.d.ts +24 -0
  233. package/es/notification/index.js +237 -0
  234. package/es/notification/style.d.ts +2 -0
  235. package/es/notification/style.js +28 -0
  236. package/es/styles/colors/colors.d.ts +39 -0
  237. package/es/styles/colors/colors.js +86 -0
  238. package/es/styles/colors/generateColorPalette.d.ts +11 -0
  239. package/es/styles/colors/generateColorPalette.js +31 -0
  240. package/es/styles/colors/neutralColors.d.ts +9 -0
  241. package/es/styles/colors/neutralColors.js +32 -0
  242. package/es/styles/index.d.ts +4 -0
  243. package/es/styles/index.js +4 -0
  244. package/es/useSpeechSynthes/const/polyfill.d.ts +3 -0
  245. package/es/useSpeechSynthes/const/polyfill.js +21 -0
  246. package/es/useSpeechSynthes/index.d.ts +13 -0
  247. package/es/useSpeechSynthes/index.js +69 -0
  248. package/es/utils/constants.d.ts +1 -0
  249. package/es/utils/constants.js +1 -0
  250. package/es/utils/tools.d.ts +1 -0
  251. package/es/utils/tools.js +1 -0
  252. package/package.json +34 -9
  253. package/umd/index.min.css +2 -0
  254. package/umd/index.min.css.map +1 -0
  255. package/umd/index.min.js +1 -1
  256. package/umd/index.min.js.map +1 -1
  257. package/es/MonacoEditor/style.js +0 -24
@@ -0,0 +1,86 @@
1
+ import { AlertProps, AvatarProps, DivProps, MetaData } from '@lobehub/ui';
2
+ import { ReactNode } from 'react';
3
+ import type { EditableMessageProps } from "../EditableMessage";
4
+ export interface ChatItemProps {
5
+ /**
6
+ * @description Actions to be displayed in the chat item
7
+ */
8
+ actions?: ReactNode;
9
+ /**
10
+ * @description Metadata for the avatar
11
+ */
12
+ avatar: MetaData;
13
+ avatarAddon?: ReactNode;
14
+ avatarProps?: AvatarProps;
15
+ /**
16
+ * @description Custom CSS class name for the chat item
17
+ */
18
+ className?: string;
19
+ /**
20
+ * @description Whether the chat item is in editing mode
21
+ */
22
+ editing?: boolean;
23
+ /**
24
+ * @description Props for Error render
25
+ */
26
+ error?: AlertProps;
27
+ errorMessage?: ReactNode;
28
+ fontSize?: number;
29
+ /**
30
+ * @description Whether the chat item is in loading state
31
+ */
32
+ loading?: boolean;
33
+ /**
34
+ * @description The message content of the chat item
35
+ */
36
+ message?: ReactNode;
37
+ messageExtra?: ReactNode;
38
+ onAvatarClick?: () => void;
39
+ /**
40
+ * @description Callback when the message content changes
41
+ * @param value - The new message content
42
+ */
43
+ onChange?: (value: string) => void;
44
+ onDoubleClick?: DivProps['onDoubleClick'];
45
+ /**
46
+ * @description Callback when the editing mode changes
47
+ * @param editing - The new editing mode
48
+ */
49
+ onEditingChange?: (editing: boolean) => void;
50
+ /**
51
+ * @description The placement of the chat item
52
+ * @default 'left'
53
+ */
54
+ placement?: 'left' | 'right';
55
+ /**
56
+ * @description Whether the chat item is primary
57
+ */
58
+ primary?: boolean;
59
+ renderMessage?: (content: ReactNode) => ReactNode;
60
+ /**
61
+ * @description Whether to show the title of the chat item
62
+ */
63
+ showTitle?: boolean;
64
+ text?: EditableMessageProps['text'];
65
+ /**
66
+ * @description The timestamp of the chat item
67
+ */
68
+ time?: number;
69
+ /**
70
+ * @description The type of the chat item
71
+ * @default 'block'
72
+ */
73
+ type?: 'block' | 'pure';
74
+ /**
75
+ * @description The markdownProps of the chat item
76
+ */
77
+ markdownProps?: EditableMessageProps['markdownProps'];
78
+ /**
79
+ * @description The markdownClassname of the chat item
80
+ */
81
+ markdownClassname?: string;
82
+ /**
83
+ * @description Whether this message is latest
84
+ */
85
+ isLatest?: boolean;
86
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export interface ThinkProps {
3
+ second?: number;
4
+ done?: boolean;
5
+ }
6
+ declare const Render: import("react").NamedExoticComponent<PropsWithChildren<ThinkProps>>;
7
+ export default Render;
@@ -0,0 +1,65 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
+ var _templateObject, _templateObject2;
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ import { Icon, Markdown } from '@lobehub/ui';
8
+ import { createStyles } from 'antd-style';
9
+ import { ChevronDown, ChevronRight, Sparkles } from 'lucide-react';
10
+ import { memo, useState } from 'react';
11
+ import { Flexbox } from 'react-layout-kit';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ var useStyles = createStyles(function (_ref) {
15
+ var css = _ref.css,
16
+ token = _ref.token,
17
+ isDarkMode = _ref.isDarkMode;
18
+ return {
19
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-block: 12px;\n color: ", ";\n "])), token.colorTextSecondary),
20
+ titlebox: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n max-width: 230px;\n padding: 8px 12px;\n\n font-size: 12px;\n color: ", ";\n\n background: ", ";\n border-radius: 8px;\n "])), token.colorText, isDarkMode ? token.colorFillTertiary : '#f3f5fc')
21
+ };
22
+ });
23
+ var mProps = {
24
+ fontSize: 12,
25
+ lineHeight: 1.625,
26
+ headerMultiple: 0.2,
27
+ marginMultiple: 0.6
28
+ };
29
+ var Render = /*#__PURE__*/memo(function (_ref2) {
30
+ var children = _ref2.children,
31
+ second = _ref2.second,
32
+ done = _ref2.done;
33
+ var _useStyles = useStyles(),
34
+ styles = _useStyles.styles,
35
+ theme = _useStyles.theme;
36
+ var _useState = useState(true),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ showDetail = _useState2[0],
39
+ setShowDetail = _useState2[1];
40
+ return /*#__PURE__*/_jsxs(Flexbox, {
41
+ className: styles.container,
42
+ children: [/*#__PURE__*/_jsxs(Flexbox, {
43
+ className: styles.titlebox,
44
+ distribution: 'space-between',
45
+ flex: 1,
46
+ horizontal: true,
47
+ onClick: function onClick() {
48
+ setShowDetail(!showDetail);
49
+ },
50
+ children: [/*#__PURE__*/_jsxs(Flexbox, {
51
+ gap: 8,
52
+ horizontal: true,
53
+ children: [/*#__PURE__*/_jsx(Icon, {
54
+ color: theme.purple,
55
+ icon: Sparkles
56
+ }), done ? "\u5DF2\u6DF1\u5EA6\u601D\u8003".concat(second ? '(用时 ' + second + ' s)' : '', " ") : '思考中...']
57
+ }), /*#__PURE__*/_jsx(Icon, {
58
+ icon: showDetail ? ChevronDown : ChevronRight
59
+ })]
60
+ }), showDetail && /*#__PURE__*/_jsx(Markdown, _objectSpread(_objectSpread({}, mProps), {}, {
61
+ children: children
62
+ }))]
63
+ });
64
+ });
65
+ export default Render;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const AntThinkingElement: {
3
+ Component: import("react").NamedExoticComponent<import("react").PropsWithChildren<import("./Component").ThinkProps>>;
4
+ rehypePlugin: () => (tree: import("unist").Node) => void;
5
+ remarkPlugins: () => (tree: any) => void;
6
+ tag: string;
7
+ };
8
+ export default AntThinkingElement;
@@ -0,0 +1,10 @@
1
+ import Component from "./Component";
2
+ import rehypePlugin from "./rehypePlugin";
3
+ import { remarkCaptureThink } from "./remarkPlugin";
4
+ var AntThinkingElement = {
5
+ Component: Component,
6
+ rehypePlugin: rehypePlugin,
7
+ remarkPlugins: remarkCaptureThink,
8
+ tag: 'think'
9
+ };
10
+ export default AntThinkingElement;
@@ -0,0 +1,3 @@
1
+ import type { Node } from 'unist';
2
+ declare const rehypePlugin: () => (tree: Node) => void;
3
+ export default rehypePlugin;
@@ -0,0 +1,32 @@
1
+ import { visit } from 'unist-util-visit';
2
+
3
+ // eslint-disable-next-line unicorn/consistent-function-scoping
4
+ var rehypePlugin = function rehypePlugin() {
5
+ return function (tree) {
6
+ visit(tree, 'element', function (node, index, parent) {
7
+ if (node.type === 'element' && node.tagName === 'p') {
8
+ var children = node.children || [];
9
+ var openTagIndex = children.findIndex(function (child) {
10
+ return child.type === 'raw' && child.value === '<think>';
11
+ });
12
+ var closeTagIndex = children.findIndex(function (child) {
13
+ return child.type === 'raw' && child.value === '</think>';
14
+ });
15
+ if (openTagIndex !== -1 && closeTagIndex !== -1 && closeTagIndex > openTagIndex) {
16
+ var content = children.slice(openTagIndex + 1, closeTagIndex);
17
+ var thinkNode = {
18
+ children: content,
19
+ properties: {},
20
+ tagName: 'think',
21
+ type: 'element'
22
+ };
23
+
24
+ // Replace the entire paragraph with our new thinkNode node
25
+ parent.children.splice(index, 1, thinkNode);
26
+ return index; // Skip processing the newly inserted node
27
+ }
28
+ }
29
+ });
30
+ };
31
+ };
32
+ export default rehypePlugin;
@@ -0,0 +1 @@
1
+ export declare const remarkCaptureThink: () => (tree: any) => void;
@@ -0,0 +1,59 @@
1
+ import { toMarkdown } from 'mdast-util-to-markdown';
2
+ import { SKIP, visit } from 'unist-util-visit';
3
+ export var remarkCaptureThink = function remarkCaptureThink() {
4
+ return function (tree) {
5
+ visit(tree, 'html', function (node, index, parent) {
6
+ if (node.value === '<think>') {
7
+ var startIndex = index;
8
+ var endIndex = startIndex + 1;
9
+ var hasCloseTag = false;
10
+
11
+ // 查找闭合标签
12
+ while (endIndex < parent.children.length) {
13
+ var sibling = parent.children[endIndex];
14
+ if (sibling.type === 'html' && sibling.value === '</think>') {
15
+ hasCloseTag = true;
16
+ break;
17
+ }
18
+ endIndex++;
19
+ }
20
+
21
+ // 计算需要删除的节点范围
22
+ var deleteCount = hasCloseTag ? endIndex - startIndex + 1 : parent.children.length - startIndex;
23
+
24
+ // 提取内容节点
25
+ var contentNodes = parent.children.slice(startIndex + 1, hasCloseTag ? endIndex : undefined);
26
+
27
+ // 转换为 Markdown 字符串
28
+ var content = contentNodes.map(function (n) {
29
+ // fix https://github.com/lobehub/lobe-chat/issues/5668
30
+ if (n.type === 'paragraph') {
31
+ return n.children.map(function (child) {
32
+ return child.value;
33
+ }).join('');
34
+ }
35
+ return toMarkdown(n);
36
+ }).join('\n\n').trim();
37
+
38
+ // 创建自定义节点
39
+ var thinkNode = {
40
+ data: {
41
+ hChildren: [{
42
+ type: 'text',
43
+ value: content || ' '
44
+ }],
45
+ hName: 'think'
46
+ },
47
+ position: node.position,
48
+ type: 'thinkBlock'
49
+ };
50
+
51
+ // 替换原始节点
52
+ parent.children.splice(startIndex, deleteCount, thinkNode);
53
+
54
+ // 跳过已处理的节点
55
+ return [SKIP, startIndex + 1];
56
+ }
57
+ });
58
+ };
59
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const markdownElements: {
3
+ Component: import("react").NamedExoticComponent<import("react").PropsWithChildren<import("./AntThinking/Component").ThinkProps>>;
4
+ rehypePlugin: () => (tree: import("unist").Node) => void;
5
+ remarkPlugins: () => (tree: any) => void;
6
+ tag: string;
7
+ }[];
@@ -0,0 +1,2 @@
1
+ import AntThinkingElement from "./AntThinking";
2
+ export var markdownElements = [AntThinkingElement];
@@ -0,0 +1,10 @@
1
+ import { type MarkdownProps } from '@lobehub/ui';
2
+ import React from 'react';
3
+ import { ThinkProps } from './MarkdownElements/AntThinking/Component';
4
+ export interface ChatMarkdownProps extends MarkdownProps {
5
+ customComponentProps?: {
6
+ think?: Partial<ThinkProps>;
7
+ [k: string]: any;
8
+ };
9
+ }
10
+ export declare const ChatMarkdown: React.FC<ChatMarkdownProps>;
@@ -0,0 +1,40 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["components", "remarkPlugins", "customComponentProps", "children"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ import { Markdown } from '@lobehub/ui';
8
+ import React, { useMemo } from 'react';
9
+ import { markdownElements } from "./MarkdownElements";
10
+ import { normalizeThinkTags } from "./utils";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ var defaultRemarkPlugins = markdownElements.map(function (element) {
13
+ return element.remarkPlugins;
14
+ });
15
+ export var ChatMarkdown = function ChatMarkdown(_ref) {
16
+ var _ref$components = _ref.components,
17
+ components = _ref$components === void 0 ? {} : _ref$components,
18
+ _ref$remarkPlugins = _ref.remarkPlugins,
19
+ remarkPlugins = _ref$remarkPlugins === void 0 ? [] : _ref$remarkPlugins,
20
+ customComponentProps = _ref.customComponentProps,
21
+ children = _ref.children,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+ var allComponents = useMemo(function () {
24
+ var defaultComponents = Object.fromEntries(markdownElements.map(function (element) {
25
+ return [element.tag, function (aprops) {
26
+ return /*#__PURE__*/_jsx(element.Component, _objectSpread(_objectSpread({}, aprops), customComponentProps === null || customComponentProps === void 0 ? void 0 : customComponentProps[element.tag]));
27
+ }];
28
+ }));
29
+ return _objectSpread(_objectSpread({}, defaultComponents), components);
30
+ }, [components, customComponentProps]);
31
+ var allRemarkPlugins = useMemo(function () {
32
+ return [].concat(_toConsumableArray(defaultRemarkPlugins), _toConsumableArray(remarkPlugins));
33
+ }, [remarkPlugins]);
34
+ return /*#__PURE__*/_jsx(Markdown, _objectSpread(_objectSpread({
35
+ components: allComponents,
36
+ remarkPlugins: allRemarkPlugins
37
+ }, props), {}, {
38
+ children: normalizeThinkTags(children)
39
+ }));
40
+ };
@@ -0,0 +1 @@
1
+ export declare const normalizeThinkTags: (markdown: string) => string;
@@ -0,0 +1,10 @@
1
+ // 预处理函数:确保 think 标签前后有两个换行符
2
+ export var normalizeThinkTags = function normalizeThinkTags(markdown) {
3
+ return (markdown || ''
4
+ // 确保 <think> 标签前后有两个换行符
5
+ ).replaceAll(/([^\n])\s*<think>/g, '$1\n\n<think>').replaceAll(/<think>\s*([^\n])/g, '<think>\n\n$1')
6
+ // 确保 </think> 标签前后有两个换行符
7
+ .replaceAll(/([^\n])\s*<\/think>/g, '$1\n\n</think>').replaceAll(/<\/think>\s*([^\n])/g, '</think>\n\n$1')
8
+ // 处理可能产生的多余换行符
9
+ .replaceAll(/\n{3,}/g, '\n\n');
10
+ };
@@ -0,0 +1,4 @@
1
+ import { FormGroupProps } from '@lobehub/ui';
2
+ import React from 'react';
3
+ export type CollapseGroupProps = Omit<FormGroupProps, 'items' | 'activeKey' | 'defaultActiveKey' | 'accordion' | 'expandIconPosition'>;
4
+ export declare const CollapseGroup: React.FC<CollapseGroupProps>;
@@ -0,0 +1,23 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "variant"];
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ import { Form as LobeForm } from '@lobehub/ui';
7
+ import React from 'react';
8
+ import { useStyles } from "./style";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ var FormGroup = LobeForm.Group;
11
+ export var CollapseGroup = function CollapseGroup(_ref) {
12
+ var className = _ref.className,
13
+ variant = _ref.variant,
14
+ otherProps = _objectWithoutProperties(_ref, _excluded);
15
+ var _useStyles = useStyles(),
16
+ styles = _useStyles.styles,
17
+ cx = _useStyles.cx;
18
+ return /*#__PURE__*/_jsx(FormGroup, _objectSpread({
19
+ className: cx(styles.root, className),
20
+ collapsible: variant !== 'pure',
21
+ variant: variant
22
+ }, otherProps));
23
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ root: import("antd-style").SerializedStyles;
3
+ }>;
@@ -0,0 +1,11 @@
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
+ prefixCls = _ref.prefixCls;
8
+ return {
9
+ root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n .", "-collapse {\n &-header {\n padding: 0 !important;\n &-text {\n flex: 1 !important;\n padding: ", "px ", "px ", "px 0;\n & > * {\n font-size: ", "px;\n /* font-weight: unset; */\n }\n }\n }\n &-expand-icon {\n cursor: pointer;\n padding: ", "px 0 ", "px ", "px;\n }\n &-extra {\n padding-right: ", "px;\n }\n &-item > .", "-collapse-content {\n padding: ", "px 0;\n background-color: ", ";\n }\n &-content {\n &-box {\n padding: ", "px ", "px !important;\n }\n }\n }\n "])), token.margin, prefixCls, token.paddingSM, token.paddingSM, token.paddingSM, token.fontSize, token.padding, token.padding, token.paddingSM, token.paddingSM, prefixCls, token.paddingXXS, token.colorBgContainer, token.paddingXXS, token.padding)
10
+ };
11
+ });
@@ -1,10 +1,12 @@
1
1
  import { ElementType, ReactNode } from 'react';
2
+ import type { PageContextValue } from "../Page/PageContext";
2
3
  import { CDN, CdnApi } from "../utils/genCdnUrl";
3
4
  type CdnFn = ({ pkg, version, path }: CdnApi) => string;
4
5
  export interface Config {
5
6
  customCdnFn?: CdnFn;
6
7
  imgAs?: ElementType;
7
8
  proxy?: CDN | 'custom';
9
+ Link?: PageContextValue['Link'];
8
10
  }
9
11
  export declare const ConfigContext: import("react").Context<Config | null>;
10
12
  export declare const ConfigProvider: import("react").NamedExoticComponent<{
@@ -12,4 +14,5 @@ export declare const ConfigProvider: import("react").NamedExoticComponent<{
12
14
  config: Config;
13
15
  }>;
14
16
  export declare const useCdnFn: () => CdnFn;
17
+ export declare const useLink: () => typeof import("react").Component | import("react").FC<any> | undefined;
15
18
  export {};
@@ -24,16 +24,22 @@ var fallback = function fallback(_ref2) {
24
24
  export var useCdnFn = function useCdnFn() {
25
25
  var config = useContext(ConfigContext);
26
26
  if (!config) return fallback;
27
- if ((config === null || config === void 0 ? void 0 : config.proxy) !== 'custom') return function (_ref3) {
28
- var pkg = _ref3.pkg,
29
- version = _ref3.version,
30
- path = _ref3.path;
31
- return genCdnUrl({
32
- path: path,
33
- pkg: pkg,
34
- proxy: config.proxy,
35
- version: version
36
- });
37
- };
27
+ if ((config === null || config === void 0 ? void 0 : config.proxy) !== 'custom') {
28
+ return function (_ref3) {
29
+ var pkg = _ref3.pkg,
30
+ version = _ref3.version,
31
+ path = _ref3.path;
32
+ return genCdnUrl({
33
+ path: path,
34
+ pkg: pkg,
35
+ proxy: config.proxy,
36
+ version: version
37
+ });
38
+ };
39
+ }
38
40
  return (config === null || config === void 0 ? void 0 : config.customCdnFn) || fallback;
41
+ };
42
+ export var useLink = function useLink() {
43
+ var config = useContext(ConfigContext);
44
+ return config === null || config === void 0 ? void 0 : config.Link;
39
45
  };
@@ -0,0 +1,14 @@
1
+ import { Descriptions as AntdDescriptions, type DescriptionsProps as AntdDescriptionsProps } from 'antd';
2
+ import React from 'react';
3
+ export interface CustomDescriptionsProps {
4
+ borderedBottom?: boolean;
5
+ borderedBottomDashed?: boolean;
6
+ borderedTop?: boolean;
7
+ borderedTopDashed?: boolean;
8
+ }
9
+ export interface DescriptionsProps extends AntdDescriptionsProps, CustomDescriptionsProps {
10
+ }
11
+ export declare const Descriptions: React.FC<DescriptionsProps> & {
12
+ Item: typeof AntdDescriptions.Item;
13
+ };
14
+ export default Descriptions;
@@ -0,0 +1,31 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "borderedBottom", "borderedBottomDashed", "borderedTop", "borderedTopDashed"];
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ import { Descriptions as AntdDescriptions } from 'antd';
7
+ import React from 'react';
8
+ import { useStyles } from "./style";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ export var Descriptions = function Descriptions(props) {
11
+ var className = props.className,
12
+ borderedBottom = props.borderedBottom,
13
+ borderedBottomDashed = props.borderedBottomDashed,
14
+ borderedTop = props.borderedTop,
15
+ borderedTopDashed = props.borderedTopDashed,
16
+ otherProps = _objectWithoutProperties(props, _excluded);
17
+ var _useStyles = useStyles({
18
+ borderedBottom: borderedBottom,
19
+ borderedBottomDashed: borderedBottomDashed,
20
+ borderedTop: borderedTop,
21
+ borderedTopDashed: borderedTopDashed,
22
+ size: otherProps.size
23
+ }),
24
+ styles = _useStyles.styles,
25
+ cx = _useStyles.cx;
26
+ return /*#__PURE__*/_jsx(AntdDescriptions, _objectSpread(_objectSpread({}, otherProps), {}, {
27
+ className: cx(styles.custom, className)
28
+ }));
29
+ };
30
+ export default Descriptions;
31
+ Descriptions.Item = AntdDescriptions.Item;
@@ -0,0 +1,4 @@
1
+ import { DescriptionsProps } from './index';
2
+ export declare const useStyles: (props?: DescriptionsProps | undefined) => import("antd-style").ReturnStyles<{
3
+ custom: import("antd-style").SerializedStyles;
4
+ }>;
@@ -0,0 +1,24 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref, _ref2) {
5
+ var css = _ref.css,
6
+ token = _ref.token,
7
+ prefixCls = _ref.prefixCls;
8
+ var borderedBottom = _ref2.borderedBottom,
9
+ borderedBottomDashed = _ref2.borderedBottomDashed,
10
+ borderedTop = _ref2.borderedTop,
11
+ borderedTopDashed = _ref2.borderedTopDashed,
12
+ size = _ref2.size;
13
+ var descriptionsContentPadding = {
14
+ small: "".concat(token.paddingXS, "px ").concat(token.padding, "px"),
15
+ middle: "".concat(token.padding, "px ").concat(token.paddingLG, "px"),
16
+ default: "".concat(token.paddingSM, "px ").concat(token.paddingLG, "px")
17
+ };
18
+ var hasCustomSizeStyle = borderedBottom || borderedBottomDashed;
19
+ return {
20
+ custom: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-descriptions-item-content {\n align-items: center !important;\n }\n .", "-descriptions-row > td {\n padding-top: 8px !important;\n padding-bottom: 8px !important;\n }\n ", "\n ", "\n ", "\n ", "\n ", "\n "])), prefixCls, prefixCls, hasCustomSizeStyle && size && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-descriptions-item-label, .", "-descriptions-item-content {\n padding: ", ";\n }\n .", "-descriptions-item {\n padding-bottom: 0 !important;\n }\n table {\n border-spacing: 0 !important;\n }\n "])), prefixCls, prefixCls, descriptionsContentPadding[size], prefixCls), borderedBottom && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-descriptions-item {\n border-bottom: 1px solid ", ";\n }\n "])), prefixCls, token.colorSplit), borderedBottomDashed && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .", "-descriptions-item {\n border-bottom: 1px dashed ", ";\n }\n "])), prefixCls, token.colorSplit), borderedTop && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n .", "-descriptions-item {\n border-top: 1px solid ", ";\n }\n "])), prefixCls, token.colorSplit), borderedTopDashed && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .", "-descriptions-item {\n border-top: 1px dashed ", ";\n }\n "])), prefixCls, token.colorSplit))
21
+ };
22
+ }, {
23
+ hashPriority: 'low'
24
+ });
@@ -0,0 +1,38 @@
1
+ import { type DividerProps as AntdDividerProps } from 'antd';
2
+ import React from 'react';
3
+ export interface CustomDividerProps {
4
+ /**
5
+ * @description type of the divider
6
+ * @default 'default'
7
+ */
8
+ mode?: 'expanded' | 'line' | 'default';
9
+ /**
10
+ * @description Default whether to expand. This parameter is available only when mode is expanded
11
+ * @default 'false'
12
+ */
13
+ defaultOpen?: boolean;
14
+ /**
15
+ * @description Expand content. This parameter is available only when mode is expanded
16
+ * @default '-'
17
+ */
18
+ content?: React.ReactNode;
19
+ /**
20
+ * @description The position of icon. This parameter is available only when mode is expanded and default
21
+ * @default 'left'
22
+ */
23
+ iconPlacement?: 'left' | 'right';
24
+ /**
25
+ * @description custom open icon. This parameter is available only when mode is expanded
26
+ * @default '-'
27
+ */
28
+ openIcon?: React.ReactNode;
29
+ /**
30
+ * @description custom close icon. This parameter is available only when mode is expanded
31
+ * @default '-'
32
+ */
33
+ closeIcon?: React.ReactNode;
34
+ }
35
+ export interface DividerProps extends AntdDividerProps, CustomDividerProps {
36
+ }
37
+ export declare const Divider: React.FC<DividerProps>;
38
+ export default Divider;