Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7ba8d1

Browse files
authored
fix(transformer-directives): implicitly :where() selector in apply (#4913)
1 parent c40987a commit b7ba8d1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

packages-presets/transformer-directives/src/apply.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ export async function parseApply({ code, uno, applyVariable }: TransformerDirect
116116
const [first, ...parentSelectors] = parent.split(' $$ ').reverse()
117117
css = `${parentSelectors.reduce((p, c, i) => i === parentSelectors.length - 1 ? `${p}{${c}{${css}}}${'}'.repeat(i)}` : `${p}{${c}`, first)}`
118118
}
119+
else if (parent === '.\\-') {
120+
css = `${className}{${css}}`
121+
}
119122
else {
120123
css = `${parent}{${css}}`
121124
}

test/transformer-directives.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,25 @@ describe('wind4', () => {
16001600
"
16011601
`)
16021602
})
1603+
1604+
it('implicitly :where() selector in apply', async () => {
1605+
const result = await transform(`.foo { @apply space-y-reverse divide-dotted; }`)
1606+
1607+
await expect(result).toMatchInlineSnapshot(`
1608+
".foo {
1609+
:where(& > :not(:last-child)) {
1610+
--un-space-y-reverse: 1;
1611+
border-style: dotted;
1612+
}
1613+
}
1614+
@property --un-space-y-reverse {
1615+
syntax: "*";
1616+
inherits: false;
1617+
initial-value: 0;
1618+
}
1619+
"
1620+
`)
1621+
})
16031622
})
16041623

16051624
describe('transformer screen', async () => {

0 commit comments

Comments
 (0)