@swc/plugin-styled-jsx 1.5.70 → 1.5.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +3 -8
- package/package.json +1 -1
- package/swc_plugin_styled_jsx.wasm +0 -0
- package/transform/Cargo.toml +10 -9
- package/transform/src/lib.rs +1 -0
- package/transform/src/lifetime.rs +408 -0
- package/transform/src/style.rs +3 -0
- package/transform/src/transform_css.rs +390 -260
- package/transform/src/visitor.rs +14 -1
- package/transform/tests/errors/ts-with-css-resolve/output.js +1 -1
- package/transform/tests/fixture/css-selector-after-pseudo/output.js +1 -1
- package/transform/tests/fixture/fragment/output.js +1 -1
- package/transform/tests/fixture/global/output.js +1 -1
- package/transform/tests/fixture/global-redundant/output.js +1 -1
- package/transform/tests/fixture/issue-30480/input.js +5 -1
- package/transform/tests/fixture/issue-30480/output.js +3 -3
- package/transform/tests/fixture/issue-30570/output.js +1 -1
- package/transform/tests/fixture/styles/output.js +4 -4
- package/transform/tests/fixture/tpl-placeholder-1-as-property/output.js +1 -2
- package/transform/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.js +1 -1
- package/transform/tests/fixture/transform-css/input.js +22 -22
- package/transform/tests/fixture/transform-css/output.js +3 -3
- package/transform/tests/fixture/transform-css-complex-selector/output.js +1 -1
- package/transform/tests/fixture/transform-css-complex-selector-2/input.js +12 -0
- package/transform/tests/fixture/transform-css-complex-selector-2/output.js +8 -0
- package/transform/tests/fixture/transform-css-global/output.js +1 -1
- package/transform/tests/fixture/transform-css-media-query/output.js +1 -1
- package/transform/tests/fixture/transform-css-normal/output.js +1 -1
- package/transform/tests/fixture/transform-css-nth-1/output.js +1 -1
- /package/transform/tests/fixture/{expressions → .expressions}/input.js +0 -0
- /package/transform/tests/fixture/{expressions → .expressions}/output.js +0 -0
package/Cargo.toml
CHANGED
|
@@ -16,15 +16,10 @@ custom_transform = ["swc_core/common_concurrent"]
|
|
|
16
16
|
[dependencies]
|
|
17
17
|
easy-error = "1.0.0"
|
|
18
18
|
styled_jsx = { path = "./transform" }
|
|
19
|
-
swc_core = { version = "0.79.
|
|
19
|
+
swc_core = { version = "0.79.56", features = [
|
|
20
20
|
"common",
|
|
21
21
|
"ecma_ast",
|
|
22
22
|
"ecma_plugin_transform",
|
|
23
|
-
"css_ast",
|
|
24
|
-
"css_codegen",
|
|
25
|
-
"css_parser",
|
|
26
|
-
"css_prefixer",
|
|
27
|
-
"css_visit",
|
|
28
23
|
"ecma_parser",
|
|
29
24
|
"ecma_minifier",
|
|
30
25
|
"ecma_utils",
|
|
@@ -33,5 +28,5 @@ swc_core = { version = "0.79.20", features = [
|
|
|
33
28
|
tracing = { version = "0.1.37", features = ["release_max_level_off"] }
|
|
34
29
|
|
|
35
30
|
[dev-dependencies]
|
|
36
|
-
swc_core = { features = ["testing_transform"], version = "0.79.
|
|
37
|
-
testing = "0.33.
|
|
31
|
+
swc_core = { features = ["testing_transform"], version = "0.79.56" }
|
|
32
|
+
testing = "0.33.21"
|
package/package.json
CHANGED
|
Binary file
|
package/transform/Cargo.toml
CHANGED
|
@@ -4,7 +4,7 @@ description = "AST transforms visitor for styled-jsx"
|
|
|
4
4
|
edition = "2021"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
name = "styled_jsx"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.38.0"
|
|
8
8
|
|
|
9
9
|
[features]
|
|
10
10
|
custom_transform = ["swc_core/common_concurrent"]
|
|
@@ -12,15 +12,16 @@ custom_transform = ["swc_core/common_concurrent"]
|
|
|
12
12
|
[dependencies]
|
|
13
13
|
easy-error = "1.0.0"
|
|
14
14
|
tracing = "0.1.37"
|
|
15
|
+
lightningcss = { version = "1.0.0-alpha.44", features = [
|
|
16
|
+
"visitor",
|
|
17
|
+
"into_owned",
|
|
18
|
+
] }
|
|
19
|
+
parcel_selectors = "0.26.0"
|
|
20
|
+
|
|
15
21
|
|
|
16
|
-
swc_core = { version = "0.79.
|
|
22
|
+
swc_core = { version = "0.79.56", features = [
|
|
17
23
|
"common",
|
|
18
24
|
"ecma_ast",
|
|
19
|
-
"css_ast",
|
|
20
|
-
"css_codegen",
|
|
21
|
-
"css_parser",
|
|
22
|
-
"css_prefixer",
|
|
23
|
-
"css_visit",
|
|
24
25
|
"ecma_parser",
|
|
25
26
|
"ecma_minifier",
|
|
26
27
|
"ecma_utils",
|
|
@@ -28,5 +29,5 @@ swc_core = { version = "0.79.20", features = [
|
|
|
28
29
|
] }
|
|
29
30
|
|
|
30
31
|
[dev-dependencies]
|
|
31
|
-
testing = "0.33.
|
|
32
|
-
swc_core = { features = ["testing_transform"], version = "0.79.
|
|
32
|
+
testing = "0.33.21"
|
|
33
|
+
swc_core = { features = ["testing_transform"], version = "0.79.56" }
|
package/transform/src/lib.rs
CHANGED
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
#![deny(unused)]
|
|
2
|
+
|
|
3
|
+
use lightningcss::{
|
|
4
|
+
properties::custom::TokenList,
|
|
5
|
+
selector::{Component, Selector, ViewTransitionPartName},
|
|
6
|
+
};
|
|
7
|
+
use parcel_selectors::{
|
|
8
|
+
attr::{AttrSelectorWithOptionalNamespace, NamespaceConstraint, ParsedAttrSelectorOperation},
|
|
9
|
+
parser::{LocalName, NthOfSelectorData},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
pub fn owned_selector<'i>(sel: &Selector) -> Selector<'i> {
|
|
13
|
+
let mut buf: Vec<Component<'i>> = vec![];
|
|
14
|
+
|
|
15
|
+
for component in sel.iter_raw_parse_order_from(0) {
|
|
16
|
+
buf.push(owned_component(component));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Selector::from(buf)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn owned_component<'i>(c: &Component) -> Component<'i> {
|
|
23
|
+
match c {
|
|
24
|
+
parcel_selectors::parser::Component::Combinator(v) => {
|
|
25
|
+
parcel_selectors::parser::Component::Combinator(*v)
|
|
26
|
+
}
|
|
27
|
+
parcel_selectors::parser::Component::ExplicitAnyNamespace => {
|
|
28
|
+
parcel_selectors::parser::Component::ExplicitAnyNamespace
|
|
29
|
+
}
|
|
30
|
+
parcel_selectors::parser::Component::ExplicitNoNamespace => {
|
|
31
|
+
parcel_selectors::parser::Component::ExplicitNoNamespace
|
|
32
|
+
}
|
|
33
|
+
parcel_selectors::parser::Component::DefaultNamespace(v) => {
|
|
34
|
+
parcel_selectors::parser::Component::DefaultNamespace(v.clone().into_owned())
|
|
35
|
+
}
|
|
36
|
+
parcel_selectors::parser::Component::Namespace(v1, v2) => {
|
|
37
|
+
parcel_selectors::parser::Component::Namespace(
|
|
38
|
+
v1.clone().into_owned(),
|
|
39
|
+
v2.clone().into_owned(),
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
parcel_selectors::parser::Component::ExplicitUniversalType => {
|
|
43
|
+
parcel_selectors::parser::Component::ExplicitUniversalType
|
|
44
|
+
}
|
|
45
|
+
parcel_selectors::parser::Component::ID(v) => {
|
|
46
|
+
parcel_selectors::parser::Component::ID(v.clone().into_owned())
|
|
47
|
+
}
|
|
48
|
+
parcel_selectors::parser::Component::Class(v) => {
|
|
49
|
+
parcel_selectors::parser::Component::Class(v.clone().into_owned())
|
|
50
|
+
}
|
|
51
|
+
parcel_selectors::parser::Component::Root => parcel_selectors::parser::Component::Root,
|
|
52
|
+
parcel_selectors::parser::Component::Empty => parcel_selectors::parser::Component::Empty,
|
|
53
|
+
parcel_selectors::parser::Component::Scope => parcel_selectors::parser::Component::Scope,
|
|
54
|
+
parcel_selectors::parser::Component::PseudoElement(v) => {
|
|
55
|
+
parcel_selectors::parser::Component::PseudoElement(owned_psuedo_element(v))
|
|
56
|
+
}
|
|
57
|
+
parcel_selectors::parser::Component::Nesting => {
|
|
58
|
+
parcel_selectors::parser::Component::Nesting
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
parcel_selectors::parser::Component::AttributeInNoNamespaceExists {
|
|
62
|
+
local_name,
|
|
63
|
+
local_name_lower,
|
|
64
|
+
} => parcel_selectors::parser::Component::AttributeInNoNamespaceExists {
|
|
65
|
+
local_name: local_name.clone().into_owned(),
|
|
66
|
+
local_name_lower: local_name_lower.clone().into_owned(),
|
|
67
|
+
},
|
|
68
|
+
parcel_selectors::parser::Component::AttributeInNoNamespace {
|
|
69
|
+
local_name,
|
|
70
|
+
operator,
|
|
71
|
+
value,
|
|
72
|
+
case_sensitivity,
|
|
73
|
+
never_matches,
|
|
74
|
+
} => parcel_selectors::parser::Component::AttributeInNoNamespace {
|
|
75
|
+
local_name: local_name.clone().into_owned(),
|
|
76
|
+
operator: *operator,
|
|
77
|
+
value: value.clone().into_owned(),
|
|
78
|
+
case_sensitivity: *case_sensitivity,
|
|
79
|
+
never_matches: *never_matches,
|
|
80
|
+
},
|
|
81
|
+
parcel_selectors::parser::Component::AttributeOther(v) => {
|
|
82
|
+
parcel_selectors::parser::Component::AttributeOther(Box::new(
|
|
83
|
+
AttrSelectorWithOptionalNamespace {
|
|
84
|
+
namespace: v.namespace.as_ref().map(|v| match v {
|
|
85
|
+
NamespaceConstraint::Any => NamespaceConstraint::Any,
|
|
86
|
+
NamespaceConstraint::Specific((v1, v2)) => NamespaceConstraint::Specific((
|
|
87
|
+
v1.clone().into_owned(),
|
|
88
|
+
v2.clone().into_owned(),
|
|
89
|
+
)),
|
|
90
|
+
}),
|
|
91
|
+
local_name: v.local_name.clone().into_owned(),
|
|
92
|
+
local_name_lower: v.local_name_lower.clone().into_owned(),
|
|
93
|
+
operation: match &v.operation {
|
|
94
|
+
ParsedAttrSelectorOperation::Exists => ParsedAttrSelectorOperation::Exists,
|
|
95
|
+
ParsedAttrSelectorOperation::WithValue {
|
|
96
|
+
operator,
|
|
97
|
+
case_sensitivity,
|
|
98
|
+
expected_value,
|
|
99
|
+
} => ParsedAttrSelectorOperation::WithValue {
|
|
100
|
+
operator: *operator,
|
|
101
|
+
case_sensitivity: *case_sensitivity,
|
|
102
|
+
expected_value: expected_value.clone().into_owned(),
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
never_matches: v.never_matches,
|
|
106
|
+
},
|
|
107
|
+
))
|
|
108
|
+
}
|
|
109
|
+
parcel_selectors::parser::Component::Negation(v) => {
|
|
110
|
+
parcel_selectors::parser::Component::Negation(owned_selectors(v))
|
|
111
|
+
}
|
|
112
|
+
parcel_selectors::parser::Component::LocalName(v1) => {
|
|
113
|
+
parcel_selectors::parser::Component::LocalName(LocalName {
|
|
114
|
+
name: v1.name.clone().into_owned(),
|
|
115
|
+
lower_name: v1.lower_name.clone().into_owned(),
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
parcel_selectors::parser::Component::Nth(v) => parcel_selectors::parser::Component::Nth(*v),
|
|
119
|
+
parcel_selectors::parser::Component::NthOf(v) => {
|
|
120
|
+
parcel_selectors::parser::Component::NthOf(NthOfSelectorData::new(
|
|
121
|
+
*v.nth_data(),
|
|
122
|
+
owned_selectors(v.selectors()),
|
|
123
|
+
))
|
|
124
|
+
}
|
|
125
|
+
parcel_selectors::parser::Component::NonTSPseudoClass(v) => {
|
|
126
|
+
parcel_selectors::parser::Component::NonTSPseudoClass(owned_psuedo_class(v))
|
|
127
|
+
}
|
|
128
|
+
parcel_selectors::parser::Component::Slotted(v) => {
|
|
129
|
+
parcel_selectors::parser::Component::Slotted(owned_selector(v))
|
|
130
|
+
}
|
|
131
|
+
parcel_selectors::parser::Component::Part(v) => parcel_selectors::parser::Component::Part(
|
|
132
|
+
v.iter().map(|v| v.clone().into_owned()).collect(),
|
|
133
|
+
),
|
|
134
|
+
parcel_selectors::parser::Component::Host(v) => {
|
|
135
|
+
parcel_selectors::parser::Component::Host(v.as_ref().map(owned_selector))
|
|
136
|
+
}
|
|
137
|
+
parcel_selectors::parser::Component::Where(v) => {
|
|
138
|
+
parcel_selectors::parser::Component::Where(owned_selectors(v))
|
|
139
|
+
}
|
|
140
|
+
parcel_selectors::parser::Component::Is(v) => {
|
|
141
|
+
parcel_selectors::parser::Component::Is(owned_selectors(v))
|
|
142
|
+
}
|
|
143
|
+
parcel_selectors::parser::Component::Any(v1, v2) => {
|
|
144
|
+
parcel_selectors::parser::Component::Any(*v1, owned_selectors(v2))
|
|
145
|
+
}
|
|
146
|
+
parcel_selectors::parser::Component::Has(v) => {
|
|
147
|
+
parcel_selectors::parser::Component::Has(owned_selectors(v))
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
fn owned_psuedo_element<'i>(
|
|
153
|
+
v: &lightningcss::selector::PseudoElement,
|
|
154
|
+
) -> lightningcss::selector::PseudoElement<'i> {
|
|
155
|
+
match v {
|
|
156
|
+
lightningcss::selector::PseudoElement::After => {
|
|
157
|
+
lightningcss::selector::PseudoElement::After
|
|
158
|
+
}
|
|
159
|
+
lightningcss::selector::PseudoElement::Before => {
|
|
160
|
+
lightningcss::selector::PseudoElement::Before
|
|
161
|
+
}
|
|
162
|
+
lightningcss::selector::PseudoElement::FirstLine => {
|
|
163
|
+
lightningcss::selector::PseudoElement::FirstLine
|
|
164
|
+
}
|
|
165
|
+
lightningcss::selector::PseudoElement::FirstLetter => {
|
|
166
|
+
lightningcss::selector::PseudoElement::FirstLetter
|
|
167
|
+
}
|
|
168
|
+
lightningcss::selector::PseudoElement::Selection(v) => {
|
|
169
|
+
lightningcss::selector::PseudoElement::Selection(*v)
|
|
170
|
+
}
|
|
171
|
+
lightningcss::selector::PseudoElement::Placeholder(v) => {
|
|
172
|
+
lightningcss::selector::PseudoElement::Placeholder(*v)
|
|
173
|
+
}
|
|
174
|
+
lightningcss::selector::PseudoElement::Marker => {
|
|
175
|
+
lightningcss::selector::PseudoElement::Marker
|
|
176
|
+
}
|
|
177
|
+
lightningcss::selector::PseudoElement::Backdrop(v) => {
|
|
178
|
+
lightningcss::selector::PseudoElement::Backdrop(*v)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
lightningcss::selector::PseudoElement::FileSelectorButton(v) => {
|
|
182
|
+
lightningcss::selector::PseudoElement::FileSelectorButton(*v)
|
|
183
|
+
}
|
|
184
|
+
lightningcss::selector::PseudoElement::WebKitScrollbar(v) => {
|
|
185
|
+
lightningcss::selector::PseudoElement::WebKitScrollbar(v.clone())
|
|
186
|
+
}
|
|
187
|
+
lightningcss::selector::PseudoElement::Cue => lightningcss::selector::PseudoElement::Cue,
|
|
188
|
+
lightningcss::selector::PseudoElement::CueRegion => {
|
|
189
|
+
lightningcss::selector::PseudoElement::CueRegion
|
|
190
|
+
}
|
|
191
|
+
lightningcss::selector::PseudoElement::CueFunction { selector } => {
|
|
192
|
+
lightningcss::selector::PseudoElement::CueFunction {
|
|
193
|
+
selector: Box::new(owned_selector(selector)),
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
lightningcss::selector::PseudoElement::CueRegionFunction { selector } => {
|
|
197
|
+
lightningcss::selector::PseudoElement::CueRegionFunction {
|
|
198
|
+
selector: Box::new(owned_selector(selector)),
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
lightningcss::selector::PseudoElement::ViewTransition => {
|
|
202
|
+
lightningcss::selector::PseudoElement::ViewTransition
|
|
203
|
+
}
|
|
204
|
+
lightningcss::selector::PseudoElement::ViewTransitionGroup { part_name } => {
|
|
205
|
+
lightningcss::selector::PseudoElement::ViewTransitionGroup {
|
|
206
|
+
part_name: owned_view_transition_part_name(part_name),
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
lightningcss::selector::PseudoElement::ViewTransitionImagePair { part_name } => {
|
|
210
|
+
lightningcss::selector::PseudoElement::ViewTransitionImagePair {
|
|
211
|
+
part_name: owned_view_transition_part_name(part_name),
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
lightningcss::selector::PseudoElement::ViewTransitionOld { part_name } => {
|
|
215
|
+
lightningcss::selector::PseudoElement::ViewTransitionOld {
|
|
216
|
+
part_name: owned_view_transition_part_name(part_name),
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
lightningcss::selector::PseudoElement::ViewTransitionNew { part_name } => {
|
|
220
|
+
lightningcss::selector::PseudoElement::ViewTransitionNew {
|
|
221
|
+
part_name: owned_view_transition_part_name(part_name),
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
lightningcss::selector::PseudoElement::Custom { name } => {
|
|
225
|
+
lightningcss::selector::PseudoElement::Custom {
|
|
226
|
+
name: name.clone().into_owned(),
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
lightningcss::selector::PseudoElement::CustomFunction { name, arguments } => {
|
|
230
|
+
lightningcss::selector::PseudoElement::CustomFunction {
|
|
231
|
+
name: name.clone().into_owned(),
|
|
232
|
+
arguments: owned_token_list(arguments),
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
fn owned_view_transition_part_name<'i>(n: &ViewTransitionPartName) -> ViewTransitionPartName<'i> {
|
|
239
|
+
match n {
|
|
240
|
+
ViewTransitionPartName::All => ViewTransitionPartName::All,
|
|
241
|
+
ViewTransitionPartName::Name(v) => ViewTransitionPartName::Name(v.clone().into_owned()),
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
fn owned_psuedo_class<'i>(
|
|
246
|
+
v: &lightningcss::selector::PseudoClass,
|
|
247
|
+
) -> lightningcss::selector::PseudoClass<'i> {
|
|
248
|
+
match v {
|
|
249
|
+
lightningcss::selector::PseudoClass::Lang { languages } => {
|
|
250
|
+
lightningcss::selector::PseudoClass::Lang {
|
|
251
|
+
languages: languages.iter().map(|v| v.clone().into_owned()).collect(),
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
lightningcss::selector::PseudoClass::Dir { direction } => {
|
|
255
|
+
lightningcss::selector::PseudoClass::Dir {
|
|
256
|
+
direction: *direction,
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
lightningcss::selector::PseudoClass::Hover => lightningcss::selector::PseudoClass::Hover,
|
|
260
|
+
lightningcss::selector::PseudoClass::Active => lightningcss::selector::PseudoClass::Active,
|
|
261
|
+
lightningcss::selector::PseudoClass::Focus => lightningcss::selector::PseudoClass::Focus,
|
|
262
|
+
lightningcss::selector::PseudoClass::FocusVisible => {
|
|
263
|
+
lightningcss::selector::PseudoClass::FocusVisible
|
|
264
|
+
}
|
|
265
|
+
lightningcss::selector::PseudoClass::FocusWithin => {
|
|
266
|
+
lightningcss::selector::PseudoClass::FocusWithin
|
|
267
|
+
}
|
|
268
|
+
lightningcss::selector::PseudoClass::Current => {
|
|
269
|
+
lightningcss::selector::PseudoClass::Current
|
|
270
|
+
}
|
|
271
|
+
lightningcss::selector::PseudoClass::Past => lightningcss::selector::PseudoClass::Past,
|
|
272
|
+
lightningcss::selector::PseudoClass::Future => lightningcss::selector::PseudoClass::Future,
|
|
273
|
+
lightningcss::selector::PseudoClass::Playing => {
|
|
274
|
+
lightningcss::selector::PseudoClass::Playing
|
|
275
|
+
}
|
|
276
|
+
lightningcss::selector::PseudoClass::Paused => lightningcss::selector::PseudoClass::Paused,
|
|
277
|
+
lightningcss::selector::PseudoClass::Seeking => {
|
|
278
|
+
lightningcss::selector::PseudoClass::Seeking
|
|
279
|
+
}
|
|
280
|
+
lightningcss::selector::PseudoClass::Buffering => {
|
|
281
|
+
lightningcss::selector::PseudoClass::Buffering
|
|
282
|
+
}
|
|
283
|
+
lightningcss::selector::PseudoClass::Stalled => {
|
|
284
|
+
lightningcss::selector::PseudoClass::Stalled
|
|
285
|
+
}
|
|
286
|
+
lightningcss::selector::PseudoClass::Muted => lightningcss::selector::PseudoClass::Muted,
|
|
287
|
+
lightningcss::selector::PseudoClass::VolumeLocked => {
|
|
288
|
+
lightningcss::selector::PseudoClass::VolumeLocked
|
|
289
|
+
}
|
|
290
|
+
lightningcss::selector::PseudoClass::Fullscreen(v) => {
|
|
291
|
+
lightningcss::selector::PseudoClass::Fullscreen(*v)
|
|
292
|
+
}
|
|
293
|
+
lightningcss::selector::PseudoClass::Open => lightningcss::selector::PseudoClass::Open,
|
|
294
|
+
lightningcss::selector::PseudoClass::Closed => lightningcss::selector::PseudoClass::Closed,
|
|
295
|
+
lightningcss::selector::PseudoClass::Modal => lightningcss::selector::PseudoClass::Modal,
|
|
296
|
+
lightningcss::selector::PseudoClass::PictureInPicture => {
|
|
297
|
+
lightningcss::selector::PseudoClass::PictureInPicture
|
|
298
|
+
}
|
|
299
|
+
lightningcss::selector::PseudoClass::PopoverOpen => {
|
|
300
|
+
lightningcss::selector::PseudoClass::PopoverOpen
|
|
301
|
+
}
|
|
302
|
+
lightningcss::selector::PseudoClass::Defined => {
|
|
303
|
+
lightningcss::selector::PseudoClass::Defined
|
|
304
|
+
}
|
|
305
|
+
lightningcss::selector::PseudoClass::AnyLink(v) => {
|
|
306
|
+
lightningcss::selector::PseudoClass::AnyLink(*v)
|
|
307
|
+
}
|
|
308
|
+
lightningcss::selector::PseudoClass::Link => lightningcss::selector::PseudoClass::Link,
|
|
309
|
+
lightningcss::selector::PseudoClass::LocalLink => {
|
|
310
|
+
lightningcss::selector::PseudoClass::LocalLink
|
|
311
|
+
}
|
|
312
|
+
lightningcss::selector::PseudoClass::Target => lightningcss::selector::PseudoClass::Target,
|
|
313
|
+
lightningcss::selector::PseudoClass::TargetWithin => {
|
|
314
|
+
lightningcss::selector::PseudoClass::TargetWithin
|
|
315
|
+
}
|
|
316
|
+
lightningcss::selector::PseudoClass::Visited => {
|
|
317
|
+
lightningcss::selector::PseudoClass::Visited
|
|
318
|
+
}
|
|
319
|
+
lightningcss::selector::PseudoClass::Enabled => {
|
|
320
|
+
lightningcss::selector::PseudoClass::Enabled
|
|
321
|
+
}
|
|
322
|
+
lightningcss::selector::PseudoClass::Disabled => {
|
|
323
|
+
lightningcss::selector::PseudoClass::Disabled
|
|
324
|
+
}
|
|
325
|
+
lightningcss::selector::PseudoClass::ReadOnly(v) => {
|
|
326
|
+
lightningcss::selector::PseudoClass::ReadOnly(*v)
|
|
327
|
+
}
|
|
328
|
+
lightningcss::selector::PseudoClass::ReadWrite(v) => {
|
|
329
|
+
lightningcss::selector::PseudoClass::ReadWrite(*v)
|
|
330
|
+
}
|
|
331
|
+
lightningcss::selector::PseudoClass::PlaceholderShown(v) => {
|
|
332
|
+
lightningcss::selector::PseudoClass::PlaceholderShown(*v)
|
|
333
|
+
}
|
|
334
|
+
lightningcss::selector::PseudoClass::Default => {
|
|
335
|
+
lightningcss::selector::PseudoClass::Default
|
|
336
|
+
}
|
|
337
|
+
lightningcss::selector::PseudoClass::Checked => {
|
|
338
|
+
lightningcss::selector::PseudoClass::Checked
|
|
339
|
+
}
|
|
340
|
+
lightningcss::selector::PseudoClass::Indeterminate => {
|
|
341
|
+
lightningcss::selector::PseudoClass::Indeterminate
|
|
342
|
+
}
|
|
343
|
+
lightningcss::selector::PseudoClass::Blank => lightningcss::selector::PseudoClass::Blank,
|
|
344
|
+
lightningcss::selector::PseudoClass::Valid => lightningcss::selector::PseudoClass::Valid,
|
|
345
|
+
lightningcss::selector::PseudoClass::Invalid => {
|
|
346
|
+
lightningcss::selector::PseudoClass::Invalid
|
|
347
|
+
}
|
|
348
|
+
lightningcss::selector::PseudoClass::InRange => {
|
|
349
|
+
lightningcss::selector::PseudoClass::InRange
|
|
350
|
+
}
|
|
351
|
+
lightningcss::selector::PseudoClass::OutOfRange => {
|
|
352
|
+
lightningcss::selector::PseudoClass::OutOfRange
|
|
353
|
+
}
|
|
354
|
+
lightningcss::selector::PseudoClass::Required => {
|
|
355
|
+
lightningcss::selector::PseudoClass::Required
|
|
356
|
+
}
|
|
357
|
+
lightningcss::selector::PseudoClass::Optional => {
|
|
358
|
+
lightningcss::selector::PseudoClass::Optional
|
|
359
|
+
}
|
|
360
|
+
lightningcss::selector::PseudoClass::UserValid => {
|
|
361
|
+
lightningcss::selector::PseudoClass::UserValid
|
|
362
|
+
}
|
|
363
|
+
lightningcss::selector::PseudoClass::UserInvalid => {
|
|
364
|
+
lightningcss::selector::PseudoClass::UserInvalid
|
|
365
|
+
}
|
|
366
|
+
lightningcss::selector::PseudoClass::Autofill(v) => {
|
|
367
|
+
lightningcss::selector::PseudoClass::Autofill(*v)
|
|
368
|
+
}
|
|
369
|
+
lightningcss::selector::PseudoClass::Local { selector } => {
|
|
370
|
+
lightningcss::selector::PseudoClass::Local {
|
|
371
|
+
selector: Box::new(owned_selector(selector)),
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
lightningcss::selector::PseudoClass::Global { selector } => {
|
|
375
|
+
lightningcss::selector::PseudoClass::Global {
|
|
376
|
+
selector: Box::new(owned_selector(selector)),
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
lightningcss::selector::PseudoClass::WebKitScrollbar(v) => {
|
|
380
|
+
lightningcss::selector::PseudoClass::WebKitScrollbar(v.clone())
|
|
381
|
+
}
|
|
382
|
+
lightningcss::selector::PseudoClass::Custom { name } => {
|
|
383
|
+
lightningcss::selector::PseudoClass::Custom {
|
|
384
|
+
name: name.clone().into_owned(),
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
lightningcss::selector::PseudoClass::CustomFunction { name, arguments } => {
|
|
388
|
+
lightningcss::selector::PseudoClass::CustomFunction {
|
|
389
|
+
name: name.clone().into_owned(),
|
|
390
|
+
arguments: owned_token_list(arguments),
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
fn owned_selectors<'i>(ss: &[Selector]) -> Box<[Selector<'i>]> {
|
|
397
|
+
let mut buf: Vec<Selector<'i>> = vec![];
|
|
398
|
+
|
|
399
|
+
for selector in ss.iter() {
|
|
400
|
+
buf.push(owned_selector(selector));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
buf.into_boxed_slice()
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
fn owned_token_list<'i>(t: &TokenList) -> TokenList<'i> {
|
|
407
|
+
TokenList(t.0.iter().map(|v| v.clone().into_owned()).collect())
|
|
408
|
+
}
|
package/transform/src/style.rs
CHANGED