Skip to content

Commit 72e9741

Browse files
committed
feat: remove const unitless ignore
1 parent ac85e1f commit 72e9741

File tree

3 files changed

+6
-40
lines changed

3 files changed

+6
-40
lines changed

src/context/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { useMergedConfigContext } from './config-provider';
2-
export { useMergedThemeContext, ignore, unitless } from './theme-provider';
2+
export { useMergedThemeContext } from './theme-provider';
33

44
export type { GetConfigProviderContext } from './config-provider';
55
export type { GetThemeProviderContext, DesignTokenProviderProps } from './theme-provider';

src/context/theme-provider.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,6 @@ import defaultSeedToken from '../themes/seed';
55

66
import type { AliasToken, OverrideToken, MapToken, SeedToken, GlobalToken } from '../interface';
77

8-
export const unitless: {
9-
[key in keyof AliasToken]?: boolean;
10-
} = {
11-
lineHeight: true,
12-
lineHeightSM: true,
13-
lineHeightLG: true,
14-
lineHeightHeading1: true,
15-
lineHeightHeading2: true,
16-
lineHeightHeading3: true,
17-
lineHeightHeading4: true,
18-
lineHeightHeading5: true,
19-
opacityLoading: true,
20-
fontWeightStrong: true,
21-
zIndexPopupBase: true,
22-
zIndexBase: true,
23-
};
24-
25-
export const ignore: {
26-
[key in keyof AliasToken]?: boolean;
27-
} = {
28-
size: true,
29-
sizeSM: true,
30-
sizeLG: true,
31-
sizeMD: true,
32-
sizeXS: true,
33-
sizeXXS: true,
34-
sizeMS: true,
35-
sizeXL: true,
36-
sizeXXL: true,
37-
sizeUnit: true,
38-
sizeStep: true,
39-
motionBase: true,
40-
motionUnit: true,
41-
};
42-
438
type ComponentsToken<CompTokenMap extends Object> = {
449
[key in keyof OverrideToken<CompTokenMap>]?: OverrideToken<CompTokenMap>[key] & {
4510
theme?: Theme<SeedToken, MapToken>;

src/util/genStyleUtils.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { token2CSSVar, useCSSVarRegister, useStyleRegister } from '@ant-design/c
55
import type { CSSInterpolation, Theme } from '@ant-design/cssinjs';
66

77
import {
8-
unitless,
9-
ignore,
108
useMergedConfigContext,
119
useMergedThemeContext,
1210
} from '../context';
@@ -166,7 +164,7 @@ export default function genStyleUtils<CompTokenMap extends Object>(
166164
// Fill unitless
167165
const originUnitless = options?.unitless || {};
168166
const compUnitless: any = {
169-
...unitless,
167+
...originUnitless,
170168
[prefixToken('zIndexPopup')]: true,
171169
};
172170
Object.keys(originUnitless).forEach((key) => {
@@ -200,12 +198,15 @@ export default function genStyleUtils<CompTokenMap extends Object>(
200198
unitless?: {
201199
[key in ComponentTokenKey<CompTokenMap, C>]: boolean;
202200
};
201+
ignore?: {
202+
[key in keyof AliasToken]?: boolean;
203+
};
203204
deprecatedTokens?: [ComponentTokenKey<CompTokenMap, C>, ComponentTokenKey<CompTokenMap, C>][];
204205
injectStyle?: boolean;
205206
prefixToken: (key: string) => string;
206207
},
207208
) {
208-
const { unitless: compUnitless, injectStyle = true, prefixToken } = options;
209+
const { unitless: compUnitless, injectStyle = true, prefixToken, ignore } = options;
209210

210211
const CSSVarRegister: FC<CSSVarRegisterProps> = ({ rootCls, cssVar = {} }) => {
211212
const [, realToken] = useToken();

0 commit comments

Comments
 (0)