ripple 0.3.128 → 0.4.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.
- package/CHANGELOG.md +267 -0
- package/package.json +10 -4
- package/src/runtime/element.js +23 -6
- package/src/runtime/index-client.js +81 -41
- package/src/runtime/index-server.js +1 -0
- package/src/runtime/internal/client/blocks.js +173 -91
- package/src/runtime/internal/client/component.js +4 -30
- package/src/runtime/internal/client/composite.js +12 -13
- package/src/runtime/internal/client/constants.js +9 -0
- package/src/runtime/internal/client/context.js +12 -19
- package/src/runtime/internal/client/css.js +7 -9
- package/src/runtime/internal/client/events.js +178 -90
- package/src/runtime/internal/client/expression.js +45 -25
- package/src/runtime/internal/client/for.js +409 -129
- package/src/runtime/internal/client/head.js +10 -5
- package/src/runtime/internal/client/html.js +1 -0
- package/src/runtime/internal/client/hydration.js +152 -10
- package/src/runtime/internal/client/if.js +239 -50
- package/src/runtime/internal/client/index.js +4 -12
- package/src/runtime/internal/client/operations.js +40 -61
- package/src/runtime/internal/client/portal.js +163 -85
- package/src/runtime/internal/client/render.js +39 -39
- package/src/runtime/internal/client/rpc.js +3 -3
- package/src/runtime/internal/client/runtime.js +592 -433
- package/src/runtime/internal/client/selector.js +5 -2
- package/src/runtime/internal/client/template.js +133 -158
- package/src/runtime/internal/client/transport.js +38 -0
- package/src/runtime/internal/client/try.js +465 -426
- package/src/runtime/internal/client/types.d.ts +56 -23
- package/src/runtime/internal/client/utils.js +1 -3
- package/src/runtime/internal/server/dynamic.js +20 -21
- package/src/runtime/internal/server/index.js +325 -275
- package/src/runtime/internal/server/rpc.js +3 -2
- package/src/runtime/internal/server/transport.js +16 -0
- package/src/runtime/transport.js +21 -0
- package/tests/client/__snapshots__/for.test.tsrx.snap +0 -5
- package/tests/client/array/array.copy-within.test.tsrx +12 -12
- package/tests/client/array/array.derived.test.tsrx +46 -46
- package/tests/client/array/array.iteration.test.tsrx +10 -10
- package/tests/client/array/array.mutations.test.tsrx +20 -20
- package/tests/client/array/array.static.test.tsrx +11 -11
- package/tests/client/array/array.to-methods.test.tsrx +6 -6
- package/tests/client/async-suspend.test.tsrx +74 -75
- package/tests/client/basic/basic.attributes.test.tsrx +86 -83
- package/tests/client/basic/basic.collections.test.tsrx +12 -12
- package/tests/client/basic/basic.components.test.tsrx +99 -25
- package/tests/client/basic/basic.errors.test.tsrx +18 -18
- package/tests/client/basic/basic.events.test.tsrx +42 -42
- package/tests/client/basic/basic.get-set.test.tsrx +8 -8
- package/tests/client/basic/basic.reactivity.test.tsrx +73 -38
- package/tests/client/basic/basic.rendering.test.tsrx +25 -25
- package/tests/client/basic/basic.utilities.test.tsrx +3 -3
- package/tests/client/boundaries.test.tsrx +8 -8
- package/tests/client/boxed-locals.test.tsrx +452 -0
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.tsrx.snap +6 -6
- package/tests/client/compiler/compiler.assignments.test.tsrx +9 -73
- package/tests/client/compiler/compiler.attributes.test.tsrx +23 -23
- package/tests/client/compiler/compiler.basic.test.tsrx +15 -60
- package/tests/client/compiler/compiler.tracked-access.test.tsrx +18 -43
- package/tests/client/compiler/compiler.try-in-function.test.tsrx +2 -2
- package/tests/client/composite/__snapshots__/composite.render.test.tsrx.snap +0 -1
- package/tests/client/composite/composite.dynamic-components.test.tsrx +77 -6
- package/tests/client/composite/composite.props.test.tsrx +149 -12
- package/tests/client/composite/composite.reactivity.test.tsrx +51 -52
- package/tests/client/composite/composite.render.test.tsrx +26 -9
- package/tests/client/css/scoped-styles.test.tsrx +8 -8
- package/tests/client/date.test.tsrx +42 -42
- package/tests/client/derived-release.test.tsrx +370 -0
- package/tests/client/dynamic-elements.test.tsrx +45 -45
- package/tests/client/events.test.tsrx +97 -71
- package/tests/client/for-selector.test.tsrx +14 -14
- package/tests/client/for-single-root-items.test.tsrx +118 -3
- package/tests/client/for.test.tsrx +332 -31
- package/tests/client/head.test.tsrx +19 -19
- package/tests/client/html.test.tsrx +11 -9
- package/tests/client/if-block.test.tsrx +80 -0
- package/tests/client/map.test.tsrx +16 -16
- package/tests/client/media-query.test.tsrx +7 -7
- package/tests/client/portal.test.tsrx +224 -26
- package/tests/client/primitive-text.test.tsrx +50 -0
- package/tests/client/prop-kind-switch.test.tsrx +141 -0
- package/tests/client/ref.test.tsrx +17 -17
- package/tests/client/return.test.tsrx +26 -3
- package/tests/client/root-boundary.test.tsrx +42 -0
- package/tests/client/scoped-flush.test.tsrx +8 -8
- package/tests/client/set.test.tsrx +6 -6
- package/tests/client/svg.test.tsrx +11 -11
- package/tests/client/switch.test.tsrx +44 -44
- package/tests/client/track-async-hydration.test.tsrx +4 -4
- package/tests/client/try.test.tsrx +151 -83
- package/tests/client/tsx.test.tsrx +43 -40
- package/tests/client/url/url.derived.test.tsrx +6 -6
- package/tests/client/url-search-params/url-search-params.derived.test.tsrx +8 -8
- package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +10 -10
- package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +10 -10
- package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +18 -18
- package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +2 -2
- package/tests/hydration/basic.test.js +74 -1
- package/tests/hydration/build-components.js +22 -1
- package/tests/hydration/compiled/client/basic.js +1142 -713
- package/tests/hydration/compiled/client/composite.js +151 -100
- package/tests/hydration/compiled/client/events.js +184 -171
- package/tests/hydration/compiled/client/for.js +1472 -1132
- package/tests/hydration/compiled/client/fragment-cursor.js +2341 -0
- package/tests/hydration/compiled/client/head.js +254 -201
- package/tests/hydration/compiled/client/hmr.js +54 -41
- package/tests/hydration/compiled/client/html-in-template.js +54 -39
- package/tests/hydration/compiled/client/html.js +1633 -1263
- package/tests/hydration/compiled/client/if-children.js +420 -270
- package/tests/hydration/compiled/client/if-fragment-controlflow.js +363 -317
- package/tests/hydration/compiled/client/if.js +229 -219
- package/tests/hydration/compiled/client/mixed-control-flow.js +420 -404
- package/tests/hydration/compiled/client/nested-control-flow.js +1326 -1277
- package/tests/hydration/compiled/client/portal.js +87 -95
- package/tests/hydration/compiled/client/reactivity.js +135 -101
- package/tests/hydration/compiled/client/return.js +28 -19
- package/tests/hydration/compiled/client/streaming.js +390 -306
- package/tests/hydration/compiled/client/switch.js +258 -266
- package/tests/hydration/compiled/client/track-async-serialization.js +448 -280
- package/tests/hydration/compiled/client/try.js +173 -129
- package/tests/hydration/compiled/client/typed-text.js +71 -0
- package/tests/hydration/compiled/fixtures/money.js +10 -0
- package/tests/hydration/compiled/server/basic.js +123 -6
- package/tests/hydration/compiled/server/composite.js +16 -30
- package/tests/hydration/compiled/server/events.js +66 -18
- package/tests/hydration/compiled/server/for.js +117 -41
- package/tests/hydration/compiled/server/fragment-cursor.js +1687 -0
- package/tests/hydration/compiled/server/head.js +20 -20
- package/tests/hydration/compiled/server/hmr.js +2 -2
- package/tests/hydration/compiled/server/html.js +70 -238
- package/tests/hydration/compiled/server/if-children.js +107 -15
- package/tests/hydration/compiled/server/if.js +11 -15
- package/tests/hydration/compiled/server/mixed-control-flow.js +8 -8
- package/tests/hydration/compiled/server/portal.js +14 -22
- package/tests/hydration/compiled/server/reactivity.js +14 -14
- package/tests/hydration/compiled/server/streaming.js +19 -19
- package/tests/hydration/compiled/server/switch.js +8 -8
- package/tests/hydration/compiled/server/track-async-serialization.js +150 -23
- package/tests/hydration/compiled/server/try.js +8 -8
- package/tests/hydration/compiled/server/typed-text.js +17 -0
- package/tests/hydration/components/basic.tsrx +44 -8
- package/tests/hydration/components/composite.tsrx +2 -2
- package/tests/hydration/components/events.tsrx +25 -25
- package/tests/hydration/components/for.tsrx +115 -67
- package/tests/hydration/components/fragment-cursor.tsrx +650 -0
- package/tests/hydration/components/head.tsrx +16 -16
- package/tests/hydration/components/hmr.tsrx +2 -2
- package/tests/hydration/components/html.tsrx +7 -7
- package/tests/hydration/components/if-children.tsrx +72 -25
- package/tests/hydration/components/if.tsrx +18 -18
- package/tests/hydration/components/mixed-control-flow.tsrx +11 -11
- package/tests/hydration/components/portal.tsrx +3 -3
- package/tests/hydration/components/reactivity.tsrx +16 -16
- package/tests/hydration/components/streaming.tsrx +20 -20
- package/tests/hydration/components/switch.tsrx +20 -20
- package/tests/hydration/components/text-types.ts +4 -0
- package/tests/hydration/components/track-async-serialization.tsrx +80 -26
- package/tests/hydration/components/try.tsrx +8 -8
- package/tests/hydration/components/typed-text.tsrx +22 -0
- package/tests/hydration/fixtures/money.js +10 -0
- package/tests/hydration/for.test.js +36 -0
- package/tests/hydration/fragment-cursor.test.js +111 -0
- package/tests/hydration/if-children.test.js +24 -0
- package/tests/hydration/streaming.test.js +19 -0
- package/tests/hydration/track-async-serialization.test.js +87 -2
- package/tests/hydration/tsconfig.text-types.json +10 -0
- package/tests/hydration/typed-text.test.js +34 -0
- package/tests/server/await.test.tsrx +3 -3
- package/tests/server/basic.attributes.test.tsrx +42 -42
- package/tests/server/basic.components.test.tsrx +64 -8
- package/tests/server/basic.test.tsrx +34 -32
- package/tests/server/compiler.test.tsrx +1 -70
- package/tests/server/composite.props.test.tsrx +6 -6
- package/tests/server/dynamic-elements.test.tsrx +31 -8
- package/tests/server/for.test.tsrx +94 -0
- package/tests/server/head.test.tsrx +11 -11
- package/tests/server/scoped-styles.test.tsrx +2 -2
- package/tests/server/streaming-ssr.test.tsrx +48 -43
- package/tests/server/track-async-serialization.test.tsrx +204 -21
- package/tests/server/try.test.tsrx +48 -48
- package/tests/types/transport.ts +40 -0
- package/tests/utils/vite-plugin-config.test.js +23 -0
- package/types/index.d.ts +48 -7
- package/types/server.d.ts +3 -0
- package/types/transport.d.ts +15 -0
- package/src/runtime/internal/client/switch.js +0 -113
- package/src/utils/errors.js +0 -13
- package/tests/client/lazy-array.test.tsrx +0 -31
- package/tests/client/lazy-destructuring.test.tsrx +0 -438
- package/tests/client/tracked-index-access.test.tsrx +0 -113
- package/tests/server/lazy-destructuring.test.tsrx +0 -595
- package/tests/server/tracked-index-access.test.tsrx +0 -76
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import { track } from 'ripple';
|
|
2
|
+
|
|
3
|
+
// Components exercising where the hydration cursor sits after a node, block,
|
|
4
|
+
// or component: on its last DOM node, where the parent's sibling traversal
|
|
5
|
+
// expects it. Fragment roots are hydrated on their own and as a child with
|
|
6
|
+
// trailing siblings (`Wrap<Name>`), so the compiler's closing `next(n)` must
|
|
7
|
+
// land on the fragment's last top-level node; the single-root shapes at the
|
|
8
|
+
// end check a slot followed by siblings inside an element.
|
|
9
|
+
|
|
10
|
+
function Leaf() @{
|
|
11
|
+
<i class="leaf">{'leaf'}</i>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function TrailingNavigatedElements() @{
|
|
15
|
+
const n = track(0);
|
|
16
|
+
<>
|
|
17
|
+
<div class="count">{n.value}</div>
|
|
18
|
+
<button class="inc" onClick={() => n.value++}>{'inc'}</button>
|
|
19
|
+
<button class="dec" onClick={() => n.value--}>{'dec'}</button>
|
|
20
|
+
</>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function TrailingStaticNavigatedElements() @{
|
|
24
|
+
const n = track(0);
|
|
25
|
+
<>
|
|
26
|
+
<div class="host">{'static'}</div>
|
|
27
|
+
<button class="inc" onClick={() => n.value++}>{'inc'}</button>
|
|
28
|
+
<button class="dec" onClick={() => n.value--}>{'dec'}</button>
|
|
29
|
+
</>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function NavigatedThenStatic() @{
|
|
33
|
+
const n = track(0);
|
|
34
|
+
<>
|
|
35
|
+
<div class="host">{'static'}</div>
|
|
36
|
+
<button class="inc" onClick={() => n.value++}>{'inc'}</button>
|
|
37
|
+
<div class="a">{'a'}</div>
|
|
38
|
+
<div class="b">{'b'}</div>
|
|
39
|
+
</>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function LeadingNavigatedThenStatic() @{
|
|
43
|
+
const n = track(0);
|
|
44
|
+
<>
|
|
45
|
+
<button class="inc" onClick={() => n.value++}>{'inc'}</button>
|
|
46
|
+
<div class="a">{'a'}</div>
|
|
47
|
+
<div class="b">{'b'}</div>
|
|
48
|
+
</>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function TrailingNestedNavigated() @{
|
|
52
|
+
const n = track(0);
|
|
53
|
+
<>
|
|
54
|
+
<div class="host">{'static'}</div>
|
|
55
|
+
<div class="wrap">
|
|
56
|
+
<button class="inc" onClick={() => n.value++}>{'inc'}</button>
|
|
57
|
+
</div>
|
|
58
|
+
</>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function NestedNavigatedThenStatic() @{
|
|
62
|
+
const n = track(0);
|
|
63
|
+
<>
|
|
64
|
+
<div class="wrap">
|
|
65
|
+
<button class="inc" onClick={() => n.value++}>{'inc'}</button>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="a">{'a'}</div>
|
|
68
|
+
<div class="b">{'b'}</div>
|
|
69
|
+
</>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function TrackedTextThenStatic() @{
|
|
73
|
+
const n = track(0);
|
|
74
|
+
<>
|
|
75
|
+
{n.value}
|
|
76
|
+
<div class="a">{'a'}</div>
|
|
77
|
+
<div class="b">{'b'}</div>
|
|
78
|
+
</>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function StaticThenTrackedText() @{
|
|
82
|
+
const n = track(0);
|
|
83
|
+
<>
|
|
84
|
+
<div class="a">{'a'}</div>
|
|
85
|
+
<div class="b">{'b'}</div>
|
|
86
|
+
{n.value}
|
|
87
|
+
</>
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function StaticNestedThenStatic() @{
|
|
91
|
+
<>
|
|
92
|
+
<div class="a">{'a'}</div>
|
|
93
|
+
<div class="wrap">
|
|
94
|
+
<span>{'x'}</span>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="b">{'b'}</div>
|
|
97
|
+
<div class="c">{'c'}</div>
|
|
98
|
+
</>
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function AllStatic() @{
|
|
102
|
+
<>
|
|
103
|
+
<div class="a">{'a'}</div>
|
|
104
|
+
<div class="b">{'b'}</div>
|
|
105
|
+
<div class="c">{'c'}</div>
|
|
106
|
+
</>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function TrailingDynamicChild() @{
|
|
110
|
+
const n = track(0);
|
|
111
|
+
<>
|
|
112
|
+
<div class="a">{'a'}</div>
|
|
113
|
+
<div class="count">{n.value}</div>
|
|
114
|
+
</>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function DynamicChildThenStatic() @{
|
|
118
|
+
const n = track(0);
|
|
119
|
+
<>
|
|
120
|
+
<div class="count">{n.value}</div>
|
|
121
|
+
<div class="a">{'a'}</div>
|
|
122
|
+
<div class="b">{'b'}</div>
|
|
123
|
+
</>
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function IfThenStatic() @{
|
|
127
|
+
const n = track(0);
|
|
128
|
+
<>
|
|
129
|
+
@if (n.value >= 0) {
|
|
130
|
+
<b class="if">{'x'}</b>
|
|
131
|
+
}
|
|
132
|
+
<div class="a">{'a'}</div>
|
|
133
|
+
<div class="b">{'b'}</div>
|
|
134
|
+
</>
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function StaticThenIf() @{
|
|
138
|
+
const n = track(0);
|
|
139
|
+
<>
|
|
140
|
+
<div class="a">{'a'}</div>
|
|
141
|
+
<div class="b">{'b'}</div>
|
|
142
|
+
@if (n.value >= 0) {
|
|
143
|
+
<b class="if">{'x'}</b>
|
|
144
|
+
}
|
|
145
|
+
</>
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function CompThenStatic() @{
|
|
149
|
+
<>
|
|
150
|
+
<Leaf />
|
|
151
|
+
<div class="a">{'a'}</div>
|
|
152
|
+
<div class="b">{'b'}</div>
|
|
153
|
+
</>
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function StaticThenComp() @{
|
|
157
|
+
<>
|
|
158
|
+
<div class="a">{'a'}</div>
|
|
159
|
+
<div class="b">{'b'}</div>
|
|
160
|
+
<Leaf />
|
|
161
|
+
</>
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function SiblingComps() @{
|
|
165
|
+
<>
|
|
166
|
+
<Leaf />
|
|
167
|
+
<Leaf />
|
|
168
|
+
</>
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function WrapTrailingNavigatedElements() @{
|
|
172
|
+
const n = track(0);
|
|
173
|
+
<div class="outer">
|
|
174
|
+
<TrailingNavigatedElements />
|
|
175
|
+
<span class="after">{n.value}</span>
|
|
176
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
177
|
+
</div>
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function WrapTrailingStaticNavigatedElements() @{
|
|
181
|
+
const n = track(0);
|
|
182
|
+
<div class="outer">
|
|
183
|
+
<TrailingStaticNavigatedElements />
|
|
184
|
+
<span class="after">{n.value}</span>
|
|
185
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
186
|
+
</div>
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function WrapNavigatedThenStatic() @{
|
|
190
|
+
const n = track(0);
|
|
191
|
+
<div class="outer">
|
|
192
|
+
<NavigatedThenStatic />
|
|
193
|
+
<span class="after">{n.value}</span>
|
|
194
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
195
|
+
</div>
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function WrapLeadingNavigatedThenStatic() @{
|
|
199
|
+
const n = track(0);
|
|
200
|
+
<div class="outer">
|
|
201
|
+
<LeadingNavigatedThenStatic />
|
|
202
|
+
<span class="after">{n.value}</span>
|
|
203
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
204
|
+
</div>
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function WrapTrailingNestedNavigated() @{
|
|
208
|
+
const n = track(0);
|
|
209
|
+
<div class="outer">
|
|
210
|
+
<TrailingNestedNavigated />
|
|
211
|
+
<span class="after">{n.value}</span>
|
|
212
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
213
|
+
</div>
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function WrapNestedNavigatedThenStatic() @{
|
|
217
|
+
const n = track(0);
|
|
218
|
+
<div class="outer">
|
|
219
|
+
<NestedNavigatedThenStatic />
|
|
220
|
+
<span class="after">{n.value}</span>
|
|
221
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
222
|
+
</div>
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function WrapTrackedTextThenStatic() @{
|
|
226
|
+
const n = track(0);
|
|
227
|
+
<div class="outer">
|
|
228
|
+
<TrackedTextThenStatic />
|
|
229
|
+
<span class="after">{n.value}</span>
|
|
230
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
231
|
+
</div>
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function WrapStaticThenTrackedText() @{
|
|
235
|
+
const n = track(0);
|
|
236
|
+
<div class="outer">
|
|
237
|
+
<StaticThenTrackedText />
|
|
238
|
+
<span class="after">{n.value}</span>
|
|
239
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
240
|
+
</div>
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export function WrapStaticNestedThenStatic() @{
|
|
244
|
+
const n = track(0);
|
|
245
|
+
<div class="outer">
|
|
246
|
+
<StaticNestedThenStatic />
|
|
247
|
+
<span class="after">{n.value}</span>
|
|
248
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
249
|
+
</div>
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function WrapAllStatic() @{
|
|
253
|
+
const n = track(0);
|
|
254
|
+
<div class="outer">
|
|
255
|
+
<AllStatic />
|
|
256
|
+
<span class="after">{n.value}</span>
|
|
257
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
258
|
+
</div>
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export function WrapTrailingDynamicChild() @{
|
|
262
|
+
const n = track(0);
|
|
263
|
+
<div class="outer">
|
|
264
|
+
<TrailingDynamicChild />
|
|
265
|
+
<span class="after">{n.value}</span>
|
|
266
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
267
|
+
</div>
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function WrapDynamicChildThenStatic() @{
|
|
271
|
+
const n = track(0);
|
|
272
|
+
<div class="outer">
|
|
273
|
+
<DynamicChildThenStatic />
|
|
274
|
+
<span class="after">{n.value}</span>
|
|
275
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
276
|
+
</div>
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function WrapIfThenStatic() @{
|
|
280
|
+
const n = track(0);
|
|
281
|
+
<div class="outer">
|
|
282
|
+
<IfThenStatic />
|
|
283
|
+
<span class="after">{n.value}</span>
|
|
284
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
285
|
+
</div>
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function WrapStaticThenIf() @{
|
|
289
|
+
const n = track(0);
|
|
290
|
+
<div class="outer">
|
|
291
|
+
<StaticThenIf />
|
|
292
|
+
<span class="after">{n.value}</span>
|
|
293
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
294
|
+
</div>
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export function WrapCompThenStatic() @{
|
|
298
|
+
const n = track(0);
|
|
299
|
+
<div class="outer">
|
|
300
|
+
<CompThenStatic />
|
|
301
|
+
<span class="after">{n.value}</span>
|
|
302
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
303
|
+
</div>
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export function WrapStaticThenComp() @{
|
|
307
|
+
const n = track(0);
|
|
308
|
+
<div class="outer">
|
|
309
|
+
<StaticThenComp />
|
|
310
|
+
<span class="after">{n.value}</span>
|
|
311
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
312
|
+
</div>
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export function WrapSiblingComps() @{
|
|
316
|
+
const n = track(0);
|
|
317
|
+
<div class="outer">
|
|
318
|
+
<SiblingComps />
|
|
319
|
+
<span class="after">{n.value}</span>
|
|
320
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
321
|
+
</div>
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export function UntrackedTextThenStatic() @{
|
|
325
|
+
const label = 'label';
|
|
326
|
+
<>
|
|
327
|
+
{label.toUpperCase()}
|
|
328
|
+
<div class="a">{'a'}</div>
|
|
329
|
+
<div class="b">{'b'}</div>
|
|
330
|
+
</>
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export function NestedFragmentThenStatic() @{
|
|
334
|
+
<>
|
|
335
|
+
<div class="a">{'a'}</div>
|
|
336
|
+
<>
|
|
337
|
+
<span class="x">{'x'}</span>
|
|
338
|
+
<span class="y">{'y'}</span>
|
|
339
|
+
</>
|
|
340
|
+
<div class="b">{'b'}</div>
|
|
341
|
+
<div class="c">{'c'}</div>
|
|
342
|
+
</>
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export function TrailingNestedFragment() @{
|
|
346
|
+
const n = track(0);
|
|
347
|
+
<>
|
|
348
|
+
<div class="count">{n.value}</div>
|
|
349
|
+
<>
|
|
350
|
+
<span class="x">{'x'}</span>
|
|
351
|
+
<button class="inc" onClick={() => n.value++}>{'inc'}</button>
|
|
352
|
+
</>
|
|
353
|
+
</>
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export function ForThenStatic() @{
|
|
357
|
+
const items = [1, 2];
|
|
358
|
+
<>
|
|
359
|
+
@for (const item of items) {
|
|
360
|
+
<b class="item">{item}</b>
|
|
361
|
+
}
|
|
362
|
+
<div class="a">{'a'}</div>
|
|
363
|
+
<div class="b">{'b'}</div>
|
|
364
|
+
</>
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export function SwitchThenStatic() @{
|
|
368
|
+
const n = track(0);
|
|
369
|
+
<>
|
|
370
|
+
@switch (n.value) {
|
|
371
|
+
@case 0: {
|
|
372
|
+
<b class="zero">{'zero'}</b>
|
|
373
|
+
}
|
|
374
|
+
@default: {
|
|
375
|
+
<b class="other">{'other'}</b>
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
<div class="a">{'a'}</div>
|
|
379
|
+
<div class="b">{'b'}</div>
|
|
380
|
+
</>
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function TryThenStatic() @{
|
|
384
|
+
<>
|
|
385
|
+
@try {
|
|
386
|
+
<b class="try">{'try'}</b>
|
|
387
|
+
} @catch (e) {
|
|
388
|
+
<b class="catch">{'catch'}</b>
|
|
389
|
+
}
|
|
390
|
+
<div class="a">{'a'}</div>
|
|
391
|
+
<div class="b">{'b'}</div>
|
|
392
|
+
</>
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export function StyleThenStatic() @{
|
|
396
|
+
<>
|
|
397
|
+
<style>{`.styled { color: red; }`}</style>
|
|
398
|
+
<div class="styled a">{'a'}</div>
|
|
399
|
+
<div class="styled b">{'b'}</div>
|
|
400
|
+
</>
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export function CollectionThenStatic() @{
|
|
404
|
+
const items = [1, 2];
|
|
405
|
+
<>
|
|
406
|
+
{items.map((item) => <b class="item">{item}</b>)}
|
|
407
|
+
<div class="a">{'a'}</div>
|
|
408
|
+
<div class="b">{'b'}</div>
|
|
409
|
+
</>
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export function InlineElementThenStatic() @{
|
|
413
|
+
<>
|
|
414
|
+
{<b class="inline">{'inline'}</b>}
|
|
415
|
+
<div class="a">{'a'}</div>
|
|
416
|
+
<div class="b">{'b'}</div>
|
|
417
|
+
</>
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export function WrapUntrackedTextThenStatic() @{
|
|
421
|
+
const n = track(0);
|
|
422
|
+
<div class="outer">
|
|
423
|
+
<UntrackedTextThenStatic />
|
|
424
|
+
<span class="after">{n.value}</span>
|
|
425
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
426
|
+
</div>
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export function WrapNestedFragmentThenStatic() @{
|
|
430
|
+
const n = track(0);
|
|
431
|
+
<div class="outer">
|
|
432
|
+
<NestedFragmentThenStatic />
|
|
433
|
+
<span class="after">{n.value}</span>
|
|
434
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
435
|
+
</div>
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export function WrapTrailingNestedFragment() @{
|
|
439
|
+
const n = track(0);
|
|
440
|
+
<div class="outer">
|
|
441
|
+
<TrailingNestedFragment />
|
|
442
|
+
<span class="after">{n.value}</span>
|
|
443
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
444
|
+
</div>
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export function WrapForThenStatic() @{
|
|
448
|
+
const n = track(0);
|
|
449
|
+
<div class="outer">
|
|
450
|
+
<ForThenStatic />
|
|
451
|
+
<span class="after">{n.value}</span>
|
|
452
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
453
|
+
</div>
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export function WrapSwitchThenStatic() @{
|
|
457
|
+
const n = track(0);
|
|
458
|
+
<div class="outer">
|
|
459
|
+
<SwitchThenStatic />
|
|
460
|
+
<span class="after">{n.value}</span>
|
|
461
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
462
|
+
</div>
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export function WrapTryThenStatic() @{
|
|
466
|
+
const n = track(0);
|
|
467
|
+
<div class="outer">
|
|
468
|
+
<TryThenStatic />
|
|
469
|
+
<span class="after">{n.value}</span>
|
|
470
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
471
|
+
</div>
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export function WrapStyleThenStatic() @{
|
|
475
|
+
const n = track(0);
|
|
476
|
+
<div class="outer">
|
|
477
|
+
<StyleThenStatic />
|
|
478
|
+
<span class="after">{n.value}</span>
|
|
479
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
480
|
+
</div>
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export function WrapCollectionThenStatic() @{
|
|
484
|
+
const n = track(0);
|
|
485
|
+
<div class="outer">
|
|
486
|
+
<CollectionThenStatic />
|
|
487
|
+
<span class="after">{n.value}</span>
|
|
488
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
489
|
+
</div>
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export function WrapInlineElementThenStatic() @{
|
|
493
|
+
const n = track(0);
|
|
494
|
+
<div class="outer">
|
|
495
|
+
<InlineElementThenStatic />
|
|
496
|
+
<span class="after">{n.value}</span>
|
|
497
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
498
|
+
</div>
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export function IfOnly() @{
|
|
502
|
+
const n = track(0);
|
|
503
|
+
<>
|
|
504
|
+
@if (n.value >= 0) {
|
|
505
|
+
<b class="if">{'x'}</b>
|
|
506
|
+
}
|
|
507
|
+
</>
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export function IfThenOne() @{
|
|
511
|
+
const n = track(0);
|
|
512
|
+
<>
|
|
513
|
+
@if (n.value >= 0) {
|
|
514
|
+
<b class="if">{'x'}</b>
|
|
515
|
+
}
|
|
516
|
+
<div class="a">{'a'}</div>
|
|
517
|
+
</>
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export function SingleRootWithIf() @{
|
|
521
|
+
const n = track(0);
|
|
522
|
+
<div class="root">
|
|
523
|
+
@if (n.value >= 0) {
|
|
524
|
+
<b class="if">{'x'}</b>
|
|
525
|
+
}
|
|
526
|
+
</div>
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export function WrapIfOnly() @{
|
|
530
|
+
const n = track(0);
|
|
531
|
+
<div class="outer">
|
|
532
|
+
<IfOnly />
|
|
533
|
+
<span class="after">{n.value}</span>
|
|
534
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
535
|
+
</div>
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export function WrapIfThenOne() @{
|
|
539
|
+
const n = track(0);
|
|
540
|
+
<div class="outer">
|
|
541
|
+
<IfThenOne />
|
|
542
|
+
<span class="after">{n.value}</span>
|
|
543
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
544
|
+
</div>
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export function WrapSingleRootWithIf() @{
|
|
548
|
+
const n = track(0);
|
|
549
|
+
<div class="outer">
|
|
550
|
+
<SingleRootWithIf />
|
|
551
|
+
<span class="after">{n.value}</span>
|
|
552
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
553
|
+
</div>
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export function ExprThenSiblingInDiv() @{
|
|
557
|
+
const n = track(0);
|
|
558
|
+
const label = 'label';
|
|
559
|
+
<div class="outer">
|
|
560
|
+
{label.toUpperCase()}
|
|
561
|
+
<span class="after">{n.value}</span>
|
|
562
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
563
|
+
</div>
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export function IfTwoThenStatic() @{
|
|
567
|
+
const n = track(0);
|
|
568
|
+
<>
|
|
569
|
+
@if (n.value >= 0) {
|
|
570
|
+
<>
|
|
571
|
+
<b class="if">{'x'}</b>
|
|
572
|
+
<i class="if2">{'y'}</i>
|
|
573
|
+
</>
|
|
574
|
+
}
|
|
575
|
+
<div class="a">{'a'}</div>
|
|
576
|
+
<div class="b">{'b'}</div>
|
|
577
|
+
</>
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export function IfTwoInDiv() @{
|
|
581
|
+
const n = track(0);
|
|
582
|
+
<div class="outer">
|
|
583
|
+
@if (n.value >= 0) {
|
|
584
|
+
<>
|
|
585
|
+
<b class="if">{'x'}</b>
|
|
586
|
+
<i class="if2">{'y'}</i>
|
|
587
|
+
</>
|
|
588
|
+
}
|
|
589
|
+
<span class="after">{n.value}</span>
|
|
590
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
591
|
+
</div>
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export function WrapIfTwoThenStatic() @{
|
|
595
|
+
const n = track(0);
|
|
596
|
+
<div class="outer">
|
|
597
|
+
<IfTwoThenStatic />
|
|
598
|
+
<span class="after">{n.value}</span>
|
|
599
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
600
|
+
</div>
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export function ForTwoNodeItems() @{
|
|
604
|
+
const items = [1, 2];
|
|
605
|
+
<div class="outer">
|
|
606
|
+
@for (const item of items) {
|
|
607
|
+
<>
|
|
608
|
+
<b class="item">{item}</b>
|
|
609
|
+
<i class="sep">{'|'}</i>
|
|
610
|
+
</>
|
|
611
|
+
}
|
|
612
|
+
<span class="after">{'after'}</span>
|
|
613
|
+
</div>
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export function StaticCallThenStatic() @{
|
|
617
|
+
const makeB = () => <b class="made">{'made'}</b>;
|
|
618
|
+
<>
|
|
619
|
+
{makeB()}
|
|
620
|
+
<div class="a">{'a'}</div>
|
|
621
|
+
<div class="b">{'b'}</div>
|
|
622
|
+
</>
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export function StaticThenStyleThenStatic() @{
|
|
626
|
+
<>
|
|
627
|
+
<div class="a">{'a'}</div>
|
|
628
|
+
<style>{`.styled2 { color: blue; }`}</style>
|
|
629
|
+
<div class="styled2 b">{'b'}</div>
|
|
630
|
+
<div class="styled2 c">{'c'}</div>
|
|
631
|
+
</>
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export function WrapStaticCallThenStatic() @{
|
|
635
|
+
const n = track(0);
|
|
636
|
+
<div class="outer">
|
|
637
|
+
<StaticCallThenStatic />
|
|
638
|
+
<span class="after">{n.value}</span>
|
|
639
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
640
|
+
</div>
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export function WrapStaticThenStyleThenStatic() @{
|
|
644
|
+
const n = track(0);
|
|
645
|
+
<div class="outer">
|
|
646
|
+
<StaticThenStyleThenStatic />
|
|
647
|
+
<span class="after">{n.value}</span>
|
|
648
|
+
<button class="outer-inc" onClick={() => n.value++}>{'outer'}</button>
|
|
649
|
+
</div>
|
|
650
|
+
}
|