@@ -8,9 +8,11 @@ import type {
88 CSSEdgeSizeValue ,
99 CSSRadiusValues ,
1010} from '../common/css-values' ;
11- import type { AndStringsType , ArgsPseudos } from '../common/pseudo-selectors' ;
11+ import type { AndStrings , AndStringsType , ArgsPseudos } from '../common/pseudo-selectors' ;
1212import type { CSSColorValue , CSSVariableProperties , CSSVariableValue } from '../common/css-variables' ;
13- import { MediaQueryType } from './custom-html-type' ;
13+ import { MediaQuery , MediaQueryType } from './custom-html-type' ;
14+ import { HtmlTags } from '../../utils/html-tags' ;
15+ import { LanguageCodes } from '../../utils/language-codes' ;
1416
1517type CustomExtendProperties = {
1618 width ?: CSSNumericValue | CSSLengthSubValue | 'auto' ;
@@ -33,7 +35,7 @@ type CustomExtendProperties = {
3335 wordSpacing ?: CSSNumericValue | 'normal' ;
3436 borderWidth ?: CSSNumericValue | 'thin' | 'medium' | 'thick' ;
3537 borderRadius ?: CSSRadiusValues | number ;
36- top ?: CSSNumericValue | 'auto' ;
38+ top ?: CSSNumericValue | 'auto' | number ;
3739 right ?: CSSNumericValue | 'auto' ;
3840 bottom ?: CSSNumericValue | 'auto' ;
3941 left ?: CSSNumericValue | 'auto' ;
@@ -51,45 +53,51 @@ type CustomExtendProperties = {
5153 color ?: CSSColorValue | CSSGlobalValue ;
5254 background ?: CSSColorValue | CSSGlobalValue | 'none' ;
5355 backgroundColor ?: CSSColorValue | CSSGlobalValue ;
54- active ?: CustomCSSProperties ;
55- hover ?: CustomCSSProperties ;
56- link ?: CustomCSSProperties ;
57- visited ?: CustomCSSProperties ;
58- empty ?: CustomCSSProperties ;
59- lang ?: undefined ;
60- not ?: undefined ;
61- notClass ?: undefined ;
62- has ?: undefined ;
63- hasChild ?: undefined ;
64- hasPlus ?: undefined ;
65- hasClass ?: undefined ;
66- hasClassChild ?: undefined ;
67- hasClassPlus ?: undefined ;
68- firstChild ?: CustomCSSProperties ;
69- lastChild ?: CustomCSSProperties ;
70- nthChild ?: undefined ;
71- nthLastChild ?: undefined ;
72- nthLastOfType ?: undefined ;
73- nthOfType ?: undefined ;
74- checked ?: CustomCSSProperties ;
75- disabled ?: CustomCSSProperties ;
76- enabled ?: CustomCSSProperties ;
77- focus ?: CustomCSSProperties ;
78- inRange ?: CustomCSSProperties ;
79- invalid ?: CustomCSSProperties ;
80- valid ?: CustomCSSProperties ;
81- optional ?: CustomCSSProperties ;
82- outOfRange ?: CustomCSSProperties ;
83- readOnly ?: CustomCSSProperties ;
84- readWrite ?: CustomCSSProperties ;
85- required ?: CustomCSSProperties ;
86- target ?: CustomCSSProperties ;
87- after ?: CustomCSSProperties ;
88- before ?: CustomCSSProperties ;
89- firstLetter ?: CustomCSSProperties ;
90- firstLine ?: CustomCSSProperties ;
91- marker ?: CustomCSSProperties ;
92- selection ?: CustomCSSProperties ;
56+ } ;
57+
58+ type PseudoElementsAndClassKeys =
59+ | 'active'
60+ | 'hover'
61+ | 'link'
62+ | 'visited'
63+ | 'empty'
64+ | `lang${LanguageCodes } `
65+ | `not${HtmlTags } `
66+ | `notClass${string } `
67+ | `has${HtmlTags } `
68+ | `hasChild${HtmlTags } `
69+ | `hasPlus${HtmlTags } `
70+ | `hasClass${string } `
71+ | `hasClassChild${string } `
72+ | `hasClassPlus${string } `
73+ | 'firstChild'
74+ | 'lastChild'
75+ | `nthChild${number | 'Odd' | 'Even' } `
76+ | `nthLastChild${number | 'Odd' | 'Even' } `
77+ | `nthLastOfType${number | 'Odd' | 'Even' } `
78+ | `nthOfType${number | 'Odd' | 'Even' } `
79+ | 'checked'
80+ | 'disabled'
81+ | 'enabled'
82+ | 'focus'
83+ | 'inRange'
84+ | 'invalid'
85+ | 'valid'
86+ | 'optional'
87+ | 'outOfRange'
88+ | 'readOnly'
89+ | 'readWrite'
90+ | 'required'
91+ | 'target'
92+ | 'after'
93+ | 'before'
94+ | 'firstLetter'
95+ | 'firstLine'
96+ | 'marker'
97+ | 'selection' ;
98+
99+ type PseudoElementsAndClassType = {
100+ [ K in PseudoElementsAndClassKeys ] ?: CustomCSSProperties ;
93101} ;
94102
95103export type CustomCSSProperties =
@@ -99,4 +107,11 @@ export type CustomCSSProperties =
99107 [ K in keyof React . CSSProperties ] : React . CSSProperties [ K ] | CSSVariableValue ;
100108 } )
101109 | CSSVariableProperties
102- | MediaQueryType ;
110+ | MediaQueryType
111+ | PseudoElementsAndClassType ;
112+
113+ export type ExtendedCSSProperties =
114+ | CustomCSSProperties
115+ | {
116+ [ K in AndStrings | PseudoElementsAndClassKeys | MediaQuery ] ?: CustomCSSProperties ;
117+ } ;
0 commit comments