@lobehub/ui 1.10.0 → 1.11.1
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/style.js +1 -1
- package/es/Highlighter/style.js +1 -2
- package/es/Input/index.js +7 -5
- package/es/Input/style.js +2 -3
- package/es/Markdown/style.js +1 -1
- package/es/SearchBar/index.js +2 -1
- package/es/Snippet/style.js +1 -2
- package/es/StroyBook/style.js +1 -1
- package/es/ThemeProvider/index.d.ts +2 -6
- package/es/ThemeProvider/index.js +8 -18
- package/es/styles/algorithms/generateColorPalette.d.ts +11 -0
- package/es/styles/algorithms/generateColorPalette.js +31 -0
- package/es/styles/{customStylish.d.ts → algorithms/generateCustomStylish.d.ts} +1 -1
- package/es/styles/{customStylish.js → algorithms/generateCustomStylish.js} +1 -1
- package/es/styles/algorithms/generateCustomToken.d.ts +3 -0
- package/es/styles/algorithms/generateCustomToken.js +57 -0
- package/es/styles/algorithms/generateTheme.d.ts +5 -0
- package/es/styles/algorithms/generateTheme.js +18 -0
- package/es/styles/colors.d.ts +38 -0
- package/es/styles/colors.js +176 -0
- package/es/styles/index.d.ts +3 -3
- package/es/styles/index.js +3 -3
- package/es/styles/theme/base.d.ts +2 -2
- package/es/styles/theme/base.js +8 -14
- package/es/styles/theme/dark.d.ts +3 -4
- package/es/styles/theme/dark.js +40 -71
- package/es/styles/theme/light.d.ts +3 -4
- package/es/styles/theme/light.js +41 -32
- package/es/types/customToken.d.ts +1027 -0
- package/es/types/global.d.ts +12 -0
- package/es/types/index.d.ts +5 -28
- package/es/types/index.js +1 -0
- package/lib/ActionIcon/index.js +77 -79
- package/lib/ActionIcon/style.js +17 -61
- package/lib/Avatar/index.js +62 -67
- package/lib/Chat/const.js +6 -27
- package/lib/Chat/index.js +24 -28
- package/lib/Chat/store/index.js +46 -40
- package/lib/Chat/store/initialState.js +6 -27
- package/lib/Chat/store/messageReducer.js +51 -58
- package/lib/Chat/store/selectors.js +44 -46
- package/lib/Chat/store/store.js +242 -115
- package/lib/Chat/types.js +4 -16
- package/lib/Chat/utils/fetch.js +104 -68
- package/lib/ContextMenu/MenuItem/icons.js +48 -66
- package/lib/ContextMenu/MenuItem/index.js +73 -66
- package/lib/ContextMenu/MenuItem/style.js +19 -89
- package/lib/ContextMenu/index.js +194 -178
- package/lib/ContextMenu/style.js +17 -85
- package/lib/ContextMenu/types/index.js +15 -18
- package/lib/ContextMenu/types/menuItem.js +4 -16
- package/lib/Conversation/App.js +47 -50
- package/lib/Conversation/ChatList/MessageItem/Content.js +98 -93
- package/lib/Conversation/ChatList/MessageItem/Toolbar.js +94 -104
- package/lib/Conversation/ChatList/MessageItem/index.js +125 -157
- package/lib/Conversation/ChatList/index.js +64 -58
- package/lib/Conversation/InputArea/ActionBar.js +74 -92
- package/lib/Conversation/InputArea/index.js +103 -142
- package/lib/Conversation/StoreUpdater.js +28 -48
- package/lib/Conversation/index.js +30 -42
- package/lib/CopyButton/index.js +37 -62
- package/lib/DraggablePanel/index.js +192 -207
- package/lib/DraggablePanel/style.js +30 -278
- package/lib/DraggablePanel/utils.js +14 -35
- package/lib/EditableMessage/index.js +66 -89
- package/lib/EditableMessageList/index.js +97 -112
- package/lib/EditableText/index.js +36 -49
- package/lib/Highlighter/SyntaxHighlighter/Prism.js +43 -38
- package/lib/Highlighter/SyntaxHighlighter/index.js +62 -53
- package/lib/Highlighter/SyntaxHighlighter/style.js +18 -56
- package/lib/Highlighter/index.js +52 -58
- package/lib/Highlighter/style.js +22 -102
- package/lib/Icon/index.js +29 -36
- package/lib/Input/index.js +45 -39
- package/lib/Input/style.js +17 -68
- package/lib/List/ListItem/index.js +108 -150
- package/lib/List/ListItem/time.js +15 -47
- package/lib/List/index.js +9 -37
- package/lib/Logo/Divider.js +21 -34
- package/lib/Logo/Logo3D.js +17 -33
- package/lib/Logo/LogoFlat.js +108 -118
- package/lib/Logo/LogoHighContrast.js +30 -33
- package/lib/Logo/LogoText.js +21 -34
- package/lib/Logo/index.js +97 -59
- package/lib/Logo/style.js +13 -36
- package/lib/Markdown/Code.js +16 -30
- package/lib/Markdown/CodeBlock.js +33 -65
- package/lib/Markdown/index.js +35 -54
- package/lib/Markdown/style.js +15 -125
- package/lib/MessageInput/index.js +60 -56
- package/lib/MessageModal/index.js +80 -91
- package/lib/SearchBar/index.js +86 -72
- package/lib/SearchBar/style.js +18 -46
- package/lib/SideNav/index.js +43 -31
- package/lib/SideNav/style.js +13 -43
- package/lib/Snippet/index.js +42 -45
- package/lib/Snippet/style.js +13 -72
- package/lib/StroyBook/index.js +60 -61
- package/lib/StroyBook/style.js +19 -87
- package/lib/Swatches/index.js +35 -53
- package/lib/TabsNav/index.js +23 -31
- package/lib/TabsNav/style.js +17 -60
- package/lib/ThemeProvider/GlobalStyle.js +29 -92
- package/lib/ThemeProvider/index.d.ts +2 -6
- package/lib/ThemeProvider/index.js +44 -69
- package/lib/ThemeSwitch/index.js +62 -46
- package/lib/Tooltip/index.js +26 -31
- package/lib/Tooltip/style.js +13 -49
- package/lib/components/ControlInput.js +86 -87
- package/lib/hooks/useCopied.js +27 -37
- package/lib/hooks/useHighlight.js +65 -70
- package/lib/index.js +211 -120
- package/lib/styles/algorithms/generateColorPalette.d.ts +11 -0
- package/lib/styles/algorithms/generateColorPalette.js +40 -0
- package/lib/styles/{customStylish.d.ts → algorithms/generateCustomStylish.d.ts} +1 -1
- package/lib/styles/algorithms/generateCustomStylish.js +27 -0
- package/lib/styles/algorithms/generateCustomToken.d.ts +3 -0
- package/lib/styles/algorithms/generateCustomToken.js +65 -0
- package/lib/styles/algorithms/generateTheme.d.ts +5 -0
- package/lib/styles/algorithms/generateTheme.js +28 -0
- package/lib/styles/colors.d.ts +38 -0
- package/lib/styles/colors.js +183 -0
- package/lib/styles/index.d.ts +3 -3
- package/lib/styles/index.js +25 -20
- package/lib/styles/theme/base.d.ts +2 -2
- package/lib/styles/theme/base.js +17 -44
- package/lib/styles/theme/dark.d.ts +3 -4
- package/lib/styles/theme/dark.js +45 -119
- package/lib/styles/theme/light.d.ts +3 -4
- package/lib/styles/theme/light.js +47 -61
- package/lib/types/customToken.d.ts +1027 -0
- package/lib/types/global.d.ts +12 -0
- package/lib/types/index.d.ts +5 -28
- package/lib/types/index.js +5 -0
- package/lib/utils/colorUtils.js +14 -48
- package/package.json +1 -1
- package/es/styles/algorithms/colorRelationship.d.ts +0 -6
- package/es/styles/algorithms/colorRelationship.js +0 -88
- package/es/styles/algorithms/index.d.ts +0 -15
- package/es/styles/algorithms/index.js +0 -66
- package/es/styles/algorithms/paletteGenerator.d.ts +0 -51
- package/es/styles/algorithms/paletteGenerator.js +0 -74
- package/es/styles/antdTheme.d.ts +0 -2
- package/es/styles/antdTheme.js +0 -4
- package/es/styles/customToken.d.ts +0 -65
- package/es/styles/customToken.js +0 -24
- package/es/styles/theme/index.d.ts +0 -2
- package/es/styles/theme/index.js +0 -2
- package/lib/styles/algorithms/colorRelationship.d.ts +0 -6
- package/lib/styles/algorithms/colorRelationship.js +0 -87
- package/lib/styles/algorithms/index.d.ts +0 -15
- package/lib/styles/algorithms/index.js +0 -81
- package/lib/styles/algorithms/paletteGenerator.d.ts +0 -51
- package/lib/styles/algorithms/paletteGenerator.js +0 -91
- package/lib/styles/antdTheme.d.ts +0 -2
- package/lib/styles/antdTheme.js +0 -30
- package/lib/styles/customStylish.js +0 -118
- package/lib/styles/customToken.d.ts +0 -65
- package/lib/styles/customToken.js +0 -54
- package/lib/styles/theme/index.d.ts +0 -2
- package/lib/styles/theme/index.js +0 -32
package/es/ActionIcon/style.js
CHANGED
|
@@ -7,6 +7,6 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
7
7
|
var active = _ref2.active,
|
|
8
8
|
glass = _ref2.glass;
|
|
9
9
|
return {
|
|
10
|
-
block: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition: color 600ms ", ",\n background-color 100ms ", ";\n\n ", "\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n "])), active ? token.colorText : token.
|
|
10
|
+
block: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition: color 600ms ", ",\n background-color 100ms ", ";\n\n ", "\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n "])), active ? token.colorText : token.colorTextTertiary, active ? token.colorFillTertiary : 'transparent', token.motionEaseOut, token.motionEaseOut, glass && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n backdrop-filter: saturate(180%) blur(10px);\n "]))), token.colorText, token.colorFillSecondary, token.colorText, token.colorFill)
|
|
11
11
|
};
|
|
12
12
|
});
|
package/es/Highlighter/style.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
import { rgba } from 'polished';
|
|
5
4
|
export var useStyles = createStyles(function (_ref, type) {
|
|
6
5
|
var token = _ref.token,
|
|
7
6
|
css = _ref.css,
|
|
@@ -11,7 +10,7 @@ export var useStyles = createStyles(function (_ref, type) {
|
|
|
11
10
|
var buttonHoverCls = "".concat(prefix, "-hover-btn");
|
|
12
11
|
var langHoverCls = "".concat(prefix, "-hover-lang");
|
|
13
12
|
return {
|
|
14
|
-
container: cx(prefix, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: auto;\n\n background-color: ", ";\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n ", "\n &:hover {\n background-color: ", ";\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding: ", " !important;\n background: none !important;\n }\n\n code {\n background: transparent !important;\n }\n "])), type === 'block' ?
|
|
13
|
+
container: cx(prefix, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: auto;\n\n background-color: ", ";\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n ", "\n &:hover {\n background-color: ", ";\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding: ", " !important;\n background: none !important;\n }\n\n code {\n background: transparent !important;\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', token.borderRadius, token.motionEaseOut, type === 'ghost' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorBorder), type === 'prue' ? 'transparent' : token.colorFillTertiary, buttonHoverCls, langHoverCls, type === 'prue' ? 0 : "16px 24px")),
|
|
15
14
|
button: cx(buttonHoverCls, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 51;\n top: 8px;\n right: 8px;\n\n opacity: 0;\n "])))),
|
|
16
15
|
lang: cx(langHoverCls, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 50;\n right: 8px;\n bottom: 8px;\n\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.colorTextPlaceholder))
|
|
17
16
|
};
|
package/es/Input/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["className", "type"],
|
|
4
4
|
_excluded2 = ["className", "type"];
|
|
5
5
|
import { Input as AntInput } from 'antd';
|
|
6
|
-
import { memo } from 'react';
|
|
6
|
+
import { forwardRef, memo } from 'react';
|
|
7
7
|
import { useStyles } from "./style";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
export var Input = /*#__PURE__*/memo(function (_ref) {
|
|
9
|
+
export var Input = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
10
|
var className = _ref.className,
|
|
11
11
|
_ref$type = _ref.type,
|
|
12
12
|
type = _ref$type === void 0 ? 'ghost' : _ref$type,
|
|
@@ -17,10 +17,11 @@ export var Input = /*#__PURE__*/memo(function (_ref) {
|
|
|
17
17
|
styles = _useStyles.styles,
|
|
18
18
|
cx = _useStyles.cx;
|
|
19
19
|
return /*#__PURE__*/_jsx(AntInput, _objectSpread({
|
|
20
|
+
ref: ref,
|
|
20
21
|
className: cx(styles.input, className)
|
|
21
22
|
}, props));
|
|
22
|
-
});
|
|
23
|
-
export var TextArea = /*#__PURE__*/memo(function (_ref2) {
|
|
23
|
+
}));
|
|
24
|
+
export var TextArea = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
24
25
|
var className = _ref2.className,
|
|
25
26
|
_ref2$type = _ref2.type,
|
|
26
27
|
type = _ref2$type === void 0 ? 'ghost' : _ref2$type,
|
|
@@ -31,6 +32,7 @@ export var TextArea = /*#__PURE__*/memo(function (_ref2) {
|
|
|
31
32
|
styles = _useStyles2.styles,
|
|
32
33
|
cx = _useStyles2.cx;
|
|
33
34
|
return /*#__PURE__*/_jsx(AntInput.TextArea, _objectSpread({
|
|
35
|
+
ref: ref,
|
|
34
36
|
className: cx(styles.textarea, className)
|
|
35
37
|
}, props));
|
|
36
|
-
});
|
|
38
|
+
}));
|
package/es/Input/style.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
import { rgba } from 'polished';
|
|
5
4
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
6
5
|
var css = _ref.css,
|
|
7
6
|
token = _ref.token;
|
|
8
7
|
var type = _ref2.type;
|
|
9
8
|
return {
|
|
10
|
-
input: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n height: 36px;\n padding: 0 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n\n transition: background-color 100ms ", ";\n\n input {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ?
|
|
11
|
-
textarea: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n padding: 8px 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n\n transition: background-color 100ms ", ";\n\n textarea {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ?
|
|
9
|
+
input: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n height: 36px;\n padding: 0 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n\n transition: background-color 100ms ", ";\n\n input {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, token.motionEaseOut, token.colorFillTertiary),
|
|
10
|
+
textarea: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n max-width: 100%;\n padding: 8px 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n\n transition: background-color 100ms ", ";\n\n textarea {\n background: transparent;\n }\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, token.motionEaseOut, token.colorFillTertiary)
|
|
12
11
|
};
|
|
13
12
|
});
|
package/es/Markdown/style.js
CHANGED
|
@@ -6,7 +6,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
6
6
|
token = _ref.token,
|
|
7
7
|
isDarkMode = _ref.isDarkMode;
|
|
8
8
|
return {
|
|
9
|
-
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n\n p {\n margin: 20px auto;\n\n font-size: 14px;\n line-height: 1.8;\n color: ", ";\n text-align: justify;\n word-wrap: break-word;\n }\n\n blockquote {\n margin: 16px 0;\n padding: 0 12px;\n p {\n font-style: italic;\n color: ", ";\n }\n }\n\n p:not(:last-child) {\n margin-bottom: 1em;\n }\n\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n\n img {\n max-width: 100%;\n }\n\n > :not([data-code-type='highlighter']) code {\n padding: 2px 6px;\n color: ", ";\n background: ", ";\n border-radius: 4px;\n }\n\n table {\n border-spacing: 0;\n\n width: 100%;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n th,\n td {\n padding-block-start: 10px;\n padding-block-end: 10px;\n padding-inline-start: 16px;\n padding-inline-end: 16px;\n }\n\n thead {\n tr {\n th {\n background: ", ";\n &:first-child {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n &:last-child {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n }\n\n ul li {\n line-height: 1.8;\n }\n "])), isDarkMode ? token.colorTextSecondary : token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, isDarkMode ? token['cyan-7'] : token.colorPrimaryText, isDarkMode ? token['cyan-1'] : token.colorPrimaryBg, token.
|
|
9
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n\n p {\n margin: 20px auto;\n\n font-size: 14px;\n line-height: 1.8;\n color: ", ";\n text-align: justify;\n word-wrap: break-word;\n }\n\n blockquote {\n margin: 16px 0;\n padding: 0 12px;\n p {\n font-style: italic;\n color: ", ";\n }\n }\n\n p:not(:last-child) {\n margin-bottom: 1em;\n }\n\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n\n img {\n max-width: 100%;\n }\n\n > :not([data-code-type='highlighter']) code {\n padding: 2px 6px;\n color: ", ";\n background: ", ";\n border-radius: 4px;\n }\n\n table {\n border-spacing: 0;\n\n width: 100%;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n th,\n td {\n padding-block-start: 10px;\n padding-block-end: 10px;\n padding-inline-start: 16px;\n padding-inline-end: 16px;\n }\n\n thead {\n tr {\n th {\n background: ", ";\n &:first-child {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n &:last-child {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n }\n\n ul li {\n line-height: 1.8;\n }\n\n pre {\n border-radius: ", "px;\n }\n "])), isDarkMode ? token.colorTextSecondary : token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, isDarkMode ? token['cyan-7'] : token.colorPrimaryText, isDarkMode ? token['cyan-1'] : token.colorPrimaryBg, token.colorBorderSecondary, token.borderRadius, token.colorFillTertiary, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius),
|
|
10
10
|
code: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 2px 4px;\n font-family: ", " !important;\n color: ", ";\n border-radius: 4px;\n "])), token.fontFamilyCode, isDarkMode ? token.cyan8 : token.pink7)
|
|
11
11
|
};
|
|
12
12
|
});
|
package/es/SearchBar/index.js
CHANGED
|
@@ -37,8 +37,9 @@ var SearchBar = /*#__PURE__*/memo(function (_ref) {
|
|
|
37
37
|
if (!enableShortKey) return;
|
|
38
38
|
var handler = function handler(ev) {
|
|
39
39
|
if ((isAppleDevice ? ev.metaKey : ev.ctrlKey) && ev.key === shortKey) {
|
|
40
|
+
var _inputRef$current;
|
|
40
41
|
ev.preventDefault();
|
|
41
|
-
inputRef.current.focus();
|
|
42
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
document.addEventListener('keydown', handler);
|
package/es/Snippet/style.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
import { rgba } from 'polished';
|
|
5
4
|
export var useStyles = createStyles(function (_ref, type) {
|
|
6
5
|
var css = _ref.css,
|
|
7
6
|
token = _ref.token;
|
|
8
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n max-width: 100%;\n height: 36px;\n padding: 0 8px 0 12px;\n\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n .ant-highlighter-shiki {\n overflow: auto;\n flex: 1;\n }\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding-top: 6px !important;\n line-height: 1;\n background: none !important;\n }\n\n code[class*='language-'] {\n background: none !important;\n }\n "])), token.borderRadius, token.motionEaseOut, type === 'block' ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])),
|
|
7
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n max-width: 100%;\n height: 36px;\n padding: 0 8px 0 12px;\n\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n .ant-highlighter-shiki {\n overflow: auto;\n flex: 1;\n }\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding-top: 6px !important;\n line-height: 1;\n background: none !important;\n }\n\n code[class*='language-'] {\n background: none !important;\n }\n "])), token.borderRadius, token.motionEaseOut, type === 'block' ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorFillTertiary) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorBorder), token.colorFillTertiary);
|
|
9
8
|
});
|
package/es/StroyBook/style.js
CHANGED
|
@@ -9,6 +9,6 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
9
9
|
return {
|
|
10
10
|
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 "])), mobile && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-direction: column;\n "])))),
|
|
11
11
|
left: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: auto;\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n\n ", "\n "])), !noPadding && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 40px 24px;\n "])))),
|
|
12
|
-
right: css(_templateObject5 || (_templateObject5 = _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 padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\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.
|
|
12
|
+
right: css(_templateObject5 || (_templateObject5 = _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 padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\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.colorBgLayout, token.colorFillSecondary)
|
|
13
13
|
};
|
|
14
14
|
});
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { extractStaticStyle, type ThemeMode } from 'antd-style';
|
|
2
|
-
import React from 'react';
|
|
3
3
|
export interface ThemeProviderProps {
|
|
4
|
-
/**
|
|
5
|
-
* @description Custom tokens to be used in the theme
|
|
6
|
-
*/
|
|
7
|
-
token?: any;
|
|
8
4
|
/**
|
|
9
5
|
* @description The children of the ThemeProvider component
|
|
10
6
|
*/
|
|
@@ -22,5 +18,5 @@ export interface ThemeProviderProps {
|
|
|
22
18
|
*/
|
|
23
19
|
cache?: typeof extractStaticStyle.cache;
|
|
24
20
|
}
|
|
25
|
-
declare const ThemeProvider:
|
|
21
|
+
declare const ThemeProvider: import("react").NamedExoticComponent<ThemeProviderProps>;
|
|
26
22
|
export default ThemeProvider;
|
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { lobeCustomStylish, lobeCustomToken, lobeTheme } from "../styles";
|
|
2
2
|
import { App } from 'antd';
|
|
3
3
|
import { ThemeProvider as AntdThemeProvider, StyleProvider, setupStyled } from 'antd-style';
|
|
4
|
-
import
|
|
4
|
+
import { memo } from 'react';
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import ReactFontLoader from 'react-font-loader';
|
|
7
7
|
import { ThemeContext } from 'styled-components';
|
|
8
|
-
import { createCustomToken, getAntdTheme, getCustomStylish } from "../styles";
|
|
9
8
|
import GlobalStyle from "./GlobalStyle";
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
var ThemeProvider = function
|
|
13
|
-
var
|
|
14
|
-
children = _ref.children,
|
|
11
|
+
var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
15
13
|
themeMode = _ref.themeMode;
|
|
16
14
|
setupStyled({
|
|
17
15
|
ThemeContext: ThemeContext
|
|
18
16
|
});
|
|
19
|
-
var getCustomToken = useCallback(function (params) {
|
|
20
|
-
var base = createCustomToken(params);
|
|
21
|
-
if (token) {
|
|
22
|
-
return _objectSpread(_objectSpread({}, base), token);
|
|
23
|
-
} else {
|
|
24
|
-
return base;
|
|
25
|
-
}
|
|
26
|
-
}, [token]);
|
|
27
17
|
return /*#__PURE__*/_jsx(StyleProvider, {
|
|
28
18
|
speedy: process.env.NODE_ENV === 'production',
|
|
29
19
|
children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
|
|
30
20
|
themeMode: themeMode,
|
|
31
|
-
theme:
|
|
32
|
-
customStylish:
|
|
33
|
-
customToken:
|
|
21
|
+
theme: lobeTheme,
|
|
22
|
+
customStylish: lobeCustomStylish,
|
|
23
|
+
customToken: lobeCustomToken,
|
|
34
24
|
children: [/*#__PURE__*/_jsx(ReactFontLoader, {
|
|
35
25
|
url: "https://raw.githubusercontent.com/IKKI2000/harmonyos-fonts/main/css/harmonyos_sans.css"
|
|
36
26
|
}), /*#__PURE__*/_jsx(ReactFontLoader, {
|
|
@@ -44,5 +34,5 @@ var ThemeProvider = function ThemeProvider(_ref) {
|
|
|
44
34
|
})]
|
|
45
35
|
})
|
|
46
36
|
});
|
|
47
|
-
};
|
|
37
|
+
});
|
|
48
38
|
export default ThemeProvider;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ColorScaleItem } from "../colors";
|
|
2
|
+
import { AliasToken } from 'antd/es/theme/interface';
|
|
3
|
+
export declare const generateColorPalette: ({ type, scale, appearance, }: {
|
|
4
|
+
type: 'Primary' | 'Success' | 'Warning' | 'Error' | 'Info' | string;
|
|
5
|
+
scale: ColorScaleItem;
|
|
6
|
+
appearance: 'light' | 'dark';
|
|
7
|
+
}) => Partial<AliasToken>;
|
|
8
|
+
export declare const generateColorNeutralPalette: ({ scale, appearance, }: {
|
|
9
|
+
scale: ColorScaleItem;
|
|
10
|
+
appearance: 'light' | 'dark';
|
|
11
|
+
}) => Partial<AliasToken>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { capitalize } from 'lodash';
|
|
3
|
+
export var generateColorPalette = function generateColorPalette(_ref) {
|
|
4
|
+
var _ref2;
|
|
5
|
+
var type = _ref.type,
|
|
6
|
+
scale = _ref.scale,
|
|
7
|
+
appearance = _ref.appearance;
|
|
8
|
+
var name = capitalize(type);
|
|
9
|
+
return _ref2 = {}, _defineProperty(_ref2, "color".concat(name, "Bg"), scale[appearance][1]), _defineProperty(_ref2, "color".concat(name, "BgHover"), scale[appearance][2]), _defineProperty(_ref2, "color".concat(name, "Border"), scale[appearance][4]), _defineProperty(_ref2, "color".concat(name, "BorderHover"), scale[appearance][5]), _defineProperty(_ref2, "color".concat(name, "Hover"), scale[appearance][10]), _defineProperty(_ref2, "color".concat(name), scale[appearance][9]), _defineProperty(_ref2, "color".concat(name, "Active"), scale[appearance][7]), _defineProperty(_ref2, "color".concat(name, "TextHover"), scale[appearance][10]), _defineProperty(_ref2, "color".concat(name, "Text"), scale[appearance][9]), _defineProperty(_ref2, "color".concat(name, "Active"), scale[appearance][7]), _ref2;
|
|
10
|
+
};
|
|
11
|
+
export var generateColorNeutralPalette = function generateColorNeutralPalette(_ref3) {
|
|
12
|
+
var scale = _ref3.scale,
|
|
13
|
+
appearance = _ref3.appearance;
|
|
14
|
+
return {
|
|
15
|
+
colorText: scale[appearance][12],
|
|
16
|
+
colorTextSecondary: scale[appearance][10],
|
|
17
|
+
colorTextTertiary: scale[appearance][8],
|
|
18
|
+
colorTextQuaternary: scale[appearance][6],
|
|
19
|
+
colorBorder: scale["".concat(appearance, "A")][4],
|
|
20
|
+
colorBorderSecondary: scale["".concat(appearance, "A")][3],
|
|
21
|
+
colorFill: scale["".concat(appearance, "A")][3],
|
|
22
|
+
colorFillSecondary: scale["".concat(appearance, "A")][2],
|
|
23
|
+
colorFillTertiary: scale["".concat(appearance, "A")][1],
|
|
24
|
+
colorFillQuaternary: scale["".concat(appearance, "A")][0],
|
|
25
|
+
colorBgContainer: appearance === 'dark' ? scale[appearance][1] : scale[appearance][0],
|
|
26
|
+
colorBgElevated: appearance === 'dark' ? scale[appearance][2] : scale[appearance][0],
|
|
27
|
+
colorBgLayout: appearance === 'dark' ? scale[appearance][0] : scale[appearance][1],
|
|
28
|
+
colorBgSpotlight: scale[appearance][5],
|
|
29
|
+
colorBgMask: scale.lightA[8]
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
3
3
|
import { rgba } from 'polished';
|
|
4
|
-
export var
|
|
4
|
+
export var generateCustomStylish = function generateCustomStylish(_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token,
|
|
7
7
|
isDarkMode = _ref.isDarkMode;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import { colorScales } from "../colors";
|
|
4
|
+
import { capitalize } from 'lodash';
|
|
5
|
+
import { generateColorPalette } from "./generateColorPalette";
|
|
6
|
+
var generateCustomColorPalette = function generateCustomColorPalette(_ref) {
|
|
7
|
+
var type = _ref.type,
|
|
8
|
+
scale = _ref.scale,
|
|
9
|
+
appearance = _ref.appearance;
|
|
10
|
+
var name = capitalize(type);
|
|
11
|
+
var colorStepPalette = {};
|
|
12
|
+
scale[appearance].forEach(function (color, index) {
|
|
13
|
+
colorStepPalette["color".concat(name).concat(index + 1)] = color;
|
|
14
|
+
});
|
|
15
|
+
scale["".concat(appearance, "A")].forEach(function (color, index) {
|
|
16
|
+
colorStepPalette["color".concat(name).concat(index + 1, "A")] = color;
|
|
17
|
+
});
|
|
18
|
+
return _objectSpread(_objectSpread({}, colorStepPalette), generateColorPalette({
|
|
19
|
+
type: type,
|
|
20
|
+
scale: scale,
|
|
21
|
+
appearance: appearance
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
export var generateCustomToken = function generateCustomToken(_ref2) {
|
|
27
|
+
var appearance = _ref2.appearance,
|
|
28
|
+
token = _ref2.token,
|
|
29
|
+
isDarkMode = _ref2.isDarkMode;
|
|
30
|
+
var gradientColor1 = token.blue;
|
|
31
|
+
var gradientColor2 = isDarkMode ? token.pink : token.cyan;
|
|
32
|
+
var gradientColor3 = token.purple;
|
|
33
|
+
var colorSolid = isDarkMode ? token.colorWhite : '#000';
|
|
34
|
+
var colorCustomToken = {
|
|
35
|
+
headerHeight: 64,
|
|
36
|
+
footerHeight: 300,
|
|
37
|
+
sidebarWidth: 240,
|
|
38
|
+
tocWidth: 176,
|
|
39
|
+
contentMaxWidth: 1152,
|
|
40
|
+
colorSolid: colorSolid,
|
|
41
|
+
gradientColor1: gradientColor1,
|
|
42
|
+
gradientColor2: gradientColor2,
|
|
43
|
+
gradientColor3: gradientColor3,
|
|
44
|
+
gradientHeroBgG: "radial-gradient(at 80% 20%, ".concat(gradientColor1, " 0%, ").concat(gradientColor2, " 80%, ").concat(gradientColor3, " 130%)")
|
|
45
|
+
};
|
|
46
|
+
Object.entries(colorScales).forEach(function (_ref3) {
|
|
47
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
48
|
+
type = _ref4[0],
|
|
49
|
+
scale = _ref4[1];
|
|
50
|
+
colorCustomToken = _objectSpread(_objectSpread({}, colorCustomToken), generateCustomColorPalette({
|
|
51
|
+
type: type,
|
|
52
|
+
scale: scale,
|
|
53
|
+
appearance: appearance
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
return colorCustomToken;
|
|
57
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import darkBaseToken from "../theme/dark";
|
|
3
|
+
import lightBaseToken from "../theme/light";
|
|
4
|
+
export var lightTheme = {
|
|
5
|
+
token: lightBaseToken,
|
|
6
|
+
algorithm: function algorithm(seedToken, mapToken) {
|
|
7
|
+
return _objectSpread(_objectSpread({}, mapToken), lightBaseToken);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export var darkTheme = {
|
|
11
|
+
token: darkBaseToken,
|
|
12
|
+
algorithm: function algorithm(seedToken, mapToken) {
|
|
13
|
+
return _objectSpread(_objectSpread({}, mapToken), darkBaseToken);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export var generateTheme = function generateTheme(appearance) {
|
|
17
|
+
return appearance === 'dark' ? darkTheme : lightTheme;
|
|
18
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface ColorScaleItem {
|
|
2
|
+
light: string[];
|
|
3
|
+
lightA: string[];
|
|
4
|
+
dark: string[];
|
|
5
|
+
darkA: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface ColorScales {
|
|
8
|
+
tomato: ColorScaleItem;
|
|
9
|
+
red: ColorScaleItem;
|
|
10
|
+
crimson: ColorScaleItem;
|
|
11
|
+
pink: ColorScaleItem;
|
|
12
|
+
plum: ColorScaleItem;
|
|
13
|
+
purple: ColorScaleItem;
|
|
14
|
+
violet: ColorScaleItem;
|
|
15
|
+
indigo: ColorScaleItem;
|
|
16
|
+
blue: ColorScaleItem;
|
|
17
|
+
cyan: ColorScaleItem;
|
|
18
|
+
teal: ColorScaleItem;
|
|
19
|
+
green: ColorScaleItem;
|
|
20
|
+
grass: ColorScaleItem;
|
|
21
|
+
orange: ColorScaleItem;
|
|
22
|
+
brown: ColorScaleItem;
|
|
23
|
+
sky: ColorScaleItem;
|
|
24
|
+
mint: ColorScaleItem;
|
|
25
|
+
lime: ColorScaleItem;
|
|
26
|
+
yellow: ColorScaleItem;
|
|
27
|
+
amber: ColorScaleItem;
|
|
28
|
+
bronze: ColorScaleItem;
|
|
29
|
+
gold: ColorScaleItem;
|
|
30
|
+
gray: ColorScaleItem;
|
|
31
|
+
mauve: ColorScaleItem;
|
|
32
|
+
slate: ColorScaleItem;
|
|
33
|
+
sage: ColorScaleItem;
|
|
34
|
+
olive: ColorScaleItem;
|
|
35
|
+
sand: ColorScaleItem;
|
|
36
|
+
bnw: ColorScaleItem;
|
|
37
|
+
}
|
|
38
|
+
export declare const colorScales: ColorScales;
|