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

Commit 7eec932

Browse files
committed
feat(css-values.ts*): Changed CSS~EdgeSizeValues to CSSMarginValue and CSSPaddingValue
1 parent e3fe923 commit 7eec932

File tree

2 files changed

+12
-44
lines changed

2 files changed

+12
-44
lines changed

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

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
CSSPercentageUnitValue,
66
CSSRespectUnitValue,
77
CSSViewportUnitValue,
8+
CSSUnit,
89
} from './css-units';
910
import type { CSSVariableValue } from './css-variables';
1011

@@ -28,48 +29,15 @@ type CSSUnitsAndGlobalValue =
2829

2930
export type CSSNumericValue = CSSUnitsAndGlobalValue | number;
3031

31-
type CSSSizeValue<T extends string | number> = `${T}` | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`;
32-
33-
type CSSAbsoluteUnitAndAutoValue = CSSAbsoluteUnitValue | 'auto';
34-
type CSSLocalFontAndAutoValue = CSSLocalFontRelativeUnitValue | 'auto';
35-
type CSSViewportUnitAndAutoValue = CSSViewportUnitValue | 'auto';
36-
type CSSRespectUnitAndAutoValue = CSSRespectUnitValue | 'auto';
37-
type CSSPercentageUnitAndAutValue = CSSPercentageUnitValue | 'auto';
32+
type CSSPaddingUnitValue = `${number}${CSSUnit}` | '0';
33+
type CSSPaddingSizeValue<T extends CSSPaddingUnitValue> = `${T}` | `${T} ${T}` | `${T} ${T} ${string}` | `${T} ${T} ${string} ${string}`;
34+
export type CSSPaddingValue = CSSPaddingSizeValue<CSSPaddingUnitValue> | number;
3835

39-
type CSSEdgeSizeAbsoluteWithAutoValues = CSSSizeValue<CSSAbsoluteUnitAndAutoValue>;
40-
type CSSEdgeSizeLocalFontWithAutoValues = CSSSizeValue<CSSLocalFontAndAutoValue>;
41-
type CSSEdgeSizeRootFontWithAutoValues = CSSSizeValue<CSSRootFontRelativeUnitValue>;
42-
type CSSEdgeSizeViewportWithAutoValues = CSSSizeValue<CSSViewportUnitAndAutoValue>;
43-
type CSSEdgeSizeRespectWithAutoValues = CSSSizeValue<CSSRespectUnitAndAutoValue>;
44-
type CSSEdgeSizePercentageWithAutoValues = CSSSizeValue<CSSPercentageUnitAndAutValue>;
45-
type CSSEdgeSizeCalcExpressionFunctioin = CSSSizeValue<CSSCalcExpressionFunctioin>;
46-
export type CSSMarginEdgeSizeValues =
47-
| CSSEdgeSizeAbsoluteWithAutoValues
48-
| CSSEdgeSizeLocalFontWithAutoValues
49-
| CSSEdgeSizeRootFontWithAutoValues
50-
| CSSEdgeSizeViewportWithAutoValues
51-
| CSSEdgeSizeRespectWithAutoValues
52-
| CSSEdgeSizePercentageWithAutoValues
53-
| CSSEdgeSizeCalcExpressionFunctioin
54-
| CSSGlobalValue
55-
| CSSVariableValue;
36+
type CSSMarginUnitValue = `${number}${CSSUnit}` | '0' | 'auto';
37+
type CSSMarginSizeValue<T extends CSSMarginUnitValue> = `${T}` | `${T} ${T}` | `${T} ${T} ${string}` | `${T} ${T} ${string} ${string}`;
38+
export type CSSMarginValue = CSSMarginSizeValue<CSSMarginUnitValue> | number;
5639

57-
type CSSEdgeSizeAbsoluteValues = CSSSizeValue<CSSAbsoluteUnitValue>;
58-
type CSSEdgeSizeLocalFontValues = CSSSizeValue<CSSLocalFontRelativeUnitValue>;
59-
type CSSEdgeSizeRootFontValues = CSSSizeValue<CSSRootFontRelativeUnitValue>;
60-
type CSSEdgeSizeViewportValues = CSSSizeValue<CSSViewportUnitValue>;
61-
type CSSEdgeSizeRespectValues = CSSRadiusValue<CSSRespectUnitValue>;
62-
type CSSEdgeSizePercentageValues = CSSSizeValue<CSSPercentageUnitValue>;
63-
export type CSSPaddingEdgeSizeValues =
64-
| CSSEdgeSizeAbsoluteValues
65-
| CSSEdgeSizeLocalFontValues
66-
| CSSEdgeSizeRootFontValues
67-
| CSSEdgeSizeViewportValues
68-
| CSSEdgeSizeRespectValues
69-
| CSSEdgeSizePercentageValues
70-
| CSSEdgeSizeCalcExpressionFunctioin
71-
| CSSGlobalValue
72-
| CSSVariableValue;
40+
type CSSSizeValue<T extends string | number> = `${T}` | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`;
7341

7442
type CustomRadiusValue<
7543
T extends

src/_internal/types/custom/custom-css-properties.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import type {
55
CSSFontSizeSubValue,
66
CSSGlobalValue,
77
CSSNumericValue,
8-
CSSMarginEdgeSizeValues,
9-
CSSPaddingEdgeSizeValues,
8+
CSSMarginValue,
9+
CSSPaddingValue,
1010
CSSRadiusValues,
1111
} from '../common/css-values';
1212
import type { AndStringsType, ArgsPseudos } from '../common/pseudo-selectors';
@@ -15,12 +15,12 @@ import type { CSSColorValue, CSSVariableProperties, CSSVariableValue } from '../
1515
type CustomExtendProperties = {
1616
width?: CSSNumericValue | CSSLengthSubValue | 'auto';
1717
height?: CSSNumericValue | CSSLengthSubValue | 'auto';
18-
margin?: CSSMarginEdgeSizeValues | number;
18+
margin?: CSSMarginValue;
1919
marginBottom?: CSSNumericValue | 'auto';
2020
marginLeft?: CSSNumericValue | 'auto';
2121
marginRight?: CSSNumericValue | 'auto';
2222
marginTop?: CSSNumericValue | 'auto';
23-
padding?: CSSPaddingEdgeSizeValues | number;
23+
padding?: CSSPaddingValue;
2424
paddingBottom?: CSSNumericValue;
2525
paddingLeft?: CSSNumericValue;
2626
paddingRight?: CSSNumericValue;

0 commit comments

Comments
 (0)