@lark-apaas/client-toolkit 1.1.9-alpha.log.4 → 1.1.9-dataloom-test.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/lib/apis/hooks/useTheme.d.ts +1 -0
- package/lib/apis/hooks/useTheme.js +1 -0
- package/lib/components/AppContainer/index.js +7 -4
- package/lib/components/AppContainer/sonner.js +6 -1
- package/lib/components/ErrorRender/index.js +68 -18
- package/lib/components/NotFoundRender/index.js +41 -12
- package/lib/components/theme/ThemeProvider.d.ts +20 -0
- package/lib/components/theme/ThemeProvider.js +75 -0
- package/lib/components/theme/index.d.ts +2 -1
- package/lib/components/theme/index.js +3 -1
- package/lib/components/theme/miaoDarkTheme.d.ts +2 -0
- package/lib/components/theme/miaoDarkTheme.js +310 -0
- package/lib/components/theme/miaoLightTheme.d.ts +2 -0
- package/lib/components/theme/miaoLightTheme.js +296 -0
- package/lib/components/theme/util.d.ts +5 -6
- package/lib/components/theme/util.js +81 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useTheme.d.ts +4 -0
- package/lib/hooks/useTheme.js +8 -0
- package/lib/integrations/dataloom.js +1 -1
- package/lib/logger/log-types.d.ts +0 -3
- package/lib/logger/log-types.js +1 -2
- package/lib/logger/logger.js +0 -5
- package/lib/logger/selected-logs.js +0 -1
- package/package.json +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../hooks/useTheme';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../hooks/useTheme.js";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
+
import { StyleProvider } from "@ant-design/cssinjs";
|
|
3
4
|
import { MiaodaInspector } from "@lark-apaas/miaoda-inspector";
|
|
4
5
|
import IframeBridge from "./IframeBridge.js";
|
|
5
6
|
import { defaultUIConfig } from "../theme/ui-config.js";
|
|
6
7
|
import { Toaster } from "./sonner.js";
|
|
7
8
|
import { PageHoc } from "./PageHoc.js";
|
|
8
|
-
import { findValueByPixel, generateTailwindRadiusToken, themeColorTokenMap, themeMetaOptions } from "../theme/index.js";
|
|
9
|
+
import { ThemeProvider, findValueByPixel, generateTailwindRadiusToken, themeColorTokenMap, themeMetaOptions } from "../theme/index.js";
|
|
9
10
|
import { registerDayjsPlugins } from "./dayjsPlugins.js";
|
|
10
11
|
import "../../index.css";
|
|
11
12
|
import { initAxiosConfig } from "../../utils/axiosConfig.js";
|
|
@@ -36,7 +37,8 @@ const App = (props)=>{
|
|
|
36
37
|
}, 300);
|
|
37
38
|
});
|
|
38
39
|
}, []);
|
|
39
|
-
return /*#__PURE__*/ jsxs(
|
|
40
|
+
return /*#__PURE__*/ jsxs(StyleProvider, {
|
|
41
|
+
layer: true,
|
|
40
42
|
children: [
|
|
41
43
|
/*#__PURE__*/ jsx(Toaster, {}),
|
|
42
44
|
'production' !== process.env.NODE_ENV && /*#__PURE__*/ jsx(MiaodaInspector, {
|
|
@@ -56,7 +58,8 @@ const App = (props)=>{
|
|
|
56
58
|
};
|
|
57
59
|
const AppContainer = (props)=>{
|
|
58
60
|
const { children, ...rest } = props;
|
|
59
|
-
return /*#__PURE__*/ jsxs(
|
|
61
|
+
return /*#__PURE__*/ jsxs(ThemeProvider, {
|
|
62
|
+
...rest,
|
|
60
63
|
children: [
|
|
61
64
|
/*#__PURE__*/ jsx(safety, {}),
|
|
62
65
|
/*#__PURE__*/ jsx(App, {
|
|
@@ -2,7 +2,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import { Toaster, toast } from "sonner";
|
|
4
4
|
import "./sonner.css";
|
|
5
|
-
|
|
5
|
+
import { useTheme } from "../../hooks/index.js";
|
|
6
|
+
const sonner_Toaster = ({ ...props })=>{
|
|
7
|
+
const { theme } = useTheme();
|
|
8
|
+
return /*#__PURE__*/ jsx(Toaster, {
|
|
9
|
+
theme: theme,
|
|
6
10
|
className: "toaster group",
|
|
7
11
|
style: {
|
|
8
12
|
top: 70
|
|
@@ -18,4 +22,5 @@ const sonner_Toaster = ({ ...props })=>/*#__PURE__*/ jsx(Toaster, {
|
|
|
18
22
|
},
|
|
19
23
|
...props
|
|
20
24
|
});
|
|
25
|
+
};
|
|
21
26
|
export { sonner_Toaster as Toaster, toast };
|
|
@@ -1,21 +1,48 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import {
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
import { useLocation } from "react-router-dom";
|
|
4
|
+
import { Button } from "../ui/button.js";
|
|
5
|
+
import { postMessage } from "../../utils/postMessage.js";
|
|
6
|
+
import { copyToClipboard } from "../../utils/copyToClipboard.js";
|
|
4
7
|
const RenderError = (props)=>{
|
|
5
8
|
const { error } = props;
|
|
9
|
+
const location = useLocation();
|
|
10
|
+
const onClickCopy = useCallback(()=>{
|
|
11
|
+
const { message, stack } = error ?? {};
|
|
12
|
+
let result = '';
|
|
13
|
+
if (message && stack) {
|
|
14
|
+
const wrapIndex = stack.indexOf('\n');
|
|
15
|
+
const extraMsg = -1 !== wrapIndex ? stack.slice(0, wrapIndex) : stack;
|
|
16
|
+
result = `${message}
|
|
17
|
+
${extraMsg}`;
|
|
18
|
+
}
|
|
19
|
+
if (!result) try {
|
|
20
|
+
result = JSON.stringify(error);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error('复制到剪切板失败:', error);
|
|
23
|
+
result = 'unknown error';
|
|
24
|
+
}
|
|
25
|
+
copyToClipboard(result);
|
|
26
|
+
}, [
|
|
27
|
+
error
|
|
28
|
+
]);
|
|
29
|
+
const onClickRepair = useCallback(()=>{
|
|
30
|
+
postMessage({
|
|
31
|
+
type: 'RenderErrorRepair',
|
|
32
|
+
data: props.error
|
|
33
|
+
});
|
|
34
|
+
}, [
|
|
35
|
+
props
|
|
36
|
+
]);
|
|
6
37
|
useEffect(()=>{
|
|
7
|
-
if (props.error)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
error
|
|
12
|
-
],
|
|
13
|
-
meta: {
|
|
14
|
-
type: 'render-error'
|
|
15
|
-
}
|
|
38
|
+
if (props.error) postMessage({
|
|
39
|
+
type: 'RenderError',
|
|
40
|
+
data: props.error,
|
|
41
|
+
location: location
|
|
16
42
|
});
|
|
17
43
|
}, [
|
|
18
|
-
props.error
|
|
44
|
+
props.error,
|
|
45
|
+
location
|
|
19
46
|
]);
|
|
20
47
|
return /*#__PURE__*/ jsx("div", {
|
|
21
48
|
className: "min-h-screen flex items-center justify-center bg-gray-100",
|
|
@@ -23,14 +50,37 @@ const RenderError = (props)=>{
|
|
|
23
50
|
className: "flex flex-col justify-center items-center text-center",
|
|
24
51
|
children: [
|
|
25
52
|
/*#__PURE__*/ jsx("img", {
|
|
26
|
-
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/
|
|
53
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/render_error.svg",
|
|
27
54
|
alt: "render error",
|
|
28
|
-
className: "mb-
|
|
55
|
+
className: "mb-4 w-[120px]"
|
|
29
56
|
}),
|
|
30
57
|
/*#__PURE__*/ jsx("p", {
|
|
31
|
-
className: "text-l/[22px] text-[
|
|
32
|
-
children:
|
|
33
|
-
})
|
|
58
|
+
className: "text-l/[22px] text-[#1F2329] font-medium mb-2",
|
|
59
|
+
children: 'production' !== process.env.NODE_ENV ? '哎呀,写错代码了' : '哎呀,出错了'
|
|
60
|
+
}),
|
|
61
|
+
'production' !== process.env.NODE_ENV ? /*#__PURE__*/ jsxs(Fragment, {
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ jsx("p", {
|
|
64
|
+
className: "text-sm/[22px] text-[#646A73] font-normal mb-2",
|
|
65
|
+
children: "可复制错误信息,或告诉妙搭进行修复"
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ jsxs("div", {
|
|
68
|
+
className: "flex space-x-4",
|
|
69
|
+
children: [
|
|
70
|
+
/*#__PURE__*/ jsx(Button, {
|
|
71
|
+
className: "bg-white cursor-pointer text-gray-600 font-[400] border rounded-[6px] shadow-xs hover:bg-gray-100 active:bg-gray-200 focus:outline-hidden h-[32px] border-[#D0D3D6]",
|
|
72
|
+
onClick: onClickCopy,
|
|
73
|
+
children: "复制错误信息"
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ jsx(Button, {
|
|
76
|
+
className: "cursor-pointer h-[32px] text-sm font-medium text-white bg-blue-600 border border-transparent rounded-[6px] shadow-xs hover:bg-blue-600 active:bg-blue-700 focus:outline-hidden ",
|
|
77
|
+
onClick: onClickRepair,
|
|
78
|
+
children: "告诉妙搭修复"
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
}) : null
|
|
34
84
|
]
|
|
35
85
|
})
|
|
36
86
|
});
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useLocation } from "react-router-dom";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
+
import { postMessage } from "../../utils/postMessage.js";
|
|
5
|
+
import { useUpdatingRef } from "../../hooks/useUpdatingRef.js";
|
|
4
6
|
import { logger } from "../../logger/index.js";
|
|
5
7
|
const NotFound = ()=>{
|
|
6
8
|
const location = useLocation();
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
const navigateRef = useUpdatingRef(navigate);
|
|
7
11
|
useEffect(()=>{
|
|
8
12
|
logger.log({
|
|
9
13
|
level: 'error',
|
|
@@ -11,27 +15,52 @@ const NotFound = ()=>{
|
|
|
11
15
|
`页面 ${location.pathname} 不存在`
|
|
12
16
|
],
|
|
13
17
|
meta: {
|
|
14
|
-
repairMessage: `页面 ${location.pathname}
|
|
15
|
-
noStacktrace: true
|
|
16
|
-
stacktrace: [],
|
|
17
|
-
type: 'not-found'
|
|
18
|
+
repairMessage: `页面 ${location.pathname} 不存在,帮我创建`,
|
|
19
|
+
noStacktrace: true
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
}, [
|
|
21
23
|
location.pathname
|
|
22
24
|
]);
|
|
25
|
+
const onClick = ()=>{
|
|
26
|
+
if ('production' !== process.env.NODE_ENV) postMessage({
|
|
27
|
+
type: 'CreatePage',
|
|
28
|
+
data: location.pathname
|
|
29
|
+
});
|
|
30
|
+
else navigateRef.current('/');
|
|
31
|
+
};
|
|
23
32
|
return /*#__PURE__*/ jsxs("div", {
|
|
24
|
-
className: "min-h-screen flex flex-col items-center justify-center bg-white
|
|
33
|
+
className: "min-h-screen flex flex-col items-center justify-center bg-white",
|
|
25
34
|
children: [
|
|
26
35
|
/*#__PURE__*/ jsx("img", {
|
|
27
|
-
src: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/
|
|
28
|
-
alt: "
|
|
29
|
-
className: "w-[
|
|
36
|
+
src: 'production' !== process.env.NODE_ENV ? 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_positive_create.svg' : 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_failure-miss.svg',
|
|
37
|
+
alt: "Empty",
|
|
38
|
+
className: "mb-3 w-[120px]"
|
|
30
39
|
}),
|
|
31
40
|
/*#__PURE__*/ jsx("p", {
|
|
32
41
|
className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium",
|
|
33
|
-
children:
|
|
34
|
-
})
|
|
42
|
+
children: 'production' !== process.env.NODE_ENV ? '哎呀,这个页面尚未生成' : '404'
|
|
43
|
+
}),
|
|
44
|
+
'production' !== process.env.NODE_ENV ? /*#__PURE__*/ jsxs(Fragment, {
|
|
45
|
+
children: [
|
|
46
|
+
/*#__PURE__*/ jsx("p", {
|
|
47
|
+
className: "text-sm/[22px] text-[14px] text-[#646A73] font-normal mt-1",
|
|
48
|
+
children: "戳下方按钮,我可以根据上下文帮你生成一个"
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ jsxs("button", {
|
|
51
|
+
className: "h-[32px] text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md shadow-xs hover:bg-blue-600 active:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-blue-500 px-3 flex flex-row items-center mt-3",
|
|
52
|
+
onClick: onClick,
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ jsx("img", {
|
|
55
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/icon_chat-ai_outlined.svg",
|
|
56
|
+
alt: "Icon",
|
|
57
|
+
className: "w-[14px] h-[14px] mr-1"
|
|
58
|
+
}),
|
|
59
|
+
"告诉妙搭生成一个"
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}) : null
|
|
35
64
|
]
|
|
36
65
|
});
|
|
37
66
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import type { ITheme } from '../../types';
|
|
4
|
+
import { IThemeTokenMeta } from './util';
|
|
5
|
+
export interface IBaseThemeProviderProps {
|
|
6
|
+
defaultTheme?: ITheme;
|
|
7
|
+
themeMeta?: Partial<IThemeTokenMeta>;
|
|
8
|
+
}
|
|
9
|
+
interface ThemeProviderProps extends IBaseThemeProviderProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** 是否启用系统主题自动切换 */
|
|
12
|
+
enableSystemTheme?: boolean;
|
|
13
|
+
}
|
|
14
|
+
type ThemeProviderState = {
|
|
15
|
+
theme: ITheme;
|
|
16
|
+
setTheme: (theme: ITheme) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const ThemeProviderContext: React.Context<ThemeProviderState>;
|
|
19
|
+
export declare function ThemeProvider({ children, defaultTheme, themeMeta, enableSystemTheme, ...props }: ThemeProviderProps): React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { ConfigProvider } from "antd";
|
|
4
|
+
import { generateDarkTheme, generateLightTheme } from "./util.js";
|
|
5
|
+
import { findValueByPixel, themeMetaOptions } from "./constants.js";
|
|
6
|
+
const initialState = {
|
|
7
|
+
theme: 'system',
|
|
8
|
+
setTheme: ()=>null
|
|
9
|
+
};
|
|
10
|
+
const ThemeProviderContext = /*#__PURE__*/ createContext(initialState);
|
|
11
|
+
const themeKey = 'miao-ui-theme';
|
|
12
|
+
function ThemeProvider({ children, defaultTheme = 'light', themeMeta = {}, enableSystemTheme = false, ...props }) {
|
|
13
|
+
const [theme, setTheme] = useState(()=>localStorage.getItem(themeKey) || defaultTheme);
|
|
14
|
+
useEffect(()=>{
|
|
15
|
+
const root = window.document.documentElement;
|
|
16
|
+
root.classList.remove('light', 'dark');
|
|
17
|
+
root.classList.add(theme);
|
|
18
|
+
}, [
|
|
19
|
+
theme,
|
|
20
|
+
enableSystemTheme
|
|
21
|
+
]);
|
|
22
|
+
useEffect(()=>{
|
|
23
|
+
const root = window.document.documentElement;
|
|
24
|
+
if (void 0 !== themeMeta.spacing) {
|
|
25
|
+
const { rem } = findValueByPixel(themeMetaOptions.themeSpaces, themeMeta.spacing) || {
|
|
26
|
+
rem: '0.25'
|
|
27
|
+
};
|
|
28
|
+
root.style.setProperty('--spacing', `${rem}rem`);
|
|
29
|
+
}
|
|
30
|
+
if (void 0 !== themeMeta.borderRadius) {
|
|
31
|
+
const { rem } = findValueByPixel(themeMetaOptions.themeRadius, themeMeta.borderRadius) || {
|
|
32
|
+
rem: '0.625'
|
|
33
|
+
};
|
|
34
|
+
root.style.setProperty('--radius', `${rem}rem`);
|
|
35
|
+
}
|
|
36
|
+
}, [
|
|
37
|
+
themeMeta
|
|
38
|
+
]);
|
|
39
|
+
const value = {
|
|
40
|
+
theme,
|
|
41
|
+
setTheme: (theme)=>{
|
|
42
|
+
localStorage.setItem(themeKey, theme);
|
|
43
|
+
setTheme(theme);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const antdTheme = useMemo(()=>{
|
|
47
|
+
const res = findValueByPixel(themeMetaOptions.themeSpaces, themeMeta.spacing) || {
|
|
48
|
+
pixel: '36',
|
|
49
|
+
rem: '0.25',
|
|
50
|
+
size: {
|
|
51
|
+
sizeUnit: '4',
|
|
52
|
+
sizeStep: '4'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const transformThemeMeta = {
|
|
56
|
+
colorPrimary: themeMeta.colorPrimary,
|
|
57
|
+
borderRadius: Number(themeMeta.borderRadius),
|
|
58
|
+
sizeUnit: Number(res.size.sizeUnit),
|
|
59
|
+
sizeStep: Number(res.size.sizeStep)
|
|
60
|
+
};
|
|
61
|
+
return 'dark' === theme ? generateDarkTheme(transformThemeMeta) : generateLightTheme(transformThemeMeta);
|
|
62
|
+
}, [
|
|
63
|
+
theme,
|
|
64
|
+
themeMeta
|
|
65
|
+
]);
|
|
66
|
+
return /*#__PURE__*/ jsx(ThemeProviderContext.Provider, {
|
|
67
|
+
...props,
|
|
68
|
+
value: value,
|
|
69
|
+
children: /*#__PURE__*/ jsx(ConfigProvider, {
|
|
70
|
+
theme: antdTheme,
|
|
71
|
+
children: children
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export { ThemeProvider, ThemeProviderContext };
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
const defaultPrimaryPresets = {
|
|
2
|
+
colorPrimary: '#336df4',
|
|
3
|
+
colorPrimaryBg: '#152340',
|
|
4
|
+
colorPrimaryBgHover: '#173166',
|
|
5
|
+
colorPrimaryBorder: '#336df4',
|
|
6
|
+
colorPrimaryBorderHover: '#888888',
|
|
7
|
+
colorPrimaryHover: '#4c88ff',
|
|
8
|
+
colorPrimaryActive: '#75a4ff',
|
|
9
|
+
colorPrimaryTextHover: '#3370eb',
|
|
10
|
+
colorPrimaryText: '#4c88ff',
|
|
11
|
+
colorPrimaryTextActive: '#75a4ff',
|
|
12
|
+
colorPrimaryFill: 'rgba(255, 255, 255, 0.22)',
|
|
13
|
+
colorPrimaryFillSecondary: 'rgba(255, 255, 255, 0.16)',
|
|
14
|
+
colorPrimaryFillTertiary: 'rgba(255, 255, 255, 0.08)',
|
|
15
|
+
colorPrimaryFillQuaternary: 'rgba(255, 255, 255, 0.02)'
|
|
16
|
+
};
|
|
17
|
+
const darkToken = {
|
|
18
|
+
blue: '#8ae8ff',
|
|
19
|
+
purple: '#bd54c6',
|
|
20
|
+
cyan: '#95f3d9',
|
|
21
|
+
green: '#62c473',
|
|
22
|
+
magenta: '#e34ba9',
|
|
23
|
+
pink: '#EB2F96',
|
|
24
|
+
red: '#f4416c',
|
|
25
|
+
orange: '#ff9927',
|
|
26
|
+
yellow: '#ffef5c',
|
|
27
|
+
volcano: '#ec5e41',
|
|
28
|
+
geekblue: '#0072f5',
|
|
29
|
+
gold: '#ffb224',
|
|
30
|
+
lime: '#c4f042',
|
|
31
|
+
colorPrimary: '#336df4',
|
|
32
|
+
colorSuccess: '#51ba43',
|
|
33
|
+
colorWarning: '#f3871b',
|
|
34
|
+
colorError: '#f05b56',
|
|
35
|
+
colorInfo: '#336df4',
|
|
36
|
+
colorLink: '#4c88ff',
|
|
37
|
+
colorTextBase: '#ebebeb',
|
|
38
|
+
colorBgBase: '#000',
|
|
39
|
+
fontFamily: '"HarmonyOS Sans","Segoe UI","SF Pro Display",-apple-system,BlinkMacSystemFont,Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif,"HarmonyOS Sans SC","PingFang SC","Hiragino Sans GB","Microsoft Yahei UI","Microsoft Yahei","Source Han Sans CN",sans-serif,"Segoe UI Emoji","Segoe UI Symbol","Apple Color Emoji","Twemoji Mozilla","Noto Color Emoji","Android Emoji"',
|
|
40
|
+
fontFamilyCode: 'Hack,ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace,"HarmonyOS Sans SC","PingFang SC","Hiragino Sans GB","Microsoft Yahei UI","Microsoft Yahei","Source Han Sans CN",sans-serif,"Segoe UI Emoji","Segoe UI Symbol","Apple Color Emoji","Twemoji Mozilla","Noto Color Emoji","Android Emoji"',
|
|
41
|
+
fontSize: 14,
|
|
42
|
+
lineWidth: 1,
|
|
43
|
+
lineType: 'solid',
|
|
44
|
+
motionUnit: 0.1,
|
|
45
|
+
motionBase: 0,
|
|
46
|
+
motionEaseOutCirc: 'cubic-bezier(0.08, 0.82, 0.17, 1)',
|
|
47
|
+
motionEaseInOutCirc: 'cubic-bezier(0.78, 0.14, 0.15, 0.86)',
|
|
48
|
+
motionEaseOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
|
|
49
|
+
motionEaseInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)',
|
|
50
|
+
motionEaseOutBack: 'cubic-bezier(0.12, 0.4, 0.29, 1.46)',
|
|
51
|
+
motionEaseInBack: 'cubic-bezier(0.71, -0.46, 0.88, 0.6)',
|
|
52
|
+
motionEaseInQuint: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',
|
|
53
|
+
motionEaseOutQuint: 'cubic-bezier(0.23, 1, 0.32, 1)',
|
|
54
|
+
borderRadius: 6,
|
|
55
|
+
sizeUnit: 4,
|
|
56
|
+
sizeStep: 4,
|
|
57
|
+
sizePopupArrow: 16,
|
|
58
|
+
controlHeight: 36,
|
|
59
|
+
zIndexBase: 0,
|
|
60
|
+
zIndexPopupBase: 1000,
|
|
61
|
+
opacityImage: 1,
|
|
62
|
+
wireframe: false,
|
|
63
|
+
motion: true,
|
|
64
|
+
borderRadiusLG: 8,
|
|
65
|
+
borderRadiusSM: 4,
|
|
66
|
+
colorText: '#ebebeb',
|
|
67
|
+
colorTextSecondary: '#a6a6a6',
|
|
68
|
+
colorTextTertiary: '#757575',
|
|
69
|
+
colorTextQuaternary: '#5f5f5f',
|
|
70
|
+
colorFill: 'rgba(255, 255, 255, 0.16)',
|
|
71
|
+
colorFillSecondary: 'rgba(255, 255, 255, 0.10)',
|
|
72
|
+
colorFillTertiary: 'rgba(255, 255, 255, 0.06)',
|
|
73
|
+
colorFillQuaternary: 'rgba(255, 255, 255, 0.02)',
|
|
74
|
+
colorBgSolid: 'rgba(255,255,255,0.95)',
|
|
75
|
+
colorBgSolidHover: 'rgb(255,255,255)',
|
|
76
|
+
colorBgSolidActive: 'rgba(255,255,255,0.9)',
|
|
77
|
+
colorBgLayout: '#000000',
|
|
78
|
+
colorBgContainer: '#0d0d0d',
|
|
79
|
+
colorBgElevated: '#1a1a1a',
|
|
80
|
+
colorBgSpotlight: '#2d2d2d',
|
|
81
|
+
colorBgBlur: 'rgba(255,255,255,0.04)',
|
|
82
|
+
colorBorder: '#505050',
|
|
83
|
+
colorBorderSecondary: '#ebebeb26',
|
|
84
|
+
colorPrimaryBg: '#152340',
|
|
85
|
+
colorPrimaryBgHover: '#173166',
|
|
86
|
+
colorPrimaryBorder: '#336df4',
|
|
87
|
+
colorPrimaryBorderHover: '#888888',
|
|
88
|
+
colorPrimaryHover: '#4c88ff',
|
|
89
|
+
colorPrimaryActive: '#75a4ff',
|
|
90
|
+
colorPrimaryTextHover: '#3370eb',
|
|
91
|
+
colorPrimaryText: '#4c88ff',
|
|
92
|
+
colorPrimaryTextActive: '#75a4ff',
|
|
93
|
+
colorSuccessBg: '#0e2b0a',
|
|
94
|
+
colorSuccessBgHover: '#173b12',
|
|
95
|
+
colorSuccessBorder: '#2f7526',
|
|
96
|
+
colorSuccessBorderHover: '#35872a',
|
|
97
|
+
colorSuccessHover: '#419e34',
|
|
98
|
+
colorSuccessActive: '#69cc5c',
|
|
99
|
+
colorSuccessTextHover: '#419e34',
|
|
100
|
+
colorSuccessText: '#51ba43',
|
|
101
|
+
colorSuccessTextActive: '#69cc5c',
|
|
102
|
+
colorErrorBg: '#3d1a19',
|
|
103
|
+
colorErrorBgHover: '#591f1d',
|
|
104
|
+
colorErrorBgFilledHover: '#441e1f',
|
|
105
|
+
colorErrorBgActive: '#5b2526',
|
|
106
|
+
colorErrorBorder: '#b33a37',
|
|
107
|
+
colorErrorBorderHover: '#d14642',
|
|
108
|
+
colorErrorHover: '#f05b56',
|
|
109
|
+
colorErrorActive: '#f89e9b',
|
|
110
|
+
colorErrorTextHover: '#d14642',
|
|
111
|
+
colorErrorText: '#f05b56',
|
|
112
|
+
colorErrorTextActive: '#f89e9b',
|
|
113
|
+
colorWarningBg: '#33210b',
|
|
114
|
+
colorWarningBgHover: '#4a2b10',
|
|
115
|
+
colorWarningBorder: '#a15317',
|
|
116
|
+
colorWarningBorderHover: '#b85e1a',
|
|
117
|
+
colorWarningHover: '#db7018',
|
|
118
|
+
colorWarningActive: '#f89e44',
|
|
119
|
+
colorWarningTextHover: '#db7018',
|
|
120
|
+
colorWarningText: '#f3871b',
|
|
121
|
+
colorWarningTextActive: '#f89e44',
|
|
122
|
+
colorInfoBg: '#002126',
|
|
123
|
+
colorInfoBgHover: '#00363f',
|
|
124
|
+
colorInfoBorder: '#006675',
|
|
125
|
+
colorInfoBorderHover: '#008093',
|
|
126
|
+
colorInfoHover: '#b8f0ff',
|
|
127
|
+
colorInfoActive: '#47b3ca',
|
|
128
|
+
colorInfoTextHover: '#b8f0ff',
|
|
129
|
+
colorInfoText: '#8ae8ff',
|
|
130
|
+
colorInfoTextActive: '#47b3ca',
|
|
131
|
+
colorLinkHover: '#3370eb',
|
|
132
|
+
colorLinkActive: '#75a4ff',
|
|
133
|
+
colorBgMask: 'rgba(0, 0, 0, 0.44)',
|
|
134
|
+
colorWhite: '#fff',
|
|
135
|
+
fontSizeSM: 12,
|
|
136
|
+
fontSizeLG: 16,
|
|
137
|
+
fontSizeXL: 18,
|
|
138
|
+
fontSizeHeading1: 30,
|
|
139
|
+
fontSizeHeading2: 24,
|
|
140
|
+
fontSizeHeading3: 20,
|
|
141
|
+
fontSizeHeading4: 18,
|
|
142
|
+
fontSizeHeading5: 16,
|
|
143
|
+
lineHeight: 1.5714285714285714,
|
|
144
|
+
lineHeightLG: 1.5,
|
|
145
|
+
lineHeightSM: 1.6666666666666667,
|
|
146
|
+
fontHeight: 22,
|
|
147
|
+
fontHeightLG: 24,
|
|
148
|
+
fontHeightSM: 20,
|
|
149
|
+
lineHeightHeading1: 1.2105263157894737,
|
|
150
|
+
lineHeightHeading2: 1.2666666666666666,
|
|
151
|
+
lineHeightHeading3: 1.3333333333333333,
|
|
152
|
+
lineHeightHeading4: 1.4,
|
|
153
|
+
lineHeightHeading5: 1.5,
|
|
154
|
+
sizeXXL: 48,
|
|
155
|
+
sizeXL: 32,
|
|
156
|
+
sizeLG: 24,
|
|
157
|
+
sizeMD: 20,
|
|
158
|
+
sizeMS: 16,
|
|
159
|
+
size: 16,
|
|
160
|
+
sizeSM: 12,
|
|
161
|
+
sizeXS: 8,
|
|
162
|
+
sizeXXS: 4,
|
|
163
|
+
controlHeightSM: 27,
|
|
164
|
+
controlHeightXS: 18,
|
|
165
|
+
controlHeightLG: 45,
|
|
166
|
+
motionDurationFast: '0.1s',
|
|
167
|
+
motionDurationMid: '0.2s',
|
|
168
|
+
motionDurationSlow: '0.3s',
|
|
169
|
+
lineWidthBold: 2,
|
|
170
|
+
borderRadiusOuter: 4,
|
|
171
|
+
colorPrimaryFill: 'rgba(255, 255, 255, 0.22)',
|
|
172
|
+
colorPrimaryFillSecondary: 'rgba(255, 255, 255, 0.16)',
|
|
173
|
+
colorPrimaryFillTertiary: 'rgba(255, 255, 255, 0.08)',
|
|
174
|
+
colorPrimaryFillQuaternary: 'rgba(255, 255, 255, 0.02)',
|
|
175
|
+
colorSuccessFill: 'rgba(177, 255, 0, 0.31)',
|
|
176
|
+
colorSuccessFillSecondary: 'rgba(168, 250, 0, 0.22)',
|
|
177
|
+
colorSuccessFillTertiary: 'rgba(154, 254, 0, 0.13)',
|
|
178
|
+
colorSuccessFillQuaternary: 'rgba(100, 200, 0, 0.02)',
|
|
179
|
+
colorWarningFill: 'rgba(252, 174, 0, 0.42)',
|
|
180
|
+
colorWarningFillSecondary: 'rgba(248, 166, 0, 0.29)',
|
|
181
|
+
colorWarningFillTertiary: 'rgba(247, 159, 0, 0.17)',
|
|
182
|
+
colorWarningFillQuaternary: 'rgba(233, 100, 0, 0.03)',
|
|
183
|
+
colorErrorFill: 'rgba(255, 0, 106, 0.47)',
|
|
184
|
+
colorErrorFillSecondary: 'rgba(253, 0, 103, 0.34)',
|
|
185
|
+
colorErrorFillTertiary: 'rgba(255, 0, 95, 0.22)',
|
|
186
|
+
colorErrorFillQuaternary: 'rgba(250, 0, 50, 0.06)',
|
|
187
|
+
colorInfoFill: 'rgba(0, 223, 254, 0.35)',
|
|
188
|
+
colorInfoFillSecondary: 'rgba(0, 216, 252, 0.25)',
|
|
189
|
+
colorInfoFillTertiary: 'rgba(0, 220, 253, 0.15)',
|
|
190
|
+
colorInfoFillQuaternary: 'rgba(0, 167, 200, 0.03)',
|
|
191
|
+
boxShadow: '\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
192
|
+
boxShadowSecondary: '\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
193
|
+
boxShadowTertiary: '\n 0 1px 2px 0 rgba(0, 0, 0, 0.03),\n 0 1px 6px -1px rgba(0, 0, 0, 0.02),\n 0 2px 4px 0 rgba(0, 0, 0, 0.02)\n ',
|
|
194
|
+
colorTextLightSolid: '#fff',
|
|
195
|
+
colorFillContent: 'rgba(255, 255, 255, 0.10)',
|
|
196
|
+
colorFillContentHover: 'rgba(255, 255, 255, 0.16)',
|
|
197
|
+
colorFillAlter: 'rgba(255, 255, 255, 0.02)',
|
|
198
|
+
colorBgContainerDisabled: 'rgba(255, 255, 255, 0.06)',
|
|
199
|
+
colorBorderBg: '#0d0d0d',
|
|
200
|
+
colorSplit: 'rgba(230,230,230,0.06)',
|
|
201
|
+
colorTextPlaceholder: '#555555',
|
|
202
|
+
colorTextDisabled: '#555555',
|
|
203
|
+
colorTextHeading: '#ffffff',
|
|
204
|
+
colorTextLabel: '#aaaaaa',
|
|
205
|
+
colorTextDescription: '#6f6f6f',
|
|
206
|
+
colorHighlight: '#f4416c',
|
|
207
|
+
colorBgTextHover: 'rgba(255, 255, 255, 0.10)',
|
|
208
|
+
colorBgTextActive: 'rgba(255, 255, 255, 0.16)',
|
|
209
|
+
colorIcon: '#6f6f6f',
|
|
210
|
+
colorIconHover: '#ffffff',
|
|
211
|
+
colorErrorOutline: 'rgba(57,0,21,0.97)',
|
|
212
|
+
colorWarningOutline: 'rgba(43,27,0,0.97)',
|
|
213
|
+
fontSizeIcon: 12,
|
|
214
|
+
lineWidthFocus: 3,
|
|
215
|
+
controlOutlineWidth: 2,
|
|
216
|
+
controlInteractiveSize: 18,
|
|
217
|
+
controlItemBgHover: 'rgba(255, 255, 255, 0.06)',
|
|
218
|
+
controlItemBgActive: '#111111',
|
|
219
|
+
controlItemBgActiveHover: '#333333',
|
|
220
|
+
controlItemBgActiveDisabled: 'rgba(255, 255, 255, 0.16)',
|
|
221
|
+
controlTmpOutline: 'rgba(255, 255, 255, 0.02)',
|
|
222
|
+
controlOutline: 'rgba(213,213,213,0.02)',
|
|
223
|
+
fontWeightStrong: 600,
|
|
224
|
+
opacityLoading: 0.65,
|
|
225
|
+
linkDecoration: 'none',
|
|
226
|
+
linkHoverDecoration: 'none',
|
|
227
|
+
linkFocusDecoration: 'none',
|
|
228
|
+
controlPaddingHorizontal: 12,
|
|
229
|
+
controlPaddingHorizontalSM: 8,
|
|
230
|
+
paddingXXS: 4,
|
|
231
|
+
paddingXS: 8,
|
|
232
|
+
paddingSM: 12,
|
|
233
|
+
padding: 16,
|
|
234
|
+
paddingMD: 20,
|
|
235
|
+
paddingLG: 24,
|
|
236
|
+
paddingXL: 32,
|
|
237
|
+
paddingContentHorizontalLG: 24,
|
|
238
|
+
paddingContentVerticalLG: 16,
|
|
239
|
+
paddingContentHorizontal: 16,
|
|
240
|
+
paddingContentVertical: 12,
|
|
241
|
+
paddingContentHorizontalSM: 16,
|
|
242
|
+
paddingContentVerticalSM: 8,
|
|
243
|
+
marginXXS: 4,
|
|
244
|
+
marginXS: 8,
|
|
245
|
+
marginSM: 12,
|
|
246
|
+
margin: 16,
|
|
247
|
+
marginMD: 20,
|
|
248
|
+
marginLG: 24,
|
|
249
|
+
marginXL: 32,
|
|
250
|
+
marginXXL: 48,
|
|
251
|
+
screenXS: 480,
|
|
252
|
+
screenXSMin: 480,
|
|
253
|
+
screenXSMax: 575,
|
|
254
|
+
screenSM: 576,
|
|
255
|
+
screenSMMin: 576,
|
|
256
|
+
screenSMMax: 767,
|
|
257
|
+
screenMD: 768,
|
|
258
|
+
screenMDMin: 768,
|
|
259
|
+
screenMDMax: 991,
|
|
260
|
+
screenLG: 992,
|
|
261
|
+
screenLGMin: 992,
|
|
262
|
+
screenLGMax: 1199,
|
|
263
|
+
screenXL: 1200,
|
|
264
|
+
screenXLMin: 1200,
|
|
265
|
+
screenXLMax: 1599,
|
|
266
|
+
screenXXL: 1600,
|
|
267
|
+
screenXXLMin: 1600,
|
|
268
|
+
boxShadowPopoverArrow: '2px 2px 5px rgba(0, 0, 0, 0.05)',
|
|
269
|
+
boxShadowCard: '\n 0 1px 2px -2px rgba(0,0,0,0.16),\n 0 3px 6px 0 rgba(0,0,0,0.12),\n 0 5px 12px 4px rgba(0,0,0,0.09)\n ',
|
|
270
|
+
boxShadowDrawerRight: '\n -6px 0 16px 0 rgba(0, 0, 0, 0.08),\n -3px 0 6px -4px rgba(0, 0, 0, 0.12),\n -9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
271
|
+
boxShadowDrawerLeft: '\n 6px 0 16px 0 rgba(0, 0, 0, 0.08),\n 3px 0 6px -4px rgba(0, 0, 0, 0.12),\n 9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
272
|
+
boxShadowDrawerUp: '\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
273
|
+
boxShadowDrawerDown: '\n 0 -6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 -3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 -9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
274
|
+
boxShadowTabsOverflowLeft: 'inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)',
|
|
275
|
+
boxShadowTabsOverflowRight: 'inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)',
|
|
276
|
+
boxShadowTabsOverflowTop: 'inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)',
|
|
277
|
+
boxShadowTabsOverflowBottom: 'inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)',
|
|
278
|
+
Button: {
|
|
279
|
+
contentFontSizeSM: 12
|
|
280
|
+
},
|
|
281
|
+
DatePicker: {},
|
|
282
|
+
Input: {},
|
|
283
|
+
InputNumber: {},
|
|
284
|
+
Mentions: {},
|
|
285
|
+
Select: {},
|
|
286
|
+
themeMode: 'dark',
|
|
287
|
+
appearance: 'dark',
|
|
288
|
+
isDarkMode: true,
|
|
289
|
+
browserPrefers: 'light',
|
|
290
|
+
prefixCls: 'antd',
|
|
291
|
+
iconPrefixCls: 'anticon'
|
|
292
|
+
};
|
|
293
|
+
const defaultDarkTheme = {
|
|
294
|
+
cssVar: true,
|
|
295
|
+
token: {
|
|
296
|
+
...darkToken,
|
|
297
|
+
...defaultPrimaryPresets
|
|
298
|
+
},
|
|
299
|
+
components: {
|
|
300
|
+
Tag: {
|
|
301
|
+
lineType: 'none'
|
|
302
|
+
},
|
|
303
|
+
Button: {
|
|
304
|
+
dangerShadow: '0',
|
|
305
|
+
defaultShadow: '0',
|
|
306
|
+
primaryShadow: '0'
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
export { defaultDarkTheme };
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
const defaultPrimaryPresets = {
|
|
2
|
+
colorPrimary: '#1456f0',
|
|
3
|
+
colorPrimaryBg: '#f0f4ff',
|
|
4
|
+
colorPrimaryBgHover: '#e0e9ff',
|
|
5
|
+
colorPrimaryBorder: '#336df4',
|
|
6
|
+
colorPrimaryBorderHover: '#5083fb',
|
|
7
|
+
colorPrimaryHover: '#336df4',
|
|
8
|
+
colorPrimaryActive: '#0442d2',
|
|
9
|
+
colorPrimaryTextHover: '#336df4',
|
|
10
|
+
colorPrimaryText: '#1456f0',
|
|
11
|
+
colorPrimaryTextActive: '#0442d2',
|
|
12
|
+
colorPrimaryFill: 'rgba(0, 0, 0, 0.36)',
|
|
13
|
+
colorPrimaryFillSecondary: 'rgba(0, 0, 0, 0.22)',
|
|
14
|
+
colorPrimaryFillTertiary: 'rgba(0, 0, 0, 0.16)',
|
|
15
|
+
colorPrimaryFillQuaternary: 'rgba(0, 0, 0, 0.08)'
|
|
16
|
+
};
|
|
17
|
+
const lightToken = {
|
|
18
|
+
blue: '#7AA2FF',
|
|
19
|
+
purple: '#B791FA',
|
|
20
|
+
cyan: '#2DBEAB',
|
|
21
|
+
green: '#32A645',
|
|
22
|
+
magenta: '#EB78B8',
|
|
23
|
+
pink: '#EB2F96',
|
|
24
|
+
red: '#FF7570',
|
|
25
|
+
orange: '#FF811A',
|
|
26
|
+
yellow: '#FFC60A',
|
|
27
|
+
volcano: '#FFE928',
|
|
28
|
+
geekblue: '#25B0E7',
|
|
29
|
+
gold: '#DE81DE',
|
|
30
|
+
lime: '#91AD00',
|
|
31
|
+
colorSuccess: '#32a645',
|
|
32
|
+
colorError: '#f54a45',
|
|
33
|
+
colorInfo: '#1456f0',
|
|
34
|
+
colorLink: '#1456f0',
|
|
35
|
+
colorTextBase: '#1f2329',
|
|
36
|
+
colorBgBase: '#fff',
|
|
37
|
+
fontFamily: '"HarmonyOS Sans","Segoe UI","SF Pro Display",-apple-system,BlinkMacSystemFont,Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif,"HarmonyOS Sans SC","PingFang SC","Hiragino Sans GB","Microsoft Yahei UI","Microsoft Yahei","Source Han Sans CN",sans-serif,"Segoe UI Emoji","Segoe UI Symbol","Apple Color Emoji","Twemoji Mozilla","Noto Color Emoji","Android Emoji"',
|
|
38
|
+
fontFamilyCode: 'Hack,ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace,"HarmonyOS Sans SC","PingFang SC","Hiragino Sans GB","Microsoft Yahei UI","Microsoft Yahei","Source Han Sans CN",sans-serif,"Segoe UI Emoji","Segoe UI Symbol","Apple Color Emoji","Twemoji Mozilla","Noto Color Emoji","Android Emoji"',
|
|
39
|
+
lineWidth: 1,
|
|
40
|
+
lineType: 'solid',
|
|
41
|
+
motionUnit: 0.1,
|
|
42
|
+
motionBase: 0,
|
|
43
|
+
motionEaseOutCirc: 'cubic-bezier(0.08, 0.82, 0.17, 1)',
|
|
44
|
+
motionEaseInOutCirc: 'cubic-bezier(0.78, 0.14, 0.15, 0.86)',
|
|
45
|
+
motionEaseOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
|
|
46
|
+
motionEaseInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)',
|
|
47
|
+
motionEaseOutBack: 'cubic-bezier(0.12, 0.4, 0.29, 1.46)',
|
|
48
|
+
motionEaseInBack: 'cubic-bezier(0.71, -0.46, 0.88, 0.6)',
|
|
49
|
+
motionEaseInQuint: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',
|
|
50
|
+
motionEaseOutQuint: 'cubic-bezier(0.23, 1, 0.32, 1)',
|
|
51
|
+
borderRadius: 6,
|
|
52
|
+
sizePopupArrow: 16,
|
|
53
|
+
controlHeight: 36,
|
|
54
|
+
zIndexBase: 0,
|
|
55
|
+
zIndexPopupBase: 1000,
|
|
56
|
+
opacityImage: 1,
|
|
57
|
+
wireframe: false,
|
|
58
|
+
motion: true,
|
|
59
|
+
borderRadiusLG: 8,
|
|
60
|
+
borderRadiusSM: 4,
|
|
61
|
+
colorText: '#1f2329',
|
|
62
|
+
colorTextSecondary: '#646a73',
|
|
63
|
+
colorTextTertiary: '#8f959e',
|
|
64
|
+
colorTextQuaternary: '#bbbfc4',
|
|
65
|
+
colorFill: '#1f23291f',
|
|
66
|
+
colorFillSecondary: '#1f23290f',
|
|
67
|
+
colorFillTertiary: '#1f232908',
|
|
68
|
+
colorFillQuaternary: '#1f232905',
|
|
69
|
+
colorBgSolid: 'rgb(0,0,0)',
|
|
70
|
+
colorBgSolidHover: 'rgba(0,0,0,0.75)',
|
|
71
|
+
colorBgSolidActive: 'rgba(0,0,0,0.95)',
|
|
72
|
+
colorBgSpotlight: '#eff0f1',
|
|
73
|
+
colorBgBlur: 'transparent',
|
|
74
|
+
colorBorder: '#d0d3d6',
|
|
75
|
+
colorBorderSecondary: '#dee0e3',
|
|
76
|
+
colorSuccessBg: '#e4fae1',
|
|
77
|
+
colorSuccessBgHover: '#d0f5ce',
|
|
78
|
+
colorSuccessBorder: '#32a645',
|
|
79
|
+
colorSuccessBorderHover: '#258832',
|
|
80
|
+
colorSuccessHover: '#71c179',
|
|
81
|
+
colorSuccessActive: '#258832',
|
|
82
|
+
colorSuccessTextHover: '#35bd4b',
|
|
83
|
+
colorSuccessText: '#32a645',
|
|
84
|
+
colorSuccessTextActive: '#258832',
|
|
85
|
+
colorErrorBg: '#fef0f0',
|
|
86
|
+
colorErrorBgHover: '#fee3e2',
|
|
87
|
+
colorErrorBgFilledHover: '#ffdfdc',
|
|
88
|
+
colorErrorBgActive: '#ffccc7',
|
|
89
|
+
colorErrorBorder: '#f54a45',
|
|
90
|
+
colorErrorBorderHover: '#e22e28',
|
|
91
|
+
colorErrorHover: '#f54a45',
|
|
92
|
+
colorErrorActive: '#a53716',
|
|
93
|
+
colorErrorTextHover: '#ff7570',
|
|
94
|
+
colorErrorText: '#f54a45',
|
|
95
|
+
colorErrorTextActive: '#de332c',
|
|
96
|
+
colorWarningBg: '#fff3e5',
|
|
97
|
+
colorWarningBgHover: '#fee7cd',
|
|
98
|
+
colorWarningBorder: '#ed6d0c',
|
|
99
|
+
colorWarningBorderHover: '#c25705',
|
|
100
|
+
colorWarningHover: '#ffc368',
|
|
101
|
+
colorWarningActive: '#c25705',
|
|
102
|
+
colorWarningTextHover: '#ff9d4c',
|
|
103
|
+
colorWarningText: '#ff811a',
|
|
104
|
+
colorWarningTextActive: '#ed6d0c',
|
|
105
|
+
colorInfoBg: '#fcfbff',
|
|
106
|
+
colorInfoBgHover: '#f1f5ff',
|
|
107
|
+
colorInfoBorder: '#cedfff',
|
|
108
|
+
colorInfoBorderHover: '#e2ebff',
|
|
109
|
+
colorInfoHover: '#4c90ff',
|
|
110
|
+
colorInfoActive: '#005ae0',
|
|
111
|
+
colorInfoTextHover: '#4c90ff',
|
|
112
|
+
colorInfoText: '#0072f5',
|
|
113
|
+
colorInfoTextActive: '#005ae0',
|
|
114
|
+
colorLinkHover: '#336df4',
|
|
115
|
+
colorLinkActive: '#0442d2',
|
|
116
|
+
colorBgMask: '#1f232966',
|
|
117
|
+
colorWhite: '#fff',
|
|
118
|
+
fontSizeSM: 12,
|
|
119
|
+
fontSizeLG: 16,
|
|
120
|
+
fontSizeXL: 18,
|
|
121
|
+
fontSizeHeading1: 30,
|
|
122
|
+
fontSizeHeading2: 24,
|
|
123
|
+
fontSizeHeading3: 20,
|
|
124
|
+
fontSizeHeading4: 18,
|
|
125
|
+
fontSizeHeading5: 16,
|
|
126
|
+
lineHeight: 1.5714285714285714,
|
|
127
|
+
lineHeightLG: 1.5,
|
|
128
|
+
lineHeightSM: 1.6666666666666667,
|
|
129
|
+
fontHeight: 22,
|
|
130
|
+
fontHeightLG: 24,
|
|
131
|
+
fontHeightSM: 20,
|
|
132
|
+
lineHeightHeading1: 1.2105263157894737,
|
|
133
|
+
lineHeightHeading2: 1.2666666666666666,
|
|
134
|
+
lineHeightHeading3: 1.3333333333333333,
|
|
135
|
+
lineHeightHeading4: 1.4,
|
|
136
|
+
lineHeightHeading5: 1.5,
|
|
137
|
+
sizeXXL: 48,
|
|
138
|
+
sizeXL: 32,
|
|
139
|
+
sizeLG: 24,
|
|
140
|
+
sizeMD: 20,
|
|
141
|
+
sizeMS: 16,
|
|
142
|
+
size: 16,
|
|
143
|
+
sizeSM: 12,
|
|
144
|
+
sizeXS: 8,
|
|
145
|
+
sizeXXS: 4,
|
|
146
|
+
controlHeightSM: 27,
|
|
147
|
+
controlHeightXS: 18,
|
|
148
|
+
controlHeightLG: 45,
|
|
149
|
+
motionDurationFast: '0.1s',
|
|
150
|
+
motionDurationMid: '0.2s',
|
|
151
|
+
motionDurationSlow: '0.3s',
|
|
152
|
+
lineWidthBold: 2,
|
|
153
|
+
borderRadiusOuter: 4,
|
|
154
|
+
colorSuccessFill: 'rgba(40, 174, 1, 0.26)',
|
|
155
|
+
colorSuccessFillSecondary: 'rgba(60, 190, 10, 0.14)',
|
|
156
|
+
colorSuccessFillTertiary: 'rgba(84, 205, 12, 0.10)',
|
|
157
|
+
colorSuccessFillQuaternary: 'rgba(117, 230, 5, 0.06)',
|
|
158
|
+
colorWarningFill: 'rgba(255, 134, 5, 0.20)',
|
|
159
|
+
colorWarningFillSecondary: 'rgba(255, 117, 5, 0.16)',
|
|
160
|
+
colorWarningFillTertiary: 'rgba(255,155,55,0.08)',
|
|
161
|
+
colorWarningFillQuaternary: 'rgba(255,145,55,0.04)',
|
|
162
|
+
colorErrorFill: 'rgba(255, 42, 3, 0.20)',
|
|
163
|
+
colorErrorFillSecondary: 'rgba(255, 35, 2, 0.12)',
|
|
164
|
+
colorErrorFillTertiary: 'rgba(255, 44, 11, 0.06)',
|
|
165
|
+
colorErrorFillQuaternary: 'rgba(255, 55, 30, 0.04)',
|
|
166
|
+
colorInfoFill: 'rgba(10, 95, 255, 0.2)',
|
|
167
|
+
colorInfoFillSecondary: 'rgba(13, 88, 255, 0.12)',
|
|
168
|
+
colorInfoFillTertiary: 'rgba(22, 88, 255, 0.06)',
|
|
169
|
+
colorInfoFillQuaternary: 'rgba(105, 55, 255, 0.02)',
|
|
170
|
+
boxShadow: '\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
171
|
+
boxShadowSecondary: '\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
172
|
+
boxShadowTertiary: '\n 0 1px 2px 0 rgba(0, 0, 0, 0.03),\n 0 1px 6px -1px rgba(0, 0, 0, 0.02),\n 0 2px 4px 0 rgba(0, 0, 0, 0.02)\n ',
|
|
173
|
+
colorTextLightSolid: '#fff',
|
|
174
|
+
colorFillContent: 'rgba(0, 0, 0, 0.06)',
|
|
175
|
+
colorFillContentHover: 'rgba(0, 0, 0, 0.12)',
|
|
176
|
+
colorFillAlter: 'rgba(0, 0, 0, 0.015)',
|
|
177
|
+
colorBgContainerDisabled: 'rgba(0, 0, 0, 0.03)',
|
|
178
|
+
colorBorderBg: '#ffffff',
|
|
179
|
+
colorSplit: 'rgba(12,12,12,0.07)',
|
|
180
|
+
colorTextPlaceholder: '#bbbbbb',
|
|
181
|
+
colorTextDisabled: '#bbbbbb',
|
|
182
|
+
colorTextHeading: '#080808',
|
|
183
|
+
colorTextLabel: '#666666',
|
|
184
|
+
colorTextDescription: '#999999',
|
|
185
|
+
colorHighlight: '#ec5e41',
|
|
186
|
+
colorBgTextHover: 'rgba(0, 0, 0, 0.06)',
|
|
187
|
+
colorBgTextActive: 'rgba(0, 0, 0, 0.12)',
|
|
188
|
+
colorIcon: '#999999',
|
|
189
|
+
colorIconHover: '#080808',
|
|
190
|
+
colorErrorOutline: 'rgba(255,55,30,0.04)',
|
|
191
|
+
colorWarningOutline: 'rgba(255,55,255,0.01)',
|
|
192
|
+
fontSizeIcon: 12,
|
|
193
|
+
lineWidthFocus: 3,
|
|
194
|
+
controlOutlineWidth: 2,
|
|
195
|
+
controlInteractiveSize: 18,
|
|
196
|
+
controlItemBgHover: 'rgba(0, 0, 0, 0.03)',
|
|
197
|
+
controlItemBgActive: '#f5f5f5',
|
|
198
|
+
controlItemBgActiveHover: '#eeeeee',
|
|
199
|
+
controlItemBgActiveDisabled: 'rgba(0, 0, 0, 0.12)',
|
|
200
|
+
controlTmpOutline: 'rgba(0, 0, 0, 0.015)',
|
|
201
|
+
controlOutline: 'rgba(5,5,5,0.04)',
|
|
202
|
+
fontWeightStrong: 600,
|
|
203
|
+
opacityLoading: 0.65,
|
|
204
|
+
linkDecoration: 'none',
|
|
205
|
+
linkHoverDecoration: 'none',
|
|
206
|
+
linkFocusDecoration: 'none',
|
|
207
|
+
controlPaddingHorizontal: 12,
|
|
208
|
+
controlPaddingHorizontalSM: 8,
|
|
209
|
+
paddingXXS: 4,
|
|
210
|
+
paddingXS: 8,
|
|
211
|
+
paddingSM: 12,
|
|
212
|
+
padding: 16,
|
|
213
|
+
paddingMD: 20,
|
|
214
|
+
paddingLG: 24,
|
|
215
|
+
paddingXL: 32,
|
|
216
|
+
paddingContentHorizontalLG: 24,
|
|
217
|
+
paddingContentVerticalLG: 16,
|
|
218
|
+
paddingContentHorizontal: 16,
|
|
219
|
+
paddingContentVertical: 12,
|
|
220
|
+
paddingContentHorizontalSM: 16,
|
|
221
|
+
paddingContentVerticalSM: 8,
|
|
222
|
+
marginXXS: 4,
|
|
223
|
+
marginXS: 8,
|
|
224
|
+
marginSM: 12,
|
|
225
|
+
margin: 16,
|
|
226
|
+
marginMD: 20,
|
|
227
|
+
marginLG: 24,
|
|
228
|
+
marginXL: 32,
|
|
229
|
+
marginXXL: 48,
|
|
230
|
+
screenXS: 480,
|
|
231
|
+
screenXSMin: 480,
|
|
232
|
+
screenXSMax: 575,
|
|
233
|
+
screenSM: 576,
|
|
234
|
+
screenSMMin: 576,
|
|
235
|
+
screenSMMax: 767,
|
|
236
|
+
screenMD: 768,
|
|
237
|
+
screenMDMin: 768,
|
|
238
|
+
screenMDMax: 991,
|
|
239
|
+
screenLG: 992,
|
|
240
|
+
screenLGMin: 992,
|
|
241
|
+
screenLGMax: 1199,
|
|
242
|
+
screenXL: 1200,
|
|
243
|
+
screenXLMin: 1200,
|
|
244
|
+
screenXLMax: 1599,
|
|
245
|
+
screenXXL: 1600,
|
|
246
|
+
screenXXLMin: 1600,
|
|
247
|
+
boxShadowPopoverArrow: '2px 2px 5px rgba(0, 0, 0, 0.05)',
|
|
248
|
+
boxShadowCard: '\n 0 1px 2px -2px rgba(0,0,0,0.16),\n 0 3px 6px 0 rgba(0,0,0,0.12),\n 0 5px 12px 4px rgba(0,0,0,0.09)\n ',
|
|
249
|
+
boxShadowDrawerRight: '\n -6px 0 16px 0 rgba(0, 0, 0, 0.08),\n -3px 0 6px -4px rgba(0, 0, 0, 0.12),\n -9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
250
|
+
boxShadowDrawerLeft: '\n 6px 0 16px 0 rgba(0, 0, 0, 0.08),\n 3px 0 6px -4px rgba(0, 0, 0, 0.12),\n 9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
251
|
+
boxShadowDrawerUp: '\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
252
|
+
boxShadowDrawerDown: '\n 0 -6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 -3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 -9px 28px 8px rgba(0, 0, 0, 0.05)\n ',
|
|
253
|
+
boxShadowTabsOverflowLeft: 'inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)',
|
|
254
|
+
boxShadowTabsOverflowRight: 'inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)',
|
|
255
|
+
boxShadowTabsOverflowTop: 'inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)',
|
|
256
|
+
boxShadowTabsOverflowBottom: 'inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)',
|
|
257
|
+
Button: {
|
|
258
|
+
contentFontSizeSM: 12
|
|
259
|
+
},
|
|
260
|
+
DatePicker: {},
|
|
261
|
+
Input: {},
|
|
262
|
+
InputNumber: {},
|
|
263
|
+
Mentions: {},
|
|
264
|
+
Select: {},
|
|
265
|
+
themeMode: 'light',
|
|
266
|
+
appearance: 'light',
|
|
267
|
+
isDarkMode: false,
|
|
268
|
+
browserPrefers: 'light',
|
|
269
|
+
prefixCls: 'antd',
|
|
270
|
+
iconPrefixCls: 'anticon',
|
|
271
|
+
colorPrimaryBgHover: '#e0e9ff',
|
|
272
|
+
colorWarning: '#ed6d0c',
|
|
273
|
+
colorBgLayout: '#f5f6f7'
|
|
274
|
+
};
|
|
275
|
+
const defaultLightTheme = {
|
|
276
|
+
cssVar: true,
|
|
277
|
+
token: {
|
|
278
|
+
...lightToken,
|
|
279
|
+
...defaultPrimaryPresets
|
|
280
|
+
},
|
|
281
|
+
components: {
|
|
282
|
+
Tag: {
|
|
283
|
+
lineType: 'none',
|
|
284
|
+
algorithm: true
|
|
285
|
+
},
|
|
286
|
+
Tooltip: {
|
|
287
|
+
colorBgSpotlight: 'rgb(31,35,41)'
|
|
288
|
+
},
|
|
289
|
+
Button: {
|
|
290
|
+
dangerShadow: '0',
|
|
291
|
+
defaultShadow: '0',
|
|
292
|
+
primaryShadow: '0'
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
export { defaultLightTheme };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UIComponentConfig } from
|
|
3
|
-
export
|
|
4
|
-
defaultTheme?: ITheme;
|
|
5
|
-
themeMeta?: Partial<IThemeTokenMeta>;
|
|
6
|
-
}
|
|
1
|
+
import { type ThemeConfig } from 'antd';
|
|
2
|
+
import { UIComponentConfig } from './ui-config';
|
|
3
|
+
export type IThemeMode = 'dark' | 'light' | 'system';
|
|
7
4
|
export interface IThemeTokenMeta {
|
|
8
5
|
/**
|
|
9
6
|
* 品牌色
|
|
@@ -19,3 +16,5 @@ export interface IThemeTokenMeta {
|
|
|
19
16
|
spacing: number;
|
|
20
17
|
}
|
|
21
18
|
export declare const generateTailwindRadiusToken: (radiusRemValue: number) => UIComponentConfig;
|
|
19
|
+
export declare function generateLightTheme(override?: Partial<IThemeTokenMeta>): ThemeConfig;
|
|
20
|
+
export declare function generateDarkTheme(override?: Partial<IThemeTokenMeta>): ThemeConfig;
|
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
import { generate } from "@ant-design/colors";
|
|
2
|
+
import { defaultDarkTheme } from "./miaoDarkTheme.js";
|
|
3
|
+
import { defaultLightTheme } from "./miaoLightTheme.js";
|
|
4
|
+
const generateColorPalettes = (baseColor, mode)=>{
|
|
5
|
+
const colors = generate(baseColor, {
|
|
6
|
+
theme: mode
|
|
7
|
+
});
|
|
8
|
+
return {
|
|
9
|
+
1: colors[0],
|
|
10
|
+
2: colors[1],
|
|
11
|
+
3: colors[2],
|
|
12
|
+
4: colors[3],
|
|
13
|
+
5: colors[6],
|
|
14
|
+
6: colors[5],
|
|
15
|
+
7: colors[4],
|
|
16
|
+
8: colors[6],
|
|
17
|
+
9: colors[5],
|
|
18
|
+
10: colors[4]
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
function generateColorPrimaryToken(colorPrimary, mode = 'light') {
|
|
22
|
+
const primaryColors = generateColorPalettes(colorPrimary, 'dark' === mode ? 'dark' : 'default');
|
|
23
|
+
return {
|
|
24
|
+
colorPrimaryBg: primaryColors[1],
|
|
25
|
+
colorPrimaryBgHover: primaryColors[2],
|
|
26
|
+
colorPrimaryBorder: primaryColors[3],
|
|
27
|
+
colorPrimaryBorderHover: primaryColors[4],
|
|
28
|
+
colorPrimaryHover: primaryColors[5],
|
|
29
|
+
colorPrimary: primaryColors[6],
|
|
30
|
+
colorPrimaryActive: primaryColors[7],
|
|
31
|
+
colorPrimaryTextHover: primaryColors[8],
|
|
32
|
+
colorPrimaryText: primaryColors[9],
|
|
33
|
+
colorPrimaryTextActive: primaryColors[10]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const generateBorderRadiusTokenSyncTailwind = (radiusBase)=>({
|
|
37
|
+
borderRadius: radiusBase,
|
|
38
|
+
borderRadiusXS: radiusBase - 4,
|
|
39
|
+
borderRadiusSM: radiusBase - 2,
|
|
40
|
+
borderRadiusLG: radiusBase + 2,
|
|
41
|
+
borderRadiusOuter: radiusBase + 4
|
|
42
|
+
});
|
|
43
|
+
const generateSpacingToken = (token)=>{
|
|
44
|
+
const { sizeUnit, sizeStep } = token;
|
|
45
|
+
return {
|
|
46
|
+
sizeXXL: sizeUnit * (sizeStep + 8),
|
|
47
|
+
sizeXL: sizeUnit * (sizeStep + 4),
|
|
48
|
+
sizeLG: sizeUnit * (sizeStep + 2),
|
|
49
|
+
sizeMD: sizeUnit * (sizeStep + 1),
|
|
50
|
+
sizeMS: sizeUnit * sizeStep,
|
|
51
|
+
size: sizeUnit * sizeStep,
|
|
52
|
+
sizeSM: sizeUnit * (sizeStep - 1),
|
|
53
|
+
sizeXS: sizeUnit * (sizeStep - 2),
|
|
54
|
+
sizeXXS: sizeUnit * (sizeStep - 3)
|
|
55
|
+
};
|
|
56
|
+
};
|
|
1
57
|
const generateTailwindRadiusToken = (radiusRemValue)=>{
|
|
2
58
|
try {
|
|
3
59
|
const rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
@@ -105,4 +161,28 @@ const generateTailwindRadiusToken = (radiusRemValue)=>{
|
|
|
105
161
|
};
|
|
106
162
|
}
|
|
107
163
|
};
|
|
108
|
-
|
|
164
|
+
const lightColorPrimary = '#1456f0';
|
|
165
|
+
const darkColorPrimary = '#336df4';
|
|
166
|
+
function generateLightTheme(override) {
|
|
167
|
+
return {
|
|
168
|
+
...defaultLightTheme,
|
|
169
|
+
token: {
|
|
170
|
+
...defaultLightTheme.token,
|
|
171
|
+
...generateColorPrimaryToken(override?.colorPrimary || lightColorPrimary, 'light'),
|
|
172
|
+
...generateBorderRadiusTokenSyncTailwind(override?.borderRadius),
|
|
173
|
+
...generateSpacingToken(override)
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function generateDarkTheme(override) {
|
|
178
|
+
return {
|
|
179
|
+
...defaultDarkTheme,
|
|
180
|
+
token: {
|
|
181
|
+
...defaultDarkTheme.token,
|
|
182
|
+
...generateColorPrimaryToken(override?.colorPrimary || darkColorPrimary, 'dark'),
|
|
183
|
+
...generateBorderRadiusTokenSyncTailwind(override?.borderRadius),
|
|
184
|
+
...generateSpacingToken(override)
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
export { generateDarkTheme, generateLightTheme, generateTailwindRadiusToken };
|
package/lib/hooks/index.d.ts
CHANGED
package/lib/hooks/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ThemeProviderContext } from "../components/theme/index.js";
|
|
3
|
+
const useTheme = ()=>{
|
|
4
|
+
const context = useContext(ThemeProviderContext);
|
|
5
|
+
if (void 0 === context) throw new Error('useTheme 必须在 ThemeProvider 内使用');
|
|
6
|
+
return context;
|
|
7
|
+
};
|
|
8
|
+
export { useTheme };
|
|
@@ -8,7 +8,7 @@ const createDataLoomClient = (url, pat)=>{
|
|
|
8
8
|
const appId = getAppId(window.location.pathname);
|
|
9
9
|
return createClient(baseUrl, pat, workspace, {
|
|
10
10
|
global: {
|
|
11
|
-
|
|
11
|
+
enableDataloomLog: 'production' !== process.env.NODE_ENV,
|
|
12
12
|
requestRateLimit: 'production' !== process.env.NODE_ENV ? 100 : void 0,
|
|
13
13
|
brandName: 'miaoda',
|
|
14
14
|
appId,
|
|
@@ -44,7 +44,6 @@ export declare const logMeta: z.ZodObject<{
|
|
|
44
44
|
skipFrame: z.ZodOptional<z.ZodNumber>;
|
|
45
45
|
noStacktrace: z.ZodOptional<z.ZodBoolean>;
|
|
46
46
|
repairMessage: z.ZodOptional<z.ZodString>;
|
|
47
|
-
type: z.ZodOptional<z.ZodString>;
|
|
48
47
|
}, z.core.$strip>;
|
|
49
48
|
export declare const selectedLogSchema: z.ZodObject<{
|
|
50
49
|
type: z.ZodLiteral<"typedLogV2">;
|
|
@@ -68,7 +67,6 @@ export declare const selectedLogSchema: z.ZodObject<{
|
|
|
68
67
|
skipFrame: z.ZodOptional<z.ZodNumber>;
|
|
69
68
|
noStacktrace: z.ZodOptional<z.ZodBoolean>;
|
|
70
69
|
repairMessage: z.ZodOptional<z.ZodString>;
|
|
71
|
-
type: z.ZodOptional<z.ZodString>;
|
|
72
70
|
}, z.core.$strip>;
|
|
73
71
|
}, z.core.$strip>;
|
|
74
72
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'success';
|
|
@@ -92,7 +90,6 @@ export declare const logWithMetaSchema: z.ZodObject<{
|
|
|
92
90
|
skipFrame: z.ZodOptional<z.ZodNumber>;
|
|
93
91
|
noStacktrace: z.ZodOptional<z.ZodBoolean>;
|
|
94
92
|
repairMessage: z.ZodOptional<z.ZodString>;
|
|
95
|
-
type: z.ZodOptional<z.ZodString>;
|
|
96
93
|
}, z.core.$strip>>;
|
|
97
94
|
}, z.core.$strip>;
|
|
98
95
|
export type LogStackFrame = z.infer<typeof logStackFrameSchema>;
|
package/lib/logger/log-types.js
CHANGED
|
@@ -38,8 +38,7 @@ const logMeta = zod.object({
|
|
|
38
38
|
logTraceID: zod.optional(zod.string()),
|
|
39
39
|
skipFrame: zod.optional(zod.number()),
|
|
40
40
|
noStacktrace: zod.optional(zod.boolean()),
|
|
41
|
-
repairMessage: zod.optional(zod.string())
|
|
42
|
-
type: zod.optional(zod.string())
|
|
41
|
+
repairMessage: zod.optional(zod.string())
|
|
43
42
|
});
|
|
44
43
|
const selectedLogSchema = zod.object({
|
|
45
44
|
type: zod.literal('typedLogV2'),
|
package/lib/logger/logger.js
CHANGED
|
@@ -59,11 +59,6 @@ let logger = {
|
|
|
59
59
|
if (shouldLog(level)) console.log(...getFormattedPrefix(level), ...args);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
if ('production' !== process.env.NODE_ENV) window.__RUNTIME_LOGGER__ = {
|
|
63
|
-
get () {
|
|
64
|
-
return logger;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
62
|
for (const interceptor of interceptors)logger = interceptor(logger);
|
|
68
63
|
'production' !== process.env.NODE_ENV && interceptErrors();
|
|
69
64
|
export { logger };
|
|
@@ -43,7 +43,6 @@ async function sendSelectedLog(logWithoutID) {
|
|
|
43
43
|
} catch (e) {}
|
|
44
44
|
newParts.push(newError.message, newError);
|
|
45
45
|
} else newParts.push(log.args[i]);
|
|
46
|
-
log.args = newParts;
|
|
47
46
|
if (!log.meta.stacktrace) try {
|
|
48
47
|
let frames = await getStacktrace();
|
|
49
48
|
const firstFrameIndex = frames.findIndex((frame)=>!frame.fileName.includes('node_modules/@lark-apaas/client-toolkit/lib/logger'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.1.9-
|
|
3
|
+
"version": "1.1.9-dataloom-test.1",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -73,7 +73,9 @@
|
|
|
73
73
|
"prepublishOnly": "npm run build && node scripts/replace-workspace-alias.js"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@
|
|
76
|
+
"@ant-design/colors": "^7.2.1",
|
|
77
|
+
"@ant-design/cssinjs": "^1.24.0",
|
|
78
|
+
"@data-loom/js": "0.4.0",
|
|
77
79
|
"@lark-apaas/miaoda-inspector": "^1.0.2",
|
|
78
80
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
79
81
|
"@radix-ui/react-popover": "^1.1.15",
|
|
@@ -118,6 +120,7 @@
|
|
|
118
120
|
"@types/react": "^18.3.23",
|
|
119
121
|
"@types/react-dom": "^18.3.7",
|
|
120
122
|
"@types/sockjs-client": "^1",
|
|
123
|
+
"antd": "^5.26.6",
|
|
121
124
|
"eslint": "^8.57.0",
|
|
122
125
|
"jsdom": "^26.1.0",
|
|
123
126
|
"lucide-react": "npm:@lark-apaas/lucide-react@1.0.2",
|
|
@@ -134,6 +137,7 @@
|
|
|
134
137
|
"vitest": "^3.2.4"
|
|
135
138
|
},
|
|
136
139
|
"peerDependencies": {
|
|
140
|
+
"antd": ">=5.26.6",
|
|
137
141
|
"react": ">=16.14.0",
|
|
138
142
|
"react-dom": ">=16.14.0",
|
|
139
143
|
"react-router-dom": ">=6.26.2"
|