|
|
|
@ -55,11 +55,6 @@ export const DesignTokenContext = React.createContext<{
|
|
|
|
|
}>(defaultConfig);
|
|
|
|
|
|
|
|
|
|
// ================================== Hook ==================================
|
|
|
|
|
// In dev env, we refresh salt per hour to avoid user use this
|
|
|
|
|
// Note: Do not modify this to real time update which will make debug harder
|
|
|
|
|
const saltPrefix =
|
|
|
|
|
process.env.NODE_ENV === 'production' ? version : `${version}-${new Date().getHours()}`;
|
|
|
|
|
|
|
|
|
|
export function useToken(): [Theme<SeedToken, MapToken>, GlobalToken, string] {
|
|
|
|
|
const {
|
|
|
|
|
token: rootDesignToken,
|
|
|
|
@ -68,7 +63,7 @@ export function useToken(): [Theme<SeedToken, MapToken>, GlobalToken, string] {
|
|
|
|
|
components,
|
|
|
|
|
} = React.useContext(DesignTokenContext);
|
|
|
|
|
|
|
|
|
|
const salt = `${saltPrefix}-${hashed || ''}`;
|
|
|
|
|
const salt = `${version}-${hashed || ''}`;
|
|
|
|
|
|
|
|
|
|
const mergedTheme = theme || defaultTheme;
|
|
|
|
|
|
|
|
|
|