@swc/plugin-styled-jsx 1.5.75 → 1.5.77
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 -2
- package/package.json +1 -1
- package/src/lib.rs +10 -3
- package/swc_plugin_styled_jsx.wasm +0 -0
- package/transform/Cargo.toml +10 -3
- package/transform/src/lib.rs +2 -1
- package/transform/src/transform_css_swc.rs +394 -0
- package/transform/src/visitor.rs +43 -10
- package/transform/tests/errors/nested-style-tags/output.js +31 -4
- package/transform/tests/errors/ts-with-css-resolve/output.js +1 -1
- package/transform/tests/fixture/absent/output.swc.js +7 -0
- package/transform/tests/fixture/attribute-generation-classname-rewriting/output.swc.js +112 -0
- package/transform/tests/fixture/attribute-generation-modes/output.swc.js +228 -0
- package/transform/tests/fixture/class/output.swc.js +12 -0
- package/transform/tests/fixture/comments/output.swc.js +12 -0
- package/transform/tests/fixture/component-attribute/output.swc.js +10 -0
- package/transform/tests/fixture/conflicts/output.swc.js +14 -0
- package/transform/tests/fixture/css-selector-after-pseudo/output.swc.js +11 -0
- package/transform/tests/fixture/css-tag-same-file/output.swc.js +21 -0
- package/transform/tests/fixture/different-jsx-ids/output.swc.js +24 -0
- package/transform/tests/fixture/dynamic-element/output.swc.js +40 -0
- package/transform/tests/fixture/dynamic-element-class/output.swc.js +25 -0
- package/transform/tests/fixture/dynamic-element-external/output.swc.js +12 -0
- package/transform/tests/fixture/dynamic-this-in-arrow/output.swc.js +39 -0
- package/transform/tests/fixture/exported-jsx-style/output.swc.js +1 -0
- package/transform/tests/fixture/exported-non-jsx-style/output.swc.js +1 -0
- package/transform/tests/fixture/external-nested-scope/output.swc.js +7 -0
- package/transform/tests/fixture/external-stylesheet/output.swc.js +34 -0
- package/transform/tests/fixture/external-stylesheet-global/output.swc.js +18 -0
- package/transform/tests/fixture/external-stylesheet-multi-line/output.swc.js +9 -0
- package/transform/tests/fixture/fragment/output.swc.js +47 -0
- package/transform/tests/fixture/global/output.swc.js +7 -0
- package/transform/tests/fixture/global-child-selector/output.swc.js +8 -0
- package/transform/tests/fixture/global-redundant/output.swc.js +10 -0
- package/transform/tests/fixture/issue-30480/output.swc.js +15 -0
- package/transform/tests/fixture/issue-30570/output.swc.js +12 -0
- package/transform/tests/fixture/issue-31562-interpolation-in-mdea/output.swc.js +43 -0
- package/transform/tests/fixture/mixed-global-scoped/output.swc.js +11 -0
- package/transform/tests/fixture/multiple-jsx/output.swc.js +32 -0
- package/transform/tests/fixture/next-54653/output.swc.js +3 -0
- package/transform/tests/fixture/non-styled-jsx-style/output.swc.js +12 -0
- package/transform/tests/fixture/not-styled-jsx-tagged-templates/{output.js → output.lightningcss.js} +1 -2
- package/transform/tests/fixture/not-styled-jsx-tagged-templates/output.swc.js +23 -0
- package/transform/tests/fixture/number-after-placeholder/output.swc.js +17 -0
- package/transform/tests/fixture/one-off-global-selectors/output.swc.js +8 -0
- package/transform/tests/fixture/source-maps/output.swc.js +8 -0
- package/transform/tests/fixture/styles/output.swc.js +39 -0
- package/transform/tests/fixture/styles-external-invalid/output.swc.js +9 -0
- package/transform/tests/fixture/styles-external-invalid2/output.swc.js +8 -0
- package/transform/tests/fixture/styles2/output.swc.js +5 -0
- package/transform/tests/fixture/too-many/output.swc.js +49 -0
- package/transform/tests/fixture/tpl-escape-1/output.swc.js +12 -0
- package/transform/tests/fixture/tpl-escape-2/output.swc.js +17 -0
- package/transform/tests/fixture/tpl-placeholder-1-as-property/output.swc.js +28 -0
- package/transform/tests/fixture/tpl-placeholder-2-as-part-of-value/output.swc.js +34 -0
- package/transform/tests/fixture/tpl-placeholder-3-as-value/output.swc.js +28 -0
- package/transform/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.swc.js +31 -0
- package/transform/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/output.swc.js +31 -0
- package/transform/tests/fixture/transform-css/output.swc.js +8 -0
- package/transform/tests/fixture/transform-css-complex-selector/output.swc.js +8 -0
- package/transform/tests/fixture/transform-css-complex-selector-2/output.swc.js +8 -0
- package/transform/tests/fixture/transform-css-global/output.swc.js +8 -0
- package/transform/tests/fixture/transform-css-media-query/output.swc.js +8 -0
- package/transform/tests/fixture/transform-css-normal/output.swc.js +8 -0
- package/transform/tests/fixture/transform-css-nth-1/output.swc.js +8 -0
- package/transform/tests/fixture/whitespace/output.lightningcss.js +12 -0
- package/transform/tests/fixture/whitespace/output.swc.js +12 -0
- package/transform/tests/fixture.rs +55 -38
- package/transform/tests/fixture/.expressions/output.js +0 -91
- package/transform/tests/fixture/nested-style-tags/output.js +0 -0
- /package/transform/src/{transform_css.rs → transform_css_lightningcss.rs} +0 -0
- /package/transform/tests/fixture/absent/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/attribute-generation-classname-rewriting/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/attribute-generation-modes/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/class/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/comments/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/component-attribute/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/conflicts/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/css-selector-after-pseudo/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/css-tag-same-file/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/different-jsx-ids/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/dynamic-element/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/dynamic-element-class/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/dynamic-element-external/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/dynamic-this-in-arrow/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/exported-jsx-style/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/exported-non-jsx-style/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/external-nested-scope/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/external-stylesheet/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/external-stylesheet-global/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/external-stylesheet-multi-line/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/fragment/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/global/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/global-child-selector/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/global-redundant/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/issue-30480/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/issue-30570/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/issue-31562-interpolation-in-mdea/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/mixed-global-scoped/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/multiple-jsx/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/next-54653/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/non-styled-jsx-style/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/number-after-placeholder/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/one-off-global-selectors/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/source-maps/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/stateless/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/{whitespace/output.js → stateless/output.swc.js} +0 -0
- /package/transform/tests/fixture/styles/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/styles-external-invalid/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/styles-external-invalid2/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/styles2/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/too-many/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/tpl-escape-1/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/tpl-escape-2/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/tpl-placeholder-1-as-property/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/tpl-placeholder-2-as-part-of-value/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/tpl-placeholder-3-as-value/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/transform-css/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/transform-css-complex-selector/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/transform-css-complex-selector-2/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/transform-css-global/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/transform-css-media-query/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/transform-css-normal/{output.js → output.lightningcss.js} +0 -0
- /package/transform/tests/fixture/transform-css-nth-1/{output.js → output.lightningcss.js} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
export default (()=>{
|
|
3
|
+
const Element = 'div';
|
|
4
|
+
return <div className={"jsx-abb4c2202db1a207"}>
|
|
5
|
+
|
|
6
|
+
<div {...test.test} className={"jsx-abb4c2202db1a207" + " " + (test.test && test.test.className != null && test.test.className || "test")}/>
|
|
7
|
+
|
|
8
|
+
<div {...test.test.test} className={"jsx-abb4c2202db1a207" + " " + (test.test.test && test.test.test.className != null && test.test.test.className || "test")}/>
|
|
9
|
+
|
|
10
|
+
<div {...this.test.test} className={"jsx-abb4c2202db1a207" + " " + (this.test.test && this.test.test.className != null && this.test.test.className || "test")}/>
|
|
11
|
+
|
|
12
|
+
<div data-test="test" className={"jsx-abb4c2202db1a207"}/>
|
|
13
|
+
|
|
14
|
+
<div className={"jsx-abb4c2202db1a207" + " " + 'test'}/>
|
|
15
|
+
|
|
16
|
+
<div className={"jsx-abb4c2202db1a207" + " " + `test`}/>
|
|
17
|
+
|
|
18
|
+
<div className={"jsx-abb4c2202db1a207" + " " + `test${true ? ' test2' : ''}`}/>
|
|
19
|
+
|
|
20
|
+
<div className={"jsx-abb4c2202db1a207" + " " + ('test ' + test || "")}/>
|
|
21
|
+
|
|
22
|
+
<div className={"jsx-abb4c2202db1a207" + " " + ([
|
|
23
|
+
'test',
|
|
24
|
+
'test2'
|
|
25
|
+
].join(' ') || "")}/>
|
|
26
|
+
|
|
27
|
+
<div className={"jsx-abb4c2202db1a207" + " " + (true && 'test' || "")}/>
|
|
28
|
+
|
|
29
|
+
<div className={"jsx-abb4c2202db1a207" + " " + ((test ? 'test' : null) || "")}/>
|
|
30
|
+
|
|
31
|
+
<div className={"jsx-abb4c2202db1a207" + " " + (test || "")}/>
|
|
32
|
+
|
|
33
|
+
<div className={"jsx-abb4c2202db1a207" + " " + (test && 'test' || "")}/>
|
|
34
|
+
|
|
35
|
+
<div className={"jsx-abb4c2202db1a207" + " " + (test && test('test') || "")}/>
|
|
36
|
+
|
|
37
|
+
<div className={"jsx-abb4c2202db1a207" + " " + (undefined || "")}/>
|
|
38
|
+
|
|
39
|
+
<div className={"jsx-abb4c2202db1a207" + " " + (null || "")}/>
|
|
40
|
+
|
|
41
|
+
<div className={"jsx-abb4c2202db1a207" + " " + (false || "")}/>
|
|
42
|
+
|
|
43
|
+
<div data-test className={"jsx-abb4c2202db1a207" + " " + 'test'}/>
|
|
44
|
+
|
|
45
|
+
<div data-test className={"jsx-abb4c2202db1a207" + " " + 'test'}/>
|
|
46
|
+
|
|
47
|
+
<div data-test="test" className={"jsx-abb4c2202db1a207" + " " + 'test'}/>
|
|
48
|
+
|
|
49
|
+
<div {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || 'test')}/>
|
|
50
|
+
|
|
51
|
+
<div {...props} {...rest} className={"jsx-abb4c2202db1a207" + " " + (rest && rest.className != null && rest.className || props && props.className != null && props.className || 'test')}/>
|
|
52
|
+
|
|
53
|
+
<div {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || `test ${test ? 'test' : ''}`)}/>
|
|
54
|
+
|
|
55
|
+
<div {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || test && test('test') || "")}/>
|
|
56
|
+
|
|
57
|
+
<div {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || test && test('test') && 'test' || "")}/>
|
|
58
|
+
|
|
59
|
+
<div {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || test && test('test') && test2('test') || "")}/>
|
|
60
|
+
|
|
61
|
+
<div {...props} className={"jsx-abb4c2202db1a207" + " " + 'test'}/>
|
|
62
|
+
|
|
63
|
+
<div {...props} {...rest} className={"jsx-abb4c2202db1a207" + " " + 'test'}/>
|
|
64
|
+
|
|
65
|
+
<div {...props} {...rest} className={"jsx-abb4c2202db1a207" + " " + (rest && rest.className != null && rest.className || 'test')}/>
|
|
66
|
+
|
|
67
|
+
<div {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || "")}/>
|
|
68
|
+
|
|
69
|
+
<div {...props} {...rest} className={"jsx-abb4c2202db1a207" + " " + (rest && rest.className != null && rest.className || props && props.className != null && props.className || "")}/>
|
|
70
|
+
|
|
71
|
+
<div {...props} data-foo {...rest} className={"jsx-abb4c2202db1a207" + " " + (rest && rest.className != null && rest.className || props && props.className != null && props.className || "")}/>
|
|
72
|
+
|
|
73
|
+
<div {...props} data-foo {...rest} className={"jsx-abb4c2202db1a207" + " " + (rest && rest.className != null && rest.className || 'test')}/>
|
|
74
|
+
|
|
75
|
+
<div {...{
|
|
76
|
+
id: 'foo'
|
|
77
|
+
}} className={"jsx-abb4c2202db1a207"}/>
|
|
78
|
+
|
|
79
|
+
<div className={"jsx-abb4c2202db1a207" + " " + 'foo'}/>
|
|
80
|
+
|
|
81
|
+
<div {...{
|
|
82
|
+
className: 'foo'
|
|
83
|
+
}} className={"jsx-abb4c2202db1a207" + " " + "test"}/>
|
|
84
|
+
|
|
85
|
+
<div className="test" className={"jsx-abb4c2202db1a207" + " " + 'foo'}/>
|
|
86
|
+
|
|
87
|
+
<div {...bar} className={"jsx-abb4c2202db1a207" + " " + (bar && bar.className != null && bar.className || 'foo')}/>
|
|
88
|
+
|
|
89
|
+
<div {...{
|
|
90
|
+
className: 'foo'
|
|
91
|
+
}} {...bar} className={"jsx-abb4c2202db1a207" + " " + "test"}/>
|
|
92
|
+
|
|
93
|
+
<div className="test" {...bar} className={"jsx-abb4c2202db1a207" + " " + (bar && bar.className != null && bar.className || 'foo')}/>
|
|
94
|
+
|
|
95
|
+
<div className="test" className={"jsx-abb4c2202db1a207" + " " + (props.className || "")}/>
|
|
96
|
+
|
|
97
|
+
<div className="test" {...bar} className={"jsx-abb4c2202db1a207" + " " + (bar && bar.className != null && bar.className || props.className || "")}/>
|
|
98
|
+
|
|
99
|
+
<div className="test" {...bar} className={"jsx-abb4c2202db1a207" + " " + (props.className || "")}/>
|
|
100
|
+
|
|
101
|
+
<div {...bar()} className={"jsx-abb4c2202db1a207" + " " + "test"}/>
|
|
102
|
+
|
|
103
|
+
<Element className={"jsx-abb4c2202db1a207"}/>
|
|
104
|
+
|
|
105
|
+
<Element className={"jsx-abb4c2202db1a207" + " " + "test"}/>
|
|
106
|
+
|
|
107
|
+
<Element {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || "")}/>
|
|
108
|
+
|
|
109
|
+
<_JSXStyle id={"abb4c2202db1a207"}>{"div.jsx-abb4c2202db1a207{color:red}"}</_JSXStyle>
|
|
110
|
+
|
|
111
|
+
</div>;
|
|
112
|
+
});
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import styles from './styles';
|
|
3
|
+
const styles2 = require('./styles2');
|
|
4
|
+
// external only
|
|
5
|
+
export const Test1 = ()=><div className={`jsx-${styles2.__hash} jsx-${styles.__hash}`}>
|
|
6
|
+
|
|
7
|
+
<p className={`jsx-${styles2.__hash} jsx-${styles.__hash}`}>external only</p>
|
|
8
|
+
|
|
9
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
10
|
+
|
|
11
|
+
<_JSXStyle id={styles2.__hash}>{styles2}</_JSXStyle>
|
|
12
|
+
|
|
13
|
+
</div>;
|
|
14
|
+
// external and static
|
|
15
|
+
export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles.__hash}`}>
|
|
16
|
+
|
|
17
|
+
<p className={"jsx-81a68341e430a972 " + `jsx-${styles.__hash}`}>external and static</p>
|
|
18
|
+
|
|
19
|
+
<_JSXStyle id={"81a68341e430a972"}>{"p.jsx-81a68341e430a972{color:red}"}</_JSXStyle>
|
|
20
|
+
|
|
21
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
22
|
+
|
|
23
|
+
</div>;
|
|
24
|
+
// external and dynamic
|
|
25
|
+
export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
|
|
26
|
+
[
|
|
27
|
+
"f08108daf927b99d",
|
|
28
|
+
[
|
|
29
|
+
color
|
|
30
|
+
]
|
|
31
|
+
]
|
|
32
|
+
])}>
|
|
33
|
+
|
|
34
|
+
<p className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
|
|
35
|
+
[
|
|
36
|
+
"f08108daf927b99d",
|
|
37
|
+
[
|
|
38
|
+
color
|
|
39
|
+
]
|
|
40
|
+
]
|
|
41
|
+
])}>external and dynamic</p>
|
|
42
|
+
|
|
43
|
+
<_JSXStyle id={"f08108daf927b99d"} dynamic={[
|
|
44
|
+
color
|
|
45
|
+
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
|
|
46
|
+
|
|
47
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
48
|
+
|
|
49
|
+
</div>;
|
|
50
|
+
// external, static and dynamic
|
|
51
|
+
export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
|
|
52
|
+
[
|
|
53
|
+
"9779eebad83219f8",
|
|
54
|
+
[
|
|
55
|
+
color
|
|
56
|
+
]
|
|
57
|
+
]
|
|
58
|
+
])}>
|
|
59
|
+
|
|
60
|
+
<p className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
|
|
61
|
+
[
|
|
62
|
+
"9779eebad83219f8",
|
|
63
|
+
[
|
|
64
|
+
color
|
|
65
|
+
]
|
|
66
|
+
]
|
|
67
|
+
])}>external, static and dynamic</p>
|
|
68
|
+
|
|
69
|
+
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
|
|
70
|
+
|
|
71
|
+
<_JSXStyle id={"9779eebad83219f8"} dynamic={[
|
|
72
|
+
color
|
|
73
|
+
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
|
|
74
|
+
|
|
75
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
76
|
+
|
|
77
|
+
</div>;
|
|
78
|
+
// static only
|
|
79
|
+
export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}>
|
|
80
|
+
|
|
81
|
+
<p className={"jsx-df0159ebd3f9fb6f"}>static only</p>
|
|
82
|
+
|
|
83
|
+
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-df0159ebd3f9fb6f{display:inline-block}"}</_JSXStyle>
|
|
84
|
+
|
|
85
|
+
<_JSXStyle id={"81a68341e430a972"}>{"p.jsx-df0159ebd3f9fb6f{color:red}"}</_JSXStyle>
|
|
86
|
+
|
|
87
|
+
</div>;
|
|
88
|
+
// static and dynamic
|
|
89
|
+
export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
|
|
90
|
+
[
|
|
91
|
+
"9779eebad83219f8",
|
|
92
|
+
[
|
|
93
|
+
color
|
|
94
|
+
]
|
|
95
|
+
]
|
|
96
|
+
])}>
|
|
97
|
+
|
|
98
|
+
<p className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
|
|
99
|
+
[
|
|
100
|
+
"9779eebad83219f8",
|
|
101
|
+
[
|
|
102
|
+
color
|
|
103
|
+
]
|
|
104
|
+
]
|
|
105
|
+
])}>static and dynamic</p>
|
|
106
|
+
|
|
107
|
+
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
|
|
108
|
+
|
|
109
|
+
<_JSXStyle id={"9779eebad83219f8"} dynamic={[
|
|
110
|
+
color
|
|
111
|
+
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
|
|
112
|
+
|
|
113
|
+
</div>;
|
|
114
|
+
// dynamic only
|
|
115
|
+
export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
|
|
116
|
+
[
|
|
117
|
+
"f08108daf927b99d",
|
|
118
|
+
[
|
|
119
|
+
color
|
|
120
|
+
]
|
|
121
|
+
]
|
|
122
|
+
])}>
|
|
123
|
+
|
|
124
|
+
<p className={_JSXStyle.dynamic([
|
|
125
|
+
[
|
|
126
|
+
"f08108daf927b99d",
|
|
127
|
+
[
|
|
128
|
+
color
|
|
129
|
+
]
|
|
130
|
+
]
|
|
131
|
+
])}>dynamic only</p>
|
|
132
|
+
|
|
133
|
+
<_JSXStyle id={"f08108daf927b99d"} dynamic={[
|
|
134
|
+
color
|
|
135
|
+
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
|
|
136
|
+
|
|
137
|
+
</div>;
|
|
138
|
+
// dynamic with scoped compound variable
|
|
139
|
+
export const Test8 = ({ color })=>{
|
|
140
|
+
if (color) {
|
|
141
|
+
const innerProps = {
|
|
142
|
+
color
|
|
143
|
+
};
|
|
144
|
+
return <div className={_JSXStyle.dynamic([
|
|
145
|
+
[
|
|
146
|
+
"62256c563b89bfae",
|
|
147
|
+
[
|
|
148
|
+
innerProps.color
|
|
149
|
+
]
|
|
150
|
+
]
|
|
151
|
+
])}>
|
|
152
|
+
|
|
153
|
+
<p className={_JSXStyle.dynamic([
|
|
154
|
+
[
|
|
155
|
+
"62256c563b89bfae",
|
|
156
|
+
[
|
|
157
|
+
innerProps.color
|
|
158
|
+
]
|
|
159
|
+
]
|
|
160
|
+
])}>dynamic with scoped compound variable</p>
|
|
161
|
+
|
|
162
|
+
<_JSXStyle id={"62256c563b89bfae"} dynamic={[
|
|
163
|
+
innerProps.color
|
|
164
|
+
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
|
|
165
|
+
|
|
166
|
+
</div>;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
// dynamic with compound variable
|
|
170
|
+
export const Test9 = ({ color })=>{
|
|
171
|
+
const innerProps = {
|
|
172
|
+
color
|
|
173
|
+
};
|
|
174
|
+
return <div className={_JSXStyle.dynamic([
|
|
175
|
+
[
|
|
176
|
+
"708723e452f192e4",
|
|
177
|
+
[
|
|
178
|
+
innerProps.color
|
|
179
|
+
]
|
|
180
|
+
]
|
|
181
|
+
])}>
|
|
182
|
+
|
|
183
|
+
<p className={_JSXStyle.dynamic([
|
|
184
|
+
[
|
|
185
|
+
"708723e452f192e4",
|
|
186
|
+
[
|
|
187
|
+
innerProps.color
|
|
188
|
+
]
|
|
189
|
+
]
|
|
190
|
+
])}>dynamic with compound variable</p>
|
|
191
|
+
|
|
192
|
+
<_JSXStyle id={"708723e452f192e4"} dynamic={[
|
|
193
|
+
innerProps.color
|
|
194
|
+
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
|
|
195
|
+
|
|
196
|
+
</div>;
|
|
197
|
+
};
|
|
198
|
+
const foo = 'red';
|
|
199
|
+
// dynamic with constant variable
|
|
200
|
+
export const Test10 = ()=><div className={"jsx-f849b7a02be96503"}>
|
|
201
|
+
|
|
202
|
+
<p className={"jsx-f849b7a02be96503"}>dynamic with constant variable</p>
|
|
203
|
+
|
|
204
|
+
<_JSXStyle id={"f849b7a02be96503"}>{`p.jsx-f849b7a02be96503{color:${foo}}`}</_JSXStyle>
|
|
205
|
+
|
|
206
|
+
</div>;
|
|
207
|
+
// dynamic with complex scope
|
|
208
|
+
export const Test11 = ({ color })=>{
|
|
209
|
+
const items = Array.from({
|
|
210
|
+
length: 5
|
|
211
|
+
}).map((item, i)=><li key={i} className={_JSXStyle.dynamic([
|
|
212
|
+
[
|
|
213
|
+
"a2585dff420632b1",
|
|
214
|
+
[
|
|
215
|
+
color
|
|
216
|
+
]
|
|
217
|
+
]
|
|
218
|
+
]) + " " + "item"}>
|
|
219
|
+
|
|
220
|
+
<_JSXStyle id={"a2585dff420632b1"} dynamic={[
|
|
221
|
+
color
|
|
222
|
+
]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
|
|
223
|
+
|
|
224
|
+
Item #{i + 1}
|
|
225
|
+
|
|
226
|
+
</li>);
|
|
227
|
+
return <ul className="items">{items}</ul>;
|
|
228
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
export default class {
|
|
3
|
+
render() {
|
|
4
|
+
return <div className={"jsx-b2b86d63f35d25ee"}>
|
|
5
|
+
|
|
6
|
+
<p className={"jsx-b2b86d63f35d25ee"}>test</p>
|
|
7
|
+
|
|
8
|
+
<_JSXStyle id={"b2b86d63f35d25ee"}>{"p.jsx-b2b86d63f35d25ee{color:red}"}</_JSXStyle>
|
|
9
|
+
|
|
10
|
+
</div>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
export default class {
|
|
3
|
+
render() {
|
|
4
|
+
return <div className={"jsx-1952086b0a5ae64c"}>
|
|
5
|
+
|
|
6
|
+
<p className={"jsx-1952086b0a5ae64c"}>test</p>
|
|
7
|
+
|
|
8
|
+
<_JSXStyle id={"1952086b0a5ae64c"}>{"p.jsx-1952086b0a5ae64c{color:red}"}</_JSXStyle>
|
|
9
|
+
|
|
10
|
+
</div>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
const Test = ()=><div className={"jsx-a9535d7d5f32c3c4"}>
|
|
3
|
+
|
|
4
|
+
<span className={"jsx-a9535d7d5f32c3c4"}>test</span>
|
|
5
|
+
|
|
6
|
+
<Component/>
|
|
7
|
+
|
|
8
|
+
<_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}</_JSXStyle>
|
|
9
|
+
|
|
10
|
+
</div>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
function NavigationItem({ active, className }) {
|
|
3
|
+
return <span className={"jsx-2342aae4628612c6" + " " + (cn({
|
|
4
|
+
active
|
|
5
|
+
}, className, 'navigation-item') || "")}>
|
|
6
|
+
|
|
7
|
+
<_JSXStyle id={"2342aae4628612c6"}>{'.navigation-item.jsx-2342aae4628612c6 a::after{content:attr(data-text);content:attr(data-text)/""}'}</_JSXStyle>
|
|
8
|
+
|
|
9
|
+
</span>;
|
|
10
|
+
}
|
|
11
|
+
export default NavigationItem;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
export default (({ children })=><div className={`jsx-${styles.__hash}`}>
|
|
3
|
+
|
|
4
|
+
<p className={`jsx-${styles.__hash}`}>{children}</p>
|
|
5
|
+
|
|
6
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
7
|
+
|
|
8
|
+
</div>);
|
|
9
|
+
const styles = new String("p.jsx-556239d258b6d66a{color:red}");
|
|
10
|
+
styles.__hash = "556239d258b6d66a";
|
|
11
|
+
class Test extends React.Component {
|
|
12
|
+
render() {
|
|
13
|
+
return <div className={`jsx-${styles.__hash}`}>
|
|
14
|
+
|
|
15
|
+
<p className={`jsx-${styles.__hash}`}>{this.props.children}</p>
|
|
16
|
+
|
|
17
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
18
|
+
|
|
19
|
+
</div>;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
const color = 'red';
|
|
3
|
+
const otherColor = 'green';
|
|
4
|
+
const A = ()=><div className={"jsx-8522d6f4b7f930d2"}>
|
|
5
|
+
|
|
6
|
+
<p className={"jsx-8522d6f4b7f930d2"}>test</p>
|
|
7
|
+
|
|
8
|
+
<_JSXStyle id={"8522d6f4b7f930d2"}>{`p.jsx-8522d6f4b7f930d2{color:${color}}`}</_JSXStyle>
|
|
9
|
+
|
|
10
|
+
</div>;
|
|
11
|
+
const B = ()=><div className={"jsx-d1ed441bb35f699d"}>
|
|
12
|
+
|
|
13
|
+
<p className={"jsx-d1ed441bb35f699d"}>test</p>
|
|
14
|
+
|
|
15
|
+
<_JSXStyle id={"d1ed441bb35f699d"}>{`p.jsx-d1ed441bb35f699d{color:${otherColor}}`}</_JSXStyle>
|
|
16
|
+
|
|
17
|
+
</div>;
|
|
18
|
+
export default (()=><div>
|
|
19
|
+
|
|
20
|
+
<A/>
|
|
21
|
+
|
|
22
|
+
<B/>
|
|
23
|
+
|
|
24
|
+
</div>);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
export default (({ level = 1 })=>{
|
|
3
|
+
const Element = `h${level}`;
|
|
4
|
+
return <Element className={"jsx-fca64cc3f069b519" + " " + "root"}>
|
|
5
|
+
|
|
6
|
+
<p className={"jsx-fca64cc3f069b519"}>dynamic element</p>
|
|
7
|
+
|
|
8
|
+
<_JSXStyle id={"fca64cc3f069b519"}>{".root.jsx-fca64cc3f069b519{background:red}"}</_JSXStyle>
|
|
9
|
+
|
|
10
|
+
</Element>;
|
|
11
|
+
});
|
|
12
|
+
export const TestLowerCase = ({ level = 1 })=>{
|
|
13
|
+
const element = `h${level}`;
|
|
14
|
+
return <element className={"jsx-fca64cc3f069b519" + " " + "root"}>
|
|
15
|
+
|
|
16
|
+
<p className={"jsx-fca64cc3f069b519"}>dynamic element</p>
|
|
17
|
+
|
|
18
|
+
<_JSXStyle id={"fca64cc3f069b519"}>{".root.jsx-fca64cc3f069b519{background:red}"}</_JSXStyle>
|
|
19
|
+
|
|
20
|
+
</element>;
|
|
21
|
+
};
|
|
22
|
+
const Element2 = 'div';
|
|
23
|
+
export const Test2 = ()=>{
|
|
24
|
+
return <Element2 className="root">
|
|
25
|
+
|
|
26
|
+
<p className={"jsx-fca64cc3f069b519"}>dynamic element</p>
|
|
27
|
+
|
|
28
|
+
<_JSXStyle id={"fca64cc3f069b519"}>{".root.jsx-fca64cc3f069b519{background:red}"}</_JSXStyle>
|
|
29
|
+
|
|
30
|
+
</Element2>;
|
|
31
|
+
};
|
|
32
|
+
export const Test3 = ({ Component = 'div' })=>{
|
|
33
|
+
return <Component className={"jsx-f825b24bbab5b83b"}>
|
|
34
|
+
|
|
35
|
+
<p className={"jsx-f825b24bbab5b83b"}>dynamic element</p>
|
|
36
|
+
|
|
37
|
+
<_JSXStyle id={"f825b24bbab5b83b"}>{".root.jsx-f825b24bbab5b83b{background:red}"}</_JSXStyle>
|
|
38
|
+
|
|
39
|
+
</Component>;
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
export default class {
|
|
3
|
+
render() {
|
|
4
|
+
const Element = 'div';
|
|
5
|
+
return <Element className={"jsx-f825b24bbab5b83b" + " " + "root"}>
|
|
6
|
+
|
|
7
|
+
<p className={"jsx-f825b24bbab5b83b"}>dynamic element</p>
|
|
8
|
+
|
|
9
|
+
<_JSXStyle id={"f825b24bbab5b83b"}>{".root.jsx-f825b24bbab5b83b{background:red}"}</_JSXStyle>
|
|
10
|
+
|
|
11
|
+
</Element>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const Element2 = 'div';
|
|
15
|
+
export const Test2 = class {
|
|
16
|
+
render() {
|
|
17
|
+
return <Element2 className="root">
|
|
18
|
+
|
|
19
|
+
<p className={"jsx-f825b24bbab5b83b"}>dynamic element</p>
|
|
20
|
+
|
|
21
|
+
<_JSXStyle id={"f825b24bbab5b83b"}>{".root.jsx-f825b24bbab5b83b{background:red}"}</_JSXStyle>
|
|
22
|
+
|
|
23
|
+
</Element2>;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import styles from './styles2';
|
|
3
|
+
export default (({ level = 1 })=>{
|
|
4
|
+
const Element = `h${level}`;
|
|
5
|
+
return <Element className={`jsx-${styles.__hash}` + " " + "root"}>
|
|
6
|
+
|
|
7
|
+
<p className={`jsx-${styles.__hash}`}>dynamic element</p>
|
|
8
|
+
|
|
9
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
10
|
+
|
|
11
|
+
</Element>;
|
|
12
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// TODO
|
|
2
|
+
// import React, { Component } from 'react'
|
|
3
|
+
// export default class Index extends Component {
|
|
4
|
+
// static getInitialProps() {
|
|
5
|
+
// return { color: 'aquamarine' }
|
|
6
|
+
// }
|
|
7
|
+
// render() {
|
|
8
|
+
// return (
|
|
9
|
+
// <div>
|
|
10
|
+
// {[1, 2].map(idx => (
|
|
11
|
+
// <div key={idx}>
|
|
12
|
+
// {[3, 4].map(idx2 => (
|
|
13
|
+
// <div key={idx2}>{this.props.color}</div>
|
|
14
|
+
// ))}
|
|
15
|
+
// </div>
|
|
16
|
+
// ))}
|
|
17
|
+
// {[1, 2].map(idx => (
|
|
18
|
+
// <div key={idx}>
|
|
19
|
+
// <div>
|
|
20
|
+
// {this.props.color}
|
|
21
|
+
// <div className="something">
|
|
22
|
+
// <React.Fragment>
|
|
23
|
+
// <div>
|
|
24
|
+
// <div>{this.props.color} hello there</div>
|
|
25
|
+
// </div>
|
|
26
|
+
// </React.Fragment>
|
|
27
|
+
// </div>
|
|
28
|
+
// </div>
|
|
29
|
+
// </div>
|
|
30
|
+
// ))}
|
|
31
|
+
// <style jsx>{`
|
|
32
|
+
// div {
|
|
33
|
+
// background: ${this.props.color};
|
|
34
|
+
// }
|
|
35
|
+
// `}</style>
|
|
36
|
+
// </div>
|
|
37
|
+
// )
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// module.exports = () => <p><style jsx>{`p { color:red; }`}</style></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// module.exports = () => <p><style>{`p { color:red; }`}</style></p>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import styles from './styles';
|
|
3
|
+
const styles2 = require('./styles2');
|
|
4
|
+
import { foo as styles3 } from './styles';
|
|
5
|
+
export default (()=><div className={"jsx-bee92b62eadf8a14 " + `jsx-${styles.__hash} jsx-${styles3.__hash}`}>
|
|
6
|
+
|
|
7
|
+
<p className={"jsx-bee92b62eadf8a14 " + `jsx-${styles.__hash} jsx-${styles3.__hash}` + " " + "foo"}>test</p>
|
|
8
|
+
|
|
9
|
+
<p className={"jsx-bee92b62eadf8a14 " + `jsx-${styles.__hash} jsx-${styles3.__hash}`}>woot</p>
|
|
10
|
+
|
|
11
|
+
<_JSXStyle id={styles2.__hash}>{styles2}</_JSXStyle>
|
|
12
|
+
|
|
13
|
+
<_JSXStyle id={styles3.__hash}>{styles3}</_JSXStyle>
|
|
14
|
+
|
|
15
|
+
<div className={"jsx-bee92b62eadf8a14 " + `jsx-${styles.__hash} jsx-${styles3.__hash}`}>woot</div>
|
|
16
|
+
|
|
17
|
+
<_JSXStyle id={"bee92b62eadf8a14"}>{"p.jsx-bee92b62eadf8a14{color:red}div.jsx-bee92b62eadf8a14{color:green}"}</_JSXStyle>
|
|
18
|
+
|
|
19
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
20
|
+
|
|
21
|
+
</div>);
|
|
22
|
+
export const Test = ()=><div className={"jsx-bee92b62eadf8a14 " + `jsx-${styles3.__hash}`}>
|
|
23
|
+
|
|
24
|
+
<p className={"jsx-bee92b62eadf8a14 " + `jsx-${styles3.__hash}` + " " + "foo"}>test</p>
|
|
25
|
+
|
|
26
|
+
<p className={"jsx-bee92b62eadf8a14 " + `jsx-${styles3.__hash}`}>woot</p>
|
|
27
|
+
|
|
28
|
+
<_JSXStyle id={styles3.__hash}>{styles3}</_JSXStyle>
|
|
29
|
+
|
|
30
|
+
<div className={"jsx-bee92b62eadf8a14 " + `jsx-${styles3.__hash}`}>woot</div>
|
|
31
|
+
|
|
32
|
+
<_JSXStyle id={"bee92b62eadf8a14"}>{"p.jsx-bee92b62eadf8a14{color:red}div.jsx-bee92b62eadf8a14{color:green}"}</_JSXStyle>
|
|
33
|
+
|
|
34
|
+
</div>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import styles, { foo as styles3 } from './styles';
|
|
3
|
+
const styles2 = require('./styles2');
|
|
4
|
+
export default (()=><div>
|
|
5
|
+
|
|
6
|
+
<p>test</p>
|
|
7
|
+
|
|
8
|
+
<div>woot</div>
|
|
9
|
+
|
|
10
|
+
<p>woot</p>
|
|
11
|
+
|
|
12
|
+
<_JSXStyle id={styles2.__hash}>{styles2}</_JSXStyle>
|
|
13
|
+
|
|
14
|
+
<_JSXStyle id={styles3.__hash}>{styles3}</_JSXStyle>
|
|
15
|
+
|
|
16
|
+
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
|
|
17
|
+
|
|
18
|
+
</div>);
|