@lobehub/ui 1.151.5 → 1.152.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.
@@ -106,7 +106,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
106
106
  var defaultDOM = /*#__PURE__*/_jsx(ImageGallery, {
107
107
  enable: enableImageGallery,
108
108
  children: /*#__PURE__*/_jsx(ReactMarkdown, _objectSpread(_objectSpread({
109
- className: cx(mdStyles.__root, mdStyles.a, mdStyles.blockquote, mdStyles.code, mdStyles.details, mdStyles.header, mdStyles.hr, mdStyles.img, mdStyles.kbd, mdStyles.list, mdStyles.p, mdStyles.pre, mdStyles.strong, mdStyles.table, mdStyles.video, isChatMode && styles.chat),
109
+ className: cx(mdStyles.__root, mdStyles.a, mdStyles.blockquote, mdStyles.code, mdStyles.details, mdStyles.header, mdStyles.hr, mdStyles.img, mdStyles.kbd, mdStyles.list, mdStyles.p, mdStyles.pre, mdStyles.strong, mdStyles.table, mdStyles.video, enableLatex && styles.latex, isChatMode && styles.chat),
110
110
  components: memoComponents,
111
111
  rehypePlugins: memoRehypePlugins,
112
112
  remarkPlugins: memoRemarkPlugins
@@ -5,5 +5,6 @@ export declare const useStyles: (props?: {
5
5
  marginMultiple?: number | undefined;
6
6
  } | undefined) => import("antd-style").ReturnStyles<{
7
7
  chat: import("antd-style").SerializedStyles;
8
+ latex: import("antd-style").SerializedStyles;
8
9
  root: import("antd-style").SerializedStyles;
9
10
  }>;
@@ -1,5 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2;
2
+ var _templateObject, _templateObject2, _templateObject3;
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref, _ref2) {
5
5
  var css = _ref.css,
@@ -16,6 +16,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
16
16
  var cyanColor = isDarkMode ? token.cyan9A : token.cyan11A;
17
17
  return {
18
18
  chat: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --lobe-markdown-font-size: ", "px;\n --lobe-markdown-header-multiple: ", ";\n --lobe-markdown-margin-multiple: ", ";\n --lobe-markdown-line-height: ", ";\n --lobe-markdown-border-radius: ", ";\n\n margin-block: ", "em;\n\n /* \u89E3\u51B3\u53EA\u6709\u4E00\u4E2A\u5B50\u8282\u70B9\u65F6\u9AD8\u5EA6\u574D\u7F29\u7684\u95EE\u9898 */\n :first-child:not(:has(*)) {\n margin-block: 0;\n }\n\n ol,\n ul {\n li {\n &::marker {\n color: ", " !important;\n }\n\n li {\n &::marker {\n color: ", " !important;\n }\n }\n }\n }\n\n ul {\n list-style: unset;\n\n li {\n &::before {\n content: unset;\n display: unset;\n }\n }\n }\n "])), fontSize, headerMultiple, marginMultiple, lineHeight, token.borderRadius, marginMultiple * -0.75, cyanColor, token.colorTextSecondary),
19
- root: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n\n #footnote-label {\n display: none;\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n margin-inline: 0.2em;\n padding-block: 0.05em;\n padding-inline: 0.4em;\n\n font-size: 0.75em;\n vertical-align: super !important;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: 0.25em;\n }\n\n section.footnotes {\n padding-block: 1em;\n font-size: 0.875em;\n color: ", ";\n\n ol {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5em;\n\n margin: 0;\n padding: 0;\n\n list-style-type: none;\n }\n\n ol li {\n position: relative;\n\n overflow: hidden;\n display: flex;\n flex-direction: row;\n\n margin: 0 !important;\n padding-block: 0 !important;\n padding-inline: 0 0.4em !important;\n\n text-overflow: ellipsis;\n white-space: nowrap;\n\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n &::before {\n content: counter(list-item);\n counter-increment: list-item;\n\n display: block;\n\n margin-inline-end: 0.4em;\n padding-inline: 0.6em;\n\n background: ", ";\n }\n\n p,\n a {\n overflow: hidden;\n\n margin: 0 !important;\n padding: 0 !important;\n\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n }\n "])), token.colorFillTertiary, token.colorBorderSecondary, token.colorTextSecondary, token.colorBorderSecondary, token.colorFillSecondary)
19
+ latex: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .katex-html {\n overflow: auto hidden;\n padding: 3px;\n\n .base {\n margin-block: 0;\n margin-inline: auto;\n }\n }\n\n .katex-html:has(span.tag) {\n display: flex !important;\n }\n\n .katex-html > .tag {\n position: relative !important;\n float: right;\n margin-inline-start: 0.25rem;\n }\n "]))),
20
+ root: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n\n #footnote-label {\n display: none;\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n margin-inline: 0.2em;\n padding-block: 0.05em;\n padding-inline: 0.4em;\n\n font-size: 0.75em;\n vertical-align: super !important;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: 0.25em;\n }\n\n section.footnotes {\n padding-block: 1em;\n font-size: 0.875em;\n color: ", ";\n\n ol {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5em;\n\n margin: 0;\n padding: 0;\n\n list-style-type: none;\n }\n\n ol li {\n position: relative;\n\n overflow: hidden;\n display: flex;\n flex-direction: row;\n\n margin: 0 !important;\n padding-block: 0 !important;\n padding-inline: 0 0.4em !important;\n\n text-overflow: ellipsis;\n white-space: nowrap;\n\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n &::before {\n content: counter(list-item);\n counter-increment: list-item;\n\n display: block;\n\n margin-inline-end: 0.4em;\n padding-inline: 0.6em;\n\n background: ", ";\n }\n\n p,\n a {\n overflow: hidden;\n\n margin: 0 !important;\n padding: 0 !important;\n\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n }\n "])), token.colorFillTertiary, token.colorBorderSecondary, token.colorTextSecondary, token.colorBorderSecondary, token.colorFillSecondary)
20
21
  };
21
22
  });
@@ -44,8 +44,8 @@ export function fixMarkdownBold(text) {
44
44
  }
45
45
  if (count === 2 && count2 % 2 === 0) {
46
46
  var prevChar = i > 0 ? text[i - 2] : '';
47
- var isPrevCharAlphanumeric = /[\dA-Za-z]/.test(prevChar);
48
- result += i + 1 < text.length && text[i + 1] !== ' ' && !isPrevCharAlphanumeric ? '* ' : '*';
47
+ var isPrevCharSymbol = /(?:[!-\/:-@\[-`\{-~\xA1-\xA9\xAB\xAC\xAE-\xB1\xB4\xB6-\xB8\xBB\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u037E\u0384\u0385\u0387\u03F6\u0482\u055A-\u055F\u0589\u058A\u058D-\u058F\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0606-\u060F\u061B\u061D-\u061F\u066A-\u066D\u06D4\u06DE\u06E9\u06FD\u06FE\u0700-\u070D\u07F6-\u07F9\u07FE\u07FF\u0830-\u083E\u085E\u0888\u0964\u0965\u0970\u09F2\u09F3\u09FA\u09FB\u09FD\u0A76\u0AF0\u0AF1\u0B70\u0BF3-\u0BFA\u0C77\u0C7F\u0C84\u0D4F\u0D79\u0DF4\u0E3F\u0E4F\u0E5A\u0E5B\u0F01-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F85\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u104A-\u104F\u109E\u109F\u10FB\u1360-\u1368\u1390-\u1399\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DB\u1800-\u180A\u1940\u1944\u1945\u19DE-\u19FF\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B6A\u1B74-\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2010-\u2027\u2030-\u205E\u207A-\u207E\u208A-\u208E\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2775\u2794-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3001-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u303F\u309B\u309C\u30A0\u30FB\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAA77-\uAA79\uAADE\uAADF\uAAF0\uAAF1\uAB5B\uAB6A\uAB6B\uABEB\uFB29\uFBB2-\uFBC2\uFD3E-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD00-\uDD02\uDD37-\uDD3F\uDD79-\uDD89\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DD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA])/.test(prevChar);
48
+ result += i + 1 < text.length && text[i + 1] !== ' ' && isPrevCharSymbol ? '* ' : '*';
49
49
  } else {
50
50
  result += '*';
51
51
  }
@@ -1,8 +1,12 @@
1
1
  import { ThemeProviderProps as AntdThemeProviderProps, CustomStylishParams, CustomTokenParams } from 'antd-style';
2
2
  import { CSSProperties } from 'react';
3
3
  import { NeutralColors, PrimaryColors } from "../styles";
4
- export interface ThemeProviderProps extends Omit<AntdThemeProviderProps<any>, 'theme'> {
4
+ export interface ThemeProviderProps extends AntdThemeProviderProps<any> {
5
5
  className?: string;
6
+ /**
7
+ * @description Webfont loader css strings
8
+ */
9
+ customFonts?: string[];
6
10
  customStylish?: (theme: CustomStylishParams) => {
7
11
  [key: string]: any;
8
12
  };
@@ -16,13 +20,9 @@ export interface ThemeProviderProps extends Omit<AntdThemeProviderProps<any>, 't
16
20
  customToken?: (theme: CustomTokenParams) => {
17
21
  [key: string]: any;
18
22
  };
23
+ enableCustomFonts?: boolean;
19
24
  enableGlobalStyle?: boolean;
20
- enableWebfonts?: boolean;
21
25
  style?: CSSProperties;
22
- /**
23
- * @description Webfont loader css strings
24
- */
25
- webfonts?: string[];
26
26
  }
27
27
  declare const ThemeProvider: import("react").NamedExoticComponent<ThemeProviderProps>;
28
28
  export default ThemeProvider;
@@ -2,9 +2,10 @@
2
2
 
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["children", "customStylish", "customToken", "enableWebfonts", "enableGlobalStyle", "webfonts", "customTheme", "className", "style"];
5
+ var _excluded = ["children", "customStylish", "customToken", "enableCustomFonts", "enableGlobalStyle", "customFonts", "customTheme", "className", "style", "theme"];
6
6
  import { App } from 'antd';
7
7
  import { ThemeProvider as AntdThemeProvider, StyleProvider } from 'antd-style';
8
+ import { merge } from 'lodash-es';
8
9
  import { memo, useCallback } from 'react';
9
10
  import { useCdnFn } from "../ConfigProvider";
10
11
  import FontLoader from "../FontLoader";
@@ -18,18 +19,19 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
18
19
  var children = _ref.children,
19
20
  customStylish = _ref.customStylish,
20
21
  customToken = _ref.customToken,
21
- _ref$enableWebfonts = _ref.enableWebfonts,
22
- enableWebfonts = _ref$enableWebfonts === void 0 ? true : _ref$enableWebfonts,
22
+ _ref$enableCustomFont = _ref.enableCustomFonts,
23
+ enableCustomFonts = _ref$enableCustomFont === void 0 ? true : _ref$enableCustomFont,
23
24
  _ref$enableGlobalStyl = _ref.enableGlobalStyle,
24
25
  enableGlobalStyle = _ref$enableGlobalStyl === void 0 ? true : _ref$enableGlobalStyl,
25
- webfonts = _ref.webfonts,
26
+ customFonts = _ref.customFonts,
26
27
  _ref$customTheme = _ref.customTheme,
27
28
  customTheme = _ref$customTheme === void 0 ? {} : _ref$customTheme,
28
29
  className = _ref.className,
29
30
  style = _ref.style,
31
+ antdTheme = _ref.theme,
30
32
  res = _objectWithoutProperties(_ref, _excluded);
31
33
  var genCdnUrl = useCdnFn();
32
- var webfontUrls = webfonts || [genCdnUrl({
34
+ var webfontUrls = customFonts || [genCdnUrl({
33
35
  path: 'css/index.css',
34
36
  pkg: '@lobehub/webfont-mono',
35
37
  version: '1.0.0'
@@ -53,14 +55,15 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
53
55
  return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), customToken === null || customToken === void 0 ? void 0 : customToken(theme));
54
56
  }, [customToken]);
55
57
  var theme = useCallback(function (appearance) {
56
- return createLobeAntdTheme({
58
+ var lobeTheme = createLobeAntdTheme({
57
59
  appearance: appearance,
58
60
  neutralColor: customTheme.neutralColor,
59
61
  primaryColor: customTheme.primaryColor
60
62
  });
61
- }, [customTheme.primaryColor, customTheme.neutralColor]);
63
+ return merge(lobeTheme, antdTheme);
64
+ }, [customTheme.primaryColor, customTheme.neutralColor, antdTheme]);
62
65
  return /*#__PURE__*/_jsxs(_Fragment, {
63
- children: [enableWebfonts && (webfontUrls === null || webfontUrls === void 0 ? void 0 : webfontUrls.length) > 0 && webfontUrls.map(function (webfont) {
66
+ children: [enableCustomFonts && (webfontUrls === null || webfontUrls === void 0 ? void 0 : webfontUrls.length) > 0 && webfontUrls.map(function (webfont) {
64
67
  return /*#__PURE__*/_jsx(FontLoader, {
65
68
  url: webfont
66
69
  }, webfont);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.151.5",
3
+ "version": "1.152.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",