@lobehub/ui 1.26.0 → 1.26.2
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 +1 -1
- package/es/ActionIcon/index.js +30 -18
- package/es/Avatar/index.js +11 -11
- package/es/Chat/store/initialState.d.ts +3 -3
- package/es/Chat/store/initialState.js +4 -4
- package/es/Chat/store/messageReducer.js +71 -49
- package/es/Chat/store/selectors.d.ts +3 -3
- package/es/Chat/store/selectors.js +3 -3
- package/es/Chat/store/store.d.ts +1 -1
- package/es/Chat/store/store.js +110 -110
- package/es/Chat/types.d.ts +1 -1
- package/es/Chat/utils/fetch.d.ts +1 -1
- package/es/Chat/utils/fetch.js +4 -4
- package/es/ChatInputArea/index.js +2 -1
- package/es/ChatInputArea/style.d.ts +3 -3
- package/es/ChatInputArea/style.js +5 -5
- package/es/ChatItem/index.js +12 -10
- package/es/ChatItem/style.d.ts +3 -3
- package/es/ChatItem/style.js +7 -7
- package/es/ChatList/ActionsBar.d.ts +1 -1
- package/es/ChatList/ActionsBar.js +12 -11
- package/es/ChatList/index.d.ts +1 -1
- package/es/ChatList/index.js +1 -1
- package/es/ColorScales/ScaleRow.js +20 -14
- package/es/ColorScales/index.js +6 -4
- package/es/ColorScales/style.d.ts +2 -2
- package/es/ColorScales/style.js +7 -7
- package/es/ContextMenu/MenuItem/index.js +14 -14
- package/es/ContextMenu/MenuItem/style.d.ts +2 -2
- package/es/ContextMenu/MenuItem/style.js +5 -5
- package/es/ContextMenu/index.js +42 -42
- package/es/ContextMenu/style.d.ts +1 -1
- package/es/ContextMenu/style.js +2 -2
- package/es/Conversation/App.js +2 -2
- package/es/Conversation/ChatList/MessageItem/Content.js +15 -15
- package/es/Conversation/ChatList/MessageItem/Toolbar.js +3 -3
- package/es/Conversation/ChatList/MessageItem/index.js +14 -14
- package/es/Conversation/ChatList/index.js +5 -5
- package/es/Conversation/InputArea/ActionBar.d.ts +2 -2
- package/es/Conversation/InputArea/ActionBar.js +2 -2
- package/es/Conversation/InputArea/index.d.ts +2 -2
- package/es/Conversation/InputArea/index.js +10 -12
- package/es/Conversation/StoreUpdater.js +1 -1
- package/es/Conversation/index.js +2 -2
- package/es/CopyButton/index.d.ts +4 -2
- package/es/CopyButton/index.js +4 -3
- package/es/DraggablePanel/index.d.ts +2 -2
- package/es/DraggablePanel/index.js +50 -42
- package/es/DraggablePanel/style.d.ts +9 -9
- package/es/DraggablePanel/style.js +17 -17
- package/es/DraggablePanel/utils.js +12 -4
- package/es/EditableMessage/index.js +4 -4
- package/es/EditableMessageList/index.js +20 -19
- package/es/EditableText/index.js +1 -1
- package/es/Features/Item.js +5 -5
- package/es/Features/Item.style.d.ts +2 -2
- package/es/Features/Item.style.js +4 -4
- package/es/Features/index.js +3 -3
- package/es/Features/style.js +2 -2
- package/es/FontLoader/index.d.ts +6 -0
- package/es/FontLoader/index.js +16 -0
- package/es/Footer/index.js +2 -2
- package/es/GradientButton/style.d.ts +1 -1
- package/es/GradientButton/style.js +2 -2
- package/es/Header/index.js +2 -2
- package/es/Header/style.d.ts +1 -1
- package/es/Header/style.js +2 -2
- package/es/Hero/style.d.ts +3 -3
- package/es/Hero/style.js +14 -13
- package/es/Highlighter/SyntaxHighlighter/Prism.js +7 -7
- package/es/Highlighter/SyntaxHighlighter/index.js +1 -1
- package/es/Highlighter/SyntaxHighlighter/style.d.ts +2 -2
- package/es/Highlighter/SyntaxHighlighter/style.js +2 -2
- package/es/Highlighter/index.d.ts +1 -2
- package/es/Highlighter/index.js +4 -3
- package/es/Highlighter/style.d.ts +1 -1
- package/es/Highlighter/style.js +2 -2
- package/es/Highlighter/theme.js +22 -22
- package/es/Icon/index.js +24 -16
- package/es/Input/index.js +4 -4
- package/es/Layout/index.js +1 -1
- package/es/Layout/style.d.ts +5 -5
- package/es/Layout/style.js +7 -7
- package/es/List/ListItem/index.d.ts +1 -1
- package/es/List/ListItem/index.js +21 -42
- package/es/List/ListItem/style.d.ts +9 -0
- package/es/List/ListItem/style.js +21 -0
- package/es/List/index.d.ts +1 -1
- package/es/Logo/index.d.ts +2 -2
- package/es/Logo/index.js +48 -38
- package/es/Logo/style.d.ts +1 -1
- package/es/Logo/style.js +2 -2
- package/es/Markdown/CodeBlock.d.ts +1 -1
- package/es/Markdown/CodeBlock.js +7 -7
- package/es/Markdown/index.js +3 -3
- package/es/Markdown/style.d.ts +1 -1
- package/es/Markdown/style.js +2 -2
- package/es/MessageInput/index.d.ts +1 -1
- package/es/MessageInput/index.js +5 -5
- package/es/MessageModal/index.js +8 -6
- package/es/MessageModal/style.d.ts +1 -1
- package/es/MessageModal/style.js +2 -2
- package/es/SearchBar/index.d.ts +1 -1
- package/es/SearchBar/index.js +13 -11
- package/es/SearchBar/style.d.ts +2 -2
- package/es/SearchBar/style.js +3 -3
- package/es/Snippet/index.js +5 -3
- package/es/Spotlight/index.js +13 -13
- package/es/Spotlight/style.js +1 -1
- package/es/StroyBook/index.d.ts +1 -2
- package/es/StroyBook/index.js +3 -3
- package/es/StroyBook/style.d.ts +1 -1
- package/es/StroyBook/style.js +2 -2
- package/es/Swatches/index.d.ts +1 -1
- package/es/Swatches/index.js +9 -9
- package/es/ThemeProvider/index.d.ts +2 -2
- package/es/ThemeProvider/index.js +3 -4
- package/es/ThemeSwitch/index.js +8 -8
- package/es/Toc/TocMobile.d.ts +4 -4
- package/es/Toc/TocMobile.js +15 -15
- package/es/Toc/style.d.ts +2 -2
- package/es/Toc/style.js +3 -3
- package/es/TokenTag/style.js +12 -7
- package/es/components/ControlInput.d.ts +1 -1
- package/es/components/ControlInput.js +7 -6
- package/es/hooks/useHighlight.js +14 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/styles/algorithms/generateColorPalette.js +10 -10
- package/es/styles/algorithms/generateCustomStylish.js +5 -5
- package/es/styles/algorithms/generateCustomToken.js +42 -17
- package/es/styles/algorithms/generateTheme.js +4 -4
- package/es/styles/colors.js +65 -65
- package/es/styles/theme/base.js +2 -2
- package/es/styles/theme/dark.js +16 -16
- package/es/styles/theme/light.js +16 -16
- package/es/types/llm.d.ts +1 -1
- package/package.json +3 -3
package/es/Logo/index.js
CHANGED
|
@@ -30,48 +30,58 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
30
|
var logoComponent;
|
|
31
31
|
switch (type) {
|
|
32
32
|
case '3d':
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
{
|
|
34
|
+
return /*#__PURE__*/_jsx(Logo3D, _objectSpread({
|
|
35
|
+
style: _objectSpread({
|
|
36
|
+
height: size,
|
|
37
|
+
width: size
|
|
38
|
+
}, style)
|
|
39
|
+
}, props));
|
|
40
|
+
}
|
|
39
41
|
case 'flat':
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
{
|
|
43
|
+
return /*#__PURE__*/_jsx(LogoFlat, _objectSpread({
|
|
44
|
+
style: _objectSpread({
|
|
45
|
+
height: size,
|
|
46
|
+
width: size
|
|
47
|
+
}, style)
|
|
48
|
+
}, props));
|
|
49
|
+
}
|
|
46
50
|
case 'high-contrast':
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
width: size
|
|
51
|
-
}, style)
|
|
52
|
-
}, props));
|
|
53
|
-
case 'text':
|
|
54
|
-
return /*#__PURE__*/_jsx(LogoText, _objectSpread({
|
|
55
|
-
style: _objectSpread({
|
|
56
|
-
height: size,
|
|
57
|
-
width: 'auto'
|
|
58
|
-
}, style)
|
|
59
|
-
}, props));
|
|
60
|
-
case 'combine':
|
|
61
|
-
logoComponent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
62
|
-
children: [/*#__PURE__*/_jsx(Logo3D, {
|
|
63
|
-
style: {
|
|
51
|
+
{
|
|
52
|
+
return /*#__PURE__*/_jsx(LogoHighContrast, _objectSpread({
|
|
53
|
+
style: _objectSpread({
|
|
64
54
|
height: size,
|
|
65
55
|
width: size
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
}, style)
|
|
57
|
+
}, props));
|
|
58
|
+
}
|
|
59
|
+
case 'text':
|
|
60
|
+
{
|
|
61
|
+
return /*#__PURE__*/_jsx(LogoText, _objectSpread({
|
|
62
|
+
style: _objectSpread({
|
|
70
63
|
height: size,
|
|
71
64
|
width: 'auto'
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
}
|
|
65
|
+
}, style)
|
|
66
|
+
}, props));
|
|
67
|
+
}
|
|
68
|
+
case 'combine':
|
|
69
|
+
{
|
|
70
|
+
logoComponent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
71
|
+
children: [/*#__PURE__*/_jsx(Logo3D, {
|
|
72
|
+
style: {
|
|
73
|
+
height: size,
|
|
74
|
+
width: size
|
|
75
|
+
}
|
|
76
|
+
}), /*#__PURE__*/_jsx(LogoText, {
|
|
77
|
+
style: {
|
|
78
|
+
height: size,
|
|
79
|
+
marginLeft: Math.round(size / 4),
|
|
80
|
+
width: 'auto'
|
|
81
|
+
}
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
75
85
|
}
|
|
76
86
|
var extraSize = Math.round(size / 3 * 1.9);
|
|
77
87
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
@@ -81,9 +91,9 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
81
91
|
children: [logoComponent, extra && /*#__PURE__*/_jsxs(_Fragment, {
|
|
82
92
|
children: [/*#__PURE__*/_jsx(Divider, {
|
|
83
93
|
style: {
|
|
94
|
+
color: theme.colorBorder,
|
|
84
95
|
height: extraSize,
|
|
85
|
-
width: extraSize
|
|
86
|
-
color: theme.colorBorder
|
|
96
|
+
width: extraSize
|
|
87
97
|
}
|
|
88
98
|
}), /*#__PURE__*/_jsx("div", {
|
|
89
99
|
className: styles.extraTitle,
|
package/es/Logo/style.d.ts
CHANGED
package/es/Logo/style.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createStyles } from 'antd-style';
|
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css;
|
|
6
6
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
extraTitle: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-weight: 300;\n white-space: nowrap;\n "]))),
|
|
8
|
+
flexCenter: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n "])))
|
|
9
9
|
};
|
|
10
10
|
});
|
package/es/Markdown/CodeBlock.js
CHANGED
|
@@ -8,22 +8,22 @@ var useStyles = createStyles(function (_ref) {
|
|
|
8
8
|
var css = _ref.css;
|
|
9
9
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :not(:last-child) {\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0;\n margin-inline-end: 0;\n }\n "])));
|
|
10
10
|
});
|
|
11
|
-
var Code = /*#__PURE__*/memo(function (
|
|
11
|
+
var Code = /*#__PURE__*/memo(function (properties) {
|
|
12
12
|
var _useStyles = useStyles(),
|
|
13
13
|
styles = _useStyles.styles,
|
|
14
14
|
theme = _useStyles.theme;
|
|
15
|
-
if (!
|
|
16
|
-
var
|
|
17
|
-
children =
|
|
18
|
-
className =
|
|
19
|
-
if (!children) return
|
|
15
|
+
if (!properties.children[0]) return;
|
|
16
|
+
var _properties$children$ = properties.children[0].props,
|
|
17
|
+
children = _properties$children$.children,
|
|
18
|
+
className = _properties$children$.className;
|
|
19
|
+
if (!children) return;
|
|
20
20
|
return /*#__PURE__*/_jsx(Highlighter, {
|
|
21
21
|
className: styles,
|
|
22
22
|
language: (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'markdown',
|
|
23
23
|
spotlight: true,
|
|
24
24
|
theme: theme.appearance,
|
|
25
25
|
type: "block",
|
|
26
|
-
children: children
|
|
26
|
+
children: Array.isArray(children) ? children[0] : children
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
export default Code;
|
package/es/Markdown/index.js
CHANGED
|
@@ -14,11 +14,11 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
14
14
|
styles = _useStyles.styles,
|
|
15
15
|
cx = _useStyles.cx;
|
|
16
16
|
var components = {
|
|
17
|
-
|
|
17
|
+
a: Typography.Link,
|
|
18
18
|
code: Code,
|
|
19
|
+
details: Collapse,
|
|
19
20
|
hr: Divider,
|
|
20
|
-
|
|
21
|
-
details: Collapse
|
|
21
|
+
pre: CodeBlock
|
|
22
22
|
};
|
|
23
23
|
return /*#__PURE__*/_jsx(Typography, {
|
|
24
24
|
children: /*#__PURE__*/_jsx(ReactMarkdown, {
|
package/es/Markdown/style.d.ts
CHANGED
package/es/Markdown/style.js
CHANGED
|
@@ -7,7 +7,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
7
7
|
isDarkMode = _ref.isDarkMode,
|
|
8
8
|
stylish = _ref.stylish;
|
|
9
9
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
code: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 2px 4px;\n font-family: ", " !important;\n color: ", ";\n border-radius: 4px;\n "])), token.fontFamilyCode, isDarkMode ? token.cyan8 : token.pink7),
|
|
11
|
+
markdown: stylish.markdown
|
|
12
12
|
};
|
|
13
13
|
});
|
package/es/MessageInput/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Button } from 'antd';
|
|
|
6
6
|
import { cx } from 'antd-style';
|
|
7
7
|
import { memo, useState } from 'react';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
|
-
import { TextArea } from "
|
|
9
|
+
import { TextArea } from "../Input";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @title MessageInputProps
|
|
@@ -26,7 +26,7 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
26
26
|
className = _ref.className;
|
|
27
27
|
var _useState = useState(defaultValue || ''),
|
|
28
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
|
|
29
|
+
temporarySystemRole = _useState2[0],
|
|
30
30
|
setRole = _useState2[1];
|
|
31
31
|
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
32
32
|
gap: 8,
|
|
@@ -40,16 +40,16 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
40
40
|
height: height !== null && height !== void 0 ? height : 200
|
|
41
41
|
},
|
|
42
42
|
type: type,
|
|
43
|
-
value:
|
|
43
|
+
value: temporarySystemRole
|
|
44
44
|
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
45
45
|
direction: 'horizontal-reverse',
|
|
46
46
|
gap: 8,
|
|
47
|
-
children: renderButtons ? renderButtons(
|
|
47
|
+
children: renderButtons ? renderButtons(temporarySystemRole).map(function (buttonProps, index) {
|
|
48
48
|
return /*#__PURE__*/_jsx(Button, _objectSpread({}, buttonProps), index);
|
|
49
49
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
50
50
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
51
51
|
onClick: function onClick() {
|
|
52
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(
|
|
52
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(temporarySystemRole);
|
|
53
53
|
},
|
|
54
54
|
type: "primary",
|
|
55
55
|
children: "Confirm"
|
package/es/MessageModal/index.js
CHANGED
|
@@ -4,7 +4,9 @@ import { X } from 'lucide-react';
|
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import { Flexbox } from 'react-layout-kit';
|
|
6
6
|
import useControlledState from 'use-merge-value';
|
|
7
|
-
import
|
|
7
|
+
import Icon from "../Icon";
|
|
8
|
+
import Markdown from "../Markdown";
|
|
9
|
+
import MessageInput from "../MessageInput";
|
|
8
10
|
import { useStyles } from "./style";
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -17,15 +19,15 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
17
19
|
var _useStyles = useStyles(),
|
|
18
20
|
styles = _useStyles.styles;
|
|
19
21
|
var _useControlledState = useControlledState(false, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
onChange: onEditingChange,
|
|
23
|
+
value: editing
|
|
22
24
|
}),
|
|
23
25
|
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
24
26
|
isEdit = _useControlledState2[0],
|
|
25
27
|
setTyping = _useControlledState2[1];
|
|
26
28
|
var _useControlledState3 = useControlledState(false, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
onChange: onOpenChange,
|
|
30
|
+
value: open
|
|
29
31
|
}),
|
|
30
32
|
_useControlledState4 = _slicedToArray(_useControlledState3, 2),
|
|
31
33
|
expand = _useControlledState4[0],
|
|
@@ -36,7 +38,7 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
36
38
|
closeIcon: /*#__PURE__*/_jsx(Icon, {
|
|
37
39
|
icon: X
|
|
38
40
|
}),
|
|
39
|
-
footer: isEdit ?
|
|
41
|
+
footer: isEdit ? undefined : undefined,
|
|
40
42
|
okText: 'Edit',
|
|
41
43
|
onCancel: function onCancel() {
|
|
42
44
|
return setExpand(false);
|
package/es/MessageModal/style.js
CHANGED
|
@@ -5,7 +5,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
prefixCls = _ref.prefixCls;
|
|
7
7
|
return {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
body: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow-y: scroll;\n max-height: 70vh;\n "]))),
|
|
9
|
+
modal: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 70%;\n .", "-modal-header {\n margin-bottom: 24px;\n }\n "])), prefixCls)
|
|
10
10
|
};
|
|
11
11
|
});
|
package/es/SearchBar/index.d.ts
CHANGED
package/es/SearchBar/index.js
CHANGED
|
@@ -8,11 +8,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
import { Tag } from 'antd';
|
|
9
9
|
import { Search } from 'lucide-react';
|
|
10
10
|
import { memo, useEffect, useRef, useState } from 'react';
|
|
11
|
-
import
|
|
11
|
+
import Icon from "../Icon";
|
|
12
|
+
import { Input } from "../Input";
|
|
13
|
+
import Spotlight from "../Spotlight";
|
|
12
14
|
import { useStyles } from "./style";
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(typeof navigator
|
|
17
|
+
var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(typeof navigator === 'undefined' ? '' : (_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.platform);
|
|
16
18
|
var symbol = isAppleDevice ? '⌘' : 'Ctrl';
|
|
17
19
|
var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
18
20
|
var spotlight = _ref.spotlight,
|
|
@@ -23,7 +25,7 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
23
25
|
enableShortKey = _ref.enableShortKey,
|
|
24
26
|
_ref$shortKey = _ref.shortKey,
|
|
25
27
|
shortKey = _ref$shortKey === void 0 ? 'f' : _ref$shortKey,
|
|
26
|
-
|
|
28
|
+
properties = _objectWithoutProperties(_ref, _excluded);
|
|
27
29
|
var _useState = useState(true),
|
|
28
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
31
|
showTag = _useState2[0],
|
|
@@ -35,14 +37,14 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
35
37
|
var _useStyles = useStyles(),
|
|
36
38
|
styles = _useStyles.styles,
|
|
37
39
|
cx = _useStyles.cx;
|
|
38
|
-
var
|
|
40
|
+
var inputReference = useRef();
|
|
39
41
|
useEffect(function () {
|
|
40
42
|
if (!enableShortKey) return;
|
|
41
|
-
var handler = function handler(
|
|
42
|
-
if ((isAppleDevice ?
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
(
|
|
43
|
+
var handler = function handler(event_) {
|
|
44
|
+
if ((isAppleDevice ? event_.metaKey : event_.ctrlKey) && event_.key === shortKey) {
|
|
45
|
+
var _inputReference$curre;
|
|
46
|
+
event_.preventDefault();
|
|
47
|
+
(_inputReference$curre = inputReference.current) === null || _inputReference$curre === void 0 ? void 0 : _inputReference$curre.focus();
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
document.addEventListener('keydown', handler);
|
|
@@ -75,9 +77,9 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
75
77
|
marginRight: 4
|
|
76
78
|
}
|
|
77
79
|
}),
|
|
78
|
-
ref:
|
|
80
|
+
ref: inputReference,
|
|
79
81
|
value: value
|
|
80
|
-
},
|
|
82
|
+
}, properties)), enableShortKey && showTag && !inputValue && /*#__PURE__*/_jsxs(Tag, {
|
|
81
83
|
className: styles.tag,
|
|
82
84
|
children: [symbol, " ", shortKey.toUpperCase()]
|
|
83
85
|
})]
|
package/es/SearchBar/style.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
-
|
|
2
|
+
icon: import("antd-style").SerializedStyles;
|
|
3
3
|
input: import("antd-style").SerializedStyles;
|
|
4
|
+
search: import("antd-style").SerializedStyles;
|
|
4
5
|
tag: import("antd-style").SerializedStyles;
|
|
5
|
-
icon: import("antd-style").SerializedStyles;
|
|
6
6
|
}>;
|
package/es/SearchBar/style.js
CHANGED
|
@@ -5,9 +5,9 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
return {
|
|
8
|
-
|
|
8
|
+
icon: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextPlaceholder),
|
|
9
9
|
input: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding: 0 8px 0 12px;\n "]))),
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
search: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n "]))),
|
|
11
|
+
tag: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 5;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n\n background: ", ";\n "])), token.colorBgContainer)
|
|
12
12
|
};
|
|
13
13
|
});
|
package/es/Snippet/index.js
CHANGED
|
@@ -4,7 +4,9 @@ var _excluded = ["symbol", "language", "children", "copyable", "type", "spotligh
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import { memo } from 'react';
|
|
7
|
-
import
|
|
7
|
+
import CopyButton from "../CopyButton";
|
|
8
|
+
import SyntaxHighlighter from "../Highlighter/SyntaxHighlighter";
|
|
9
|
+
import Spotlight from "../Spotlight";
|
|
8
10
|
import { useStyles } from "./style";
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -30,8 +32,8 @@ var Snippet = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
32
|
}), copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
31
33
|
content: children,
|
|
32
34
|
size: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
blockSize: 24,
|
|
36
|
+
fontSize: 14
|
|
35
37
|
}
|
|
36
38
|
})]
|
|
37
39
|
}));
|
package/es/Spotlight/index.js
CHANGED
|
@@ -16,14 +16,14 @@ var useMouseOffset = function useMouseOffset() {
|
|
|
16
16
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
17
17
|
outside = _useState4[0],
|
|
18
18
|
setOutside = _useState4[1];
|
|
19
|
-
var
|
|
19
|
+
var reference = useRef();
|
|
20
20
|
useEffect(function () {
|
|
21
|
-
if (
|
|
22
|
-
var
|
|
21
|
+
if (reference.current && reference.current.parentElement) {
|
|
22
|
+
var element = reference.current.parentElement;
|
|
23
23
|
|
|
24
24
|
// debounce?
|
|
25
25
|
var onMouseMove = function onMouseMove(e) {
|
|
26
|
-
var bound =
|
|
26
|
+
var bound = element.getBoundingClientRect();
|
|
27
27
|
setOffset({
|
|
28
28
|
x: e.clientX - bound.x,
|
|
29
29
|
y: e.clientY - bound.y
|
|
@@ -33,26 +33,26 @@ var useMouseOffset = function useMouseOffset() {
|
|
|
33
33
|
var onMouseLeave = function onMouseLeave() {
|
|
34
34
|
setOutside(true);
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
element.addEventListener('mousemove', onMouseMove);
|
|
37
|
+
element.addEventListener('mouseleave', onMouseLeave);
|
|
38
38
|
return function () {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
element.removeEventListener('mousemove', onMouseMove);
|
|
40
|
+
element.removeEventListener('mouseleave', onMouseLeave);
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
}, []);
|
|
44
|
-
return [offset, outside,
|
|
44
|
+
return [offset, outside, reference];
|
|
45
45
|
};
|
|
46
46
|
var Spotlight = /*#__PURE__*/memo(function (_ref) {
|
|
47
47
|
var className = _ref.className,
|
|
48
48
|
_ref$size = _ref.size,
|
|
49
49
|
size = _ref$size === void 0 ? 64 : _ref$size,
|
|
50
|
-
|
|
50
|
+
properties = _objectWithoutProperties(_ref, _excluded);
|
|
51
51
|
var _useMouseOffset = useMouseOffset(),
|
|
52
52
|
_useMouseOffset2 = _slicedToArray(_useMouseOffset, 3),
|
|
53
53
|
offset = _useMouseOffset2[0],
|
|
54
54
|
outside = _useMouseOffset2[1],
|
|
55
|
-
|
|
55
|
+
reference = _useMouseOffset2[2];
|
|
56
56
|
var _useStyles = useStyles({
|
|
57
57
|
offset: offset,
|
|
58
58
|
outside: outside,
|
|
@@ -62,7 +62,7 @@ var Spotlight = /*#__PURE__*/memo(function (_ref) {
|
|
|
62
62
|
cx = _useStyles.cx;
|
|
63
63
|
return /*#__PURE__*/_jsx("div", _objectSpread({
|
|
64
64
|
className: cx(styles, className),
|
|
65
|
-
ref:
|
|
66
|
-
},
|
|
65
|
+
ref: reference
|
|
66
|
+
}, properties));
|
|
67
67
|
});
|
|
68
68
|
export default Spotlight;
|
package/es/Spotlight/style.js
CHANGED
|
@@ -13,5 +13,5 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
13
13
|
var spotlightY = ((_offset$y = offset === null || offset === void 0 ? void 0 : offset.y) !== null && _offset$y !== void 0 ? _offset$y : 0) + 'px';
|
|
14
14
|
var spotlightOpacity = outside ? '0' : '.1';
|
|
15
15
|
var spotlightSize = size + 'px';
|
|
16
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 1;\n inset: 0;\n\n opacity: ", ";\n background: radial-gradient(\n ", " circle at ", " ", ",\n ", ",\n ", "\n );\n border-radius: inherit;\n\n transition: all 0.2s;\n "])), spotlightOpacity, spotlightSize, spotlightX, spotlightY, isDarkMode ? token.colorText : '#fff',
|
|
16
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 1;\n inset: 0;\n\n opacity: ", ";\n background: radial-gradient(\n ", " circle at ", " ", ",\n ", ",\n ", "\n );\n border-radius: inherit;\n\n transition: all 0.2s;\n "])), spotlightOpacity, spotlightSize, spotlightX, spotlightY, isDarkMode ? token.colorText : '#fff', isDarkMode ? 'transparent' : token.colorTextQuaternary);
|
|
17
17
|
});
|
package/es/StroyBook/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { useControls, useCreateStore } from 'leva';
|
|
3
2
|
import { DivProps } from "../types";
|
|
4
|
-
export { useControls, useCreateStore };
|
|
5
3
|
export interface StroyBookProps extends DivProps {
|
|
6
4
|
/**
|
|
7
5
|
* @description The Leva store instance to be used by the component
|
|
@@ -15,3 +13,4 @@ export interface StroyBookProps extends DivProps {
|
|
|
15
13
|
}
|
|
16
14
|
export declare const StroyBook: import("react").NamedExoticComponent<StroyBookProps>;
|
|
17
15
|
export default StroyBook;
|
|
16
|
+
export { useControls, useCreateStore } from 'leva';
|
package/es/StroyBook/index.js
CHANGED
|
@@ -4,13 +4,12 @@ var _excluded = ["levaStore", "noPadding", "className", "children"];
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import { useResponsive } from 'antd-style';
|
|
7
|
-
import { LevaPanel
|
|
7
|
+
import { LevaPanel } from 'leva';
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
import DraggablePanel from "../DraggablePanel";
|
|
10
10
|
import { useStyles } from "./style";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
export { useControls, useCreateStore };
|
|
14
13
|
export var StroyBook = /*#__PURE__*/memo(function (_ref) {
|
|
15
14
|
var levaStore = _ref.levaStore,
|
|
16
15
|
noPadding = _ref.noPadding,
|
|
@@ -44,4 +43,5 @@ export var StroyBook = /*#__PURE__*/memo(function (_ref) {
|
|
|
44
43
|
})]
|
|
45
44
|
}));
|
|
46
45
|
});
|
|
47
|
-
export default StroyBook;
|
|
46
|
+
export default StroyBook;
|
|
47
|
+
export { useControls, useCreateStore } from 'leva';
|
package/es/StroyBook/style.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const useStyles: (props?: boolean | undefined) => import("antd-style").ReturnStyles<{
|
|
2
2
|
editor: import("antd-style").SerializedStyles;
|
|
3
3
|
left: import("antd-style").SerializedStyles;
|
|
4
|
-
right: import("antd-style").SerializedStyles;
|
|
5
4
|
leva: import("antd-style").SerializedStyles;
|
|
5
|
+
right: import("antd-style").SerializedStyles;
|
|
6
6
|
}>;
|
package/es/StroyBook/style.js
CHANGED
|
@@ -8,7 +8,7 @@ export var useStyles = createStyles(function (_ref, noPadding) {
|
|
|
8
8
|
return {
|
|
9
9
|
editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n\n width: inherit;\n min-height: inherit;\n\n ", " {\n flex-direction: column;\n }\n "])), responsive.mobile),
|
|
10
10
|
left: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: auto;\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n\n ", "\n "])), !noPadding && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 40px 24px;\n "])))),
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
leva: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n --leva-sizes-controlWidth: 66%;\n --leva-colors-elevation1: ", ";\n --leva-colors-elevation2: transparent;\n --leva-colors-elevation3: ", ";\n --leva-colors-accent1: ", ";\n --leva-colors-accent2: ", ";\n --leva-colors-accent3: ", ";\n --leva-colors-highlight1: ", ";\n --leva-colors-highlight2: ", ";\n --leva-colors-highlight3: ", ";\n --leva-colors-vivid1: ", ";\n --leva-shadows-level1: unset;\n --leva-shadows-level2: unset;\n --leva-fonts-mono: ", ";\n\n overflow: auto;\n width: 100%;\n height: 100%;\n padding: 6px 0;\n\n > div {\n background: transparent;\n\n > div {\n background: transparent;\n }\n }\n\n input:checked + label > svg {\n stroke: ", ";\n }\n\n button {\n --leva-colors-accent2: ", ";\n }\n "])), token.colorFillSecondary, token.colorFillSecondary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryActive, token.colorTextTertiary, token.colorTextSecondary, token.colorText, token.colorWarning, token.fontFamilyCode, token.colorBgLayout, token.colorFillSecondary),
|
|
12
|
+
right: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: ", ";\n\n ", " {\n .draggable-panel-fixed {\n width: 100% !important;\n }\n }\n "])), token.colorBgLayout, responsive.mobile)
|
|
13
13
|
};
|
|
14
14
|
});
|
package/es/Swatches/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface SwatchesProps {
|
|
|
13
13
|
* @description A function to be called when a swatch is selected
|
|
14
14
|
* @default undefined
|
|
15
15
|
*/
|
|
16
|
-
onSelect?: (c
|
|
16
|
+
onSelect?: (c?: string | undefined) => void;
|
|
17
17
|
}
|
|
18
18
|
declare const Swatches: import("react").NamedExoticComponent<SwatchesProps>;
|
|
19
19
|
export default Swatches;
|
package/es/Swatches/index.js
CHANGED
|
@@ -13,15 +13,15 @@ var Swatches = /*#__PURE__*/memo(function (_ref) {
|
|
|
13
13
|
horizontal: true,
|
|
14
14
|
children: [/*#__PURE__*/_jsx(Flexbox, {
|
|
15
15
|
onClick: function onClick() {
|
|
16
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(
|
|
16
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
17
17
|
},
|
|
18
18
|
style: {
|
|
19
|
-
width: 24,
|
|
20
|
-
height: 24,
|
|
21
19
|
background: theme.colorBgContainer,
|
|
22
|
-
boxShadow: "inset 0 0 0px 2px ".concat(!activeColor ? theme.colorPrimary : 'rgba(0,0,0,0.1)'),
|
|
23
20
|
borderRadius: '50%',
|
|
24
|
-
|
|
21
|
+
boxShadow: "inset 0 0 0px 2px ".concat(activeColor ? 'rgba(0,0,0,0.1)' : theme.colorPrimary),
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
height: 24,
|
|
24
|
+
width: 24
|
|
25
25
|
}
|
|
26
26
|
}), colors.map(function (c) {
|
|
27
27
|
var borderColor = c === activeColor ? theme.colorPrimary : 'rgba(0,0,0,0.1)';
|
|
@@ -30,12 +30,12 @@ var Swatches = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
30
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(c);
|
|
31
31
|
},
|
|
32
32
|
style: {
|
|
33
|
-
width: 24,
|
|
34
|
-
height: 24,
|
|
35
33
|
background: c,
|
|
36
|
-
boxShadow: "inset 0 0 0px 2px ".concat(borderColor),
|
|
37
34
|
borderRadius: '50%',
|
|
38
|
-
|
|
35
|
+
boxShadow: "inset 0 0 0px 2px ".concat(borderColor),
|
|
36
|
+
cursor: 'pointer',
|
|
37
|
+
height: 24,
|
|
38
|
+
width: 24
|
|
39
39
|
}
|
|
40
40
|
}, c);
|
|
41
41
|
})]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type ThemeMode, extractStaticStyle } from 'antd-style';
|
|
3
2
|
import type { CustomStylishParams, CustomTokenParams } from 'antd-style/lib/types/function';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
4
|
export interface ThemeProviderProps {
|
|
5
5
|
/**
|
|
6
6
|
* @description Cache for the extracted static styles
|
|
@@ -9,7 +9,7 @@ export interface ThemeProviderProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* @description The children of the ThemeProvider component
|
|
11
11
|
*/
|
|
12
|
-
children:
|
|
12
|
+
children: ReactNode;
|
|
13
13
|
/**
|
|
14
14
|
* @description Custom stylish
|
|
15
15
|
*/
|