@lobehub/ui 2.11.9 → 2.12.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 (44) hide show
  1. package/es/Image/Image.js +2 -8
  2. package/es/Image/style.js +3 -3
  3. package/es/Markdown/Markdown.js +70 -77
  4. package/es/Markdown/Typography.js +4 -1
  5. package/es/{mdx/mdxComponents → Markdown/components}/Footnotes.d.ts +2 -2
  6. package/es/Markdown/components/Footnotes.js +120 -0
  7. package/es/Markdown/components/{SearchResultCard/index.js → SearchResultCards/SearchResultCard.js} +4 -2
  8. package/es/Markdown/components/SearchResultCards/index.js +7 -3
  9. package/es/Markdown/components/useDelayedAnimated.d.ts +1 -0
  10. package/es/Markdown/components/useDelayedAnimated.js +31 -0
  11. package/es/Markdown/markdown.style.js +12 -11
  12. package/es/Markdown/plugins/rehypeCustomFootnotes.d.ts +1 -0
  13. package/es/Markdown/plugins/{footnote.js → rehypeCustomFootnotes.js} +2 -34
  14. package/es/Markdown/plugins/rehypeStreamAnimated.d.ts +2 -0
  15. package/es/Markdown/plugins/{animated.js → rehypeStreamAnimated.js} +1 -1
  16. package/es/Markdown/plugins/remarkColor.d.ts +17 -0
  17. package/es/Markdown/plugins/remarkColor.js +188 -0
  18. package/es/Markdown/plugins/remarkCustomFootnotes.d.ts +6 -0
  19. package/es/Markdown/plugins/remarkCustomFootnotes.js +32 -0
  20. package/es/Markdown/plugins/remarkGfmPlus.d.ts +5 -0
  21. package/es/Markdown/plugins/remarkGfmPlus.js +140 -0
  22. package/es/Markdown/plugins/remarkVideo.d.ts +17 -0
  23. package/es/Markdown/plugins/remarkVideo.js +186 -0
  24. package/es/Markdown/style.d.ts +1 -0
  25. package/es/Markdown/style.js +5 -4
  26. package/es/Markdown/type.d.ts +1 -1
  27. package/es/Mermaid/SyntaxMermaid/index.js +4 -2
  28. package/es/Video/index.js +1 -1
  29. package/es/hooks/useMarkdown/useMarkdownComponents.js +65 -16
  30. package/es/hooks/useMarkdown/useMarkdownRehypePlugins.js +4 -4
  31. package/es/hooks/useMarkdown/useMarkdownRemarkPlugins.js +7 -3
  32. package/es/mdx/mdxComponents/Section.d.ts +0 -1
  33. package/es/mdx/mdxComponents/Section.js +1 -1
  34. package/package.json +2 -1
  35. package/es/Markdown/plugins/animated.d.ts +0 -2
  36. package/es/Markdown/plugins/footnote.d.ts +0 -2
  37. package/es/hooks/useMarkdown/fixMarkdownEmphasisSpacing.d.ts +0 -1
  38. package/es/hooks/useMarkdown/fixMarkdownEmphasisSpacing.js +0 -189
  39. package/es/mdx/mdxComponents/Footnotes.js +0 -44
  40. /package/es/Markdown/components/{SearchResultCard/index.d.ts → SearchResultCards/SearchResultCard.d.ts} +0 -0
  41. /package/es/Markdown/components/{SearchResultCard → SearchResultCards}/style.d.ts +0 -0
  42. /package/es/Markdown/components/{SearchResultCard → SearchResultCards}/style.js +0 -0
  43. /package/es/Markdown/plugins/{katexDir.d.ts → rehypeKatexDir.d.ts} +0 -0
  44. /package/es/Markdown/plugins/{katexDir.js → rehypeKatexDir.js} +0 -0
package/es/Image/Image.js CHANGED
@@ -102,16 +102,10 @@ var Image = /*#__PURE__*/memo(function (_ref) {
102
102
  preview: preview === false ? false : _objectSpread({
103
103
  mask: false
104
104
  }, mergePreivew),
105
- style: _objectSpread({
106
- height: 'auto',
107
- width: '100%'
108
- }, customStyles === null || customStyles === void 0 ? void 0 : customStyles.image),
105
+ style: _objectSpread({}, customStyles === null || customStyles === void 0 ? void 0 : customStyles.image),
109
106
  width: width,
110
107
  wrapperClassName: cx(styles.image, classNames === null || classNames === void 0 ? void 0 : classNames.wrapper),
111
- wrapperStyle: _objectSpread({
112
- height: 'auto',
113
- width: '100%'
114
- }, customStyles === null || customStyles === void 0 ? void 0 : customStyles.wrapper)
108
+ wrapperStyle: _objectSpread({}, customStyles === null || customStyles === void 0 ? void 0 : customStyles.wrapper)
115
109
  }, rest))]
116
110
  });
117
111
  });
