ripple 0.4.3 → 0.4.4

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/package.json +3 -3
  3. package/src/constants.js +6 -0
  4. package/src/runtime/internal/client/attributes.js +251 -125
  5. package/src/runtime/internal/client/blocks.js +16 -6
  6. package/src/runtime/internal/client/composite.js +292 -100
  7. package/src/runtime/internal/client/constants.js +8 -0
  8. package/src/runtime/internal/client/expression.js +4 -4
  9. package/src/runtime/internal/client/for.js +13 -38
  10. package/src/runtime/internal/client/if.js +56 -1
  11. package/src/runtime/internal/client/index.js +6 -6
  12. package/src/runtime/internal/client/runtime.js +73 -11
  13. package/src/runtime/internal/client/template-ns.js +45 -4
  14. package/src/runtime/internal/client/template.js +56 -0
  15. package/tests/client/composite/composite.dynamic-components.test.tsrx +40 -0
  16. package/tests/client/css/scoped-styles.test.tsrx +3 -1
  17. package/tests/client/svg.test.tsrx +273 -1
  18. package/tests/hydration/compiled/client/basic.js +36 -35
  19. package/tests/hydration/compiled/client/composite.js +11 -2
  20. package/tests/hydration/compiled/client/events.js +1 -1
  21. package/tests/hydration/compiled/client/for.js +73 -62
  22. package/tests/hydration/compiled/client/fragment-cursor.js +182 -115
  23. package/tests/hydration/compiled/client/head.js +10 -10
  24. package/tests/hydration/compiled/client/hmr.js +11 -2
  25. package/tests/hydration/compiled/client/html-in-template.js +1 -1
  26. package/tests/hydration/compiled/client/html.js +78 -50
  27. package/tests/hydration/compiled/client/if-children.js +94 -26
  28. package/tests/hydration/compiled/client/if-fragment-controlflow.js +34 -14
  29. package/tests/hydration/compiled/client/if.js +65 -17
  30. package/tests/hydration/compiled/client/mixed-control-flow.js +50 -20
  31. package/tests/hydration/compiled/client/nested-control-flow.js +188 -97
  32. package/tests/hydration/compiled/client/portal.js +14 -5
  33. package/tests/hydration/compiled/client/reactivity.js +3 -3
  34. package/tests/hydration/compiled/client/streaming.js +17 -17
  35. package/tests/hydration/compiled/client/switch.js +17 -17
  36. package/tests/hydration/compiled/client/track-async-serialization.js +19 -19
  37. package/tests/hydration/compiled/client/try.js +9 -9
  38. package/tests/hydration/compiled/client/typed-text.js +3 -2
@@ -1,7 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/client';
3
3
 
4
- var root_1 = _$_.template(`<div>`);
4
+ var root_1 = _$_.template_el('div');
5
5
 
6
6
  function render(__prev) {
7
7
  var __pattern = _$_.get(__prev._a);
@@ -19,7 +19,7 @@ function render(__prev) {
19
19
  }
20
20
  }
21
21
 
22
- var root_2 = _$_.template(`<div>pending a`);
22
+ var root_2 = _$_.template_el('div', null, 'pending a');
23
23
 
24
24
  function render_1(__prev) {
25
25
  var __a = `pending pending-${_$_.get(__prev._a).id}`;
@@ -29,7 +29,7 @@ function render_1(__prev) {
29
29
  }
30
30
  }
31
31
 
32
- var root_3 = _$_.template(`<div>`);
32
+ var root_3 = _$_.template_el('div');
33
33
 
34
34
  function render_2(__prev) {
35
35
  var __pattern_1 = _$_.get(__prev._a);
@@ -47,7 +47,7 @@ function render_2(__prev) {
47
47
  }
48
48
  }
49
49
 
50
- var root_4 = _$_.template(`<div>pending b`);
50
+ var root_4 = _$_.template_el('div', null, 'pending b');
51
51
 
