@lobehub/ui 1.149.1 → 1.149.3
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.
- package/es/EmojiPicker/index.js +17 -4
- package/es/Markdown/index.d.ts +5 -0
- package/es/Markdown/index.js +16 -9
- package/package.json +21 -20
package/es/EmojiPicker/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
3
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
5
4
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import data from '@emoji-mart/data';
|
|
7
7
|
import Picker from '@emoji-mart/react';
|
|
8
8
|
import { Popover } from 'antd';
|
|
9
|
-
import { memo } from 'react';
|
|
9
|
+
import { memo, useState } from 'react';
|
|
10
10
|
import useSWR from 'swr';
|
|
11
11
|
import useMergeState from 'use-merge-value';
|
|
12
12
|
import Avatar from "../Avatar";
|
|
@@ -21,6 +21,10 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
21
21
|
onChange = _ref.onChange,
|
|
22
22
|
_ref$locale = _ref.locale,
|
|
23
23
|
locale = _ref$locale === void 0 ? 'en-US' : _ref$locale;
|
|
24
|
+
var _useState = useState(false),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
open = _useState2[0],
|
|
27
|
+
setOpen = _useState2[1];
|
|
24
28
|
var _useStyles = useStyles(),
|
|
25
29
|
styles = _useStyles.styles;
|
|
26
30
|
var _useSWR = useSWR(locale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -49,24 +53,33 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
49
53
|
ava = _useMergeState2[0],
|
|
50
54
|
setAva = _useMergeState2[1];
|
|
51
55
|
return /*#__PURE__*/_jsx(Popover, {
|
|
56
|
+
arrow: false,
|
|
52
57
|
content: /*#__PURE__*/_jsx("div", {
|
|
53
58
|
className: styles.picker,
|
|
59
|
+
onBlur: function onBlur() {
|
|
60
|
+
return setOpen(false);
|
|
61
|
+
},
|
|
54
62
|
children: /*#__PURE__*/_jsx(Picker, {
|
|
55
63
|
data: data,
|
|
56
64
|
i18n: i18n,
|
|
57
65
|
locale: locale.split('-')[0],
|
|
58
66
|
onEmojiSelect: function onEmojiSelect(e) {
|
|
59
|
-
|
|
67
|
+
setAva(e.native);
|
|
68
|
+
setOpen(false);
|
|
60
69
|
},
|
|
61
70
|
skinTonePosition: 'none',
|
|
62
71
|
theme: 'auto'
|
|
63
72
|
})
|
|
64
73
|
}),
|
|
74
|
+
open: open,
|
|
65
75
|
placement: 'left',
|
|
66
76
|
rootClassName: styles.popover,
|
|
67
|
-
trigger: 'click',
|
|
77
|
+
trigger: ['click'],
|
|
68
78
|
children: /*#__PURE__*/_jsx("div", {
|
|
69
79
|
className: styles.avatar,
|
|
80
|
+
onClick: function onClick() {
|
|
81
|
+
return setOpen(true);
|
|
82
|
+
},
|
|
70
83
|
style: {
|
|
71
84
|
width: 'fit-content'
|
|
72
85
|
},
|
package/es/Markdown/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AnchorProps } from 'antd';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
|
+
import type { Components } from 'react-markdown/lib/ast-to-react';
|
|
4
|
+
import type { Pluggable } from 'unified';
|
|
3
5
|
import { type HighlighterProps } from "../Highlighter";
|
|
4
6
|
import { type MermaidProps } from "../Mermaid";
|
|
5
7
|
import { type ImageProps } from "../mdx/Image";
|
|
@@ -19,11 +21,14 @@ export interface MarkdownProps extends TypographyProps {
|
|
|
19
21
|
pre?: Partial<PreProps>;
|
|
20
22
|
video?: Partial<VideoProps>;
|
|
21
23
|
};
|
|
24
|
+
components?: Components;
|
|
22
25
|
enableImageGallery?: boolean;
|
|
23
26
|
enableLatex?: boolean;
|
|
24
27
|
enableMermaid?: boolean;
|
|
25
28
|
fullFeaturedCodeBlock?: boolean;
|
|
26
29
|
onDoubleClick?: () => void;
|
|
30
|
+
rehypePlugins?: Pluggable[];
|
|
31
|
+
remarkPlugins?: Pluggable[];
|
|
27
32
|
style?: CSSProperties;
|
|
28
33
|
variant?: 'normal' | 'chat';
|
|
29
34
|
}
|
package/es/Markdown/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "enableLatex", "enableMermaid", "enableImageGallery", "componentProps", "allowHtml", "fontSize", "headerMultiple", "marginMultiple", "variant", "lineHeight"];
|
|
6
|
+
var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "enableLatex", "enableMermaid", "enableImageGallery", "componentProps", "allowHtml", "fontSize", "headerMultiple", "marginMultiple", "variant", "lineHeight", "rehypePlugins", "remarkPlugins", "components"];
|
|
6
7
|
import { memo, useMemo } from 'react';
|
|
7
8
|
import ReactMarkdown from 'react-markdown';
|
|
8
9
|
import rehypeKatex from 'rehype-katex';
|
|
@@ -39,6 +40,12 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
39
40
|
_ref$variant = _ref.variant,
|
|
40
41
|
variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
|
|
41
42
|
lineHeight = _ref.lineHeight,
|
|
43
|
+
_ref$rehypePlugins = _ref.rehypePlugins,
|
|
44
|
+
rehypePlugins = _ref$rehypePlugins === void 0 ? [] : _ref$rehypePlugins,
|
|
45
|
+
_ref$remarkPlugins = _ref.remarkPlugins,
|
|
46
|
+
remarkPlugins = _ref$remarkPlugins === void 0 ? [] : _ref$remarkPlugins,
|
|
47
|
+
_ref$components = _ref.components,
|
|
48
|
+
components = _ref$components === void 0 ? {} : _ref$components,
|
|
42
49
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
50
|
var _useStyles = useStyles({
|
|
44
51
|
fontSize: fontSize,
|
|
@@ -59,7 +66,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
59
66
|
if (!enableLatex) return fixMarkdownBold(children);
|
|
60
67
|
return fixMarkdownBold(escapeMhchem(escapeBrackets(children)));
|
|
61
68
|
}, [children, enableLatex]);
|
|
62
|
-
var
|
|
69
|
+
var componentsCache = useMemo(function () {
|
|
63
70
|
return {
|
|
64
71
|
a: function a(props) {
|
|
65
72
|
return /*#__PURE__*/_jsx(Link, _objectSpread(_objectSpread({}, props), componentProps === null || componentProps === void 0 ? void 0 : componentProps.a));
|
|
@@ -89,12 +96,12 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
89
96
|
}
|
|
90
97
|
};
|
|
91
98
|
}, [componentProps, enableImageGallery, enableMermaid, fullFeaturedCodeBlock]);
|
|
92
|
-
var
|
|
99
|
+
var rehypePluginsCache = useMemo(function () {
|
|
93
100
|
return [allowHtml && rehypeRaw, enableLatex && rehypeKatex].filter(Boolean);
|
|
94
|
-
}, [allowHtml]);
|
|
95
|
-
var
|
|
101
|
+
}, [allowHtml, enableLatex]);
|
|
102
|
+
var remarkPluginsCache = useMemo(function () {
|
|
96
103
|
return [remarkGfm, enableLatex && remarkMath, isChatMode && remarkBreaks].filter(Boolean);
|
|
97
|
-
}, [isChatMode]);
|
|
104
|
+
}, [isChatMode, enableLatex]);
|
|
98
105
|
return /*#__PURE__*/_jsx("article", {
|
|
99
106
|
className: cx(styles.root, className),
|
|
100
107
|
"data-code-type": "markdown",
|
|
@@ -104,9 +111,9 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
104
111
|
enable: enableImageGallery,
|
|
105
112
|
children: /*#__PURE__*/_jsx(ReactMarkdown, _objectSpread(_objectSpread({
|
|
106
113
|
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),
|
|
107
|
-
components: components,
|
|
108
|
-
rehypePlugins: rehypePlugins,
|
|
109
|
-
remarkPlugins: remarkPlugins
|
|
114
|
+
components: _objectSpread(_objectSpread({}, componentsCache), components),
|
|
115
|
+
rehypePlugins: [].concat(_toConsumableArray(rehypePluginsCache), _toConsumableArray(rehypePlugins)),
|
|
116
|
+
remarkPlugins: [].concat(_toConsumableArray(remarkPluginsCache), _toConsumableArray(remarkPlugins))
|
|
110
117
|
}, rest), {}, {
|
|
111
118
|
children: escapedContent
|
|
112
119
|
}))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.149.
|
|
3
|
+
"version": "1.149.3",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -75,21 +75,21 @@
|
|
|
75
75
|
]
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@babel/runtime": "^7.
|
|
78
|
+
"@babel/runtime": "^7.25.4",
|
|
79
79
|
"@dnd-kit/core": "^6.1.0",
|
|
80
80
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
81
81
|
"@dnd-kit/sortable": "^8.0.0",
|
|
82
82
|
"@dnd-kit/utilities": "^3.2.2",
|
|
83
83
|
"@emoji-mart/data": "^1.2.1",
|
|
84
84
|
"@emoji-mart/react": "^1.1.1",
|
|
85
|
-
"@floating-ui/react": "^0.26.
|
|
85
|
+
"@floating-ui/react": "^0.26.23",
|
|
86
86
|
"@giscus/react": "^3.0.0",
|
|
87
87
|
"@lobehub/emojilib": "latest",
|
|
88
|
-
"@react-spring/web": "^9.7.
|
|
89
|
-
"@shikijs/transformers": "^1.
|
|
88
|
+
"@react-spring/web": "^9.7.4",
|
|
89
|
+
"@shikijs/transformers": "^1.14.1",
|
|
90
90
|
"@splinetool/runtime": "^0.9.526",
|
|
91
|
-
"chroma-js": "^2.
|
|
92
|
-
"dayjs": "^1.11.
|
|
91
|
+
"chroma-js": "^2.6.0",
|
|
92
|
+
"dayjs": "^1.11.13",
|
|
93
93
|
"emoji-mart": "^5.6.0",
|
|
94
94
|
"emoji-regex": "^10.3.0",
|
|
95
95
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -100,33 +100,33 @@
|
|
|
100
100
|
"numeral": "^2.0.6",
|
|
101
101
|
"polished": "^4.3.1",
|
|
102
102
|
"prism-react-renderer": "^2.3.1",
|
|
103
|
-
"query-string": "^9.
|
|
103
|
+
"query-string": "^9.1.0",
|
|
104
104
|
"rc-footer": "^0.6.8",
|
|
105
105
|
"re-resizable": "^6.9.17",
|
|
106
106
|
"react-error-boundary": "^4.0.13",
|
|
107
107
|
"react-layout-kit": "^1.9.0",
|
|
108
108
|
"react-markdown": "^8.0.7",
|
|
109
109
|
"react-merge-refs": "^2.1.1",
|
|
110
|
-
"react-rnd": "^10.4.
|
|
110
|
+
"react-rnd": "^10.4.12",
|
|
111
111
|
"react-simple-code-editor": "^0.13.1",
|
|
112
112
|
"rehype-katex": "^6.0.3",
|
|
113
113
|
"rehype-raw": "^7.0.0",
|
|
114
114
|
"remark-breaks": "^4.0.0",
|
|
115
115
|
"remark-gfm": "^3.0.1",
|
|
116
116
|
"remark-math": "^5.1.1",
|
|
117
|
-
"shiki": "^1.
|
|
117
|
+
"shiki": "^1.14.1",
|
|
118
118
|
"swr": "^2.2.5",
|
|
119
119
|
"ts-md5": "^1.3.1",
|
|
120
120
|
"url-join": "^5.0.0",
|
|
121
121
|
"use-merge-value": "^1.2.0",
|
|
122
122
|
"uuid": "^10.0.0",
|
|
123
|
-
"zustand": "^4.5.
|
|
123
|
+
"zustand": "^4.5.5",
|
|
124
124
|
"zustand-utils": "^1.3.2"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
|
-
"@ant-design/icons": "^5.
|
|
128
|
-
"@commitlint/cli": "^19.
|
|
129
|
-
"@lobehub/lint": "^1.24.
|
|
127
|
+
"@ant-design/icons": "^5.4.0",
|
|
128
|
+
"@commitlint/cli": "^19.4.0",
|
|
129
|
+
"@lobehub/lint": "^1.24.4",
|
|
130
130
|
"@testing-library/react": "^14.3.1",
|
|
131
131
|
"@types/chroma-js": "^2.4.4",
|
|
132
132
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"@types/uuid": "^10.0.0",
|
|
140
140
|
"@vitest/coverage-v8": "~1.2.2",
|
|
141
141
|
"babel-plugin-antd-style": "^1.0.4",
|
|
142
|
-
"commitlint": "^19.
|
|
142
|
+
"commitlint": "^19.4.0",
|
|
143
143
|
"concurrently": "^8.2.2",
|
|
144
144
|
"cross-env": "^7.0.3",
|
|
145
145
|
"dpdm": "^3.14.0",
|
|
@@ -148,16 +148,16 @@
|
|
|
148
148
|
"eslint": "^8.57.0",
|
|
149
149
|
"father": "4.3.1",
|
|
150
150
|
"husky": "9.0.11",
|
|
151
|
-
"jsdom": "^24.1.
|
|
152
|
-
"lint-staged": "^15.2.
|
|
153
|
-
"prettier": "^3.3.
|
|
151
|
+
"jsdom": "^24.1.3",
|
|
152
|
+
"lint-staged": "^15.2.9",
|
|
153
|
+
"prettier": "^3.3.3",
|
|
154
154
|
"react": "^18.3.1",
|
|
155
155
|
"react-dom": "^18.3.1",
|
|
156
156
|
"remark": "^14.0.3",
|
|
157
157
|
"remark-cli": "^11.0.0",
|
|
158
158
|
"semantic-release": "^21.1.2",
|
|
159
159
|
"stylelint": "^15.11.0",
|
|
160
|
-
"typescript": "^5.5.
|
|
160
|
+
"typescript": "^5.5.4",
|
|
161
161
|
"vitest": "~1.2.2"
|
|
162
162
|
},
|
|
163
163
|
"peerDependencies": {
|
|
@@ -166,7 +166,8 @@
|
|
|
166
166
|
"antd-style": ">=3",
|
|
167
167
|
"lucide-react": ">=0.396.0",
|
|
168
168
|
"react": ">=18",
|
|
169
|
-
"react-dom": ">=18"
|
|
169
|
+
"react-dom": ">=18",
|
|
170
|
+
"unified": ">=10.0.0"
|
|
170
171
|
},
|
|
171
172
|
"publishConfig": {
|
|
172
173
|
"access": "public",
|