ripple 0.3.71 → 0.3.74
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 +75 -0
- package/package.json +3 -3
- package/src/jsx-runtime.d.ts +2 -8
- package/src/runtime/index-client.js +3 -13
- package/src/runtime/internal/client/blocks.js +3 -25
- package/src/runtime/internal/client/for.js +80 -5
- package/src/runtime/internal/client/index.js +0 -2
- package/src/runtime/internal/client/types.d.ts +0 -10
- package/tests/client/__snapshots__/computed-properties.test.tsrx.snap +8 -0
- package/tests/client/__snapshots__/for.test.tsrx.snap +22 -0
- package/tests/client/__snapshots__/html.test.tsrx.snap +4 -0
- package/tests/client/array/array.copy-within.test.tsrx +19 -19
- package/tests/client/array/array.derived.test.tsrx +97 -109
- package/tests/client/array/array.iteration.test.tsrx +28 -28
- package/tests/client/array/array.mutations.test.tsrx +68 -68
- package/tests/client/array/array.static.test.tsrx +82 -92
- package/tests/client/array/array.to-methods.test.tsrx +15 -15
- package/tests/client/async-suspend.test.tsrx +180 -179
- package/tests/client/basic/__snapshots__/basic.attributes.test.tsrx.snap +2 -0
- package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +4 -0
- package/tests/client/basic/basic.attributes.test.tsrx +273 -317
- package/tests/client/basic/basic.collections.test.tsrx +59 -71
- package/tests/client/basic/basic.components.test.tsrx +196 -222
- package/tests/client/basic/basic.errors.test.tsrx +72 -78
- package/tests/client/basic/basic.events.test.tsrx +80 -85
- package/tests/client/basic/basic.get-set.test.tsrx +54 -64
- package/tests/client/basic/basic.hmr.test.tsrx +15 -19
- package/tests/client/basic/basic.reactivity.test.tsrx +121 -135
- package/tests/client/basic/basic.rendering.test.tsrx +273 -178
- package/tests/client/basic/basic.utilities.test.tsrx +8 -10
- package/tests/client/boundaries.test.tsrx +18 -18
- package/tests/client/compiler/compiler.assignments.test.tsrx +77 -76
- package/tests/client/compiler/compiler.attributes.test.tsrx +18 -14
- package/tests/client/compiler/compiler.basic.test.tsrx +364 -296
- package/tests/client/compiler/compiler.regex.test.tsrx +40 -44
- package/tests/client/compiler/compiler.tracked-access.test.tsrx +57 -38
- package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
- package/tests/client/compiler/compiler.typescript.test.tsrx +4 -3
- package/tests/client/composite/composite.dynamic-components.test.tsrx +41 -44
- package/tests/client/composite/composite.generics.test.tsrx +165 -167
- package/tests/client/composite/composite.props.test.tsrx +66 -74
- package/tests/client/composite/composite.reactivity.test.tsrx +132 -166
- package/tests/client/composite/composite.render.test.tsrx +92 -101
- package/tests/client/computed-properties.test.tsrx +14 -18
- package/tests/client/context.test.tsrx +14 -18
- package/tests/client/css/global-additional-cases.test.tsrx +491 -437
- package/tests/client/css/global-advanced-selectors.test.tsrx +169 -153
- package/tests/client/css/global-at-rules.test.tsrx +71 -66
- package/tests/client/css/global-basic.test.tsrx +105 -98
- package/tests/client/css/global-classes-ids.test.tsrx +128 -114
- package/tests/client/css/global-combinators.test.tsrx +83 -78
- package/tests/client/css/global-complex-nesting.test.tsrx +134 -120
- package/tests/client/css/global-edge-cases.test.tsrx +138 -120
- package/tests/client/css/global-keyframes.test.tsrx +108 -96
- package/tests/client/css/global-nested.test.tsrx +88 -78
- package/tests/client/css/global-pseudo.test.tsrx +104 -98
- package/tests/client/css/global-scoping.test.tsrx +145 -125
- package/tests/client/css/style-identifier.test.tsrx +62 -69
- package/tests/client/date.test.tsrx +83 -83
- package/tests/client/dynamic-elements.test.tsrx +227 -283
- package/tests/client/events.test.tsrx +252 -266
- package/tests/client/for.test.tsrx +120 -127
- package/tests/client/head.test.tsrx +40 -48
- package/tests/client/html.test.tsrx +37 -49
- package/tests/client/input-value.test.tsrx +1125 -1354
- package/tests/client/lazy-array.test.tsrx +10 -16
- package/tests/client/lazy-destructuring.test.tsrx +169 -221
- package/tests/client/map.test.tsrx +39 -41
- package/tests/client/media-query.test.tsrx +15 -19
- package/tests/client/object.test.tsrx +46 -56
- package/tests/client/portal.test.tsrx +31 -37
- package/tests/client/ref.test.tsrx +173 -193
- package/tests/client/return.test.tsrx +62 -37
- package/tests/client/set.test.tsrx +33 -33
- package/tests/client/svg.test.tsrx +195 -215
- package/tests/client/switch.test.tsrx +201 -191
- package/tests/client/track-async-hydration.test.tsrx +14 -18
- package/tests/client/tracked-index-access.test.tsrx +18 -28
- package/tests/client/try.test.tsrx +494 -619
- package/tests/client/tsx.test.tsrx +290 -371
- package/tests/client/typescript-generics.test.tsrx +121 -129
- package/tests/client/url/url.derived.test.tsrx +21 -25
- package/tests/client/url/url.parsing.test.tsrx +35 -35
- package/tests/client/url/url.partial-removal.test.tsrx +32 -32
- package/tests/client/url/url.reactivity.test.tsrx +68 -72
- package/tests/client/url/url.serialization.test.tsrx +8 -8
- package/tests/client/url-search-params/url-search-params.derived.test.tsrx +21 -27
- package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +16 -16
- package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +37 -37
- package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +56 -60
- package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +32 -34
- package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +9 -9
- package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +10 -10
- package/tests/hydration/compiled/client/basic.js +396 -325
- package/tests/hydration/compiled/client/composite.js +52 -44
- package/tests/hydration/compiled/client/for.js +734 -604
- package/tests/hydration/compiled/client/head.js +183 -103
- package/tests/hydration/compiled/client/html.js +93 -86
- package/tests/hydration/compiled/client/if-children.js +95 -71
- package/tests/hydration/compiled/client/if.js +113 -89
- package/tests/hydration/compiled/client/mixed-control-flow.js +225 -209
- package/tests/hydration/compiled/client/nested-control-flow.js +94 -98
- package/tests/hydration/compiled/client/reactivity.js +26 -24
- package/tests/hydration/compiled/client/return.js +8 -42
- package/tests/hydration/compiled/client/switch.js +208 -173
- package/tests/hydration/compiled/client/track-async-serialization.js +176 -128
- package/tests/hydration/compiled/client/try.js +29 -21
- package/tests/hydration/compiled/server/basic.js +210 -221
- package/tests/hydration/compiled/server/composite.js +13 -14
- package/tests/hydration/compiled/server/for.js +427 -444
- package/tests/hydration/compiled/server/head.js +199 -189
- package/tests/hydration/compiled/server/html.js +33 -41
- package/tests/hydration/compiled/server/if-children.js +114 -117
- package/tests/hydration/compiled/server/if.js +77 -83
- package/tests/hydration/compiled/server/mixed-control-flow.js +145 -150
- package/tests/hydration/compiled/server/nested-control-flow.js +10 -0
- package/tests/hydration/compiled/server/reactivity.js +24 -22
- package/tests/hydration/compiled/server/return.js +6 -18
- package/tests/hydration/compiled/server/switch.js +179 -176
- package/tests/hydration/compiled/server/track-async-serialization.js +88 -70
- package/tests/hydration/compiled/server/try.js +31 -35
- package/tests/hydration/components/basic.tsrx +216 -286
- package/tests/hydration/components/composite.tsrx +32 -42
- package/tests/hydration/components/events.tsrx +81 -101
- package/tests/hydration/components/for.tsrx +270 -336
- package/tests/hydration/components/head.tsrx +43 -39
- package/tests/hydration/components/hmr.tsrx +16 -22
- package/tests/hydration/components/html-in-template.tsrx +15 -21
- package/tests/hydration/components/html.tsrx +442 -526
- package/tests/hydration/components/if-children.tsrx +107 -125
- package/tests/hydration/components/if.tsrx +68 -90
- package/tests/hydration/components/mixed-control-flow.tsrx +65 -72
- package/tests/hydration/components/nested-control-flow.tsrx +202 -216
- package/tests/hydration/components/portal.tsrx +33 -41
- package/tests/hydration/components/reactivity.tsrx +26 -34
- package/tests/hydration/components/return.tsrx +4 -6
- package/tests/hydration/components/switch.tsrx +73 -78
- package/tests/hydration/components/track-async-serialization.tsrx +83 -93
- package/tests/hydration/components/try.tsrx +37 -51
- package/tests/hydration/switch.test.js +8 -8
- package/tests/server/await.test.tsrx +3 -3
- package/tests/server/basic.attributes.test.tsrx +120 -167
- package/tests/server/basic.components.test.tsrx +163 -197
- package/tests/server/basic.test.tsrx +298 -220
- package/tests/server/compiler.test.tsrx +142 -72
- package/tests/server/composite.props.test.tsrx +54 -58
- package/tests/server/composite.test.tsrx +165 -167
- package/tests/server/context.test.tsrx +13 -17
- package/tests/server/dynamic-elements.test.tsrx +103 -135
- package/tests/server/for.test.tsrx +115 -84
- package/tests/server/head.test.tsrx +31 -31
- package/tests/server/html-nesting-validation.test.tsrx +16 -8
- package/tests/server/if.test.tsrx +49 -59
- package/tests/server/lazy-destructuring.test.tsrx +288 -366
- package/tests/server/return.test.tsrx +58 -36
- package/tests/server/streaming-ssr.test.tsrx +4 -4
- package/tests/server/style-identifier.test.tsrx +58 -66
- package/tests/server/switch.test.tsrx +89 -97
- package/tests/server/track-async-serialization.test.tsrx +85 -103
- package/tests/server/try.test.tsrx +275 -360
- package/tests/utils/ref-types.test.js +72 -0
- package/tests/utils/vite-plugin-config.test.js +41 -74
- package/types/index.d.ts +1 -0
- package/src/runtime/internal/client/compat.js +0 -40
- package/tests/utils/compiler-compat-config.test.js +0 -38
|
@@ -3,35 +3,37 @@ import { compile } from '@tsrx/ripple';
|
|
|
3
3
|
describe('CSS :global nested blocks', () => {
|
|
4
4
|
it('handles nested global blocks', () => {
|
|
5
5
|
const source = `
|
|
6
|
-
export function Test() {
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
export function Test() @{
|
|
7
|
+
<>
|
|
8
|
+
<div>
|
|
9
|
+
<p>{'content'}</p>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
div {
|
|
14
|
+
:global {
|
|
15
|
+
.x {
|
|
16
|
+
color: green;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:global(.x) {
|
|
15
21
|
color: green;
|
|
16
22
|
}
|
|
17
|
-
}
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
p :global {
|
|
25
|
+
.y {
|
|
26
|
+
color: green;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
.y {
|
|
30
|
+
p :global(.y) {
|
|
25
31
|
color: green;
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
</style>
|
|
34
|
-
</>; }`;
|
|
34
|
+
</style>
|
|
35
|
+
</>
|
|
36
|
+
}`;
|
|
35
37
|
const { css } = compile(source, 'test.tsrx');
|
|
36
38
|
|
|
37
39
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ {/);
|
|
@@ -44,29 +46,31 @@ export function Test() { return <>
|
|
|
44
46
|
|
|
45
47
|
it('handles :global with nesting selector', () => {
|
|
46
48
|
const source = `
|
|
47
|
-
export function Test() {
|
|
48
|
-
|
|
49
|
+
export function Test() @{
|
|
50
|
+
<>
|
|
51
|
+
<div class="x">{'content'}</div>
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
div {
|
|
55
|
+
:global {
|
|
56
|
+
&.x {
|
|
57
|
+
color: green;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
49
61
|
|
|
50
|
-
|
|
51
|
-
div {
|
|
52
|
-
:global {
|
|
62
|
+
div :global {
|
|
53
63
|
&.x {
|
|
54
64
|
color: green;
|
|
55
65
|
}
|
|
56
66
|
}
|
|
57
|
-
}
|
|
58
67
|
|
|
59
|
-
|
|
60
|
-
&.x {
|
|
68
|
+
div :global.x {
|
|
61
69
|
color: green;
|
|
62
70
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
color: green;
|
|
67
|
-
}
|
|
68
|
-
</style>
|
|
69
|
-
</>; }`;
|
|
71
|
+
</style>
|
|
72
|
+
</>
|
|
73
|
+
}`;
|
|
70
74
|
const { css } = compile(source, 'test.tsrx');
|
|
71
75
|
|
|
72
76
|
expect(css).toContain('&.x {');
|
|
@@ -75,23 +79,25 @@ export function Test() { return <>
|
|
|
75
79
|
|
|
76
80
|
it('handles global block with de-nested syntax', () => {
|
|
77
81
|
const source = `
|
|
78
|
-
export function Test() {
|
|
79
|
-
|
|
82
|
+
export function Test() @{
|
|
83
|
+
<>
|
|
84
|
+
<div><p>{'content'}</p></div>
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
<style>
|
|
87
|
+
:global div {
|
|
88
|
+
.y {
|
|
89
|
+
color: green;
|
|
90
|
+
}
|
|
85
91
|
}
|
|
86
|
-
}
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
div :global p {
|
|
94
|
+
.y {
|
|
95
|
+
color: green;
|
|
96
|
+
}
|
|
91
97
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
</style>
|
|
99
|
+
</>
|
|
100
|
+
}`;
|
|
95
101
|
const { css } = compile(source, 'test.tsrx');
|
|
96
102
|
|
|
97
103
|
expect(css).toContain('div {');
|
|
@@ -101,23 +107,25 @@ export function Test() { return <>
|
|
|
101
107
|
|
|
102
108
|
it('handles global local nested combinations', () => {
|
|
103
109
|
const source = `
|
|
104
|
-
export function Test() {
|
|
105
|
-
|
|
110
|
+
export function Test() @{
|
|
111
|
+
<>
|
|
112
|
+
<div>{'content'}</div>
|
|
106
113
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
<style>
|
|
115
|
+
div {
|
|
116
|
+
:global(.whatever) {
|
|
117
|
+
color: green;
|
|
118
|
+
}
|
|
111
119
|
}
|
|
112
|
-
}
|
|
113
120
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
:global(.whatever) {
|
|
122
|
+
div {
|
|
123
|
+
color: green;
|
|
124
|
+
}
|
|
117
125
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
</style>
|
|
127
|
+
</>
|
|
128
|
+
}`;
|
|
121
129
|
const { css } = compile(source, 'test.tsrx');
|
|
122
130
|
|
|
123
131
|
expect(css).toContain('.whatever {');
|
|
@@ -127,21 +135,23 @@ export function Test() { return <>
|
|
|
127
135
|
|
|
128
136
|
it('handles :global with :is and :where pseudoclasses', () => {
|
|
129
137
|
const source = `
|
|
130
|
-
export function Test() {
|
|
131
|
-
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
export function Test() @{
|
|
139
|
+
<>
|
|
140
|
+
<div>
|
|
141
|
+
<span>{'content'}</span>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<style>
|
|
145
|
+
div :global(:is(span)) {
|
|
146
|
+
color: green;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:global(.foo) :is(div) {
|
|
150
|
+
color: green;
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
153
|
+
</>
|
|
154
|
+
}`;
|
|
145
155
|
const { css } = compile(source, 'test.tsrx');
|
|
146
156
|
|
|
147
157
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ :is\(span\) {/);
|
|
@@ -3,21 +3,22 @@ import { compile } from '@tsrx/ripple';
|
|
|
3
3
|
describe('CSS :global with pseudo-classes', () => {
|
|
4
4
|
it('handles :global with :has()', () => {
|
|
5
5
|
const source = `
|
|
6
|
-
export function Test() {
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
export function Test() @{
|
|
7
|
+
<>
|
|
8
|
+
<div>
|
|
9
|
+
<span>{'content'}</span>
|
|
10
|
+
</div>
|
|
11
|
+
<style>
|
|
12
|
+
div:has(:global(span)) {
|
|
13
|
+
color: red;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:global(div:has(span)) {
|
|
17
|
+
color: blue;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
</>
|
|
21
|
+
}`;
|
|
21
22
|
const { css } = compile(source, 'test.tsrx');
|
|
22
23
|
|
|
23
24
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+:has\(span\)/);
|
|
@@ -26,22 +27,23 @@ export function Test() { return <>
|
|
|
26
27
|
|
|
27
28
|
it('handles :global with :is()', () => {
|
|
28
29
|
const source = `
|
|
29
|
-
export function Test() {
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
export function Test() @{
|
|
31
|
+
<>
|
|
32
|
+
<div>
|
|
33
|
+
<span>{'one'}</span>
|
|
34
|
+
<p>{'two'}</p>
|
|
35
|
+
</div>
|
|
36
|
+
<style>
|
|
37
|
+
div :is(:global(span), p) {
|
|
38
|
+
color: red;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:global(div:is(.foo, .bar)) {
|
|
42
|
+
color: blue;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
</>
|
|
46
|
+
}`;
|
|
45
47
|
const { css } = compile(source, 'test.tsrx');
|
|
46
48
|
|
|
47
49
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ :is\(span, p:where\(\.tsrx-[a-z0-9]+\)\) {/);
|
|
@@ -52,22 +54,23 @@ export function Test() { return <>
|
|
|
52
54
|
|
|
53
55
|
it('handles :global with :where()', () => {
|
|
54
56
|
const source = `
|
|
55
|
-
export function Test() {
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
export function Test() @{
|
|
58
|
+
<>
|
|
59
|
+
<div>
|
|
60
|
+
<span>{'one'}</span>
|
|
61
|
+
<p>{'two'}</p>
|
|
62
|
+
</div>
|
|
63
|
+
<style>
|
|
64
|
+
div :where(:global(span), p) {
|
|
65
|
+
color: red;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:global(div:where(.foo, .bar)) {
|
|
69
|
+
color: blue;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
72
|
+
</>
|
|
73
|
+
}`;
|
|
71
74
|
const { css } = compile(source, 'test.tsrx');
|
|
72
75
|
|
|
73
76
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+ :where\(span, p:where\(\.tsrx-[a-z0-9]+\)\) {/);
|
|
@@ -78,21 +81,22 @@ export function Test() { return <>
|
|
|
78
81
|
|
|
79
82
|
it('handles :global with :not()', () => {
|
|
80
83
|
const source = `
|
|
81
|
-
export function Test() {
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
export function Test() @{
|
|
85
|
+
<>
|
|
86
|
+
<div>
|
|
87
|
+
<span>{'content'}</span>
|
|
88
|
+
</div>
|
|
89
|
+
<style>
|
|
90
|
+
div:not(:global(span)) {
|
|
91
|
+
color: red;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:global(div:not(.foo)) {
|
|
95
|
+
color: blue;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
98
|
+
</>
|
|
99
|
+
}`;
|
|
96
100
|
const { css } = compile(source, 'test.tsrx');
|
|
97
101
|
|
|
98
102
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+:not\(span\)/);
|
|
@@ -101,21 +105,22 @@ export function Test() { return <>
|
|
|
101
105
|
|
|
102
106
|
it('handles nested pseudo-classes with :global', () => {
|
|
103
107
|
const source = `
|
|
104
|
-
export function Test() {
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
export function Test() @{
|
|
109
|
+
<>
|
|
110
|
+
<div>
|
|
111
|
+
<span>{'content'}</span>
|
|
112
|
+
</div>
|
|
113
|
+
<style>
|
|
114
|
+
div:is(:has(:global(span))) {
|
|
115
|
+
color: red;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:global(div:where(:is(.foo))) {
|
|
119
|
+
color: blue;
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
122
|
+
</>
|
|
123
|
+
}`;
|
|
119
124
|
const { css } = compile(source, 'test.tsrx');
|
|
120
125
|
|
|
121
126
|
expect(css).toMatch(/div\.tsrx-[a-z0-9]+:is\(:where\(\.tsrx-[a-z0-9]+\):has\(span\)\) {/);
|
|
@@ -124,27 +129,28 @@ export function Test() { return <>
|
|
|
124
129
|
|
|
125
130
|
it('handles :global with :nth-child and other structural pseudo-classes', () => {
|
|
126
131
|
const source = `
|
|
127
|
-
export function Test() {
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
132
|
+
export function Test() @{
|
|
133
|
+
<>
|
|
134
|
+
<div>
|
|
135
|
+
<span>{'one'}</span>
|
|
136
|
+
<span>{'two'}</span>
|
|
137
|
+
<span>{'three'}</span>
|
|
138
|
+
</div>
|
|
139
|
+
<style>
|
|
140
|
+
:global(span):nth-child(2) {
|
|
141
|
+
color: red;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
div > :global(span:first-child) {
|
|
145
|
+
color: blue;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:global(div):last-child {
|
|
149
|
+
color: green;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
</>
|
|
153
|
+
}`;
|
|
148
154
|
const { css } = compile(source, 'test.tsrx');
|
|
149
155
|
|
|
150
156
|
expect(css).toContain('span:nth-child(2) {');
|