ripple 0.3.68 → 0.3.70
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 +126 -259
- 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 -131
- 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
|
@@ -4,7 +4,7 @@ import { compile } from '@tsrx/ripple';
|
|
|
4
4
|
describe('CSS :global additional use cases', () => {
|
|
5
5
|
it('handles :global as modifier with dot notation', () => {
|
|
6
6
|
const source = `
|
|
7
|
-
export
|
|
7
|
+
export function Test() { return <>
|
|
8
8
|
<div class="x">{'content'}</div>
|
|
9
9
|
|
|
10
10
|
<style>
|
|
@@ -12,7 +12,7 @@ export component Test() {
|
|
|
12
12
|
color: red;
|
|
13
13
|
}
|
|
14
14
|
</style>
|
|
15
|
-
}`;
|
|
15
|
+
</>; }`;
|
|
16
16
|
const { css } = compile(source, 'test.tsrx');
|
|
17
17
|
|
|
18
18
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+\.x {/);
|
|
@@ -20,7 +20,7 @@ export component Test() {
|
|
|
20
20
|
|
|
21
21
|
it('handles :global modifier in nested syntax', () => {
|
|
22
22
|
const source = `
|
|
23
|
-
export
|
|
23
|
+
export function Test() { return <>
|
|
24
24
|
<div class="x">{'content'}</div>
|
|
25
25
|
|
|
26
26
|
<style>
|
|
@@ -30,7 +30,7 @@ export component Test() {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
</style>
|
|
33
|
-
}`;
|
|
33
|
+
</>; }`;
|
|
34
34
|
const { css } = compile(source, 'test.tsrx');
|
|
35
35
|
|
|
36
36
|
expect(css).toContain('&.x {');
|
|
@@ -38,7 +38,7 @@ export component Test() {
|
|
|
38
38
|
|
|
39
39
|
it('handles :global with & nesting selector inside block', () => {
|
|
40
40
|
const source = `
|
|
41
|
-
export
|
|
41
|
+
export function Test() { return <>
|
|
42
42
|
<div class="x">{'content'}</div>
|
|
43
43
|
|
|
44
44
|
<style>
|
|
@@ -48,7 +48,7 @@ export component Test() {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
</style>
|
|
51
|
-
}`;
|
|
51
|
+
</>; }`;
|
|
52
52
|
const { css } = compile(source, 'test.tsrx');
|
|
53
53
|
|
|
54
54
|
expect(css).toContain('&.x {');
|
|
@@ -56,7 +56,7 @@ export component Test() {
|
|
|
56
56
|
|
|
57
57
|
it('handles :global with :is pseudo-class modifier', () => {
|
|
58
58
|
const source = `
|
|
59
|
-
export
|
|
59
|
+
export function Test() { return <>
|
|
60
60
|
<div>{'content'}</div>
|
|
61
61
|
|
|
62
62
|
<style>
|
|
@@ -64,7 +64,7 @@ export component Test() {
|
|
|
64
64
|
color: green;
|
|
65
65
|
}
|
|
66
66
|
</style>
|
|
67
|
-
}`;
|
|
67
|
+
</>; }`;
|
|
68
68
|
const { css } = compile(source, 'test.tsrx');
|
|
69
69
|
|
|
70
70
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+:is\(html\.dark-mode \*\) {/);
|
|
@@ -72,7 +72,7 @@ export component Test() {
|
|
|
72
72
|
|
|
73
73
|
it('handles :global with & inside :global block', () => {
|
|
74
74
|
const source = `
|
|
75
|
-
export
|
|
75
|
+
export function Test() { return <>
|
|
76
76
|
<div class="class">{'content'}</div>
|
|
77
77
|
|
|
78
78
|
<style>
|
|
@@ -82,7 +82,7 @@ export component Test() {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
</style>
|
|
85
|
-
}`;
|
|
85
|
+
</>; }`;
|
|
86
86
|
const { css } = compile(source, 'test.tsrx');
|
|
87
87
|
|
|
88
88
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
@@ -91,7 +91,7 @@ export component Test() {
|
|
|
91
91
|
|
|
92
92
|
it('handles :global(*) with & and descendant', () => {
|
|
93
93
|
const source = `
|
|
94
|
-
export
|
|
94
|
+
export function Test() { return <>
|
|
95
95
|
<div class="class">{'content'}</div>
|
|
96
96
|
|
|
97
97
|
<style>
|
|
@@ -101,7 +101,7 @@ export component Test() {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
</style>
|
|
104
|
-
}`;
|
|
104
|
+
</>; }`;
|
|
105
105
|
const { css } = compile(source, 'test.tsrx');
|
|
106
106
|
|
|
107
107
|
expect(css).toContain('* {');
|
|
@@ -110,7 +110,7 @@ export component Test() {
|
|
|
110
110
|
|
|
111
111
|
it('handles multiple :global selectors in list', () => {
|
|
112
112
|
const source = `
|
|
113
|
-
export
|
|
113
|
+
export function Test() { return <>
|
|
114
114
|
<x>{'content'}</x>
|
|
115
115
|
<y>{'content'}</y>
|
|
116
116
|
|
|
@@ -119,7 +119,7 @@ export component Test() {
|
|
|
119
119
|
color: green;
|
|
120
120
|
}
|
|
121
121
|
</style>
|
|
122
|
-
}`;
|
|
122
|
+
</>; }`;
|
|
123
123
|
const { css } = compile(source, 'test.tsrx');
|
|
124
124
|
|
|
125
125
|
expect(css).toContain(' x, y {');
|
|
@@ -127,7 +127,7 @@ export component Test() {
|
|
|
127
127
|
|
|
128
128
|
it('handles :global block with nested selector list', () => {
|
|
129
129
|
const source = `
|
|
130
|
-
export
|
|
130
|
+
export function Test() { return <>
|
|
131
131
|
<div>
|
|
132
132
|
<y>{'content'}</y>
|
|
133
133
|
</div>
|
|
@@ -139,7 +139,7 @@ export component Test() {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
</style>
|
|
142
|
-
}`;
|
|
142
|
+
</>; }`;
|
|
143
143
|
const { css } = compile(source, 'test.tsrx');
|
|
144
144
|
|
|
145
145
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+/);
|
|
@@ -148,7 +148,7 @@ export component Test() {
|
|
|
148
148
|
|
|
149
149
|
it('handles keyframes inside :global block', () => {
|
|
150
150
|
const source = `
|
|
151
|
-
export
|
|
151
|
+
export function Test() { return <>
|
|
152
152
|
<div class="x">{'animated'}</div>
|
|
153
153
|
|
|
154
154
|
<style>
|
|
@@ -174,7 +174,7 @@ export component Test() {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
</style>
|
|
177
|
-
}`;
|
|
177
|
+
</>; }`;
|
|
178
178
|
const { css } = compile(source, 'test.tsrx');
|
|
179
179
|
|
|
180
180
|
expect(css).toContain('@keyframes test-in {');
|
|
@@ -186,7 +186,7 @@ export component Test() {
|
|
|
186
186
|
|
|
187
187
|
it('handles global keyframes with no component elements', () => {
|
|
188
188
|
const source = `
|
|
189
|
-
export
|
|
189
|
+
export function Test() { return <>
|
|
190
190
|
<div>{'content'}</div>
|
|
191
191
|
|
|
192
192
|
<style>
|
|
@@ -195,7 +195,7 @@ export component Test() {
|
|
|
195
195
|
100% { color: blue; }
|
|
196
196
|
}
|
|
197
197
|
</style>
|
|
198
|
-
}`;
|
|
198
|
+
</>; }`;
|
|
199
199
|
const { css } = compile(source, 'test.tsrx');
|
|
200
200
|
|
|
201
201
|
expect(css).toContain('@keyframes orphan');
|
|
@@ -204,7 +204,7 @@ export component Test() {
|
|
|
204
204
|
|
|
205
205
|
it('handles :global with class modifier syntax', () => {
|
|
206
206
|
const source = `
|
|
207
|
-
export
|
|
207
|
+
export function Test() { return <>
|
|
208
208
|
<div class="blue">{'might be programmatically added'}</div>
|
|
209
209
|
<span class="x blue">{'span content'}</span>
|
|
210
210
|
|
|
@@ -219,7 +219,7 @@ export component Test() {
|
|
|
219
219
|
background: red;
|
|
220
220
|
}
|
|
221
221
|
</style>
|
|
222
|
-
}`;
|
|
222
|
+
</>; }`;
|
|
223
223
|
const { css } = compile(source, 'test.tsrx');
|
|
224
224
|
|
|
225
225
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+\.blue {/);
|
|
@@ -229,7 +229,7 @@ export component Test() {
|
|
|
229
229
|
|
|
230
230
|
it('handles multiple :global() in descendant sequence', () => {
|
|
231
231
|
const source = `
|
|
232
|
-
export
|
|
232
|
+
export function Test() { return <>
|
|
233
233
|
<p>{'this may or may not be styled'}</p>
|
|
234
234
|
|
|
235
235
|
<style>
|
|
@@ -237,7 +237,7 @@ export component Test() {
|
|
|
237
237
|
color: red;
|
|
238
238
|
}
|
|
239
239
|
</style>
|
|
240
|
-
}`;
|
|
240
|
+
</>; }`;
|
|
241
241
|
const { css } = compile(source, 'test.tsrx');
|
|
242
242
|
|
|
243
243
|
expect(css).toContain('div > section > p');
|
|
@@ -246,7 +246,7 @@ export component Test() {
|
|
|
246
246
|
|
|
247
247
|
it('handles :is with :global and html context', () => {
|
|
248
248
|
const source = `
|
|
249
|
-
export
|
|
249
|
+
export function Test() { return <>
|
|
250
250
|
<x>
|
|
251
251
|
<y>
|
|
252
252
|
<z>{'content'}</z>
|
|
@@ -258,7 +258,7 @@ export component Test() {
|
|
|
258
258
|
color: green;
|
|
259
259
|
}
|
|
260
260
|
</style>
|
|
261
|
-
}`;
|
|
261
|
+
</>; }`;
|
|
262
262
|
const { css } = compile(source, 'test.tsrx');
|
|
263
263
|
|
|
264
264
|
expect(css).toMatch(/x\.tsrx-[a-z0-9]+ :is\(html \*\) {/);
|
|
@@ -266,7 +266,7 @@ export component Test() {
|
|
|
266
266
|
|
|
267
267
|
it('handles :global block with :has inside', () => {
|
|
268
268
|
const source = `
|
|
269
|
-
export
|
|
269
|
+
export function Test() { return <>
|
|
270
270
|
<div>
|
|
271
271
|
<x>{'content'}</x>
|
|
272
272
|
</div>
|
|
@@ -285,7 +285,7 @@ export component Test() {
|
|
|
285
285
|
color: green;
|
|
286
286
|
}
|
|
287
287
|
</style>
|
|
288
|
-
}`;
|
|
288
|
+
</>; }`;
|
|
289
289
|
const { css } = compile(source, 'test.tsrx');
|
|
290
290
|
|
|
291
291
|
expect(css).toContain('.foo {');
|
|
@@ -296,7 +296,7 @@ export component Test() {
|
|
|
296
296
|
|
|
297
297
|
it('handles :not with :global in complex nesting', () => {
|
|
298
298
|
const source = `
|
|
299
|
-
export
|
|
299
|
+
export function Test() { return <>
|
|
300
300
|
<p class="foo">{'foo'}</p>
|
|
301
301
|
<p class="bar">
|
|
302
302
|
{'bar'}
|
|
@@ -340,7 +340,7 @@ export component Test() {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
</style>
|
|
343
|
-
}`;
|
|
343
|
+
</>; }`;
|
|
344
344
|
const { css } = compile(source, 'test.tsrx');
|
|
345
345
|
|
|
346
346
|
expect(css).toContain(':not(.foo)');
|
|
@@ -349,7 +349,7 @@ export component Test() {
|
|
|
349
349
|
|
|
350
350
|
it('handles sibling combinators with children and :global before scoped elements', () => {
|
|
351
351
|
const source = `
|
|
352
|
-
export
|
|
352
|
+
export function Test({ children }) { return <>
|
|
353
353
|
<div>
|
|
354
354
|
<p class="before">{'before'}</p>
|
|
355
355
|
|
|
@@ -375,7 +375,7 @@ export component Test({ children }) {
|
|
|
375
375
|
/* should be unused as this is not a possibility */
|
|
376
376
|
:global(.x) + .bar { color: green; }
|
|
377
377
|
</style>
|
|
378
|
-
}`;
|
|
378
|
+
</>; }`;
|
|
379
379
|
const { css } = compile(source, 'test.tsrx');
|
|
380
380
|
|
|
381
381
|
expect(css).toMatch(/\.before\.tsrx-[a-z0-9]+ \+ \.foo:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
@@ -386,7 +386,7 @@ export component Test({ children }) {
|
|
|
386
386
|
|
|
387
387
|
it('handles sibling combinators with component and :global before scoped elements', () => {
|
|
388
388
|
const source = `
|
|
389
|
-
export
|
|
389
|
+
export function Test({ children }) { return <>
|
|
390
390
|
<div>
|
|
391
391
|
<p class="before">{'before'}</p>
|
|
392
392
|
|
|
@@ -412,11 +412,11 @@ export component Test({ children }) {
|
|
|
412
412
|
/* should be unused as this is not a possibility */
|
|
413
413
|
:global(.x) + .bar { color: green; }
|
|
414
414
|
</style>
|
|
415
|
-
}
|
|
415
|
+
</>; }
|
|
416
416
|
|
|
417
|
-
|
|
417
|
+
function Child1() { return <>
|
|
418
418
|
<div>{'child1'}</div>
|
|
419
|
-
}`;
|
|
419
|
+
</>; }`;
|
|
420
420
|
const { css } = compile(source, 'test.tsrx');
|
|
421
421
|
|
|
422
422
|
expect(css).toMatch(/\.before\.tsrx-[a-z0-9]+ \+ \.foo:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
@@ -431,7 +431,7 @@ component Child1() {
|
|
|
431
431
|
const source = `
|
|
432
432
|
import { track } from 'ripple';
|
|
433
433
|
|
|
434
|
-
export
|
|
434
|
+
export function Test({ children }) { return <>
|
|
435
435
|
const DynamicComponent = track(() => Child1);
|
|
436
436
|
<div>
|
|
437
437
|
<p class="before">{'before'}</p>
|
|
@@ -458,11 +458,11 @@ export component Test({ children }) {
|
|
|
458
458
|
/* should be unused as this is not a possibility */
|
|
459
459
|
:global(.x) + .bar { color: green; }
|
|
460
460
|
</style>
|
|
461
|
-
}
|
|
461
|
+
</>; }
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
function Child1() { return <>
|
|
464
464
|
<div>{'child1'}</div>
|
|
465
|
-
}`;
|
|
465
|
+
</>; }`;
|
|
466
466
|
const { css } = compile(source, 'test.tsrx');
|
|
467
467
|
|
|
468
468
|
expect(css).toMatch(/\.before\.tsrx-[a-z0-9]+ \+ \.foo:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
@@ -478,7 +478,7 @@ component Child1() {
|
|
|
478
478
|
const source = `
|
|
479
479
|
import { track } from 'ripple';
|
|
480
480
|
|
|
481
|
-
export
|
|
481
|
+
export function Test({ children, classes }) { return <>
|
|
482
482
|
const dynamicElement = track('div');
|
|
483
483
|
<div>
|
|
484
484
|
<p class="before">{'before'}</p>
|
|
@@ -505,7 +505,7 @@ export component Test({ children, classes }) {
|
|
|
505
505
|
/* should be unused as this is not a possibility */
|
|
506
506
|
:global(.x) + .bar { color: green; }
|
|
507
507
|
</style>
|
|
508
|
-
}`;
|
|
508
|
+
</>; }`;
|
|
509
509
|
|
|
510
510
|
const { css } = compile(source, 'test.tsrx');
|
|
511
511
|
|
|
@@ -518,7 +518,7 @@ export component Test({ children, classes }) {
|
|
|
518
518
|
|
|
519
519
|
it('handles :global with multiple global descendants', () => {
|
|
520
520
|
const source = `
|
|
521
|
-
export
|
|
521
|
+
export function Test() { return <>
|
|
522
522
|
<div class="root">
|
|
523
523
|
<section class="whatever">
|
|
524
524
|
<p>{'hello'}</p>
|
|
@@ -530,7 +530,7 @@ export component Test() {
|
|
|
530
530
|
color: red;
|
|
531
531
|
}
|
|
532
532
|
</style>
|
|
533
|
-
}`;
|
|
533
|
+
</>; }`;
|
|
534
534
|
const { css } = compile(source, 'test.tsrx');
|
|
535
535
|
|
|
536
536
|
expect(css).toMatch(/html body \.root\.tsrx-[a-z0-9]+ p:where\(\.tsrx-[a-z0-9]+\) {/);
|
|
@@ -538,7 +538,7 @@ export component Test() {
|
|
|
538
538
|
|
|
539
539
|
it('handles nested @media with :global blocks', () => {
|
|
540
540
|
const source = `
|
|
541
|
-
export
|
|
541
|
+
export function Test() { return <>
|
|
542
542
|
<div>{'content'}</div>
|
|
543
543
|
|
|
544
544
|
<style>
|
|
@@ -556,7 +556,7 @@ export component Test() {
|
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
</style>
|
|
559
|
-
}`;
|
|
559
|
+
</>; }`;
|
|
560
560
|
const { css } = compile(source, 'test.tsrx');
|
|
561
561
|
|
|
562
562
|
expect(css).toContain('@media (min-width: 768px) {');
|
|
@@ -566,7 +566,7 @@ export component Test() {
|
|
|
566
566
|
|
|
567
567
|
it('handles :has with complex combinators', () => {
|
|
568
568
|
const source = `
|
|
569
|
-
export
|
|
569
|
+
export function Test() { return <>
|
|
570
570
|
<g>
|
|
571
571
|
<h>
|
|
572
572
|
<i>{'content'}</i>
|
|
@@ -587,7 +587,7 @@ export component Test() {
|
|
|
587
587
|
color: green;
|
|
588
588
|
}
|
|
589
589
|
</style>
|
|
590
|
-
}`;
|
|
590
|
+
</>; }`;
|
|
591
591
|
const { css } = compile(source, 'test.tsrx');
|
|
592
592
|
|
|
593
593
|
expect(css).toMatch(
|
|
@@ -598,7 +598,7 @@ export component Test() {
|
|
|
598
598
|
|
|
599
599
|
it('handles :global with attribute selectors containing special characters', () => {
|
|
600
600
|
const source = `
|
|
601
|
-
export
|
|
601
|
+
export function Test() { return <>
|
|
602
602
|
<div>
|
|
603
603
|
<h1 data-title="Hello, world!">{'hello world'}</h1>
|
|
604
604
|
</div>
|
|
@@ -611,7 +611,7 @@ export component Test() {
|
|
|
611
611
|
color: red;
|
|
612
612
|
}
|
|
613
613
|
</style>
|
|
614
|
-
}`;
|
|
614
|
+
</>; }`;
|
|
615
615
|
const { css } = compile(source, 'test.tsrx');
|
|
616
616
|
|
|
617
617
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ h1\[data-title="Hello, world!"\]/);
|
|
@@ -620,7 +620,7 @@ export component Test() {
|
|
|
620
620
|
|
|
621
621
|
it('handles escaped commas in :global class names', () => {
|
|
622
622
|
const source = `
|
|
623
|
-
export
|
|
623
|
+
export function Test() { return <>
|
|
624
624
|
<div>
|
|
625
625
|
<h1 class="h1,h2,h3">{'hello world'}</h1>
|
|
626
626
|
</div>
|
|
@@ -630,7 +630,7 @@ export component Test() {
|
|
|
630
630
|
color: red;
|
|
631
631
|
}
|
|
632
632
|
</style>
|
|
633
|
-
}`;
|
|
633
|
+
</>; }`;
|
|
634
634
|
const { css } = compile(source, 'test.tsrx');
|
|
635
635
|
|
|
636
636
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ \.h1\\,h2\\,h3 {/);
|
|
@@ -641,7 +641,7 @@ export component Test() {
|
|
|
641
641
|
*/
|
|
642
642
|
it('handles :global with :is containing multiple selectors', () => {
|
|
643
643
|
const source = `
|
|
644
|
-
export
|
|
644
|
+
export function Test() { return <>
|
|
645
645
|
<div>
|
|
646
646
|
<h1>{'hello world'}</h1>
|
|
647
647
|
<h2>{'subtitle'}</h2>
|
|
@@ -655,7 +655,7 @@ export component Test() {
|
|
|
655
655
|
color: red;
|
|
656
656
|
}
|
|
657
657
|
</style>
|
|
658
|
-
}`;
|
|
658
|
+
</>; }`;
|
|
659
659
|
const { css } = compile(source, 'test.tsrx');
|
|
660
660
|
|
|
661
661
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ :is\(h1, h2\)/);
|
|
@@ -664,7 +664,7 @@ export component Test() {
|
|
|
664
664
|
|
|
665
665
|
it('handles :global with :is containing compound selectors', () => {
|
|
666
666
|
const source = `
|
|
667
|
-
export
|
|
667
|
+
export function Test() { return <>
|
|
668
668
|
<div>
|
|
669
669
|
<h1>{'hello world'}</h1>
|
|
670
670
|
<h2>{'subtitle'}</h2>
|
|
@@ -676,7 +676,7 @@ export component Test() {
|
|
|
676
676
|
color: red;
|
|
677
677
|
}
|
|
678
678
|
</style>
|
|
679
|
-
}`;
|
|
679
|
+
</>; }`;
|
|
680
680
|
const { css } = compile(source, 'test.tsrx');
|
|
681
681
|
|
|
682
682
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ h1 ~ :is\(h2, h3\)/);
|
|
@@ -684,7 +684,7 @@ export component Test() {
|
|
|
684
684
|
|
|
685
685
|
it('handles :global with pseudo-elements', () => {
|
|
686
686
|
const source = `
|
|
687
|
-
export
|
|
687
|
+
export function Test() { return <>
|
|
688
688
|
<div>
|
|
689
689
|
<h1 class="foo">{'hello world'}</h1>
|
|
690
690
|
</div>
|
|
@@ -697,7 +697,7 @@ export component Test() {
|
|
|
697
697
|
color: red;
|
|
698
698
|
}
|
|
699
699
|
</style>
|
|
700
|
-
}`;
|
|
700
|
+
</>; }`;
|
|
701
701
|
expect(() => compile(source, 'test.tsrx')).toThrow(
|
|
702
702
|
':global(...) can be at the start or end of a selector sequence, but not in the middle',
|
|
703
703
|
);
|
|
@@ -3,7 +3,7 @@ import { compile } from '@tsrx/ripple';
|
|
|
3
3
|
describe('CSS :global with advanced selectors', () => {
|
|
4
4
|
it('handles :global with ::slotted()', () => {
|
|
5
5
|
const source = `
|
|
6
|
-
export
|
|
6
|
+
export function Test() { return <>
|
|
7
7
|
<div>
|
|
8
8
|
<slot />
|
|
9
9
|
</div>
|
|
@@ -17,7 +17,7 @@ export component Test() {
|
|
|
17
17
|
color: blue;
|
|
18
18
|
}
|
|
19
19
|
</style>
|
|
20
|
-
}`;
|
|
20
|
+
</>; }`;
|
|
21
21
|
const { css } = compile(source, 'test.tsrx');
|
|
22
22
|
|
|
23
23
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ ::slotted\(span\) {/);
|
|
@@ -26,7 +26,7 @@ export component Test() {
|
|
|
26
26
|
|
|
27
27
|
it('handles :global with ::part()', () => {
|
|
28
28
|
const source = `
|
|
29
|
-
export
|
|
29
|
+
export function Test() { return <>
|
|
30
30
|
<div>{'content'}</div>
|
|
31
31
|
|
|
32
32
|
<style>
|
|
@@ -38,7 +38,7 @@ export component Test() {
|
|
|
38
38
|
border: 1px solid blue;
|
|
39
39
|
}
|
|
40
40
|
</style>
|
|
41
|
-
}`;
|
|
41
|
+
</>; }`;
|
|
42
42
|
const { css } = compile(source, 'test.tsrx');
|
|
43
43
|
|
|
44
44
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ ::part\(input\) {/);
|
|
@@ -47,7 +47,7 @@ export component Test() {
|
|
|
47
47
|
|
|
48
48
|
it('handles :global with :host and :host-context', () => {
|
|
49
49
|
const source = `
|
|
50
|
-
export
|
|
50
|
+
export function Test() { return <>
|
|
51
51
|
<div>{'content'}</div>
|
|
52
52
|
|
|
53
53
|
<style>
|
|
@@ -63,7 +63,7 @@ export component Test() {
|
|
|
63
63
|
background: black;
|
|
64
64
|
}
|
|
65
65
|
</style>
|
|
66
|
-
}`;
|
|
66
|
+
</>; }`;
|
|
67
67
|
const { css } = compile(source, 'test.tsrx');
|
|
68
68
|
|
|
69
69
|
expect(css).toContain(':host {');
|
|
@@ -73,7 +73,7 @@ export component Test() {
|
|
|
73
73
|
|
|
74
74
|
it('handles :global with complex :nth-* selectors', () => {
|
|
75
75
|
const source = `
|
|
76
|
-
export
|
|
76
|
+
export function Test() { return <>
|
|
77
77
|
<div>
|
|
78
78
|
<span>{'one'}</span>
|
|
79
79
|
<span>{'two'}</span>
|
|
@@ -93,7 +93,7 @@ export component Test() {
|
|
|
93
93
|
margin-top: 10px;
|
|
94
94
|
}
|
|
95
95
|
</style>
|
|
96
|
-
}`;
|
|
96
|
+
</>; }`;
|
|
97
97
|
const { css } = compile(source, 'test.tsrx');
|
|
98
98
|
|
|
99
99
|
expect(css).toContain('span:nth-child(odd) {');
|
|
@@ -103,7 +103,7 @@ export component Test() {
|
|
|
103
103
|
|
|
104
104
|
it('handles :global with language and directional pseudo-classes', () => {
|
|
105
105
|
const source = `
|
|
106
|
-
export
|
|
106
|
+
export function Test() { return <>
|
|
107
107
|
<div>{'content'}</div>
|
|
108
108
|
|
|
109
109
|
<style>
|
|
@@ -119,7 +119,7 @@ export component Test() {
|
|
|
119
119
|
quotes: '«' '»';
|
|
120
120
|
}
|
|
121
121
|
</style>
|
|
122
|
-
}`;
|
|
122
|
+
</>; }`;
|
|
123
123
|
const { css } = compile(source, 'test.tsrx');
|
|
124
124
|
|
|
125
125
|
expect(css).toContain(':lang(en) {');
|
|
@@ -129,7 +129,7 @@ export component Test() {
|
|
|
129
129
|
|
|
130
130
|
it('handles :global with :focus-within and :focus-visible', () => {
|
|
131
131
|
const source = `
|
|
132
|
-
export
|
|
132
|
+
export function Test() { return <>
|
|
133
133
|
<div>
|
|
134
134
|
<input type="text" />
|
|
135
135
|
</div>
|
|
@@ -143,7 +143,7 @@ export component Test() {
|
|
|
143
143
|
outline: 2px solid red;
|
|
144
144
|
}
|
|
145
145
|
</style>
|
|
146
|
-
}`;
|
|
146
|
+
</>; }`;
|
|
147
147
|
const { css } = compile(source, 'test.tsrx');
|
|
148
148
|
|
|
149
149
|
expect(css).toContain('div:focus-within {');
|
|
@@ -152,7 +152,7 @@ export component Test() {
|
|
|
152
152
|
|
|
153
153
|
it('handles :global with :any-link, :target, :scope', () => {
|
|
154
154
|
const source = `
|
|
155
|
-
export
|
|
155
|
+
export function Test() { return <>
|
|
156
156
|
<div>
|
|
157
157
|
<a href="#">{'link'}</a>
|
|
158
158
|
</div>
|
|
@@ -170,7 +170,7 @@ export component Test() {
|
|
|
170
170
|
border: 1px solid black;
|
|
171
171
|
}
|
|
172
172
|
</style>
|
|
173
|
-
}`;
|
|
173
|
+
</>; }`;
|
|
174
174
|
const { css } = compile(source, 'test.tsrx');
|
|
175
175
|
|
|
176
176
|
expect(css).toContain(':any-link {');
|
|
@@ -180,7 +180,7 @@ export component Test() {
|
|
|
180
180
|
|
|
181
181
|
it('handles :global with form-related pseudo-classes', () => {
|
|
182
182
|
const source = `
|
|
183
|
-
export
|
|
183
|
+
export function Test() { return <>
|
|
184
184
|
<form>
|
|
185
185
|
<input type="text" required />
|
|
186
186
|
<input type="checkbox" checked />
|
|
@@ -215,7 +215,7 @@ export component Test() {
|
|
|
215
215
|
border-color: red;
|
|
216
216
|
}
|
|
217
217
|
</style>
|
|
218
|
-
}`;
|
|
218
|
+
</>; }`;
|
|
219
219
|
const { css } = compile(source, 'test.tsrx');
|
|
220
220
|
|
|
221
221
|
expect(css).toContain('input:required {');
|
|
@@ -3,7 +3,7 @@ import { compile } from '@tsrx/ripple';
|
|
|
3
3
|
describe('CSS :global with @media and @supports', () => {
|
|
4
4
|
it('handles :global inside @media queries', () => {
|
|
5
5
|
const source = `
|
|
6
|
-
export
|
|
6
|
+
export function Test() { return <>
|
|
7
7
|
<div>{'content'}</div>
|
|
8
8
|
|
|
9
9
|
<style>
|
|
@@ -17,7 +17,7 @@ export component Test() {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
</style>
|
|
20
|
-
}`;
|
|
20
|
+
</>; }`;
|
|
21
21
|
const { css } = compile(source, 'test.tsrx');
|
|
22
22
|
|
|
23
23
|
expect(css).toContain('@media (min-width: 768px) {');
|
|
@@ -27,7 +27,7 @@ export component Test() {
|
|
|
27
27
|
|
|
28
28
|
it('handles :global inside @supports queries', () => {
|
|
29
29
|
const source = `
|
|
30
|
-
export
|
|
30
|
+
export function Test() { return <>
|
|
31
31
|
<div>{'content'}</div>
|
|
32
32
|
|
|
33
33
|
<style>
|
|
@@ -41,7 +41,7 @@ export component Test() {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
</style>
|
|
44
|
-
}`;
|
|
44
|
+
</>; }`;
|
|
45
45
|
const { css } = compile(source, 'test.tsrx');
|
|
46
46
|
|
|
47
47
|
expect(css).toContain('@supports (display: grid) {');
|
|
@@ -51,7 +51,7 @@ export component Test() {
|
|
|
51
51
|
|
|
52
52
|
it('handles nested @media with :global', () => {
|
|
53
53
|
const source = `
|
|
54
|
-
export
|
|
54
|
+
export function Test() { return <>
|
|
55
55
|
<div>{'content'}</div>
|
|
56
56
|
|
|
57
57
|
<style>
|
|
@@ -69,7 +69,7 @@ export component Test() {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
</style>
|
|
72
|
-
}`;
|
|
72
|
+
</>; }`;
|
|
73
73
|
const { css } = compile(source, 'test.tsrx');
|
|
74
74
|
|
|
75
75
|
expect(css).toContain('@media (min-width: 768px) {');
|
|
@@ -80,7 +80,7 @@ export component Test() {
|
|
|
80
80
|
|
|
81
81
|
it('handles :global in @container queries', () => {
|
|
82
82
|
const source = `
|
|
83
|
-
export
|
|
83
|
+
export function Test() { return <>
|
|
84
84
|
<div>{'content'}</div>
|
|
85
85
|
|
|
86
86
|
<style>
|
|
@@ -90,7 +90,7 @@ export component Test() {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
</style>
|
|
93
|
-
}`;
|
|
93
|
+
</>; }`;
|
|
94
94
|
const { css } = compile(source, 'test.tsrx');
|
|
95
95
|
|
|
96
96
|
expect(css).toContain('@container (min-width: 400px) {');
|
|
@@ -99,7 +99,7 @@ export component Test() {
|
|
|
99
99
|
|
|
100
100
|
it('handles multiple at-rules with :global', () => {
|
|
101
101
|
const source = `
|
|
102
|
-
export
|
|
102
|
+
export function Test() { return <>
|
|
103
103
|
<div>{'content'}</div>
|
|
104
104
|
|
|
105
105
|
<style>
|
|
@@ -115,7 +115,7 @@ export component Test() {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
</style>
|
|
118
|
-
}`;
|
|
118
|
+
</>; }`;
|
|
119
119
|
const { css } = compile(source, 'test.tsrx');
|
|
120
120
|
|
|
121
121
|
expect(css).toContain('@media screen {');
|