Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit edccf3a

Browse files
committed
fix(css-values.ts): padding and margin now supports relative font size
1 parent cb8f072 commit edccf3a

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

src/_internal/types/common/css-values.ts

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type {
22
CSSAbsoluteUnitValue,
33
CSSLocalFontRelativeUnitValue,
4+
CSSRootFontRelativeUnitValue,
45
CSSPercentageUnitValue,
56
CSSRespectUnitValue,
6-
CSSRootFontRelativeUnitValue,
77
CSSViewportUnitValue,
88
} from './css-units';
99
import type { CSSVariableValue } from './css-variables';
@@ -31,20 +31,22 @@ export type CSSNumericValue = CSSUnitsAndGlobalValue | number;
3131
type CSSSizeValue<T extends string | number> = `${T}` | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`;
3232

3333
type CSSAbsoluteUnitAndAutoValue = CSSAbsoluteUnitValue | 'auto';
34-
type CSSRelativeUnitAndAutoValue = CSSLocalFontRelativeUnitValue | 'auto';
34+
type CSSLocalFontAndAutoValue = CSSLocalFontRelativeUnitValue | 'auto';
3535
type CSSViewportUnitAndAutoValue = CSSViewportUnitValue | 'auto';
3636
type CSSRespectUnitAndAutoValue = CSSRespectUnitValue | 'auto';
3737
type CSSPercentageUnitAndAutValue = CSSPercentageUnitValue | 'auto';
3838

3939
type CSSEdgeSizeAbsoluteWithAutoValues = CSSSizeValue<CSSAbsoluteUnitAndAutoValue>;
40-
type CSSEdgeSizeRelativeWithAutoValues = CSSSizeValue<CSSRelativeUnitAndAutoValue>;
40+
type CSSEdgeSizeLocalFontWithAutoValues = CSSSizeValue<CSSLocalFontAndAutoValue>;
41+
type CSSEdgeSizeRootFontWithAutoValues = CSSSizeValue<CSSRootFontRelativeUnitValue>;
4142
type CSSEdgeSizeViewportWithAutoValues = CSSSizeValue<CSSViewportUnitAndAutoValue>;
4243
type CSSEdgeSizeRespectWithAutoValues = CSSSizeValue<CSSRespectUnitAndAutoValue>;
4344
type CSSEdgeSizePercentageWithAutoValues = CSSSizeValue<CSSPercentageUnitAndAutValue>;
4445
type CSSEdgeSizeCalcExpressionFunctioin = CSSSizeValue<CSSCalcExpressionFunctioin>;
4546
export type CSSMarginEdgeSizeValues =
4647
| CSSEdgeSizeAbsoluteWithAutoValues
47-
| CSSEdgeSizeRelativeWithAutoValues
48+
| CSSEdgeSizeLocalFontWithAutoValues
49+
| CSSEdgeSizeRootFontWithAutoValues
4850
| CSSEdgeSizeViewportWithAutoValues
4951
| CSSEdgeSizeRespectWithAutoValues
5052
| CSSEdgeSizePercentageWithAutoValues
@@ -53,38 +55,54 @@ export type CSSMarginEdgeSizeValues =
5355
| CSSVariableValue;
5456

5557
type CSSEdgeSizeAbsoluteValues = CSSSizeValue<CSSAbsoluteUnitValue>;
56-
type CSSEdgeSizeRelativeValues = CSSSizeValue<CSSLocalFontRelativeUnitValue>;
58+
type CSSEdgeSizeLocalFontValues = CSSSizeValue<CSSLocalFontRelativeUnitValue>;
59+
type CSSEdgeSizeRootFontValues = CSSSizeValue<CSSRootFontRelativeUnitValue>;
5760
type CSSEdgeSizeViewportValues = CSSSizeValue<CSSViewportUnitValue>;
58-
type CSSEdgeSizeRespectValues = CSSSizeValue<CSSRespectUnitValue>;
61+
type CSSEdgeSizeRespectValues = CSSRadiusValue<CSSRespectUnitValue>;
5962
type CSSEdgeSizePercentageValues = CSSSizeValue<CSSPercentageUnitValue>;
6063
export type CSSPaddingEdgeSizeValues =
6164
| CSSEdgeSizeAbsoluteValues
62-
| CSSEdgeSizeRelativeValues
65+
| CSSEdgeSizeLocalFontValues
66+
| CSSEdgeSizeRootFontValues
6367
| CSSEdgeSizeViewportValues
6468
| CSSEdgeSizeRespectValues
6569
| CSSEdgeSizePercentageValues
6670
| CSSEdgeSizeCalcExpressionFunctioin
6771
| CSSGlobalValue
6872
| CSSVariableValue;
6973

70-
type CustomRadiusValue<T extends CSSAbsoluteUnitValue | CSSLocalFontRelativeUnitValue | CSSViewportUnitValue | CSSRespectUnitValue | CSSPercentageUnitValue> =
71-
`${T} ${T} / ${T} ${T}`;
74+
type CustomRadiusValue<
75+
T extends
76+
| CSSAbsoluteUnitValue
77+
| CSSLocalFontRelativeUnitValue
78+
| CSSRootFontRelativeUnitValue
79+
| CSSViewportUnitValue
80+
| CSSRespectUnitValue
81+
| CSSPercentageUnitValue
82+
> = `${T} ${T} / ${T} ${T}`;
7283

73-
type CSSRadiusValue<T extends CSSAbsoluteUnitValue | CSSLocalFontRelativeUnitValue | CSSViewportUnitValue | CSSRespectUnitValue | CSSPercentageUnitValue> =
74-
| CSSSizeValue<T>
75-
| CustomRadiusValue<T>;
84+
type CSSRadiusValue<
85+
T extends
86+
| CSSAbsoluteUnitValue
87+
| CSSLocalFontRelativeUnitValue
88+
| CSSRootFontRelativeUnitValue
89+
| CSSViewportUnitValue
90+
| CSSRespectUnitValue
91+
| CSSPercentageUnitValue
92+
> = CSSSizeValue<T> | CustomRadiusValue<T>;
7693

7794
type CSSRadiusAbsoluteValues = CSSRadiusValue<CSSAbsoluteUnitValue>;
78-
type CSSRadiusRelativeValues = CSSRadiusValue<CSSLocalFontRelativeUnitValue>;
95+
type CSSRadiusLocalFontValues = CSSRadiusValue<CSSLocalFontRelativeUnitValue>;
96+
type CSSRadiusRootFontValues = CSSRadiusValue<CSSRootFontRelativeUnitValue>;
7997
type CSSRadiusViewportValues = CSSRadiusValue<CSSViewportUnitValue>;
8098
type CSSRadiusRespectValues = CSSRadiusValue<CSSRespectUnitValue>;
8199
type CSSRadiusPercentageValues = CSSRadiusValue<CSSPercentageUnitValue>;
82100
export type CSSRadiusValues =
83101
| CSSRadiusAbsoluteValues
84-
| CSSRadiusRelativeValues
102+
| CSSRadiusLocalFontValues
103+
| CSSRadiusRootFontValues
85104
| CSSRadiusViewportValues
86105
| CSSRadiusRespectValues
87106
| CSSRadiusPercentageValues
88107
| CSSGlobalValue
89-
| CSSVariableValue
90-
| number;
108+
| CSSVariableValue;

0 commit comments

Comments
 (0)