mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 07:09:55 +08:00
5d9cb2e50d
* refactor: Optimize theme export and add docs * chore: fix lint * chore: fix lint * chore: fix lint
29 lines
954 B
TypeScript
29 lines
954 B
TypeScript
/* eslint-disable import/prefer-default-export */
|
|
import { defaultConfig, useToken as useInternalToken } from './internal';
|
|
import defaultAlgorithm from './themes/default';
|
|
import darkAlgorithm from './themes/dark';
|
|
import compactAlgorithm from './themes/compact';
|
|
|
|
// ZombieJ: We export as object to user but array in internal.
|
|
// This is used to minimize the bundle size for antd package but safe to refactor as object also.
|
|
// Please do not export internal `useToken` directly to avoid something export unexpected.
|
|
/** Get current context Design Token. Will be different if you are using nest theme config. */
|
|
function useToken() {
|
|
const [theme, token, hashId] = useInternalToken();
|
|
|
|
return { theme, token, hashId };
|
|
}
|
|
|
|
export default {
|
|
/** @private Test Usage. Do not use in production. */
|
|
defaultConfig,
|
|
|
|
/** Default seedToken */
|
|
defaultSeed: defaultConfig.token,
|
|
|
|
useToken,
|
|
defaultAlgorithm,
|
|
darkAlgorithm,
|
|
compactAlgorithm,
|
|
};
|