ripple 0.3.71 → 0.3.72
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 +9 -0
- package/package.json +3 -3
- package/tests/client/basic/basic.collections.test.tsrx +7 -13
- package/tests/client/basic/basic.components.test.tsrx +1 -5
- package/tests/client/basic/basic.errors.test.tsrx +2 -2
- package/tests/client/compiler/compiler.basic.test.tsrx +9 -10
- package/tests/client/tsx.test.tsrx +74 -149
- package/tests/hydration/compiled/client/basic.js +14 -14
- package/tests/hydration/components/basic.tsrx +26 -54
- package/tests/server/basic.attributes.test.tsrx +3 -5
- package/tests/server/basic.components.test.tsrx +1 -5
- package/tests/server/basic.test.tsrx +15 -37
- package/tests/server/compiler.test.tsrx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# ripple
|
|
2
2
|
|
|
3
|
+
## 0.3.72
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
[[`0ea87fb`](https://github.com/Ripple-TS/ripple/commit/0ea87fb3cbef21c3c00d63cc2a1f3c9f34d01c24)]:
|
|
9
|
+
- @tsrx/core@0.1.20
|
|
10
|
+
- @tsrx/ripple@0.1.20
|
|
11
|
+
|
|
3
12
|
## 0.3.71
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ripple is an elegant TypeScript UI framework",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.72",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "src/runtime/index-client.js",
|
|
9
9
|
"main": "src/runtime/index-client.js",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"clsx": "^2.1.1",
|
|
75
75
|
"devalue": "^5.8.1",
|
|
76
76
|
"esm-env": "^1.2.2",
|
|
77
|
-
"@tsrx/core": "0.1.
|
|
78
|
-
"@tsrx/ripple": "0.1.
|
|
77
|
+
"@tsrx/core": "0.1.20",
|
|
78
|
+
"@tsrx/ripple": "0.1.20"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@types/estree": "^1.0.8",
|
|
@@ -125,23 +125,19 @@ describe('basic client > collections', () => {
|
|
|
125
125
|
return <>
|
|
126
126
|
let &[primary] = track(true);
|
|
127
127
|
<div class="frame">
|
|
128
|
-
{
|
|
128
|
+
{<>
|
|
129
129
|
{primary
|
|
130
130
|
? [
|
|
131
131
|
'first:',
|
|
132
|
-
<strong class="middle">
|
|
133
|
-
{'one'}
|
|
134
|
-
</strong>,
|
|
132
|
+
<strong class="middle">{'one'}</strong>,
|
|
135
133
|
':tail',
|
|
136
134
|
]
|
|
137
135
|
: [
|
|
138
136
|
'second:',
|
|
139
|
-
<strong class="middle">
|
|
140
|
-
{'two'}
|
|
141
|
-
</strong>,
|
|
137
|
+
<strong class="middle">{'two'}</strong>,
|
|
142
138
|
':done',
|
|
143
139
|
]}
|
|
144
|
-
|
|
140
|
+
</>}
|
|
145
141
|
</div>
|
|
146
142
|
<button
|
|
147
143
|
onClick={() => {
|
|
@@ -181,16 +177,14 @@ describe('basic client > collections', () => {
|
|
|
181
177
|
function App() {
|
|
182
178
|
return <>
|
|
183
179
|
<div class="frame">
|
|
184
|
-
{
|
|
180
|
+
{<>
|
|
185
181
|
{[
|
|
186
182
|
'start:',
|
|
187
183
|
['one', 2, true, null, false],
|
|
188
|
-
<strong>
|
|
189
|
-
{'!'}
|
|
190
|
-
</strong>,
|
|
184
|
+
<strong>{'!'}</strong>,
|
|
191
185
|
':end',
|
|
192
186
|
]}
|
|
193
|
-
|
|
187
|
+
</>}
|
|
194
188
|
</div>
|
|
195
189
|
</>;
|
|
196
190
|
}
|
|
@@ -174,11 +174,7 @@ describe('basic client > components & composition', () => {
|
|
|
174
174
|
|
|
175
175
|
it('allows a compat-only function as a component type', () => {
|
|
176
176
|
function CompatOnly() {
|
|
177
|
-
return
|
|
178
|
-
<div>
|
|
179
|
-
{'compat'}
|
|
180
|
-
</div>
|
|
181
|
-
</tsx>;
|
|
177
|
+
return <><div>{'compat'}</div></>;
|
|
182
178
|
}
|
|
183
179
|
|
|
184
180
|
function App() {
|
|
@@ -228,7 +228,7 @@ describe('basic client > errors', () => {
|
|
|
228
228
|
}).toThrow('Do...while loops are not supported in TSRX templates.');
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
-
it('should allow JSX fragments in TSRX templates as
|
|
231
|
+
it('should allow JSX fragments in TSRX templates as <> shorthand', () => {
|
|
232
232
|
const code = `
|
|
233
233
|
export default function SafeProfile() { return <>
|
|
234
234
|
<b><>{111}</></b>
|
|
@@ -243,7 +243,7 @@ describe('basic client > errors', () => {
|
|
|
243
243
|
it('should allow JSX fragments inside tsx blocks', () => {
|
|
244
244
|
const code = `
|
|
245
245
|
export default function SafeProfile() { return <>
|
|
246
|
-
|
|
246
|
+
<><>{111}</></>
|
|
247
247
|
</>; }
|
|
248
248
|
`;
|
|
249
249
|
|
|
@@ -119,7 +119,7 @@ describe('compiler > basics', () => {
|
|
|
119
119
|
const declaration = (ast.body[0] as AST.VariableDeclaration).declarations[0];
|
|
120
120
|
const fragment = get_returned_tsrx(declaration).children[0] as any;
|
|
121
121
|
|
|
122
|
-
expect(fragment.type).toBe('
|
|
122
|
+
expect(fragment.type).toBe('TsrxFragment');
|
|
123
123
|
expect(fragment.children[0].type).toBe('ExpressionStatement');
|
|
124
124
|
expect(fragment.children[0].expression.type).toBe('TemplateLiteral');
|
|
125
125
|
expect(fragment.children[0].expression.quasis[0].value.raw).toBe('333');
|
|
@@ -140,7 +140,7 @@ describe('compiler > basics', () => {
|
|
|
140
140
|
const declaration = (ast.body[0] as AST.VariableDeclaration).declarations[0];
|
|
141
141
|
const fragment = get_returned_tsrx(declaration).children[0] as any;
|
|
142
142
|
|
|
143
|
-
expect(fragment.type).toBe('
|
|
143
|
+
expect(fragment.type).toBe('TsrxFragment');
|
|
144
144
|
expect(fragment.children.map((child: any) => child.type)).toEqual([
|
|
145
145
|
'ExpressionStatement',
|
|
146
146
|
]);
|
|
@@ -379,7 +379,7 @@ const Inline = function(props) { return <>
|
|
|
379
379
|
function App() { return <>
|
|
380
380
|
function make(flag) {
|
|
381
381
|
if (flag) {
|
|
382
|
-
return
|
|
382
|
+
return <><span>{'nested'}</span></>;
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
return null;
|
|
@@ -506,11 +506,11 @@ function App() { return <>
|
|
|
506
506
|
it('lowers native expression values in to_ts output', () => {
|
|
507
507
|
const source = `
|
|
508
508
|
function App() { return <>
|
|
509
|
-
const nested =
|
|
509
|
+
const nested = <>
|
|
510
510
|
<span class="nested-tsx">
|
|
511
511
|
{'inside nested tsx'}
|
|
512
512
|
</span>
|
|
513
|
-
|
|
513
|
+
</>;
|
|
514
514
|
const content = <div class="native">{nested}</div>;
|
|
515
515
|
|
|
516
516
|
{content}
|
|
@@ -518,9 +518,8 @@ function App() { return <>
|
|
|
518
518
|
`;
|
|
519
519
|
const result = compile_to_volar_mappings(source, 'test.tsrx').code;
|
|
520
520
|
|
|
521
|
-
expect(result).
|
|
522
|
-
expect(result).
|
|
523
|
-
expect(result).toContain('const nested = <>');
|
|
521
|
+
expect(result).toContain('const nested = <span class="nested-tsx">');
|
|
522
|
+
expect(result).toContain('return <>{children}</>;');
|
|
524
523
|
expect(result).toContain('const content = <div class="native">');
|
|
525
524
|
});
|
|
526
525
|
|
|
@@ -557,11 +556,11 @@ function App() { return <>
|
|
|
557
556
|
it('maps identifiers from native expression values in to_ts output', () => {
|
|
558
557
|
const source = `
|
|
559
558
|
function App() { return <>
|
|
560
|
-
const nested =
|
|
559
|
+
const nested = <>
|
|
561
560
|
<span class="nested-tsx">
|
|
562
561
|
{'inside nested tsx'}
|
|
563
562
|
</span>
|
|
564
|
-
|
|
563
|
+
</>;
|
|
565
564
|
const content = <div class="native">{nested}</div>;
|
|
566
565
|
|
|
567
566
|
{content}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { flushSync, track } from 'ripple';
|
|
2
2
|
|
|
3
3
|
describe('tsx expression', () => {
|
|
4
|
-
it('renders an empty
|
|
4
|
+
it('renders an empty <></> element', () => {
|
|
5
5
|
function App() {
|
|
6
6
|
return <>
|
|
7
|
-
|
|
7
|
+
<></>
|
|
8
8
|
</>;
|
|
9
9
|
}
|
|
10
10
|
render(App);
|
|
@@ -21,10 +21,10 @@ describe('tsx expression', () => {
|
|
|
21
21
|
expect(container.textContent).toBe('');
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
it('renders an empty
|
|
24
|
+
it('renders an empty <></> assigned to a variable', () => {
|
|
25
25
|
function App() {
|
|
26
26
|
return <>
|
|
27
|
-
const el =
|
|
27
|
+
const el = <></>;
|
|
28
28
|
{el}
|
|
29
29
|
</>;
|
|
30
30
|
}
|
|
@@ -46,9 +46,7 @@ describe('tsx expression', () => {
|
|
|
46
46
|
it('renders a basic fragment shorthand element', () => {
|
|
47
47
|
function App() {
|
|
48
48
|
return <>
|
|
49
|
-
const el =
|
|
50
|
-
<div>hello world</div>
|
|
51
|
-
</tsx>;
|
|
49
|
+
const el = <><div>"hello world"</div></>;
|
|
52
50
|
{el}
|
|
53
51
|
</>;
|
|
54
52
|
}
|
|
@@ -60,13 +58,11 @@ describe('tsx expression', () => {
|
|
|
60
58
|
it('applies scoped classes inside tsx blocks and fragment shorthand', () => {
|
|
61
59
|
function App() {
|
|
62
60
|
return <>
|
|
63
|
-
|
|
61
|
+
<>
|
|
64
62
|
<div class="card">
|
|
65
|
-
<h2>
|
|
66
|
-
{'tsx block'}
|
|
67
|
-
</h2>
|
|
63
|
+
<h2>{'tsx block'}</h2>
|
|
68
64
|
</div>
|
|
69
|
-
|
|
65
|
+
</>
|
|
70
66
|
<>
|
|
71
67
|
<div class="card">
|
|
72
68
|
<h2>{'fragment shorthand'}</h2>
|
|
@@ -108,9 +104,7 @@ describe('tsx expression', () => {
|
|
|
108
104
|
it('renders a tsx element assigned to a variable', () => {
|
|
109
105
|
function App() {
|
|
110
106
|
return <>
|
|
111
|
-
const el =
|
|
112
|
-
<span class="test">content</span>
|
|
113
|
-
</tsx>;
|
|
107
|
+
const el = <><span class="test">"content"</span></>;
|
|
114
108
|
{el}
|
|
115
109
|
</>;
|
|
116
110
|
}
|
|
@@ -123,10 +117,10 @@ describe('tsx expression', () => {
|
|
|
123
117
|
it('renders a tsx element with multiple children', () => {
|
|
124
118
|
function App() {
|
|
125
119
|
return <>
|
|
126
|
-
const el =
|
|
127
|
-
<div>first</div>
|
|
128
|
-
<div>second</div>
|
|
129
|
-
|
|
120
|
+
const el = <>
|
|
121
|
+
<div>"first"</div>
|
|
122
|
+
<div>"second"</div>
|
|
123
|
+
</>;
|
|
130
124
|
{el}
|
|
131
125
|
</>;
|
|
132
126
|
}
|
|
@@ -140,11 +134,11 @@ describe('tsx expression', () => {
|
|
|
140
134
|
it('renders a tsx element with nested elements', () => {
|
|
141
135
|
function App() {
|
|
142
136
|
return <>
|
|
143
|
-
const el =
|
|
137
|
+
const el = <>
|
|
144
138
|
<div class="outer">
|
|
145
|
-
<span class="inner">nested</span>
|
|
139
|
+
<span class="inner">"nested"</span>
|
|
146
140
|
</div>
|
|
147
|
-
|
|
141
|
+
</>;
|
|
148
142
|
{el}
|
|
149
143
|
</>;
|
|
150
144
|
}
|
|
@@ -159,9 +153,7 @@ describe('tsx expression', () => {
|
|
|
159
153
|
it('renders a tsx element inline in a parent element', () => {
|
|
160
154
|
function App() {
|
|
161
155
|
return <>
|
|
162
|
-
const el =
|
|
163
|
-
<span>inline</span>
|
|
164
|
-
</tsx>;
|
|
156
|
+
const el = <><span>"inline"</span></>;
|
|
165
157
|
<div class="parent">{el}</div>
|
|
166
158
|
</>;
|
|
167
159
|
}
|
|
@@ -176,11 +168,11 @@ describe('tsx expression', () => {
|
|
|
176
168
|
function App() {
|
|
177
169
|
return <>
|
|
178
170
|
let &[count] = track(0);
|
|
179
|
-
const el =
|
|
171
|
+
const el = <>
|
|
180
172
|
<div>
|
|
181
173
|
{'count: ' + count}
|
|
182
174
|
</div>
|
|
183
|
-
|
|
175
|
+
</>;
|
|
184
176
|
{el}
|
|
185
177
|
<button onClick={() => count++}>{'increment'}</button>
|
|
186
178
|
</>;
|
|
@@ -197,9 +189,7 @@ describe('tsx expression', () => {
|
|
|
197
189
|
function App() {
|
|
198
190
|
return <>
|
|
199
191
|
let &[show] = track(true);
|
|
200
|
-
const el =
|
|
201
|
-
<div class="tsx-content">visible</div>
|
|
202
|
-
</tsx>;
|
|
192
|
+
const el = <><div class="tsx-content">"visible"</div></>;
|
|
203
193
|
if (show) {
|
|
204
194
|
{el}
|
|
205
195
|
}
|
|
@@ -219,15 +209,13 @@ describe('tsx expression', () => {
|
|
|
219
209
|
});
|
|
220
210
|
|
|
221
211
|
it('renders tsx element passed as children prop', () => {
|
|
222
|
-
function Child(&{ children }
|
|
212
|
+
function Child(&{ children }) {
|
|
223
213
|
return <><div class="wrapper">{children}</div></>;
|
|
224
214
|
}
|
|
225
215
|
|
|
226
216
|
function App() {
|
|
227
217
|
return <>
|
|
228
|
-
const el =
|
|
229
|
-
<span>from tsx</span>
|
|
230
|
-
</tsx>;
|
|
218
|
+
const el = <><span>"from tsx"</span></>;
|
|
231
219
|
<Child children={el} />
|
|
232
220
|
</>;
|
|
233
221
|
}
|
|
@@ -241,9 +229,7 @@ describe('tsx expression', () => {
|
|
|
241
229
|
it('renders tsx element with text content only', () => {
|
|
242
230
|
function App() {
|
|
243
231
|
return <>
|
|
244
|
-
const el =
|
|
245
|
-
just text
|
|
246
|
-
</tsx>;
|
|
232
|
+
const el = <>"just text"</>;
|
|
247
233
|
{el}
|
|
248
234
|
</>;
|
|
249
235
|
}
|
|
@@ -255,9 +241,9 @@ describe('tsx expression', () => {
|
|
|
255
241
|
it('renders tsx element with static attributes', () => {
|
|
256
242
|
function App() {
|
|
257
243
|
return <>
|
|
258
|
-
const el =
|
|
259
|
-
<div id="my-id" class="my-class" data-testid="test" aria-label="label">content</div>
|
|
260
|
-
|
|
244
|
+
const el = <>
|
|
245
|
+
<div id="my-id" class="my-class" data-testid="test" aria-label="label">"content"</div>
|
|
246
|
+
</>;
|
|
261
247
|
{el}
|
|
262
248
|
</>;
|
|
263
249
|
}
|
|
@@ -274,9 +260,7 @@ describe('tsx expression', () => {
|
|
|
274
260
|
function App() {
|
|
275
261
|
return <>
|
|
276
262
|
let &[name] = track('initial');
|
|
277
|
-
const el =
|
|
278
|
-
<div id={name} class={'cls-' + name}>content</div>
|
|
279
|
-
</tsx>;
|
|
263
|
+
const el = <><div id={name} class={'cls-' + name}>"content"</div></>;
|
|
280
264
|
{el}
|
|
281
265
|
<button onClick={() => (name = 'updated')}>{'update'}</button>
|
|
282
266
|
</>;
|
|
@@ -297,11 +281,7 @@ describe('tsx expression', () => {
|
|
|
297
281
|
function App() {
|
|
298
282
|
return <>
|
|
299
283
|
let &[clicked] = track(false);
|
|
300
|
-
const el =
|
|
301
|
-
<button onClick={() => (clicked = true)}>
|
|
302
|
-
{'click me'}
|
|
303
|
-
</button>
|
|
304
|
-
</tsx>;
|
|
284
|
+
const el = <><button onClick={() => (clicked = true)}>{'click me'}</button></>;
|
|
305
285
|
{el}
|
|
306
286
|
<div class="status">{clicked ? 'clicked' : 'not clicked'}</div>
|
|
307
287
|
</>;
|
|
@@ -319,11 +299,7 @@ describe('tsx expression', () => {
|
|
|
319
299
|
function App() {
|
|
320
300
|
return <>
|
|
321
301
|
let &[isDisabled] = track(true);
|
|
322
|
-
const el =
|
|
323
|
-
<button disabled={isDisabled}>
|
|
324
|
-
{'btn'}
|
|
325
|
-
</button>
|
|
326
|
-
</tsx>;
|
|
302
|
+
const el = <><button disabled={isDisabled}>{'btn'}</button></>;
|
|
327
303
|
{el}
|
|
328
304
|
<button class="toggle" onClick={() => (isDisabled = !isDisabled)}>{'toggle'}</button>
|
|
329
305
|
</>;
|
|
@@ -341,9 +317,7 @@ describe('tsx expression', () => {
|
|
|
341
317
|
function App() {
|
|
342
318
|
return <>
|
|
343
319
|
let &[color] = track('red');
|
|
344
|
-
const el =
|
|
345
|
-
<div style={'color: ' + color}>styled</div>
|
|
346
|
-
</tsx>;
|
|
320
|
+
const el = <><div style={'color: ' + color}>"styled"</div></>;
|
|
347
321
|
{el}
|
|
348
322
|
<button onClick={() => (color = 'blue')}>{'change color'}</button>
|
|
349
323
|
</>;
|
|
@@ -361,7 +335,7 @@ describe('tsx expression', () => {
|
|
|
361
335
|
function App() {
|
|
362
336
|
return <>
|
|
363
337
|
let &[index] = track(0);
|
|
364
|
-
const el =
|
|
338
|
+
const el = <>
|
|
365
339
|
<div
|
|
366
340
|
id={'item-' + index}
|
|
367
341
|
class={'item pos-' + index}
|
|
@@ -370,7 +344,7 @@ describe('tsx expression', () => {
|
|
|
370
344
|
>
|
|
371
345
|
{'Item ' + index}
|
|
372
346
|
</div>
|
|
373
|
-
|
|
347
|
+
</>;
|
|
374
348
|
{el}
|
|
375
349
|
<button onClick={() => index++}>{'next'}</button>
|
|
376
350
|
</>;
|
|
@@ -392,18 +366,12 @@ describe('tsx expression', () => {
|
|
|
392
366
|
});
|
|
393
367
|
|
|
394
368
|
it('renders fragment shorthand passed directly as component prop', () => {
|
|
395
|
-
function Wrapper(&{ content }
|
|
369
|
+
function Wrapper(&{ content }) {
|
|
396
370
|
return <><div class="wrapper">{content}</div></>;
|
|
397
371
|
}
|
|
398
372
|
|
|
399
373
|
function App() {
|
|
400
|
-
return
|
|
401
|
-
<Wrapper
|
|
402
|
-
content={<tsx>
|
|
403
|
-
<span class="inner">direct prop</span>
|
|
404
|
-
</tsx>}
|
|
405
|
-
/>
|
|
406
|
-
</>;
|
|
374
|
+
return <><Wrapper content={<><span class="inner">"direct prop"</span></>} /></>;
|
|
407
375
|
}
|
|
408
376
|
|
|
409
377
|
render(App);
|
|
@@ -414,7 +382,7 @@ describe('tsx expression', () => {
|
|
|
414
382
|
});
|
|
415
383
|
|
|
416
384
|
it('renders fragment shorthand passed directly as children prop', () => {
|
|
417
|
-
function Card(&{ title, children }
|
|
385
|
+
function Card(&{ title, children }) {
|
|
418
386
|
return <>
|
|
419
387
|
<div class="card">
|
|
420
388
|
<h2 class="card-title">{title}</h2>
|
|
@@ -426,12 +394,8 @@ describe('tsx expression', () => {
|
|
|
426
394
|
function App() {
|
|
427
395
|
return <>
|
|
428
396
|
<Card
|
|
429
|
-
title={
|
|
430
|
-
|
|
431
|
-
</tsx>}
|
|
432
|
-
children={<tsx>
|
|
433
|
-
<p>Card content here</p>
|
|
434
|
-
</tsx>}
|
|
397
|
+
title={<><span class="bold">"Title"</span></>}
|
|
398
|
+
children={<><p>"Card content here"</p></>}
|
|
435
399
|
/>
|
|
436
400
|
</>;
|
|
437
401
|
}
|
|
@@ -443,10 +407,8 @@ describe('tsx expression', () => {
|
|
|
443
407
|
});
|
|
444
408
|
|
|
445
409
|
it('renders tsx from function defined outside component', () => {
|
|
446
|
-
function createBadge(label
|
|
447
|
-
return
|
|
448
|
-
<span class="badge">{label}</span>
|
|
449
|
-
</tsx>;
|
|
410
|
+
function createBadge(label) {
|
|
411
|
+
return <><span class="badge">{label}</span></>;
|
|
450
412
|
}
|
|
451
413
|
|
|
452
414
|
function App() {
|
|
@@ -462,10 +424,8 @@ describe('tsx expression', () => {
|
|
|
462
424
|
});
|
|
463
425
|
|
|
464
426
|
it('renders tsx from function with multiple elements', () => {
|
|
465
|
-
function createListItem(item
|
|
466
|
-
return
|
|
467
|
-
<li class="list-item">{item}</li>
|
|
468
|
-
</tsx>;
|
|
427
|
+
function createListItem(item) {
|
|
428
|
+
return <><li class="list-item">{item}</li></>;
|
|
469
429
|
}
|
|
470
430
|
|
|
471
431
|
function App() {
|
|
@@ -488,7 +448,7 @@ describe('tsx expression', () => {
|
|
|
488
448
|
});
|
|
489
449
|
|
|
490
450
|
it('renders tsx from factory function passed to component', () => {
|
|
491
|
-
function List(&{ renderItem, items }
|
|
451
|
+
function List(&{ renderItem, items }) {
|
|
492
452
|
return <>
|
|
493
453
|
<ul class="list">
|
|
494
454
|
for (const item of items) {
|
|
@@ -498,12 +458,12 @@ describe('tsx expression', () => {
|
|
|
498
458
|
</>;
|
|
499
459
|
}
|
|
500
460
|
|
|
501
|
-
function itemRenderer(item
|
|
502
|
-
return
|
|
461
|
+
function itemRenderer(item) {
|
|
462
|
+
return <>
|
|
503
463
|
<li>
|
|
504
464
|
<span class="item-content">{item}</span>
|
|
505
465
|
</li>
|
|
506
|
-
|
|
466
|
+
</>;
|
|
507
467
|
}
|
|
508
468
|
|
|
509
469
|
function App() {
|
|
@@ -519,15 +479,15 @@ describe('tsx expression', () => {
|
|
|
519
479
|
});
|
|
520
480
|
|
|
521
481
|
it('renders tsx from function with reactive state', () => {
|
|
522
|
-
function createCounter(label
|
|
523
|
-
return
|
|
482
|
+
function createCounter(label, getCount) {
|
|
483
|
+
return <>
|
|
524
484
|
<div class="counter-display">
|
|
525
485
|
<span class="label">{label}</span>
|
|
526
486
|
<span class="count">
|
|
527
487
|
{getCount()}
|
|
528
488
|
</span>
|
|
529
489
|
</div>
|
|
530
|
-
|
|
490
|
+
</>;
|
|
531
491
|
}
|
|
532
492
|
|
|
533
493
|
function App() {
|
|
@@ -549,19 +509,17 @@ describe('tsx expression', () => {
|
|
|
549
509
|
});
|
|
550
510
|
|
|
551
511
|
it('renders nested tsx from multiple functions', () => {
|
|
552
|
-
function createIcon(name
|
|
553
|
-
return
|
|
554
|
-
<i class={'icon icon-' + name}></i>
|
|
555
|
-
</tsx>;
|
|
512
|
+
function createIcon(name) {
|
|
513
|
+
return <><i class={'icon icon-' + name} /></>;
|
|
556
514
|
}
|
|
557
515
|
|
|
558
|
-
function createButton(icon
|
|
559
|
-
return
|
|
516
|
+
function createButton(icon, label) {
|
|
517
|
+
return <>
|
|
560
518
|
<button class="icon-button">
|
|
561
519
|
{createIcon(icon)}
|
|
562
520
|
<span class="btn-label">{label}</span>
|
|
563
521
|
</button>
|
|
564
|
-
|
|
522
|
+
</>;
|
|
565
523
|
}
|
|
566
524
|
|
|
567
525
|
function App() {
|
|
@@ -579,29 +537,21 @@ describe('tsx expression', () => {
|
|
|
579
537
|
});
|
|
580
538
|
|
|
581
539
|
it('renders deeply nested tsx and tsrx expression values', () => {
|
|
582
|
-
function HelperItem({ item }
|
|
540
|
+
function HelperItem({ item }) {
|
|
583
541
|
return <><div class="helper-item">{item}</div></>;
|
|
584
542
|
}
|
|
585
543
|
|
|
586
|
-
function MakeFragment({ label }
|
|
544
|
+
function MakeFragment({ label }) {
|
|
587
545
|
return <>
|
|
588
546
|
<span class="label">{label}</span>
|
|
589
|
-
const test =
|
|
590
|
-
{[1, 2, 3, 4].map(
|
|
591
|
-
(item) => <tsx>
|
|
592
|
-
<HelperItem item={item} />
|
|
593
|
-
</tsx>,
|
|
594
|
-
)}
|
|
595
|
-
</tsx>;
|
|
547
|
+
const test = <>{[1, 2, 3, 4].map((item) => <><HelperItem {item} /></>)}</>;
|
|
596
548
|
{test}
|
|
597
549
|
</>;
|
|
598
550
|
}
|
|
599
551
|
|
|
600
552
|
function App() {
|
|
601
553
|
return <>
|
|
602
|
-
{<
|
|
603
|
-
{[1, 2, 3].map((item) => <div class="app-item">{item}</div>)}
|
|
604
|
-
</tsx>}
|
|
554
|
+
{<>{[1, 2, 3].map((item) => <div class="app-item">{item}</div>)}</>}
|
|
605
555
|
<MakeFragment label="from helper" />
|
|
606
556
|
</>;
|
|
607
557
|
}
|
|
@@ -624,15 +574,11 @@ describe('tsx expression', () => {
|
|
|
624
574
|
it('renders tsrx nested directly inside a top-level tsx expression value', () => {
|
|
625
575
|
function App() {
|
|
626
576
|
return <>
|
|
627
|
-
const content =
|
|
577
|
+
const content = <>
|
|
628
578
|
<section class="outer">
|
|
629
|
-
{
|
|
630
|
-
<div class="inner">
|
|
631
|
-
{'from tsrx'}
|
|
632
|
-
</div>
|
|
633
|
-
</>}
|
|
579
|
+
{<><div class="inner">{'from tsrx'}</div></>}
|
|
634
580
|
</section>
|
|
635
|
-
|
|
581
|
+
</>;
|
|
636
582
|
{content}
|
|
637
583
|
</>;
|
|
638
584
|
}
|
|
@@ -647,17 +593,15 @@ describe('tsx expression', () => {
|
|
|
647
593
|
it('renders nested elements from tsrx inside a top-level tsx value', () => {
|
|
648
594
|
function App() {
|
|
649
595
|
return <>
|
|
650
|
-
const content =
|
|
596
|
+
const content = <>
|
|
651
597
|
<div class="wrapper">
|
|
652
598
|
{<>
|
|
653
599
|
<section class="native">
|
|
654
|
-
<span class="nested-tsrx">
|
|
655
|
-
{'inside nested tsrx'}
|
|
656
|
-
</span>
|
|
600
|
+
<span class="nested-tsrx">{'inside nested tsrx'}</span>
|
|
657
601
|
</section>
|
|
658
602
|
</>}
|
|
659
603
|
</div>
|
|
660
|
-
|
|
604
|
+
</>;
|
|
661
605
|
{content}
|
|
662
606
|
</>;
|
|
663
607
|
}
|
|
@@ -672,14 +616,8 @@ describe('tsx expression', () => {
|
|
|
672
616
|
it('renders tsx declared before a top-level tsx value', () => {
|
|
673
617
|
function App() {
|
|
674
618
|
return <>
|
|
675
|
-
const nested =
|
|
676
|
-
|
|
677
|
-
{'inside nested tsx'}
|
|
678
|
-
</span>
|
|
679
|
-
</tsx>;
|
|
680
|
-
const content = <tsx>
|
|
681
|
-
<div class="native">{nested}</div>
|
|
682
|
-
</tsx>;
|
|
619
|
+
const nested = <><span class="nested-tsx">{'inside nested tsx'}</span></>;
|
|
620
|
+
const content = <><div class="native">{nested}</div></>;
|
|
683
621
|
{content}
|
|
684
622
|
</>;
|
|
685
623
|
}
|
|
@@ -692,7 +630,7 @@ describe('tsx expression', () => {
|
|
|
692
630
|
});
|
|
693
631
|
|
|
694
632
|
it('renders tsx as prop with fallback in component', () => {
|
|
695
|
-
function Alert(&{ icon, message }
|
|
633
|
+
function Alert(&{ icon, message }) {
|
|
696
634
|
return <>
|
|
697
635
|
<div class="alert">
|
|
698
636
|
{icon}
|
|
@@ -704,12 +642,7 @@ describe('tsx expression', () => {
|
|
|
704
642
|
function App() {
|
|
705
643
|
return <>
|
|
706
644
|
<Alert message="No icon" />
|
|
707
|
-
<Alert
|
|
708
|
-
icon={<tsx>
|
|
709
|
-
<span class="custom-icon">✓</span>
|
|
710
|
-
</tsx>}
|
|
711
|
-
message="Custom icon"
|
|
712
|
-
/>
|
|
645
|
+
<Alert icon={<><span class="custom-icon">"✓"</span></>} message="Custom icon" />
|
|
713
646
|
</>;
|
|
714
647
|
}
|
|
715
648
|
|
|
@@ -721,10 +654,8 @@ describe('tsx expression', () => {
|
|
|
721
654
|
});
|
|
722
655
|
|
|
723
656
|
it('renders tsx stored in array via function', () => {
|
|
724
|
-
function createItem(className
|
|
725
|
-
return
|
|
726
|
-
<div class={className}>{content}</div>
|
|
727
|
-
</tsx>;
|
|
657
|
+
function createItem(className, content) {
|
|
658
|
+
return <><div class={className}>{content}</div></>;
|
|
728
659
|
}
|
|
729
660
|
|
|
730
661
|
function App() {
|
|
@@ -750,19 +681,13 @@ describe('tsx expression', () => {
|
|
|
750
681
|
});
|
|
751
682
|
|
|
752
683
|
it('renders tsx conditionally from function', () => {
|
|
753
|
-
function createContent(type
|
|
684
|
+
function createContent(type) {
|
|
754
685
|
if (type === 'success') {
|
|
755
|
-
return
|
|
756
|
-
<div class="success">Success!</div>
|
|
757
|
-
</tsx>;
|
|
686
|
+
return <><div class="success">"Success!"</div></>;
|
|
758
687
|
} else if (type === 'error') {
|
|
759
|
-
return
|
|
760
|
-
<div class="error">Error!</div>
|
|
761
|
-
</tsx>;
|
|
688
|
+
return <><div class="error">"Error!"</div></>;
|
|
762
689
|
}
|
|
763
|
-
return
|
|
764
|
-
<div class="default">Default</div>
|
|
765
|
-
</tsx>;
|
|
690
|
+
return <><div class="default">"Default"</div></>;
|
|
766
691
|
}
|
|
767
692
|
|
|
768
693
|
function App() {
|
|
@@ -857,7 +782,7 @@ describe('tsrx expression', () => {
|
|
|
857
782
|
});
|
|
858
783
|
|
|
859
784
|
it('renders fragments returned from component functions outside components', () => {
|
|
860
|
-
function MakeFragment({ label }
|
|
785
|
+
function MakeFragment({ label }) {
|
|
861
786
|
return <><span>{label}</span></>;
|
|
862
787
|
}
|
|
863
788
|
|
|
@@ -41,10 +41,10 @@ var root_36 = _$_.template(`<div class="dynamic-array-track"> </div>`, 0);
|
|
|
41
41
|
var root_37 = _$_.template(`<div class="dynamic-array-conditional"> </div>`, 0);
|
|
42
42
|
var root_38 = _$_.template(`<div class="dynamic-array-logical"> </div>`, 0);
|
|
43
43
|
var root_40 = _$_.template(`<div class="inner">from tsrx</div>`, 0);
|
|
44
|
-
var root_39 = _$_.template(`<section class="outer"
|
|
44
|
+
var root_39 = _$_.template(`<section class="outer"><!></section>`, 0);
|
|
45
45
|
var root_41 = _$_.template(`<!>`, 1, 1);
|
|
46
46
|
var root_43 = _$_.template(`<section class="native"><span class="nested-tsrx">inside nested tsrx</span></section>`, 0);
|
|
47
|
-
var root_42 = _$_.template(`<div class="wrapper"
|
|
47
|
+
var root_42 = _$_.template(`<div class="wrapper"><!></div>`, 0);
|
|
48
48
|
var root_44 = _$_.template(`<!>`, 1, 1);
|
|
49
49
|
var root_45 = _$_.template(`<span class="nested-tsx">inside nested tsx</span>`, 0);
|
|
50
50
|
var root_46 = _$_.template(`<div class="native"><!></div>`, 0);
|
|
@@ -295,17 +295,17 @@ export function MixedTsrxCollectionText() {
|
|
|
295
295
|
_$_.expression(expression_6, () => [
|
|
296
296
|
'alpha ',
|
|
297
297
|
_$_.tsrx_element((__anchor, __block) => {
|
|
298
|
-
var
|
|
298
|
+
var strong_1 = root_17();
|
|
299
299
|
|
|
300
|
-
_$_.append(__anchor,
|
|
300
|
+
_$_.append(__anchor, strong_1);
|
|
301
301
|
}),
|
|
302
302
|
' gamma ',
|
|
303
303
|
[
|
|
304
304
|
'delta ',
|
|
305
305
|
_$_.tsrx_element((__anchor, __block) => {
|
|
306
|
-
var
|
|
306
|
+
var em_1 = root_18();
|
|
307
307
|
|
|
308
|
-
_$_.append(__anchor,
|
|
308
|
+
_$_.append(__anchor, em_1);
|
|
309
309
|
}),
|
|
310
310
|
' zeta'
|
|
311
311
|
]
|
|
@@ -336,17 +336,17 @@ export function MixedTsrxCollectionSplitServerText() {
|
|
|
336
336
|
_$_.expression(expression_8, () => [
|
|
337
337
|
'alpha ',
|
|
338
338
|
_$_.tsrx_element((__anchor, __block) => {
|
|
339
|
-
var
|
|
339
|
+
var strong_2 = root_21();
|
|
340
340
|
|
|
341
|
-
_$_.append(__anchor,
|
|
341
|
+
_$_.append(__anchor, strong_2);
|
|
342
342
|
}),
|
|
343
343
|
' gamma ',
|
|
344
344
|
[
|
|
345
345
|
'delta ',
|
|
346
346
|
_$_.tsrx_element((__anchor, __block) => {
|
|
347
|
-
var
|
|
347
|
+
var em_2 = root_22();
|
|
348
348
|
|
|
349
|
-
_$_.append(__anchor,
|
|
349
|
+
_$_.append(__anchor, em_2);
|
|
350
350
|
}),
|
|
351
351
|
' zeta'
|
|
352
352
|
]
|
|
@@ -377,17 +377,17 @@ export function MixedTsrxCollectionSplitClientText() {
|
|
|
377
377
|
_$_.expression(expression_10, () => [
|
|
378
378
|
'alpha ',
|
|
379
379
|
_$_.tsrx_element((__anchor, __block) => {
|
|
380
|
-
var
|
|
380
|
+
var strong_3 = root_25();
|
|
381
381
|
|
|
382
|
-
_$_.append(__anchor,
|
|
382
|
+
_$_.append(__anchor, strong_3);
|
|
383
383
|
}),
|
|
384
384
|
' gamma ',
|
|
385
385
|
[
|
|
386
386
|
'changed ',
|
|
387
387
|
_$_.tsrx_element((__anchor, __block) => {
|
|
388
|
-
var
|
|
388
|
+
var em_3 = root_26();
|
|
389
389
|
|
|
390
|
-
_$_.append(__anchor,
|
|
390
|
+
_$_.append(__anchor, em_3);
|
|
391
391
|
}),
|
|
392
392
|
' zeta'
|
|
393
393
|
]
|
|
@@ -104,100 +104,84 @@ export function NestedTsxTsrxExpressionValues() {
|
|
|
104
104
|
|
|
105
105
|
export function MixedTsrxCollectionText() {
|
|
106
106
|
return <>
|
|
107
|
-
const content =
|
|
107
|
+
const content = <>
|
|
108
108
|
{[
|
|
109
109
|
'alpha ',
|
|
110
|
-
<strong class="middle">
|
|
111
|
-
{'beta'}
|
|
112
|
-
</strong>,
|
|
110
|
+
<strong class="middle">{'beta'}</strong>,
|
|
113
111
|
' gamma ',
|
|
114
112
|
[
|
|
115
113
|
'delta ',
|
|
116
|
-
<em class="tail">
|
|
117
|
-
{'epsilon'}
|
|
118
|
-
</em>,
|
|
114
|
+
<em class="tail">{'epsilon'}</em>,
|
|
119
115
|
' zeta',
|
|
120
116
|
],
|
|
121
117
|
]}
|
|
122
|
-
|
|
118
|
+
</>;
|
|
123
119
|
<div class="mixed-collection">{content}</div>
|
|
124
120
|
</>;
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
export function MixedTsrxCollectionSplitServerText() {
|
|
128
124
|
return <>
|
|
129
|
-
const content =
|
|
125
|
+
const content = <>
|
|
130
126
|
{[
|
|
131
127
|
'alpha ',
|
|
132
|
-
<strong class="middle">
|
|
133
|
-
{'beta'}
|
|
134
|
-
</strong>,
|
|
128
|
+
<strong class="middle">{'beta'}</strong>,
|
|
135
129
|
' gamma ',
|
|
136
130
|
[
|
|
137
131
|
'delta ',
|
|
138
|
-
<em class="tail">
|
|
139
|
-
{'epsilon'}
|
|
140
|
-
</em>,
|
|
132
|
+
<em class="tail">{'epsilon'}</em>,
|
|
141
133
|
' zeta',
|
|
142
134
|
],
|
|
143
135
|
]}
|
|
144
|
-
|
|
136
|
+
</>;
|
|
145
137
|
<div class="mixed-collection-split">{content}</div>
|
|
146
138
|
</>;
|
|
147
139
|
}
|
|
148
140
|
|
|
149
141
|
export function MixedTsrxCollectionSplitClientText() {
|
|
150
142
|
return <>
|
|
151
|
-
const content =
|
|
143
|
+
const content = <>
|
|
152
144
|
{[
|
|
153
145
|
'alpha ',
|
|
154
|
-
<strong class="middle">
|
|
155
|
-
{'beta'}
|
|
156
|
-
</strong>,
|
|
146
|
+
<strong class="middle">{'beta'}</strong>,
|
|
157
147
|
' gamma ',
|
|
158
148
|
[
|
|
159
149
|
'changed ',
|
|
160
|
-
<em class="tail">
|
|
161
|
-
{'epsilon'}
|
|
162
|
-
</em>,
|
|
150
|
+
<em class="tail">{'epsilon'}</em>,
|
|
163
151
|
' zeta',
|
|
164
152
|
],
|
|
165
153
|
]}
|
|
166
|
-
|
|
154
|
+
</>;
|
|
167
155
|
<div class="mixed-collection-split">{content}</div>
|
|
168
156
|
</>;
|
|
169
157
|
}
|
|
170
158
|
|
|
171
159
|
export function MixedTsrxCollectionPrimitiveServerText() {
|
|
172
160
|
return <>
|
|
173
|
-
const content =
|
|
161
|
+
const content = <>
|
|
174
162
|
{[
|
|
175
163
|
'count: ',
|
|
176
164
|
1,
|
|
177
165
|
' / ',
|
|
178
166
|
true,
|
|
179
|
-
<span class="primitive-tail">
|
|
180
|
-
{' ok'}
|
|
181
|
-
</span>,
|
|
167
|
+
<span class="primitive-tail">{' ok'}</span>,
|
|
182
168
|
]}
|
|
183
|
-
|
|
169
|
+
</>;
|
|
184
170
|
<div class="mixed-collection-primitive">{content}</div>
|
|
185
171
|
</>;
|
|
186
172
|
}
|
|
187
173
|
|
|
188
174
|
export function MixedTsrxCollectionPrimitiveClientText() {
|
|
189
175
|
return <>
|
|
190
|
-
const content =
|
|
176
|
+
const content = <>
|
|
191
177
|
{[
|
|
192
178
|
'count: ',
|
|
193
179
|
2,
|
|
194
180
|
' / ',
|
|
195
181
|
false,
|
|
196
|
-
<span class="primitive-tail">
|
|
197
|
-
{' ok'}
|
|
198
|
-
</span>,
|
|
182
|
+
<span class="primitive-tail">{' ok'}</span>,
|
|
199
183
|
]}
|
|
200
|
-
|
|
184
|
+
</>;
|
|
201
185
|
<div class="mixed-collection-primitive">{content}</div>
|
|
202
186
|
</>;
|
|
203
187
|
}
|
|
@@ -238,46 +222,34 @@ export function DynamicArrayFromLogical() {
|
|
|
238
222
|
|
|
239
223
|
export function NestedTsrxInsideTopLevelTsxExpression() {
|
|
240
224
|
return <>
|
|
241
|
-
const content =
|
|
225
|
+
const content = <>
|
|
242
226
|
<section class="outer">
|
|
243
|
-
{
|
|
244
|
-
<div class="inner">
|
|
245
|
-
{'from tsrx'}
|
|
246
|
-
</div>
|
|
247
|
-
</>}
|
|
227
|
+
{<><div class="inner">{'from tsrx'}</div></>}
|
|
248
228
|
</section>
|
|
249
|
-
|
|
229
|
+
</>;
|
|
250
230
|
{content}
|
|
251
231
|
</>;
|
|
252
232
|
}
|
|
253
233
|
|
|
254
234
|
export function NestedTsrxElementsInsideTopLevelTsxValue() {
|
|
255
235
|
return <>
|
|
256
|
-
const content =
|
|
236
|
+
const content = <>
|
|
257
237
|
<div class="wrapper">
|
|
258
238
|
{<>
|
|
259
239
|
<section class="native">
|
|
260
|
-
<span class="nested-tsrx">
|
|
261
|
-
{'inside nested tsrx'}
|
|
262
|
-
</span>
|
|
240
|
+
<span class="nested-tsrx">{'inside nested tsrx'}</span>
|
|
263
241
|
</section>
|
|
264
242
|
</>}
|
|
265
243
|
</div>
|
|
266
|
-
|
|
244
|
+
</>;
|
|
267
245
|
{content}
|
|
268
246
|
</>;
|
|
269
247
|
}
|
|
270
248
|
|
|
271
249
|
export function TsxDeclaredBeforeTopLevelTsx() {
|
|
272
250
|
return <>
|
|
273
|
-
const nested =
|
|
274
|
-
|
|
275
|
-
{'inside nested tsx'}
|
|
276
|
-
</span>
|
|
277
|
-
</tsx>;
|
|
278
|
-
const content = <tsx>
|
|
279
|
-
<div class="native">{nested}</div>
|
|
280
|
-
</tsx>;
|
|
251
|
+
const nested = <><span class="nested-tsx">{'inside nested tsx'}</span></>;
|
|
252
|
+
const content = <><div class="native">{nested}</div></>;
|
|
281
253
|
{content}
|
|
282
254
|
</>;
|
|
283
255
|
}
|
|
@@ -91,13 +91,11 @@ describe('basic server > attribute rendering', () => {
|
|
|
91
91
|
it('applies scoped classes inside tsx blocks and fragment shorthand', async () => {
|
|
92
92
|
function App() {
|
|
93
93
|
return <>
|
|
94
|
-
|
|
94
|
+
<>
|
|
95
95
|
<div class="card">
|
|
96
|
-
<h2>
|
|
97
|
-
{'tsx block'}
|
|
98
|
-
</h2>
|
|
96
|
+
<h2>{'tsx block'}</h2>
|
|
99
97
|
</div>
|
|
100
|
-
|
|
98
|
+
</>
|
|
101
99
|
<>
|
|
102
100
|
<div class="card">
|
|
103
101
|
<h2>{'fragment shorthand'}</h2>
|
|
@@ -156,11 +156,7 @@ describe('basic server > components & composition', () => {
|
|
|
156
156
|
|
|
157
157
|
it('allows a compat-only function as a component type', async () => {
|
|
158
158
|
function CompatOnly() {
|
|
159
|
-
return
|
|
160
|
-
<div>
|
|
161
|
-
{'compat'}
|
|
162
|
-
</div>
|
|
163
|
-
</tsx>;
|
|
159
|
+
return <><div>{'compat'}</div></>;
|
|
164
160
|
}
|
|
165
161
|
|
|
166
162
|
function App() {
|
|
@@ -150,24 +150,16 @@ second"</pre>
|
|
|
150
150
|
function makeFragment(label: string) {
|
|
151
151
|
return <>
|
|
152
152
|
<span class="label">{label}</span>
|
|
153
|
-
const test =
|
|
154
|
-
{[1, 2, 3, 4].map(
|
|
155
|
-
|
|
156
|
-
{<>
|
|
157
|
-
<div class="helper-item">{item}</div>
|
|
158
|
-
</>}
|
|
159
|
-
</tsx>,
|
|
160
|
-
)}
|
|
161
|
-
</tsx>;
|
|
153
|
+
const test = <>
|
|
154
|
+
{[1, 2, 3, 4].map((item) => <>{<><div class="helper-item">{item}</div></>}</>)}
|
|
155
|
+
</>;
|
|
162
156
|
{test}
|
|
163
157
|
</>;
|
|
164
158
|
}
|
|
165
159
|
|
|
166
160
|
function Basic() {
|
|
167
161
|
return <>
|
|
168
|
-
{<
|
|
169
|
-
{[1, 2, 3].map((item) => <div class="app-item">{item}</div>)}
|
|
170
|
-
</tsx>}
|
|
162
|
+
{<>{[1, 2, 3].map((item) => <div class="app-item">{item}</div>)}</>}
|
|
171
163
|
{makeFragment('from helper')}
|
|
172
164
|
</>;
|
|
173
165
|
}
|
|
@@ -182,15 +174,11 @@ second"</pre>
|
|
|
182
174
|
it('renders tsrx nested directly inside a top-level tsx expression value', async () => {
|
|
183
175
|
function Basic() {
|
|
184
176
|
return <>
|
|
185
|
-
const content =
|
|
177
|
+
const content = <>
|
|
186
178
|
<section class="outer">
|
|
187
|
-
{
|
|
188
|
-
<div class="inner">
|
|
189
|
-
{'from tsrx'}
|
|
190
|
-
</div>
|
|
191
|
-
</>}
|
|
179
|
+
{<><div class="inner">{'from tsrx'}</div></>}
|
|
192
180
|
</section>
|
|
193
|
-
|
|
181
|
+
</>;
|
|
194
182
|
{content}
|
|
195
183
|
</>;
|
|
196
184
|
}
|
|
@@ -203,17 +191,15 @@ second"</pre>
|
|
|
203
191
|
it('renders nested elements from tsrx inside a top-level tsx value', async () => {
|
|
204
192
|
function Basic() {
|
|
205
193
|
return <>
|
|
206
|
-
const content =
|
|
194
|
+
const content = <>
|
|
207
195
|
<div class="wrapper">
|
|
208
196
|
{<>
|
|
209
197
|
<section class="native">
|
|
210
|
-
<span class="nested-tsrx">
|
|
211
|
-
{'inside nested tsrx'}
|
|
212
|
-
</span>
|
|
198
|
+
<span class="nested-tsrx">{'inside nested tsrx'}</span>
|
|
213
199
|
</section>
|
|
214
200
|
</>}
|
|
215
201
|
</div>
|
|
216
|
-
|
|
202
|
+
</>;
|
|
217
203
|
{content}
|
|
218
204
|
</>;
|
|
219
205
|
}
|
|
@@ -228,14 +214,8 @@ second"</pre>
|
|
|
228
214
|
it('renders tsx declared before a top-level tsx value', async () => {
|
|
229
215
|
function Basic() {
|
|
230
216
|
return <>
|
|
231
|
-
const nested =
|
|
232
|
-
|
|
233
|
-
{'inside nested tsx'}
|
|
234
|
-
</span>
|
|
235
|
-
</tsx>;
|
|
236
|
-
const content = <tsx>
|
|
237
|
-
<div class="native">{nested}</div>
|
|
238
|
-
</tsx>;
|
|
217
|
+
const nested = <><span class="nested-tsx">{'inside nested tsx'}</span></>;
|
|
218
|
+
const content = <><div class="native">{nested}</div></>;
|
|
239
219
|
{content}
|
|
240
220
|
</>;
|
|
241
221
|
}
|
|
@@ -251,16 +231,14 @@ second"</pre>
|
|
|
251
231
|
function Basic() {
|
|
252
232
|
return <>
|
|
253
233
|
<div>
|
|
254
|
-
{
|
|
234
|
+
{<>
|
|
255
235
|
{[
|
|
256
236
|
'start:',
|
|
257
237
|
['one', 2, true, null, false],
|
|
258
|
-
<strong>
|
|
259
|
-
{'!'}
|
|
260
|
-
</strong>,
|
|
238
|
+
<strong>{'!'}</strong>,
|
|
261
239
|
':end',
|
|
262
240
|
]}
|
|
263
|
-
|
|
241
|
+
</>}
|
|
264
242
|
</div>
|
|
265
243
|
</>;
|
|
266
244
|
}
|
|
@@ -287,7 +287,7 @@ export function App() { return <>
|
|
|
287
287
|
function App() { return <>
|
|
288
288
|
function make(flag) {
|
|
289
289
|
if (flag) {
|
|
290
|
-
return
|
|
290
|
+
return <><span>{'nested'}</span></>;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
return null;
|
|
@@ -308,7 +308,7 @@ function App() { return <>
|
|
|
308
308
|
function App() { return <>
|
|
309
309
|
function make() {
|
|
310
310
|
function nested() {
|
|
311
|
-
return
|
|
311
|
+
return <><span>{'nested'}</span></>;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
return nested;
|