@lobehub/ui 2.13.4 → 2.13.6
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _excluded = ["value", "defaultAvatar", "onChange", "locale", "allowUpload", "allowDelete", "texts", "onDelete", "compressSize", "customEmojis", "className", "loading", "onUpload", "customTabs", "popupClassName", "popupStyle"];
|
|
4
|
+
var _excluded = ["value", "defaultAvatar", "onChange", "locale", "allowUpload", "allowDelete", "texts", "onDelete", "compressSize", "customEmojis", "className", "loading", "onUpload", "customTabs", "popupClassName", "popupStyle", "customRender"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -61,6 +61,7 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
61
61
|
customTabs = _ref$customTabs === void 0 ? [] : _ref$customTabs,
|
|
62
62
|
popupClassName = _ref.popupClassName,
|
|
63
63
|
popupStyle = _ref.popupStyle,
|
|
64
|
+
customRender = _ref.customRender,
|
|
64
65
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
65
66
|
var ref = useRef(null);
|
|
66
67
|
var _useState = useState('emoji'),
|
|
@@ -135,7 +136,7 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
135
136
|
label: tab.label
|
|
136
137
|
};
|
|
137
138
|
}))).filter(Boolean);
|
|
138
|
-
var showTabs = items && items.length > 1;
|
|
139
|
+
var showTabs = allowDelete || items && items.length > 1;
|
|
139
140
|
var content = /*#__PURE__*/_jsxs(Flexbox, {
|
|
140
141
|
className: cx(styles.picker, popupClassName),
|
|
141
142
|
ref: ref,
|
|
@@ -201,7 +202,7 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
201
202
|
placement: 'bottomRight',
|
|
202
203
|
rootClassName: styles.popover,
|
|
203
204
|
trigger: ['click'],
|
|
204
|
-
children: /*#__PURE__*/_jsx(Avatar, _objectSpread({
|
|
205
|
+
children: customRender ? customRender(ava) : /*#__PURE__*/_jsx(Avatar, _objectSpread({
|
|
205
206
|
avatar: ava,
|
|
206
207
|
className: cx(styles.root, className),
|
|
207
208
|
loading: loading
|
package/es/EmojiPicker/type.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface EmojiPickerProps extends Omit<AvatarProps, 'onChange' | 'avatar
|
|
|
25
25
|
allowUpload?: boolean;
|
|
26
26
|
compressSize?: number;
|
|
27
27
|
customEmojis?: EmojiPickerCustomEmoji[];
|
|
28
|
+
customRender?: (avatar: string) => ReactNode;
|
|
28
29
|
customTabs?: EmojiPickerCustomTab[];
|
|
29
30
|
defaultAvatar?: string;
|
|
30
31
|
loading?: boolean;
|
package/es/Input/type.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { InputNumberProps as AntdInputNumberProps, InputProps as AntdInputP
|
|
|
2
2
|
import type { OTPProps as AntdOPTProps, OTPRef } from 'antd/es/input/OTP';
|
|
3
3
|
import type { PasswordProps as AntdPasswordProps } from 'antd/es/input/Password';
|
|
4
4
|
import type { TextAreaProps as AntdTextAreaProps, TextAreaRef } from 'antd/es/input/TextArea';
|
|
5
|
+
import type { InputNumberRef } from 'rc-input-number';
|
|
5
6
|
import type { Ref } from 'react';
|
|
6
7
|
export interface InputProps extends AntdInputProps {
|
|
7
8
|
ref?: Ref<InputRef>;
|
|
@@ -13,7 +14,7 @@ export interface TextAreaProps extends AntdTextAreaProps {
|
|
|
13
14
|
shadow?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export interface InputNumberProps extends AntdInputNumberProps {
|
|
16
|
-
ref?: Ref<
|
|
17
|
+
ref?: Ref<InputNumberRef>;
|
|
17
18
|
shadow?: boolean;
|
|
18
19
|
}
|
|
19
20
|
export interface InputPasswordProps extends AntdPasswordProps {
|
|
@@ -32,6 +32,19 @@ export declare function escapeLatexPipes(text: string): string;
|
|
|
32
32
|
* @returns The string with unescaped underscores escaped within \text{...} commands
|
|
33
33
|
*/
|
|
34
34
|
export declare function escapeTextUnderscores(text: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Escapes dollar signs that appear to be currency symbols to prevent them from being
|
|
37
|
+
* interpreted as LaTeX math delimiters.
|
|
38
|
+
*
|
|
39
|
+
* This function identifies currency patterns such as:
|
|
40
|
+
* - $20, $100, $1,000
|
|
41
|
+
* - $20-50, $100+
|
|
42
|
+
* - Patterns within markdown tables
|
|
43
|
+
*
|
|
44
|
+
* @param text The input string containing potential currency symbols
|
|
45
|
+
* @returns The string with currency dollar signs escaped
|
|
46
|
+
*/
|
|
47
|
+
export declare function escapeCurrencyDollars(text: string): string;
|
|
35
48
|
/**
|
|
36
49
|
* Preprocesses LaTeX content by performing multiple operations:
|
|
37
50
|
* 1. Protects code blocks from processing
|
|
@@ -51,7 +51,8 @@ export function escapeLatexPipes(text) {
|
|
|
51
51
|
// Replace unescaped '|' inside LaTeX math spans with '\vert' so that
|
|
52
52
|
// remark-gfm table parsing won't treat them as column separators.
|
|
53
53
|
// Leave code blocks/inline code untouched.
|
|
54
|
-
|
|
54
|
+
// Also ignore escaped dollars (\$) which are currency symbols
|
|
55
|
+
var pattern = /(```[\S\s]*?```|`[^\n`]*`)|\$\$([\S\s]*?)\$\$|(?<!\\)(?<!\$)\$(?!\$)([\S\s]*?)(?<!\\)(?<!\$)\$(?!\$)/g;
|
|
55
56
|
return text.replaceAll(pattern, function (match, code, display, inline) {
|
|
56
57
|
if (code !== undefined) return code; // preserve code fences/inline code
|
|
57
58
|
if (display !== undefined) return "$$".concat(replaceUnescapedPipes(display), "$$");
|
|
@@ -79,6 +80,41 @@ export function escapeTextUnderscores(text) {
|
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Escapes dollar signs that appear to be currency symbols to prevent them from being
|
|
85
|
+
* interpreted as LaTeX math delimiters.
|
|
86
|
+
*
|
|
87
|
+
* This function identifies currency patterns such as:
|
|
88
|
+
* - $20, $100, $1,000
|
|
89
|
+
* - $20-50, $100+
|
|
90
|
+
* - Patterns within markdown tables
|
|
91
|
+
*
|
|
92
|
+
* @param text The input string containing potential currency symbols
|
|
93
|
+
* @returns The string with currency dollar signs escaped
|
|
94
|
+
*/
|
|
95
|
+
export function escapeCurrencyDollars(text) {
|
|
96
|
+
// Protect code blocks and existing LaTeX expressions from processing
|
|
97
|
+
var protectedStrings = [];
|
|
98
|
+
var content = text.replaceAll(/(```[\S\s]*?```|`[^\n`]*`|\$\$[\S\s]*?\$\$|\\\[[\S\s]*?\\]|\\\(.*?\\\))/g, function (match) {
|
|
99
|
+
protectedStrings.push(match);
|
|
100
|
+
return "<<PROTECTED_".concat(protectedStrings.length - 1, ">>");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Escape dollar signs that are clearly currency:
|
|
104
|
+
// - $ followed by a digit
|
|
105
|
+
// - Not preceded by another $ (to avoid breaking $$)
|
|
106
|
+
// - Followed by number patterns with optional commas, decimals, ranges, or plus signs
|
|
107
|
+
// Match patterns like: $20, $1,000, $19.99, $20-50, $300+, $1,000-2,000+
|
|
108
|
+
// In the replacement: \\ = backslash, $$ = literal $, $1 = capture group 1
|
|
109
|
+
content = content.replaceAll(/(?<!\$)\$(\d{1,3}(?:,\d{3})*(?:\.\d+)?(?:-\d{1,3}(?:,\d{3})*(?:\.\d+)?)?\+?)/g, '\\$$$1');
|
|
110
|
+
|
|
111
|
+
// Restore protected content
|
|
112
|
+
content = content.replaceAll(/<<PROTECTED_(\d+)>>/g, function (_, index) {
|
|
113
|
+
return protectedStrings[Number.parseInt(index)];
|
|
114
|
+
});
|
|
115
|
+
return content;
|
|
116
|
+
}
|
|
117
|
+
|
|
82
118
|
/**
|
|
83
119
|
* Preprocesses LaTeX content by performing multiple operations:
|
|
84
120
|
* 1. Protects code blocks from processing
|
|
@@ -123,6 +159,8 @@ export function preprocessLaTeX(str) {
|
|
|
123
159
|
var content = str;
|
|
124
160
|
|
|
125
161
|
// Step 6: Apply additional escaping functions
|
|
162
|
+
// Escape currency dollar signs FIRST before other LaTeX processing
|
|
163
|
+
content = escapeCurrencyDollars(content);
|
|
126
164
|
content = convertLatexDelimiters(content);
|
|
127
165
|
content = escapeMhchemCommands(content);
|
|
128
166
|
content = escapeLatexPipes(content);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.6",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -55,38 +55,39 @@
|
|
|
55
55
|
"@floating-ui/react": "^0.27.16",
|
|
56
56
|
"@giscus/react": "^3.1.0",
|
|
57
57
|
"@lobehub/fluent-emoji": "^2.0.0",
|
|
58
|
-
"@lobehub/icons": "^2.
|
|
58
|
+
"@lobehub/icons": "^2.43.1",
|
|
59
59
|
"@mdx-js/mdx": "^3.1.1",
|
|
60
60
|
"@mdx-js/react": "^3.1.1",
|
|
61
|
-
"@radix-ui/react-slot": "^1.2.
|
|
62
|
-
"@shikijs/transformers": "^3.
|
|
61
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
62
|
+
"@shikijs/transformers": "^3.15.0",
|
|
63
63
|
"@splinetool/runtime": "0.9.526",
|
|
64
|
-
"ahooks": "^3.9.
|
|
64
|
+
"ahooks": "^3.9.6",
|
|
65
65
|
"antd-style": "^3.7.1",
|
|
66
66
|
"chroma-js": "^3.1.2",
|
|
67
67
|
"class-variance-authority": "^0.7.1",
|
|
68
|
-
"dayjs": "^1.11.
|
|
68
|
+
"dayjs": "^1.11.19",
|
|
69
69
|
"emoji-mart": "^5.6.0",
|
|
70
70
|
"fast-deep-equal": "^3.1.3",
|
|
71
|
-
"framer-motion": "^12.23.
|
|
72
|
-
"immer": "^10.
|
|
73
|
-
"katex": "^0.16.
|
|
74
|
-
"leva": "^0.10.
|
|
71
|
+
"framer-motion": "^12.23.24",
|
|
72
|
+
"immer": "^10.2.0",
|
|
73
|
+
"katex": "^0.16.25",
|
|
74
|
+
"leva": "^0.10.1",
|
|
75
75
|
"lodash-es": "^4.17.21",
|
|
76
76
|
"lucide-react": "^0.543.0",
|
|
77
|
-
"marked": "^16.
|
|
78
|
-
"mermaid": "^11.
|
|
77
|
+
"marked": "^16.4.1",
|
|
78
|
+
"mermaid": "^11.12.1",
|
|
79
79
|
"numeral": "^2.0.6",
|
|
80
80
|
"polished": "^4.3.1",
|
|
81
|
-
"query-string": "^9.3.
|
|
81
|
+
"query-string": "^9.3.1",
|
|
82
82
|
"rc-collapse": "^4.0.0",
|
|
83
83
|
"rc-footer": "^0.6.8",
|
|
84
84
|
"rc-image": "^7.12.0",
|
|
85
|
+
"rc-input-number": "^9.5.0",
|
|
85
86
|
"rc-menu": "^9.16.1",
|
|
86
87
|
"re-resizable": "^6.11.2",
|
|
87
88
|
"react-avatar-editor": "^13.0.2",
|
|
88
89
|
"react-error-boundary": "^5.0.0",
|
|
89
|
-
"react-hotkeys-hook": "^5.1
|
|
90
|
+
"react-hotkeys-hook": "^5.2.1",
|
|
90
91
|
"react-layout-kit": "^2.0.0",
|
|
91
92
|
"react-markdown": "^10.1.0",
|
|
92
93
|
"react-merge-refs": "^3.0.2",
|
|
@@ -96,11 +97,11 @@
|
|
|
96
97
|
"rehype-katex": "^7.0.1",
|
|
97
98
|
"rehype-raw": "^7.0.0",
|
|
98
99
|
"remark-breaks": "^4.0.0",
|
|
99
|
-
"remark-cjk-friendly": "^1.2.
|
|
100
|
+
"remark-cjk-friendly": "^1.2.3",
|
|
100
101
|
"remark-gfm": "^4.0.1",
|
|
101
102
|
"remark-github": "^12.0.0",
|
|
102
103
|
"remark-math": "^6.0.0",
|
|
103
|
-
"shiki": "^3.
|
|
104
|
+
"shiki": "^3.15.0",
|
|
104
105
|
"swr": "^2.3.6",
|
|
105
106
|
"ts-md5": "^2.0.1",
|
|
106
107
|
"unified": "^11.0.5",
|