@lobehub/ui 1.153.16 → 1.153.17
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/ThemeProvider/index.d.ts +1 -2
- package/es/ThemeProvider/index.js +32 -42
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { StyleProviderProps as AntdStyleProviderProps } from '@ant-design/cssinjs';
|
|
2
1
|
import { ThemeProviderProps as AntdThemeProviderProps, CustomStylishParams, CustomTokenParams } from 'antd-style';
|
|
3
2
|
import { CSSProperties } from 'react';
|
|
4
3
|
import { NeutralColors, PrimaryColors } from "../styles";
|
|
5
|
-
export interface ThemeProviderProps extends AntdThemeProviderProps<any
|
|
4
|
+
export interface ThemeProviderProps extends AntdThemeProviderProps<any> {
|
|
6
5
|
className?: string;
|
|
7
6
|
/**
|
|
8
7
|
* @description Webfont loader css strings
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["children", "customStylish", "customToken", "enableCustomFonts", "enableGlobalStyle", "customFonts", "customTheme", "className", "style", "
|
|
5
|
+
var _excluded = ["children", "customStylish", "customToken", "enableCustomFonts", "enableGlobalStyle", "customFonts", "customTheme", "className", "style", "theme"];
|
|
6
6
|
import { App } from 'antd';
|
|
7
|
-
import { ThemeProvider as AntdThemeProvider
|
|
7
|
+
import { ThemeProvider as AntdThemeProvider } from 'antd-style';
|
|
8
8
|
import { merge } from 'lodash-es';
|
|
9
|
-
import { memo, useCallback } from 'react';
|
|
9
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
10
10
|
import { useCdnFn } from "../ConfigProvider";
|
|
11
11
|
import FontLoader from "../FontLoader";
|
|
12
12
|
import { lobeCustomStylish, lobeCustomToken } from "../styles";
|
|
@@ -28,28 +28,24 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
|
28
28
|
customTheme = _ref$customTheme === void 0 ? {} : _ref$customTheme,
|
|
29
29
|
className = _ref.className,
|
|
30
30
|
style = _ref.style,
|
|
31
|
-
cache = _ref.cache,
|
|
32
|
-
ssrInline = _ref.ssrInline,
|
|
33
31
|
antdTheme = _ref.theme,
|
|
34
32
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
33
|
var genCdnUrl = useCdnFn();
|
|
36
|
-
var webfontUrls =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
version: '0.16.8'
|
|
52
|
-
})];
|
|
34
|
+
var webfontUrls = useMemo(function () {
|
|
35
|
+
return customFonts || [genCdnUrl({
|
|
36
|
+
path: 'css/index.css',
|
|
37
|
+
pkg: '@lobehub/webfont-mono'
|
|
38
|
+
}), genCdnUrl({
|
|
39
|
+
path: 'css/index.css',
|
|
40
|
+
pkg: '@lobehub/webfont-harmony-sans'
|
|
41
|
+
}), genCdnUrl({
|
|
42
|
+
path: 'css/index.css',
|
|
43
|
+
pkg: '@lobehub/webfont-harmony-sans-sc'
|
|
44
|
+
}), genCdnUrl({
|
|
45
|
+
path: 'dist/katex.min.css',
|
|
46
|
+
pkg: 'katex'
|
|
47
|
+
})];
|
|
48
|
+
}, [customFonts, genCdnUrl]);
|
|
53
49
|
var stylish = useCallback(function (theme) {
|
|
54
50
|
return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), customStylish === null || customStylish === void 0 ? void 0 : customStylish(theme));
|
|
55
51
|
}, [customStylish]);
|
|
@@ -69,26 +65,20 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
|
69
65
|
return /*#__PURE__*/_jsx(FontLoader, {
|
|
70
66
|
url: webfont
|
|
71
67
|
}, webfont);
|
|
72
|
-
}), /*#__PURE__*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
children: /*#__PURE__*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
width: 'inherit'
|
|
87
|
-
}, style),
|
|
88
|
-
children: children
|
|
89
|
-
})]
|
|
90
|
-
}))
|
|
91
|
-
})]
|
|
68
|
+
}), /*#__PURE__*/_jsxs(AntdThemeProvider, _objectSpread(_objectSpread({
|
|
69
|
+
customStylish: stylish,
|
|
70
|
+
customToken: token,
|
|
71
|
+
theme: theme
|
|
72
|
+
}, rest), {}, {
|
|
73
|
+
children: [enableGlobalStyle && /*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
|
|
74
|
+
className: className,
|
|
75
|
+
style: _objectSpread({
|
|
76
|
+
minHeight: 'inherit',
|
|
77
|
+
width: 'inherit'
|
|
78
|
+
}, style),
|
|
79
|
+
children: children
|
|
80
|
+
})]
|
|
81
|
+
}))]
|
|
92
82
|
});
|
|
93
83
|
});
|
|
94
84
|
ThemeProvider.displayName = 'LobeThemeProvider';
|