@lobehub/ui 1.146.3 → 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,14 +1,32 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
1
  export function escapeDollarNumber(text) {
4
2
  var escapedText = '';
5
- 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) {
6
7
  var char = text[i];
7
- var nextChar = text[i + 1] || ' ';
8
- if (char === '$' && nextChar >= '0' && nextChar <= '9') {
9
- char = String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["$"], ["\\$"])));
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') {
26
+ char = '\\$';
10
27
  }
11
28
  escapedText += char;
29
+ i++;
12
30
  }
13
31
  return escapedText;
14
32
  }
@@ -26,5 +44,5 @@ export function escapeBrackets(text) {
26
44
  });
27
45
  }
28
46
  export function escapeMhchem(text) {
29
- return text.replaceAll(String.raw(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["$ce{"], ["$\\ce{"]))), String.raw(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["$\\ce{"], ["$\\\\ce{"])))).replaceAll(String.raw(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["$pu{"], ["$\\pu{"]))), String.raw(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["$\\pu{"], ["$\\\\pu{"]))));
47
+ return text.replaceAll('$\\ce{', '$\\\\ce{').replaceAll('$\\pu{', '$\\\\pu{');
30
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.146.3",
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",
@@ -125,7 +125,7 @@
125
125
  "devDependencies": {
126
126
  "@ant-design/icons": "^5.3.7",
127
127
  "@commitlint/cli": "^19.3.0",
128
- "@lobehub/lint": "^1.24.2",
128
+ "@lobehub/lint": "^1.24.3",
129
129
  "@testing-library/react": "^14.3.1",
130
130
  "@types/chroma-js": "^2.4.4",
131
131
  "@types/lodash-es": "^4.17.12",