@lobehub/ui 1.146.4 → 1.146.5

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.
@@ -61,9 +61,12 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
61
61
  }), showLanguage && language && /*#__PURE__*/_jsx(Tag, {
62
62
  className: styles.lang,
63
63
  children: language.toLowerCase()
64
- }), /*#__PURE__*/_jsx(SyntaxHighlighter, {
65
- language: language === null || language === void 0 ? void 0 : language.toLowerCase(),
66
- children: children
64
+ }), /*#__PURE__*/_jsx("div", {
65
+ className: styles.scroller,
66
+ children: /*#__PURE__*/_jsx(SyntaxHighlighter, {
67
+ language: language === null || language === void 0 ? void 0 : language.toLowerCase(),
68
+ children: children
69
+ })
67
70
  })]
68
71
  }));
69
72
  });
@@ -3,5 +3,6 @@ export declare const useStyles: (props?: "block" | "ghost" | "pure" | undefined)
3
3
  container: string;
4
4
  header: import("antd-style").SerializedStyles;
5
5
  lang: string;
6
+ scroller: import("antd-style").SerializedStyles;
6
7
  select: import("antd-style").SerializedStyles;
7
8
  }>;
@@ -1,5 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref, type) {
5
5
  var token = _ref.token,
@@ -13,9 +13,10 @@ export var useStyles = createStyles(function (_ref, type) {
13
13
  var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border: 1px solid ", ";\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, type === 'block' ? token.colorFillTertiary : token.colorFillQuaternary);
14
14
  return {
15
15
  button: cx(buttonHoverCls, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-start: ", ";\n inset-inline-end: ", ";\n\n opacity: 0;\n "])), type === 'pure' ? 0 : '8px', type === 'pure' ? 0 : '8px')),
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 overflow: auto hidden;\n\n margin: 0 !important;\n padding: ", " !important;\n\n white-space: break-spaces;\n\n background: none !important;\n }\n\n code {\n text-wrap: nowrap !important;\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, buttonHoverCls, langHoverCls, type === 'pure' ? 0 : "16px")),
16
+ container: cx(prefix, type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\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 overflow: auto hidden;\n\n margin: 0 !important;\n padding: ", " !important;\n\n white-space: break-spaces;\n\n background: none !important;\n }\n\n code {\n text-wrap: nowrap !important;\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, buttonHoverCls, langHoverCls, type === 'pure' ? 0 : "16px")),
17
17
  header: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding-block: 4px;\n padding-inline: 8px;\n background: ", ";\n "])), token.colorFillQuaternary),
18
18
  lang: cx(langHoverCls, stylish.blur, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-end: 8px;\n inset-inline-end: 0;\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 user-select: none;\n font-size: 14px;\n color: ", ";\n .", "-select-selection-item {\n min-width: 100px;\n padding-inline-end: 0 !important;\n color: ", ";\n text-align: center;\n }\n "])), token.colorTextDescription, prefixCls, token.colorTextDescription)
19
+ scroller: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: auto;\n width: 100%;\n height: 100%;\n "]))),
20
+ select: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n user-select: none;\n font-size: 14px;\n color: ", ";\n .", "-select-selection-item {\n min-width: 100px;\n padding-inline-end: 0 !important;\n color: ", ";\n text-align: center;\n }\n "])), token.colorTextDescription, prefixCls, token.colorTextDescription)
20
21
  };
21
22
  });
@@ -1,12 +1,32 @@
1
1
  export function escapeDollarNumber(text) {
2
2
  var escapedText = '';
3
- for (var i = 0; i < text.length; i += 1) {
3
+ var inCodeBlock = false;
4
+ var inSingleLineCodeBlock = false;
5
+ var i = 0;
6
+ while (i < text.length) {
4
7
  var char = text[i];
5
- var nextChar = text[i + 1] || ' ';
6
- if (char === '$' && nextChar >= '0' && nextChar <= '9') {
8
+ if (char === '`') {
9
+ var tickCount = 1;
10
+ while (text[i + tickCount] === '`') {
11
+ tickCount++;
12
+ }
13
+ if (tickCount === 3) {
14
+ inCodeBlock = !inCodeBlock;
15
+ escapedText += '```';
16
+ i += tickCount;
17
+ continue;
18
+ } else if (tickCount === 1) {
19
+ inSingleLineCodeBlock = !inSingleLineCodeBlock;
20
+ escapedText += '`';
21
+ i += tickCount;
22
+ continue;
23
+ }
24
+ }
25
+ if (!inCodeBlock && !inSingleLineCodeBlock && char === '$' && i + 1 < text.length && text[i + 1] >= '0' && text[i + 1] <= '9') {
7
26
  char = '\\$';
8
27
  }
9
28
  escapedText += char;
29
+ i++;
10
30
  }
11
31
  return escapedText;
12
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.146.4",
3
+ "version": "1.146.5",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",