52
52
  function render_3(__prev) {
53
53
  var __a = `pending pending-${_$_.get(__prev._a).id}`;
@@ -115,7 +115,15 @@ function if_1(pattern) {
115
115
  if (_$_.get(pattern).enabled) return consequent;
116
116
  }
117
117
 
118
- var root = _$_.template(`<section class=mixed-static>`);
118
+ function render_4(__prev) {
119
+ var __a = if_1(__prev._a);
120
+
121
+ if (__prev.a !== __a) {
122
+ _$_.if_update(__prev._b, __prev.a = __a);
123
+ }
124
+ }
125
+
126
+ var root = _$_.template_el('section', ['class', 'mixed-static']);
119
127
 
120
128
  function MixedControlFlowStatic_render(__anchor, __block) {
121
129
  const rows = [
@@ -131,10 +139,15 @@ function MixedControlFlowStatic_render(__anchor, __block) {
131
139
  section,
132
140
  () => rows,
133
141
  (__anchor, pattern) => {
134
- _$_.if(__anchor, if_1, true, pattern);
142
+ var ifs = _$_.if_static(__anchor, if_1, 3, pattern);
143
+
144
+ _$_.item({ a: _$_.UNINITIALIZED, _a: pattern, _b: ifs });
135
145
  },
136
146
  4,
137
- (pattern) => pattern.id
147
+ (pattern) => pattern.id,
148
+ void 0,
149
+ void 0,
150
+ render_4
138
151
  );
139
152
 
140
153
  _$_.hydrating && _$_.pop(section);
@@ -145,9 +158,9 @@ function MixedControlFlowStatic_render(__anchor, __block) {
145
158
 
146
159
  MixedControlFlowStatic[_$_.$r] = MixedControlFlowStatic_render;
147
160
 
148
- var root_8 = _$_.template(`<p>`);
161
+ var root_8 = _$_.template_el('p');
149
162
 
150
- function render_4(__prev) {
163
+ function render_5(__prev) {
151
164
  var __pattern_1_1 = _$_.get(__prev._a);
152
165
  var __a = `A:${__pattern_1_1.label}`;
153
166
 
@@ -163,10 +176,10 @@ function render_4(__prev) {
163
176
  }
164
177
  }
165
178
 
166
- var root_9 = _$_.template(`<p class=pending>pending a`);
167
- var root_10 = _$_.template(`<p>`);
179
+ var root_9 = _$_.template_el('p', ['class', 'pending'], 'pending a');
180
+ var root_10 = _$_.template_el('p');
168
181
 
169
- function render_5(__prev) {
182
+ function render_6(__prev) {
170
183
  var __pattern_1_2 = _$_.get(__prev._a);
171
184
  var __a = `B:${__pattern_1_2.label}`;
172
185
 
@@ -182,7 +195,7 @@ function render_5(__prev) {
182
195
  }
183
196
  }
184
197
 
185
- var root_11 = _$_.template(`<p class=pending>pending b`);
198
+ var root_11 = _$_.template_el('p', ['class', 'pending'], 'pending b');
186
199
 
187
200
  function switch_case_0_1(__anchor, { a: mode, b: pattern_1 }) {
188
201
  _$_.try(
@@ -190,7 +203,7 @@ function switch_case_0_1(__anchor, { a: mode, b: pattern_1 }) {
190
203
  (__anchor) => {
191
204
  var p = root_8();
192
205
 
193
- _$_.render(render_4, { a: '', b: _$_.UNINITIALIZED, _a: pattern_1, _b: p });
206
+ _$_.render(render_5, { a: '', b: _$_.UNINITIALIZED, _a: pattern_1, _b: p });
194
207
  _$_.append(__anchor, p);
195
208
  },
196
209
  null,
@@ -209,7 +222,7 @@ function switch_case_default_1(__anchor, { a: mode, b: pattern_1 }) {
209
222
  (__anchor) => {
210
223
  var p_2 = root_10();
211
224
 
212
- _$_.render(render_5, { a: '', b: _$_.UNINITIALIZED, _a: pattern_1, _b: p_2 });
225
+ _$_.render(render_6, { a: '', b: _$_.UNINITIALIZED, _a: pattern_1, _b: p_2 });
213
226
  _$_.append(__anchor, p_2);
214
227
  },
215
228
  null,
@@ -232,7 +245,7 @@ function switch_2({ a: mode, b: pattern_1 }) {
232
245
  }
233
246
  }
234
247
 
235
- var root_7 = _$_.template(`<div class=mixed-reactive-list>`);
248
+ var root_7 = _$_.template_el('div', ['class', 'mixed-reactive-list']);
236
249
 
237
250
  function consequent_1(__anchor, { a: show, b: items, c: mode }) {
238
251
  var div_4 = root_7();
@@ -259,6 +272,15 @@ function if_2({ a: show, b: items, c: mode }) {
259
272
  }
260
273
 
261
274
  var root_6 = _$_.template(`<button class=toggle-show>Toggle Show</button><button class=toggle-mode>Toggle Mode</button><button class=add-item>Add Item</button><!>`, 1, 4);
275
+
276
+ function render_7(__prev) {
277
+ var __a = if_2({ a: __prev._a, b: __prev._b, c: __prev._c });
278
+
279
+ if (__prev.a !== __a) {
280
+ _$_.if_update(__prev._d, __prev.a = __a);
281
+ }
282
+ }
283
+
262
284
  var root_5 = _$_.template(`<!>`, 1, 1);
263
285
 
264
286
  function MixedControlFlowReactive_render(__anchor, __block) {
@@ -289,8 +311,16 @@ function MixedControlFlowReactive_render(__anchor, __block) {
289
311
  };
290
312
 
291
313
  var node = _$_.hydrating ? _$_.hydrate_sibling() : button_2.nextSibling;
314
+ var ifs_1 = _$_.if_static(node, if_2, 0, { a: show, b: items, c: mode });
315
+
316
+ _$_.render(render_7, {
317
+ a: _$_.UNINITIALIZED,
318
+ _a: show,
319
+ _b: items,
320
+ _c: mode,
321
+ _d: ifs_1
322
+ });
292
323
 
293
- _$_.if(node, if_2, false, { a: show, b: items, c: mode });
294
324
  _$_.append(__anchor, fragment_1);
295
325
  }));
296
326
 
@@ -299,8 +329,8 @@ function MixedControlFlowReactive_render(__anchor, __block) {
299
329
 
300
330
  MixedControlFlowReactive[_$_.$r] = MixedControlFlowReactive_render;
301
331
 
302
- var root_14 = _$_.template(`<div>`);
303
- var root_15 = _$_.template(`<div class=unexpected>unexpected`);
332
+ var root_14 = _$_.template_el('div');
333
+ var root_15 = _$_.template_el('div', ['class', 'unexpected'], 'unexpected');
304
334
 
305
335
  function switch_case_0_2(__anchor, { a: state, b: row }) {
306
336
  _$_.try(
@@ -379,7 +409,7 @@ function MixedControlFlowAsyncPending_render(__anchor, __block) {
379
409
 
380
410
  MixedControlFlowAsyncPending[_$_.$r] = MixedControlFlowAsyncPending_render;
381
411
 
382
- var root_16 = _$_.template(`<div class=resolved-row> `);
412
+ var root_16 = _$_.template_el('div', ['class', 'resolved-row'], ' ');
383
413
 
384
414
  function AsyncRow_render(__anchor, __block, { label }) {
385
415
  const value = _$_.track_async(() => _$_.with_scope(__block, () => Promise.resolve(label)), __block, '4nsq00');