package/es/Image/style.js CHANGED
@@ -24,12 +24,12 @@ export var useStyles = createStyles(function (_ref) {
24
24
  actions: actions,
25
25
  borderless: stylish.variantBorderlessWithoutHover,
26
26
  filled: cx(stylish.variantOutlinedWithoutHover, stylish.variantFilledWithoutHover),
27
- image: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n width: 100%;\n height: auto;\n\n .", "-image-img {\n width: 100%;\n min-width: ", ";\n max-width: ", ";\n height: auto;\n min-height: ", ";\n max-height: ", ";\n\n object-fit: ", ";\n }\n "])), prefixCls, MIN_WIDTH, MAX_WIDTH, MIN_HEIGHT, MAX_HEIGHT, objectFit || 'cover'),
27
+ image: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n height: auto;\n\n .", "-image-img {\n width: auto;\n min-width: ", ";\n max-width: ", ";\n height: auto;\n min-height: ", ";\n max-height: ", ";\n\n object-fit: ", ";\n }\n "])), prefixCls, MIN_WIDTH, MAX_WIDTH, MIN_HEIGHT, MAX_HEIGHT, objectFit || 'cover'),
28
28
  mask: cx(stylish.blur, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n backdrop-filter: blur(8px);\n "])))),
29
29
  outlined: stylish.variantOutlinedWithoutHover,
30
30
  preview: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n img {\n width: 100%;\n }\n "]))),
31
- root: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n cursor: pointer;\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n\n border-radius: ", "px;\n\n &:hover {\n .", " {\n opacity: 1;\n }\n }\n "])), token.borderRadius, actions),
32
- toolbar: cx(stylish.blur, stylish.variantOutlinedWithoutHover, css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 4px;\n border-radius: ", "px;\n background: ", ";\n "])), token.borderRadiusLG, rgba(token.colorBgMask, 0.5)))
31
+ root: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n cursor: pointer;\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n\n width: fit-content;\n border-radius: ", "px;\n\n line-height: 1;\n\n &:hover {\n .", " {\n opacity: 1;\n }\n }\n "])), token.borderRadius, actions),
32
+ toolbar: cx(stylish.blur, stylish.variantOutlinedWithoutHover, css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 4px;\n border-color: ", ";\n border-radius: ", "px;\n background: ", ";\n "])), token.colorFillTertiary, token.borderRadiusLG, rgba(token.colorBgMask, 0.5)))
33
33
  };
34
34
  });
35
35
  export var FALLBACK = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA2NDAgNDAwIj48cGF0aCBmaWxsPSIjM0IzQjNCIiBkPSJNMCAwaDY0MHY0MDBIMHoiLz48cGF0aCBzdHJva2U9IiM2MjYyNjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIxNSIgZD0iTTM3Mi41IDEzMi41aC0xMDVjLTguMjg0IDAtMTUgNi43MTYtMTUgMTV2MTA1YzAgOC4yODQgNi43MTYgMTUgMTUgMTVoMTA1YzguMjg0IDAgMTUtNi43MTYgMTUtMTV2LTEwNWMwLTguMjg0LTYuNzE2LTE1LTE1LTE1eiIvPjxwYXRoIHN0cm9rZT0iIzYyNjI2MiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjE1IiBkPSJNMjk3LjUgMTkyLjVjOC4yODQgMCAxNS02LjcxNiAxNS0xNSAwLTguMjg0LTYuNzE2LTE1LTE1LTE1LTguMjg0IDAtMTUgNi43MTYtMTUgMTUgMCA4LjI4NCA2LjcxNiAxNSAxNSAxNXpNMzg3LjUgMjIyLjUwMmwtMjMuMTQ1LTIzLjE0NWExNS4wMDEgMTUuMDAxIDAgMDAtMjEuMjEgMEwyNzUgMjY3LjUwMiIvPjwvc3ZnPg==';
@@ -1,95 +1,74 @@
1
1
  'use client';
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
- var _excluded = ["ref", "children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "animated", "enableLatex", "enableMermaid", "enableImageGallery", "enableCustomFootnotes", "enableGithubAlert", "enableStream", "componentProps", "allowHtml", "fontSize", "headerMultiple", "marginMultiple", "showFootnotes", "variant", "reactMarkdownProps", "lineHeight", "rehypePlugins", "remarkPlugins", "remarkPluginsAhead", "components", "customRender", "citations"];
4
+ var _excluded = ["ref", "children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "animated", "enableLatex", "enableMermaid", "enableImageGallery", "enableCustomFootnotes", "enableGithubAlert", "enableStream", "componentProps", "allowHtml", "borderRadius", "fontSize", "headerMultiple", "marginMultiple", "variant", "reactMarkdownProps", "lineHeight", "rehypePlugins", "remarkPlugins", "remarkPluginsAhead", "components", "customRender", "citations"];
5
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
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
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; }
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
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); }
10
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
- 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); }
13
- 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; }
14
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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
12
  import { cva } from 'class-variance-authority';
