@swc/plugin-styled-jsx 1.3.0 → 1.5.2

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.
Files changed (139) hide show
  1. package/Cargo.toml +23 -8
  2. package/package.json +1 -1
  3. package/src/lib.rs +9 -1
  4. package/src/style.rs +21 -0
  5. package/src/transform_css.rs +530 -0
  6. package/src/utils.rs +370 -0
  7. package/src/visitor.rs +921 -0
  8. package/swc_plugin_styled_jsx.wasm +0 -0
  9. package/tests/errors/nested-style-tags/input.js +31 -0
  10. package/tests/errors/nested-style-tags/output.js +31 -0
  11. package/tests/errors/nested-style-tags/output.stderr +21 -0
  12. package/tests/errors/no-child/input.js +6 -0
  13. package/tests/errors/no-child/output.js +8 -0
  14. package/tests/errors/no-child/output.stderr +7 -0
  15. package/tests/errors/ts-with-css-resolve/input.js +10 -0
  16. package/tests/errors/ts-with-css-resolve/output.js +5 -0
  17. package/tests/errors/ts-with-css-resolve/output.stderr +2 -0
  18. package/tests/errors/two-children/input.js +8 -0
  19. package/tests/errors/two-children/output.js +12 -0
  20. package/tests/errors/two-children/output.stderr +9 -0
  21. package/tests/errors/wrong-child-type/input.js +7 -0
  22. package/tests/errors/wrong-child-type/output.js +10 -0
  23. package/tests/errors/wrong-child-type/output.stderr +8 -0
  24. package/tests/errors/wrong-jsx-expression-type/input.js +7 -0
  25. package/tests/errors/wrong-jsx-expression-type/output.js +10 -0
  26. package/tests/errors/wrong-jsx-expression-type/output.stderr +8 -0
  27. package/tests/fixture/absent/input.js +6 -0
  28. package/tests/fixture/absent/output.js +7 -0
  29. package/tests/fixture/attribute-generation-classname-rewriting/input.js +55 -0
  30. package/tests/fixture/attribute-generation-classname-rewriting/output.js +112 -0
  31. package/tests/fixture/attribute-generation-modes/input.js +166 -0
  32. package/tests/fixture/attribute-generation-modes/output.js +228 -0
  33. package/tests/fixture/class/input.js +14 -0
  34. package/tests/fixture/class/output.js +12 -0
  35. package/tests/fixture/comments/input.js +18 -0
  36. package/tests/fixture/comments/output.js +12 -0
  37. package/tests/fixture/component-attribute/input.js +11 -0
  38. package/tests/fixture/component-attribute/output.js +10 -0
  39. package/tests/fixture/conflicts/input.js +16 -0
  40. package/tests/fixture/conflicts/output.js +14 -0
  41. package/tests/fixture/css-selector-after-pseudo/input.js +18 -0
  42. package/tests/fixture/css-selector-after-pseudo/output.js +11 -0
  43. package/tests/fixture/css-tag-same-file/input.js +25 -0
  44. package/tests/fixture/css-tag-same-file/output.js +21 -0
  45. package/tests/fixture/different-jsx-ids/input.js +23 -0
  46. package/tests/fixture/different-jsx-ids/output.js +24 -0
  47. package/tests/fixture/dynamic-element/input.js +56 -0
  48. package/tests/fixture/dynamic-element/output.js +40 -0
  49. package/tests/fixture/dynamic-element-class/input.js +32 -0
  50. package/tests/fixture/dynamic-element-class/output.js +25 -0
  51. package/tests/fixture/dynamic-element-external/input.js +12 -0
  52. package/tests/fixture/dynamic-element-external/output.js +12 -0
  53. package/tests/fixture/dynamic-this-in-arrow/input.js +41 -0
  54. package/tests/fixture/dynamic-this-in-arrow/output.js +39 -0
  55. package/tests/fixture/exported-jsx-style/input.js +1 -0
  56. package/tests/fixture/exported-jsx-style/output.js +1 -0
  57. package/tests/fixture/exported-non-jsx-style/input.js +1 -0
  58. package/tests/fixture/exported-non-jsx-style/output.js +1 -0
  59. package/tests/fixture/expressions/input.js +90 -0
  60. package/tests/fixture/expressions/output.js +91 -0
  61. package/tests/fixture/external-nested-scope/input.js +5 -0
  62. package/tests/fixture/external-nested-scope/output.js +7 -0
  63. package/tests/fixture/external-stylesheet/input.js +41 -0
  64. package/tests/fixture/external-stylesheet/output.js +34 -0
  65. package/tests/fixture/external-stylesheet-global/input.js +19 -0
  66. package/tests/fixture/external-stylesheet-global/output.js +18 -0
  67. package/tests/fixture/external-stylesheet-multi-line/input.js +9 -0
  68. package/tests/fixture/external-stylesheet-multi-line/output.js +9 -0
  69. package/tests/fixture/fragment/input.js +51 -0
  70. package/tests/fixture/fragment/output.js +47 -0
  71. package/tests/fixture/global/input.js +22 -0
  72. package/tests/fixture/global/output.js +7 -0
  73. package/tests/fixture/global-child-selector/input.js +10 -0
  74. package/tests/fixture/global-child-selector/output.js +8 -0
  75. package/tests/fixture/global-redundant/input.js +12 -0
  76. package/tests/fixture/global-redundant/output.js +10 -0
  77. package/tests/fixture/issue-30480/input.js +7 -0
  78. package/tests/fixture/issue-30480/output.js +15 -0
  79. package/tests/fixture/issue-30570/input.js +15 -0
  80. package/tests/fixture/issue-30570/output.js +12 -0
  81. package/tests/fixture/issue-31562-interpolation-in-mdea/input.js +30 -0
  82. package/tests/fixture/issue-31562-interpolation-in-mdea/output.js +43 -0
  83. package/tests/fixture/mixed-global-scoped/input.js +9 -0
  84. package/tests/fixture/mixed-global-scoped/output.js +11 -0
  85. package/tests/fixture/multiple-jsx/input.js +43 -0
  86. package/tests/fixture/multiple-jsx/output.js +32 -0
  87. package/tests/fixture/nested-style-tags/index.js +0 -0
  88. package/tests/fixture/nested-style-tags/output.js +0 -0
  89. package/tests/fixture/non-styled-jsx-style/input.js +7 -0
  90. package/tests/fixture/non-styled-jsx-style/output.js +12 -0
  91. package/tests/fixture/not-styled-jsx-tagged-templates/input.js +30 -0
  92. package/tests/fixture/not-styled-jsx-tagged-templates/output.js +24 -0
  93. package/tests/fixture/number-after-placeholder/input.js +17 -0
  94. package/tests/fixture/number-after-placeholder/output.js +17 -0
  95. package/tests/fixture/one-off-global-selectors/input.js +10 -0
  96. package/tests/fixture/one-off-global-selectors/output.js +8 -0
  97. package/tests/fixture/source-maps/input.js +8 -0
  98. package/tests/fixture/source-maps/output.js +8 -0
  99. package/tests/fixture/stateless/input.js +8 -0
  100. package/tests/fixture/stateless/output.js +12 -0
  101. package/tests/fixture/styles/input.js +57 -0
  102. package/tests/fixture/styles/output.js +39 -0
  103. package/tests/fixture/styles-external-invalid/input.js +13 -0
  104. package/tests/fixture/styles-external-invalid/output.js +9 -0
  105. package/tests/fixture/styles-external-invalid2/input.js +11 -0
  106. package/tests/fixture/styles-external-invalid2/output.js +8 -0
  107. package/tests/fixture/styles2/input.js +6 -0
  108. package/tests/fixture/styles2/output.js +5 -0
  109. package/tests/fixture/too-many/input.js +35 -0
  110. package/tests/fixture/too-many/output.js +49 -0
  111. package/tests/fixture/tpl-escape-1/input.js +14 -0
  112. package/tests/fixture/tpl-escape-1/output.js +12 -0
  113. package/tests/fixture/tpl-escape-2/input.js +17 -0
  114. package/tests/fixture/tpl-escape-2/output.js +17 -0
  115. package/tests/fixture/tpl-placeholder-1-as-property/input.js +17 -0
  116. package/tests/fixture/tpl-placeholder-1-as-property/output.js +29 -0
  117. package/tests/fixture/tpl-placeholder-2-as-part-of-value/input.js +21 -0
  118. package/tests/fixture/tpl-placeholder-2-as-part-of-value/output.js +34 -0
  119. package/tests/fixture/tpl-placeholder-3-as-value/input.js +17 -0
  120. package/tests/fixture/tpl-placeholder-3-as-value/output.js +28 -0
  121. package/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/input.js +17 -0
  122. package/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.js +31 -0
  123. package/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/input.js +16 -0
  124. package/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/output.js +31 -0
  125. package/tests/fixture/transform-css/input.js +176 -0
  126. package/tests/fixture/transform-css/output.js +8 -0
  127. package/tests/fixture/transform-css-complex-selector/input.js +116 -0
  128. package/tests/fixture/transform-css-complex-selector/output.js +8 -0
  129. package/tests/fixture/transform-css-global/input.js +32 -0
  130. package/tests/fixture/transform-css-global/output.js +8 -0
  131. package/tests/fixture/transform-css-media-query/input.js +24 -0
  132. package/tests/fixture/transform-css-media-query/output.js +8 -0
  133. package/tests/fixture/transform-css-normal/input.js +22 -0
  134. package/tests/fixture/transform-css-normal/output.js +8 -0
  135. package/tests/fixture/transform-css-nth-1/input.js +10 -0
  136. package/tests/fixture/transform-css-nth-1/output.js +8 -0
  137. package/tests/fixture/whitespace/input.js +12 -0
  138. package/tests/fixture/whitespace/output.js +12 -0
  139. package/tests/fixture.rs +87 -0
