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.
- package/CHANGELOG.md +75 -0
- package/package.json +3 -3
- package/src/jsx-runtime.d.ts +2 -8
- package/src/runtime/index-client.js +3 -13
- package/src/runtime/internal/client/blocks.js +3 -25
- package/src/runtime/internal/client/for.js +80 -5
- package/src/runtime/internal/client/index.js +0 -2
- package/src/runtime/internal/client/types.d.ts +0 -10
- package/tests/client/__snapshots__/computed-properties.test.tsrx.snap +8 -0
- package/tests/client/__snapshots__/for.test.tsrx.snap +22 -0
- package/tests/client/__snapshots__/html.test.tsrx.snap +4 -0
- package/tests/client/array/array.copy-within.test.tsrx +19 -19
- package/tests/client/array/array.derived.test.tsrx +97 -109
- package/tests/client/array/array.iteration.test.tsrx +28 -28
- package/tests/client/array/array.mutations.test.tsrx +68 -68
- package/tests/client/array/array.static.test.tsrx +82 -92
- package/tests/client/array/array.to-methods.test.tsrx +15 -15
- package/tests/client/async-suspend.test.tsrx +180 -179
- package/tests/client/basic/__snapshots__/basic.attributes.test.tsrx.snap +2 -0
- package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +4 -0
- package/tests/client/basic/basic.attributes.test.tsrx +273 -317
- package/tests/client/basic/basic.collections.test.tsrx +59 -71
- package/tests/client/basic/basic.components.test.tsrx +196 -222
- package/tests/client/basic/basic.errors.test.tsrx +72 -78
- package/tests/client/basic/basic.events.test.tsrx +80 -85
- package/tests/client/basic/basic.get-set.test.tsrx +54 -64
- package/tests/client/basic/basic.hmr.test.tsrx +15 -19
- package/tests/client/basic/basic.reactivity.test.tsrx +121 -135
- package/tests/client/basic/basic.rendering.test.tsrx +273 -178
- package/tests/client/basic/basic.utilities.test.tsrx +8 -10
- package/tests/client/boundaries.test.tsrx +18 -18
- package/tests/client/compiler/compiler.assignments.test.tsrx +77 -76
- package/tests/client/compiler/compiler.attributes.test.tsrx +18 -14
- package/tests/client/compiler/compiler.basic.test.tsrx +364 -296
- package/tests/client/compiler/compiler.regex.test.tsrx +40 -44
- package/tests/client/compiler/compiler.tracked-access.test.tsrx +57 -38
- package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
- package/tests/client/compiler/compiler.typescript.test.tsrx +4 -3
- package/tests/client/composite/composite.dynamic-components.test.tsrx +41 -44
- package/tests/client/composite/composite.generics.test.tsrx +165 -167
- package/tests/client/composite/composite.props.test.tsrx +66 -74
- package/tests/client/composite/composite.reactivity.test.tsrx +132 -166
- package/tests/client/composite/composite.render.test.tsrx +92 -101
- package/tests/client/computed-properties.test.tsrx +14 -18
- package/tests/client/context.test.tsrx +14 -18
- package/tests/client/css/global-additional-cases.test.tsrx +491 -437
- package/tests/client/css/global-advanced-selectors.test.tsrx +169 -153
- package/tests/client/css/global-at-rules.test.tsrx +71 -66
- package/tests/client/css/global-basic.test.tsrx +105 -98
- package/tests/client/css/global-classes-ids.test.tsrx +128 -114
- package/tests/client/css/global-combinators.test.tsrx +83 -78
- package/tests/client/css/global-complex-nesting.test.tsrx +134 -120
- package/tests/client/css/global-edge-cases.test.tsrx +138 -120
- package/tests/client/css/global-keyframes.test.tsrx +108 -96
- package/tests/client/css/global-nested.test.tsrx +88 -78
- package/tests/client/css/global-pseudo.test.tsrx +104 -98
- package/tests/client/css/global-scoping.test.tsrx +145 -125
- package/tests/client/css/style-identifier.test.tsrx +62 -69
- package/tests/client/date.test.tsrx +83 -83
- package/tests/client/dynamic-elements.test.tsrx +227 -283
- package/tests/client/events.test.tsrx +252 -266
- package/tests/client/for.test.tsrx +120 -127
- package/tests/client/head.test.tsrx +40 -48
- package/tests/client/html.test.tsrx +37 -49
- package/tests/client/input-value.test.tsrx +1125 -1354
- package/tests/client/lazy-array.test.tsrx +10 -16
- package/tests/client/lazy-destructuring.test.tsrx +169 -221
- package/tests/client/map.test.tsrx +39 -41
- package/tests/client/media-query.test.tsrx +15 -19
- package/tests/client/object.test.tsrx +46 -56
- package/tests/client/portal.test.tsrx +31 -37
- package/tests/client/ref.test.tsrx +173 -193
- package/tests/client/return.test.tsrx +62 -37
- package/tests/client/set.test.tsrx +33 -33
- package/tests/client/svg.test.tsrx +195 -215
- package/tests/client/switch.test.tsrx +201 -191
- package/tests/client/track-async-hydration.test.tsrx +14 -18
- package/tests/client/tracked-index-access.test.tsrx +18 -28
- package/tests/client/try.test.tsrx +494 -619
- package/tests/client/tsx.test.tsrx +290 -371
- package/tests/client/typescript-generics.test.tsrx +121 -129
- package/tests/client/url/url.derived.test.tsrx +21 -25
- package/tests/client/url/url.parsing.test.tsrx +35 -35
- package/tests/client/url/url.partial-removal.test.tsrx +32 -32
- package/tests/client/url/url.reactivity.test.tsrx +68 -72
- package/tests/client/url/url.serialization.test.tsrx +8 -8
- package/tests/client/url-search-params/url-search-params.derived.test.tsrx +21 -27
- package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +16 -16
- package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +37 -37
- package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +56 -60
- package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +32 -34
- package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +9 -9
- package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +10 -10
- package/tests/hydration/compiled/client/basic.js +396 -325
- package/tests/hydration/compiled/client/composite.js +52 -44
- package/tests/hydration/compiled/client/for.js +734 -604
- package/tests/hydration/compiled/client/head.js +183 -103
- package/tests/hydration/compiled/client/html.js +93 -86
- package/tests/hydration/compiled/client/if-children.js +95 -71
- package/tests/hydration/compiled/client/if.js +113 -89
- package/tests/hydration/compiled/client/mixed-control-flow.js +225 -209
- package/tests/hydration/compiled/client/nested-control-flow.js +94 -98
- package/tests/hydration/compiled/client/reactivity.js +26 -24
- package/tests/hydration/compiled/client/return.js +8 -42
- package/tests/hydration/compiled/client/switch.js +208 -173
- package/tests/hydration/compiled/client/track-async-serialization.js +176 -128
- package/tests/hydration/compiled/client/try.js +29 -21
- package/tests/hydration/compiled/server/basic.js +210 -221
- package/tests/hydration/compiled/server/composite.js +13 -14
- package/tests/hydration/compiled/server/for.js +427 -444
- package/tests/hydration/compiled/server/head.js +199 -189
- package/tests/hydration/compiled/server/html.js +33 -41
- package/tests/hydration/compiled/server/if-children.js +114 -117
- package/tests/hydration/compiled/server/if.js +77 -83
- package/tests/hydration/compiled/server/mixed-control-flow.js +145 -150
- package/tests/hydration/compiled/server/nested-control-flow.js +10 -0
- package/tests/hydration/compiled/server/reactivity.js +24 -22
- package/tests/hydration/compiled/server/return.js +6 -18
- package/tests/hydration/compiled/server/switch.js +179 -176
- package/tests/hydration/compiled/server/track-async-serialization.js +88 -70
- package/tests/hydration/compiled/server/try.js +31 -35
- package/tests/hydration/components/basic.tsrx +216 -286
- package/tests/hydration/components/composite.tsrx +32 -42
- package/tests/hydration/components/events.tsrx +81 -101
- package/tests/hydration/components/for.tsrx +270 -336
- package/tests/hydration/components/head.tsrx +43 -39
- package/tests/hydration/components/hmr.tsrx +16 -22
- package/tests/hydration/components/html-in-template.tsrx +15 -21
- package/tests/hydration/components/html.tsrx +442 -526
- package/tests/hydration/components/if-children.tsrx +107 -125
- package/tests/hydration/components/if.tsrx +68 -90
- package/tests/hydration/components/mixed-control-flow.tsrx +65 -72
- package/tests/hydration/components/nested-control-flow.tsrx +202 -216
- package/tests/hydration/components/portal.tsrx +33 -41
- package/tests/hydration/components/reactivity.tsrx +26 -34
- package/tests/hydration/components/return.tsrx +4 -6
- package/tests/hydration/components/switch.tsrx +73 -78
- package/tests/hydration/components/track-async-serialization.tsrx +83 -93
- package/tests/hydration/components/try.tsrx +37 -51
- package/tests/hydration/switch.test.js +8 -8
- package/tests/server/await.test.tsrx +3 -3
- package/tests/server/basic.attributes.test.tsrx +120 -167
- package/tests/server/basic.components.test.tsrx +163 -197
- package/tests/server/basic.test.tsrx +298 -220
- package/tests/server/compiler.test.tsrx +142 -72
- package/tests/server/composite.props.test.tsrx +54 -58
- package/tests/server/composite.test.tsrx +165 -167
- package/tests/server/context.test.tsrx +13 -17
- package/tests/server/dynamic-elements.test.tsrx +103 -135
- package/tests/server/for.test.tsrx +115 -84
- package/tests/server/head.test.tsrx +31 -31
- package/tests/server/html-nesting-validation.test.tsrx +16 -8
- package/tests/server/if.test.tsrx +49 -59
- package/tests/server/lazy-destructuring.test.tsrx +288 -366
- package/tests/server/return.test.tsrx +58 -36
- package/tests/server/streaming-ssr.test.tsrx +4 -4
- package/tests/server/style-identifier.test.tsrx +58 -66
- package/tests/server/switch.test.tsrx +89 -97
- package/tests/server/track-async-serialization.test.tsrx +85 -103
- package/tests/server/try.test.tsrx +275 -360
- package/tests/utils/ref-types.test.js +72 -0
- package/tests/utils/vite-plugin-config.test.js +41 -74
- package/types/index.d.ts +1 -0
- package/src/runtime/internal/client/compat.js +0 -40
- package/tests/utils/compiler-compat-config.test.js +0 -38
|
@@ -2,397 +2,327 @@
|
|
|
2
2
|
import { track } from 'ripple';
|
|
3
3
|
import type { Children } from 'ripple';
|
|
4
4
|
|
|
5
|
-
export function StaticText() {
|
|
6
|
-
|
|
5
|
+
export function StaticText() @{
|
|
6
|
+
<div>{'Hello World'}</div>
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function MultipleElements() {
|
|
10
|
-
|
|
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
|
-
|
|
19
|
-
<div class="
|
|
20
|
-
<
|
|
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
|
-
|
|
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
|
-
|
|
32
|
+
export function ChildComponent() @{
|
|
33
|
+
<span class="child">{'Child content'}</span>
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
export function ParentWithChild() {
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
</div>
|
|
43
|
-
</>;
|
|
36
|
+
export function ParentWithChild() @{
|
|
37
|
+
<div class="parent">
|
|
38
|
+
<ChildComponent />
|
|
39
|
+
</div>
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
export function FirstSibling() {
|
|
47
|
-
|
|
42
|
+
export function FirstSibling() @{
|
|
43
|
+
<div class="first">{'First'}</div>
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
export function SecondSibling() {
|
|
51
|
-
|
|
46
|
+
export function SecondSibling() @{
|
|
47
|
+
<div class="second">{'Second'}</div>
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
export function SiblingComponents() {
|
|
55
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
64
|
+
export function WithGreeting() @{
|
|
65
|
+
<Greeting name="World" />
|
|
72
66
|
}
|
|
73
67
|
|
|
74
|
-
export function ExpressionContent() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
77
|
+
function NestedHelperItem({ item }: { item: number }) @{
|
|
78
|
+
<div class="helper-item">{item}</div>
|
|
85
79
|
}
|
|
86
80
|
|
|
87
|
-
function NestedTsxTsrxFragment({ label }: { label: string }) {
|
|
88
|
-
|
|
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
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
' / ',
|
|
178
|
-
true,
|
|
179
|
-
<span class="primitive-tail">
|
|
180
|
-
{' ok'}
|
|
181
|
-
</span>,
|
|
182
|
-
]}
|
|
183
|
-
</tsx>;
|
|
184
|
-
<div class="mixed-collection-primitive">{content}</div>
|
|
185
|
-
</>;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export function MixedTsrxCollectionPrimitiveClientText() {
|
|
189
|
-
return <>
|
|
190
|
-
const content = <tsx>
|
|
191
|
-
{[
|
|
192
|
-
'count: ',
|
|
193
|
-
2,
|
|
194
|
-
' / ',
|
|
195
|
-
false,
|
|
196
|
-
<span class="primitive-tail">
|
|
197
|
-
{' ok'}
|
|
198
|
-
</span>,
|
|
199
|
-
]}
|
|
200
|
-
</tsx>;
|
|
201
|
-
<div class="mixed-collection-primitive">{content}</div>
|
|
202
|
-
</>;
|
|
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>
|
|
203
171
|
}
|
|
204
172
|
|
|
205
173
|
function createPrimitiveItems() {
|
|
206
174
|
return ['start:', ['one', 2], true, null, false, ':end'];
|
|
207
175
|
}
|
|
208
176
|
|
|
209
|
-
export function DynamicArrayFromCall() {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
<div class="dynamic-array-call">{items}</div>
|
|
213
|
-
</>;
|
|
177
|
+
export function DynamicArrayFromCall() @{
|
|
178
|
+
const items = createPrimitiveItems();
|
|
179
|
+
<div class="dynamic-array-call">{items}</div>
|
|
214
180
|
}
|
|
215
181
|
|
|
216
|
-
export function DynamicArrayFromTrack() {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<div class="dynamic-array-track">{items}</div>
|
|
220
|
-
</>;
|
|
182
|
+
export function DynamicArrayFromTrack() @{
|
|
183
|
+
let &[items] = track(['start:', ['one', 2], true, null, false, ':end']);
|
|
184
|
+
<div class="dynamic-array-track">{items}</div>
|
|
221
185
|
}
|
|
222
186
|
|
|
223
|
-
export function DynamicArrayFromConditional() {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<div class="dynamic-array-conditional">{items}</div>
|
|
228
|
-
</>;
|
|
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>
|
|
229
191
|
}
|
|
230
192
|
|
|
231
|
-
export function DynamicArrayFromLogical() {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
<div class="dynamic-array-logical">{items}</div>
|
|
236
|
-
</>;
|
|
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>
|
|
237
197
|
}
|
|
238
198
|
|
|
239
|
-
export function NestedTsrxInsideTopLevelTsxExpression() {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
<div class="inner">
|
|
245
|
-
{'from tsrx'}
|
|
246
|
-
</div>
|
|
247
|
-
</>}
|
|
248
|
-
</section>
|
|
249
|
-
</tsx>;
|
|
250
|
-
{content}
|
|
199
|
+
export function NestedTsrxInsideTopLevelTsxExpression() @{
|
|
200
|
+
const content = <>
|
|
201
|
+
<section class="outer">
|
|
202
|
+
<div class="inner">{'from tsrx'}</div>
|
|
203
|
+
</section>
|
|
251
204
|
</>;
|
|
205
|
+
<>
|
|
206
|
+
{content}
|
|
207
|
+
</>
|
|
252
208
|
}
|
|
253
209
|
|
|
254
|
-
export function NestedTsrxElementsInsideTopLevelTsxValue() {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
<
|
|
258
|
-
{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
{'inside nested tsrx'}
|
|
262
|
-
</span>
|
|
263
|
-
</section>
|
|
264
|
-
</>}
|
|
265
|
-
</div>
|
|
266
|
-
</tsx>;
|
|
267
|
-
{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>
|
|
268
217
|
</>;
|
|
218
|
+
<>
|
|
219
|
+
{content}
|
|
220
|
+
</>
|
|
269
221
|
}
|
|
270
222
|
|
|
271
|
-
export function TsxDeclaredBeforeTopLevelTsx() {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
{'inside nested tsx'}
|
|
276
|
-
</span>
|
|
277
|
-
</tsx>;
|
|
278
|
-
const content = <tsx>
|
|
279
|
-
<div class="native">{nested}</div>
|
|
280
|
-
</tsx>;
|
|
223
|
+
export function TsxDeclaredBeforeTopLevelTsx() @{
|
|
224
|
+
const nested = <span class="nested-tsx">inside nested tsx</span>;
|
|
225
|
+
const content = <><div class="native">{nested}</div></>;
|
|
226
|
+
<>
|
|
281
227
|
{content}
|
|
282
|
-
|
|
228
|
+
</>
|
|
283
229
|
}
|
|
284
230
|
|
|
285
|
-
function TextProp(&{ children }: { children: string }) {
|
|
286
|
-
|
|
231
|
+
function TextProp(&{ children }: { children: string }) @{
|
|
232
|
+
<div class="text-prop">{children}</div>
|
|
287
233
|
}
|
|
288
234
|
|
|
289
|
-
export function TextPropWithToggle() {
|
|
290
|
-
|
|
291
|
-
|
|
235
|
+
export function TextPropWithToggle() @{
|
|
236
|
+
let &[show] = track(false);
|
|
237
|
+
<>
|
|
292
238
|
<TextProp children={show ? 'hello' : ''} />
|
|
293
239
|
<button class="show-text" onClick={() => (show = true)}>{'Show'}</button>
|
|
294
|
-
|
|
240
|
+
</>
|
|
295
241
|
}
|
|
296
242
|
|
|
297
243
|
// Test for static content in child component followed by sibling content
|
|
298
|
-
function StaticHeader() {
|
|
299
|
-
|
|
244
|
+
function StaticHeader() @{
|
|
245
|
+
<>
|
|
300
246
|
<h1 class="sr-only">{'heading'}</h1>
|
|
301
247
|
<p class="subtitle">{'first paragraph'}</p>
|
|
302
248
|
<p class="subtitle">{'second paragraph'}</p>
|
|
303
|
-
|
|
249
|
+
</>
|
|
304
250
|
}
|
|
305
251
|
|
|
306
|
-
export function StaticChildWithSiblings() {
|
|
307
|
-
|
|
308
|
-
|
|
252
|
+
export function StaticChildWithSiblings() @{
|
|
253
|
+
const foo = 'bar';
|
|
254
|
+
<>
|
|
309
255
|
<StaticHeader />
|
|
310
256
|
<span class="sibling1">{foo}</span>
|
|
311
257
|
<span class="sibling2">{foo}</span>
|
|
312
|
-
|
|
258
|
+
</>
|
|
313
259
|
}
|
|
314
260
|
|
|
315
261
|
// Website-like components for testing complex hydration scenarios
|
|
316
262
|
|
|
317
|
-
function Header() {
|
|
318
|
-
|
|
263
|
+
function Header() @{
|
|
264
|
+
<>
|
|
319
265
|
<h1 class="sr-only">{'Ripple'}</h1>
|
|
320
266
|
<img src="/images/logo.png" alt="Logo" class="logo" />
|
|
321
267
|
<p class="subtitle">{'the elegant TypeScript UI framework'}</p>
|
|
322
|
-
|
|
268
|
+
</>
|
|
323
269
|
}
|
|
324
270
|
|
|
325
|
-
function Actions({ playgroundVisible = false }: { playgroundVisible: boolean }) {
|
|
326
|
-
|
|
327
|
-
<
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
<a href="/playground" class="playground-link">{'Playground'}</a>
|
|
332
|
-
}
|
|
333
|
-
</div>
|
|
334
|
-
</>;
|
|
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>
|
|
335
277
|
}
|
|
336
278
|
|
|
337
|
-
function Layout({ children }: { children: Children }) {
|
|
338
|
-
|
|
339
|
-
<
|
|
340
|
-
|
|
341
|
-
</main>
|
|
342
|
-
</>;
|
|
279
|
+
function Layout({ children }: { children: Children }) @{
|
|
280
|
+
<main>
|
|
281
|
+
<div class="container">{children}</div>
|
|
282
|
+
</main>
|
|
343
283
|
}
|
|
344
284
|
|
|
345
|
-
function Content() {
|
|
346
|
-
|
|
347
|
-
<
|
|
348
|
-
|
|
349
|
-
</div>
|
|
350
|
-
</>;
|
|
285
|
+
function Content() @{
|
|
286
|
+
<div class="content">
|
|
287
|
+
<p>{'Some content here'}</p>
|
|
288
|
+
</div>
|
|
351
289
|
}
|
|
352
290
|
|
|
353
|
-
export function WebsiteIndex() {
|
|
354
|
-
|
|
355
|
-
<
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
</Layout>
|
|
361
|
-
</>;
|
|
291
|
+
export function WebsiteIndex() @{
|
|
292
|
+
<Layout>
|
|
293
|
+
<Header />
|
|
294
|
+
<Actions playgroundVisible={true} />
|
|
295
|
+
<Content />
|
|
296
|
+
<Actions playgroundVisible={false} />
|
|
297
|
+
</Layout>
|
|
362
298
|
}
|
|
363
299
|
|
|
364
300
|
// Test case for component as last element with no following siblings.
|
|
365
301
|
// This exercises hydrate_advance() in append() - at the end of content,
|
|
366
302
|
// there's no next sibling and that should be handled gracefully.
|
|
367
|
-
function LastChild() {
|
|
368
|
-
|
|
303
|
+
function LastChild() @{
|
|
304
|
+
<footer class="last-child">{'I am the last child'}</footer>
|
|
369
305
|
}
|
|
370
306
|
|
|
371
|
-
export function ComponentAsLastSibling() {
|
|
372
|
-
|
|
373
|
-
<
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
</div>
|
|
378
|
-
</>;
|
|
307
|
+
export function ComponentAsLastSibling() @{
|
|
308
|
+
<div class="wrapper">
|
|
309
|
+
<h1>{'Header'}</h1>
|
|
310
|
+
<p>{'Some content'}</p>
|
|
311
|
+
<LastChild />
|
|
312
|
+
</div>
|
|
379
313
|
}
|
|
380
314
|
|
|
381
315
|
// Nested version - component is last child inside another component
|
|
382
|
-
function InnerContent() {
|
|
383
|
-
|
|
384
|
-
<
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
<h2>{'Section title'}</h2>
|
|
395
|
-
<InnerContent />
|
|
396
|
-
</section>
|
|
397
|
-
</>;
|
|
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>
|
|
398
328
|
}
|