@lobehub/ui 1.38.0 → 1.38.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/FluentEmoji/index.js +4 -7
- package/es/ThemeProvider/index.js +24 -18
- package/package.json +1 -1
package/es/FluentEmoji/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
-
import { useLocalStorageState } from 'ahooks';
|
|
6
5
|
import { kebabCase } from 'lodash-es';
|
|
7
6
|
import { memo, useEffect, useState } from 'react';
|
|
8
7
|
import { getEmojiNameByCharacter } from "../utils/getEmojiByCharacter";
|
|
@@ -20,12 +19,10 @@ var FluentEmoji = /*#__PURE__*/memo(function (_ref) {
|
|
|
20
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
21
20
|
loadingFail = _useState2[0],
|
|
22
21
|
setLoadingFail = _useState2[1];
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
emojiUrl = _useLocalStorageState2[0],
|
|
28
|
-
setEmojiUrl = _useLocalStorageState2[1];
|
|
22
|
+
var _useState3 = useState({}),
|
|
23
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
+
emojiUrl = _useState4[0],
|
|
25
|
+
setEmojiUrl = _useState4[1];
|
|
29
26
|
var _useStyles = useStyles(),
|
|
30
27
|
cx = _useStyles.cx,
|
|
31
28
|
styles = _useStyles.styles;
|
|
@@ -3,7 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
3
3
|
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; }
|
|
4
4
|
import { App } from 'antd';
|
|
5
5
|
import { ThemeProvider as AntdThemeProvider, StyleProvider, setupStyled } from 'antd-style';
|
|
6
|
-
import { memo } from 'react';
|
|
6
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
7
7
|
import { ThemeContext } from 'styled-components';
|
|
8
8
|
import FontLoader from "../FontLoader";
|
|
9
9
|
import { lobeCustomStylish, lobeCustomToken, lobeTheme } from "../styles";
|
|
@@ -14,21 +14,31 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
14
14
|
var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
15
15
|
var children = _ref.children,
|
|
16
16
|
themeMode = _ref.themeMode,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return {};
|
|
20
|
-
} : _ref$customStylish,
|
|
21
|
-
_ref$customToken = _ref.customToken,
|
|
22
|
-
_customToken = _ref$customToken === void 0 ? function () {
|
|
23
|
-
return {};
|
|
24
|
-
} : _ref$customToken,
|
|
17
|
+
customStylish = _ref.customStylish,
|
|
18
|
+
customToken = _ref.customToken,
|
|
25
19
|
_ref$enableWebfonts = _ref.enableWebfonts,
|
|
26
20
|
enableWebfonts = _ref$enableWebfonts === void 0 ? true : _ref$enableWebfonts,
|
|
27
21
|
_ref$webfonts = _ref.webfonts,
|
|
28
22
|
webfonts = _ref$webfonts === void 0 ? ['https://npm.elemecdn.com/@lobehub/webfont-mono/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans-sc/css/index.css'] : _ref$webfonts;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
setupStyled({
|
|
25
|
+
ThemeContext: ThemeContext
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
var stylish = useCallback(function (theme) {
|
|
29
|
+
var stylish = {};
|
|
30
|
+
if (customStylish) {
|
|
31
|
+
stylish = customStylish(theme);
|
|
32
|
+
}
|
|
33
|
+
return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), stylish);
|
|
34
|
+
}, [customStylish]);
|
|
35
|
+
var token = useCallback(function (theme) {
|
|
36
|
+
var token = {};
|
|
37
|
+
if (customToken) {
|
|
38
|
+
token = customToken(theme);
|
|
39
|
+
}
|
|
40
|
+
return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), token);
|
|
41
|
+
}, [customToken]);
|
|
32
42
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
33
43
|
children: [enableWebfonts && (webfonts === null || webfonts === void 0 ? void 0 : webfonts.length) > 0 && webfonts.map(function (webfont, index) {
|
|
34
44
|
return /*#__PURE__*/_jsx(FontLoader, {
|
|
@@ -37,12 +47,8 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
|
37
47
|
}), /*#__PURE__*/_jsx(StyleProvider, {
|
|
38
48
|
speedy: process.env.NODE_ENV === 'production',
|
|
39
49
|
children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
|
|
40
|
-
customStylish:
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
customToken: function customToken(theme) {
|
|
44
|
-
return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), _customToken(theme));
|
|
45
|
-
},
|
|
50
|
+
customStylish: stylish,
|
|
51
|
+
customToken: token,
|
|
46
52
|
theme: lobeTheme,
|
|
47
53
|
themeMode: themeMode,
|
|
48
54
|
children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
|