ripple 0.3.71 → 0.3.74

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 (165) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/package.json +3 -3
  3. package/src/jsx-runtime.d.ts +2 -8
  4. package/src/runtime/index-client.js +3 -13
  5. package/src/runtime/internal/client/blocks.js +3 -25
  6. package/src/runtime/internal/client/for.js +80 -5
  7. package/src/runtime/internal/client/index.js +0 -2
  8. package/src/runtime/internal/client/types.d.ts +0 -10
  9. package/tests/client/__snapshots__/computed-properties.test.tsrx.snap +8 -0
  10. package/tests/client/__snapshots__/for.test.tsrx.snap +22 -0
  11. package/tests/client/__snapshots__/html.test.tsrx.snap +4 -0
  12. package/tests/client/array/array.copy-within.test.tsrx +19 -19
  13. package/tests/client/array/array.derived.test.tsrx +97 -109
  14. package/tests/client/array/array.iteration.test.tsrx +28 -28
  15. package/tests/client/array/array.mutations.test.tsrx +68 -68
  16. package/tests/client/array/array.static.test.tsrx +82 -92
  17. package/tests/client/array/array.to-methods.test.tsrx +15 -15
  18. package/tests/client/async-suspend.test.tsrx +180 -179
  19. package/tests/client/basic/__snapshots__/basic.attributes.test.tsrx.snap +2 -0
  20. package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +4 -0
  21. package/tests/client/basic/basic.attributes.test.tsrx +273 -317
  22. package/tests/client/basic/basic.collections.test.tsrx +59 -71
  23. package/tests/client/basic/basic.components.test.tsrx +196 -222
  24. package/tests/client/basic/basic.errors.test.tsrx +72 -78
  25. package/tests/client/basic/basic.events.test.tsrx +80 -85
  26. package/tests/client/basic/basic.get-set.test.tsrx +54 -64
  27. package/tests/client/basic/basic.hmr.test.tsrx +15 -19
  28. package/tests/client/basic/basic.reactivity.test.tsrx +121 -135
  29. package/tests/client/basic/basic.rendering.test.tsrx +273 -178
  30. package/tests/client/basic/basic.utilities.test.tsrx +8 -10
  31. package/tests/client/boundaries.test.tsrx +18 -18
  32. package/tests/client/compiler/compiler.assignments.test.tsrx +77 -76
  33. package/tests/client/compiler/compiler.attributes.test.tsrx +18 -14
  34. package/tests/client/compiler/compiler.basic.test.tsrx +364 -296
  35. package/tests/client/compiler/compiler.regex.test.tsrx +40 -44
  36. package/tests/client/compiler/compiler.tracked-access.test.tsrx +57 -38
  37. package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
  38. package/tests/client/compiler/compiler.typescript.test.tsrx +4 -3
  39. package/tests/client/composite/composite.dynamic-components.test.tsrx +41 -44
  40. package/tests/client/composite/composite.generics.test.tsrx +165 -167
  41. package/tests/client/composite/composite.props.test.tsrx +66 -74
  42. package/tests/client/composite/composite.reactivity.test.tsrx +132 -166
  43. package/tests/client/composite/composite.render.test.tsrx +92 -101
  44. package/tests/client/computed-properties.test.tsrx +14 -18
  45. package/tests/client/context.test.tsrx +14 -18
  46. package/tests/client/css/global-additional-cases.test.tsrx +491 -437
  47. package/tests/client/css/global-advanced-selectors.test.tsrx +169 -153
  48. package/tests/client/css/global-at-rules.test.tsrx +71 -66
  49. package/tests/client/css/global-basic.test.tsrx +105 -98
  50. package/tests/client/css/global-classes-ids.test.tsrx +128 -114
  51. package/tests/client/css/global-combinators.test.tsrx +83 -78
  52. package/tests/client/css/global-complex-nesting.test.tsrx +134 -120
  53. package/tests/client/css/global-edge-cases.test.tsrx +138 -120
  54. package/tests/client/css/global-keyframes.test.tsrx +108 -96
  55. package/tests/client/css/global-nested.test.tsrx +88 -78
  56. package/tests/client/css/global-pseudo.test.tsrx +104 -98
  57. package/tests/client/css/global-scoping.test.tsrx +145 -125
  58. package/tests/client/css/style-identifier.test.tsrx +62 -69
  59. package/tests/client/date.test.tsrx +83 -83
  60. package/tests/client/dynamic-elements.test.tsrx +227 -283
  61. package/tests/client/events.test.tsrx +252 -266
  62. package/tests/client/for.test.tsrx +120 -127
  63. package/tests/client/head.test.tsrx +40 -48
  64. package/tests/client/html.test.tsrx +37 -49
  65. package/tests/client/input-value.test.tsrx +1125 -1354
  66. package/tests/client/lazy-array.test.tsrx +10 -16
  67. package/tests/client/lazy-destructuring.test.tsrx +169 -221
  68. package/tests/client/map.test.tsrx +39 -41
  69. package/tests/client/media-query.test.tsrx +15 -19
  70. package/tests/client/object.test.tsrx +46 -56
  71. package/tests/client/portal.test.tsrx +31 -37
  72. package/tests/client/ref.test.tsrx +173 -193
  73. package/tests/client/return.test.tsrx +62 -37
  74. package/tests/client/set.test.tsrx +33 -33
  75. package/tests/client/svg.test.tsrx +195 -215
  76. package/tests/client/switch.test.tsrx +201 -191
  77. package/tests/client/track-async-hydration.test.tsrx +14 -18
  78. package/tests/client/tracked-index-access.test.tsrx +18 -28
  79. package/tests/client/try.test.tsrx +494 -619
  80. package/tests/client/tsx.test.tsrx +290 -371
  81. package/tests/client/typescript-generics.test.tsrx +121 -129
  82. package/tests/client/url/url.derived.test.tsrx +21 -25
  83. package/tests/client/url/url.parsing.test.tsrx +35 -35
  84. package/tests/client/url/url.partial-removal.test.tsrx +32 -32
  85. package/tests/client/url/url.reactivity.test.tsrx +68 -72
  86. package/tests/client/url/url.serialization.test.tsrx +8 -8
  87. package/tests/client/url-search-params/url-search-params.derived.test.tsrx +21 -27
  88. package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +16 -16
  89. package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +37 -37
  90. package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +56 -60
  91. package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +32 -34
  92. package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +9 -9
  93. package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +10 -10
  94. package/tests/hydration/compiled/client/basic.js +396 -325
  95. package/tests/hydration/compiled/client/composite.js +52 -44
  96. package/tests/hydration/compiled/client/for.js +734 -604
  97. package/tests/hydration/compiled/client/head.js +183 -103
  98. package/tests/hydration/compiled/client/html.js +93 -86
  99. package/tests/hydration/compiled/client/if-children.js +95 -71
  100. package/tests/hydration/compiled/client/if.js +113 -89
  101. package/tests/hydration/compiled/client/mixed-control-flow.js +225 -209
  102. package/tests/hydration/compiled/client/nested-control-flow.js +94 -98
  103. package/tests/hydration/compiled/client/reactivity.js +26 -24
  104. package/tests/hydration/compiled/client/return.js +8 -42
  105. package/tests/hydration/compiled/client/switch.js +208 -173
  106. package/tests/hydration/compiled/client/track-async-serialization.js +176 -128
  107. package/tests/hydration/compiled/client/try.js +29 -21
  108. package/tests/hydration/compiled/server/basic.js +210 -221
  109. package/tests/hydration/compiled/server/composite.js +13 -14
  110. package/tests/hydration/compiled/server/for.js +427 -444
  111. package/tests/hydration/compiled/server/head.js +199 -189
  112. package/tests/hydration/compiled/server/html.js +33 -41
  113. package/tests/hydration/compiled/server/if-children.js +114 -117
  114. package/tests/hydration/compiled/server/if.js +77 -83
  115. package/tests/hydration/compiled/server/mixed-control-flow.js +145 -150
  116. package/tests/hydration/compiled/server/nested-control-flow.js +10 -0
  117. package/tests/hydration/compiled/server/reactivity.js +24 -22
  118. package/tests/hydration/compiled/server/return.js +6 -18
  119. package/tests/hydration/compiled/server/switch.js +179 -176
  120. package/tests/hydration/compiled/server/track-async-serialization.js +88 -70
  121. package/tests/hydration/compiled/server/try.js +31 -35
  122. package/tests/hydration/components/basic.tsrx +216 -286
  123. package/tests/hydration/components/composite.tsrx +32 -42
  124. package/tests/hydration/components/events.tsrx +81 -101
  125. package/tests/hydration/components/for.tsrx +270 -336
  126. package/tests/hydration/components/head.tsrx +43 -39
  127. package/tests/hydration/components/hmr.tsrx +16 -22
  128. package/tests/hydration/components/html-in-template.tsrx +15 -21
  129. package/tests/hydration/components/html.tsrx +442 -526
  130. package/tests/hydration/components/if-children.tsrx +107 -125
  131. package/tests/hydration/components/if.tsrx +68 -90
  132. package/tests/hydration/components/mixed-control-flow.tsrx +65 -72
  133. package/tests/hydration/components/nested-control-flow.tsrx +202 -216
  134. package/tests/hydration/components/portal.tsrx +33 -41
  135. package/tests/hydration/components/reactivity.tsrx +26 -34
  136. package/tests/hydration/components/return.tsrx +4 -6
  137. package/tests/hydration/components/switch.tsrx +73 -78
  138. package/tests/hydration/components/track-async-serialization.tsrx +83 -93
  139. package/tests/hydration/components/try.tsrx +37 -51
  140. package/tests/hydration/switch.test.js +8 -8
  141. package/tests/server/await.test.tsrx +3 -3
  142. package/tests/server/basic.attributes.test.tsrx +120 -167
  143. package/tests/server/basic.components.test.tsrx +163 -197
  144. package/tests/server/basic.test.tsrx +298 -220
  145. package/tests/server/compiler.test.tsrx +142 -72
  146. package/tests/server/composite.props.test.tsrx +54 -58
  147. package/tests/server/composite.test.tsrx +165 -167
  148. package/tests/server/context.test.tsrx +13 -17
  149. package/tests/server/dynamic-elements.test.tsrx +103 -135
  150. package/tests/server/for.test.tsrx +115 -84
  151. package/tests/server/head.test.tsrx +31 -31
  152. package/tests/server/html-nesting-validation.test.tsrx +16 -8
  153. package/tests/server/if.test.tsrx +49 -59
  154. package/tests/server/lazy-destructuring.test.tsrx +288 -366
  155. package/tests/server/return.test.tsrx +58 -36
  156. package/tests/server/streaming-ssr.test.tsrx +4 -4
  157. package/tests/server/style-identifier.test.tsrx +58 -66
  158. package/tests/server/switch.test.tsrx +89 -97
  159. package/tests/server/track-async-serialization.test.tsrx +85 -103
  160. package/tests/server/try.test.tsrx +275 -360
  161. package/tests/utils/ref-types.test.js +72 -0
  162. package/tests/utils/vite-plugin-config.test.js +41 -74
  163. package/types/index.d.ts +1 -0
  164. package/src/runtime/internal/client/compat.js +0 -40
  165. package/tests/utils/compiler-compat-config.test.js +0 -38
