mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
fix(theme): DerivativeToken
to AliasToken
This commit is contained in:
parent
5019af42b5
commit
b3ddb0e498
@ -2,7 +2,7 @@
|
|||||||
import { unit } from '@ant-design/cssinjs';
|
import { unit } from '@ant-design/cssinjs';
|
||||||
import type { CSSObject } 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';
|
export { operationUnit } from './operationUnit';
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ export const textEllipsis: CSSObject = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const resetComponent = (
|
export const resetComponent = (
|
||||||
token: DerivativeToken,
|
token: AliasToken,
|
||||||
needInheritFontFamily = false,
|
needInheritFontFamily = false,
|
||||||
): CSSObject => ({
|
): CSSObject => ({
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
@ -66,7 +66,7 @@ export const clearFix = (): CSSObject => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const genLinkStyle = (token: DerivativeToken): CSSObject => ({
|
export const genLinkStyle = (token: AliasToken): CSSObject => ({
|
||||||
a: {
|
a: {
|
||||||
color: token.colorLink,
|
color: token.colorLink,
|
||||||
textDecoration: token.linkDecoration,
|
textDecoration: token.linkDecoration,
|
||||||
@ -103,7 +103,7 @@ export const genLinkStyle = (token: DerivativeToken): CSSObject => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const genCommonStyle = (
|
export const genCommonStyle = (
|
||||||
token: DerivativeToken,
|
token: AliasToken,
|
||||||
componentPrefixCls: string,
|
componentPrefixCls: string,
|
||||||
rootCls?: string,
|
rootCls?: string,
|
||||||
resetFont?: boolean,
|
resetFont?: boolean,
|
||||||
@ -144,7 +144,7 @@ export const genFocusOutline = (token: AliasToken): CSSObject => ({
|
|||||||
transition: 'outline-offset 0s, outline 0s',
|
transition: 'outline-offset 0s, outline 0s',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const genFocusStyle = (token: DerivativeToken): CSSObject => ({
|
export const genFocusStyle = (token: AliasToken): CSSObject => ({
|
||||||
'&:focus-visible': {
|
'&:focus-visible': {
|
||||||
...genFocusOutline(token),
|
...genFocusOutline(token),
|
||||||
},
|
},
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
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
|
// 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.
|
// 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.
|
// And Typography use this to generate link style which should not do this.
|
||||||
color: token.colorLink,
|
color: token.colorLink,
|
||||||
|
@ -51,8 +51,6 @@ export {
|
|||||||
};
|
};
|
||||||
export type {
|
export type {
|
||||||
AliasToken,
|
AliasToken,
|
||||||
// FIXME: Remove this type
|
|
||||||
AliasToken as DerivativeToken,
|
|
||||||
FullToken,
|
FullToken,
|
||||||
OverrideComponent,
|
OverrideComponent,
|
||||||
GenerateStyle,
|
GenerateStyle,
|
||||||
|
@ -5,7 +5,7 @@ import { useCacheToken } from '@ant-design/cssinjs';
|
|||||||
import version from '../version';
|
import version from '../version';
|
||||||
import type { DesignTokenProviderProps } from './context';
|
import type { DesignTokenProviderProps } from './context';
|
||||||
import { defaultTheme, DesignTokenContext } 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 defaultSeedToken from './themes/seed';
|
||||||
import formatToken from './util/alias';
|
import formatToken from './util/alias';
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ export const getComputedToken = (
|
|||||||
|
|
||||||
// ================================== Hook ==================================
|
// ================================== Hook ==================================
|
||||||
export default function useToken(): [
|
export default function useToken(): [
|
||||||
theme: Theme<SeedToken, MapToken>,
|
theme: Theme<SeedToken, AliasToken>,
|
||||||
token: GlobalToken,
|
token: GlobalToken,
|
||||||
hashId: string,
|
hashId: string,
|
||||||
realToken: GlobalToken,
|
realToken: GlobalToken,
|
||||||
|
@ -6,7 +6,6 @@ import { genFocusOutline, resetComponent } from '../../style';
|
|||||||
import { genCollapseMotion } from '../../style/motion';
|
import { genCollapseMotion } from '../../style/motion';
|
||||||
import type {
|
import type {
|
||||||
AliasToken,
|
AliasToken,
|
||||||
DerivativeToken,
|
|
||||||
FullToken,
|
FullToken,
|
||||||
GetDefaultToken,
|
GetDefaultToken,
|
||||||
CSSUtil,
|
CSSUtil,
|
||||||
@ -55,7 +54,7 @@ const treeNodeFX = new Keyframes('ant-tree-node-fx-do-not-use', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Switch ==============================
|
// ============================== Switch ==============================
|
||||||
const getSwitchStyle = (prefixCls: string, token: DerivativeToken): CSSObject => ({
|
const getSwitchStyle = (prefixCls: string, token: AliasToken): CSSObject => ({
|
||||||
[`.${prefixCls}-switcher-icon`]: {
|
[`.${prefixCls}-switcher-icon`]: {
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
@ -68,7 +67,7 @@ const getSwitchStyle = (prefixCls: string, token: DerivativeToken): CSSObject =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
// =============================== Drop ===============================
|
// =============================== Drop ===============================
|
||||||
const getDropIndicatorStyle = (prefixCls: string, token: DerivativeToken) => ({
|
const getDropIndicatorStyle = (prefixCls: string, token: AliasToken) => ({
|
||||||
[`.${prefixCls}-drop-indicator`]: {
|
[`.${prefixCls}-drop-indicator`]: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
// it should displayed over the following node
|
// it should displayed over the following node
|
||||||
|
Loading…
Reference in New Issue
Block a user