refactor(theme): migrate and refactor type GenStyleFn by @ant-design/cssinjs-utils

This commit is contained in:
🏎️ Yumo 2024-07-23 17:15:39 +08:00
parent a3cba98064
commit 3ec77d32b0
10 changed files with 49 additions and 14 deletions

View File

@ -1,9 +1,13 @@
import { Keyframes, unit } from '@ant-design/cssinjs';
import { resetComponent } from '../../style';
import type { FullToken, GenerateStyle } from '../../theme/internal';
import type {
FullToken,
GenerateStyle,
GenStyleFn,
GetDefaultToken,
} from '../../theme/internal';
import { genPresetColor, genStyleHooks, mergeToken } from '../../theme/internal';
import type { GenStyleFn, GetDefaultToken } from '../../theme/util/genComponentStyleHook';
/** Component only token. Which will handle additional calculation of alias token */
export interface ComponentToken {

View File

@ -1,8 +1,11 @@
import type { CSSProperties } from 'react';
import type { FullToken, GetDefaultToken } from '../../theme/internal';
import type {
FullToken,
GetDefaultToken,
GenStyleFn,
} from '../../theme/internal';
import { getLineHeight, mergeToken } from '../../theme/internal';
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
/** Component only token. Which will handle additional calculation of alias token */
export interface ComponentToken {

View File

@ -4,9 +4,14 @@ import { unit } from '@ant-design/cssinjs';
import { resetComponent } from '../../style';
import { genCollapseMotion, zoomIn } from '../../style/motion';
import type { AliasToken, FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
import type {
AliasToken,
FullToken,
GenerateStyle,
GetDefaultToken,
GenStyleFn,
} from '../../theme/internal';
import { genStyleHooks, mergeToken } from '../../theme/internal';
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
import genFormValidateMotionStyle from './explain';
export interface ComponentToken {

View File

@ -3,9 +3,15 @@ import { unit } from '@ant-design/cssinjs';
import { genFocusStyle, resetComponent } from '../../style';
import { initFadeMotion, initZoomMotion } from '../../style/motion';
import type { AliasToken, FullToken, GenerateStyle, GlobalToken } from '../../theme/internal';
import type {
AliasToken,
FullToken,
GenerateStyle,
GlobalToken,
GenStyleFn,
} from '../../theme/internal';
import { genStyleHooks, mergeToken } from '../../theme/internal';
import type { GenStyleFn, TokenWithCommonCls } from '../../theme/util/genComponentStyleHook';
import type { TokenWithCommonCls } from '../../theme/util/genComponentStyleHook';
/** Component only token. Which will handle additional calculation of alias token */
export interface ComponentToken {

View File

@ -3,9 +3,13 @@ import { Keyframes, unit } from '@ant-design/cssinjs';
import { CONTAINER_MAX_OFFSET } from '../../_util/hooks/useZIndex';
import { genFocusStyle, resetComponent } from '../../style';
import type { AliasToken, FullToken, GenerateStyle } from '../../theme/internal';
import type {
AliasToken,
FullToken,
GenerateStyle,
GenStyleFn,
} from '../../theme/internal';
import { genStyleHooks, mergeToken } from '../../theme/internal';
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
import genNotificationPlacementStyle from './placement';
import genStackStyle from './stack';

View File

@ -1,6 +1,5 @@
import { unit } from '@ant-design/cssinjs';
import type { CSSObject } from '@ant-design/cssinjs';
import type { GenStyleFn } from 'antd/es/theme/util/genComponentStyleHook';
import {
genBasicInputStyle,
@ -11,7 +10,12 @@ import {
import type { SharedComponentToken, SharedInputToken } from '../../input/style/token';
import { genBaseOutlinedStyle, genDisabledStyle } from '../../input/style/variants';
import { genFocusOutline, genFocusStyle, resetComponent } from '../../style';
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
import type {
FullToken,
GenerateStyle,
GetDefaultToken,
GenStyleFn,
} from '../../theme/internal';
import { genStyleHooks, mergeToken } from '../../theme/internal';
export interface ComponentToken {

View File

@ -4,9 +4,12 @@ import type { CSSInterpolation } from '@ant-design/cssinjs';
import { TinyColor } from '@ctrl/tinycolor';
import { resetComponent } from '../../style';
import type { FullToken, GetDefaultToken } from '../../theme/internal';
import type {
FullToken,
GetDefaultToken,
GenStyleFn,
} from '../../theme/internal';
import { genStyleHooks, mergeToken } from '../../theme/internal';
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
export interface ComponentToken {
/**

View File

@ -3,6 +3,7 @@ import type {
OverrideTokenMap as OverrideTokenTypeUtil,
FullToken as FullTokenTypeUtil,
GetDefaultToken as GetDefaultTokenTypeUtil,
GenStyleFn as GenStyleFnTypeUtil,
TokenMapKey,
} from '@ant-design/cssinjs-utils';
@ -20,3 +21,5 @@ export type OverrideComponent = TokenMapKey<ComponentTokenMap>;
export type FullToken<C extends TokenMapKey<ComponentTokenMap>> = FullTokenTypeUtil<ComponentTokenMap, AliasToken, C>;
export type GetDefaultToken<C extends TokenMapKey<ComponentTokenMap>> = GetDefaultTokenTypeUtil<ComponentTokenMap, AliasToken, C>;
export type GenStyleFn<C extends TokenMapKey<ComponentTokenMap>> = GenStyleFnTypeUtil<ComponentTokenMap, AliasToken, C>;

View File

@ -13,6 +13,7 @@ export type {
FullToken,
OverrideComponent,
GetDefaultToken,
GenStyleFn,
} from './cssinjs-utils';
export type { AliasToken } from './alias';

View File

@ -11,6 +11,7 @@ import type {
FullToken,
GetDefaultToken,
OverrideComponent,
GenStyleFn,
} from './interface';
import { PresetColors } from './interface';
import { getLineHeight } from './themes/shared/genFontSizes';
@ -52,4 +53,5 @@ export type {
UseComponentStyleResult,
GetDefaultToken,
GlobalToken,
GenStyleFn,
};