19
- import { memo, useEffect, useMemo, useState } from 'react';
13
+ import { memo, useCallback, useMemo } from 'react';
20
14
  import { PreviewGroup } from "../Image";
21
- import { MarkdownProvider } from "./components/MarkdownProvider";
22
15
  import { MarkdownRender, StreamdownRender } from "./SyntaxMarkdown";
23
16
  import Typography from "./Typography";
17
+ import { MarkdownProvider } from "./components/MarkdownProvider";
18
+ import { useDelayedAnimated } from "./components/useDelayedAnimated";
24
19
  import { useStyles } from "./style";
25
20
  import { jsx as _jsx } from "react/jsx-runtime";
26
- var Markdown = /*#__PURE__*/memo(function (_ref) {
27
- var ref = _ref.ref,
28
- _ref$children = _ref.children,
29
- children = _ref$children === void 0 ? '' : _ref$children,
30
- className = _ref.className,
31
- style = _ref.style,
32
- fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock,
33
- onDoubleClick = _ref.onDoubleClick,
34
- animated = _ref.animated,
35
- _ref$enableLatex = _ref.enableLatex,
36
- enableLatex = _ref$enableLatex === void 0 ? true : _ref$enableLatex,
37
- _ref$enableMermaid = _ref.enableMermaid,
38
- enableMermaid = _ref$enableMermaid === void 0 ? true : _ref$enableMermaid,
39
- enableImageGallery = _ref.enableImageGallery,
40
- enableCustomFootnotes = _ref.enableCustomFootnotes,
41
- enableGithubAlert = _ref.enableGithubAlert,
42
- _ref$enableStream = _ref.enableStream,
43
- enableStream = _ref$enableStream === void 0 ? true : _ref$enableStream,
44
- componentProps = _ref.componentProps,
45
- allowHtml = _ref.allowHtml,
46
- _ref$fontSize = _ref.fontSize,
47
- fontSize = _ref$fontSize === void 0 ? 14 : _ref$fontSize,
48
- _ref$headerMultiple = _ref.headerMultiple,
49
- headerMultiple = _ref$headerMultiple === void 0 ? 0.25 : _ref$headerMultiple,
50
- marginMultiple = _ref.marginMultiple,
51
- showFootnotes = _ref.showFootnotes,
52
- _ref$variant = _ref.variant,
53
- variant = _ref$variant === void 0 ? 'default' : _ref$variant,
54
- reactMarkdownProps = _ref.reactMarkdownProps,
55
- _ref$lineHeight = _ref.lineHeight,
56
- lineHeight = _ref$lineHeight === void 0 ? 1.6 : _ref$lineHeight,
57
- rehypePlugins = _ref.rehypePlugins,
58
- remarkPlugins = _ref.remarkPlugins,
59
- remarkPluginsAhead = _ref.remarkPluginsAhead,
60
- _ref$components = _ref.components,
61
- components = _ref$components === void 0 ? {} : _ref$components,
62
- customRender = _ref.customRender,
63
- citations = _ref.citations,
64
- rest = _objectWithoutProperties(_ref, _excluded);
21
+ var Markdown = /*#__PURE__*/memo(function (props) {
22
+ var ref = props.ref,
23
+ _props$children = props.children,
24
+ children = _props$children === void 0 ? '' : _props$children,
25
+ className = props.className,
26
+ style = props.style,
27
+ fullFeaturedCodeBlock = props.fullFeaturedCodeBlock,
28
+ onDoubleClick = props.onDoubleClick,
29
+ animated = props.animated,
30
+ _props$enableLatex = props.enableLatex,
31
+ enableLatex = _props$enableLatex === void 0 ? true : _props$enableLatex,
32
+ _props$enableMermaid = props.enableMermaid,
33
+ enableMermaid = _props$enableMermaid === void 0 ? true : _props$enableMermaid,
34
+ enableImageGallery = props.enableImageGallery,
35
+ enableCustomFootnotes = props.enableCustomFootnotes,
36
+ enableGithubAlert = props.enableGithubAlert,
37
+ _props$enableStream = props.enableStream,
38
+ enableStream = _props$enableStream === void 0 ? true : _props$enableStream,
39
+ componentProps = props.componentProps,
40
+ allowHtml = props.allowHtml,
41
+ _props$borderRadius = props.borderRadius,
42
+ borderRadius = _props$borderRadius === void 0 ? props.variant === 'chat' ? 4 : undefined : _props$borderRadius,
43
+ _props$fontSize = props.fontSize,
44
+ fontSize = _props$fontSize === void 0 ? props.variant === 'chat' ? 14 : undefined : _props$fontSize,
45
+ _props$headerMultiple = props.headerMultiple,
46
+ headerMultiple = _props$headerMultiple === void 0 ? props.variant === 'chat' ? 0.25 : undefined : _props$headerMultiple,
47
+ _props$marginMultiple = props.marginMultiple,
48
+ marginMultiple = _props$marginMultiple === void 0 ? props.variant === 'chat' ? 1 : undefined : _props$marginMultiple,
49
+ _props$variant = props.variant,
50
+ variant = _props$variant === void 0 ? 'default' : _props$variant,
51
+ reactMarkdownProps = props.reactMarkdownProps,
52
+ _props$lineHeight = props.lineHeight,
53
+ lineHeight = _props$lineHeight === void 0 ? props.variant === 'chat' ? 1.6 : undefined : _props$lineHeight,
54
+ rehypePlugins = props.rehypePlugins,
55
+ remarkPlugins = props.remarkPlugins,
56
+ remarkPluginsAhead = props.remarkPluginsAhead,
57
+ _props$components = props.components,
58
+ components = _props$components === void 0 ? {} : _props$components,
59
+ customRender = props.customRender,
60
+ citations = props.citations,
61
+ rest = _objectWithoutProperties(props, _excluded);
65
62
  var _useStyles = useStyles(),
66
63
  cx = _useStyles.cx,
67
64
  styles = _useStyles.styles;
68
- var _useState = useState(animated),
69
- _useState2 = _slicedToArray(_useState, 2),
70
- delayedAnimated = _useState2[0],
71
- setDelayedAnimated = _useState2[1];
72
-
73
- // Watch for changes in animated prop
74
- useEffect(function () {
75
- // If animated changes from true to false, delay the update by 1 second
76
- if (animated === false && delayedAnimated === true) {
77
- var timer = setTimeout(function () {
78
- setDelayedAnimated(false);
79
- }, 1000);
80
- return function () {
81
- return clearTimeout(timer);
82
- };
83
- } else {
84
- // For any other changes, update immediately
85
- setDelayedAnimated(animated);
86
- }
87
- }, [animated, delayedAnimated]);
65
+ var delayedAnimated = useDelayedAnimated(animated);
88
66
 
89
67
  // Style variant handling
90
68
  var variants = useMemo(function () {
91
69
  return cva(styles.root, {
92
70
  defaultVariants: {
71
+ enableGfm: true,
93
72
  enableLatex: true,
94
73
  variant: 'default'
95
74
  },
@@ -102,18 +81,31 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
102
81
  enableLatex: {
103
82
  true: styles.latex,
104
83
  false: null
84
+ },
85
+ enableGfm: {
86
+ true: styles.gfm,
87
+ false: null
105
88
  }
106
89
  }
107
90
  /* eslint-enable sort-keys-fix/sort-keys-fix */
108
91
  });
109
92
  }, [styles]);
110
- var DefaultRender = enableStream && delayedAnimated ? StreamdownRender : MarkdownRender;
111
- var defaultDOM = /*#__PURE__*/_jsx(DefaultRender, _objectSpread(_objectSpread({}, reactMarkdownProps), {}, {
112
- children: children
113
- }));
93
+ var Render = useCallback(function (_ref) {
94
+ var enableStream = _ref.enableStream,
95
+ children = _ref.children,
96
+ reactMarkdownProps = _ref.reactMarkdownProps;
97
+ var DefaultRender = enableStream && delayedAnimated ? StreamdownRender : MarkdownRender;
98
+ var defaultDOM = /*#__PURE__*/_jsx(DefaultRender, _objectSpread(_objectSpread({}, reactMarkdownProps), {}, {
99
+ children: children
100
+ }));
101
+ return customRender ? customRender(defaultDOM, {
102
+ text: children
103
+ }) : defaultDOM;
104
+ }, [customRender]);
114
105
  return /*#__PURE__*/_jsx(PreviewGroup, {
115
106
  enable: enableImageGallery,
116
107
  children: /*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
108
+ borderRadius: borderRadius,
117
109
  className: cx(variants({
118
110
  enableLatex: enableLatex,
119
111
  variant: variant
@@ -122,7 +114,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
122
114
  fontSize: fontSize,
123
115
  headerMultiple: headerMultiple,
124
116
  lineHeight: lineHeight,
125
- marginMultiple: marginMultiple || (variant === 'chat' ? 1 : 2),
117
+ marginMultiple: marginMultiple,
126
118
  onDoubleClick: onDoubleClick,
127
119
  ref: ref,
128
120
  style: style
@@ -142,12 +134,13 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
142
134
  rehypePlugins: rehypePlugins,
143
135
  remarkPlugins: remarkPlugins,
144
136
  remarkPluginsAhead: remarkPluginsAhead,
145
- showFootnotes: showFootnotes,
146
137
  variant: variant
147
138
  },
148
- children: customRender ? customRender(defaultDOM, {
149
- text: children
150
- }) : defaultDOM
139
+ children: /*#__PURE__*/_jsx(Render, {
140
+ enableStream: enableStream,
141
+ reactMarkdownProps: reactMarkdownProps,
142
+ children: children
143
+ })
151
144
  })
152
145
  }))
