ripple 0.3.7 → 0.3.8
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 +7 -0
- package/package.json +2 -2
- package/src/compiler/phases/1-parse/index.js +37 -194
- package/src/compiler/phases/2-analyze/index.js +63 -18
- package/src/compiler/phases/3-transform/client/index.js +19 -3
- package/src/compiler/phases/3-transform/server/index.js +16 -24
- package/src/compiler/types/parse.d.ts +0 -8
- package/src/runtime/internal/client/composite.js +2 -2
- package/tests/client/array/array.copy-within.test.ripple +12 -12
- package/tests/client/array/array.derived.test.ripple +46 -46
- package/tests/client/array/array.iteration.test.ripple +10 -10
- package/tests/client/array/array.mutations.test.ripple +20 -20
- package/tests/client/array/array.to-methods.test.ripple +6 -6
- package/tests/client/async-suspend.test.ripple +5 -5
- package/tests/client/basic/basic.attributes.test.ripple +81 -81
- package/tests/client/basic/basic.collections.test.ripple +9 -9
- package/tests/client/basic/basic.components.test.ripple +28 -28
- package/tests/client/basic/basic.errors.test.ripple +18 -18
- package/tests/client/basic/basic.events.test.ripple +37 -37
- package/tests/client/basic/basic.get-set.test.ripple +6 -6
- package/tests/client/basic/basic.reactivity.test.ripple +68 -68
- package/tests/client/basic/basic.rendering.test.ripple +19 -19
- package/tests/client/basic/basic.utilities.test.ripple +3 -3
- package/tests/client/boundaries.test.ripple +12 -12
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.ripple.snap +5 -5
- package/tests/client/compiler/compiler.assignments.test.ripple +19 -19
- package/tests/client/compiler/compiler.basic.test.ripple +16 -16
- package/tests/client/compiler/compiler.tracked-access.test.ripple +2 -2
- package/tests/client/composite/composite.dynamic-components.test.ripple +9 -9
- package/tests/client/composite/composite.props.test.ripple +11 -11
- package/tests/client/composite/composite.reactivity.test.ripple +43 -43
- package/tests/client/composite/composite.render.test.ripple +3 -3
- package/tests/client/computed-properties.test.ripple +4 -4
- package/tests/client/date.test.ripple +42 -42
- package/tests/client/dynamic-elements.test.ripple +42 -42
- package/tests/client/events.test.ripple +70 -70
- package/tests/client/for.test.ripple +25 -25
- package/tests/client/head.test.ripple +19 -19
- package/tests/client/html.test.ripple +3 -3
- package/tests/client/input-value.test.ripple +84 -84
- package/tests/client/lazy-destructuring.test.ripple +71 -16
- package/tests/client/map.test.ripple +16 -16
- package/tests/client/media-query.test.ripple +7 -7
- package/tests/client/portal.test.ripple +11 -11
- package/tests/client/ref.test.ripple +4 -4
- package/tests/client/return.test.ripple +52 -52
- package/tests/client/set.test.ripple +6 -6
- package/tests/client/svg.test.ripple +5 -5
- package/tests/client/switch.test.ripple +44 -44
- package/tests/client/try.test.ripple +5 -5
- package/tests/client/url/url.derived.test.ripple +6 -6
- package/tests/client/url-search-params/url-search-params.derived.test.ripple +8 -8
- package/tests/client/url-search-params/url-search-params.iteration.test.ripple +10 -10
- package/tests/client/url-search-params/url-search-params.mutation.test.ripple +10 -10
- package/tests/client/url-search-params/url-search-params.retrieval.test.ripple +18 -18
- package/tests/client/url-search-params/url-search-params.serialization.test.ripple +2 -2
- package/tests/hydration/compiled/client/events.js +25 -25
- package/tests/hydration/compiled/client/for.js +70 -66
- package/tests/hydration/compiled/client/head.js +25 -25
- package/tests/hydration/compiled/client/hmr.js +2 -2
- package/tests/hydration/compiled/client/html.js +3 -3
- package/tests/hydration/compiled/client/if-children.js +24 -24
- package/tests/hydration/compiled/client/if.js +18 -18
- package/tests/hydration/compiled/client/mixed-control-flow.js +9 -9
- package/tests/hydration/compiled/client/portal.js +3 -3
- package/tests/hydration/compiled/client/reactivity.js +16 -16
- package/tests/hydration/compiled/client/return.js +40 -40
- package/tests/hydration/compiled/client/switch.js +12 -12
- package/tests/hydration/compiled/server/events.js +19 -19
- package/tests/hydration/compiled/server/for.js +41 -41
- package/tests/hydration/compiled/server/head.js +26 -26
- package/tests/hydration/compiled/server/hmr.js +2 -2
- package/tests/hydration/compiled/server/html.js +2 -2
- package/tests/hydration/compiled/server/if-children.js +16 -16
- package/tests/hydration/compiled/server/if.js +11 -11
- package/tests/hydration/compiled/server/mixed-control-flow.js +6 -6
- package/tests/hydration/compiled/server/portal.js +2 -2
- package/tests/hydration/compiled/server/reactivity.js +16 -16
- package/tests/hydration/compiled/server/return.js +25 -25
- package/tests/hydration/compiled/server/switch.js +8 -8
- package/tests/hydration/components/events.ripple +25 -25
- package/tests/hydration/components/for.ripple +66 -66
- package/tests/hydration/components/head.ripple +16 -16
- package/tests/hydration/components/hmr.ripple +2 -2
- package/tests/hydration/components/html.ripple +3 -3
- package/tests/hydration/components/if-children.ripple +24 -24
- package/tests/hydration/components/if.ripple +18 -18
- package/tests/hydration/components/mixed-control-flow.ripple +9 -9
- package/tests/hydration/components/portal.ripple +3 -3
- package/tests/hydration/components/reactivity.ripple +16 -16
- package/tests/hydration/components/return.ripple +40 -40
- package/tests/hydration/components/switch.ripple +20 -20
- package/tests/server/await.test.ripple +3 -3
- package/tests/server/basic.attributes.test.ripple +34 -34
- package/tests/server/basic.components.test.ripple +10 -10
- package/tests/server/basic.test.ripple +38 -40
- package/tests/server/composite.props.test.ripple +9 -9
- package/tests/server/dynamic-elements.test.ripple +13 -12
- package/tests/server/head.test.ripple +11 -11
- package/tests/server/lazy-destructuring.test.ripple +27 -4
|
@@ -19,13 +19,13 @@ describe('head elements', () => {
|
|
|
19
19
|
|
|
20
20
|
it('renders reactive title element', async () => {
|
|
21
21
|
component App() {
|
|
22
|
-
let title = track('Initial Title');
|
|
22
|
+
let &[title] = track('Initial Title');
|
|
23
23
|
|
|
24
24
|
<head>
|
|
25
|
-
<title>{
|
|
25
|
+
<title>{title}</title>
|
|
26
26
|
</head>
|
|
27
27
|
<div>
|
|
28
|
-
<span>{
|
|
28
|
+
<span>{title}</span>
|
|
29
29
|
</div>
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -38,10 +38,10 @@ describe('head elements', () => {
|
|
|
38
38
|
|
|
39
39
|
it('renders title with template literal', async () => {
|
|
40
40
|
component App() {
|
|
41
|
-
let name = track('World');
|
|
41
|
+
let &[name] = track('World');
|
|
42
42
|
|
|
43
43
|
<head>
|
|
44
|
-
<title>{`Hello ${
|
|
44
|
+
<title>{`Hello ${name}!`}</title>
|
|
45
45
|
</head>
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -53,14 +53,14 @@ describe('head elements', () => {
|
|
|
53
53
|
|
|
54
54
|
it('renders title with computed value', async () => {
|
|
55
55
|
component App() {
|
|
56
|
-
let count = track(0);
|
|
56
|
+
let &[count] = track(0);
|
|
57
57
|
let prefix = 'Count: ';
|
|
58
58
|
|
|
59
59
|
<head>
|
|
60
|
-
<title>{prefix +
|
|
60
|
+
<title>{prefix + count}</title>
|
|
61
61
|
</head>
|
|
62
62
|
<div>
|
|
63
|
-
<span>{
|
|
63
|
+
<span>{count}</span>
|
|
64
64
|
</div>
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -86,11 +86,11 @@ describe('head elements', () => {
|
|
|
86
86
|
|
|
87
87
|
it('renders title with conditional content', async () => {
|
|
88
88
|
component App() {
|
|
89
|
-
let showPrefix = track(true);
|
|
90
|
-
let title = track('Main Page');
|
|
89
|
+
let &[showPrefix] = track(true);
|
|
90
|
+
let &[title] = track('Main Page');
|
|
91
91
|
|
|
92
92
|
<head>
|
|
93
|
-
<title>{
|
|
93
|
+
<title>{showPrefix ? 'App - ' + title : title}</title>
|
|
94
94
|
</head>
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -117,11 +117,11 @@ describe('lazy destructuring', () => {
|
|
|
117
117
|
expect(body).toBeHtml('<pre>Alice-30</pre>');
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
it('treats
|
|
120
|
+
it('treats array destructuring of trackSplit as regular array access', async () => {
|
|
121
121
|
component Test() {
|
|
122
122
|
const source = { a: 1, b: 2, c: 3 };
|
|
123
|
-
const
|
|
124
|
-
<pre>{`${
|
|
123
|
+
const [a, b, rest] = trackSplit(source, ['a', 'b']);
|
|
124
|
+
<pre>{`${a.value}-${b.value}-${rest.value.c}`}</pre>
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
const { body } = await render(Test);
|
|
@@ -132,7 +132,7 @@ describe('lazy destructuring', () => {
|
|
|
132
132
|
component Test() {
|
|
133
133
|
let tracked_value = track(0);
|
|
134
134
|
let &[value, ...rest] = tracked_value;
|
|
135
|
-
<pre>{`${value}-${
|
|
135
|
+
<pre>{`${value}-${rest.length}-${rest[0] === tracked_value}`}</pre>
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const { body } = await render(Test);
|
|
@@ -149,4 +149,27 @@ describe('lazy destructuring', () => {
|
|
|
149
149
|
const { body } = await render(Test);
|
|
150
150
|
expect(body).toBeHtml('<pre>x-yz</pre>');
|
|
151
151
|
});
|
|
152
|
+
|
|
153
|
+
it('supports standalone lazy array destructuring with track()', async () => {
|
|
154
|
+
component Test() {
|
|
155
|
+
let count;
|
|
156
|
+
&[count] = track(0);
|
|
157
|
+
<div>{count}</div>
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const { body } = await render(Test);
|
|
161
|
+
expect(body).toBeHtml('<div>0</div>');
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('supports standalone lazy object destructuring', async () => {
|
|
165
|
+
component Test() {
|
|
166
|
+
let a;
|
|
167
|
+
let b;
|
|
168
|
+
&{ a, b } = { a: 10, b: 20 };
|
|
169
|
+
<pre>{`${a}-${b}`}</pre>
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const { body } = await render(Test);
|
|
173
|
+
expect(body).toBeHtml('<pre>10-20</pre>');
|
|
174
|
+
});
|
|
152
175
|
});
|