@lobehub/ui 1.157.0 → 1.157.1

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.
@@ -34,23 +34,24 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
34
34
  var _useStyles = useStyles(type),
35
35
  styles = _useStyles.styles,
36
36
  cx = _useStyles.cx;
37
+ var tirmedChildren = children.trim();
37
38
  var originalActions = copyable && /*#__PURE__*/_jsx(CopyButton, {
38
- content: children,
39
+ content: tirmedChildren,
39
40
  placement: "left",
40
41
  size: copyButtonSize
41
42
  });
42
43
  var actions = actionsRender ? actionsRender({
43
44
  actionIconSize: copyButtonSize,
44
- content: children,
45
+ content: tirmedChildren,
45
46
  language: language,
46
47
  originalNode: originalActions
47
48
  }) : originalActions;
48
49
  var originalBody = /*#__PURE__*/_jsx(SyntaxHighlighter, {
49
50
  language: language === null || language === void 0 ? void 0 : language.toLowerCase(),
50
- children: children
51
+ children: tirmedChildren
51
52
  });
52
53
  var body = bodyRender ? bodyRender({
53
- content: children,
54
+ content: tirmedChildren,
54
55
  language: language,
55
56
  originalNode: originalBody
56
57
  }) : originalBody;
@@ -64,7 +65,7 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
64
65
  type: type,
65
66
  wrap: wrap
66
67
  }, rest), {}, {
67
- children: children
68
+ children: tirmedChildren
68
69
  }));
69
70
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
70
71
  className: cx(styles.container, !wrap && styles.nowrap, className),
@@ -26,6 +26,7 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
26
26
  var _useStyles = useStyles(type),
27
27
  styles = _useStyles.styles,
28
28
  cx = _useStyles.cx;
29
+ var tirmedChildren = children.trim();
29
30
  return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
30
31
  align: 'center',
31
32
  className: cx(styles.container, className),
@@ -34,9 +35,9 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
34
35
  }, rest), {}, {
35
36
  children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
36
37
  language: language,
37
- children: [symbol, children].filter(Boolean).join(' ')
38
+ children: [symbol, tirmedChildren].filter(Boolean).join(' ')
38
39
  }), copyable && /*#__PURE__*/_jsx(CopyButton, {
39
- content: children,
40
+ content: tirmedChildren,
40
41
  size: {
41
42
  blockSize: 24,
42
43
  fontSize: 14
@@ -12,6 +12,7 @@ export interface MdxProps extends Omit<TypographyProps, 'children'> {
12
12
  onDoubleClick?: () => void;
13
13
  rehypePlugins?: Pluggable[];
14
14
  remarkPlugins?: Pluggable[];
15
+ variant?: 'normal' | 'chat';
15
16
  }
16
17
  declare const Mdx: import("react").NamedExoticComponent<MdxProps>;
17
18
  export default Mdx;
@@ -6,7 +6,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
6
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
7
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
8
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
9
- var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock", "enableLatex", "enableMermaid", "rehypePlugins", "remarkPlugins", "components", "fallback"];
9
+ var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock", "enableLatex", "enableMermaid", "rehypePlugins", "remarkPlugins", "components", "fallback", "fontSize", "headerMultiple", "lineHeight", "marginMultiple", "variant"];
10
10
  import { evaluate } from '@mdx-js/mdx';
11
11
  import { memo, useEffect, useMemo, useState } from 'react';
12
12
  import jsxDevRuntime from 'react/jsx-dev-runtime';
@@ -16,6 +16,7 @@ import remarkGfm from 'remark-gfm';
16
16
  import remarkMath from 'remark-math';
17
17
  import Alert from "../../Alert";
18
18
  import { Typography } from "../../Markdown/Typography";
19
+ import { useStyles } from "../../Markdown/style";
19
20
  import { escapeBrackets, escapeMhchem, fixMarkdownBold } from "../../Markdown/utils";
20
21
  import mdxComponents from "../mdxComponents";
21
22
  import CodeBlock from "../mdxComponents/CodeBlock";
@@ -37,7 +38,21 @@ var Mdx = /*#__PURE__*/memo(function (_ref) {
37
38
  components = _ref$components === void 0 ? {} : _ref$components,
38
39
  _ref$fallback = _ref.fallback,
39
40
  fallback = _ref$fallback === void 0 ? null : _ref$fallback,
41
+ fontSize = _ref.fontSize,
42
+ headerMultiple = _ref.headerMultiple,
43
+ lineHeight = _ref.lineHeight,
44
+ marginMultiple = _ref.marginMultiple,
45
+ variant = _ref.variant,
40
46
  rest = _objectWithoutProperties(_ref, _excluded);
47
+ var _useStyles = useStyles({
48
+ fontSize: fontSize,
49
+ headerMultiple: headerMultiple,
50
+ lineHeight: lineHeight,
51
+ marginMultiple: marginMultiple
52
+ }),
53
+ cx = _useStyles.cx,
54
+ styles = _useStyles.styles;
55
+ var isChatMode = variant === 'chat';
41
56
  var _useState = useState(function () {
42
57
  return function () {
43
58
  return null;
@@ -124,7 +139,7 @@ var Mdx = /*#__PURE__*/memo(function (_ref) {
124
139
  }, [escapedContent, memoRehypePlugins, memoRemarkPlugins]);
125
140
  if (!MDXContent) return fallback;
126
141
  return /*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
127
- className: className,
142
+ className: cx(enableLatex && styles.latex, isChatMode && styles.chat, className),
128
143
  style: style
129
144
  }, rest), {}, {
130
145
  children: /*#__PURE__*/_jsx(MDXContent, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.157.0",
3
+ "version": "1.157.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",