Skip to content

Commit

Permalink
fix(preset-mini): fix support for bracket in variable variant (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
chu121su12 committed Jun 25, 2022
1 parent fc2ed5b commit 7935399
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/preset-mini/src/variants/misc.ts
Expand Up @@ -56,7 +56,7 @@ export const variantScope: Variant = {
export const variantVariables: Variant = {
name: 'variables',
match(matcher) {
const match = matcher.match(/^(\[[^\]]+\]):/)
const match = matcher.match(/^(\[.+?\]):/)
if (match) {
const variant = h.bracket(match[1]) ?? ''
const updates = variant.startsWith('@')
Expand Down
2 changes: 2 additions & 0 deletions test/__snapshots__/preset-mini.test.ts.snap
Expand Up @@ -71,6 +71,8 @@ div:hover .group-\\\\[div\\\\:hover\\\\]-\\\\[combinator\\\\:test-4\\\\]{combina
.\\\\!m-\\\\$c-m{margin:var(--c-m) !important;}
.\\\\[\\\\&_\\\\&\\\\]\\\\:m-13 .\\\\[\\\\&_\\\\&\\\\]\\\\:m-13{margin:3.25rem;}
.\\\\[\\\\&\\\\:nth-child\\\\(2\\\\)\\\\]\\\\:m-10:nth-child(2){margin:2.5rem;}
.\\\\[\\\\&\\\\[open\\\\]\\\\]\\\\:m-14[open]{margin:3.5rem;}
.\\\\[\\\\&\\\\[readonly\\\\]\\\\[disabled\\\\]\\\\]\\\\:m-15[readonly][disabled]{margin:3.75rem;}
.\\\\[\\\\&\\\\>\\\\*\\\\]\\\\:m-11>*{margin:2.75rem;}
.all\\\\:m-auto *,
.children\\\\:m-auto>*,
Expand Down
2 changes: 2 additions & 0 deletions test/assets/preset-mini-targets.ts
Expand Up @@ -878,6 +878,8 @@ export const presetMiniTargets: string[] = [
'[&>*]:m-11',
'[*>&]:m-12',
'[&_&]:m-13',
'[&[open]]:m-14',
'[&[readonly][disabled]]:m-15',
'[@supports(display:grid)]:bg-red/33',
'[@supports(display:grid)]:[*+&]:bg-red/34',

Expand Down

0 comments on commit 7935399

Please sign in to comment.