@lobehub/ui 1.168.16 → 1.168.18

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 (34) hide show
  1. package/es/Highlighter/SyntaxHighlighter/index.js +10 -9
  2. package/es/Hotkey/index.d.ts +2 -0
  3. package/es/Hotkey/index.js +3 -1
  4. package/es/Markdown/Typography.d.ts +5 -5
  5. package/es/Markdown/Typography.js +4 -3
  6. package/es/Markdown/index.d.ts +1 -1
  7. package/es/Markdown/index.js +166 -90
  8. package/es/Markdown/markdown.style.d.ts +1 -18
  9. package/es/Markdown/markdown.style.js +19 -19
  10. package/es/Markdown/style.d.ts +1 -6
  11. package/es/Markdown/style.js +4 -12
  12. package/es/Mermaid/{Controls.js → components/Controls.js} +1 -1
  13. package/es/Mermaid/components/MermaidContainer.d.ts +5 -0
  14. package/es/Mermaid/components/MermaidContainer.js +43 -0
  15. package/es/Mermaid/components/MermaidZoomableContainer.d.ts +5 -0
  16. package/es/Mermaid/components/MermaidZoomableContainer.js +21 -0
  17. package/es/Mermaid/components/style.d.ts +3 -0
  18. package/es/Mermaid/components/style.js +12 -0
  19. package/es/Mermaid/index.js +9 -7
  20. package/es/Swatches/index.d.ts +2 -1
  21. package/es/Swatches/index.js +34 -22
  22. package/es/Swatches/style.js +2 -2
  23. package/es/components.d.ts +2 -4
  24. package/es/components.js +2 -4
  25. package/es/hooks/useHighlight.d.ts +2 -1
  26. package/es/hooks/useHighlight.js +119 -40
  27. package/es/hooks/useMermaid.d.ts +9 -0
  28. package/es/{Mermaid → hooks}/useMermaid.js +137 -73
  29. package/es/mdx/Mdx/index.js +1 -1
  30. package/es/utils/genCdnUrl.d.ts +3 -0
  31. package/es/utils/genCdnUrl.js +3 -1
  32. package/package.json +6 -6
  33. package/es/Mermaid/useMermaid.d.ts +0 -3
  34. /package/es/Mermaid/{Controls.d.ts → components/Controls.d.ts} +0 -0
@@ -21,16 +21,17 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
21
21
  var _useHighlight = useHighlight(children, language, enableTransformer),
22
22
  data = _useHighlight.data,
23
23
  isLoading = _useHighlight.isLoading;
