@swc/plugin-styled-jsx 1.3.0 → 1.5.0

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,30 @@
1
+
2
+
3
+
4
+ export default class {
5
+ render() {
6
+ return (
7
+ <div>
8
+ <p>test</p>
9
+ <style jsx global>{`
10
+ html {
11
+ font-size: ${Typography.base.size.default};
12
+ line-height: ${Typography.base.lineHeight};
13
+ }
14
+ @media ${Target.mediumPlus} {
15
+ html {
16
+ font-size: ${Typography.base.size.mediumPlus};
17
+ }
18
+ }
19
+ @media ${Target.largePlus} {
20
+ html {
21
+ font-size: ${Typography.base.size.largePlus};
22
+ }
23
+ }
24
+ `}
25
+ </style>
26
+ </div>
27
+ )
28
+ }
29
+ }
30
+
@@ -0,0 +1,43 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default class {
3
+ render() {
4
+ return <div className={_JSXStyle.dynamic([
5
+ [
6
+ "60bda1963c17b640",
7
+ [
8
+ Typography.base.size.default,
9
+ Typography.base.lineHeight,
10
+ Target.mediumPlus,
11
+ Typography.base.size.mediumPlus,
12
+ Target.largePlus,
13
+ Typography.base.size.largePlus
14
+ ]
15
+ ]
16
+ ])}>
17
+
18
+ <p className={_JSXStyle.dynamic([
19
+ [
20
+ "60bda1963c17b640",
21
+ [
22
+ Typography.base.size.default,
23
+ Typography.base.lineHeight,
24
+ Target.mediumPlus,
25
+ Typography.base.size.mediumPlus,
26
+ Target.largePlus,
27
+ Typography.base.size.largePlus
28
+ ]
29
+ ]
30
+ ])}>test</p>
31
+
32
+ <_JSXStyle id={"60bda1963c17b640"} dynamic={[
33
+ Typography.base.size.default,
34
+ Typography.base.lineHeight,
35
+ Target.mediumPlus,
36
+ Typography.base.size.mediumPlus,
37
+ Target.largePlus,
38
+ Typography.base.size.largePlus
39
+ ]}>{`html{font-size:${Typography.base.size.default};line-height:${Typography.base.lineHeight}}@media ${Target.mediumPlus}{html{font-size:${Typography.base.size.mediumPlus}}}@media ${Target.largePlus}{html{font-size:${Typography.base.size.largePlus}}}`}</_JSXStyle>
40
+
41
+ </div>;
42
+ }
43
+ }
@@ -0,0 +1,9 @@
1
+ const Test = () => <style global jsx>{'p { color: red }'}</style>
2
+
3
+ export default () => (
4
+ <div>
5
+ <p>test</p>
6
+ <style jsx global>{`body { background: red }`}</style>
7
+ <style jsx>{'p { color: red }'}</style>
8
+ </div>
9
+ )
@@ -0,0 +1,11 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ const Test = ()=><_JSXStyle id={"94239b6d6b42c9b5"}>{"p{color:red}"}</_JSXStyle>;
3
+ export default (()=><div className={"jsx-3822e6e1fb9fa41a"}>
4
+
5
+ <p className={"jsx-3822e6e1fb9fa41a"}>test</p>
6
+
7
+ <_JSXStyle id={"b7efb453c85593c1"}>{"body{background:red}"}</_JSXStyle>
8
+
9
+ <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-3822e6e1fb9fa41a{color:red}"}</_JSXStyle>
10
+
11
+ </div>);
@@ -0,0 +1,43 @@
1
+ const attrs = {
2
+ id: 'test'
3
+ }
4
+
5
+ const Test1 = () => (
6
+ <div>
7
+ <span {...attrs} data-test="test">test</span>
8
+ <Component />
9
+ <style jsx>{`
10
+ span {
11
+ color: red;
12
+ }
13
+ `}</style>
14
+ </div>
15
+ )
16
+
17
+ const Test2 = () => <span>test</span>
18
+
19
+ const Test3 = () => (
20
+ <div>
21
+ <span>test</span>
22
+ <style jsx>{`
23
+ span {
24
+ color: red;
25
+ }
26
+ `}</style>
27
+ </div>
28
+ )
29
+
30
+ export default class {
31
+ render () {
32
+ return (
33
+ <div>
34
+ <p>test</p>
35
+ <style jsx>{`
36
+ p {
37
+ color: red;
38
+ }
39
+ `}</style>
40
+ </div>
41
+ )
42
+ }
43
+ }
@@ -0,0 +1,32 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ const attrs = {
3
+ id: 'test'
4
+ };
5
+ const Test1 = ()=><div className={"jsx-a9535d7d5f32c3c4"}>
6
+
7
+ <span {...attrs} data-test="test" className={"jsx-a9535d7d5f32c3c4" + " " + (attrs && attrs.className != null && attrs.className || "")}>test</span>
8
+
9
+ <Component />
10
+
11
+ <_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}</_JSXStyle>
12
+
13
+ </div>;
14
+ const Test2 = ()=><span >test</span>;
15
+ const Test3 = ()=><div className={"jsx-a9535d7d5f32c3c4"}>
16
+
17
+ <span className={"jsx-a9535d7d5f32c3c4"}>test</span>
18
+
19
+ <_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}</_JSXStyle>
20
+
21
+ </div>;
22
+ export default class {
23
+ render() {
24
+ return <div className={"jsx-b2b86d63f35d25ee"}>
25
+
26
+ <p className={"jsx-b2b86d63f35d25ee"}>test</p>
27
+
28
+ <_JSXStyle id={"b2b86d63f35d25ee"}>{"p.jsx-b2b86d63f35d25ee{color:red}"}</_JSXStyle>
29
+
30
+ </div>;
31
+ }
32
+ }
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ export default () => (
2
+ <div>
3
+ <p>woot</p>
4
+ <style dangerouslySetInnerHTML={{ __html: `body { margin: 0; }` }}></style>
5
+ <style jsx>{'p { color: red }'}</style>
6
+ </div>
7
+ )
@@ -0,0 +1,12 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default (()=><div className={"jsx-94239b6d6b42c9b5"}>
3
+
4
+ <p className={"jsx-94239b6d6b42c9b5"}>woot</p>
5
+
6
+ <style dangerouslySetInnerHTML={{
7
+ __html: `body { margin: 0; }`
8
+ }}></style>
9
+
10
+ <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"}</_JSXStyle>
11
+
12
+ </div>);
@@ -0,0 +1,30 @@
1
+ import css from 'hell'
2
+
3
+ const color = 'red'
4
+
5
+ const bar = css`
6
+ div {
7
+ font-size: 3em;
8
+ }
9
+ `
10
+ export const uh = bar
11
+
12
+ export const foo = css`div { color: ${color}}`
13
+
14
+ export default css`
15
+ div {
16
+ font-size: 3em;
17
+ }
18
+ p {
19
+ color: ${color};
20
+ }
21
+ `
22
+
23
+ const Title = styled.h1`
24
+ color: red;
25
+ font-size: 50px;
26
+ `
27
+
28
+ const AnotherTitle = Title.extend`color: blue;`
29
+
30
+ export const Component = () => <AnotherTitle>My page</AnotherTitle>
@@ -0,0 +1,24 @@
1
+ import css from 'hell';
2
+ const color = 'red';
3
+ const bar = css`
4
+ div {
5
+ font-size: 3em;
6
+ }
7
+ `;
8
+ export const uh = bar;
9
+ export const foo = css`div { color: ${color}}`;
10
+ export default css`
11
+ div {
12
+ font-size: 3em;
13
+ }
14
+ p {
15
+ color: ${color};
16
+ }
17
+ `;
18
+ const Title = styled.h1`
19
+ color: red;
20
+ font-size: 50px;
21
+ `;
22
+ const AnotherTitle = Title.extend`color: blue;`;
23
+ export const Component = ()=><AnotherTitle >My page</AnotherTitle>
24
+ ;
@@ -0,0 +1,17 @@
1
+ import Link from "next/link";
2
+
3
+ export default function IndexPage() {
4
+ return (
5
+ <div>
6
+ Hello World.{" "}
7
+ <Link href="/about">
8
+ <a>Abound</a>
9
+ </Link>
10
+ <style jsx>{`
11
+ a {
12
+ color: ${"#abcdef"}12;
13
+ }
14
+ `}</style>
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,17 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import Link from "next/link";
3
+ export default function IndexPage() {
4
+ return <div className={"jsx-9a4b3442d519aae9"}>
5
+
6
+ Hello World.{" "}
7
+
8
+ <Link href="/about">
9
+
10
+ <a className={"jsx-9a4b3442d519aae9"}>Abound</a>
11
+
12
+ </Link>
13
+
14
+ <_JSXStyle id={"9a4b3442d519aae9"}>{`a.jsx-9a4b3442d519aae9{color:${"#abcdef"}12}`}</_JSXStyle>
15
+
16
+ </div>;
17
+ }
@@ -0,0 +1,10 @@
1
+ export default () => (
2
+ <div>
3
+ <p>test</p>
4
+ <style jsx>{`
5
+ .container :global(> *) {
6
+ color: red;
7
+ }
8
+ `}</style>
9
+ </div>
10
+ )
@@ -0,0 +1,8 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default (()=><div className={"jsx-c7c3a8e231c9215a"}>
3
+
4
+ <p className={"jsx-c7c3a8e231c9215a"}>test</p>
5
+
6
+ <_JSXStyle id={"c7c3a8e231c9215a"}>{".container.jsx-c7c3a8e231c9215a>*{color:red}"}</_JSXStyle>
7
+
8
+ </div>);
@@ -0,0 +1,8 @@
1
+ // TODO: needs sourcemaps
2
+ // export default () => (
3
+ // <div>
4
+ // <p>test</p>
5
+ // <p>woot</p>
6
+ // <style jsx>{'p { color: red }'}</style>
7
+ // </div>
8
+ // )
@@ -0,0 +1,8 @@
1
+ // TODO: needs sourcemaps
2
+ // export default () => (
3
+ // <div>
4
+ // <p>test</p>
5
+ // <p>woot</p>
6
+ // <style jsx>{'p { color: red }'}</style>
7
+ // </div>
8
+ // )
@@ -0,0 +1,8 @@
1
+ export default () => (
2
+ <div>
3
+ <p>test</p>
4
+ <p>woot</p>
5
+ <p>woot</p>
6
+ <style jsx>{'p { color: red }'}</style>
7
+ </div>
8
+ )
@@ -0,0 +1,12 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default (()=><div className={"jsx-94239b6d6b42c9b5"}>
3
+
4
+ <p className={"jsx-94239b6d6b42c9b5"}>test</p>
5
+
6
+ <p className={"jsx-94239b6d6b42c9b5"}>woot</p>
7
+
8
+ <p className={"jsx-94239b6d6b42c9b5"}>woot</p>
9
+
10
+ <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"}</_JSXStyle>
11
+
12
+ </div>);
@@ -0,0 +1,57 @@
1
+ import css, { resolve, global } from 'styled-jsx/css'
2
+ import colors, { size } from './constants'
3
+ const color = 'red'
4
+
5
+ const bar = css`
6
+ div {
7
+ font-size: 3em;
8
+ }
9
+ `
10
+
11
+ const baz = css.global`
12
+ div {
13
+ font-size: 3em;
14
+ }
15
+ `
16
+
17
+ const a = global`
18
+ div {
19
+ font-size: ${size}em;
20
+ }
21
+ `
22
+
23
+ export const uh = bar
24
+
25
+ export const foo = css`div { color: ${color}}`
26
+
27
+ css.resolve`
28
+ div {
29
+ color: ${colors.green.light};
30
+ }
31
+ a { color: red }
32
+ `
33
+
34
+ const b = resolve`
35
+ div {
36
+ color: ${colors.green.light};
37
+ }
38
+ a { color: red }
39
+ `
40
+
41
+ const dynamic = colors => {
42
+ const b = resolve`
43
+ div {
44
+ color: ${colors.green.light};
45
+ }
46
+ a { color: red }
47
+ `
48
+ }
49
+
50
+ export default css.resolve`
51
+ div {
52
+ font-size: 3em;
53
+ }
54
+ p {
55
+ color: ${color};
56
+ }
57
+ `
@@ -0,0 +1,39 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import colors, { size } from './constants';
3
+ const color = 'red';
4
+ const bar = new String("div.jsx-aaed0341accea8f{font-size:3em}");
5
+ bar.__hash = "aaed0341accea8f";
6
+ const baz = new String("div{font-size:3em}");
7
+ baz.__hash = "aaed0341accea8f";
8
+ const a = new String(`div{font-size:${size}em}`);
9
+ a.__hash = "b4e02b3e84cc50c";
10
+ export const uh = bar;
11
+ export const foo = new String(`div.jsx-1a001e3709d54ba4{color:${color}}`);
12
+ foo.__hash = "1a001e3709d54ba4";
13
+ ({
14
+ styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>,
15
+ className: "jsx-38ae14c4ec5e0907"
16
+ });
17
+ const b = {
18
+ styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>,
19
+ className: "jsx-38ae14c4ec5e0907"
20
+ };
21
+ const dynamic = (colors)=>{
22
+ const b = {
23
+ styles: <_JSXStyle id={"b68d3b38146e2a7d"} dynamic={[
24
+ colors.green.light
25
+ ]}>{`div.__jsx-style-dynamic-selector{color:${colors.green.light}}a.__jsx-style-dynamic-selector{color:red}`}</_JSXStyle>,
26
+ className: _JSXStyle.dynamic([
27
+ [
28
+ "b68d3b38146e2a7d",
29
+ [
30
+ colors.green.light
31
+ ]
32
+ ]
33
+ ])
34
+ };
35
+ };
36
+ export default {
37
+ styles: <_JSXStyle id={"e14aa5a1efa47449"}>{`div.jsx-e14aa5a1efa47449{font-size:3em}p.jsx-e14aa5a1efa47449{color:${color}}`}</_JSXStyle>,
38
+ className: "jsx-e14aa5a1efa47449"
39
+ };
@@ -0,0 +1,13 @@
1
+ // TODO
2
+ // import css from 'styled-jsx/css'
3
+
4
+ // const color = 'red'
5
+
6
+ // export const foo = css`div { color: ${color}}`
7
+
8
+ // const props = { color: 'red ' }
9
+
10
+ // export default css`
11
+ // div { font-size: 3em; color: ${props.color} }
12
+ // p { color: ${this.props.color};}
13
+ // `
@@ -0,0 +1,9 @@
1
+ // TODO
2
+ // import css from 'styled-jsx/css'
3
+ // const color = 'red'
4
+ // export const foo = css`div { color: ${color}}`
5
+ // const props = { color: 'red ' }
6
+ // export default css`
7
+ // div { font-size: 3em; color: ${props.color} }
8
+ // p { color: ${this.props.color};}
9
+ // `
@@ -0,0 +1,11 @@
1
+ // TODO
2
+ // import css from 'styled-jsx/css'
3
+
4
+ // const color = 'red'
5
+
6
+ // export const foo = css`div { color: ${color}}`
7
+
8
+ // export default css`
9
+ // div { font-size: 3em }
10
+ // p { color: ${props.color};}
11
+ // `
@@ -0,0 +1,8 @@
1
+ // TODO
2
+ // import css from 'styled-jsx/css'
3
+ // const color = 'red'
4
+ // export const foo = css`div { color: ${color}}`
5
+ // export default css`
6
+ // div { font-size: 3em }
7
+ // p { color: ${props.color};}
8
+ // `
@@ -0,0 +1,6 @@
1
+ // TODO: support common js
2
+ // import css from 'styled-jsx/css'
3
+
4
+ // module.exports = css`
5
+ // div { font-size: 3em }
6
+ // `
@@ -0,0 +1,5 @@
1
+ // TODO: support common js
2
+ // import css from 'styled-jsx/css'
3
+ // module.exports = css`
4
+ // div { font-size: 3em }
5
+ // `
@@ -0,0 +1,35 @@
1
+
2
+
3
+ export const Red = ({
4
+ Component = 'button',
5
+ }) => {
6
+
7
+ return (
8
+ <Component
9
+
10
+ >
11
+
12
+ {/* Dynamic Styles */}
13
+ <style jsx>{`
14
+ .button {
15
+ --button-1: ${e1};
16
+ --button-2: ${e2};
17
+ --button-3: ${e3};
18
+ --button-4: ${e4};
19
+ --button-5: ${e5};
20
+ --button-6: ${e6};
21
+ --button-7: ${e7};
22
+ --button-8: ${e8};
23
+ --button-9: ${e9};
24
+ --button-10: ${e10};
25
+ --button-11: ${e11};
26
+ --button-12: ${e12};
27
+ --button-13: ${e13};
28
+ --button-14: ${e14};
29
+ --button-15: ${e15};
30
+ }
31
+ `}</style>
32
+ </Component>
33
+ );
34
+ };
35
+
@@ -0,0 +1,49 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export const Red = ({ Component ='button' , })=>{
3
+ return <Component className={_JSXStyle.dynamic([
4
+ [
5
+ "1a9f9e2fa701f7ec",
6
+ [
7
+ e1,
8
+ e2,
9
+ e3,
10
+ e4,
11
+ e5,
12
+ e6,
13
+ e7,
14
+ e8,
15
+ e9,
16
+ e10,
17
+ e11,
18
+ e12,
19
+ e13,
20
+ e14,
21
+ e15
22
+ ]
23
+ ]
24
+ ])}>
25
+
26
+
27
+
28
+ {}
29
+
30
+ <_JSXStyle id={"1a9f9e2fa701f7ec"} dynamic={[
31
+ e1,
32
+ e2,
33
+ e3,
34
+ e4,
35
+ e5,
36
+ e6,
37
+ e7,
38
+ e8,
39
+ e9,
40
+ e10,
41
+ e11,
42
+ e12,
43
+ e13,
44
+ e14,
45
+ e15
46
+ ]}>{`.button.__jsx-style-dynamic-selector{--button-1:${e1};--button-2:${e2};--button-3:${e3};--button-4:${e4};--button-5:${e5};--button-6:${e6};--button-7:${e7};--button-8:${e8};--button-9:${e9};--button-10:${e10};--button-11:${e11};--button-12:${e12};--button-13:${e13};--button-14:${e14};--button-15:${e15}}`}</_JSXStyle>
47
+
48
+ </Component>;
49
+ };
@@ -0,0 +1,14 @@
1
+ export default class {
2
+ render() {
3
+ return (
4
+ <div>
5
+ <p>test</p>
6
+ <style jsx>{`
7
+ p {
8
+ content: '\`'
9
+ }
10
+ `}</style>
11
+ </div>
12
+ )
13
+ }
14
+ }
@@ -0,0 +1,12 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default class {
3
+ render() {
4
+ return <div className={"jsx-1f6cef12199c3a8f"}>
5
+
6
+ <p className={"jsx-1f6cef12199c3a8f"}>test</p>
7
+
8
+ <_JSXStyle id={"1f6cef12199c3a8f"}>{'p.jsx-1f6cef12199c3a8f{content:"`"}'}</_JSXStyle>
9
+
10
+ </div>;
11
+ }
12
+ }
@@ -0,0 +1,17 @@
1
+ export default function Home({ fontFamily }) {
2
+ return (
3
+ <div>
4
+ <style jsx global>
5
+ {`
6
+ body {
7
+ font-family: ${fontFamily};
8
+ }
9
+ code:before,
10
+ code:after {
11
+ content: '\`';
12
+ }
13
+ `}
14
+ </style>
15
+ </div>
16
+ )
17
+ }
@@ -0,0 +1,17 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ export default function Home({ fontFamily }) {
3
+ return <div className={_JSXStyle.dynamic([
4
+ [
5
+ "3892513b52a23034",
6
+ [
7
+ fontFamily
8
+ ]
9
+ ]
10
+ ])}>
11
+
12
+ <_JSXStyle id={"3892513b52a23034"} dynamic={[
13
+ fontFamily
14
+ ]}>{`body{font-family:${fontFamily}}code:before,code:after{content:"\`"}`}</_JSXStyle>
15
+
16
+ </div>;
17
+ }