153
146
  });
@@ -1,7 +1,7 @@
1
1
  'use client';
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
- var _excluded = ["ref", "children", "className", "fontSize", "headerMultiple", "marginMultiple", "lineHeight", "style"];
4
+ var _excluded = ["ref", "children", "className", "fontSize", "headerMultiple", "marginMultiple", "lineHeight", "borderRadius", "style"];
5
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
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
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; }
@@ -24,6 +24,8 @@ var Typography = /*#__PURE__*/memo(function (_ref) {
24
24
  marginMultiple = _ref$marginMultiple === void 0 ? 2 : _ref$marginMultiple,
25
25
  _ref$lineHeight = _ref.lineHeight,
26
26
  lineHeight = _ref$lineHeight === void 0 ? 1.8 : _ref$lineHeight,
27
+ _ref$borderRadius = _ref.borderRadius,
28
+ borderRadius = _ref$borderRadius === void 0 ? 8 : _ref$borderRadius,
27
29
  style = _ref.style,
28
30
  rest = _objectWithoutProperties(_ref, _excluded);
29
31
  var _useStyles = useStyles(),
@@ -34,6 +36,7 @@ var Typography = /*#__PURE__*/memo(function (_ref) {
34
36
  ref: ref,
35
37
  style: _objectSpread({
36
38
  // @ts-ignore
39
+ '--lobe-markdown-border-radius': borderRadius,
37
40
  '--lobe-markdown-font-size': "".concat(fontSize, "px"),
38
41
  '--lobe-markdown-header-multiple': headerMultiple,
39
42
  '--lobe-markdown-line-height': lineHeight,
@@ -1,8 +1,8 @@
1
- import { type FC, type ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface FootnotesProps {
3
3
  'children': ReactNode;
4
4
  'data-footnote-links'?: string;
5
5
  'data-footnotes'?: boolean;
6
6
  }
7
- declare const Footnotes: FC<FootnotesProps>;
7
+ declare const Footnotes: import("react").NamedExoticComponent<FootnotesProps>;
8
8
  export default Footnotes;
@@ -0,0 +1,120 @@
1
+ 'use client';
2
+
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
+ var _excluded = ["node"],
5
+ _excluded2 = ["children"];
6
+ 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; }
7
+ 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; }
8
+ 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; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
+ 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); }
11
+ 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; }
12
+ 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; }
13
+ import { memo, useMemo } from 'react';
14
+ import { Flexbox } from 'react-layout-kit';
15
+ import A from "../../A";
16
+ import Block from "../../Block";
17
+ import Text from "../../Text";
18
+ import SearchResultCards from "./SearchResultCards";
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { createElement as _createElement } from "react";
22
+ var DefaultFootnotes = /*#__PURE__*/memo(function (_ref) {
23
+ var dataSource = _ref.dataSource;
24
+ var items = useMemo(function () {
25
+ var _dataSource$find;
26
+ return (_dataSource$find = dataSource.find(function (child) {
27
+ return (child === null || child === void 0 ? void 0 : child.type) === 'ol';
28
+ })) === null || _dataSource$find === void 0 || (_dataSource$find = _dataSource$find.props) === null || _dataSource$find === void 0 || (_dataSource$find = _dataSource$find.children) === null || _dataSource$find === void 0 ? void 0 : _dataSource$find.map(function (item) {
29
+ var _item$props, _data$;
30
+ if (typeof item === 'string' || (item === null || item === void 0 ? void 0 : item.type) !== 'li') return false;
31
+ var data = item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 || (_item$props = _item$props.children) === null || _item$props === void 0 || (_item$props = _item$props.find(function (note) {
32
+ var _note$props;
33
+ return note === null || note === void 0 || (_note$props = note.props) === null || _note$props === void 0 ? void 0 : _note$props.children;
34
+ })) === null || _item$props === void 0 || (_item$props = _item$props.props) === null || _item$props === void 0 ? void 0 : _item$props.children;
35
+ if (!data || !Array.isArray(data)) return false;
36
+ return {
37
+ children: data[0],
38
+ props: ((_data$ = data[1]) === null || _data$ === void 0 ? void 0 : _data$.props) || {}
39
+ };
40
+ }).filter(Boolean);
41
+ }, [dataSource]);
42
+ if (!Array.isArray(items)) return null;
43
+ return /*#__PURE__*/_jsx(Flexbox, {
44
+ align: 'flex-start',
45
+ as: 'section',
46
+ className: 'footnotes',
47
+ "data-footnotes": "true",
48
+ gap: '0.5em',
49
+ horizontal: true,
50
+ justify: 'flex-start',
51
+ wrap: 'wrap',
52
+ children: items.map(function (_ref2, index) {
53
+ var children = _ref2.children,
54
+ props = _ref2.props;
55
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
56
+ var node = props.node,
57
+ rest = _objectWithoutProperties(props, _excluded);
58
+ return /*#__PURE__*/_createElement(A, _objectSpread(_objectSpread({}, rest), {}, {
59
+ key: index
60
+ }), /*#__PURE__*/_jsxs(Block, {
61
+ align: 'stretch',
62
+ horizontal: true,
63
+ style: {
64
+ overflow: 'hidden',
65
+ position: 'relative'
66
+ },
67
+ variant: 'outlined',
68
+ children: [/*#__PURE__*/_jsx(Block, {
69
+ paddingInline: '0.66em',
70
+ style: {
71
+ borderRadius: 0
72
+ },
73
+ variant: 'filled',
74
+ children: /*#__PURE__*/_jsx(Text, {
75
+ as: "span",
76
+ code: true,
77
+ type: 'secondary',
78
+ children: index + 1
79
+ })
80
+ }), /*#__PURE__*/_jsx(Text, {
81
+ as: "span",
82
+ style: {
83
+ paddingInline: '0.66em'
84
+ },
85
+ type: 'secondary',
86
+ children: children
87
+ })]
88
+ }));
89
+ })
90
+ });
91
+ });
92
+ var Footnotes = /*#__PURE__*/memo(function (_ref3) {
93
+ var children = _ref3.children,
94
+ rest = _objectWithoutProperties(_ref3, _excluded2);
95
+ var links = useMemo(function () {
96
+ try {
97
+ return JSON.parse(rest['data-footnote-links'] || '');
98
+ } catch (error) {
99
+ console.error(error);
100
+ return [];
101
+ }
102
+ }, [rest['data-footnote-links']]);
103
+ var isError = links.length === 0;
104
+ if (!children) return;
105
+ if (isError) {
106
+ if (!Array.isArray(children)) return children;
107
+ return /*#__PURE__*/_jsx(DefaultFootnotes, {
108
+ dataSource: children
109
+ });
110
+ }
111
+ return /*#__PURE__*/_jsx("section", {
112
+ className: 'footnotes',
113
+ "data-footnotes": "true",
114
+ children: /*#__PURE__*/_jsx(SearchResultCards, {
115
+ dataSource: links
116
+ })
117
+ });
118
+ });
119
+ Footnotes.displayName = 'Footnotes';
120
+ export default Footnotes;
@@ -17,7 +17,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
17
17
  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
18
  import { memo, useMemo } from 'react';
19
19
  import { Flexbox } from 'react-layout-kit';
20
+ import A from "../../../A";
20
21
  import Block from "../../../Block";
22
+ import Img from "../../../Img";
21
23
  import Text from "../../../Text";
22
24
  import { useStyles } from "./style";
23
25
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -48,7 +50,7 @@ var SearchResultCard = /*#__PURE__*/memo(function (_ref) {
48
50
  displayTitle = _useMemo2[0],
49
51
  domain = _useMemo2[1],
50
52
  host = _useMemo2[2];
51
- return /*#__PURE__*/_jsx("a", _objectSpread(_objectSpread({
53
+ return /*#__PURE__*/_jsx(A, _objectSpread(_objectSpread({
52
54
  href: url,
53
55
  ref: ref,
54
56
  rel: "noreferrer",
@@ -71,7 +73,7 @@ var SearchResultCard = /*#__PURE__*/memo(function (_ref) {
71
73
  align: 'center',
72
74
  gap: 4,
73
75
  horizontal: true,
74
- children: [/*#__PURE__*/_jsx("img", {
76
+ children: [/*#__PURE__*/_jsx(Img, {
75
77
  alt: alt || title || url,
76
78
  height: 14,
77
79
  src: "https://icons.duckduckgo.com/ip3/".concat(host, ".ico"),
@@ -10,21 +10,25 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
10
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; }
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 { memo } from 'react';
13
- import { Flexbox } from 'react-layout-kit';
14
- import SearchResultCard from "../SearchResultCard";
13
+ import ScrollShadow from "../../../ScrollShadow";
14
+ import SearchResultCard from "./SearchResultCard";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  var SearchResultCards = /*#__PURE__*/memo(function (_ref) {
17
17
  var ref = _ref.ref,
18
18
  dataSource = _ref.dataSource,
19
19
  style = _ref.style,
20
20
  rest = _objectWithoutProperties(_ref, _excluded);
21
- return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
21
+ return /*#__PURE__*/_jsx(ScrollShadow, _objectSpread(_objectSpread({
22
22
  gap: 12,
23
+ hideScrollBar: true,
23
24
  horizontal: true,
25
+ orientation: 'horizontal',
24
26
  ref: ref,
27
+ size: 10,
25
28
  style: _objectSpread({
26
29
  minHeight: 80,
27
30
  overflowX: 'scroll',
31
+ paddingInlineEnd: 24,
28
32
  width: '100%'
29
33
  }, style)
30
34
  }, rest), {}, {
@@ -0,0 +1 @@
1
+ export declare const useDelayedAnimated: (animated?: boolean) => boolean | undefined;
@@ -0,0 +1,31 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ 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); }
4
+ 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; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useEffect, useState } from 'react';
8
+ export var useDelayedAnimated = function useDelayedAnimated(animated) {
9
+ var _useState = useState(animated),
10
+ _useState2 = _slicedToArray(_useState, 2),
11
+ delayedAnimated = _useState2[0],
12
+ setDelayedAnimated = _useState2[1];
13
+
14
+ // Watch for changes in animated prop
15
+ useEffect(function () {
16
+ if (animated === undefined) return;
17
+ // If animated changes from true to false, delay the update by 1 second
18
+ if (animated === false && delayedAnimated === true) {
19
+ var timer = setTimeout(function () {
20
+ setDelayedAnimated(false);
21
+ }, 1000);
22
+ return function () {
23
+ return clearTimeout(timer);
24
+ };
25
+ } else {
26
+ // For any other changes, update immediately
27
+ setDelayedAnimated(animated);
28
+ }
29
+ }, [animated, delayedAnimated]);
30
+ return delayedAnimated;
31
+ };
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
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
4
  var IGNORE_CLASSNAME = '.ignore-markdown-style';
@@ -14,16 +14,17 @@ export var useStyles = createStyles(function (_ref) {
14
14
  var header = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n 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 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2 {\n font-size: calc(var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple)));\n }\n\n h3 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5,\n h6 {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])));
15
15
  var hr = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n hr {\n width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1.5em);\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 "])), token.colorBorder);
16
16
  var img = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n img {\n max-width: 100%;\n }\n\n > img,\n > p > img {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n "])));
17
- var kbd = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n 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 border: 1px solid ", ";\n border-radius: 0.25em;\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 }\n "])), token.colorBorderSecondary, token.fontFamily, token.colorBgLayout);
18
- var list = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n li {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n\n p:first-child {\n display: inline;\n }\n }\n\n ul,\n ol {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\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 {\n list-style: auto;\n }\n\n ul {\n list-style-type: none;\n\n > li {\n &::before {\n content: '-';\n\n position: absolute;\n\n display: inline-block;\n\n margin-inline: -1em 0.5em;\n\n opacity: 0.5;\n }\n }\n }\n "])));
19
- var p = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n p {\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) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])));
20
- var pre = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n pre {\n font-size: calc(var(--lobe-markdown-font-size) * 0.85);\n }\n "])));
21
- var strong = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n strong {\n font-weight: 600;\n }\n "])));
22
- var svg = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n svg {\n line-height: 1;\n }\n "])));
23
- var table = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n 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) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\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 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 "])), token.colorFillQuaternary, token.colorFillQuaternary);
24
- var video = css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n > video,\n > p > video {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\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 {\n max-width: 100%;\n }\n "])));
25
- var gfm = css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n .markdown-alert {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-start: 1em;\n border-inline-start: solid 4px ", ";\n\n > p {\n margin-block-start: 0 !important;\n }\n }\n\n .markdown-alert > :first-child {\n margin-block-start: 0;\n }\n\n .markdown-alert > :last-child {\n margin-block-end: 0;\n }\n\n .markdown-alert-note {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-tip {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-important {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-warning {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-caution {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-title {\n display: flex;\n align-items: center;\n margin-block-end: 0.5em !important;\n font-weight: 500;\n }\n\n .markdown-alert-note .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-tip .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-important .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-warning .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-caution .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .octicon {\n overflow: visible !important;\n display: inline-block;\n margin-inline-end: 0.5em;\n vertical-align: text-bottom;\n }\n\n .task-list-item {\n &::before {\n display: none !important;\n }\n\n input[type='checkbox'] {\n margin-block: 0 0.25em;\n margin-inline: -1.6em 0.2em;\n vertical-align: middle;\n }\n\n input[type='checkbox']:dir(rtl) {\n margin: 0 -1.6em 0.25em 0.2em;\n }\n }\n\n /* Style the footnotes section. */\n\n .footnotes {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 1em);\n font-size: smaller;\n color: #8b949e;\n\n #footnote-label {\n display: none;\n }\n\n > ol {\n margin: 0 !important;\n }\n }\n\n .sr-only {\n position: absolute;\n\n overflow: hidden;\n\n width: 1px;\n height: 1px;\n padding: 0;\n border: 0;\n\n word-wrap: normal;\n\n clip: rect(0, 0, 0, 0);\n }\n\n sup {\n line-height: var(--lobe-markdown-line-height);\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n margin-inline: 2px;\n vertical-align: super !important;\n\n [data-footnote-ref] {\n display: inline-block;\n\n width: 16px;\n height: 16px;\n border-radius: 4px;\n\n font-family: ", ";\n font-size: 10px;\n color: ", " !important;\n text-align: center;\n\n background: ", ";\n }\n }\n "])), token.colorBorder, token.colorInfo, token.colorSuccess, token.purple, token.colorWarning, token.colorError, token.colorInfo, token.colorInfo, token.colorSuccess, token.colorSuccess, token.purple, token.purple, token.colorWarning, token.colorWarning, token.colorError, token.colorError, token.fontFamilyCode, token.colorTextSecondary, token.colorFillSecondary);
17
+ var list = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n li {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n\n p:first-child {\n display: inline;\n }\n }\n\n ul,\n ol {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\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 {\n list-style: auto;\n }\n\n ul {\n list-style-type: none;\n\n > li {\n &::before {\n content: '-';\n\n position: absolute;\n\n display: inline-block;\n\n margin-inline: -1em 0.5em;\n\n opacity: 0.5;\n }\n }\n }\n\n .task-list-item {\n &::before {\n display: none !important;\n }\n\n input[type='checkbox'] {\n margin-block: 0 0.25em;\n margin-inline: -1.6em 0.2em;\n vertical-align: middle;\n }\n\n input[type='checkbox']:dir(rtl) {\n margin: 0 -1.6em 0.25em 0.2em;\n }\n }\n "])));
18
+ var p = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n p {\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) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])));
19
+ var pre = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n pre {\n font-size: calc(var(--lobe-markdown-font-size) * 0.85);\n }\n "])));
20
+ var strong = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n strong {\n font-weight: 600;\n }\n "])));
21
+ var svg = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n svg {\n line-height: 1;\n }\n "])));
22
+ var table = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n 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) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\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 box-shadow: 0 0 0 1px ", ";\n\n code {\n word-break: break-word;\n }\n\n thead {\n background: ", ";\n }\n\n tr {\n box-shadow: 0 1px 0 ", ";\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 "])), token.colorFillQuaternary, token.colorBorderSecondary, token.colorFillQuaternary, token.colorBorderSecondary);
23
+ var video = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n > video,\n > p > video {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\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 {\n max-width: 100%;\n }\n "])));
24
+ var footnote = css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n .footnotes {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 1em);\n font-size: smaller;\n color: #8b949e;\n\n #footnote-label {\n display: none;\n }\n\n > ol {\n margin: 0 !important;\n }\n }\n "])));
25
+ var sup = css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n sup {\n position: relative;\n inset-block-start: -0.25em;\n\n font-size: 0.75em;\n line-height: var(--lobe-markdown-line-height);\n vertical-align: baseline;\n }\n "])));
26
+ var sub = css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n sub {\n position: relative;\n inset-block-end: -0.25em;\n\n font-size: 0.75em;\n line-height: var(--lobe-markdown-line-height);\n vertical-align: baseline;\n }\n "])));
26
27
  return {
27
- root: css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n :not(:has(", ")),\n .markdown {\n ", "\n }\n "])), IGNORE_CLASSNAME, [__root, a, blockquote, code, del, details, header, hr, img, kbd, list, p, pre, strong, svg, table, video, gfm])
28
+ root: css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n :not(:has(", ")),\n .markdown {\n ", "\n }\n "])), IGNORE_CLASSNAME, [__root, a, blockquote, code, del, details, header, hr, img, list, p, pre, strong, svg, table, video, footnote, sub, sup])
28
29
  };
29
30
  });
@@ -0,0 +1 @@
1
+ export declare const rehypeCustomFootnotes: () => (tree: any, file: any) => void;
@@ -10,41 +10,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
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
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { SKIP, visit } from 'unist-util-visit';
13
+ import { visit } from 'unist-util-visit';
14
14
  // eslint-disable-next-line unicorn/consistent-function-scoping
15
- export var remarkCustomFootnotes = function remarkCustomFootnotes() {
16
- return function (tree, file) {
17
- var footnoteLinks = new Map();
18
- visit(tree, 'footnoteDefinition', function (node) {
19
- var linkData = null;
20
-
21
- // 查找第一个link类型的子节点
22
- visit(node, 'link', function (linkNode) {
23
- if (linkData) return SKIP; // 只取第一个链接
24
-
25
- // 提取链接文本
26
- var textNode = linkNode.children.find(function (n) {
27
- return n.type === 'text';
28
- });
29
- linkData = {
30
- alt: (textNode === null || textNode === void 0 ? void 0 : textNode.value) || '',
31
- title: (textNode === null || textNode === void 0 ? void 0 : textNode.value) || '',
32
- url: linkNode.url // 或者根据需求处理
33
- };
34
- return SKIP; // 找到后停止遍历
35
- });
36
- if (linkData) {
37
- footnoteLinks.set(node.identifier, linkData);
38
- }
39
- });
40
-
41
- // 将数据存入文件上下文
42
- file.data.footnoteLinks = Object.fromEntries(footnoteLinks);
43
- };
44
- };
45
-
46
- // eslint-disable-next-line unicorn/consistent-function-scoping
47
- export var rehypeFootnoteLinks = function rehypeFootnoteLinks() {
15
+ export var rehypeCustomFootnotes = function rehypeCustomFootnotes() {
48
16
  return function (tree, file) {
49
17
  var linksData = file.data.footnoteLinks || {};
50
18
  visit(tree, 'element', function (node) {