24
- return /*#__PURE__*/_jsxs(_Fragment, {
25
- children: [isLoading || !data ? /*#__PURE__*/_jsx("div", {
26
- className: cx(styles.unshiki, className),
27
- style: style,
28
- children: /*#__PURE__*/_jsx("pre", {
29
- children: /*#__PURE__*/_jsx("code", {
30
- children: children
31
- })
24
+ if (!data) return /*#__PURE__*/_jsx("div", {
25
+ className: cx(styles.unshiki, className),
26
+ style: style,
27
+ children: /*#__PURE__*/_jsx("pre", {
28
+ children: /*#__PURE__*/_jsx("code", {
29
+ children: children
32
30
  })
33
- }) : /*#__PURE__*/_jsx("div", {
31
+ })
32
+ });
33
+ return /*#__PURE__*/_jsxs(_Fragment, {
34
+ children: [/*#__PURE__*/_jsx("div", {
34
35
  className: cx(styles.shiki, className),
35
36
  dangerouslySetInnerHTML: {
36
37
  __html: data
@@ -16,3 +16,5 @@ export interface HotkeyProps extends Omit<FlexboxProps, 'children'> {
16
16
  }
17
17
  declare const Hotkey: import("react").NamedExoticComponent<HotkeyProps>;
18
18
  export default Hotkey;
19
+ export { KeyMapEnum } from './type';
20
+ export { combineKeys } from './utils';
@@ -153,4 +153,6 @@ var Hotkey = /*#__PURE__*/memo(function (_ref2) {
153
153
  })
154
154
  }));
155
155
  });
156
- export default Hotkey;
156
+ export default Hotkey;
157
+ export { KeyMapEnum } from "./type";
158
+ export { combineKeys } from "./utils";
@@ -1,10 +1,10 @@
1
- import { CSSProperties, FC, PropsWithChildren } from 'react';
2
- export interface TypographyProps extends PropsWithChildren {
3
- className?: string;
1
+ import { FC } from 'react';
2
+ import { DivProps } from "../types";
3
+ export interface TypographyProps extends DivProps {
4
4
  fontSize?: number;
5
5
  headerMultiple?: number;
6
6
  lineHeight?: number;
7
7
  marginMultiple?: number;
8
- style?: CSSProperties;
9
8
  }
10
- export declare const Typography: FC<TypographyProps>;
9
+ declare const Typography: FC<TypographyProps>;
10
+ export default Typography;
@@ -11,7 +11,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
11
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
12
  import { useStyles } from "./markdown.style";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- export var Typography = function Typography(_ref) {
14
+ var Typography = function Typography(_ref) {
15
15
  var children = _ref.children,
16
16
  className = _ref.className,
17
17
  fontSize = _ref.fontSize,
@@ -28,8 +28,9 @@ export var Typography = function Typography(_ref) {
28
28
  cx = _useStyles.cx,
29
29
  styles = _useStyles.styles;
30
30
  return /*#__PURE__*/_jsx("article", _objectSpread(_objectSpread({
31
- className: cx(styles.__root, styles.a, styles.blockquote, styles.code, styles.details, styles.header, styles.hr, styles.img, styles.kbd, styles.list, styles.p, styles.pre, styles.strong, styles.table, styles.video, styles.svg, className)
31
+ className: cx(styles, className)
32
32
  }, rest), {}, {
33
33
  children: children
34
34
  }));
35
- };
35
+ };
36
+ export default Typography;
@@ -9,7 +9,7 @@ import { type PreProps } from "../mdx/mdxComponents/Pre";
9
9
  import { type VideoProps } from "../mdx/mdxComponents/Video";
10
10
  import type { AProps } from "../types";
11
11
  import { CitationItem } from "../types/citation";
12
- import type { TypographyProps } from './Typography';
12
+ import { type TypographyProps } from './Typography';
13
13
  export interface MarkdownProps extends TypographyProps {
14
14
  allowHtml?: boolean;
15
15
  children: string;
@@ -2,12 +2,6 @@
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
4
  var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "enableLatex", "enableMermaid", "enableImageGallery", "enableCustomFootnotes", "componentProps", "allowHtml", "fontSize", "headerMultiple", "marginMultiple", "showFootnotes", "variant", "lineHeight", "rehypePlugins", "remarkPlugins", "remarkPluginsAhead", "components", "customRender", "citations"];
5
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
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; }
12
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; }
13
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -15,7 +9,13 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
15
9
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
10
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
- import { memo, useMemo } from 'react';
12
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
13
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
16
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
17
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
+ import { memo, useCallback, useMemo } from 'react';
19
19
  import ReactMarkdown from 'react-markdown';
20
20
  import rehypeKatex from 'rehype-katex';
21
21
  import rehypeRaw from 'rehype-raw';
@@ -28,12 +28,53 @@ import Link from "../mdx/mdxComponents/Link";
28
28
  import Section from "../mdx/mdxComponents/Section";
29
29
  import Video from "../mdx/mdxComponents/Video";
30
30
  import { CodeFullFeatured, CodeLite } from "./CodeBlock";
31
- import { useStyles as useMarkdownStyles } from "./markdown.style";
31
+ import Typography from "./Typography";
32
32
  import { rehypeFootnoteLinks, remarkCustomFootnotes } from "./plugins/footnote";
33
33
  import { rehypeKatexDir } from "./plugins/katexDir";
34
34
  import { useStyles } from "./style";
35
35
  import { escapeBrackets, escapeMhchem, fixMarkdownBold, transformCitations } from "./utils";
36
+
37
+ // 使用普通 Map 代替 WeakMap,并限制缓存大小
36
38
  import { jsx as _jsx } from "react/jsx-runtime";
39
+ var CACHE_SIZE = 50;
40
+ var contentCache = new Map();
41
+
42
+ // 添加内容到缓存时,保持缓存大小不超过限制
43
+ var addToCache = function addToCache(key, value) {
44
+ if (contentCache.size >= CACHE_SIZE) {
45
+ // 移除最早加入的缓存项
46
+ var firstKey = contentCache.keys().next().value;
47
+ if (firstKey) contentCache.delete(firstKey);
48
+ }
49
+ contentCache.set(key, value);
50
+ };
51
+ // 使用工厂函数处理插件,减少组件中的逻辑负担
52
+ var createPlugins = function createPlugins(props) {
53
+ var allowHtml = props.allowHtml,
54
+ enableLatex = props.enableLatex,
55
+ enableCustomFootnotes = props.enableCustomFootnotes,
56
+ isChatMode = props.isChatMode,
57
+ rehypePlugins = props.rehypePlugins,
58
+ remarkPlugins = props.remarkPlugins,
59
+ remarkPluginsAhead = props.remarkPluginsAhead;
60
+
61
+ // 预处理插件数组
62
+ var normalizedRehypePlugins = Array.isArray(rehypePlugins) ? rehypePlugins : rehypePlugins ? [rehypePlugins] : [];
63
+ var normalizedRemarkPlugins = Array.isArray(remarkPlugins) ? remarkPlugins : remarkPlugins ? [remarkPlugins] : [];
64
+ var normalizedRemarkPluginsAhead = Array.isArray(remarkPluginsAhead) ? remarkPluginsAhead : remarkPluginsAhead ? [remarkPluginsAhead] : [];
65
+
66
+ // 创建 rehype 插件列表
67
+ var rehypePluginsList = [allowHtml && rehypeRaw, enableLatex && rehypeKatex, enableLatex && rehypeKatexDir, enableCustomFootnotes && rehypeFootnoteLinks].concat(_toConsumableArray(normalizedRehypePlugins)).filter(Boolean);
68
+
69
+ // 创建 remark 插件列表
70
+ var remarkPluginsList = [].concat(_toConsumableArray(normalizedRemarkPluginsAhead), [[remarkGfm, {
71
+ singleTilde: false
72
+ }], enableCustomFootnotes && remarkCustomFootnotes, enableLatex && remarkMath, isChatMode && remarkBreaks], _toConsumableArray(normalizedRemarkPlugins)).filter(Boolean);
73
+ return {
74
+ rehypePluginsList: rehypePluginsList,
75
+ remarkPluginsList: remarkPluginsList
76
+ };
77
+ };
37
78
  var Markdown = /*#__PURE__*/memo(function (_ref) {
38
79
  var children = _ref.children,
39
80
  className = _ref.className,
@@ -49,13 +90,17 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
49
90
  enableCustomFootnotes = _ref.enableCustomFootnotes,
50
91
  componentProps = _ref.componentProps,
51
92
  allowHtml = _ref.allowHtml,
52
- fontSize = _ref.fontSize,
53
- headerMultiple = _ref.headerMultiple,
54
- marginMultiple = _ref.marginMultiple,
93
+ _ref$fontSize = _ref.fontSize,
94
+ fontSize = _ref$fontSize === void 0 ? 14 : _ref$fontSize,
95
+ _ref$headerMultiple = _ref.headerMultiple,
96
+ headerMultiple = _ref$headerMultiple === void 0 ? 0.25 : _ref$headerMultiple,
97
+ _ref$marginMultiple = _ref.marginMultiple,
98
+ marginMultiple = _ref$marginMultiple === void 0 ? 1 : _ref$marginMultiple,
55
99
  showFootnotes = _ref.showFootnotes,
56
100
  _ref$variant = _ref.variant,
57
101
  variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
58
- lineHeight = _ref.lineHeight,
102
+ _ref$lineHeight = _ref.lineHeight,
103
+ lineHeight = _ref$lineHeight === void 0 ? 1.6 : _ref$lineHeight,
59
104
  rehypePlugins = _ref.rehypePlugins,
60
105
  remarkPlugins = _ref.remarkPlugins,
61
106
  remarkPluginsAhead = _ref.remarkPluginsAhead,
@@ -64,95 +109,126 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
64
109
  customRender = _ref.customRender,
65
110
  citations = _ref.citations,
66
111
  rest = _objectWithoutProperties(_ref, _excluded);
67
- var _useStyles = useStyles({
68
- fontSize: fontSize,
69
- headerMultiple: headerMultiple,
70
- lineHeight: lineHeight,
71
- marginMultiple: marginMultiple
72
- }),
112
+ var _useStyles = useStyles(),
73
113
  cx = _useStyles.cx,
74
114
  styles = _useStyles.styles;
75
- var _useMarkdownStyles = useMarkdownStyles({
76
- fontSize: fontSize,
77
- headerMultiple: headerMultiple,
78
- marginMultiple: marginMultiple
79
- }),
80
- mdStyles = _useMarkdownStyles.styles;
81
115
  var isChatMode = variant === 'chat';
116
+
117
+ // 计算缓存键
118
+ var cacheKey = useMemo(function () {
119
+ return "".concat(children, "-").concat(enableLatex, "-").concat(enableCustomFootnotes, "-").concat((citations === null || citations === void 0 ? void 0 : citations.length) || 0);
120
+ }, [children, enableLatex, enableCustomFootnotes, citations === null || citations === void 0 ? void 0 : citations.length]);
121
+
122
+ // 处理内容并利用缓存避免重复计算
82
123
  var escapedContent = useMemo(function () {
83
- if (!enableLatex) return fixMarkdownBold(children);
84
- var defaultValue = fixMarkdownBold(escapeMhchem(escapeBrackets(children)));
85
- if (enableCustomFootnotes) return transformCitations(defaultValue, citations === null || citations === void 0 ? void 0 : citations.length);
86
- return defaultValue;
87
- }, [children, enableLatex, enableCustomFootnotes]);
124
+ // 尝试从缓存获取
125
+ if (contentCache.has(cacheKey)) {
126
+ return contentCache.get(cacheKey);
127
+ }
128
+
129
+ // 处理新内容
130
+ var processedContent;
131
+ if (enableLatex) {
132
+ var baseContent = fixMarkdownBold(escapeMhchem(escapeBrackets(children)));
133
+ processedContent = enableCustomFootnotes ? transformCitations(baseContent, citations === null || citations === void 0 ? void 0 : citations.length) : baseContent;
134
+ } else {
135
+ processedContent = fixMarkdownBold(children);
136
+ }
137
+
138
+ // 缓存处理结果
139
+ addToCache(cacheKey, processedContent);
140
+ return processedContent;
141
+ }, [cacheKey, children, enableLatex, enableCustomFootnotes, citations === null || citations === void 0 ? void 0 : citations.length]);
142
+
143
+ // 创建插件
144
+ var _useMemo = useMemo(function () {
145
+ return createPlugins({
146
+ allowHtml: allowHtml,
147
+ enableCustomFootnotes: enableCustomFootnotes,
148
+ enableLatex: enableLatex,
149
+ isChatMode: isChatMode,
150
+ rehypePlugins: rehypePlugins,
151
+ remarkPlugins: remarkPlugins,
152
+ remarkPluginsAhead: remarkPluginsAhead
153
+ });
154
+ }, [allowHtml, enableLatex, enableCustomFootnotes, isChatMode, rehypePlugins, remarkPlugins, remarkPluginsAhead]),
155
+ rehypePluginsList = _useMemo.rehypePluginsList,
156
+ remarkPluginsList = _useMemo.remarkPluginsList;
157
+
158
+ // 使用 useCallback 优化渲染子组件
159
+ var renderLink = useCallback(function (props) {
160
+ return /*#__PURE__*/_jsx(Link, _objectSpread(_objectSpread({
161
+ citations: citations
162
+ }, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.a));
163
+ }, [citations, componentProps === null || componentProps === void 0 ? void 0 : componentProps.a]);
164
+ var renderImage = useCallback(function (props) {
165
+ var _componentProps$img, _componentProps$img2;
166
+ return /*#__PURE__*/_jsx(Image, _objectSpread(_objectSpread(_objectSpread({}, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.img), {}, {
167
+ style: isChatMode ? _objectSpread({
168
+ height: 'auto',
169
+ maxWidth: 640
170
+ }, componentProps === null || componentProps === void 0 || (_componentProps$img = componentProps.img) === null || _componentProps$img === void 0 ? void 0 : _componentProps$img.style) : componentProps === null || componentProps === void 0 || (_componentProps$img2 = componentProps.img) === null || _componentProps$img2 === void 0 ? void 0 : _componentProps$img2.style
171
+ }));
172
+ }, [isChatMode, componentProps === null || componentProps === void 0 ? void 0 : componentProps.img]);
173
+ var renderCodeBlock = useCallback(function (props) {
174
+ return fullFeaturedCodeBlock ? /*#__PURE__*/_jsx(CodeFullFeatured, _objectSpread(_objectSpread({
175
+ enableMermaid: enableMermaid,
176
+ highlight: componentProps === null || componentProps === void 0 ? void 0 : componentProps.highlight,
177
+ mermaid: componentProps === null || componentProps === void 0 ? void 0 : componentProps.mermaid
178
+ }, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre)) : /*#__PURE__*/_jsx(CodeLite, _objectSpread(_objectSpread({
179
+ enableMermaid: enableMermaid,
180
+ highlight: componentProps === null || componentProps === void 0 ? void 0 : componentProps.highlight,
181
+ mermaid: componentProps === null || componentProps === void 0 ? void 0 : componentProps.mermaid
182
+ }, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre));
183
+ }, [enableMermaid, fullFeaturedCodeBlock, componentProps === null || componentProps === void 0 ? void 0 : componentProps.highlight, componentProps === null || componentProps === void 0 ? void 0 : componentProps.mermaid, componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre]);
184
+ var renderSection = useCallback(function (props) {
185
+ return /*#__PURE__*/_jsx(Section, _objectSpread({
186
+ showCitations: showFootnotes
187
+ }, props));
188
+ }, [showFootnotes]);
189
+ var renderVideo = useCallback(function (props) {
190
+ return /*#__PURE__*/_jsx(Video, _objectSpread(_objectSpread({}, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.video));
191
+ }, [componentProps === null || componentProps === void 0 ? void 0 : componentProps.video]);
192
+
193
+ // 创建组件映射
88
194
  var memoComponents = useMemo(function () {
89
195
  return _objectSpread({
90
- a: function a(props) {
91
- return /*#__PURE__*/_jsx(Link, _objectSpread(_objectSpread({
92
- citations: citations
93
- }, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.a));
94
- },
95
- img: enableImageGallery ? function (props) {
96
- var _componentProps$img, _componentProps$img2;
97
- return /*#__PURE__*/_jsx(Image, _objectSpread(_objectSpread(_objectSpread({}, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.img), {}, {
98
- style: isChatMode ? _objectSpread({
99
- height: 'auto',
100
- maxWidth: 640
101
- }, componentProps === null || componentProps === void 0 || (_componentProps$img = componentProps.img) === null || _componentProps$img === void 0 ? void 0 : _componentProps$img.style) : componentProps === null || componentProps === void 0 || (_componentProps$img2 = componentProps.img) === null || _componentProps$img2 === void 0 ? void 0 : _componentProps$img2.style
102
- }));
103
- } : undefined,
104
- pre: function pre(props) {
105
- return fullFeaturedCodeBlock ? /*#__PURE__*/_jsx(CodeFullFeatured, _objectSpread(_objectSpread({
106
- enableMermaid: enableMermaid,
107
- highlight: componentProps === null || componentProps === void 0 ? void 0 : componentProps.highlight,
108
- mermaid: componentProps === null || componentProps === void 0 ? void 0 : componentProps.mermaid
109
- }, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre)) : /*#__PURE__*/_jsx(CodeLite, _objectSpread(_objectSpread({
110
- enableMermaid: enableMermaid,
111
- highlight: componentProps === null || componentProps === void 0 ? void 0 : componentProps.highlight,
112
- mermaid: componentProps === null || componentProps === void 0 ? void 0 : componentProps.mermaid
113
- }, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre));
114
- },
115
- section: function section(props) {
116
- return /*#__PURE__*/_jsx(Section, _objectSpread({
117
- showCitations: showFootnotes
118
- }, props));
119
- },
120
- video: function video(props) {
121
- return /*#__PURE__*/_jsx(Video, _objectSpread(_objectSpread({}, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.video));
122
- }
196
+ a: renderLink,
197
+ img: enableImageGallery ? renderImage : undefined,
198
+ pre: renderCodeBlock,
199
+ section: renderSection,
200
+ video: renderVideo
123
201
  }, components);
124
- }, [].concat(_toConsumableArray(Object.values(components || {})), _toConsumableArray(Object.values(componentProps || {})), [enableImageGallery, enableMermaid, fullFeaturedCodeBlock], _toConsumableArray(citations || []), [showFootnotes]));
125
- var innerRehypePlugins = Array.isArray(rehypePlugins) ? rehypePlugins : [rehypePlugins];
126
- var memoRehypePlugins = useMemo(function () {
127
- return [allowHtml && rehypeRaw, enableLatex && rehypeKatex, enableLatex && rehypeKatexDir, enableCustomFootnotes && rehypeFootnoteLinks].concat(_toConsumableArray(innerRehypePlugins)).filter(Boolean);
128
- }, [allowHtml, enableLatex, enableCustomFootnotes].concat(_toConsumableArray(innerRehypePlugins)));
129
- var innerRemarkPlugins = Array.isArray(remarkPlugins) ? remarkPlugins : [remarkPlugins];
130
- var innerRemarkPluginsAhead = Array.isArray(remarkPluginsAhead) ? remarkPluginsAhead : [remarkPluginsAhead];
131
- var memoRemarkPlugins = useMemo(function () {
132
- return [].concat(_toConsumableArray(innerRemarkPluginsAhead), [[remarkGfm, {
133
- singleTilde: false
134
- }], enableCustomFootnotes && remarkCustomFootnotes, enableLatex && remarkMath, isChatMode && remarkBreaks], _toConsumableArray(innerRemarkPlugins)).filter(Boolean);
135
- }, [isChatMode, enableCustomFootnotes, enableLatex].concat(_toConsumableArray(innerRemarkPluginsAhead), _toConsumableArray(innerRemarkPlugins)));
136
- var defaultDOM = /*#__PURE__*/_jsx(ImageGallery, {
137
- enable: enableImageGallery,
138
- children: /*#__PURE__*/_jsx(ReactMarkdown, _objectSpread(_objectSpread({
139
- className: cx(mdStyles.__root, mdStyles.a, mdStyles.blockquote, mdStyles.code, mdStyles.details, mdStyles.header, mdStyles.hr, mdStyles.img, mdStyles.kbd, mdStyles.list, mdStyles.p, mdStyles.pre, mdStyles.strong, mdStyles.table, mdStyles.video, mdStyles.svg, enableLatex && styles.latex, isChatMode && styles.chat),
140
- components: memoComponents,
141
- rehypePlugins: memoRehypePlugins,
142
- remarkPlugins: memoRemarkPlugins
143
- }, rest), {}, {
144
- children: escapedContent
145
- }))
146
- });
202
+ }, [renderLink, renderImage, renderCodeBlock, renderSection, renderVideo, enableImageGallery, components]);
203
+
204
+ // 渲染默认内容
205
+ var defaultDOM = useMemo(function () {
206
+ return /*#__PURE__*/_jsx(ImageGallery, {
207
+ enable: enableImageGallery,
208
+ children: /*#__PURE__*/_jsx(ReactMarkdown, {
209
+ components: memoComponents,
210
+ rehypePlugins: rehypePluginsList,
211
+ remarkPlugins: remarkPluginsList,
212
+ children: escapedContent
213
+ })
214
+ });
215
+ }, [escapedContent, memoComponents, rehypePluginsList, remarkPluginsList, enableImageGallery]);
216
+
217
+ // 应用自定义渲染
147
218
  var markdownContent = customRender ? customRender(defaultDOM, {
148
- text: escapedContent
219
+ text: escapedContent || ''
149
220
  }) : defaultDOM;
150
- return /*#__PURE__*/_jsx("div", {
151
- className: cx(styles.root, className),
221
+ return /*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
222
+ className: cx(styles.root, enableLatex && styles.latex, isChatMode && styles.chat, className),
152
223
  "data-code-type": "markdown",
224
+ fontSize: fontSize,
225
+ headerMultiple: headerMultiple,
226
+ lineHeight: lineHeight,
227
+ marginMultiple: marginMultiple,
153
228
  onDoubleClick: onDoubleClick,
154
- style: style,
229
+ style: style
230
+ }, rest), {}, {
155
231
  children: markdownContent
156
- });
232
+ }));
157
233
  });
158
234
  export default Markdown;
@@ -3,21 +3,4 @@ export declare const useStyles: (props?: {
3
3
  headerMultiple?: number | undefined;
4
4
  lineHeight?: number | undefined;
5
5
  marginMultiple?: number | undefined;
6
- } | undefined) => import("antd-style").ReturnStyles<{
7
- __root: import("antd-style").SerializedStyles;
8
- a: import("antd-style").SerializedStyles;
9
- blockquote: import("antd-style").SerializedStyles;
10
- code: import("antd-style").SerializedStyles;
11
- details: import("antd-style").SerializedStyles;
12
- header: import("antd-style").SerializedStyles;
13
- hr: import("antd-style").SerializedStyles;
14
- img: import("antd-style").SerializedStyles;
15
- kbd: import("antd-style").SerializedStyles;
16
- list: import("antd-style").SerializedStyles;
17
- p: import("antd-style").SerializedStyles;
18
- pre: import("antd-style").SerializedStyles;
19
- strong: import("antd-style").SerializedStyles;
20
- svg: import("antd-style").SerializedStyles;
21
- table: import("antd-style").SerializedStyles;
22
- video: import("antd-style").SerializedStyles;
23
- }>;
6
+ } | undefined) => import("antd-style").ReturnStyles<string>;
@@ -4,7 +4,8 @@ import { createStyles } from 'antd-style';
4
4
  import { rgba } from 'polished';
5
5
  var IGNORE_CLASSNAME = '.ignore-markdown-style';
6
6
  export var useStyles = createStyles(function (_ref, _ref2) {
7
- var token = _ref.token,
7
+ var cx = _ref.cx,
8
+ token = _ref.token,
8
9
  isDarkMode = _ref.isDarkMode,
9
10
  css = _ref.css;
10
11
  var _ref2$fontSize = _ref2.fontSize,
@@ -15,22 +16,21 @@ export var useStyles = createStyles(function (_ref, _ref2) {
15
16
  marginMultiple = _ref2$marginMultiple === void 0 ? 1.5 : _ref2$marginMultiple,
16
17
  _ref2$lineHeight = _ref2.lineHeight,
17
18
  lineHeight = _ref2$lineHeight === void 0 ? 1.8 : _ref2$lineHeight;
18
- return {
19
- __root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --lobe-markdown-font-size: ", "px;\n --lobe-markdown-header-multiple: ", ";\n --lobe-markdown-margin-multiple: ", ";\n --lobe-markdown-line-height: ", ";\n --lobe-markdown-border-radius: ", ";\n --lobe-markdown-border-color: ", ";\n\n position: relative;\n\n width: 100%;\n max-width: 100%;\n padding-inline: 1px;\n\n font-size: var(--lobe-markdown-font-size);\n line-height: var(--lobe-markdown-line-height);\n word-break: break-word;\n\n ", " {\n font-size: 14px;\n line-height: 1.5;\n }\n "])), fontSize, headerMultiple, marginMultiple, lineHeight, token.borderRadiusLG, isDarkMode ? token.colorBorderSecondary : rgba(token.colorBorderSecondary, 0.5), IGNORE_CLASSNAME),
20
- a: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n a:not(", " a) {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n }\n "])), IGNORE_CLASSNAME, token.colorInfoText, token.colorInfoHover),
21
- blockquote: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n blockquote:not(", " blockquote) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n margin-inline: 0;\n padding-block: 0;\n padding-inline: 1em;\n\n color: ", ";\n\n border-inline-start: solid 4px ", ";\n }\n "])), IGNORE_CLASSNAME, token.colorTextSecondary, token.colorBorder),
22
- code: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n code:not(", " code) {\n &:not(:has(span)) {\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n }\n }\n "])), IGNORE_CLASSNAME, token.fontFamilyCode, token.colorFillSecondary),
23
- details: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n details:not(", " details) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n padding-block: 0.75em;\n padding-inline: 1em;\n\n background: ", ";\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n summary {\n cursor: pointer;\n display: flex;\n align-items: center;\n list-style: none;\n\n &::before {\n content: '';\n\n position: absolute;\n inset-inline-end: 1.25em;\n transform: rotateZ(-45deg);\n\n display: block;\n\n width: 0.4em;\n height: 0.4em;\n\n font-family: ", ";\n\n border-block-end: 1.5px solid ", ";\n border-inline-end: 1.5px solid ", ";\n\n transition: transform 200ms ", ";\n }\n }\n\n &[open] {\n summary {\n padding-block-end: 0.75em;\n border-block-end: 1px dashed ", ";\n\n &::before {\n transform: rotateZ(45deg);\n }\n }\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillTertiary, token.fontFamily, token.colorTextSecondary, token.colorTextSecondary, token.motionEaseOut, token.colorBorder),
24
- header: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n h1:not(", " h1),\n h2:not(", " h2),\n h3:not(", " h3),\n h4:not(", " h4),\n h5:not(", " h5),\n h6:not(", " h6) {\n margin-block: max(\n calc(\n var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em\n ),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1:not(", " h1) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2:not(", " h2) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple))\n );\n }\n\n h3:not(", " h3) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4:not(", " h4) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5:not(", " h5),\n h6:not(", " h6) {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME),
25
- hr: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n hr:not(", " hr) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1.5em);\n\n border-color: ", ";\n border-style: dashed;\n border-width: 1px;\n border-block-start: none;\n border-inline-start: none;\n border-inline-end: none;\n }\n "])), IGNORE_CLASSNAME, token.colorBorderSecondary),
26
- img: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n img:not(", " img) {\n max-width: 100%;\n }\n\n > img,\n > p > img {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n "])), IGNORE_CLASSNAME),
27
- kbd: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n kbd:not(", " kbd) {\n cursor: default;\n\n display: inline-block;\n\n min-width: 1em;\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n\n font-family: ", ";\n font-size: 0.875em;\n font-weight: 500;\n line-height: 1;\n text-align: center;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: 0.25em;\n }\n "])), IGNORE_CLASSNAME, token.fontFamily, token.colorBgLayout, token.colorBorderSecondary),
28
- list: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n li:not(", " li) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n\n p {\n display: inline;\n }\n }\n\n ul:not(", " ul),\n ol:not(", " ol) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n margin-inline-start: 1em;\n padding-inline-start: 0;\n list-style-position: outside;\n\n ul,\n ol {\n margin-block: 0;\n }\n\n li {\n margin-inline-start: 1em;\n }\n }\n\n ol:not(", " ol) {\n list-style: auto;\n }\n\n ul:not(", " ul) {\n list-style-type: none;\n\n li {\n &::before {\n content: '-';\n display: inline-block;\n margin-inline: -1em 0.5em;\n opacity: 0.5;\n }\n }\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME),
29
- p: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n p:not(", " kbd) {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 1em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 1em);\n }\n }\n "])), IGNORE_CLASSNAME),
30
- pre: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n pre:not(", " pre),\n [data-code-type='highlighter'] {\n white-space: break-spaces;\n border: none;\n\n > code {\n padding: 0 !important;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1.6;\n\n border: none !important;\n }\n }\n "])), IGNORE_CLASSNAME, token.fontFamilyCode),
31
- strong: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n strong:not(", " strong) {\n font-weight: 600;\n }\n "])), IGNORE_CLASSNAME),
32
- svg: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n svg:not(", " svg) {\n line-height: 1;\n }\n "])), IGNORE_CLASSNAME),
33
- table: css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n table:not(", " table) {\n unicode-bidi: isolate;\n overflow: auto hidden;\n display: block;\n border-spacing: 0;\n border-collapse: collapse;\n\n box-sizing: border-box;\n width: max-content;\n max-width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n\n text-align: start;\n text-indent: initial;\n text-wrap: pretty;\n word-break: auto-phrase;\n overflow-wrap: break-word;\n\n background: ", ";\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n code {\n word-break: break-word;\n }\n\n thead {\n background: ", ";\n }\n\n tr {\n box-shadow: 0 1px 0 var(--lobe-markdown-border-color);\n }\n\n th,\n td {\n min-width: 120px;\n padding-block: 0.75em;\n padding-inline: 1em;\n text-align: start;\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillQuaternary, token.colorFillQuaternary),
34
- video: css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n > video:not(", " video),\n > p:not(", " p) > video {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n\n video:not(", " video) {\n max-width: 100%;\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME)
35
- };
19
+ var __root = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --lobe-markdown-font-size: ", "px;\n --lobe-markdown-header-multiple: ", ";\n --lobe-markdown-margin-multiple: ", ";\n --lobe-markdown-line-height: ", ";\n --lobe-markdown-border-radius: ", ";\n --lobe-markdown-border-color: ", ";\n\n position: relative;\n\n width: 100%;\n max-width: 100%;\n padding-inline: 1px;\n\n font-size: var(--lobe-markdown-font-size);\n line-height: var(--lobe-markdown-line-height);\n word-break: break-word;\n\n ", " {\n font-size: 14px;\n line-height: 1.5;\n }\n "])), fontSize, headerMultiple, marginMultiple, lineHeight, token.borderRadiusLG, isDarkMode ? token.colorBorderSecondary : rgba(token.colorBorderSecondary, 0.5), IGNORE_CLASSNAME);
20
+ var a = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n a:not(", " a) {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n }\n "])), IGNORE_CLASSNAME, token.colorInfoText, token.colorInfoHover);
21
+ var blockquote = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n blockquote:not(", " blockquote) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n margin-inline: 0;\n padding-block: 0;\n padding-inline: 1em;\n\n color: ", ";\n\n border-inline-start: solid 4px ", ";\n }\n "])), IGNORE_CLASSNAME, token.colorTextSecondary, token.colorBorder);
22
+ var code = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n code:not(", " code) {\n &:not(:has(span)) {\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n }\n }\n "])), IGNORE_CLASSNAME, token.fontFamilyCode, token.colorFillSecondary);
23
+ var details = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n details:not(", " details) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n padding-block: 0.75em;\n padding-inline: 1em;\n\n background: ", ";\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n summary {\n cursor: pointer;\n display: flex;\n align-items: center;\n list-style: none;\n\n &::before {\n content: '';\n\n position: absolute;\n inset-inline-end: 1.25em;\n transform: rotateZ(-45deg);\n\n display: block;\n\n width: 0.4em;\n height: 0.4em;\n\n font-family: ", ";\n\n border-block-end: 1.5px solid ", ";\n border-inline-end: 1.5px solid ", ";\n\n transition: transform 200ms ", ";\n }\n }\n\n &[open] {\n summary {\n padding-block-end: 0.75em;\n border-block-end: 1px dashed ", ";\n\n &::before {\n transform: rotateZ(45deg);\n }\n }\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillTertiary, token.fontFamily, token.colorTextSecondary, token.colorTextSecondary, token.motionEaseOut, token.colorBorder);
24
+ var header = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n h1:not(", " h1),\n h2:not(", " h2),\n h3:not(", " h3),\n h4:not(", " h4),\n h5:not(", " h5),\n h6:not(", " h6) {\n margin-block: max(\n calc(var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1:not(", " h1) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2:not(", " h2) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple))\n );\n }\n\n h3:not(", " h3) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4:not(", " h4) {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5:not(", " h5),\n h6:not(", " h6) {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
25
+ var hr = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n hr:not(", " hr) {\n width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1.5em);\n\n border-color: ", ";\n border-style: dashed;\n border-width: 1px;\n border-block-start: none;\n border-inline-start: none;\n border-inline-end: none;\n }\n "])), IGNORE_CLASSNAME, token.colorBorder);
26
+ var img = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n img:not(", " img) {\n max-width: 100%;\n }\n\n > img,\n > p > img {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n "])), IGNORE_CLASSNAME);
27
+ var kbd = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n kbd:not(", " kbd) {\n cursor: default;\n\n display: inline-block;\n\n min-width: 1em;\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n\n font-family: ", ";\n font-size: 0.875em;\n font-weight: 500;\n line-height: 1;\n text-align: center;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: 0.25em;\n }\n "])), IGNORE_CLASSNAME, token.fontFamily, token.colorBgLayout, token.colorBorderSecondary);
28
+ var list = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n li:not(", " li) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n\n p {\n display: inline;\n }\n }\n\n ul:not(", " ul),\n ol:not(", " ol) {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n margin-inline-start: 1em;\n padding-inline-start: 0;\n list-style-position: outside;\n\n > ul,\n > ol {\n margin-block: 0;\n }\n\n > li {\n margin-inline-start: 1em;\n }\n }\n\n ol:not(", " ol) {\n list-style: auto;\n }\n\n ul:not(", " ul) {\n list-style-type: none;\n\n > li {\n &::before {\n content: '-';\n display: inline-block;\n margin-inline: -1em 0.5em;\n opacity: 0.5;\n }\n }\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
29
+ var p = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n p:not(", " kbd) {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 1em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 1em);\n }\n }\n "])), IGNORE_CLASSNAME);
30
+ var pre = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n pre:not(", " pre),\n [data-code-type='highlighter'] {\n white-space: break-spaces;\n border: none;\n\n > code {\n padding: 0 !important;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1.6;\n\n border: none !important;\n }\n }\n "])), IGNORE_CLASSNAME, token.fontFamilyCode);
31
+ var strong = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n strong:not(", " strong) {\n font-weight: 600;\n }\n "])), IGNORE_CLASSNAME);
32
+ var svg = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n svg:not(", " svg) {\n line-height: 1;\n }\n "])), IGNORE_CLASSNAME);
33
+ var table = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n table:not(", " table) {\n unicode-bidi: isolate;\n overflow: auto hidden;\n display: block;\n border-spacing: 0;\n border-collapse: collapse;\n\n box-sizing: border-box;\n width: max-content;\n max-width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n\n text-align: start;\n text-indent: initial;\n text-wrap: pretty;\n word-break: auto-phrase;\n overflow-wrap: break-word;\n\n background: ", ";\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n code {\n word-break: break-word;\n }\n\n thead {\n background: ", ";\n }\n\n tr {\n box-shadow: 0 1px 0 var(--lobe-markdown-border-color);\n }\n\n th,\n td {\n min-width: 120px;\n padding-block: 0.75em;\n padding-inline: 1em;\n text-align: start;\n }\n }\n "])), IGNORE_CLASSNAME, token.colorFillQuaternary, token.colorFillQuaternary);
34
+ var video = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n > video:not(", " video),\n > p:not(", " p) > video {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n\n video:not(", " video) {\n max-width: 100%;\n }\n "])), IGNORE_CLASSNAME, IGNORE_CLASSNAME, IGNORE_CLASSNAME);
35
+ return cx(__root, a, blockquote, code, details, header, hr, img, kbd, list, p, pre, strong, svg, table, video);
36
36
  });
@@ -1,9 +1,4 @@
1
- export declare const useStyles: (props?: {
2
- fontSize?: number | undefined;
3
- headerMultiple?: number | undefined;
4
- lineHeight?: number | undefined;
5
- marginMultiple?: number | undefined;
6
- } | undefined) => import("antd-style").ReturnStyles<{
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
7
2
  chat: import("antd-style").SerializedStyles;
8
3
  latex: import("antd-style").SerializedStyles;
9
4
  root: import("antd-style").SerializedStyles;
@@ -1,22 +1,14 @@
1
1
  var _templateObject, _templateObject2, _templateObject3;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import { createStyles } from 'antd-style';
4
- export var useStyles = createStyles(function (_ref, _ref2) {
4
+ export var useStyles = createStyles(function (_ref) {
5
5
  var css = _ref.css,
6
6
  token = _ref.token,
7
7
  isDarkMode = _ref.isDarkMode;
8
- var _ref2$fontSize = _ref2.fontSize,
9
- fontSize = _ref2$fontSize === void 0 ? 14 : _ref2$fontSize,
10
- _ref2$headerMultiple = _ref2.headerMultiple,
11
- headerMultiple = _ref2$headerMultiple === void 0 ? 0.25 : _ref2$headerMultiple,
12
- _ref2$marginMultiple = _ref2.marginMultiple,
13
- marginMultiple = _ref2$marginMultiple === void 0 ? 1 : _ref2$marginMultiple,
14
- _ref2$lineHeight = _ref2.lineHeight,
15
- lineHeight = _ref2$lineHeight === void 0 ? 1.6 : _ref2$lineHeight;
16
8
  var cyanColor = isDarkMode ? token.cyan9A : token.cyan11A;
17
9
  return {
18
- chat: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --lobe-markdown-font-size: ", "px;\n --lobe-markdown-header-multiple: ", ";\n --lobe-markdown-margin-multiple: ", ";\n --lobe-markdown-line-height: ", ";\n --lobe-markdown-border-radius: ", ";\n\n ol,\n ul {\n li {\n &::marker {\n color: ", " !important;\n }\n\n li {\n &::marker {\n color: ", " !important;\n }\n }\n }\n }\n\n ul {\n list-style: unset;\n\n li {\n &::before {\n content: unset;\n display: unset;\n }\n }\n }\n "])), fontSize, headerMultiple, marginMultiple, lineHeight, token.borderRadius, cyanColor, token.colorTextSecondary),
19
- latex: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .katex-html {\n overflow: auto hidden;\n padding: 3px;\n\n .base {\n margin-block: 0;\n margin-inline: auto;\n }\n\n .tag {\n position: relative !important;\n display: inline-block;\n padding-inline-start: 0.5rem;\n }\n }\n "]))),
20
- root: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n\n #footnote-label {\n display: none;\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n vertical-align: super !important;\n }\n "])))
10
+ chat: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --lobe-markdown-border-radius: ", ";\n\n ol,\n ul {\n > li {\n &::marker {\n color: ", " !important;\n }\n\n > li {\n &::marker {\n color: ", " !important;\n }\n }\n }\n }\n\n ul {\n list-style: unset;\n\n > li {\n &::before {\n content: unset;\n display: unset;\n }\n }\n }\n "])), token.borderRadius, cyanColor, token.colorTextSecondary),
11
+ latex: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .katex-html {\n overflow: auto hidden;\n padding: 3px;\n\n .base {\n margin-block: 0;\n margin-inline: auto;\n }\n\n .tag {\n position: relative !important;\n display: inline-block;\n padding-inline-start: 0.5rem;\n }\n }\n "]))),
12
+ root: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n\n #footnote-label {\n display: none;\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n vertical-align: super !important;\n }\n "])))
21
13
  };
22
14
  });
@@ -2,7 +2,7 @@ import { AlignVerticalSpaceAroundIcon, MinusIcon, PlusIcon } from 'lucide-react'
2
2
  import { memo } from 'react';
3
3
  import { Flexbox } from 'react-layout-kit';
4
4
  import { useControls } from 'react-zoom-pan-pinch';
5
- import ActionIcon from "../ActionIcon";
5
+ import ActionIcon from "../../ActionIcon";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
8
  var Controls = /*#__PURE__*/memo(function () {
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const MermaidContainer: import("react").NamedExoticComponent<{
3
+ children?: string | undefined;
4
+ }>;
5
+ export default MermaidContainer;