2022-06-28 15:38:30 +08:00
|
|
|
/* eslint-disable import/prefer-default-export */
|
2023-06-05 17:45:33 +08:00
|
|
|
import getDesignToken from './getDesignToken';
|
2023-08-02 10:54:27 +08:00
|
|
|
import type { GlobalToken, MappingAlgorithm } from './interface';
|
2023-06-05 17:45:33 +08:00
|
|
|
import { defaultConfig, useToken as useInternalToken } from './internal';
|
2022-10-25 17:04:36 +08:00
|
|
|
import compactAlgorithm from './themes/compact';
|
2023-06-05 17:45:33 +08:00
|
|
|
import darkAlgorithm from './themes/dark';
|
|
|
|
import defaultAlgorithm from './themes/default';
|
2022-06-28 15:38:30 +08:00
|
|
|
|
|
|
|
// 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.
|
2022-11-23 20:22:38 +08:00
|
|
|
/** Get current context Design Token. Will be different if you are using nest theme config. */
|
2022-06-29 20:34:00 +08:00
|
|
|
function useToken() {
|
|
|
|
const [theme, token, hashId] = useInternalToken();
|
2022-06-28 15:38:30 +08:00
|
|
|
|
|
|
|
return { theme, token, hashId };
|
|
|
|
}
|
2022-06-29 20:34:00 +08:00
|
|
|
|
2023-08-02 10:54:27 +08:00
|
|
|
export type { GlobalToken, MappingAlgorithm };
|
2023-01-24 17:42:42 +08:00
|
|
|
|
2022-06-29 20:34:00 +08:00
|
|
|
export default {
|
2022-08-19 17:45:03 +08:00
|
|
|
/** @private Test Usage. Do not use in production. */
|
|
|
|
defaultConfig,
|
|
|
|
|
2022-11-10 21:27:37 +08:00
|
|
|
/** Default seedToken */
|
|
|
|
defaultSeed: defaultConfig.token,
|
|
|
|
|
2022-06-29 20:34:00 +08:00
|
|
|
useToken,
|
|
|
|
defaultAlgorithm,
|
|
|
|
darkAlgorithm,
|
2022-10-25 17:04:36 +08:00
|
|
|
compactAlgorithm,
|
2023-06-05 17:45:33 +08:00
|
|
|
getDesignToken,
|
2022-06-29 20:34:00 +08:00
|
|
|
};
|