ripple 0.3.11 → 0.3.13
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 +43 -0
- package/package.json +8 -2
- package/src/compiler/phases/1-parse/index.js +73 -30
- package/src/compiler/phases/2-analyze/index.js +28 -58
- package/src/compiler/phases/3-transform/client/index.js +127 -164
- package/src/compiler/phases/3-transform/segments.js +4 -8
- package/src/compiler/phases/3-transform/server/index.js +210 -360
- package/src/compiler/types/import.d.ts +0 -12
- package/src/compiler/types/index.d.ts +12 -5
- package/src/compiler/types/parse.d.ts +2 -0
- package/src/compiler/utils.js +39 -44
- package/src/helpers.d.ts +2 -0
- package/src/runtime/index-client.js +15 -13
- package/src/runtime/index-server.js +18 -11
- package/src/runtime/internal/client/blocks.js +19 -23
- package/src/runtime/internal/client/constants.js +20 -9
- package/src/runtime/internal/client/index.js +14 -4
- package/src/runtime/internal/client/runtime.js +435 -173
- package/src/runtime/internal/client/try.js +334 -156
- package/src/runtime/internal/client/types.d.ts +26 -0
- package/src/runtime/internal/server/blocks.js +183 -0
- package/src/runtime/internal/server/constants.js +7 -0
- package/src/runtime/internal/server/index.js +780 -148
- package/src/runtime/internal/server/types.d.ts +35 -0
- package/src/server/index.js +1 -1
- package/src/utils/async.js +35 -0
- package/src/utils/builders.js +3 -1
- package/tests/client/__snapshots__/computed-properties.test.rsrx.snap +49 -0
- package/tests/client/__snapshots__/for.test.rsrx.snap +319 -0
- package/tests/client/__snapshots__/html.test.rsrx.snap +40 -0
- package/tests/client/_etc.test.rsrx +7 -0
- package/tests/client/array/{array.static.test.ripple → array.static.test.rsrx} +18 -20
- package/tests/client/async-suspend.test.rsrx +662 -0
- package/tests/client/basic/__snapshots__/basic.attributes.test.rsrx.snap +60 -0
- package/tests/client/basic/__snapshots__/basic.rendering.test.rsrx.snap +59 -0
- package/tests/client/basic/{basic.errors.test.ripple → basic.errors.test.rsrx} +2 -2
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.rsrx.snap +12 -0
- package/tests/client/compiler/__snapshots__/compiler.typescript.test.rsrx.snap +46 -0
- package/tests/client/compiler/{compiler.try-in-function.test.ripple → compiler.try-in-function.test.rsrx} +8 -6
- package/tests/client/composite/__snapshots__/composite.render.test.rsrx.snap +37 -0
- package/tests/client/{function-overload.test.ripple → function-overload.test.rsrx} +1 -1
- package/tests/client/try.test.rsrx +1702 -0
- package/tests/hydration/build-components.js +5 -3
- package/tests/hydration/compiled/client/head.js +11 -11
- package/tests/hydration/compiled/client/mixed-control-flow.js +55 -70
- package/tests/hydration/compiled/client/nested-control-flow.js +72 -88
- package/tests/hydration/compiled/client/try.js +42 -54
- package/tests/hydration/compiled/server/basic.js +491 -369
- package/tests/hydration/compiled/server/composite.js +153 -128
- package/tests/hydration/compiled/server/events.js +166 -145
- package/tests/hydration/compiled/server/for.js +821 -677
- package/tests/hydration/compiled/server/head.js +200 -165
- package/tests/hydration/compiled/server/hmr.js +62 -54
- package/tests/hydration/compiled/server/html-in-template.js +64 -55
- package/tests/hydration/compiled/server/html.js +1477 -1360
- package/tests/hydration/compiled/server/if-children.js +448 -408
- package/tests/hydration/compiled/server/if.js +204 -171
- package/tests/hydration/compiled/server/mixed-control-flow.js +237 -195
- package/tests/hydration/compiled/server/nested-control-flow.js +533 -467
- package/tests/hydration/compiled/server/portal.js +94 -107
- package/tests/hydration/compiled/server/reactivity.js +87 -64
- package/tests/hydration/compiled/server/return.js +1424 -1174
- package/tests/hydration/compiled/server/switch.js +268 -238
- package/tests/hydration/compiled/server/try.js +98 -87
- package/tests/hydration/components/{mixed-control-flow.ripple → mixed-control-flow.rsrx} +2 -2
- package/tests/hydration/components/{try.ripple → try.rsrx} +4 -2
- package/tests/hydration/mixed-control-flow.test.js +14 -0
- package/tests/hydration/nested-control-flow.test.js +50 -48
- package/tests/hydration/try.test.js +25 -0
- package/tests/server/__snapshots__/compiler.test.ripple.snap +0 -32
- package/tests/server/__snapshots__/compiler.test.rsrx.snap +95 -0
- package/tests/server/{compiler.test.ripple → compiler.test.rsrx} +0 -17
- package/tests/server/{html-nesting-validation.test.ripple → html-nesting-validation.test.rsrx} +3 -3
- package/tests/server/streaming-ssr.test.rsrx +115 -0
- package/tests/server/try.test.rsrx +503 -0
- package/tests/utils/compiler-compat-config.test.js +3 -3
- package/tests/utils/vite-plugin-config.test.js +1 -1
- package/tests/utils/vite-plugin-hmr.test.js +5 -5
- package/tsconfig.json +4 -0
- package/types/index.d.ts +13 -23
- package/types/server.d.ts +43 -16
- package/tests/client/_etc.test.ripple +0 -5
- package/tests/client/async-suspend.test.ripple +0 -94
- package/tests/client/try.test.ripple +0 -196
- package/tests/server/streaming-ssr.test.ripple +0 -68
- package/tests/server/try.test.ripple +0 -82
- /package/tests/client/array/{array.copy-within.test.ripple → array.copy-within.test.rsrx} +0 -0
- /package/tests/client/array/{array.derived.test.ripple → array.derived.test.rsrx} +0 -0
- /package/tests/client/array/{array.iteration.test.ripple → array.iteration.test.rsrx} +0 -0
- /package/tests/client/array/{array.mutations.test.ripple → array.mutations.test.rsrx} +0 -0
- /package/tests/client/array/{array.to-methods.test.ripple → array.to-methods.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.attributes.test.ripple → basic.attributes.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.collections.test.ripple → basic.collections.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.components.test.ripple → basic.components.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.events.test.ripple → basic.events.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.get-set.test.ripple → basic.get-set.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.hmr.test.ripple → basic.hmr.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.reactivity.test.ripple → basic.reactivity.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.rendering.test.ripple → basic.rendering.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.styling.test.ripple → basic.styling.test.rsrx} +0 -0
- /package/tests/client/basic/{basic.utilities.test.ripple → basic.utilities.test.rsrx} +0 -0
- /package/tests/client/{boundaries.test.ripple → boundaries.test.rsrx} +0 -0
- /package/tests/client/compiler/{compiler.assignments.test.ripple → compiler.assignments.test.rsrx} +0 -0
- /package/tests/client/compiler/{compiler.attributes.test.ripple → compiler.attributes.test.rsrx} +0 -0
- /package/tests/client/compiler/{compiler.basic.test.ripple → compiler.basic.test.rsrx} +0 -0
- /package/tests/client/compiler/{compiler.regex.test.ripple → compiler.regex.test.rsrx} +0 -0
- /package/tests/client/compiler/{compiler.tracked-access.test.ripple → compiler.tracked-access.test.rsrx} +0 -0
- /package/tests/client/compiler/{compiler.typescript.test.ripple → compiler.typescript.test.rsrx} +0 -0
- /package/tests/client/composite/{composite.dynamic-components.test.ripple → composite.dynamic-components.test.rsrx} +0 -0
- /package/tests/client/composite/{composite.generics.test.ripple → composite.generics.test.rsrx} +0 -0
- /package/tests/client/composite/{composite.props.test.ripple → composite.props.test.rsrx} +0 -0
- /package/tests/client/composite/{composite.reactivity.test.ripple → composite.reactivity.test.rsrx} +0 -0
- /package/tests/client/composite/{composite.render.test.ripple → composite.render.test.rsrx} +0 -0
- /package/tests/client/{computed-properties.test.ripple → computed-properties.test.rsrx} +0 -0
- /package/tests/client/{context.test.ripple → context.test.rsrx} +0 -0
- /package/tests/client/css/{global-additional-cases.test.ripple → global-additional-cases.test.rsrx} +0 -0
- /package/tests/client/css/{global-advanced-selectors.test.ripple → global-advanced-selectors.test.rsrx} +0 -0
- /package/tests/client/css/{global-at-rules.test.ripple → global-at-rules.test.rsrx} +0 -0
- /package/tests/client/css/{global-basic.test.ripple → global-basic.test.rsrx} +0 -0
- /package/tests/client/css/{global-classes-ids.test.ripple → global-classes-ids.test.rsrx} +0 -0
- /package/tests/client/css/{global-combinators.test.ripple → global-combinators.test.rsrx} +0 -0
- /package/tests/client/css/{global-complex-nesting.test.ripple → global-complex-nesting.test.rsrx} +0 -0
- /package/tests/client/css/{global-edge-cases.test.ripple → global-edge-cases.test.rsrx} +0 -0
- /package/tests/client/css/{global-keyframes.test.ripple → global-keyframes.test.rsrx} +0 -0
- /package/tests/client/css/{global-nested.test.ripple → global-nested.test.rsrx} +0 -0
- /package/tests/client/css/{global-pseudo.test.ripple → global-pseudo.test.rsrx} +0 -0
- /package/tests/client/css/{global-scoping.test.ripple → global-scoping.test.rsrx} +0 -0
- /package/tests/client/css/{style-identifier.test.ripple → style-identifier.test.rsrx} +0 -0
- /package/tests/client/{date.test.ripple → date.test.rsrx} +0 -0
- /package/tests/client/{dynamic-elements.test.ripple → dynamic-elements.test.rsrx} +0 -0
- /package/tests/client/{events.test.ripple → events.test.rsrx} +0 -0
- /package/tests/client/{for.test.ripple → for.test.rsrx} +0 -0
- /package/tests/client/{function-overload-import.ripple → function-overload-import.rsrx} +0 -0
- /package/tests/client/{head.test.ripple → head.test.rsrx} +0 -0
- /package/tests/client/{html.test.ripple → html.test.rsrx} +0 -0
- /package/tests/client/{input-value.test.ripple → input-value.test.rsrx} +0 -0
- /package/tests/client/{lazy-destructuring.test.ripple → lazy-destructuring.test.rsrx} +0 -0
- /package/tests/client/{map.test.ripple → map.test.rsrx} +0 -0
- /package/tests/client/{media-query.test.ripple → media-query.test.rsrx} +0 -0
- /package/tests/client/{object.test.ripple → object.test.rsrx} +0 -0
- /package/tests/client/{portal.test.ripple → portal.test.rsrx} +0 -0
- /package/tests/client/{ref.test.ripple → ref.test.rsrx} +0 -0
- /package/tests/client/{return.test.ripple → return.test.rsrx} +0 -0
- /package/tests/client/{set.test.ripple → set.test.rsrx} +0 -0
- /package/tests/client/{svg.test.ripple → svg.test.rsrx} +0 -0
- /package/tests/client/{switch.test.ripple → switch.test.rsrx} +0 -0
- /package/tests/client/{tsx.test.ripple → tsx.test.rsrx} +0 -0
- /package/tests/client/{typescript-generics.test.ripple → typescript-generics.test.rsrx} +0 -0
- /package/tests/client/url/{url.derived.test.ripple → url.derived.test.rsrx} +0 -0
- /package/tests/client/url/{url.parsing.test.ripple → url.parsing.test.rsrx} +0 -0
- /package/tests/client/url/{url.partial-removal.test.ripple → url.partial-removal.test.rsrx} +0 -0
- /package/tests/client/url/{url.reactivity.test.ripple → url.reactivity.test.rsrx} +0 -0
- /package/tests/client/url/{url.serialization.test.ripple → url.serialization.test.rsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.derived.test.ripple → url-search-params.derived.test.rsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.initialization.test.ripple → url-search-params.initialization.test.rsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.iteration.test.ripple → url-search-params.iteration.test.rsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.mutation.test.ripple → url-search-params.mutation.test.rsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.retrieval.test.ripple → url-search-params.retrieval.test.rsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.serialization.test.ripple → url-search-params.serialization.test.rsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.tracked-url.test.ripple → url-search-params.tracked-url.test.rsrx} +0 -0
- /package/tests/hydration/components/{basic.ripple → basic.rsrx} +0 -0
- /package/tests/hydration/components/{composite.ripple → composite.rsrx} +0 -0
- /package/tests/hydration/components/{events.ripple → events.rsrx} +0 -0
- /package/tests/hydration/components/{for.ripple → for.rsrx} +0 -0
- /package/tests/hydration/components/{head.ripple → head.rsrx} +0 -0
- /package/tests/hydration/components/{hmr.ripple → hmr.rsrx} +0 -0
- /package/tests/hydration/components/{html-in-template.ripple → html-in-template.rsrx} +0 -0
- /package/tests/hydration/components/{html.ripple → html.rsrx} +0 -0
- /package/tests/hydration/components/{if-children.ripple → if-children.rsrx} +0 -0
- /package/tests/hydration/components/{if.ripple → if.rsrx} +0 -0
- /package/tests/hydration/components/{nested-control-flow.ripple → nested-control-flow.rsrx} +0 -0
- /package/tests/hydration/components/{portal.ripple → portal.rsrx} +0 -0
- /package/tests/hydration/components/{reactivity.ripple → reactivity.rsrx} +0 -0
- /package/tests/hydration/components/{return.ripple → return.rsrx} +0 -0
- /package/tests/hydration/components/{switch.ripple → switch.rsrx} +0 -0
- /package/tests/server/{await.test.ripple → await.test.rsrx} +0 -0
- /package/tests/server/{basic.attributes.test.ripple → basic.attributes.test.rsrx} +0 -0
- /package/tests/server/{basic.components.test.ripple → basic.components.test.rsrx} +0 -0
- /package/tests/server/{basic.test.ripple → basic.test.rsrx} +0 -0
- /package/tests/server/{composite.props.test.ripple → composite.props.test.rsrx} +0 -0
- /package/tests/server/{composite.test.ripple → composite.test.rsrx} +0 -0
- /package/tests/server/{context.test.ripple → context.test.rsrx} +0 -0
- /package/tests/server/{dynamic-elements.test.ripple → dynamic-elements.test.rsrx} +0 -0
- /package/tests/server/{for.test.ripple → for.test.rsrx} +0 -0
- /package/tests/server/{head.test.ripple → head.test.rsrx} +0 -0
- /package/tests/server/{if.test.ripple → if.test.rsrx} +0 -0
- /package/tests/server/{lazy-destructuring.test.ripple → lazy-destructuring.test.rsrx} +0 -0
- /package/tests/server/{return.test.ripple → return.test.rsrx} +0 -0
- /package/tests/server/{style-identifier.test.ripple → style-identifier.test.rsrx} +0 -0
- /package/tests/server/{switch.test.ripple → switch.test.rsrx} +0 -0
|
@@ -1,303 +1,345 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as _$_ from 'ripple/internal/server';
|
|
3
3
|
|
|
4
|
-
import { track } from 'ripple/server';
|
|
4
|
+
import { track, trackAsync } from 'ripple/server';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
_$_.push_component();
|
|
6
|
+
export function MixedControlFlowStatic() {
|
|
7
|
+
_$_.push_component();
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const rows = [
|
|
10
|
+
{ id: 1, kind: 'a', enabled: true },
|
|
11
|
+
{ id: 2, kind: 'b', enabled: true },
|
|
12
|
+
{ id: 3, kind: 'a', enabled: false }
|
|
13
|
+
];
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
_$_.regular_block(() => {
|
|
16
|
+
_$_.output_push('<section');
|
|
17
|
+
_$_.output_push(' class="mixed-static"');
|
|
18
|
+
_$_.output_push('>');
|
|
19
19
|
|
|
20
20
|
{
|
|
21
|
-
|
|
21
|
+
_$_.output_push('<!--[-->');
|
|
22
22
|
|
|
23
23
|
for (const row of rows) {
|
|
24
|
-
|
|
24
|
+
_$_.output_push('<!--[-->');
|
|
25
25
|
|
|
26
26
|
if (row.enabled) {
|
|
27
|
-
|
|
27
|
+
_$_.output_push('<!--[-->');
|
|
28
28
|
|
|
29
29
|
switch (row.kind) {
|
|
30
30
|
case 'a':
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
31
|
+
_$_.try_block(
|
|
32
|
+
() => {
|
|
33
|
+
_$_.output_push('<!--[-->');
|
|
34
|
+
_$_.output_push('<div');
|
|
35
|
+
_$_.output_push(_$_.attr('class', `row row-${row.id} kind-a`));
|
|
36
|
+
_$_.output_push('>');
|
|
37
|
+
|
|
38
|
+
{
|
|
39
|
+
_$_.output_push(_$_.escape(`A-${row.id}`));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_$_.output_push('</div>');
|
|
43
|
+
_$_.output_push('<!--]-->');
|
|
44
|
+
},
|
|
45
|
+
null,
|
|
46
|
+
() => {
|
|
47
|
+
_$_.output_push('<!--[-->');
|
|
48
|
+
_$_.output_push('<div');
|
|
49
|
+
_$_.output_push(_$_.attr('class', `pending pending-${row.id}`));
|
|
50
|
+
_$_.output_push('>');
|
|
51
|
+
|
|
52
|
+
{
|
|
53
|
+
_$_.output_push('pending a');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_$_.output_push('</div>');
|
|
57
|
+
_$_.output_push('<!--]-->');
|
|
48
58
|
}
|
|
49
|
-
|
|
50
|
-
__output.push('</div>');
|
|
51
|
-
});
|
|
52
|
-
__output.push('<!--]-->');
|
|
59
|
+
);
|
|
53
60
|
break;
|
|
54
61
|
|
|
55
62
|
default:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
|
|
63
|
+
_$_.try_block(
|
|
64
|
+
() => {
|
|
65
|
+
_$_.output_push('<!--[-->');
|
|
66
|
+
_$_.output_push('<div');
|
|
67
|
+
_$_.output_push(_$_.attr('class', `row row-${row.id} kind-b`));
|
|
68
|
+
_$_.output_push('>');
|
|
69
|
+
|
|
70
|
+
{
|
|
71
|
+
_$_.output_push(_$_.escape(`B-${row.id}`));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_$_.output_push('</div>');
|
|
75
|
+
_$_.output_push('<!--]-->');
|
|
76
|
+
},
|
|
77
|
+
null,
|
|
78
|
+
() => {
|
|
79
|
+
_$_.output_push('<!--[-->');
|
|
80
|
+
_$_.output_push('<div');
|
|
81
|
+
_$_.output_push(_$_.attr('class', `pending pending-${row.id}`));
|
|
82
|
+
_$_.output_push('>');
|
|
83
|
+
|
|
84
|
+
{
|
|
85
|
+
_$_.output_push('pending b');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_$_.output_push('</div>');
|
|
89
|
+
_$_.output_push('<!--]-->');
|
|
73
90
|
}
|
|
74
|
-
|
|
75
|
-
__output.push('</div>');
|
|
76
|
-
});
|
|
77
|
-
__output.push('<!--]-->');
|
|
91
|
+
);
|
|
78
92
|
}
|
|
79
93
|
|
|
80
|
-
|
|
94
|
+
_$_.output_push('<!--]-->');
|
|
81
95
|
}
|
|
82
96
|
|
|
83
|
-
|
|
97
|
+
_$_.output_push('<!--]-->');
|
|
84
98
|
}
|
|
85
99
|
|
|
86
|
-
|
|
100
|
+
_$_.output_push('<!--]-->');
|
|
87
101
|
}
|
|
88
102
|
|
|
89
|
-
|
|
90
|
-
_$_.pop_component();
|
|
103
|
+
_$_.output_push('</section>');
|
|
91
104
|
});
|
|
92
|
-
}
|
|
93
105
|
|
|
94
|
-
|
|
106
|
+
_$_.pop_component();
|
|
107
|
+
}
|
|
95
108
|
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
_$_.push_component();
|
|
109
|
+
export function MixedControlFlowReactive() {
|
|
110
|
+
_$_.push_component();
|
|
99
111
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
let lazy = _$_.track(true);
|
|
113
|
+
let lazy_1 = _$_.track('a');
|
|
114
|
+
let lazy_2 = _$_.track([{ id: 1, label: 'One' }, { id: 2, label: 'Two' }]);
|
|
103
115
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
116
|
+
_$_.regular_block(() => {
|
|
117
|
+
_$_.output_push('<button');
|
|
118
|
+
_$_.output_push(' class="toggle-show"');
|
|
119
|
+
_$_.output_push('>');
|
|
107
120
|
|
|
108
121
|
{
|
|
109
|
-
|
|
122
|
+
_$_.output_push('Toggle Show');
|
|
110
123
|
}
|
|
111
124
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
_$_.output_push('</button>');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
_$_.regular_block(() => {
|
|
129
|
+
_$_.output_push('<button');
|
|
130
|
+
_$_.output_push(' class="toggle-mode"');
|
|
131
|
+
_$_.output_push('>');
|
|
116
132
|
|
|
117
133
|
{
|
|
118
|
-
|
|
134
|
+
_$_.output_push('Toggle Mode');
|
|
119
135
|
}
|
|
120
136
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
137
|
+
_$_.output_push('</button>');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
_$_.regular_block(() => {
|
|
141
|
+
_$_.output_push('<button');
|
|
142
|
+
_$_.output_push(' class="add-item"');
|
|
143
|
+
_$_.output_push('>');
|
|
125
144
|
|
|
126
145
|
{
|
|
127
|
-
|
|
146
|
+
_$_.output_push('Add Item');
|
|
128
147
|
}
|
|
129
148
|
|
|
130
|
-
|
|
131
|
-
|
|
149
|
+
_$_.output_push('</button>');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
_$_.regular_block(() => {
|
|
153
|
+
_$_.output_push('<!--[-->');
|
|
132
154
|
|
|
133
155
|
if (_$_.get(lazy)) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
156
|
+
_$_.output_push('<div');
|
|
157
|
+
_$_.output_push(' class="mixed-reactive-list"');
|
|
158
|
+
_$_.output_push('>');
|
|
137
159
|
|
|
138
160
|
{
|
|
139
|
-
|
|
161
|
+
_$_.output_push('<!--[-->');
|
|
140
162
|
|
|
141
163
|
for (const item of _$_.get(lazy_2)) {
|
|
142
|
-
|
|
164
|
+
_$_.output_push('<!--[-->');
|
|
143
165
|
|
|
144
166
|
switch (_$_.get(lazy_1)) {
|
|
145
167
|
case 'a':
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
|
|
168
|
+
_$_.try_block(
|
|
169
|
+
() => {
|
|
170
|
+
_$_.output_push('<!--[-->');
|
|
171
|
+
_$_.output_push('<p');
|
|
172
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id}`));
|
|
173
|
+
_$_.output_push('>');
|
|
174
|
+
|
|
175
|
+
{
|
|
176
|
+
_$_.output_push(_$_.escape(`A:${item.label}`));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
_$_.output_push('</p>');
|
|
180
|
+
_$_.output_push('<!--]-->');
|
|
181
|
+
},
|
|
182
|
+
null,
|
|
183
|
+
() => {
|
|
184
|
+
_$_.output_push('<!--[-->');
|
|
185
|
+
_$_.output_push('<p');
|
|
186
|
+
_$_.output_push(' class="pending"');
|
|
187
|
+
_$_.output_push('>');
|
|
188
|
+
|
|
189
|
+
{
|
|
190
|
+
_$_.output_push('pending a');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
_$_.output_push('</p>');
|
|
194
|
+
_$_.output_push('<!--]-->');
|
|
163
195
|
}
|
|
164
|
-
|
|
165
|
-
__output.push('</p>');
|
|
166
|
-
});
|
|
167
|
-
__output.push('<!--]-->');
|
|
196
|
+
);
|
|
168
197
|
break;
|
|
169
198
|
|
|
170
199
|
default:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
{
|
|
187
|
-
|
|
200
|
+
_$_.try_block(
|
|
201
|
+
() => {
|
|
202
|
+
_$_.output_push('<!--[-->');
|
|
203
|
+
_$_.output_push('<p');
|
|
204
|
+
_$_.output_push(_$_.attr('class', `item item-${item.id}`));
|
|
205
|
+
_$_.output_push('>');
|
|
206
|
+
|
|
207
|
+
{
|
|
208
|
+
_$_.output_push(_$_.escape(`B:${item.label}`));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
_$_.output_push('</p>');
|
|
212
|
+
_$_.output_push('<!--]-->');
|
|
213
|
+
},
|
|
214
|
+
null,
|
|
215
|
+
() => {
|
|
216
|
+
_$_.output_push('<!--[-->');
|
|
217
|
+
_$_.output_push('<p');
|
|
218
|
+
_$_.output_push(' class="pending"');
|
|
219
|
+
_$_.output_push('>');
|
|
220
|
+
|
|
221
|
+
{
|
|
222
|
+
_$_.output_push('pending b');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
_$_.output_push('</p>');
|
|
226
|
+
_$_.output_push('<!--]-->');
|
|
188
227
|
}
|
|
189
|
-
|
|
190
|
-
__output.push('</p>');
|
|
191
|
-
});
|
|
192
|
-
__output.push('<!--]-->');
|
|
228
|
+
);
|
|
193
229
|
}
|
|
194
230
|
|
|
195
|
-
|
|
231
|
+
_$_.output_push('<!--]-->');
|
|
196
232
|
}
|
|
197
233
|
|
|
198
|
-
|
|
234
|
+
_$_.output_push('<!--]-->');
|
|
199
235
|
}
|
|
200
236
|
|
|
201
|
-
|
|
237
|
+
_$_.output_push('</div>');
|
|
202
238
|
}
|
|
203
239
|
|
|
204
|
-
|
|
205
|
-
_$_.pop_component();
|
|
240
|
+
_$_.output_push('<!--]-->');
|
|
206
241
|
});
|
|
207
|
-
}
|
|
208
242
|
|
|
209
|
-
|
|
243
|
+
_$_.pop_component();
|
|
244
|
+
}
|
|
210
245
|
|
|
211
|
-
export
|
|
212
|
-
|
|
213
|
-
_$_.push_component();
|
|
246
|
+
export function MixedControlFlowAsyncPending() {
|
|
247
|
+
_$_.push_component();
|
|
214
248
|
|
|
215
|
-
|
|
216
|
-
|
|
249
|
+
const rows = [1, 2];
|
|
250
|
+
const state = 'slow';
|
|
217
251
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
252
|
+
_$_.regular_block(() => {
|
|
253
|
+
_$_.output_push('<div');
|
|
254
|
+
_$_.output_push(' class="before"');
|
|
255
|
+
_$_.output_push('>');
|
|
221
256
|
|
|
222
257
|
{
|
|
223
|
-
|
|
258
|
+
_$_.output_push('before');
|
|
224
259
|
}
|
|
225
260
|
|
|
226
|
-
|
|
227
|
-
|
|
261
|
+
_$_.output_push('</div>');
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
_$_.regular_block(() => {
|
|
265
|
+
_$_.output_push('<!--[-->');
|
|
228
266
|
|
|
229
267
|
for (const row of rows) {
|
|
230
|
-
|
|
268
|
+
_$_.output_push('<!--[-->');
|
|
231
269
|
|
|
232
270
|
if (row === 1) {
|
|
233
|
-
|
|
271
|
+
_$_.output_push('<!--[-->');
|
|
234
272
|
|
|
235
273
|
switch (state) {
|
|
236
274
|
case 'slow':
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
__output.body = __output.body.slice(0, __pending_pos_4);
|
|
275
|
+
_$_.try_block(
|
|
276
|
+
() => {
|
|
277
|
+
_$_.output_push('<!--[-->');
|
|
278
|
+
|
|
279
|
+
{
|
|
280
|
+
const comp = AsyncRow;
|
|
281
|
+
const args = [{ label: `row-${row}` }];
|
|
282
|
+
|
|
283
|
+
comp(...args);
|
|
284
|
+
}
|
|
248
285
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
286
|
+
_$_.output_push('<!--]-->');
|
|
287
|
+
},
|
|
288
|
+
null,
|
|
289
|
+
() => {
|
|
290
|
+
_$_.output_push('<!--[-->');
|
|
291
|
+
_$_.output_push('<div');
|
|
292
|
+
_$_.output_push(_$_.attr('class', `pending-row pending-row-${row}`));
|
|
293
|
+
_$_.output_push('>');
|
|
294
|
+
|
|
295
|
+
{
|
|
296
|
+
_$_.output_push(_$_.escape(`pending ${row}`));
|
|
297
|
+
}
|
|
252
298
|
|
|
253
|
-
|
|
299
|
+
_$_.output_push('</div>');
|
|
300
|
+
_$_.output_push('<!--]-->');
|
|
254
301
|
}
|
|
255
|
-
|
|
256
|
-
__output.push('<!--]-->');
|
|
302
|
+
);
|
|
257
303
|
break;
|
|
258
304
|
|
|
259
305
|
default:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
306
|
+
_$_.output_push('<div');
|
|
307
|
+
_$_.output_push(' class="unexpected"');
|
|
308
|
+
_$_.output_push('>');
|
|
263
309
|
{
|
|
264
|
-
|
|
310
|
+
_$_.output_push('unexpected');
|
|
265
311
|
}
|
|
266
|
-
|
|
312
|
+
_$_.output_push('</div>');
|
|
267
313
|
}
|
|
268
314
|
|
|
269
|
-
|
|
315
|
+
_$_.output_push('<!--]-->');
|
|
270
316
|
}
|
|
271
317
|
|
|
272
|
-
|
|
318
|
+
_$_.output_push('<!--]-->');
|
|
273
319
|
}
|
|
274
320
|
|
|
275
|
-
|
|
276
|
-
_$_.pop_component();
|
|
321
|
+
_$_.output_push('<!--]-->');
|
|
277
322
|
});
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
MixedControlFlowAsyncPending.async = true;
|
|
281
323
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
_$_.push_component();
|
|
324
|
+
_$_.pop_component();
|
|
325
|
+
}
|
|
285
326
|
|
|
286
|
-
|
|
327
|
+
function AsyncRow({ label }) {
|
|
328
|
+
_$_.push_component();
|
|
287
329
|
|
|
288
|
-
|
|
330
|
+
let lazy_3 = _$_.track_async(() => Promise.resolve(label));
|
|
289
331
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
332
|
+
_$_.regular_block(() => {
|
|
333
|
+
_$_.output_push('<div');
|
|
334
|
+
_$_.output_push(' class="resolved-row"');
|
|
335
|
+
_$_.output_push('>');
|
|
293
336
|
|
|
294
337
|
{
|
|
295
|
-
|
|
338
|
+
_$_.output_push(_$_.escape(_$_.get(lazy_3)));
|
|
296
339
|
}
|
|
297
340
|
|
|
298
|
-
|
|
299
|
-
_$_.pop_component();
|
|
341
|
+
_$_.output_push('</div>');
|
|
300
342
|
});
|
|
301
|
-
}
|
|
302
343
|
|
|
303
|
-
|
|
344
|
+
_$_.pop_component();
|
|
345
|
+
}
|