@@ -3,15 +3,17 @@ import { compile } from '@tsrx/ripple';
3
3
  describe('CSS :global edge cases', () => {
4
4
  it('handles multiple :global selectors in one rule', () => {
5
5
  const source = `
6
- export function Test() { return <>
7
- <div>{'content'}</div>
8
-
9
- <style>
10
- :global(div), :global(span), p {
11
- color: red;
12
- }
13
- </style>
14
- </>; }`;
6
+ export function Test() @{
7
+ <>
8
+ <div>{'content'}</div>
9
+
10
+ <style>
11
+ :global(div), :global(span), p {
12
+ color: red;
13
+ }
14
+ </style>
15
+ </>
16
+ }`;
15
17
  const { css } = compile(source, 'test.tsrx');
16
18
 
17
19
  expect(css).toContain('div, span ');
@@ -20,19 +22,21 @@ export function Test() { return <>
20
22
 
21
23
  it('handles :global with attribute selectors', () => {
22
24
  const source = `
23
- export function Test() { return <>
24
- <div data-test="value">{'content'}</div>
25
-
26
- <style>
27
- :global([data-test]) {
28
- color: red;
29
- }
30
-
31
- div:global([data-foo="bar"]) {
32
- color: blue;
33
- }
34
- </style>
35
- </>; }`;
25
+ export function Test() @{
26
+ <>
27
+ <div data-test="value">{'content'}</div>
28
+
29
+ <style>
30
+ :global([data-test]) {
31
+ color: red;
32
+ }
33
+
34
+ div:global([data-foo="bar"]) {
35
+ color: blue;
36
+ }
37
+ </style>
38
+ </>
39
+ }`;
36
40
  const { css } = compile(source, 'test.tsrx');
37
41
 
38
42
  expect(css).toContain('[data-test] {');
@@ -41,19 +45,21 @@ export function Test() { return <>
41
45
 
42
46
  it('handles :global with universal selector', () => {
43
47
  const source = `
44
- export function Test() { return <>
45
- <div>{'content'}</div>
46
-
47
- <style>
48
- :global(*) {
49
- box-sizing: border-box;
50
- }
51
-
52
- div :global(*) {
53
- margin: 0;
54
- }
55
- </style>
56
- </>; }`;
48
+ export function Test() @{
49
+ <>
50
+ <div>{'content'}</div>
51
+
52
+ <style>
53
+ :global(*) {
54
+ box-sizing: border-box;
55
+ }
56
+
57
+ div :global(*) {
58
+ margin: 0;
59
+ }
60
+ </style>
61
+ </>
62
+ }`;
57
63
  const { css } = compile(source, 'test.tsrx');
58
64
 
59
65
  expect(css).toContain('* {');
@@ -62,19 +68,21 @@ export function Test() { return <>
62
68
 
63
69
  it('handles :global with ID selectors', () => {
64
70
  const source = `
65
- export function Test() { return <>
66
- <div id="test">{'content'}</div>
67
-
68
- <style>
69
- :global(#app) {
70
- width: 100%;
71
- }
72
-
73
- div :global(#test) {
74
- color: red;
75
- }
76
- </style>
77
- </>; }`;
71
+ export function Test() @{
72
+ <>
73
+ <div id="test">{'content'}</div>
74
+
75
+ <style>
76
+ :global(#app) {
77
+ width: 100%;
78
+ }
79
+
80
+ div :global(#test) {
81
+ color: red;
82
+ }
83
+ </style>
84
+ </>
85
+ }`;
78
86
  const { css } = compile(source, 'test.tsrx');
79
87
 
80
88
  expect(css).toContain('#app {');
@@ -85,19 +93,21 @@ export function Test() { return <>
85
93
 
86
94
  it('handles :global with pseudo-elements', () => {
87
95
  const source = `
88
- export function Test() { return <>
89
- <div>{'content'}</div>
90
-
91
- <style>
92
- :global(div)::before {
93
- content: "before";
94
- }
95
-
96
- div :global(span)::after {
97
- content: "after";
98
- }
99
- </style>
100
- </>; }`;
96
+ export function Test() @{
97
+ <>
98
+ <div>{'content'}</div>
99
+
100
+ <style>
101
+ :global(div)::before {
102
+ content: "before";
103
+ }
104
+
105
+ div :global(span)::after {
106
+ content: "after";
107
+ }
108
+ </style>
109
+ </>
110
+ }`;
101
111
  const { css } = compile(source, 'test.tsrx');
102
112
 
103
113
  expect(css).toContain('div::before {');
@@ -107,17 +117,19 @@ export function Test() { return <>
107
117
 
108
118
  it('handles empty :global blocks', () => {
109
119
  const source = `
110
- export function Test() { return <>
111
- <div>{'content'}</div>
112
-
113
- <style>
114
- div {
115
- :global {
120
+ export function Test() @{
121
+ <>
122
+ <div>{'content'}</div>
123
+
124
+ <style>
125
+ div {
126
+ :global {
127
+ }
128
+ color: red;
116
129
  }
117
- color: red;
118
- }
119
- </style>
120
- </>; }`;
130
+ </style>
131
+ </>
132
+ }`;
121
133
  const { css } = compile(source, 'test.tsrx');
122
134
 
123
135
  expect(css).toContain('color: red');
@@ -126,23 +138,25 @@ export function Test() { return <>
126
138
 
127
139
  it('handles :global with complex selector chains', () => {
128
140
  const source = `
129
- export function Test() { return <>
130
- <div class="container">
131
- <span class="wrapper foo">
132
- <button class="bar"><span>{'click'}</span></button>
133
- </span>
134
- </div>
135
-
136
- <style>
137
- :global(div.container) > span.wrapper + :global(button[disabled]) {
138
- color: red;
139
- }
140
-
141
- :global(.foo > .bar) span {
142
- color: blue;
143
- }
144
- </style>
145
- </>; }`;
141
+ export function Test() @{
142
+ <>
143
+ <div class="container">
144
+ <span class="wrapper foo">
145
+ <button class="bar"><span>{'click'}</span></button>
146
+ </span>
147
+ </div>
148
+
149
+ <style>
150
+ :global(div.container) > span.wrapper + :global(button[disabled]) {
151
+ color: red;
152
+ }
153
+
154
+ :global(.foo > .bar) span {
155
+ color: blue;
156
+ }
157
+ </style>
158
+ </>
159
+ }`;
146
160
  const { css } = compile(source, 'test.tsrx');
147
161
 
148
162
  expect(css).toMatch(/div\.container > span.wrapper\.tsrx-[a-z0-9]+ \+ button\[disabled\] {/);
@@ -151,19 +165,21 @@ export function Test() { return <>
151
165
 
152
166
  it('rejects :global in the middle of a selector sequence', () => {
153
167
  const source = `
154
- export function Test() { return <>
155
- <div>
156
- <span class="foo">
157
- <button class="bar">{'click'}</button>
158
- </span>
159
- </div>
160
-
161
- <style>
162
- div :global(.foo > .bar) span {
163
- color: red;
164
- }
165
- </style>
166
- </>; }`;
168
+ export function Test() @{
169
+ <>
170
+ <div>
171
+ <span class="foo">
172
+ <button class="bar">{'click'}</button>
173
+ </span>
174
+ </div>
175
+
176
+ <style>
177
+ div :global(.foo > .bar) span {
178
+ color: red;
179
+ }
180
+ </style>
181
+ </>
182
+ }`;
167
183
 
168
184
  expect(() => compile(source, 'test.tsrx')).toThrow(
169
185
  ':global(...) can be at the start or end of a selector sequence, but not in the middle',
@@ -172,25 +188,27 @@ export function Test() { return <>
172
188
 
173
189
  it('handles :global at start and end of selector', () => {
174
190
  const source = `
175
- export function Test() { return <>
176
- <div>
177
- <span>{'content'}</span>
178
- </div>
179
-
180
- <style>
181
- :global(html) div span {
182
- color: red;
183
- }
184
-
185
- div span :global(strong) {
186
- color: blue;
187
- }
188
-
189
- :global(body) div :global(em) {
190
- color: green;
191
- }
192
- </style>
193
- </>; }`;
191
+ export function Test() @{
192
+ <>
193
+ <div>
194
+ <span>{'content'}</span>
195
+ </div>
196
+
197
+ <style>
198
+ :global(html) div span {
199
+ color: red;
200
+ }
201
+
202
+ div span :global(strong) {
203
+ color: blue;
204
+ }
205
+
206
+ :global(body) div :global(em) {
207
+ color: green;
208
+ }
209
+ </style>
210
+ </>
211
+ }`;
194
212
  const { css } = compile(source, 'test.tsrx');
195
213
 
196
214
  expect(css).toMatch(/html div\.tsrx-[a-z0-9]+ span:where\(\.tsrx-[a-z0-9]+\) {/);
@@ -3,20 +3,22 @@ import { compile } from '@tsrx/ripple';
3
3
  describe('CSS :global with keyframes', () => {
4
4
  it('handles -global- prefix for keyframes', () => {
5
5
  const source = `
6
- export function Test() { return <>
7
- <div>{'animated'}</div>
8
-
9
- <style>
10
- @keyframes -global-foo {
11
- 0% { opacity: 0; }
12
- 100% { opacity: 1; }
13
- }
14
-
15
- div {
16
- animation: foo 1s;
17
- }
18
- </style>
19
- </>; }`;
6
+ export function Test() @{
7
+ <>
8
+ <div>{'animated'}</div>
9
+
10
+ <style>
11
+ @keyframes -global-foo {
12
+ 0% { opacity: 0; }
13
+ 100% { opacity: 1; }
14
+ }
15
+
16
+ div {
17
+ animation: foo 1s;
18
+ }
19
+ </style>
20
+ </>
21
+ }`;
20
22
  const { css } = compile(source, 'test.tsrx');
21
23
 
22
24
  expect(css).toContain('@keyframes foo');
@@ -26,16 +28,18 @@ export function Test() { return <>
26
28
 
27
29
  it('handles scoped keyframes without -global- prefix', () => {
28
30
  const source = `
29
- export function Test() { return <>
30
- <div>{'animated'}</div>
31
-
32
- <style>
33
- @keyframes foo {
34
- 0% { opacity: 0; }
35
- 100% { opacity: 1; }
36
- }
37
- </style>
38
- </>; }`;
31
+ export function Test() @{
32
+ <>
33
+ <div>{'animated'}</div>
34
+
35
+ <style>
36
+ @keyframes foo {
37
+ 0% { opacity: 0; }
38
+ 100% { opacity: 1; }
39
+ }
40
+ </style>
41
+ </>
42
+ }`;
39
43
  const { css } = compile(source, 'test.tsrx');
40
44
 
41
45
  expect(css).toMatch(/@keyframes tsrx-[a-z0-9]+-foo/);
@@ -43,30 +47,32 @@ export function Test() { return <>
43
47
 
44
48
  it('handles mix of global and scoped keyframes', () => {
45
49
  const source = `
46
- export function Test() { return <>
47
- <div class="global-anim">{'one'}</div>
48
- <div class="scoped-anim">{'two'}</div>
49
-
50
- <style>
51
- @keyframes -global-fadeIn {
52
- 0% { opacity: 0; }
53
- 100% { opacity: 1; }
54
- }
55
-
56
- @keyframes slideIn {
57
- 0% { transform: translateX(-100%); }
58
- 100% { transform: translateX(0); }
59
- }
60
-
61
- .global-anim {
62
- animation: fadeIn 1s;
63
- }
64
-
65
- .scoped-anim {
66
- animation: slideIn 1s;
67
- }
68
- </style>
69
- </>; }`;
50
+ export function Test() @{
51
+ <>
52
+ <div class="global-anim">{'one'}</div>
53
+ <div class="scoped-anim">{'two'}</div>
54
+
55
+ <style>
56
+ @keyframes -global-fadeIn {
57
+ 0% { opacity: 0; }
58
+ 100% { opacity: 1; }
59
+ }
60
+
61
+ @keyframes slideIn {
62
+ 0% { transform: translateX(-100%); }
63
+ 100% { transform: translateX(0); }
64
+ }
65
+
66
+ .global-anim {
67
+ animation: fadeIn 1s;
68
+ }
69
+
70
+ .scoped-anim {
71
+ animation: slideIn 1s;
72
+ }
73
+ </style>
74
+ </>
75
+ }`;
70
76
  const { css } = compile(source, 'test.tsrx');
71
77
 
72
78
  expect(css).toContain('@keyframes fadeIn');
@@ -78,21 +84,23 @@ export function Test() { return <>
78
84
 
79
85
  it('handles multiple animations with global keyframes', () => {
80
86
  const source = `
81
- export function Test() { return <>
82
- <div>{'animated'}</div>
83
-
84
- <style>
85
- @keyframes -global-foo {
86
- 0% { opacity: 0; }
87
- 100% { opacity: 1; }
88
- }
89
-
90
- @keyframes -global-bar {
91
- 0% { transform: scale(0); }
92
- 100% { transform: scale(1); }
93
- }
94
- </style>
95
- </>; }`;
87
+ export function Test() @{
88
+ <>
89
+ <div>{'animated'}</div>
90
+
91
+ <style>
92
+ @keyframes -global-foo {
93
+ 0% { opacity: 0; }
94
+ 100% { opacity: 1; }
95
+ }
96
+
97
+ @keyframes -global-bar {
98
+ 0% { transform: scale(0); }
99
+ 100% { transform: scale(1); }
100
+ }
101
+ </style>
102
+ </>
103
+ }`;
96
104
  const { css } = compile(source, 'test.tsrx');
97
105
 
98
106
  expect(css).toContain('@keyframes foo');
@@ -101,39 +109,43 @@ export function Test() { return <>
101
109
 
102
110
  it('handles animation property referencing keyframes (not marking as unused)', () => {
103
111
  const source = `
104
- export function Parent() { return <>
105
- <div class="parent">
106
- <Child />
107
- </div>
108
-
109
- <style>
110
- /* Scoped keyframe - only usable within Parent */
111
- @keyframes slideIn {
112
- from { transform: translateX(-100%); }
113
- to { transform: translateX(0); }
114
- }
115
-
116
- /* Global keyframe - usable in any component */
117
- @keyframes -global-fadeIn {
118
- 0% { opacity: 0; }
119
- 100% { opacity: 1; }
120
- }
121
-
122
- .parent {
123
- animation: slideIn 1s;
124
- }
125
- </style>
126
- </>; }
127
-
128
- function Child() { return <>
129
- <div class="child">{'Child content'}</div>
130
-
131
- <style>
132
- .child {
133
- animation: fadeIn 3s; /* Uses global fadeIn from Parent */
134
- }
135
- </style>
136
- </>; }`;
112
+ export function Parent() @{
113
+ <>
114
+ <div class="parent">
115
+ <Child />
116
+ </div>
117
+
118
+ <style>
119
+ /* Scoped keyframe - only usable within Parent */
120
+ @keyframes slideIn {
121
+ from { transform: translateX(-100%); }
122
+ to { transform: translateX(0); }
123
+ }
124
+
125
+ /* Global keyframe - usable in any component */
126
+ @keyframes -global-fadeIn {
127
+ 0% { opacity: 0; }
128
+ 100% { opacity: 1; }
129
+ }
130
+
131
+ .parent {
132
+ animation: slideIn 1s;
133
+ }
134
+ </style>
135
+ </>
136
+ }
137
+
138
+ function Child() @{
139
+ <>
140
+ <div class="child">{'Child content'}</div>
141
+
142
+ <style>
143
+ .child {
144
+ animation: fadeIn 3s; /* Uses global fadeIn from Parent */
145
+ }
146
+ </style>
147
+ </>
148
+ }`;
137
149
  const { css } = compile(source, 'test.tsrx');
138
150
 
139
151
  // Parent should have scoped slideIn and global fadeIn