ripple 0.3.67 → 0.3.69
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 +57 -0
- package/package.json +3 -3
- package/src/jsx-runtime.d.ts +2 -2
- package/src/runtime/element.js +1 -1
- package/src/runtime/index-client.js +11 -11
- package/src/runtime/index-server.js +7 -4
- package/src/runtime/internal/client/bindings.js +1 -1
- package/src/runtime/internal/client/blocks.js +13 -4
- package/src/runtime/internal/client/component.js +55 -0
- package/src/runtime/internal/client/composite.js +4 -2
- package/src/runtime/internal/client/expression.js +65 -7
- package/src/runtime/internal/client/hmr.js +54 -43
- package/src/runtime/internal/client/index.js +5 -1
- package/src/runtime/internal/client/portal.js +70 -69
- package/src/runtime/internal/client/render.js +3 -0
- package/src/runtime/internal/server/index.js +92 -8
- package/tests/client/__snapshots__/html.test.tsrx.snap +3 -3
- package/tests/client/array/array.copy-within.test.tsrx +33 -31
- package/tests/client/array/array.derived.test.tsrx +186 -169
- package/tests/client/array/array.iteration.test.tsrx +40 -37
- package/tests/client/array/array.mutations.test.tsrx +113 -101
- package/tests/client/array/array.static.test.tsrx +119 -101
- package/tests/client/array/array.to-methods.test.tsrx +24 -21
- package/tests/client/async-suspend.test.tsrx +247 -246
- package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +0 -1
- package/tests/client/basic/basic.attributes.test.tsrx +428 -423
- package/tests/client/basic/basic.collections.test.tsrx +109 -102
- package/tests/client/basic/basic.components.test.tsrx +323 -205
- package/tests/client/basic/basic.errors.test.tsrx +91 -91
- package/tests/client/basic/basic.events.test.tsrx +114 -115
- package/tests/client/basic/basic.get-set.test.tsrx +97 -87
- package/tests/client/basic/basic.hmr.test.tsrx +19 -16
- package/tests/client/basic/basic.reactivity.test.tsrx +199 -191
- package/tests/client/basic/basic.rendering.test.tsrx +272 -182
- package/tests/client/basic/basic.styling.test.tsrx +23 -22
- package/tests/client/basic/basic.utilities.test.tsrx +10 -8
- package/tests/client/boundaries.test.tsrx +26 -26
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.rsrx.snap +5 -5
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.tsrx.snap +5 -5
- package/tests/client/compiler/compiler.assignments.test.tsrx +77 -81
- package/tests/client/compiler/compiler.attributes.test.tsrx +15 -15
- package/tests/client/compiler/compiler.basic.test.tsrx +322 -314
- package/tests/client/compiler/compiler.regex.test.tsrx +44 -47
- package/tests/client/compiler/compiler.tracked-access.test.tsrx +38 -38
- package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
- package/tests/client/compiler/compiler.typescript.test.tsrx +2 -2
- package/tests/client/composite/composite.dynamic-components.test.tsrx +47 -48
- package/tests/client/composite/composite.generics.test.tsrx +168 -192
- package/tests/client/composite/composite.props.test.tsrx +97 -81
- package/tests/client/composite/composite.reactivity.test.tsrx +177 -147
- package/tests/client/composite/composite.render.test.tsrx +122 -105
- package/tests/client/computed-properties.test.tsrx +28 -28
- package/tests/client/context.test.tsrx +21 -21
- package/tests/client/css/global-additional-cases.test.tsrx +58 -58
- package/tests/client/css/global-advanced-selectors.test.tsrx +16 -16
- package/tests/client/css/global-at-rules.test.tsrx +10 -10
- package/tests/client/css/global-basic.test.tsrx +14 -14
- package/tests/client/css/global-classes-ids.test.tsrx +14 -14
- package/tests/client/css/global-combinators.test.tsrx +10 -10
- package/tests/client/css/global-complex-nesting.test.tsrx +14 -14
- package/tests/client/css/global-edge-cases.test.tsrx +18 -18
- package/tests/client/css/global-keyframes.test.tsrx +12 -12
- package/tests/client/css/global-nested.test.tsrx +10 -10
- package/tests/client/css/global-pseudo.test.tsrx +12 -12
- package/tests/client/css/global-scoping.test.tsrx +20 -20
- package/tests/client/css/style-identifier.test.tsrx +143 -291
- package/tests/client/date.test.tsrx +146 -133
- package/tests/client/dynamic-elements.test.tsrx +398 -365
- package/tests/client/events.test.tsrx +292 -290
- package/tests/client/for.test.tsrx +156 -153
- package/tests/client/head.test.tsrx +105 -96
- package/tests/client/html.test.tsrx +122 -26
- package/tests/client/input-value.test.tsrx +1361 -1314
- package/tests/client/lazy-array.test.tsrx +16 -13
- package/tests/client/lazy-destructuring.test.tsrx +257 -213
- package/tests/client/map.test.tsrx +65 -60
- package/tests/client/media-query.test.tsrx +22 -20
- package/tests/client/object.test.tsrx +87 -81
- package/tests/client/portal.test.tsrx +57 -51
- package/tests/client/ref.test.tsrx +233 -202
- package/tests/client/return.test.tsrx +71 -2560
- package/tests/client/set.test.tsrx +54 -45
- package/tests/client/svg.test.tsrx +216 -186
- package/tests/client/switch.test.tsrx +194 -193
- package/tests/client/track-async-hydration.test.tsrx +18 -14
- package/tests/client/tracked-index-access.test.tsrx +28 -18
- package/tests/client/try.test.tsrx +675 -548
- package/tests/client/tsx.test.tsrx +373 -311
- package/tests/client/typescript-generics.test.tsrx +145 -145
- package/tests/client/url/url.derived.test.tsrx +33 -28
- package/tests/client/url/url.parsing.test.tsrx +61 -51
- package/tests/client/url/url.partial-removal.test.tsrx +56 -48
- package/tests/client/url/url.reactivity.test.tsrx +142 -125
- package/tests/client/url/url.serialization.test.tsrx +13 -11
- package/tests/client/url-search-params/url-search-params.derived.test.tsrx +34 -29
- package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +25 -21
- package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +50 -45
- package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +111 -99
- package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +49 -43
- package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +14 -12
- package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +16 -14
- package/tests/hydration/basic.test.js +3 -3
- package/tests/hydration/compiled/client/basic.js +586 -651
- package/tests/hydration/compiled/client/composite.js +79 -104
- package/tests/hydration/compiled/client/events.js +140 -148
- package/tests/hydration/compiled/client/for.js +1005 -1018
- package/tests/hydration/compiled/client/head.js +124 -134
- package/tests/hydration/compiled/client/hmr.js +41 -48
- package/tests/hydration/compiled/client/html-in-template.js +38 -41
- package/tests/hydration/compiled/client/html.js +970 -1314
- package/tests/hydration/compiled/client/if-children.js +234 -249
- package/tests/hydration/compiled/client/if.js +182 -189
- package/tests/hydration/compiled/client/mixed-control-flow.js +347 -303
- package/tests/hydration/compiled/client/nested-control-flow.js +1084 -832
- package/tests/hydration/compiled/client/portal.js +65 -85
- package/tests/hydration/compiled/client/reactivity.js +84 -90
- package/tests/hydration/compiled/client/return.js +38 -1939
- package/tests/hydration/compiled/client/switch.js +218 -224
- package/tests/hydration/compiled/client/track-async-serialization.js +250 -259
- package/tests/hydration/compiled/client/try.js +123 -132
- package/tests/hydration/compiled/server/basic.js +773 -831
- package/tests/hydration/compiled/server/composite.js +166 -191
- package/tests/hydration/compiled/server/events.js +170 -184
- package/tests/hydration/compiled/server/for.js +851 -909
- package/tests/hydration/compiled/server/head.js +206 -216
- package/tests/hydration/compiled/server/hmr.js +64 -72
- package/tests/hydration/compiled/server/html-in-template.js +42 -76
- package/tests/hydration/compiled/server/html.js +1362 -1667
- package/tests/hydration/compiled/server/if-children.js +419 -445
- package/tests/hydration/compiled/server/if.js +194 -208
- package/tests/hydration/compiled/server/mixed-control-flow.js +249 -257
- package/tests/hydration/compiled/server/nested-control-flow.js +491 -515
- package/tests/hydration/compiled/server/portal.js +152 -160
- package/tests/hydration/compiled/server/reactivity.js +94 -106
- package/tests/hydration/compiled/server/return.js +28 -2172
- package/tests/hydration/compiled/server/switch.js +274 -286
- package/tests/hydration/compiled/server/track-async-serialization.js +340 -358
- package/tests/hydration/compiled/server/try.js +167 -185
- package/tests/hydration/components/basic.tsrx +320 -272
- package/tests/hydration/components/composite.tsrx +44 -32
- package/tests/hydration/components/events.tsrx +101 -91
- package/tests/hydration/components/for.tsrx +510 -452
- package/tests/hydration/components/head.tsrx +87 -80
- package/tests/hydration/components/hmr.tsrx +22 -17
- package/tests/hydration/components/html-in-template.tsrx +22 -17
- package/tests/hydration/components/html.tsrx +525 -443
- package/tests/hydration/components/if-children.tsrx +158 -148
- package/tests/hydration/components/if.tsrx +109 -95
- package/tests/hydration/components/mixed-control-flow.tsrx +100 -96
- package/tests/hydration/components/nested-control-flow.tsrx +215 -203
- package/tests/hydration/components/portal.tsrx +41 -34
- package/tests/hydration/components/reactivity.tsrx +37 -27
- package/tests/hydration/components/return.tsrx +12 -556
- package/tests/hydration/components/switch.tsrx +120 -114
- package/tests/hydration/components/track-async-serialization.tsrx +107 -91
- package/tests/hydration/components/try.tsrx +55 -40
- package/tests/hydration/html.test.js +4 -4
- package/tests/hydration/return.test.js +13 -532
- package/tests/server/await.test.tsrx +3 -3
- package/tests/server/basic.attributes.test.tsrx +264 -195
- package/tests/server/basic.components.test.tsrx +296 -169
- package/tests/server/basic.test.tsrx +300 -198
- package/tests/server/compiler.test.tsrx +62 -60
- package/tests/server/composite.props.test.tsrx +77 -63
- package/tests/server/composite.test.tsrx +168 -192
- package/tests/server/context.test.tsrx +18 -12
- package/tests/server/dynamic-elements.test.tsrx +197 -180
- package/tests/server/for.test.tsrx +85 -78
- package/tests/server/head.test.tsrx +50 -43
- package/tests/server/html-nesting-validation.test.tsrx +8 -8
- package/tests/server/if.test.tsrx +57 -51
- package/tests/server/lazy-destructuring.test.tsrx +366 -294
- package/tests/server/return.test.tsrx +76 -1355
- package/tests/server/streaming-ssr.test.tsrx +4 -75
- package/tests/server/style-identifier.test.tsrx +169 -148
- package/tests/server/switch.test.tsrx +91 -85
- package/tests/server/track-async-serialization.test.tsrx +105 -85
- package/tests/server/try.test.tsrx +374 -280
- package/tests/utils/compiler-compat-config.test.js +2 -2
- package/tests/utils/runtime-imports.test.js +10 -0
- package/types/index.d.ts +8 -0
- package/tests/client/__snapshots__/html.test.rsrx.snap +0 -40
|
@@ -2,228 +2,64 @@
|
|
|
2
2
|
import * as _$_ from 'ripple/internal/server';
|
|
3
3
|
|
|
4
4
|
export function ForIf() {
|
|
5
|
-
_$_.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_$_.output_push('>');
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
_$_.output_push('<!--[-->');
|
|
5
|
+
return _$_.tsrx_element(() => {
|
|
6
|
+
const items = [
|
|
7
|
+
{ id: 1, show: true, label: 'One' },
|
|
8
|
+
{ id: 2, show: true, label: 'Two' },
|
|
9
|
+
{ id: 3, show: false, label: 'Three' }
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
_$_.regular_block(() => {
|
|
13
|
+
_$_.output_push('<ul');
|
|
14
|
+
_$_.output_push(' class="for-if"');
|
|
15
|
+
_$_.output_push('>');
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
{
|
|
22
18
|
_$_.output_push('<!--[-->');
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
_$_.output_push('
|
|
26
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id}`));
|
|
27
|
-
_$_.output_push('>');
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
_$_.output_push(_$_.escape(item.label));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_$_.output_push('</li>');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
_$_.output_push('<!--]-->');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
_$_.output_push('<!--]-->');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
_$_.output_push('</ul>');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
_$_.pop_component();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function ForSwitch() {
|
|
49
|
-
_$_.push_component();
|
|
50
|
-
|
|
51
|
-
const items = [
|
|
52
|
-
{ id: 1, kind: 'a' },
|
|
53
|
-
{ id: 2, kind: 'b' },
|
|
54
|
-
{ id: 3, kind: 'a' }
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
_$_.regular_block(() => {
|
|
58
|
-
_$_.output_push('<ul');
|
|
59
|
-
_$_.output_push(' class="for-switch"');
|
|
60
|
-
_$_.output_push('>');
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
_$_.output_push('<!--[-->');
|
|
64
|
-
|
|
65
|
-
for (const item of items) {
|
|
66
|
-
_$_.output_push('<!--[-->');
|
|
20
|
+
for (const item of items) {
|
|
21
|
+
_$_.output_push('<!--[-->');
|
|
67
22
|
|
|
68
|
-
|
|
69
|
-
case 'a':
|
|
23
|
+
if (item.show) {
|
|
70
24
|
_$_.output_push('<li');
|
|
71
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id}
|
|
25
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id}`));
|
|
72
26
|
_$_.output_push('>');
|
|
73
|
-
{
|
|
74
|
-
_$_.output_push(_$_.escape(`A-${item.id}`));
|
|
75
|
-
}
|
|
76
|
-
_$_.output_push('</li>');
|
|
77
|
-
break;
|
|
78
27
|
|
|
79
|
-
default:
|
|
80
|
-
_$_.output_push('<li');
|
|
81
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-b`));
|
|
82
|
-
_$_.output_push('>');
|
|
83
28
|
{
|
|
84
|
-
_$_.output_push(_$_.escape(
|
|
29
|
+
_$_.output_push(_$_.escape(item.label));
|
|
85
30
|
}
|
|
86
|
-
_$_.output_push('</li>');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
_$_.output_push('<!--]-->');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
_$_.output_push('<!--]-->');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
_$_.output_push('</ul>');
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
_$_.pop_component();
|
|
99
|
-
}
|
|
100
31
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const show = true;
|
|
105
|
-
const kind = 'a';
|
|
106
|
-
|
|
107
|
-
_$_.regular_block(() => {
|
|
108
|
-
_$_.output_push('<div');
|
|
109
|
-
_$_.output_push(' class="if-switch"');
|
|
110
|
-
_$_.output_push('>');
|
|
111
|
-
|
|
112
|
-
{
|
|
113
|
-
_$_.output_push('<!--[-->');
|
|
114
|
-
|
|
115
|
-
if (show) {
|
|
116
|
-
_$_.output_push('<!--[-->');
|
|
117
|
-
|
|
118
|
-
switch (kind) {
|
|
119
|
-
case 'a':
|
|
120
|
-
_$_.output_push('<p');
|
|
121
|
-
_$_.output_push(' class="case-a"');
|
|
122
|
-
_$_.output_push('>');
|
|
123
|
-
{
|
|
124
|
-
_$_.output_push('Case A');
|
|
125
|
-
}
|
|
126
|
-
_$_.output_push('</p>');
|
|
127
|
-
break;
|
|
32
|
+
_$_.output_push('</li>');
|
|
33
|
+
}
|
|
128
34
|
|
|
129
|
-
|
|
130
|
-
_$_.output_push('<p');
|
|
131
|
-
_$_.output_push(' class="case-default"');
|
|
132
|
-
_$_.output_push('>');
|
|
133
|
-
{
|
|
134
|
-
_$_.output_push('Default');
|
|
135
|
-
}
|
|
136
|
-
_$_.output_push('</p>');
|
|
35
|
+
_$_.output_push('<!--]-->');
|
|
137
36
|
}
|
|
138
37
|
|
|
139
38
|
_$_.output_push('<!--]-->');
|
|
140
39
|
}
|
|
141
40
|
|
|
142
|
-
_$_.output_push('
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
_$_.output_push('</div>');
|
|
41
|
+
_$_.output_push('</ul>');
|
|
42
|
+
});
|
|
146
43
|
});
|
|
147
|
-
|
|
148
|
-
_$_.pop_component();
|
|
149
44
|
}
|
|
150
45
|
|
|
151
|
-
export function
|
|
152
|
-
_$_.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
_$_.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
_$_.output_push('<!--[-->');
|
|
164
|
-
|
|
165
|
-
if (show) {
|
|
166
|
-
_$_.output_push('<!--[-->');
|
|
167
|
-
|
|
168
|
-
switch (kind) {
|
|
169
|
-
case 'a':
|
|
170
|
-
_$_.output_push('<p');
|
|
171
|
-
_$_.output_push(' class="case-a"');
|
|
172
|
-
_$_.output_push('>');
|
|
173
|
-
{
|
|
174
|
-
_$_.output_push('Case A');
|
|
175
|
-
}
|
|
176
|
-
_$_.output_push('</p>');
|
|
177
|
-
break;
|
|
178
|
-
|
|
179
|
-
default:
|
|
180
|
-
_$_.output_push('<p');
|
|
181
|
-
_$_.output_push(' class="case-default"');
|
|
182
|
-
_$_.output_push('>');
|
|
183
|
-
{
|
|
184
|
-
_$_.output_push('Default');
|
|
185
|
-
}
|
|
186
|
-
_$_.output_push('</p>');
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
_$_.output_push('<!--]-->');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
_$_.output_push('<!--]-->');
|
|
193
|
-
_$_.output_push('<p');
|
|
194
|
-
_$_.output_push(' class="after"');
|
|
46
|
+
export function ForSwitch() {
|
|
47
|
+
return _$_.tsrx_element(() => {
|
|
48
|
+
const items = [
|
|
49
|
+
{ id: 1, kind: 'a' },
|
|
50
|
+
{ id: 2, kind: 'b' },
|
|
51
|
+
{ id: 3, kind: 'a' }
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
_$_.regular_block(() => {
|
|
55
|
+
_$_.output_push('<ul');
|
|
56
|
+
_$_.output_push(' class="for-switch"');
|
|
195
57
|
_$_.output_push('>');
|
|
196
58
|
|
|
197
59
|
{
|
|
198
|
-
_$_.output_push('after');
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
_$_.output_push('</p>');
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
_$_.output_push('</div>');
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
_$_.pop_component();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export function ForIfSwitchSingle() {
|
|
211
|
-
_$_.push_component();
|
|
212
|
-
|
|
213
|
-
const items = [{ id: 1, kind: 'a', show: true }];
|
|
214
|
-
|
|
215
|
-
_$_.regular_block(() => {
|
|
216
|
-
_$_.output_push('<ul');
|
|
217
|
-
_$_.output_push(' class="for-if-switch-single"');
|
|
218
|
-
_$_.output_push('>');
|
|
219
|
-
|
|
220
|
-
{
|
|
221
|
-
_$_.output_push('<!--[-->');
|
|
222
|
-
|
|
223
|
-
for (const item of items) {
|
|
224
60
|
_$_.output_push('<!--[-->');
|
|
225
61
|
|
|
226
|
-
|
|
62
|
+
for (const item of items) {
|
|
227
63
|
_$_.output_push('<!--[-->');
|
|
228
64
|
|
|
229
65
|
switch (item.kind) {
|
|
@@ -239,10 +75,10 @@ export function ForIfSwitchSingle() {
|
|
|
239
75
|
|
|
240
76
|
default:
|
|
241
77
|
_$_.output_push('<li');
|
|
242
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-
|
|
78
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-b`));
|
|
243
79
|
_$_.output_push('>');
|
|
244
80
|
{
|
|
245
|
-
_$_.output_push(_$_.escape(`
|
|
81
|
+
_$_.output_push(_$_.escape(`B-${item.id}`));
|
|
246
82
|
}
|
|
247
83
|
_$_.output_push('</li>');
|
|
248
84
|
}
|
|
@@ -253,56 +89,46 @@ export function ForIfSwitchSingle() {
|
|
|
253
89
|
_$_.output_push('<!--]-->');
|
|
254
90
|
}
|
|
255
91
|
|
|
256
|
-
_$_.output_push('
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
_$_.output_push('</ul>');
|
|
92
|
+
_$_.output_push('</ul>');
|
|
93
|
+
});
|
|
260
94
|
});
|
|
261
|
-
|
|
262
|
-
_$_.pop_component();
|
|
263
95
|
}
|
|
264
96
|
|
|
265
|
-
export function
|
|
266
|
-
_$_.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
{ id: 1, kind: 'a', show: true },
|
|
270
|
-
{ id: 2, kind: 'b', show: true }
|
|
271
|
-
];
|
|
272
|
-
|
|
273
|
-
_$_.regular_block(() => {
|
|
274
|
-
_$_.output_push('<ul');
|
|
275
|
-
_$_.output_push(' class="for-if-switch-multi"');
|
|
276
|
-
_$_.output_push('>');
|
|
97
|
+
export function IfSwitch() {
|
|
98
|
+
return _$_.tsrx_element(() => {
|
|
99
|
+
const show = true;
|
|
100
|
+
const kind = 'a';
|
|
277
101
|
|
|
278
|
-
{
|
|
279
|
-
_$_.output_push('
|
|
102
|
+
_$_.regular_block(() => {
|
|
103
|
+
_$_.output_push('<div');
|
|
104
|
+
_$_.output_push(' class="if-switch"');
|
|
105
|
+
_$_.output_push('>');
|
|
280
106
|
|
|
281
|
-
|
|
107
|
+
{
|
|
282
108
|
_$_.output_push('<!--[-->');
|
|
283
109
|
|
|
284
|
-
if (
|
|
110
|
+
if (show) {
|
|
285
111
|
_$_.output_push('<!--[-->');
|
|
286
112
|
|
|
287
|
-
switch (
|
|
113
|
+
switch (kind) {
|
|
288
114
|
case 'a':
|
|
289
|
-
_$_.output_push('<
|
|
290
|
-
_$_.output_push(
|
|
115
|
+
_$_.output_push('<p');
|
|
116
|
+
_$_.output_push(' class="case-a"');
|
|
291
117
|
_$_.output_push('>');
|
|
292
118
|
{
|
|
293
|
-
_$_.output_push(
|
|
119
|
+
_$_.output_push('Case A');
|
|
294
120
|
}
|
|
295
|
-
_$_.output_push('</
|
|
121
|
+
_$_.output_push('</p>');
|
|
296
122
|
break;
|
|
297
123
|
|
|
298
124
|
default:
|
|
299
|
-
_$_.output_push('<
|
|
300
|
-
_$_.output_push(
|
|
125
|
+
_$_.output_push('<p');
|
|
126
|
+
_$_.output_push(' class="case-default"');
|
|
301
127
|
_$_.output_push('>');
|
|
302
128
|
{
|
|
303
|
-
_$_.output_push(
|
|
129
|
+
_$_.output_push('Default');
|
|
304
130
|
}
|
|
305
|
-
_$_.output_push('</
|
|
131
|
+
_$_.output_push('</p>');
|
|
306
132
|
}
|
|
307
133
|
|
|
308
134
|
_$_.output_push('<!--]-->');
|
|
@@ -311,309 +137,310 @@ export function ForIfSwitchMulti() {
|
|
|
311
137
|
_$_.output_push('<!--]-->');
|
|
312
138
|
}
|
|
313
139
|
|
|
314
|
-
_$_.output_push('
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
_$_.output_push('</ul>');
|
|
140
|
+
_$_.output_push('</div>');
|
|
141
|
+
});
|
|
318
142
|
});
|
|
319
|
-
|
|
320
|
-
_$_.pop_component();
|
|
321
143
|
}
|
|
322
144
|
|
|
323
|
-
export function
|
|
324
|
-
_$_.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
{ id: 1, kind: 'a', show: true },
|
|
328
|
-
{ id: 2, kind: 'b', show: false },
|
|
329
|
-
{ id: 3, kind: 'a', show: true }
|
|
330
|
-
];
|
|
331
|
-
|
|
332
|
-
_$_.regular_block(() => {
|
|
333
|
-
_$_.output_push('<ul');
|
|
334
|
-
_$_.output_push(' class="for-if-switch-disabled"');
|
|
335
|
-
_$_.output_push('>');
|
|
145
|
+
export function IfSwitchHidden() {
|
|
146
|
+
return _$_.tsrx_element(() => {
|
|
147
|
+
const show = false;
|
|
148
|
+
const kind = 'a';
|
|
336
149
|
|
|
337
|
-
{
|
|
338
|
-
_$_.output_push('
|
|
150
|
+
_$_.regular_block(() => {
|
|
151
|
+
_$_.output_push('<div');
|
|
152
|
+
_$_.output_push(' class="if-switch-hidden"');
|
|
153
|
+
_$_.output_push('>');
|
|
339
154
|
|
|
340
|
-
|
|
155
|
+
{
|
|
341
156
|
_$_.output_push('<!--[-->');
|
|
342
157
|
|
|
343
|
-
if (
|
|
158
|
+
if (show) {
|
|
344
159
|
_$_.output_push('<!--[-->');
|
|
345
160
|
|
|
346
|
-
switch (
|
|
161
|
+
switch (kind) {
|
|
347
162
|
case 'a':
|
|
348
|
-
_$_.output_push('<
|
|
349
|
-
_$_.output_push(
|
|
163
|
+
_$_.output_push('<p');
|
|
164
|
+
_$_.output_push(' class="case-a"');
|
|
350
165
|
_$_.output_push('>');
|
|
351
166
|
{
|
|
352
|
-
_$_.output_push(
|
|
167
|
+
_$_.output_push('Case A');
|
|
353
168
|
}
|
|
354
|
-
_$_.output_push('</
|
|
169
|
+
_$_.output_push('</p>');
|
|
355
170
|
break;
|
|
356
171
|
|
|
357
172
|
default:
|
|
358
|
-
_$_.output_push('<
|
|
359
|
-
_$_.output_push(
|
|
173
|
+
_$_.output_push('<p');
|
|
174
|
+
_$_.output_push(' class="case-default"');
|
|
360
175
|
_$_.output_push('>');
|
|
361
176
|
{
|
|
362
|
-
_$_.output_push(
|
|
177
|
+
_$_.output_push('Default');
|
|
363
178
|
}
|
|
364
|
-
_$_.output_push('</
|
|
179
|
+
_$_.output_push('</p>');
|
|
365
180
|
}
|
|
366
181
|
|
|
367
182
|
_$_.output_push('<!--]-->');
|
|
368
183
|
}
|
|
369
184
|
|
|
370
185
|
_$_.output_push('<!--]-->');
|
|
371
|
-
|
|
186
|
+
_$_.output_push('<p');
|
|
187
|
+
_$_.output_push(' class="after"');
|
|
188
|
+
_$_.output_push('>');
|
|
189
|
+
|
|
190
|
+
{
|
|
191
|
+
_$_.output_push('after');
|
|
192
|
+
}
|
|
372
193
|
|
|
373
|
-
|
|
374
|
-
|
|
194
|
+
_$_.output_push('</p>');
|
|
195
|
+
}
|
|
375
196
|
|
|
376
|
-
|
|
197
|
+
_$_.output_push('</div>');
|
|
198
|
+
});
|
|
377
199
|
});
|
|
378
|
-
|
|
379
|
-
_$_.pop_component();
|
|
380
200
|
}
|
|
381
201
|
|
|
382
|
-
export function
|
|
383
|
-
_$_.
|
|
384
|
-
|
|
385
|
-
const kind = 'a';
|
|
386
|
-
|
|
387
|
-
_$_.regular_block(() => {
|
|
388
|
-
_$_.output_push('<div');
|
|
389
|
-
_$_.output_push(' class="switch-try"');
|
|
390
|
-
_$_.output_push('>');
|
|
202
|
+
export function ForIfSwitchSingle() {
|
|
203
|
+
return _$_.tsrx_element(() => {
|
|
204
|
+
const items = [{ id: 1, kind: 'a', show: true }];
|
|
391
205
|
|
|
392
|
-
{
|
|
393
|
-
_$_.output_push('
|
|
206
|
+
_$_.regular_block(() => {
|
|
207
|
+
_$_.output_push('<ul');
|
|
208
|
+
_$_.output_push(' class="for-if-switch-single"');
|
|
209
|
+
_$_.output_push('>');
|
|
394
210
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
_$_.try_block(
|
|
398
|
-
() => {
|
|
399
|
-
_$_.output_push('<!--[-->');
|
|
400
|
-
_$_.output_push('<p');
|
|
401
|
-
_$_.output_push(' class="resolved-a"');
|
|
402
|
-
_$_.output_push('>');
|
|
211
|
+
{
|
|
212
|
+
_$_.output_push('<!--[-->');
|
|
403
213
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
214
|
+
for (const item of items) {
|
|
215
|
+
_$_.output_push('<!--[-->');
|
|
407
216
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
},
|
|
411
|
-
null,
|
|
412
|
-
() => {
|
|
413
|
-
_$_.output_push('<!--[-->');
|
|
414
|
-
_$_.output_push('<p');
|
|
415
|
-
_$_.output_push(' class="pending-a"');
|
|
416
|
-
_$_.output_push('>');
|
|
217
|
+
if (item.show) {
|
|
218
|
+
_$_.output_push('<!--[-->');
|
|
417
219
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
220
|
+
switch (item.kind) {
|
|
221
|
+
case 'a':
|
|
222
|
+
_$_.output_push('<li');
|
|
223
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-a`));
|
|
224
|
+
_$_.output_push('>');
|
|
225
|
+
{
|
|
226
|
+
_$_.output_push(_$_.escape(`A-${item.id}`));
|
|
227
|
+
}
|
|
228
|
+
_$_.output_push('</li>');
|
|
229
|
+
break;
|
|
421
230
|
|
|
422
|
-
|
|
423
|
-
|
|
231
|
+
default:
|
|
232
|
+
_$_.output_push('<li');
|
|
233
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-default`));
|
|
234
|
+
_$_.output_push('>');
|
|
235
|
+
{
|
|
236
|
+
_$_.output_push(_$_.escape(`D-${item.id}`));
|
|
237
|
+
}
|
|
238
|
+
_$_.output_push('</li>');
|
|
424
239
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
default:
|
|
429
|
-
_$_.output_push('<p');
|
|
430
|
-
_$_.output_push(' class="default"');
|
|
431
|
-
_$_.output_push('>');
|
|
432
|
-
{
|
|
433
|
-
_$_.output_push('Default');
|
|
240
|
+
|
|
241
|
+
_$_.output_push('<!--]-->');
|
|
434
242
|
}
|
|
435
|
-
_$_.output_push('</p>');
|
|
436
|
-
}
|
|
437
243
|
|
|
438
|
-
|
|
439
|
-
|
|
244
|
+
_$_.output_push('<!--]-->');
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
_$_.output_push('<!--]-->');
|
|
248
|
+
}
|
|
440
249
|
|
|
441
|
-
|
|
250
|
+
_$_.output_push('</ul>');
|
|
251
|
+
});
|
|
442
252
|
});
|
|
443
|
-
|
|
444
|
-
_$_.pop_component();
|
|
445
253
|
}
|
|
446
254
|
|
|
447
|
-
export function
|
|
448
|
-
_$_.
|
|
449
|
-
|
|
450
|
-
|
|
255
|
+
export function ForIfSwitchMulti() {
|
|
256
|
+
return _$_.tsrx_element(() => {
|
|
257
|
+
const items = [
|
|
258
|
+
{ id: 1, kind: 'a', show: true },
|
|
259
|
+
{ id: 2, kind: 'b', show: true }
|
|
260
|
+
];
|
|
261
|
+
|
|
262
|
+
_$_.regular_block(() => {
|
|
263
|
+
_$_.output_push('<ul');
|
|
264
|
+
_$_.output_push(' class="for-if-switch-multi"');
|
|
265
|
+
_$_.output_push('>');
|
|
451
266
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
_$_.output_push(' class="for-switch-try"');
|
|
455
|
-
_$_.output_push('>');
|
|
267
|
+
{
|
|
268
|
+
_$_.output_push('<!--[-->');
|
|
456
269
|
|
|
457
|
-
|
|
458
|
-
|
|
270
|
+
for (const item of items) {
|
|
271
|
+
_$_.output_push('<!--[-->');
|
|
459
272
|
|
|
460
|
-
|
|
461
|
-
|
|
273
|
+
if (item.show) {
|
|
274
|
+
_$_.output_push('<!--[-->');
|
|
462
275
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
_$_.try_block(
|
|
466
|
-
() => {
|
|
467
|
-
_$_.output_push('<!--[-->');
|
|
276
|
+
switch (item.kind) {
|
|
277
|
+
case 'a':
|
|
468
278
|
_$_.output_push('<li');
|
|
469
279
|
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-a`));
|
|
470
280
|
_$_.output_push('>');
|
|
471
|
-
|
|
472
281
|
{
|
|
473
282
|
_$_.output_push(_$_.escape(`A-${item.id}`));
|
|
474
283
|
}
|
|
475
|
-
|
|
476
284
|
_$_.output_push('</li>');
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
() => {
|
|
481
|
-
_$_.output_push('<!--[-->');
|
|
285
|
+
break;
|
|
286
|
+
|
|
287
|
+
default:
|
|
482
288
|
_$_.output_push('<li');
|
|
483
|
-
_$_.output_push(_$_.attr('class', `
|
|
289
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-b`));
|
|
484
290
|
_$_.output_push('>');
|
|
485
|
-
|
|
486
291
|
{
|
|
487
|
-
_$_.output_push(_$_.escape(`
|
|
292
|
+
_$_.output_push(_$_.escape(`B-${item.id}`));
|
|
488
293
|
}
|
|
489
|
-
|
|
490
294
|
_$_.output_push('</li>');
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
-
);
|
|
494
|
-
break;
|
|
295
|
+
}
|
|
495
296
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
297
|
+
_$_.output_push('<!--]-->');
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
_$_.output_push('<!--]-->');
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
_$_.output_push('<!--]-->');
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
_$_.output_push('</ul>');
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export function ForIfSwitchWithDisabled() {
|
|
312
|
+
return _$_.tsrx_element(() => {
|
|
313
|
+
const items = [
|
|
314
|
+
{ id: 1, kind: 'a', show: true },
|
|
315
|
+
{ id: 2, kind: 'b', show: false },
|
|
316
|
+
{ id: 3, kind: 'a', show: true }
|
|
317
|
+
];
|
|
318
|
+
|
|
319
|
+
_$_.regular_block(() => {
|
|
320
|
+
_$_.output_push('<ul');
|
|
321
|
+
_$_.output_push(' class="for-if-switch-disabled"');
|
|
322
|
+
_$_.output_push('>');
|
|
323
|
+
|
|
324
|
+
{
|
|
325
|
+
_$_.output_push('<!--[-->');
|
|
326
|
+
|
|
327
|
+
for (const item of items) {
|
|
328
|
+
_$_.output_push('<!--[-->');
|
|
329
|
+
|
|
330
|
+
if (item.show) {
|
|
331
|
+
_$_.output_push('<!--[-->');
|
|
332
|
+
|
|
333
|
+
switch (item.kind) {
|
|
334
|
+
case 'a':
|
|
500
335
|
_$_.output_push('<li');
|
|
501
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-
|
|
336
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-a`));
|
|
502
337
|
_$_.output_push('>');
|
|
503
|
-
|
|
504
338
|
{
|
|
505
|
-
_$_.output_push(_$_.escape(`
|
|
339
|
+
_$_.output_push(_$_.escape(`A-${item.id}`));
|
|
506
340
|
}
|
|
507
|
-
|
|
508
341
|
_$_.output_push('</li>');
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
() => {
|
|
513
|
-
_$_.output_push('<!--[-->');
|
|
342
|
+
break;
|
|
343
|
+
|
|
344
|
+
default:
|
|
514
345
|
_$_.output_push('<li');
|
|
515
|
-
_$_.output_push(_$_.attr('class', `
|
|
346
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-b`));
|
|
516
347
|
_$_.output_push('>');
|
|
517
|
-
|
|
518
348
|
{
|
|
519
|
-
_$_.output_push(_$_.escape(`
|
|
349
|
+
_$_.output_push(_$_.escape(`B-${item.id}`));
|
|
520
350
|
}
|
|
521
|
-
|
|
522
351
|
_$_.output_push('</li>');
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
_$_.output_push('<!--]-->');
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
_$_.output_push('<!--]-->');
|
|
526
358
|
}
|
|
527
359
|
|
|
528
360
|
_$_.output_push('<!--]-->');
|
|
529
361
|
}
|
|
530
362
|
|
|
531
|
-
_$_.output_push('
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
_$_.output_push('</ul>');
|
|
363
|
+
_$_.output_push('</ul>');
|
|
364
|
+
});
|
|
535
365
|
});
|
|
536
|
-
|
|
537
|
-
_$_.pop_component();
|
|
538
366
|
}
|
|
539
367
|
|
|
540
|
-
export function
|
|
541
|
-
_$_.
|
|
542
|
-
|
|
543
|
-
const items = [{ id: 1, show: true }, { id: 2, show: true }];
|
|
544
|
-
|
|
545
|
-
_$_.regular_block(() => {
|
|
546
|
-
_$_.output_push('<ul');
|
|
547
|
-
_$_.output_push(' class="for-if-try"');
|
|
548
|
-
_$_.output_push('>');
|
|
368
|
+
export function SwitchTry() {
|
|
369
|
+
return _$_.tsrx_element(() => {
|
|
370
|
+
const kind = 'a';
|
|
549
371
|
|
|
550
|
-
{
|
|
551
|
-
_$_.output_push('
|
|
372
|
+
_$_.regular_block(() => {
|
|
373
|
+
_$_.output_push('<div');
|
|
374
|
+
_$_.output_push(' class="switch-try"');
|
|
375
|
+
_$_.output_push('>');
|
|
552
376
|
|
|
553
|
-
|
|
377
|
+
{
|
|
554
378
|
_$_.output_push('<!--[-->');
|
|
555
379
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
(
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
380
|
+
switch (kind) {
|
|
381
|
+
case 'a':
|
|
382
|
+
_$_.try_block(
|
|
383
|
+
() => {
|
|
384
|
+
_$_.output_push('<!--[-->');
|
|
385
|
+
_$_.output_push('<p');
|
|
386
|
+
_$_.output_push(' class="resolved-a"');
|
|
387
|
+
_$_.output_push('>');
|
|
563
388
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
389
|
+
{
|
|
390
|
+
_$_.output_push('A resolved');
|
|
391
|
+
}
|
|
567
392
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
393
|
+
_$_.output_push('</p>');
|
|
394
|
+
_$_.output_push('<!--]-->');
|
|
395
|
+
},
|
|
396
|
+
null,
|
|
397
|
+
() => {
|
|
398
|
+
_$_.output_push('<!--[-->');
|
|
399
|
+
_$_.output_push('<p');
|
|
400
|
+
_$_.output_push(' class="pending-a"');
|
|
401
|
+
_$_.output_push('>');
|
|
577
402
|
|
|
578
|
-
|
|
579
|
-
|
|
403
|
+
{
|
|
404
|
+
_$_.output_push('A pending');
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
_$_.output_push('</p>');
|
|
408
|
+
_$_.output_push('<!--]-->');
|
|
580
409
|
}
|
|
410
|
+
);
|
|
411
|
+
break;
|
|
581
412
|
|
|
582
|
-
|
|
583
|
-
|
|
413
|
+
default:
|
|
414
|
+
_$_.output_push('<p');
|
|
415
|
+
_$_.output_push(' class="default"');
|
|
416
|
+
_$_.output_push('>');
|
|
417
|
+
{
|
|
418
|
+
_$_.output_push('Default');
|
|
584
419
|
}
|
|
585
|
-
|
|
420
|
+
_$_.output_push('</p>');
|
|
586
421
|
}
|
|
587
422
|
|
|
588
423
|
_$_.output_push('<!--]-->');
|
|
589
424
|
}
|
|
590
425
|
|
|
591
|
-
_$_.output_push('
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
_$_.output_push('</ul>');
|
|
426
|
+
_$_.output_push('</div>');
|
|
427
|
+
});
|
|
595
428
|
});
|
|
596
|
-
|
|
597
|
-
_$_.pop_component();
|
|
598
429
|
}
|
|
599
430
|
|
|
600
|
-
export function
|
|
601
|
-
_$_.
|
|
602
|
-
|
|
603
|
-
const items = [{ id: 1, kind: 'a', show: true }];
|
|
604
|
-
|
|
605
|
-
_$_.regular_block(() => {
|
|
606
|
-
_$_.output_push('<ul');
|
|
607
|
-
_$_.output_push(' class="for-if-switch-try-single"');
|
|
608
|
-
_$_.output_push('>');
|
|
431
|
+
export function ForSwitchTry() {
|
|
432
|
+
return _$_.tsrx_element(() => {
|
|
433
|
+
const items = [{ id: 1, kind: 'a' }, { id: 2, kind: 'b' }];
|
|
609
434
|
|
|
610
|
-
{
|
|
611
|
-
_$_.output_push('
|
|
435
|
+
_$_.regular_block(() => {
|
|
436
|
+
_$_.output_push('<ul');
|
|
437
|
+
_$_.output_push(' class="for-switch-try"');
|
|
438
|
+
_$_.output_push('>');
|
|
612
439
|
|
|
613
|
-
|
|
440
|
+
{
|
|
614
441
|
_$_.output_push('<!--[-->');
|
|
615
442
|
|
|
616
|
-
|
|
443
|
+
for (const item of items) {
|
|
617
444
|
_$_.output_push('<!--[-->');
|
|
618
445
|
|
|
619
446
|
switch (item.kind) {
|
|
@@ -654,11 +481,11 @@ export function ForIfSwitchTrySingle() {
|
|
|
654
481
|
() => {
|
|
655
482
|
_$_.output_push('<!--[-->');
|
|
656
483
|
_$_.output_push('<li');
|
|
657
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-
|
|
484
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-b`));
|
|
658
485
|
_$_.output_push('>');
|
|
659
486
|
|
|
660
487
|
{
|
|
661
|
-
_$_.output_push(_$_.escape(`
|
|
488
|
+
_$_.output_push(_$_.escape(`B-${item.id}`));
|
|
662
489
|
}
|
|
663
490
|
|
|
664
491
|
_$_.output_push('</li>');
|
|
@@ -687,100 +514,253 @@ export function ForIfSwitchTrySingle() {
|
|
|
687
514
|
_$_.output_push('<!--]-->');
|
|
688
515
|
}
|
|
689
516
|
|
|
690
|
-
_$_.output_push('
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
_$_.output_push('</ul>');
|
|
517
|
+
_$_.output_push('</ul>');
|
|
518
|
+
});
|
|
694
519
|
});
|
|
695
|
-
|
|
696
|
-
_$_.pop_component();
|
|
697
520
|
}
|
|
698
521
|
|
|
699
|
-
export function
|
|
700
|
-
_$_.
|
|
522
|
+
export function ForIfTry() {
|
|
523
|
+
return _$_.tsrx_element(() => {
|
|
524
|
+
const items = [{ id: 1, show: true }, { id: 2, show: true }];
|
|
701
525
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
526
|
+
_$_.regular_block(() => {
|
|
527
|
+
_$_.output_push('<ul');
|
|
528
|
+
_$_.output_push(' class="for-if-try"');
|
|
529
|
+
_$_.output_push('>');
|
|
706
530
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
_$_.output_push(' class="for-if-switch-try-multi"');
|
|
710
|
-
_$_.output_push('>');
|
|
531
|
+
{
|
|
532
|
+
_$_.output_push('<!--[-->');
|
|
711
533
|
|
|
712
|
-
|
|
713
|
-
|
|
534
|
+
for (const item of items) {
|
|
535
|
+
_$_.output_push('<!--[-->');
|
|
714
536
|
|
|
715
|
-
|
|
537
|
+
if (item.show) {
|
|
538
|
+
_$_.try_block(
|
|
539
|
+
() => {
|
|
540
|
+
_$_.output_push('<!--[-->');
|
|
541
|
+
_$_.output_push('<li');
|
|
542
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id}`));
|
|
543
|
+
_$_.output_push('>');
|
|
544
|
+
|
|
545
|
+
{
|
|
546
|
+
_$_.output_push(_$_.escape(`item-${item.id}`));
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
_$_.output_push('</li>');
|
|
550
|
+
_$_.output_push('<!--]-->');
|
|
551
|
+
},
|
|
552
|
+
null,
|
|
553
|
+
() => {
|
|
554
|
+
_$_.output_push('<!--[-->');
|
|
555
|
+
_$_.output_push('<li');
|
|
556
|
+
_$_.output_push(_$_.attr('class', `pending pending-${item.id}`));
|
|
557
|
+
_$_.output_push('>');
|
|
558
|
+
|
|
559
|
+
{
|
|
560
|
+
_$_.output_push(_$_.escape(`pending ${item.id}`));
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
_$_.output_push('</li>');
|
|
564
|
+
_$_.output_push('<!--]-->');
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
_$_.output_push('<!--]-->');
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
_$_.output_push('<!--]-->');
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
_$_.output_push('</ul>');
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export function ForIfSwitchTrySingle() {
|
|
581
|
+
return _$_.tsrx_element(() => {
|
|
582
|
+
const items = [{ id: 1, kind: 'a', show: true }];
|
|
583
|
+
|
|
584
|
+
_$_.regular_block(() => {
|
|
585
|
+
_$_.output_push('<ul');
|
|
586
|
+
_$_.output_push(' class="for-if-switch-try-single"');
|
|
587
|
+
_$_.output_push('>');
|
|
588
|
+
|
|
589
|
+
{
|
|
716
590
|
_$_.output_push('<!--[-->');
|
|
717
591
|
|
|
718
|
-
|
|
592
|
+
for (const item of items) {
|
|
719
593
|
_$_.output_push('<!--[-->');
|
|
720
594
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
_$_.output_push(
|
|
595
|
+
if (item.show) {
|
|
596
|
+
_$_.output_push('<!--[-->');
|
|
597
|
+
|
|
598
|
+
switch (item.kind) {
|
|
599
|
+
case 'a':
|
|
600
|
+
_$_.try_block(
|
|
601
|
+
() => {
|
|
602
|
+
_$_.output_push('<!--[-->');
|
|
603
|
+
_$_.output_push('<li');
|
|
604
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-a`));
|
|
605
|
+
_$_.output_push('>');
|
|
606
|
+
|
|
607
|
+
{
|
|
608
|
+
_$_.output_push(_$_.escape(`A-${item.id}`));
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
_$_.output_push('</li>');
|
|
612
|
+
_$_.output_push('<!--]-->');
|
|
613
|
+
},
|
|
614
|
+
null,
|
|
615
|
+
() => {
|
|
616
|
+
_$_.output_push('<!--[-->');
|
|
617
|
+
_$_.output_push('<li');
|
|
618
|
+
_$_.output_push(_$_.attr('class', `pending pending-${item.id}`));
|
|
619
|
+
_$_.output_push('>');
|
|
620
|
+
|
|
621
|
+
{
|
|
622
|
+
_$_.output_push(_$_.escape(`pending ${item.id}`));
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
_$_.output_push('</li>');
|
|
626
|
+
_$_.output_push('<!--]-->');
|
|
732
627
|
}
|
|
628
|
+
);
|
|
629
|
+
break;
|
|
630
|
+
|
|
631
|
+
default:
|
|
632
|
+
_$_.try_block(
|
|
633
|
+
() => {
|
|
634
|
+
_$_.output_push('<!--[-->');
|
|
635
|
+
_$_.output_push('<li');
|
|
636
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-default`));
|
|
637
|
+
_$_.output_push('>');
|
|
638
|
+
|
|
639
|
+
{
|
|
640
|
+
_$_.output_push(_$_.escape(`D-${item.id}`));
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
_$_.output_push('</li>');
|
|
644
|
+
_$_.output_push('<!--]-->');
|
|
645
|
+
},
|
|
646
|
+
null,
|
|
647
|
+
() => {
|
|
648
|
+
_$_.output_push('<!--[-->');
|
|
649
|
+
_$_.output_push('<li');
|
|
650
|
+
_$_.output_push(_$_.attr('class', `pending pending-${item.id}`));
|
|
651
|
+
_$_.output_push('>');
|
|
652
|
+
|
|
653
|
+
{
|
|
654
|
+
_$_.output_push(_$_.escape(`pending ${item.id}`));
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
_$_.output_push('</li>');
|
|
658
|
+
_$_.output_push('<!--]-->');
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
}
|
|
733
662
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
},
|
|
737
|
-
null,
|
|
738
|
-
() => {
|
|
739
|
-
_$_.output_push('<!--[-->');
|
|
740
|
-
_$_.output_push('<li');
|
|
741
|
-
_$_.output_push(_$_.attr('class', `pending pending-${item.id}`));
|
|
742
|
-
_$_.output_push('>');
|
|
663
|
+
_$_.output_push('<!--]-->');
|
|
664
|
+
}
|
|
743
665
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
666
|
+
_$_.output_push('<!--]-->');
|
|
667
|
+
}
|
|
747
668
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
);
|
|
752
|
-
break;
|
|
669
|
+
_$_.output_push('<!--]-->');
|
|
670
|
+
}
|
|
753
671
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
_$_.output_push('<li');
|
|
759
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-b`));
|
|
760
|
-
_$_.output_push('>');
|
|
672
|
+
_$_.output_push('</ul>');
|
|
673
|
+
});
|
|
674
|
+
});
|
|
675
|
+
}
|
|
761
676
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
677
|
+
export function ForIfSwitchTryMulti() {
|
|
678
|
+
return _$_.tsrx_element(() => {
|
|
679
|
+
const items = [
|
|
680
|
+
{ id: 1, kind: 'a', show: true },
|
|
681
|
+
{ id: 2, kind: 'b', show: true }
|
|
682
|
+
];
|
|
683
|
+
|
|
684
|
+
_$_.regular_block(() => {
|
|
685
|
+
_$_.output_push('<ul');
|
|
686
|
+
_$_.output_push(' class="for-if-switch-try-multi"');
|
|
687
|
+
_$_.output_push('>');
|
|
765
688
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
},
|
|
769
|
-
null,
|
|
770
|
-
() => {
|
|
771
|
-
_$_.output_push('<!--[-->');
|
|
772
|
-
_$_.output_push('<li');
|
|
773
|
-
_$_.output_push(_$_.attr('class', `pending pending-${item.id}`));
|
|
774
|
-
_$_.output_push('>');
|
|
689
|
+
{
|
|
690
|
+
_$_.output_push('<!--[-->');
|
|
775
691
|
|
|
776
|
-
|
|
777
|
-
|
|
692
|
+
for (const item of items) {
|
|
693
|
+
_$_.output_push('<!--[-->');
|
|
694
|
+
|
|
695
|
+
if (item.show) {
|
|
696
|
+
_$_.output_push('<!--[-->');
|
|
697
|
+
|
|
698
|
+
switch (item.kind) {
|
|
699
|
+
case 'a':
|
|
700
|
+
_$_.try_block(
|
|
701
|
+
() => {
|
|
702
|
+
_$_.output_push('<!--[-->');
|
|
703
|
+
_$_.output_push('<li');
|
|
704
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-a`));
|
|
705
|
+
_$_.output_push('>');
|
|
706
|
+
|
|
707
|
+
{
|
|
708
|
+
_$_.output_push(_$_.escape(`A-${item.id}`));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
_$_.output_push('</li>');
|
|
712
|
+
_$_.output_push('<!--]-->');
|
|
713
|
+
},
|
|
714
|
+
null,
|
|
715
|
+
() => {
|
|
716
|
+
_$_.output_push('<!--[-->');
|
|
717
|
+
_$_.output_push('<li');
|
|
718
|
+
_$_.output_push(_$_.attr('class', `pending pending-${item.id}`));
|
|
719
|
+
_$_.output_push('>');
|
|
720
|
+
|
|
721
|
+
{
|
|
722
|
+
_$_.output_push(_$_.escape(`pending ${item.id}`));
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
_$_.output_push('</li>');
|
|
726
|
+
_$_.output_push('<!--]-->');
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
break;
|
|
730
|
+
|
|
731
|
+
default:
|
|
732
|
+
_$_.try_block(
|
|
733
|
+
() => {
|
|
734
|
+
_$_.output_push('<!--[-->');
|
|
735
|
+
_$_.output_push('<li');
|
|
736
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id} kind-b`));
|
|
737
|
+
_$_.output_push('>');
|
|
738
|
+
|
|
739
|
+
{
|
|
740
|
+
_$_.output_push(_$_.escape(`B-${item.id}`));
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
_$_.output_push('</li>');
|
|
744
|
+
_$_.output_push('<!--]-->');
|
|
745
|
+
},
|
|
746
|
+
null,
|
|
747
|
+
() => {
|
|
748
|
+
_$_.output_push('<!--[-->');
|
|
749
|
+
_$_.output_push('<li');
|
|
750
|
+
_$_.output_push(_$_.attr('class', `pending pending-${item.id}`));
|
|
751
|
+
_$_.output_push('>');
|
|
752
|
+
|
|
753
|
+
{
|
|
754
|
+
_$_.output_push(_$_.escape(`pending ${item.id}`));
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
_$_.output_push('</li>');
|
|
758
|
+
_$_.output_push('<!--]-->');
|
|
778
759
|
}
|
|
760
|
+
);
|
|
761
|
+
}
|
|
779
762
|
|
|
780
|
-
|
|
781
|
-
_$_.output_push('<!--]-->');
|
|
782
|
-
}
|
|
783
|
-
);
|
|
763
|
+
_$_.output_push('<!--]-->');
|
|
784
764
|
}
|
|
785
765
|
|
|
786
766
|
_$_.output_push('<!--]-->');
|
|
@@ -789,11 +769,7 @@ export function ForIfSwitchTryMulti() {
|
|
|
789
769
|
_$_.output_push('<!--]-->');
|
|
790
770
|
}
|
|
791
771
|
|
|
792
|
-
_$_.output_push('
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
_$_.output_push('</ul>');
|
|
772
|
+
_$_.output_push('</ul>');
|
|
773
|
+
});
|
|
796
774
|
});
|
|
797
|
-
|
|
798
|
-
_$_.pop_component();
|
|
799
775
|
}
|