fix(theme): DerivativeToken to AliasToken

This commit is contained in:
🏎️ Yumo 2024-07-23 17:54:26 +08:00
parent 5019af42b5
commit b3ddb0e498
5 changed files with 11 additions and 14 deletions

View File

@ -2,7 +2,7 @@
import { unit } from '@ant-design/cssinjs';
import type { CSSObject } from '@ant-design/cssinjs';
import type { AliasToken, DerivativeToken } from '../theme/internal';
import type { AliasToken } from '../theme/internal';
export { operationUnit } from './operationUnit';
@ -13,7 +13,7 @@ export const textEllipsis: CSSObject = {
};
export const resetComponent = (
token: DerivativeToken,
token: AliasToken,
needInheritFontFamily = false,
): CSSObject => ({
boxSizing: 'border-box',
@ -66,7 +66,7 @@ export const clearFix = (): CSSObject => ({
},
});
export const genLinkStyle = (token: DerivativeToken): CSSObject => ({
export const genLinkStyle = (token: AliasToken): CSSObject => ({
a: {
color: token.colorLink,
textDecoration: token.linkDecoration,
@ -103,7 +103,7 @@ export const genLinkStyle = (token: DerivativeToken): CSSObject => ({
});
export const genCommonStyle = (
token: DerivativeToken,
token: AliasToken,
componentPrefixCls: string,
rootCls?: string,
resetFont?: boolean,
@ -144,7 +144,7 @@ export const genFocusOutline = (token: AliasToken): CSSObject => ({
transition: 'outline-offset 0s, outline 0s',
});
export const genFocusStyle = (token: DerivativeToken): CSSObject => ({
export const genFocusStyle = (token: AliasToken): CSSObject => ({
'&:focus-visible': {
...genFocusOutline(token),
},

View File

@ -1,9 +1,9 @@
import type { CSSObject } from '@ant-design/cssinjs';
import type { DerivativeToken } from '../theme/internal';
import type { AliasToken } from '../theme/internal';
// eslint-disable-next-line import/prefer-default-export
export const operationUnit = (token: DerivativeToken): CSSObject => ({
export const operationUnit = (token: AliasToken): CSSObject => ({
// FIXME: This use link but is a operation unit. Seems should be a colorPrimary.
// And Typography use this to generate link style which should not do this.
color: token.colorLink,

View File

@ -51,8 +51,6 @@ export {
};
export type {
AliasToken,
// FIXME: Remove this type
AliasToken as DerivativeToken,
FullToken,
OverrideComponent,
GenerateStyle,

View File

@ -5,7 +5,7 @@ import { useCacheToken } from '@ant-design/cssinjs';
import version from '../version';
import type { DesignTokenProviderProps } from './context';
import { defaultTheme, DesignTokenContext } from './context';
import type { AliasToken, GlobalToken, MapToken, SeedToken } from './interface';
import type { AliasToken, GlobalToken, SeedToken } from './interface';
import defaultSeedToken from './themes/seed';
import formatToken from './util/alias';
@ -111,7 +111,7 @@ export const getComputedToken = (
// ================================== Hook ==================================
export default function useToken(): [
theme: Theme<SeedToken, MapToken>,
theme: Theme<SeedToken, AliasToken>,
token: GlobalToken,
hashId: string,
realToken: GlobalToken,

View File

@ -6,7 +6,6 @@ import { genFocusOutline, resetComponent } from '../../style';
import { genCollapseMotion } from '../../style/motion';
import type {
AliasToken,
DerivativeToken,
FullToken,
GetDefaultToken,
CSSUtil,
@ -55,7 +54,7 @@ const treeNodeFX = new Keyframes('ant-tree-node-fx-do-not-use', {
});
// ============================== Switch ==============================
const getSwitchStyle = (prefixCls: string, token: DerivativeToken): CSSObject => ({
const getSwitchStyle = (prefixCls: string, token: AliasToken): CSSObject => ({
[`.${prefixCls}-switcher-icon`]: {
display: 'inline-block',
fontSize: 10,
@ -68,7 +67,7 @@ const getSwitchStyle = (prefixCls: string, token: DerivativeToken): CSSObject =>
});
// =============================== Drop ===============================
const getDropIndicatorStyle = (prefixCls: string, token: DerivativeToken) => ({
const getDropIndicatorStyle = (prefixCls: string, token: AliasToken) => ({
[`.${prefixCls}-drop-indicator`]: {
position: 'absolute',
// it should displayed over the following node