@lobehub/ui 1.116.2 → 1.116.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/ActionIcon/index.d.ts +14 -7
- package/es/ActionIcon/index.js +68 -43
- package/es/ChatItem/index.js +6 -11
- package/es/EditableMessage/index.d.ts +2 -2
- package/es/EditableMessage/index.js +40 -50
- package/es/EmojiPicker/index.js +28 -53
- package/es/Giscus/index.d.ts +1 -1
- package/es/Highlighter/index.js +4 -9
- package/es/Icon/index.d.ts +8 -7
- package/es/Icon/index.js +49 -18
- package/es/SearchBar/index.js +3 -8
- package/es/Snippet/index.js +3 -8
- package/es/types/chatMessage.d.ts +1 -2
- package/package.json +1 -2
- package/es/ActionIcon/calcSize.d.ts +0 -5
- package/es/ActionIcon/calcSize.js +0 -40
- package/es/Icon/calcSize.d.ts +0 -5
- package/es/Icon/calcSize.js +0 -39
package/es/ActionIcon/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type IconProps
|
|
3
|
-
import type
|
|
4
|
-
|
|
2
|
+
import { type IconProps } from "../Icon";
|
|
3
|
+
import { type TooltipProps } from "../Tooltip";
|
|
4
|
+
import { DivProps } from "../types";
|
|
5
|
+
export type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
|
|
5
6
|
blockSize?: number;
|
|
6
7
|
borderRadius?: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export interface ActionIconProps extends
|
|
8
|
+
fontSize?: number;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
};
|
|
11
|
+
export interface ActionIconProps extends DivProps {
|
|
11
12
|
/**
|
|
12
13
|
* @description Whether the icon is active or not
|
|
13
14
|
* @default false
|
|
@@ -18,11 +19,17 @@ export interface ActionIconProps extends Omit<IconProps, 'size' | 'icon'> {
|
|
|
18
19
|
* @default false
|
|
19
20
|
*/
|
|
20
21
|
arrow?: boolean;
|
|
22
|
+
color?: IconProps['color'];
|
|
23
|
+
fill?: IconProps['fill'];
|
|
21
24
|
/**
|
|
22
25
|
* @description Glass blur style
|
|
23
26
|
* @default 'false'
|
|
24
27
|
*/
|
|
25
28
|
glass?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @description The icon element to be rendered
|
|
31
|
+
* @type LucideIcon
|
|
32
|
+
*/
|
|
26
33
|
icon?: IconProps['icon'];
|
|
27
34
|
/**
|
|
28
35
|
* @description Set the loading status of ActionIcon
|
package/es/ActionIcon/index.js
CHANGED
|
@@ -1,21 +1,57 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["color", "fill", "className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading", "tooltipDelay"
|
|
3
|
+
var _excluded = ["color", "fill", "className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading", "tooltipDelay"];
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
import { Loader2 } from 'lucide-react';
|
|
7
|
-
import {
|
|
7
|
+
import { forwardRef, useMemo } from 'react';
|
|
8
8
|
import Icon from "../Icon";
|
|
9
|
-
import
|
|
9
|
+
import Spotlight from "../Spotlight";
|
|
10
|
+
import Tooltip from "../Tooltip";
|
|
10
11
|
import { useStyles } from "./style";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var calcSize = function calcSize(size) {
|
|
16
|
+
var blockSize;
|
|
17
|
+
var borderRadius;
|
|
18
|
+
switch (size) {
|
|
19
|
+
case 'large':
|
|
20
|
+
{
|
|
21
|
+
blockSize = 44;
|
|
22
|
+
borderRadius = 8;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case 'normal':
|
|
26
|
+
{
|
|
27
|
+
blockSize = 36;
|
|
28
|
+
borderRadius = 5;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case 'small':
|
|
32
|
+
{
|
|
33
|
+
blockSize = 24;
|
|
34
|
+
borderRadius = 5;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case 'site':
|
|
38
|
+
{
|
|
39
|
+
blockSize = 34;
|
|
40
|
+
borderRadius = 5;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
default:
|
|
44
|
+
{
|
|
45
|
+
blockSize = (size === null || size === void 0 ? void 0 : size.blockSize) || 36;
|
|
46
|
+
borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
blockSize: blockSize,
|
|
52
|
+
borderRadius: borderRadius
|
|
53
|
+
};
|
|
54
|
+
};
|
|
19
55
|
var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
56
|
var color = _ref.color,
|
|
21
57
|
fill = _ref.fill,
|
|
@@ -36,9 +72,6 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
36
72
|
loading = _ref.loading,
|
|
37
73
|
_ref$tooltipDelay = _ref.tooltipDelay,
|
|
38
74
|
tooltipDelay = _ref$tooltipDelay === void 0 ? 0.5 : _ref$tooltipDelay,
|
|
39
|
-
fillOpacity = _ref.fillOpacity,
|
|
40
|
-
fillRule = _ref.fillRule,
|
|
41
|
-
focusable = _ref.focusable,
|
|
42
75
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
76
|
var _useStyles = useStyles({
|
|
44
77
|
active: Boolean(active),
|
|
@@ -51,23 +84,21 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
51
84
|
}, [size]),
|
|
52
85
|
blockSize = _useMemo.blockSize,
|
|
53
86
|
borderRadius = _useMemo.borderRadius;
|
|
54
|
-
var
|
|
87
|
+
var content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
88
|
+
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
89
|
+
className: styles.icon,
|
|
90
|
+
color: color,
|
|
91
|
+
fill: fill,
|
|
92
|
+
icon: icon,
|
|
93
|
+
size: size === 'site' ? 'normal' : size
|
|
94
|
+
}), children]
|
|
95
|
+
});
|
|
96
|
+
var spin = /*#__PURE__*/_jsx(Icon, {
|
|
55
97
|
color: color,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
fillRule: fillRule,
|
|
59
|
-
focusable: focusable,
|
|
60
|
-
size: size === 'site' ? 'normal' : size
|
|
61
|
-
};
|
|
62
|
-
var content = icon && /*#__PURE__*/_jsx(Icon, _objectSpread({
|
|
63
|
-
className: styles.icon,
|
|
64
|
-
icon: icon
|
|
65
|
-
}, iconProps));
|
|
66
|
-
var spin = /*#__PURE__*/_jsx(Icon, _objectSpread(_objectSpread({
|
|
67
|
-
icon: Loader2
|
|
68
|
-
}, iconProps), {}, {
|
|
98
|
+
icon: Loader2,
|
|
99
|
+
size: size === 'site' ? 'normal' : size,
|
|
69
100
|
spin: true
|
|
70
|
-
})
|
|
101
|
+
});
|
|
71
102
|
var actionIconBlock = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
72
103
|
className: cx(styles.block, className),
|
|
73
104
|
onClick: loading ? undefined : onClick,
|
|
@@ -78,24 +109,18 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
78
109
|
width: blockSize
|
|
79
110
|
}, style)
|
|
80
111
|
}, rest), {}, {
|
|
81
|
-
children: [/*#__PURE__*/_jsx(
|
|
82
|
-
fallback: null,
|
|
83
|
-
children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
|
|
84
|
-
}), loading ? spin : content, children]
|
|
112
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), loading ? spin : content]
|
|
85
113
|
}));
|
|
86
114
|
if (!title) return actionIconBlock;
|
|
87
|
-
return /*#__PURE__*/_jsx(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
title: title,
|
|
97
|
-
children: actionIconBlock
|
|
98
|
-
})
|
|
115
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
116
|
+
arrow: arrow,
|
|
117
|
+
mouseEnterDelay: tooltipDelay,
|
|
118
|
+
overlayStyle: {
|
|
119
|
+
pointerEvents: 'none'
|
|
120
|
+
},
|
|
121
|
+
placement: placement,
|
|
122
|
+
title: title,
|
|
123
|
+
children: actionIconBlock
|
|
99
124
|
});
|
|
100
125
|
});
|
|
101
126
|
export default ActionIcon;
|
package/es/ChatItem/index.js
CHANGED
|
@@ -4,19 +4,17 @@ var _excluded = ["avatarAddon", "onAvatarClick", "actions", "className", "primar
|
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
import { useResponsive } from 'antd-style';
|
|
7
|
-
import {
|
|
7
|
+
import { memo } from 'react';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
9
|
import Actions from "./components/Actions";
|
|
10
10
|
import Avatar from "./components/Avatar";
|
|
11
11
|
import BorderSpacing from "./components/BorderSpacing";
|
|
12
|
+
import ErrorContent from "./components/ErrorContent";
|
|
12
13
|
import MessageContent from "./components/MessageContent";
|
|
13
14
|
import Title from "./components/Title";
|
|
14
15
|
import { useStyles } from "./style";
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
var ErrorContent = /*#__PURE__*/lazy(function () {
|
|
18
|
-
return import("./components/ErrorContent");
|
|
19
|
-
});
|
|
20
18
|
var MOBILE_AVATAR_SIZE = 32;
|
|
21
19
|
var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
22
20
|
var avatarAddon = _ref.avatarAddon,
|
|
@@ -80,13 +78,10 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
80
78
|
className: styles.messageContent,
|
|
81
79
|
direction: type === 'block' ? placement === 'left' ? 'horizontal' : 'horizontal-reverse' : 'vertical',
|
|
82
80
|
gap: 8,
|
|
83
|
-
children: [error ? /*#__PURE__*/_jsx(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
message: errorMessage,
|
|
88
|
-
placement: placement
|
|
89
|
-
})
|
|
81
|
+
children: [error ? /*#__PURE__*/_jsx(ErrorContent, {
|
|
82
|
+
error: error,
|
|
83
|
+
message: errorMessage,
|
|
84
|
+
placement: placement
|
|
90
85
|
}) : /*#__PURE__*/_jsx(MessageContent, {
|
|
91
86
|
editing: editing,
|
|
92
87
|
message: message,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
2
|
+
import { type MessageInputProps } from "../MessageInput";
|
|
3
|
+
import { type MessageModalProps } from "../MessageModal";
|
|
4
4
|
export interface EditableMessageProps {
|
|
5
5
|
/**
|
|
6
6
|
* @title The class name for the Markdown and MessageInput component
|
|
@@ -3,18 +3,14 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
import { createStyles } from 'antd-style';
|
|
6
|
-
import {
|
|
6
|
+
import { memo } from 'react';
|
|
7
7
|
import useControlledState from 'use-merge-value';
|
|
8
8
|
import Markdown from "../Markdown";
|
|
9
|
+
import MessageInput from "../MessageInput";
|
|
10
|
+
import MessageModal from "../MessageModal";
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
var MessageInput = /*#__PURE__*/lazy(function () {
|
|
13
|
-
return import("../MessageInput");
|
|
14
|
-
});
|
|
15
|
-
var MessageModal = /*#__PURE__*/lazy(function () {
|
|
16
|
-
return import("../MessageModal");
|
|
17
|
-
});
|
|
18
14
|
var useStyles = createStyles(function (_ref) {
|
|
19
15
|
var stylish = _ref.stylish;
|
|
20
16
|
return {
|
|
@@ -59,29 +55,26 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref2) {
|
|
|
59
55
|
expand = _useControlledState4[0],
|
|
60
56
|
setExpand = _useControlledState4[1];
|
|
61
57
|
var isAutoSize = height === 'auto';
|
|
62
|
-
var input = /*#__PURE__*/_jsx(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
textareaClassname: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
83
|
-
type: inputType
|
|
84
|
-
})
|
|
58
|
+
var input = /*#__PURE__*/_jsx(MessageInput, {
|
|
59
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
60
|
+
classNames: {
|
|
61
|
+
textarea: classNames === null || classNames === void 0 ? void 0 : classNames.textarea
|
|
62
|
+
},
|
|
63
|
+
defaultValue: value,
|
|
64
|
+
editButtonSize: editButtonSize,
|
|
65
|
+
height: height,
|
|
66
|
+
onCancel: function onCancel() {
|
|
67
|
+
return setTyping(false);
|
|
68
|
+
},
|
|
69
|
+
onConfirm: function onConfirm(text) {
|
|
70
|
+
_onChange === null || _onChange === void 0 || _onChange(text);
|
|
71
|
+
setTyping(false);
|
|
72
|
+
},
|
|
73
|
+
placeholder: placeholder,
|
|
74
|
+
style: stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.input,
|
|
75
|
+
text: text,
|
|
76
|
+
textareaClassname: classNames === null || classNames === void 0 ? void 0 : classNames.input,
|
|
77
|
+
type: inputType
|
|
85
78
|
});
|
|
86
79
|
if (!value && showEditWhenEmpty) return input;
|
|
87
80
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -94,26 +87,23 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref2) {
|
|
|
94
87
|
overflowY: 'auto'
|
|
95
88
|
}, stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.markdown),
|
|
96
89
|
children: value || placeholder
|
|
97
|
-
}), /*#__PURE__*/_jsx(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
text: text,
|
|
115
|
-
value: value
|
|
116
|
-
})
|
|
90
|
+
}), /*#__PURE__*/_jsx(MessageModal, {
|
|
91
|
+
editing: isEdit,
|
|
92
|
+
extra: model === null || model === void 0 ? void 0 : model.extra,
|
|
93
|
+
footer: model === null || model === void 0 ? void 0 : model.footer,
|
|
94
|
+
height: height,
|
|
95
|
+
onChange: function onChange(text) {
|
|
96
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
|
|
97
|
+
},
|
|
98
|
+
onEditingChange: setTyping,
|
|
99
|
+
onOpenChange: function onOpenChange(e) {
|
|
100
|
+
setExpand(e);
|
|
101
|
+
setTyping(false);
|
|
102
|
+
},
|
|
103
|
+
open: expand,
|
|
104
|
+
placeholder: placeholder,
|
|
105
|
+
text: text,
|
|
106
|
+
value: value
|
|
117
107
|
})]
|
|
118
108
|
});
|
|
119
109
|
});
|
package/es/EmojiPicker/index.js
CHANGED
|
@@ -1,53 +1,32 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import data from '@emoji-mart/data';
|
|
5
|
-
import
|
|
5
|
+
import Picker from '@emoji-mart/react';
|
|
6
6
|
import { Avatar } from "./..";
|
|
7
7
|
import { Popover } from 'antd';
|
|
8
|
-
import {
|
|
8
|
+
import { memo } from 'react';
|
|
9
9
|
import useSWR from 'swr';
|
|
10
10
|
import useMergeState from 'use-merge-value';
|
|
11
11
|
import { useStyles } from "./style";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
var Picker = /*#__PURE__*/lazy(function () {
|
|
14
|
-
return import('@emoji-mart/react');
|
|
15
|
-
});
|
|
16
|
-
var DEFAULT_EMOJI = '🤖';
|
|
17
|
-
var DEFAULT_LOCALE = 'en-US';
|
|
18
|
-
var DEFAULT_BACKGROUND_COLOR = 'rgba(0,0,0,0)';
|
|
19
|
-
var formatLocale = function formatLocale(locale) {
|
|
20
|
-
return locale.split('-')[0];
|
|
21
|
-
};
|
|
22
13
|
var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
23
14
|
var value = _ref.value,
|
|
24
15
|
_ref$defaultAvatar = _ref.defaultAvatar,
|
|
25
|
-
defaultAvatar = _ref$defaultAvatar === void 0 ?
|
|
16
|
+
defaultAvatar = _ref$defaultAvatar === void 0 ? '🤖' : _ref$defaultAvatar,
|
|
26
17
|
_ref$backgroundColor = _ref.backgroundColor,
|
|
27
|
-
backgroundColor = _ref$backgroundColor === void 0 ?
|
|
18
|
+
backgroundColor = _ref$backgroundColor === void 0 ? 'rgba(0,0,0,0)' : _ref$backgroundColor,
|
|
28
19
|
onChange = _ref.onChange,
|
|
29
20
|
_ref$locale = _ref.locale,
|
|
30
|
-
locale = _ref$locale === void 0 ?
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_useMergeState2 = _slicedToArray(_useMergeState, 2),
|
|
35
|
-
emojiLocale = _useMergeState2[0],
|
|
36
|
-
setEmojiLocale = _useMergeState2[1];
|
|
37
|
-
var _useMergeState3 = useMergeState('🤖', {
|
|
38
|
-
defaultValue: defaultAvatar,
|
|
39
|
-
onChange: onChange,
|
|
40
|
-
value: value
|
|
41
|
-
}),
|
|
42
|
-
_useMergeState4 = _slicedToArray(_useMergeState3, 2),
|
|
43
|
-
ava = _useMergeState4[0],
|
|
44
|
-
setAva = _useMergeState4[1];
|
|
45
|
-
var _useSWR = useSWR(emojiLocale === DEFAULT_LOCALE ? null : emojiLocale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
locale = _ref$locale === void 0 ? 'en-US' : _ref$locale;
|
|
22
|
+
var _useStyles = useStyles(),
|
|
23
|
+
styles = _useStyles.styles;
|
|
24
|
+
var _useSWR = useSWR(locale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
46
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
47
26
|
while (1) switch (_context.prev = _context.next) {
|
|
48
27
|
case 0:
|
|
49
28
|
_context.next = 2;
|
|
50
|
-
return import("@emoji-mart/data/i18n/".concat(
|
|
29
|
+
return import("@emoji-mart/data/i18n/".concat(locale.split('-')[0], ".json"));
|
|
51
30
|
case 2:
|
|
52
31
|
return _context.abrupt("return", _context.sent);
|
|
53
32
|
case 3:
|
|
@@ -55,32 +34,28 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
55
34
|
return _context.stop();
|
|
56
35
|
}
|
|
57
36
|
}, _callee);
|
|
58
|
-
})),
|
|
59
|
-
onError: function onError() {
|
|
60
|
-
return setEmojiLocale(DEFAULT_LOCALE);
|
|
61
|
-
},
|
|
62
|
-
onErrorRetry: function onErrorRetry() {
|
|
63
|
-
return setEmojiLocale(DEFAULT_LOCALE);
|
|
64
|
-
}
|
|
65
|
-
}),
|
|
37
|
+
}))),
|
|
66
38
|
i18n = _useSWR.data;
|
|
67
|
-
var
|
|
68
|
-
|
|
39
|
+
var _useMergeState = useMergeState('🤖', {
|
|
40
|
+
defaultValue: defaultAvatar,
|
|
41
|
+
onChange: onChange,
|
|
42
|
+
value: value
|
|
43
|
+
}),
|
|
44
|
+
_useMergeState2 = _slicedToArray(_useMergeState, 2),
|
|
45
|
+
ava = _useMergeState2[0],
|
|
46
|
+
setAva = _useMergeState2[1];
|
|
69
47
|
return /*#__PURE__*/_jsx(Popover, {
|
|
70
48
|
content: /*#__PURE__*/_jsx("div", {
|
|
71
49
|
className: styles.picker,
|
|
72
|
-
children: /*#__PURE__*/_jsx(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
skinTonePosition: 'none',
|
|
82
|
-
theme: 'auto'
|
|
83
|
-
})
|
|
50
|
+
children: /*#__PURE__*/_jsx(Picker, {
|
|
51
|
+
data: data,
|
|
52
|
+
i18n: i18n,
|
|
53
|
+
locale: locale.split('-')[0],
|
|
54
|
+
onEmojiSelect: function onEmojiSelect(e) {
|
|
55
|
+
return setAva(e.native);
|
|
56
|
+
},
|
|
57
|
+
skinTonePosition: 'none',
|
|
58
|
+
theme: 'auto'
|
|
84
59
|
})
|
|
85
60
|
}),
|
|
86
61
|
placement: 'left',
|
package/es/Giscus/index.d.ts
CHANGED
package/es/Highlighter/index.js
CHANGED
|
@@ -3,17 +3,15 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["fullFeatured", "copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight"];
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
|
-
import {
|
|
6
|
+
import { memo } from 'react';
|
|
7
7
|
import CopyButton from "../CopyButton";
|
|
8
|
+
import Spotlight from "../Spotlight";
|
|
8
9
|
import Tag from "../Tag";
|
|
9
10
|
import FullFeatured from "./FullFeatured";
|
|
10
11
|
import SyntaxHighlighter from "./SyntaxHighlighter";
|
|
11
12
|
import { useStyles } from "./style";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
var Spotlight = /*#__PURE__*/lazy(function () {
|
|
15
|
-
return import("../Spotlight");
|
|
16
|
-
});
|
|
17
15
|
export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
18
16
|
var fullFeatured = _ref.fullFeatured,
|
|
19
17
|
_ref$copyButtonSize = _ref.copyButtonSize,
|
|
@@ -46,11 +44,8 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
46
44
|
"data-code-type": "highlighter",
|
|
47
45
|
style: style
|
|
48
46
|
}, rest), {}, {
|
|
49
|
-
children: [/*#__PURE__*/_jsx(
|
|
50
|
-
|
|
51
|
-
children: spotlight && /*#__PURE__*/_jsx(Spotlight, {
|
|
52
|
-
size: 240
|
|
53
|
-
})
|
|
47
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {
|
|
48
|
+
size: 240
|
|
54
49
|
}), copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
55
50
|
className: styles.button,
|
|
56
51
|
content: children,
|
package/es/Icon/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { LucideIcon
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
3
|
import { DivProps } from "../types";
|
|
4
|
-
export
|
|
4
|
+
export type IconSize = 'large' | 'normal' | 'small' | {
|
|
5
5
|
fontSize?: number;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
6
|
+
strokeWidth?: number;
|
|
7
|
+
};
|
|
8
|
+
export interface IconProps extends DivProps {
|
|
9
|
+
color?: string;
|
|
10
|
+
fill?: string;
|
|
10
11
|
/**
|
|
11
12
|
* @description The icon element to be rendered
|
|
12
13
|
* @type LucideIcon
|
|
@@ -23,5 +24,5 @@ export interface IconProps extends DivProps, Pick<LucideProps, 'fill' | 'fillRul
|
|
|
23
24
|
*/
|
|
24
25
|
spin?: boolean;
|
|
25
26
|
}
|
|
26
|
-
declare const Icon: import("react").
|
|
27
|
+
declare const Icon: import("react").NamedExoticComponent<IconProps>;
|
|
27
28
|
export default Icon;
|
package/es/Icon/index.js
CHANGED
|
@@ -1,24 +1,57 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["icon", "size", "color", "fill", "className", "
|
|
4
|
-
_excluded2 = ["fontSize"];
|
|
3
|
+
var _excluded = ["icon", "size", "color", "fill", "className", "spin"];
|
|
5
4
|
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
5
|
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
|
-
import {
|
|
8
|
-
import { calcSize } from "./calcSize";
|
|
6
|
+
import { memo, useMemo } from 'react';
|
|
9
7
|
import { useStyles } from "./style";
|
|
10
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
var
|
|
9
|
+
var calcSize = function calcSize(size) {
|
|
10
|
+
var fontSize;
|
|
11
|
+
var strokeWidth;
|
|
12
|
+
switch (size) {
|
|
13
|
+
case 'large':
|
|
14
|
+
{
|
|
15
|
+
fontSize = 24;
|
|
16
|
+
strokeWidth = 2;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
case 'normal':
|
|
20
|
+
{
|
|
21
|
+
fontSize = 20;
|
|
22
|
+
strokeWidth = 2;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case 'small':
|
|
26
|
+
{
|
|
27
|
+
fontSize = 14;
|
|
28
|
+
strokeWidth = 1.5;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
{
|
|
33
|
+
if (size) {
|
|
34
|
+
fontSize = (size === null || size === void 0 ? void 0 : size.fontSize) || 24;
|
|
35
|
+
strokeWidth = (size === null || size === void 0 ? void 0 : size.strokeWidth) || 2;
|
|
36
|
+
} else {
|
|
37
|
+
fontSize = '1em';
|
|
38
|
+
strokeWidth = 2;
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
fontSize: fontSize,
|
|
45
|
+
strokeWidth: strokeWidth
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var Icon = /*#__PURE__*/memo(function (_ref) {
|
|
12
49
|
var icon = _ref.icon,
|
|
13
50
|
size = _ref.size,
|
|
14
51
|
color = _ref.color,
|
|
15
|
-
|
|
16
|
-
fill = _ref$fill === void 0 ? 'transparent' : _ref$fill,
|
|
52
|
+
fill = _ref.fill,
|
|
17
53
|
className = _ref.className,
|
|
18
|
-
focusable = _ref.focusable,
|
|
19
54
|
spin = _ref.spin,
|
|
20
|
-
fillRule = _ref.fillRule,
|
|
21
|
-
fillOpacity = _ref.fillOpacity,
|
|
22
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
23
56
|
var _useStyles = useStyles(),
|
|
24
57
|
styles = _useStyles.styles,
|
|
@@ -28,22 +61,20 @@ var Icon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
28
61
|
return calcSize(size);
|
|
29
62
|
}, [size]),
|
|
30
63
|
fontSize = _useMemo.fontSize,
|
|
31
|
-
|
|
64
|
+
strokeWidth = _useMemo.strokeWidth;
|
|
32
65
|
return /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({
|
|
33
66
|
className: cx('anticon', spin && styles.spin, className),
|
|
34
67
|
role: "img"
|
|
35
68
|
}, rest), {}, {
|
|
36
|
-
children: /*#__PURE__*/_jsx(SvgIcon,
|
|
69
|
+
children: /*#__PURE__*/_jsx(SvgIcon, {
|
|
37
70
|
color: color,
|
|
38
|
-
fill: fill,
|
|
39
|
-
|
|
40
|
-
fillRule: fillRule,
|
|
41
|
-
focusable: focusable,
|
|
71
|
+
fill: fill !== null && fill !== void 0 ? fill : 'transparent',
|
|
72
|
+
focusable: false,
|
|
42
73
|
height: fontSize,
|
|
43
|
-
ref: ref,
|
|
44
74
|
size: fontSize,
|
|
75
|
+
strokeWidth: strokeWidth,
|
|
45
76
|
width: fontSize
|
|
46
|
-
}
|
|
77
|
+
})
|
|
47
78
|
}));
|
|
48
79
|
});
|
|
49
80
|
export default Icon;
|
package/es/SearchBar/index.js
CHANGED
|
@@ -5,17 +5,15 @@ var _excluded = ["defaultValue", "spotlight", "className", "value", "onInputChan
|
|
|
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
|
import { Search } from 'lucide-react';
|
|
8
|
-
import {
|
|
8
|
+
import { memo, useEffect, useRef, useState } from 'react';
|
|
9
9
|
import useControlledState from 'use-merge-value';
|
|
10
10
|
import Icon from "../Icon";
|
|
11
11
|
import { Input } from "../Input";
|
|
12
|
+
import Spotlight from "../Spotlight";
|
|
12
13
|
import Tag from "../Tag";
|
|
13
14
|
import { useStyles } from "./style";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
var Spotlight = /*#__PURE__*/lazy(function () {
|
|
17
|
-
return import("../Spotlight");
|
|
18
|
-
});
|
|
19
17
|
var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
20
18
|
var defaultValue = _ref.defaultValue,
|
|
21
19
|
spotlight = _ref.spotlight,
|
|
@@ -68,10 +66,7 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
68
66
|
}, []);
|
|
69
67
|
return /*#__PURE__*/_jsxs("div", {
|
|
70
68
|
className: cx(styles.search, className),
|
|
71
|
-
children: [/*#__PURE__*/_jsx(
|
|
72
|
-
fallback: null,
|
|
73
|
-
children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
|
|
74
|
-
}), /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
69
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
75
70
|
allowClear: true,
|
|
76
71
|
className: styles.input,
|
|
77
72
|
onBlur: function onBlur() {
|
package/es/Snippet/index.js
CHANGED
|
@@ -3,15 +3,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["symbol", "language", "children", "copyable", "type", "spotlight", "className"];
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
|
-
import {
|
|
6
|
+
import { memo } from 'react';
|
|
7
7
|
import CopyButton from "../CopyButton";
|
|
8
8
|
import SyntaxHighlighter from "../Highlighter/SyntaxHighlighter";
|
|
9
|
+
import Spotlight from "../Spotlight";
|
|
9
10
|
import { useStyles } from "./style";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
var Spotlight = /*#__PURE__*/lazy(function () {
|
|
13
|
-
return import("../Spotlight");
|
|
14
|
-
});
|
|
15
13
|
var Snippet = /*#__PURE__*/memo(function (_ref) {
|
|
16
14
|
var symbol = _ref.symbol,
|
|
17
15
|
_ref$language = _ref.language,
|
|
@@ -30,10 +28,7 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
28
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
31
29
|
className: cx(styles.container, className)
|
|
32
30
|
}, rest), {}, {
|
|
33
|
-
children: [/*#__PURE__*/_jsx(
|
|
34
|
-
fallback: null,
|
|
35
|
-
children: spotlight && /*#__PURE__*/_jsx(Spotlight, {})
|
|
36
|
-
}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
31
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
37
32
|
language: language,
|
|
38
33
|
children: [symbol, children].filter(Boolean).join(' ')
|
|
39
34
|
}), copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
|
|
2
1
|
import { ErrorType } from './error';
|
|
3
2
|
import { LLMRoleType } from './llm';
|
|
4
3
|
import { BaseDataModel } from './meta';
|
|
@@ -29,7 +28,7 @@ export interface ChatMessage extends BaseDataModel {
|
|
|
29
28
|
function_call?: OpenAIFunctionCall;
|
|
30
29
|
name?: string;
|
|
31
30
|
parentId?: string;
|
|
32
|
-
plugin?:
|
|
31
|
+
plugin?: any;
|
|
33
32
|
quotaId?: string;
|
|
34
33
|
/**
|
|
35
34
|
* 角色
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.116.
|
|
3
|
+
"version": "1.116.3",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"@emoji-mart/react": "^1",
|
|
78
78
|
"@floating-ui/react": "^0",
|
|
79
79
|
"@giscus/react": "^2",
|
|
80
|
-
"@lobehub/chat-plugin-sdk": "latest",
|
|
81
80
|
"@lobehub/emojilib": "latest",
|
|
82
81
|
"@react-spring/web": "^9",
|
|
83
82
|
"@splinetool/react-spline": "^2.2.6",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export var calcSize = function calcSize(size) {
|
|
2
|
-
var blockSize;
|
|
3
|
-
var borderRadius;
|
|
4
|
-
switch (size) {
|
|
5
|
-
case 'large':
|
|
6
|
-
{
|
|
7
|
-
blockSize = 44;
|
|
8
|
-
borderRadius = 8;
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
case 'normal':
|
|
12
|
-
{
|
|
13
|
-
blockSize = 36;
|
|
14
|
-
borderRadius = 5;
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
case 'small':
|
|
18
|
-
{
|
|
19
|
-
blockSize = 24;
|
|
20
|
-
borderRadius = 5;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
case 'site':
|
|
24
|
-
{
|
|
25
|
-
blockSize = 34;
|
|
26
|
-
borderRadius = 5;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
default:
|
|
30
|
-
{
|
|
31
|
-
blockSize = (size === null || size === void 0 ? void 0 : size.blockSize) || 36;
|
|
32
|
-
borderRadius = (size === null || size === void 0 ? void 0 : size.borderRadius) || 5;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
blockSize: blockSize,
|
|
38
|
-
borderRadius: borderRadius
|
|
39
|
-
};
|
|
40
|
-
};
|
package/es/Icon/calcSize.d.ts
DELETED
package/es/Icon/calcSize.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export var calcSize = function calcSize(size) {
|
|
2
|
-
var fontSize;
|
|
3
|
-
var strokeWidth;
|
|
4
|
-
switch (size) {
|
|
5
|
-
case 'large':
|
|
6
|
-
{
|
|
7
|
-
fontSize = 24;
|
|
8
|
-
strokeWidth = 2;
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
case 'normal':
|
|
12
|
-
{
|
|
13
|
-
fontSize = 20;
|
|
14
|
-
strokeWidth = 2;
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
case 'small':
|
|
18
|
-
{
|
|
19
|
-
fontSize = 14;
|
|
20
|
-
strokeWidth = 1.5;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
default:
|
|
24
|
-
{
|
|
25
|
-
if (size) {
|
|
26
|
-
fontSize = (size === null || size === void 0 ? void 0 : size.fontSize) || 24;
|
|
27
|
-
strokeWidth = (size === null || size === void 0 ? void 0 : size.strokeWidth) || 2;
|
|
28
|
-
} else {
|
|
29
|
-
fontSize = '1em';
|
|
30
|
-
strokeWidth = 2;
|
|
31
|
-
}
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
fontSize: fontSize,
|
|
37
|
-
strokeWidth: strokeWidth
|
|
38
|
-
};
|
|
39
|
-
};
|