@lobehub/ui 1.86.3 → 1.87.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.
@@ -28,6 +28,7 @@ var Loading = /*#__PURE__*/memo(function (_ref) {
28
28
  },
29
29
  editButtonSize: 'small',
30
30
  editing: editing,
31
+ fullFeaturedCodeBlock: true,
31
32
  onChange: onChange,
32
33
  onEditingChange: onEditingChange,
33
34
  text: text,
@@ -22,6 +22,7 @@ export interface EditableMessageProps {
22
22
  * @default false
23
23
  */
24
24
  editing?: boolean;
25
+ fullFeaturedCodeBlock?: boolean;
25
26
  height?: MessageInputProps['height'];
26
27
  inputType?: MessageInputProps['type'];
27
28
  /**
@@ -27,7 +27,8 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
27
27
  height = _ref.height,
28
28
  inputType = _ref.inputType,
29
29
  editButtonSize = _ref.editButtonSize,
30
- text = _ref.text;
30
+ text = _ref.text,
31
+ fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock;
31
32
  var _useControlledState = useControlledState(false, {
32
33
  onChange: onEditingChange,
33
34
  value: editing
@@ -68,6 +69,7 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
68
69
  return /*#__PURE__*/_jsxs(_Fragment, {
69
70
  children: [!expand && isEdit ? input : /*#__PURE__*/_jsx(Markdown, {
70
71
  className: classNames === null || classNames === void 0 ? void 0 : classNames.markdown,
72
+ fullFeaturedCodeBlock: fullFeaturedCodeBlock,
71
73
  style: _objectSpread({
72
74
  height: isAutoSize ? 'unset' : height,
73
75
  overflowX: 'hidden',
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "../types";
3
+ export interface HighlighterProps extends DivProps {
4
+ /**
5
+ * @description The code content to be highlighted
6
+ */
7
+ children: string;
8
+ /**
9
+ * @description The language of the code content
10
+ */
11
+ language: string;
12
+ }
13
+ export declare const Highlighter: import("react").NamedExoticComponent<HighlighterProps>;
14
+ export default Highlighter;
15
+ export { default as SyntaxHighlighter, type SyntaxHighlighterProps } from './SyntaxHighlighter';
@@ -0,0 +1,99 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["children", "language", "className", "style"];
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
+ import { Select } from 'antd';
8
+ import { ChevronDown, ChevronRight } from 'lucide-react';
9
+ import { memo, useState } from 'react';
10
+ import { Flexbox } from 'react-layout-kit';
11
+ import ActionIcon from "../ActionIcon";
12
+ import CopyButton from "../CopyButton";
13
+ import { languageMap } from "../hooks/useHighlight";
14
+ import SyntaxHighlighter from "./SyntaxHighlighter";
15
+ import { useStyles } from "./style";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ var options = languageMap.map(function (item) {
19
+ return {
20
+ label: item,
21
+ value: item.toLowerCase()
22
+ };
23
+ });
24
+ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
25
+ var children = _ref.children,
26
+ _ref$language = _ref.language,
27
+ language = _ref$language === void 0 ? 'markdown' : _ref$language,
28
+ className = _ref.className,
29
+ style = _ref.style,
30
+ props = _objectWithoutProperties(_ref, _excluded);
31
+ var _useState = useState(true),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ expand = _useState2[0],
34
+ setExpand = _useState2[1];
35
+ var _useState3 = useState(language),
36
+ _useState4 = _slicedToArray(_useState3, 2),
37
+ lang = _useState4[0],
38
+ setLang = _useState4[1];
39
+ var _useStyles = useStyles('block'),
40
+ styles = _useStyles.styles,
41
+ cx = _useStyles.cx;
42
+ var container = cx(styles.container, className);
43
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
44
+ className: container,
45
+ "data-code-type": "highlighter",
46
+ style: style
47
+ }, props), {}, {
48
+ children: [/*#__PURE__*/_jsxs(Flexbox, {
49
+ align: 'center',
50
+ className: styles.header,
51
+ horizontal: true,
52
+ justify: 'space-between',
53
+ children: [/*#__PURE__*/_jsx(ActionIcon, {
54
+ icon: expand ? ChevronDown : ChevronRight,
55
+ onClick: function onClick() {
56
+ return setExpand(!expand);
57
+ },
58
+ size: {
59
+ blockSize: 24,
60
+ fontSize: 14,
61
+ strokeWidth: 3
62
+ }
63
+ }), /*#__PURE__*/_jsx(ActionIcon, {
64
+ size: {
65
+ blockSize: 24
66
+ },
67
+ style: {
68
+ width: 'unset'
69
+ },
70
+ children: /*#__PURE__*/_jsx(Select, {
71
+ bordered: false,
72
+ className: styles.select,
73
+ onSelect: setLang,
74
+ options: options,
75
+ size: 'small',
76
+ suffixIcon: false,
77
+ value: lang.toLowerCase()
78
+ })
79
+ }), /*#__PURE__*/_jsx(CopyButton, {
80
+ content: children,
81
+ placement: "left",
82
+ size: {
83
+ blockSize: 24,
84
+ fontSize: 14,
85
+ strokeWidth: 2
86
+ }
87
+ })]
88
+ }), /*#__PURE__*/_jsx(SyntaxHighlighter, {
89
+ language: lang === null || lang === void 0 ? void 0 : lang.toLowerCase(),
90
+ style: expand ? {} : {
91
+ height: 0,
92
+ overflow: 'hidden'
93
+ },
94
+ children: children === null || children === void 0 ? void 0 : children.trim()
95
+ })]
96
+ }));
97
+ });
98
+ export default Highlighter;
99
+ export { default as SyntaxHighlighter } from "./SyntaxHighlighter";
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { type HighlighterCoreOptions } from 'shikiji';
3
- export interface SyntaxHighlighterProps {
3
+ import { DivProps } from "../../types";
4
+ export interface SyntaxHighlighterProps extends DivProps {
4
5
  children: string;
5
6
  language: string;
6
7
  options?: HighlighterCoreOptions;
@@ -12,9 +12,12 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
12
12
  var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
13
13
  var children = _ref.children,
14
14
  language = _ref.language,
15
- options = _ref.options;
15
+ options = _ref.options,
16
+ className = _ref.className,
17
+ style = _ref.style;
16
18
  var _useStyles = useStyles(),
17
- styles = _useStyles.styles;
19
+ styles = _useStyles.styles,
20
+ cx = _useStyles.cx;
18
21
  var _useThemeMode = useThemeMode(),
19
22
  isDarkMode = _useThemeMode.isDarkMode;
20
23
  var _useHighlight = useHighlight(function (s) {
@@ -28,12 +31,15 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
28
31
  }, [options]);
29
32
  return /*#__PURE__*/_jsxs(_Fragment, {
30
33
  children: [isLoading ? /*#__PURE__*/_jsx("code", {
34
+ className: className,
35
+ style: style,
31
36
  children: children
32
37
  }) : /*#__PURE__*/_jsx("div", {
33
- className: styles.shiki,
38
+ className: cx(styles.shiki, className),
34
39
  dangerouslySetInnerHTML: {
35
40
  __html: codeToHtml(children, language, isDarkMode) || ''
36
- }
41
+ },
42
+ style: style
37
43
  }), isLoading && /*#__PURE__*/_jsxs(Center, {
38
44
  className: styles.loading,
39
45
  gap: 8,
@@ -12,6 +12,7 @@ export interface HighlighterProps extends DivProps {
12
12
  * @default true
13
13
  */
14
14
  copyable?: boolean;
15
+ fullFeatured?: boolean;
15
16
  /**
16
17
  * @description The language of the code content
17
18
  */
@@ -1,18 +1,20 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
3
+ var _excluded = ["fullFeatured", "copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import { memo } from 'react';
7
7
  import CopyButton from "../CopyButton";
8
8
  import Spotlight from "../Spotlight";
9
9
  import Tag from "../Tag";
10
+ import FullFeatured from "./FullFeatured";
10
11
  import SyntaxHighlighter from "./SyntaxHighlighter";
11
12
  import { useStyles } from "./style";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  export var Highlighter = /*#__PURE__*/memo(function (_ref) {
15
- var _ref$copyButtonSize = _ref.copyButtonSize,
16
+ var fullFeatured = _ref.fullFeatured,
17
+ _ref$copyButtonSize = _ref.copyButtonSize,
16
18
  copyButtonSize = _ref$copyButtonSize === void 0 ? 'site' : _ref$copyButtonSize,
17
19
  children = _ref.children,
18
20
  language = _ref.language,
@@ -30,6 +32,13 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
30
32
  styles = _useStyles.styles,
31
33
  cx = _useStyles.cx;
32
34
  var container = cx(styles.container, className);
35
+ if (fullFeatured) return /*#__PURE__*/_jsx(FullFeatured, _objectSpread(_objectSpread({
36
+ className: className,
37
+ language: language,
38
+ style: style
39
+ }, props), {}, {
40
+ children: children
41
+ }));
33
42
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
34
43
  className: container,
35
44
  "data-code-type": "highlighter",
@@ -1,5 +1,7 @@
1
1
  export declare const useStyles: (props?: "block" | "ghost" | "pure" | undefined) => import("antd-style").ReturnStyles<{
2
2
  button: string;
3
3
  container: string;
4
+ header: import("antd-style").SerializedStyles;
4
5
  lang: string;
6
+ select: import("antd-style").SerializedStyles;
5
7
  }>;
@@ -1,5 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref, type) {
5
5
  var token = _ref.token,
@@ -14,6 +14,8 @@ export var useStyles = createStyles(function (_ref, type) {
14
14
  return {
15
15
  button: cx(buttonHoverCls, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n top: ", ";\n right: ", ";\n\n opacity: 0;\n "])), type === 'pure' ? 0 : '8px', type === 'pure' ? 0 : '8px')),
16
16
  container: cx(prefix, type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: auto;\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding: ", " !important;\n background: none !important;\n }\n\n code {\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, buttonHoverCls, langHoverCls, type === 'pure' ? 0 : "16px 24px")),
17
- lang: cx(langHoverCls, stylish.blur, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n right: 0;\n bottom: 8px;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary))
17
+ header: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 4px 8px;\n background: ", ";\n "])), token.colorFillQuaternary),
18
+ lang: cx(langHoverCls, stylish.blur, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n right: 0;\n bottom: 8px;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary)),
19
+ select: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .ant-select-selection-item {\n min-width: 100px;\n padding-inline-end: 0 !important;\n color: ", ";\n text-align: center;\n }\n "])), token.colorTextDescription)
18
20
  };
19
21
  });
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare const Code: import("react").NamedExoticComponent<any>;
3
- export default Code;
2
+ export declare const CodeLite: import("react").MemoExoticComponent<(properties: any) => import("react/jsx-runtime").JSX.Element>;
3
+ export declare const CodeFullFeatured: import("react").MemoExoticComponent<(properties: any) => import("react/jsx-runtime").JSX.Element>;
@@ -1,30 +1,65 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
1
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject;
4
+ var _excluded = ["fullFeatured"];
5
+ var _templateObject, _templateObject2;
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
8
  import { createStyles } from 'antd-style';
4
9
  import { memo } from 'react';
5
10
  import Highlighter from "../Highlighter";
11
+ import Snippet from "../Snippet";
6
12
  import { jsx as _jsx } from "react/jsx-runtime";
7
13
  var useStyles = createStyles(function (_ref) {
8
14
  var css = _ref.css;
9
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :not(:last-child) {\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0;\n margin-inline-end: 0;\n }\n "])));
15
+ return {
16
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :not(:last-child) {\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0;\n margin-inline-end: 0;\n }\n "]))),
17
+ highlight: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pre {\n padding: 12px !important;\n }\n "])))
18
+ };
10
19
  });
11
- var Code = /*#__PURE__*/memo(function (properties) {
20
+ var countLines = function countLines(str) {
21
+ var regex = /\n/g;
22
+ var matches = str.match(regex);
23
+ return matches ? matches.length : 1;
24
+ };
25
+ var Code = /*#__PURE__*/memo(function (_ref2) {
26
+ var fullFeatured = _ref2.fullFeatured,
27
+ properties = _objectWithoutProperties(_ref2, _excluded);
12
28
  var _useStyles = useStyles(),
13
- styles = _useStyles.styles;
29
+ styles = _useStyles.styles,
30
+ cx = _useStyles.cx;
14
31
  if (!properties.children[0]) return;
15
32
  var _properties$children$ = properties.children[0].props,
16
33
  children = _properties$children$.children,
17
34
  className = _properties$children$.className;
18
35
  if (!children) return;
36
+ var content = Array.isArray(children) ? children[0] : children;
37
+ if (countLines(content) === 1 && content.length <= 60) {
38
+ return /*#__PURE__*/_jsx(Snippet, {
39
+ className: styles.container,
40
+ "data-code-type": "highlighter",
41
+ language: (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'markdown',
42
+ type: 'block',
43
+ children: content
44
+ });
45
+ }
19
46
  return /*#__PURE__*/_jsx(Highlighter, {
20
- className: styles,
47
+ className: cx(styles.container, styles.highlight),
21
48
  copyButtonSize: {
22
49
  blockSize: 28,
23
50
  fontSize: 16
24
51
  },
52
+ fullFeatured: fullFeatured,
25
53
  language: (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'markdown',
26
54
  type: "block",
27
- children: Array.isArray(children) ? children[0] : children
55
+ children: content
28
56
  });
29
57
  });
30
- export default Code;
58
+ export var CodeLite = /*#__PURE__*/memo(function (properties) {
59
+ return /*#__PURE__*/_jsx(Code, _objectSpread({}, properties));
60
+ });
61
+ export var CodeFullFeatured = /*#__PURE__*/memo(function (properties) {
62
+ return /*#__PURE__*/_jsx(Code, _objectSpread({
63
+ fullFeatured: true
64
+ }, properties));
65
+ });
@@ -9,6 +9,7 @@ export interface MarkdownProps {
9
9
  * @description The class name for the Markdown component
10
10
  */
11
11
  className?: string;
12
+ fullFeaturedCodeBlock?: boolean;
12
13
  style?: CSSProperties;
13
14
  }
14
15
  declare const Markdown: import("react").NamedExoticComponent<MarkdownProps>;
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["children", "className", "style"];
3
+ var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import { Collapse, Divider, Image, Typography } from 'antd';
@@ -12,13 +12,14 @@ import rehypeKatex from 'rehype-katex';
12
12
  import rehypeRaw from 'rehype-raw';
13
13
  import remarkGfm from 'remark-gfm';
14
14
  import remarkMath from 'remark-math';
15
- import CodeBlock from "./CodeBlock";
15
+ import { CodeFullFeatured, CodeLite } from "./CodeBlock";
16
16
  import { useStyles } from "./style";
17
17
  import { jsx as _jsx } from "react/jsx-runtime";
18
18
  var Markdown = /*#__PURE__*/memo(function (_ref) {
19
19
  var children = _ref.children,
20
20
  className = _ref.className,
21
21
  style = _ref.style,
22
+ fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock,
22
23
  props = _objectWithoutProperties(_ref, _excluded);
23
24
  var _useStyles = useStyles(),
24
25
  styles = _useStyles.styles;
@@ -34,7 +35,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
34
35
  });
35
36
  },
36
37
  img: Image,
37
- pre: CodeBlock
38
+ pre: fullFeaturedCodeBlock ? CodeFullFeatured : CodeLite
38
39
  };
39
40
  return /*#__PURE__*/_jsx(Typography, {
40
41
  className: className,
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["symbol", "language", "children", "copyable", "type", "spotlight"];
3
+ var _excluded = ["symbol", "language", "children", "copyable", "type", "spotlight", "className"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import { memo } from 'react';
@@ -20,11 +20,13 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
20
20
  _ref$type = _ref.type,
21
21
  type = _ref$type === void 0 ? 'ghost' : _ref$type,
22
22
  spotlight = _ref.spotlight,
23
+ className = _ref.className,
23
24
  props = _objectWithoutProperties(_ref, _excluded);
24
25
  var _useStyles = useStyles(type),
25
- styles = _useStyles.styles;
26
+ styles = _useStyles.styles,
27
+ cx = _useStyles.cx;
26
28
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
27
- className: styles.container
29
+ className: cx(styles.container, className)
28
30
  }, props), {}, {
29
31
  children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
30
32
  language: language,
@@ -13,7 +13,7 @@ export var generateCustomStylish = function generateCustomStylish(_ref) {
13
13
  blurStrong: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n backdrop-filter: blur(36px);\n "]))),
14
14
  bottomScrollbar: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ::-webkit-scrollbar {\n width: 0;\n height: 4px;\n background-color: transparent;\n\n &-thumb {\n background-color: ", ";\n border-radius: 4px;\n transition: background-color 500ms ", ";\n }\n\n &-corner {\n display: none;\n width: 0;\n height: 0;\n }\n }\n "])), token.colorFill, token.motionEaseOut),
15
15
  gradientAnimation: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background-image: linear-gradient(\n -45deg,\n ", ",\n ", ",\n ", ",\n ", "\n );\n background-size: 400% 400%;\n border-radius: inherit;\n animation: 5s ", " 5s ease infinite;\n "])), token.gold, token.magenta, token.geekblue, token.cyan, gradient),
16
- markdown: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: ", ";\n\n h1,\n h2,\n h3,\n h4,\n h5 {\n font-weight: 600;\n }\n\n p {\n margin-block-start: 0;\n margin-block-end: 0;\n\n font-size: 14px;\n line-height: 1.8;\n color: ", ";\n text-align: justify;\n word-break: break-all;\n word-wrap: break-word;\n\n + * {\n margin-block-end: 0.5em;\n }\n }\n\n > *:last-child {\n margin-bottom: 0 !important;\n }\n\n blockquote {\n margin: 16px 0;\n padding: 0 12px;\n\n p {\n font-style: italic;\n color: ", ";\n }\n }\n\n p:not(:last-child) {\n margin-bottom: 1em;\n }\n\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n\n img {\n max-width: 100%;\n }\n\n pre,\n [data-code-type='highlighter'] {\n border: none;\n border-radius: ", "px;\n\n > code {\n padding: 0 !important;\n border: none !important;\n }\n }\n\n > :not([data-code-type='highlighter']) code {\n padding: 2px 6px;\n\n font-size: ", "px;\n color: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n table {\n border-spacing: 0;\n\n width: 100%;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0;\n margin-inline-end: 0;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n\n code {\n display: inline-flex;\n }\n }\n\n th,\n td {\n padding-block-start: 10px;\n padding-block-end: 10px;\n padding-inline-start: 16px;\n padding-inline-end: 16px;\n }\n\n thead {\n tr {\n th {\n background: ", ";\n\n &:first-child {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n\n &:last-child {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n }\n\n > ol > li {\n margin-left: 0;\n }\n\n ol {\n counter-reset: steps;\n margin-left: 0;\n list-style: none;\n\n li {\n counter-increment: steps;\n word-break: break-all;\n\n > p {\n display: inline;\n }\n\n &::before {\n content: counter(steps);\n\n scale: 0.8;\n\n unicode-bidi: isolate;\n display: inline-flex !important;\n align-items: center;\n justify-content: center;\n\n width: 1.4em;\n min-width: 1.4em;\n max-width: 1.4em;\n height: 1.4em;\n margin-right: 0.5em;\n\n font-family: ", ";\n font-size: 1em;\n line-height: 1;\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n }\n }\n\n ol li::before {\n color: ", ";\n background: ", ";\n }\n }\n\n ul {\n > li::marker {\n color: ", ";\n }\n }\n\n > ul {\n > li {\n line-height: 1.8;\n list-style-type: disc;\n\n &::marker {\n color: ", " !important;\n }\n }\n }\n\n details {\n margin-bottom: 1em;\n padding: 12px 16px;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n\n transition: all 400ms ", ";\n }\n\n details[open] {\n summary {\n padding-bottom: 12px;\n border-bottom: 1px solid ", ";\n }\n }\n "])), isDarkMode ? token.colorTextSecondary : token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, token.borderRadius, token.fontSizeSM, cyanColor, cyanBackground, isDarkMode ? token.cyan1A : token.cyan6A, token.borderRadiusSM, token.colorBorderSecondary, token.borderRadius, token.colorFillTertiary, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.fontFamilyCode, cyanColor, cyanBackground, token.colorTextSecondary, token.colorFill, token.colorTextDescription, isDarkMode ? token.cyan9A : token.cyan10A, token.colorFillTertiary, token.colorBorderSecondary, token.borderRadiusLG, token.motionEaseOut, token.colorBorder),
16
+ markdown: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: ", ";\n\n h1,\n h2,\n h3,\n h4,\n h5 {\n font-weight: 600;\n }\n\n p {\n margin-block-start: 0;\n margin-block-end: 0;\n\n font-size: 14px;\n line-height: 1.8;\n color: ", ";\n text-align: justify;\n word-break: break-all;\n word-wrap: break-word;\n\n + * {\n margin-block-end: 0.5em;\n }\n }\n\n > *:last-child {\n margin-bottom: 0 !important;\n }\n\n blockquote {\n margin: 16px 0;\n padding: 0 12px;\n\n p {\n font-style: italic;\n color: ", ";\n }\n }\n\n p:not(:last-child) {\n margin-bottom: 1em;\n }\n\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n\n img {\n max-width: 100%;\n }\n\n pre,\n [data-code-type='highlighter'] {\n border: none;\n border-radius: ", "px;\n\n > code {\n padding: 0 !important;\n border: none !important;\n }\n }\n\n > :not([data-code-type='highlighter']) code {\n padding: 2px 6px;\n\n font-size: ", "px;\n color: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n table {\n border-spacing: 0;\n\n width: 100%;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0;\n margin-inline-end: 0;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n\n code {\n display: inline-flex;\n }\n }\n\n th,\n td {\n padding-block-start: 10px;\n padding-block-end: 10px;\n padding-inline-start: 16px;\n padding-inline-end: 16px;\n }\n\n thead {\n tr {\n th {\n background: ", ";\n\n &:first-child {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n\n &:last-child {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n }\n\n > ol > li::marker {\n color: ", " !important;\n }\n\n > ul > li {\n line-height: 1.8;\n list-style-type: disc;\n &::marker {\n color: ", " !important;\n }\n }\n\n ol,\n ul {\n > li::marker {\n color: ", ";\n }\n }\n\n details {\n margin-bottom: 1em;\n padding: 12px 16px;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n\n transition: all 400ms ", ";\n }\n\n details[open] {\n summary {\n padding-bottom: 12px;\n border-bottom: 1px solid ", ";\n }\n }\n "])), token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, token.borderRadius, token.fontSizeSM, cyanColor, cyanBackground, isDarkMode ? token.cyan1A : token.cyan6A, token.borderRadiusSM, token.colorBorderSecondary, token.borderRadius, token.colorFillTertiary, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, isDarkMode ? token.cyan9A : token.cyan10A, isDarkMode ? token.cyan9A : token.cyan10A, token.colorTextDescription, token.colorFillTertiary, token.colorBorderSecondary, token.borderRadiusLG, token.motionEaseOut, token.colorBorder),
17
17
  noScrollbar: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ::-webkit-scrollbar {\n display: none;\n width: 0;\n height: 0;\n background-color: transparent;\n }\n "]))),
18
18
  resetLinkColor: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n cursor: pointer;\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n "])), token.colorTextSecondary, token.colorText)
19
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.86.3",
3
+ "version": "1.87.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",