ripple 0.3.72 → 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 +66 -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 +55 -61
  23. package/tests/client/basic/basic.components.test.tsrx +196 -218
  24. package/tests/client/basic/basic.errors.test.tsrx +70 -76
  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 +357 -288
  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 +286 -292
  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 +390 -319
  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 -258
  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 +117 -162
  143. package/tests/server/basic.components.test.tsrx +163 -193
  144. package/tests/server/basic.test.tsrx +298 -198
  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
@@ -2,369 +2,327 @@
2
2
  import { track } from 'ripple';
3
3
  import type { Children } from 'ripple';
4
4
 
5
- export function StaticText() {
6
- return <><div>{'Hello World'}</div></>;
5
+ export function StaticText() @{
6
+ <div>{'Hello World'}</div>
7
7
  }
8
8
 
9
- export function MultipleElements() {
10
- return <>
9
+ export function MultipleElements() @{
10
+ <>
11
11
  <h1>{'Title'}</h1>
12
12
  <p>{'Paragraph text'}</p>
13
13
  <span>{'Span text'}</span>
14
- </>;
14
+ </>
15
15
  }
16
16
 
17
- export function NestedElements() {
18
- return <>
19
- <div class="outer">
20
- <div class="inner">
21
- <span>{'Nested content'}</span>
22
- </div>
17
+ export function NestedElements() @{
18
+ <div class="outer">
19
+ <div class="inner">
20
+ <span>{'Nested content'}</span>
23
21
  </div>
24
- </>;
22
+ </div>
25
23
  }
26
24
 
27
- export function WithAttributes() {
28
- return <>
25
+ export function WithAttributes() @{
26
+ <>
29
27
  <input type="text" placeholder="Enter text" disabled />
30
28
  <a href="/link" target="_blank">{'Link'}</a>
31
- </>;
29
+ </>
32
30
  }
33
31
 
34
- export function ChildComponent() {
35
- return <><span class="child">{'Child content'}</span></>;
32
+ export function ChildComponent() @{
33
+ <span class="child">{'Child content'}</span>
36
34
  }
37
35
 
38
- export function ParentWithChild() {
39
- return <>
40
- <div class="parent">
41
- <ChildComponent />
42
- </div>
43
- </>;
36
+ export function ParentWithChild() @{
37
+ <div class="parent">
38
+ <ChildComponent />
39
+ </div>
44
40
  }
45
41
 
46
- export function FirstSibling() {
47
- return <><div class="first">{'First'}</div></>;
42
+ export function FirstSibling() @{
43
+ <div class="first">{'First'}</div>
48
44
  }
49
45
 
50
- export function SecondSibling() {
51
- return <><div class="second">{'Second'}</div></>;
46
+ export function SecondSibling() @{
47
+ <div class="second">{'Second'}</div>
52
48
  }
53
49
 
54
- export function SiblingComponents() {
55
- return <>
50
+ export function SiblingComponents() @{
51
+ <>
56
52
  <FirstSibling />
57
53
  <SecondSibling />
58
- </>;
54
+ </>
59
55
  }
60
56
 
61
- export function Greeting(props: { name: string }) {
62
- return <>
63
- <div>
64
- {'Hello '}
65
- {props.name}
66
- </div>
67
- </>;
57
+ export function Greeting(props: { name: string }) @{
58
+ <div>
59
+ {'Hello '}
60
+ {props.name}
61
+ </div>
68
62
  }
69
63
 
70
- export function WithGreeting() {
71
- return <><Greeting name="World" /></>;
64
+ export function WithGreeting() @{
65
+ <Greeting name="World" />
72
66
  }
73
67
 
74
- export function ExpressionContent() {
75
- return <>
76
- const value = 42;
77
- const label = 'computed';
68
+ export function ExpressionContent() @{
69
+ const value = 42;
70
+ const label = 'computed';
71
+ <>
78
72
  <div>{value}</div>
79
73
  <span>{label.toUpperCase()}</span>
80
- </>;
74
+ </>
81
75
  }
82
76
 
83
- function NestedHelperItem({ item }: { item: number }) {
84
- return <><div class="helper-item">{item}</div></>;
77
+ function NestedHelperItem({ item }: { item: number }) @{
78
+ <div class="helper-item">{item}</div>
85
79
  }
86
80
 
87
- function NestedTsxTsrxFragment({ label }: { label: string }) {
88
- return <>
81
+ function NestedTsxTsrxFragment({ label }: { label: string }) @{
82
+ <>
89
83
  <span class="label">{label}</span>
90
- for (const item of [1, 2, 3, 4]) {
84
+ @for (const item of [1, 2, 3, 4]) {
91
85
  <NestedHelperItem {item} />
92
86
  }
93
- </>;
87
+ </>
94
88
  }
95
89
 
96
- export function NestedTsxTsrxExpressionValues() {
97
- return <>
98
- for (const item of [1, 2, 3]) {
90
+ export function NestedTsxTsrxExpressionValues() @{
91
+ <div class="nested-expression-values">
92
+ @for (const item of [1, 2, 3]) {
99
93
  <div class="app-item">{item}</div>
100
94
  }
101
95
  <NestedTsxTsrxFragment label="from helper" />
102
- </>;
103
- }
104
-
105
- export function MixedTsrxCollectionText() {
106
- return <>
107
- const content = <>
108
- {[
109
- 'alpha ',
110
- <strong class="middle">{'beta'}</strong>,
111
- ' gamma ',
112
- [
113
- 'delta ',
114
- <em class="tail">{'epsilon'}</em>,
115
- ' zeta',
116
- ],
117
- ]}
118
- </>;
119
- <div class="mixed-collection">{content}</div>
120
- </>;
121
- }
122
-
123
- export function MixedTsrxCollectionSplitServerText() {
124
- return <>
125
- const content = <>
126
- {[
127
- 'alpha ',
128
- <strong class="middle">{'beta'}</strong>,
129
- ' gamma ',
130
- [
131
- 'delta ',
132
- <em class="tail">{'epsilon'}</em>,
133
- ' zeta',
134
- ],
135
- ]}
136
- </>;
137
- <div class="mixed-collection-split">{content}</div>
138
- </>;
139
- }
140
-
141
- export function MixedTsrxCollectionSplitClientText() {
142
- return <>
143
- const content = <>
144
- {[
145
- 'alpha ',
146
- <strong class="middle">{'beta'}</strong>,
147
- ' gamma ',
148
- [
149
- 'changed ',
150
- <em class="tail">{'epsilon'}</em>,
151
- ' zeta',
152
- ],
153
- ]}
154
- </>;
155
- <div class="mixed-collection-split">{content}</div>
156
- </>;
157
- }
158
-
159
- export function MixedTsrxCollectionPrimitiveServerText() {
160
- return <>
161
- const content = <>
162
- {[
163
- 'count: ',
164
- 1,
165
- ' / ',
166
- true,
167
- <span class="primitive-tail">{' ok'}</span>,
168
- ]}
169
- </>;
170
- <div class="mixed-collection-primitive">{content}</div>
171
- </>;
172
- }
173
-
174
- export function MixedTsrxCollectionPrimitiveClientText() {
175
- return <>
176
- const content = <>
177
- {[
178
- 'count: ',
179
- 2,
180
- ' / ',
181
- false,
182
- <span class="primitive-tail">{' ok'}</span>,
183
- ]}
184
- </>;
185
- <div class="mixed-collection-primitive">{content}</div>
186
- </>;
96
+ </div>
97
+ }
98
+
99
+ export function MixedTsrxCollectionText() @{
100
+ const content = <>
101
+ {[
102
+ 'alpha ',
103
+ <strong class="middle">{'beta'}</strong>,
104
+ ' gamma ',
105
+ [
106
+ 'delta ',
107
+ <em class="tail">{'epsilon'}</em>,
108
+ ' zeta',
109
+ ],
110
+ ]}
111
+ </>;
112
+ <div class="mixed-collection">{content}</div>
113
+ }
114
+
115
+ export function MixedTsrxCollectionSplitServerText() @{
116
+ const content = <>
117
+ {[
118
+ 'alpha ',
119
+ <strong class="middle">{'beta'}</strong>,
120
+ ' gamma ',
121
+ [
122
+ 'delta ',
123
+ <em class="tail">{'epsilon'}</em>,
124
+ ' zeta',
125
+ ],
126
+ ]}
127
+ </>;
128
+ <div class="mixed-collection-split">{content}</div>
129
+ }
130
+
131
+ export function MixedTsrxCollectionSplitClientText() @{
132
+ const content = <>
133
+ {[
134
+ 'alpha ',
135
+ <strong class="middle">{'beta'}</strong>,
136
+ ' gamma ',
137
+ [
138
+ 'changed ',
139
+ <em class="tail">{'epsilon'}</em>,
140
+ ' zeta',
141
+ ],
142
+ ]}
143
+ </>;
144
+ <div class="mixed-collection-split">{content}</div>
145
+ }
146
+
147
+ export function MixedTsrxCollectionPrimitiveServerText() @{
148
+ const content = <>
149
+ {[
150
+ 'count: ',
151
+ 1,
152
+ ' / ',
153
+ true,
154
+ <span class="primitive-tail">{' ok'}</span>,
155
+ ]}
156
+ </>;
157
+ <div class="mixed-collection-primitive">{content}</div>
158
+ }
159
+
160
+ export function MixedTsrxCollectionPrimitiveClientText() @{
161
+ const content = <>
162
+ {[
163
+ 'count: ',
164
+ 2,
165
+ ' / ',
166
+ false,
167
+ <span class="primitive-tail">{' ok'}</span>,
168
+ ]}
169
+ </>;
170
+ <div class="mixed-collection-primitive">{content}</div>
187
171
  }
188
172
 
189
173
  function createPrimitiveItems() {
190
174
  return ['start:', ['one', 2], true, null, false, ':end'];
191
175
  }
192
176
 
193
- export function DynamicArrayFromCall() {
194
- return <>
195
- const items = createPrimitiveItems();
196
- <div class="dynamic-array-call">{items}</div>
197
- </>;
177
+ export function DynamicArrayFromCall() @{
178
+ const items = createPrimitiveItems();
179
+ <div class="dynamic-array-call">{items}</div>
198
180
  }
199
181
 
200
- export function DynamicArrayFromTrack() {
201
- return <>
202
- let &[items] = track(['start:', ['one', 2], true, null, false, ':end']);
203
- <div class="dynamic-array-track">{items}</div>
204
- </>;
182
+ export function DynamicArrayFromTrack() @{
183
+ let &[items] = track(['start:', ['one', 2], true, null, false, ':end']);
184
+ <div class="dynamic-array-track">{items}</div>
205
185
  }
206
186
 
207
- export function DynamicArrayFromConditional() {
208
- return <>
209
- const condition = true;
210
- const items = condition ? ['start:', ['one', 2], true, null, false, ':end'] : ['fallback'];
211
- <div class="dynamic-array-conditional">{items}</div>
212
- </>;
187
+ export function DynamicArrayFromConditional() @{
188
+ const condition = true;
189
+ const items = condition ? ['start:', ['one', 2], true, null, false, ':end'] : ['fallback'];
190
+ <div class="dynamic-array-conditional">{items}</div>
213
191
  }
214
192
 
215
- export function DynamicArrayFromLogical() {
216
- return <>
217
- const condition = true;
218
- const items = condition && ['start:', ['one', 2], true, null, false, ':end'];
219
- <div class="dynamic-array-logical">{items}</div>
220
- </>;
193
+ export function DynamicArrayFromLogical() @{
194
+ const condition = true;
195
+ const items = condition && ['start:', ['one', 2], true, null, false, ':end'];
196
+ <div class="dynamic-array-logical">{items}</div>
221
197
  }
222
198
 
223
- export function NestedTsrxInsideTopLevelTsxExpression() {
224
- return <>
225
- const content = <>
226
- <section class="outer">
227
- {<><div class="inner">{'from tsrx'}</div></>}
228
- </section>
229
- </>;
230
- {content}
199
+ export function NestedTsrxInsideTopLevelTsxExpression() @{
200
+ const content = <>
201
+ <section class="outer">
202
+ <div class="inner">{'from tsrx'}</div>
203
+ </section>
231
204
  </>;
205
+ <>
206
+ {content}
207
+ </>
232
208
  }
233
209
 
234
- export function NestedTsrxElementsInsideTopLevelTsxValue() {
235
- return <>
236
- const content = <>
237
- <div class="wrapper">
238
- {<>
239
- <section class="native">
240
- <span class="nested-tsrx">{'inside nested tsrx'}</span>
241
- </section>
242
- </>}
243
- </div>
244
- </>;
245
- {content}
210
+ export function NestedTsrxElementsInsideTopLevelTsxValue() @{
211
+ const content = <>
212
+ <div class="wrapper">
213
+ <section class="native">
214
+ <span class="nested-tsrx">{'inside nested tsrx'}</span>
215
+ </section>
216
+ </div>
246
217
  </>;
218
+ <>
219
+ {content}
220
+ </>
247
221
  }
248
222
 
249
- export function TsxDeclaredBeforeTopLevelTsx() {
250
- return <>
251
- const nested = <><span class="nested-tsx">{'inside nested tsx'}</span></>;
252
- const content = <><div class="native">{nested}</div></>;
223
+ export function TsxDeclaredBeforeTopLevelTsx() @{
224
+ const nested = <span class="nested-tsx">inside nested tsx</span>;
225
+ const content = <><div class="native">{nested}</div></>;
226
+ <>
253
227
  {content}
254
- </>;
228
+ </>
255
229
  }
256
230
 
257
- function TextProp(&{ children }: { children: string }) {
258
- return <><div class="text-prop">{children}</div></>;
231
+ function TextProp(&{ children }: { children: string }) @{
232
+ <div class="text-prop">{children}</div>
259
233
  }
260
234
 
261
- export function TextPropWithToggle() {
262
- return <>
263
- let &[show] = track(false);
235
+ export function TextPropWithToggle() @{
236
+ let &[show] = track(false);
237
+ <>
264
238
  <TextProp children={show ? 'hello' : ''} />
265
239
  <button class="show-text" onClick={() => (show = true)}>{'Show'}</button>
266
- </>;
240
+ </>
267
241
  }
268
242
 
269
243
  // Test for static content in child component followed by sibling content
270
- function StaticHeader() {
271
- return <>
244
+ function StaticHeader() @{
245
+ <>
272
246
  <h1 class="sr-only">{'heading'}</h1>
273
247
  <p class="subtitle">{'first paragraph'}</p>
274
248
  <p class="subtitle">{'second paragraph'}</p>
275
- </>;
249
+ </>
276
250
  }
277
251
 
278
- export function StaticChildWithSiblings() {
279
- return <>
280
- const foo = 'bar';
252
+ export function StaticChildWithSiblings() @{
253
+ const foo = 'bar';
254
+ <>
281
255
  <StaticHeader />
282
256
  <span class="sibling1">{foo}</span>
283
257
  <span class="sibling2">{foo}</span>
284
- </>;
258
+ </>
285
259
  }
286
260
 
287
261
  // Website-like components for testing complex hydration scenarios
288
262
 
289
- function Header() {
290
- return <>
263
+ function Header() @{
264
+ <>
291
265
  <h1 class="sr-only">{'Ripple'}</h1>
292
266
  <img src="/images/logo.png" alt="Logo" class="logo" />
293
267
  <p class="subtitle">{'the elegant TypeScript UI framework'}</p>
294
- </>;
268
+ </>
295
269
  }
296
270
 
297
- function Actions({ playgroundVisible = false }: { playgroundVisible: boolean }) {
298
- return <>
299
- <div class="social-links">
300
- <a href="https://github.com" class="github-link">{'GitHub'}</a>
301
- <a href="https://discord.com" class="discord-link">{'Discord'}</a>
302
- if (playgroundVisible) {
303
- <a href="/playground" class="playground-link">{'Playground'}</a>
304
- }
305
- </div>
306
- </>;
271
+ function Actions({ playgroundVisible = false }: { playgroundVisible: boolean }) @{
272
+ <div class="social-links">
273
+ <a href="https://github.com" class="github-link">{'GitHub'}</a>
274
+ <a href="https://discord.com" class="discord-link">{'Discord'}</a>
275
+ {playgroundVisible ? <a href="/playground" class="playground-link">{'Playground'}</a> : null}
276
+ </div>
307
277
  }
308
278
 
309
- function Layout({ children }: { children: Children }) {
310
- return <>
311
- <main>
312
- <div class="container">{children}</div>
313
- </main>
314
- </>;
279
+ function Layout({ children }: { children: Children }) @{
280
+ <main>
281
+ <div class="container">{children}</div>
282
+ </main>
315
283
  }
316
284
 
317
- function Content() {
318
- return <>
319
- <div class="content">
320
- <p>{'Some content here'}</p>
321
- </div>
322
- </>;
285
+ function Content() @{
286
+ <div class="content">
287
+ <p>{'Some content here'}</p>
288
+ </div>
323
289
  }
324
290
 
325
- export function WebsiteIndex() {
326
- return <>
327
- <Layout>
328
- <Header />
329
- <Actions playgroundVisible={true} />
330
- <Content />
331
- <Actions playgroundVisible={false} />
332
- </Layout>
333
- </>;
291
+ export function WebsiteIndex() @{
292
+ <Layout>
293
+ <Header />
294
+ <Actions playgroundVisible={true} />
295
+ <Content />
296
+ <Actions playgroundVisible={false} />
297
+ </Layout>
334
298
  }
335
299
 
336
300
  // Test case for component as last element with no following siblings.
337
301
  // This exercises hydrate_advance() in append() - at the end of content,
338
302
  // there's no next sibling and that should be handled gracefully.
339
- function LastChild() {
340
- return <><footer class="last-child">{'I am the last child'}</footer></>;
303
+ function LastChild() @{
304
+ <footer class="last-child">{'I am the last child'}</footer>
341
305
  }
342
306
 
343
- export function ComponentAsLastSibling() {
344
- return <>
345
- <div class="wrapper">
346
- <h1>{'Header'}</h1>
347
- <p>{'Some content'}</p>
348
- <LastChild />
349
- </div>
350
- </>;
307
+ export function ComponentAsLastSibling() @{
308
+ <div class="wrapper">
309
+ <h1>{'Header'}</h1>
310
+ <p>{'Some content'}</p>
311
+ <LastChild />
312
+ </div>
351
313
  }
352
314
 
353
315
  // Nested version - component is last child inside another component
354
- function InnerContent() {
355
- return <>
356
- <div class="inner">
357
- <span>{'Inner text'}</span>
358
- <LastChild />
359
- </div>
360
- </>;
361
- }
362
-
363
- export function NestedComponentAsLastSibling() {
364
- return <>
365
- <section class="outer">
366
- <h2>{'Section title'}</h2>
367
- <InnerContent />
368
- </section>
369
- </>;
316
+ function InnerContent() @{
317
+ <div class="inner">
318
+ <span>{'Inner text'}</span>
319
+ <LastChild />
320
+ </div>
321
+ }
322
+
323
+ export function NestedComponentAsLastSibling() @{
324
+ <section class="outer">
325
+ <h2>{'Section title'}</h2>
326
+ <InnerContent />
327
+ </section>
370
328
  }