1
- use std:: collections:: HashSet ;
2
-
3
1
use html5ever:: { namespace_url, ns, LocalName , QualName } ;
4
- use lightningcss:: properties:: PropertyId ;
5
- use once_cell:: sync:: Lazy ;
6
2
use swc_ecma_ast:: { JSXMemberExpr , JSXObject } ;
7
3
8
- static INHERITABLE_STYLES : Lazy < HashSet < PropertyId < ' static > > > = Lazy :: new ( || {
9
- let mut styles = HashSet :: new ( ) ;
10
- styles. insert ( PropertyId :: from ( "color" ) ) ;
11
- styles. insert ( PropertyId :: from ( "font-size" ) ) ;
12
- styles. insert ( PropertyId :: from ( "font-family" ) ) ;
13
- styles. insert ( PropertyId :: from ( "font-weight" ) ) ;
14
-
15
- styles. insert ( PropertyId :: from ( "font-style" ) ) ;
16
- styles. insert ( PropertyId :: from ( "font-variant" ) ) ;
17
- styles. insert ( PropertyId :: from ( "font" ) ) ;
18
- styles. insert ( PropertyId :: from ( "font-size-adjust" ) ) ;
19
- styles. insert ( PropertyId :: from ( "font-stretch" ) ) ;
20
- styles. insert ( PropertyId :: from ( "font-smoothing" ) ) ;
21
- styles. insert ( PropertyId :: from ( "font-synthesis" ) ) ;
22
- styles. insert ( PropertyId :: from ( "font-feature-settings" ) ) ;
23
- styles. insert ( PropertyId :: from ( "font-kerning" ) ) ;
24
- styles. insert ( PropertyId :: from ( "font-variant-caps" ) ) ;
25
- styles. insert ( PropertyId :: from ( "font-variant-numeric" ) ) ;
26
- styles. insert ( PropertyId :: from ( "font-variant-east-asian" ) ) ;
27
- styles. insert ( PropertyId :: from ( "font-variant-ligatures" ) ) ;
28
- styles. insert ( PropertyId :: from ( "font-variant-position" ) ) ;
29
- styles. insert ( PropertyId :: from ( "line-height" ) ) ;
30
- styles. insert ( PropertyId :: from ( "visibility" ) ) ;
31
- styles. insert ( PropertyId :: from ( "white-space" ) ) ;
32
- styles. insert ( PropertyId :: from ( "word-spacing" ) ) ;
33
- styles. insert ( PropertyId :: from ( "letter-spacing" ) ) ;
34
- styles. insert ( PropertyId :: from ( "text-align" ) ) ;
35
- styles. insert ( PropertyId :: from ( "text-emphasize" ) ) ;
36
- styles. insert ( PropertyId :: from ( "text-rendering" ) ) ;
37
- styles. insert ( PropertyId :: from ( "text-indent" ) ) ;
38
- styles. insert ( PropertyId :: from ( "text-transform" ) ) ;
39
- styles. insert ( PropertyId :: from ( "text-decoration-thickness" ) ) ;
40
- styles. insert ( PropertyId :: from ( "text-decoration-offset" ) ) ;
41
- styles. insert ( PropertyId :: from ( "cursor" ) ) ;
42
- styles. insert ( PropertyId :: from ( "direction" ) ) ;
43
- styles. insert ( PropertyId :: from ( "quotes" ) ) ;
44
- styles. insert ( PropertyId :: from ( "caption-side" ) ) ;
45
- styles. insert ( PropertyId :: from ( "border-collapse" ) ) ;
46
- styles. insert ( PropertyId :: from ( "border-spacing" ) ) ;
47
- styles. insert ( PropertyId :: from ( "empty-cells" ) ) ;
48
- styles. insert ( PropertyId :: from ( "table-layout" ) ) ;
49
- styles. insert ( PropertyId :: from ( "list-style-type" ) ) ;
50
- styles. insert ( PropertyId :: from ( "list-style-image" ) ) ;
51
- styles. insert ( PropertyId :: from ( "list-style-position" ) ) ;
52
- styles. insert ( PropertyId :: from ( "list-style" ) ) ;
53
- styles. insert ( PropertyId :: from ( "page-break-inside" ) ) ;
54
- styles. insert ( PropertyId :: from ( "page" ) ) ;
55
- styles. insert ( PropertyId :: from ( "orphans" ) ) ;
56
- styles. insert ( PropertyId :: from ( "windows" ) ) ;
57
- styles. insert ( PropertyId :: from ( "speak" ) ) ;
58
- styles. insert ( PropertyId :: from ( "speak-punctuation" ) ) ;
59
- styles. insert ( PropertyId :: from ( "speak-numeral" ) ) ;
60
- styles. insert ( PropertyId :: from ( "speak-header" ) ) ;
61
- styles. insert ( PropertyId :: from ( "speech-rate" ) ) ;
62
- styles. insert ( PropertyId :: from ( "volume" ) ) ;
63
- styles. insert ( PropertyId :: from ( "voice-family" ) ) ;
64
- styles. insert ( PropertyId :: from ( "pitch" ) ) ;
65
- styles. insert ( PropertyId :: from ( "pitch-range" ) ) ;
66
- styles. insert ( PropertyId :: from ( "stress" ) ) ;
67
- styles. insert ( PropertyId :: from ( "richness" ) ) ;
68
- styles. insert ( PropertyId :: from ( "azimuth" ) ) ;
69
- styles. insert ( PropertyId :: from ( "elevation" ) ) ;
70
-
71
- styles
72
- } ) ;
73
-
74
4
pub fn recursion_jsx_member ( expr : & JSXMemberExpr ) -> String {
75
5
match & expr. obj {
76
6
JSXObject :: JSXMemberExpr ( expr) => {
@@ -90,10 +20,6 @@ pub fn create_qualname(str: &str) -> QualName {
90
20
QualName :: new ( None , ns ! ( ) , LocalName :: from ( str) )
91
21
}
92
22
93
- pub fn is_style_inheritable ( style : PropertyId < ' _ > ) -> bool {
94
- INHERITABLE_STYLES . contains ( & style)
95
- }
96
-
97
23
pub fn is_starts_with_uppercase ( str : & str ) -> bool {
98
24
str. chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( )
99
25
}
0 commit comments