@@ -0,0 +1,41 @@
1
+ // TODO
2
+ // import React, { Component } from 'react'
3
+
4
+ // export default class Index extends Component {
5
+ // static getInitialProps() {
6
+ // return { color: 'aquamarine' }
7
+ // }
8
+
9
+ // render() {
10
+ // return (
11
+ // <div>
12
+ // {[1, 2].map(idx => (
13
+ // <div key={idx}>
14
+ // {[3, 4].map(idx2 => (
15
+ // <div key={idx2}>{this.props.color}</div>
16
+ // ))}
17
+ // </div>
18
+ // ))}
19
+ // {[1, 2].map(idx => (
20
+ // <div key={idx}>
21
+ // <div>
22
+ // {this.props.color}
23
+ // <div className="something">
24
+ // <React.Fragment>
25
+ // <div>
26
+ // <div>{this.props.color} hello there</div>
27
+ // </div>
28
+ // </React.Fragment>
29
+ // </div>
30
+ // </div>
31
+ // </div>
32
+ // ))}
33
+ // <style jsx>{`
34
+ // div {
35
+ // background: ${this.props.color};
36
+ // }
37
+ // `}</style>
38
+ // </div>
39
+ // )
40
+ // }
41
+ // }
@@ -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 jsx>{`p { color:red; }`}</style></p>
@@ -0,0 +1 @@
1
+ // module.exports = () => <p><style>{`p { color:red; }`}</style></p>
@@ -0,0 +1 @@
1
+ // module.exports = () => <p><style>{`p { color:red; }`}</style></p>
@@ -0,0 +1,90 @@
1
+ const darken = c => c
2
+ const color = 'red'
3
+ const otherColor = 'green'
4
+ const mediumScreen = '680px'
5
+ const animationDuration = '200ms'
6
+ const animationName = 'my-cool-animation'
7
+ const obj = { display: 'block' }
8
+
9
+ export default ({ display }) => (
10
+ <div>
11
+ <p>test</p>
12
+ <style jsx>{`
13
+ p.${color} {
14
+ color: ${otherColor};
15
+ display: ${obj.display};
16
+ }
17
+ `}</style>
18
+ <style jsx>{'p { color: red }'}</style>
19
+ <style jsx global>{`
20
+ body {
21
+ background: ${color};
22
+ }
23
+ `}</style>
24
+ <style jsx global>{`
25
+ body {
26
+ background: ${color};
27
+ }
28
+ `}</style>
29
+ // TODO: the next two should have the same hash
30
+ <style jsx>{`
31
+ p {
32
+ color: ${color};
33
+ }
34
+ `}</style>
35
+ <style jsx>{`
36
+ p {
37
+ color: ${color};
38
+ }
39
+ `}</style>
40
+ <style jsx>{`
41
+ p {
42
+ color: ${darken(color)};
43
+ }
44
+ `}</style>
45
+ <style jsx>{`
46
+ p {
47
+ color: ${darken(color) + 2};
48
+ }
49
+ `}</style>
50
+ <style jsx>{`
51
+ @media (min-width: ${mediumScreen}) {
52
+ p {
53
+ color: green;
54
+ }
55
+ p {
56
+ color: ${`red`};
57
+ }
58
+ }
59
+ p {
60
+ color: red;
61
+ }
62
+ `}</style>
63
+ <style jsx>{`
64
+ p {
65
+ animation-duration: ${animationDuration};
66
+ }
67
+ `}</style>
68
+ <style jsx>{`
69
+ p {
70
+ animation: ${animationDuration} forwards ${animationName};
71
+ }
72
+ div {
73
+ background: ${color};
74
+ }
75
+ `}</style>
76
+
77
+ <style jsx>{`
78
+ span {
79
+ display: ${display ? 'block' : 'none'};
80
+ }
81
+ `}</style>
82
+ // TODO: causes bad syntax
83
+ {/* <style jsx>{`
84
+ span:before {
85
+ display: ${display ? 'block' : 'none'};
86
+ content: '\`';
87
+ }
88
+ `}</style> */}
89
+ </div>
90
+ )
@@ -0,0 +1,91 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ const darken = (c)=>c;
3
+ const color = 'red';
4
+ const otherColor = 'green';
5
+ const mediumScreen = '680px';
6
+ const animationDuration = '200ms';
7
+ const animationName = 'my-cool-animation';
8
+ const obj = {
9
+ display: 'block'
10
+ };
11
+ export default (({ display })=><div className={"jsx-b452af554142d27 " + _JSXStyle.dynamic([
12
+ [
13
+ "469c0b1cc43512b8",
14
+ [
15
+ display ? 'block' : 'none'
16
+ ]
17
+ ],
18
+ [
19
+ "d05e300c372f73ee",
20
+ [
21
+ darken(color) + 2
22
+ ]
23
+ ],
24
+ [
25
+ "72e421eb2017491a",
26
+ [
27
+ darken(color)
28
+ ]
29
+ ]
30
+ ])}>
31
+
32
+ <p className={"jsx-b452af554142d27 " + _JSXStyle.dynamic([
33
+ [
34
+ "469c0b1cc43512b8",
35
+ [
36
+ display ? 'block' : 'none'
37
+ ]
38
+ ],
39
+ [
40
+ "d05e300c372f73ee",
41
+ [
42
+ darken(color) + 2
43
+ ]
44
+ ],
45
+ [
46
+ "72e421eb2017491a",
47
+ [
48
+ darken(color)
49
+ ]
50
+ ]
51
+ ])}>test</p>
52
+
53
+ <_JSXStyle id={"cb56eab0db38d266"}>{`p.${color}.jsx-b452af554142d27{color:${otherColor};display:${obj.display}}`}</_JSXStyle>
54
+
55
+ <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-b452af554142d27{color:red}"}</_JSXStyle>
56
+
57
+ <_JSXStyle id={"e66306ac259712aa"}>{`body{background:${color}}`}</_JSXStyle>
58
+
59
+ <_JSXStyle id={"e66306ac259712aa"}>{`body{background:${color}}`}</_JSXStyle>
60
+
61
+ // TODO: the next two should have the same hash
62
+
63
+ <_JSXStyle id={"f08108daf927b99d"}>{`p.jsx-b452af554142d27{color:${color}}`}</_JSXStyle>
64
+
65
+ <_JSXStyle id={"f08108daf927b99d"}>{`p.jsx-b452af554142d27{color:${color}}`}</_JSXStyle>
66
+
67
+ <_JSXStyle id={"72e421eb2017491a"} dynamic={[
68
+ darken(color)
69
+ ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`}</_JSXStyle>
70
+
71
+ <_JSXStyle id={"d05e300c372f73ee"} dynamic={[
72
+ darken(color) + 2
73
+ ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`}</_JSXStyle>
74
+
75
+ <_JSXStyle id={"7c5c5bde49d6c65d"}>{`@media(min-width:${mediumScreen}){p.jsx-b452af554142d27{color:green}p.jsx-b452af554142d27{color:${`red`}}}p.jsx-b452af554142d27{color:red}`}</_JSXStyle>
76
+
77
+ <_JSXStyle id={"c5506be0b4762e0b"}>{`p.jsx-b452af554142d27{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
78
+
79
+ <_JSXStyle id={"ed798aa885be9084"}>{`p.jsx-b452af554142d27{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-b452af554142d27{background:${color}}`}</_JSXStyle>
80
+
81
+
82
+
83
+ <_JSXStyle id={"469c0b1cc43512b8"} dynamic={[
84
+ display ? 'block' : 'none'
85
+ ]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`}</_JSXStyle>
86
+
87
+ // TODO: causes bad syntax
88
+
89
+ {}
90
+
91
+ </div>);
@@ -0,0 +1,5 @@
1
+ import css from 'styled-jsx/css'
2
+
3
+ function test() {
4
+ css.resolve`div { color: red }`
5
+ }
@@ -0,0 +1,7 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ function test() {
3
+ ({
4
+ styles: <_JSXStyle id={"abb4c2202db1a207"}>{"div.jsx-abb4c2202db1a207{color:red}"}</_JSXStyle>,
5
+ className: "jsx-abb4c2202db1a207"
6
+ });
7
+ }
@@ -0,0 +1,41 @@
1
+ import styles from './styles'
2
+ const styles2 = require('./styles2')
3
+ import { foo as styles3 } from './styles'
4
+
5
+ export default () => (
6
+ <div>
7
+ <p className="foo">test</p>
8
+ <p>woot</p>
9
+ <style jsx global>
10
+ {styles2}
11
+ </style>
12
+ <style jsx>{styles3}</style>
13
+ <div>woot</div>
14
+ <style jsx>{`
15
+ p {
16
+ color: red;
17
+ }
18
+ div {
19
+ color: green;
20
+ }
21
+ `}</style>
22
+ <style jsx>{styles}</style>
23
+ </div>
24
+ )
25
+
26
+ export const Test = () => (
27
+ <div>
28
+ <p className="foo">test</p>
29
+ <p>woot</p>
30
+ <style jsx>{styles3}</style>
31
+ <div>woot</div>
32
+ <style jsx>{`
33
+ p {
34
+ color: red;
35
+ }
36
+ div {
37
+ color: green;
38
+ }
39
+ `}</style>
40
+ </div>
41
+ )
@@ -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,19 @@
1
+ import styles, { foo as styles3 } from './styles'
2
+
3
+ const styles2 = require('./styles2')
4
+
5
+ export default () =>
6
+ <div>
7
+ <p>test</p>
8
+ <div>woot</div>
9
+ <p>woot</p>
10
+ <style jsx global>
11
+ {styles2}
12
+ </style>
13
+ <style jsx global>
14
+ {styles3}
15
+ </style>
16
+ <style jsx global>
17
+ {styles}
18
+ </style>
19
+ </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>);
@@ -0,0 +1,9 @@
1
+ import styles from './styles'
2
+
3
+ export default () =>
4
+ <div>
5
+ <p>test</p>
6
+ <style jsx>
7
+ {styles}
8
+ </style>
9
+ </div>
@@ -0,0 +1,9 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import styles from './styles';
3
+ export default (()=><div className={`jsx-${styles.__hash}`}>
4
+
5
+ <p className={`jsx-${styles.__hash}`}>test</p>
6
+
7
+ <_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
8
+
9
+ </div>);
@@ -0,0 +1,51 @@
1
+ import React from 'react'
2
+
3
+ export default () => (
4
+ <>
5
+ <p>Testing!!!</p>
6
+ <p className="foo">Bar</p>
7
+ <>
8
+ <h3 id="head">Title...</h3>
9
+ <React.Fragment>
10
+ <p>hello</p>
11
+ <>
12
+ <p>foo</p>
13
+ <p>bar</p>
14
+ </>
15
+ <p>world</p>
16
+ </React.Fragment>
17
+ </>
18
+ <style jsx>{`
19
+ p {
20
+ color: cyan;
21
+ }
22
+ .foo {
23
+ font-size: 18px;
24
+ color: hotpink;
25
+ }
26
+ #head {
27
+ text-decoration: underline;
28
+ }
29
+ `}</style>
30
+ </>
31
+ )
32
+
33
+ function Component1() {
34
+ return (
35
+ <>
36
+ <div>test</div>
37
+ </>
38
+ )
39
+ }
40
+
41
+ function Component2() {
42
+ return (
43
+ <div>
44
+ <style jsx>{`
45
+ div {
46
+ color: red;
47
+ }
48
+ `}</style>
49
+ </div>
50
+ )
51
+ }
@@ -0,0 +1,47 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import React from 'react';
3
+ export default (()=><>
4
+
5
+ <p className={"jsx-6dd5f97e085c0297"}>Testing!!!</p>
6
+
7
+ <p className={"jsx-6dd5f97e085c0297" + " " + "foo"}>Bar</p>
8
+
9
+ <>
10
+
11
+ <h3 id="head" className={"jsx-6dd5f97e085c0297"}>Title...</h3>
12
+
13
+ <React.Fragment >
14
+
15
+ <p className={"jsx-6dd5f97e085c0297"}>hello</p>
16
+
17
+ <>
18
+
19
+ <p className={"jsx-6dd5f97e085c0297"}>foo</p>
20
+
21
+ <p className={"jsx-6dd5f97e085c0297"}>bar</p>
22
+
23
+ </>
24
+
25
+ <p className={"jsx-6dd5f97e085c0297"}>world</p>
26
+
27
+ </React.Fragment>
28
+
29
+ </>
30
+
31
+ <_JSXStyle id={"6dd5f97e085c0297"}>{"p.jsx-6dd5f97e085c0297{color:cyan}.foo.jsx-6dd5f97e085c0297{font-size:18px;color:hotpink}#head.jsx-6dd5f97e085c0297{text-decoration:underline}"}</_JSXStyle>
32
+
33
+ </>);
34
+ function Component1() {
35
+ return <>
36
+
37
+ <div >test</div>
38
+
39
+ </>;
40
+ }
41
+ function Component2() {
42
+ return <div className={"jsx-678f41ca6d3b294b"}>
43
+
44
+ <_JSXStyle id={"678f41ca6d3b294b"}>{"div.jsx-678f41ca6d3b294b{color:red}"}</_JSXStyle>
45
+
46
+ </div>;
47
+ }
@@ -0,0 +1,22 @@
1
+ const Test = () => (
2
+ <div>
3
+ <style jsx global>{`
4
+ body {
5
+ color: red
6
+ }
7
+
8
+ :hover { color: red; display: flex;
9
+ animation: foo 1s ease-out }
10
+
11
+ div a {
12
+ display: none;
13
+ }
14
+
15
+ [data-test] > div {
16
+ color: red;
17
+ }
18
+ `}</style>
19
+ </div>
20
+ )
21
+
22
+ const Test2 = () => <style global jsx>{'p { color: red }'}</style>
@@ -0,0 +1,7 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ const Test = ()=><div className={"jsx-d47d6adadf14e957"}>
3
+
4
+ <_JSXStyle id={"d47d6adadf14e957"}>{"body{color:red}:hover{color:red;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-animation:foo 1s ease-out;-moz-animation:foo 1s ease-out;-o-animation:foo 1s ease-out;animation:foo 1s ease-out}div a{display:none}[data-test]>div{color:red}"}</_JSXStyle>
5
+
6
+ </div>;
7
+ const Test2 = ()=><_JSXStyle id={"94239b6d6b42c9b5"}>{"p{color:red}"}</_JSXStyle>;
@@ -0,0 +1,10 @@
1
+ const Test = () => (
2
+ <div>
3
+ <span>test</span>
4
+ <style jsx>{`
5
+ div > :global(span) {
6
+ color: red;
7
+ }
8
+ `}</style>
9
+ </div>
10
+ )
@@ -0,0 +1,8 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ const Test = ()=><div className={"jsx-5a206f122d1cb32e"}>
3
+
4
+ <span className={"jsx-5a206f122d1cb32e"}>test</span>
5
+
6
+ <_JSXStyle id={"5a206f122d1cb32e"}>{"div.jsx-5a206f122d1cb32e>span{color:red}"}</_JSXStyle>
7
+
8
+ </div>;
@@ -0,0 +1,12 @@
1
+ export default function IndexPage() {
2
+ return (
3
+ <div>
4
+ should be blue.
5
+ <style jsx global>{`
6
+ :global(div) {
7
+ color: blue;
8
+ }
9
+ `}</style>
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,10 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default function IndexPage() {
3
+ return <div className={"jsx-b6abd0684ba81871"}>
4
+
5
+ should be blue.
6
+
7
+ <_JSXStyle id={"b6abd0684ba81871"}>{"div{color:blue}"}</_JSXStyle>
8
+
9
+ </div>;
10
+ }
@@ -0,0 +1,7 @@
1
+
2
+
3
+ export default ({ breakPoint }) => (
4
+ <div>
5
+ <style jsx>{`@media (${breakPoint}) {}`}</style>
6
+ </div>
7
+ )
@@ -0,0 +1,15 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default (({ breakPoint })=><div className={_JSXStyle.dynamic([
3
+ [
4
+ "5d2a0e645566ce9c",
5
+ [
6
+ breakPoint
7
+ ]
8
+ ]
9
+ ])}>
10
+
11
+ <_JSXStyle id={"5d2a0e645566ce9c"} dynamic={[
12
+ breakPoint
13
+ ]}>{`@media(${breakPoint}){}`}</_JSXStyle>
14
+
15
+ </div>);
@@ -0,0 +1,15 @@
1
+ export default function IndexPage() {
2
+ return (
3
+ <div>
4
+ <h1>Hello World.</h1>
5
+
6
+ <style jsx global>{`
7
+ @supports (display: flex) {
8
+ h1 {
9
+ color: hotpink;
10
+ }
11
+ }
12
+ `}</style>
13
+ </div>
14
+ );
15
+ }
@@ -0,0 +1,12 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default function IndexPage() {
3
+ return <div className={"jsx-bbdada4ef17d18ef"}>
4
+
5
+ <h1 className={"jsx-bbdada4ef17d18ef"}>Hello World.</h1>
6
+
7
+
8
+
9
+ <_JSXStyle id={"bbdada4ef17d18ef"}>{"@supports((display:flex)or (display:-webkit-box)or (display:-webkit-flex)or (display:-moz-box)or (display:-ms-flexbox)){h1{color:hotpink}}"}</_JSXStyle>
10
+
11
+ </div>;
12
+ }