Skip to content

Commit

Permalink
feat(preset-mini): support pos- prefix for z-index
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 8, 2023
1 parent bf434f3 commit 731a8c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/preset-mini/src/_rules/position.ts
Expand Up @@ -140,8 +140,8 @@ export const floats: Rule[] = [
]

export const zIndexes: Rule[] = [
[/^z([\d.]+)$/, ([, v]) => ({ 'z-index': h.number(v) })],
[/^z-(.+)$/, ([, v]) => ({ 'z-index': h.bracket.cssvar.global.auto.number(v) }), { autocomplete: 'z-<num>' }],
[/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ 'z-index': h.number(v) })],
[/^(?:position-|pos-)?z-(.+)$/, ([, v]) => ({ 'z-index': h.bracket.cssvar.global.auto.number(v) }), { autocomplete: 'z-<num>' }],
]

export const boxSizing: Rule[] = [
Expand Down
6 changes: 4 additions & 2 deletions test/__snapshots__/preset-mini.test.ts.snap
Expand Up @@ -829,11 +829,13 @@ unocss .scope-\\\\[unocss\\\\]\\\\:block{display:block;}
.clear-revert{clear:revert;}
.z-0,
.z0{z-index:0;}
.-z-1{z-index:-1;}
.-z-1,
.pos-z--1{z-index:-1;}
.position-z-auto,
.z-auto{z-index:auto;}
.z-\\\\$variable{z-index:var(--variable);}
.z-1{z-index:1;}
.z-100{z-index:100;}
.z-auto{z-index:auto;}
.z-inherit{z-index:inherit;}
.box-border{box-sizing:border-box;}
.box-content{box-sizing:content-box;}
Expand Down
10 changes: 7 additions & 3 deletions test/assets/preset-mini-targets.ts
Expand Up @@ -388,15 +388,19 @@ export const presetMiniTargets: string[] = [
'clear-both',
'clear-none',
'clear-revert',
'box-content',
'box-border',
'box-inherit',

// position - z-index
'z0',
'z-0',
'z-1',
'z-100',
'z-auto',
'z-inherit',
'box-content',
'box-border',
'box-inherit',
'pos-z--1',
'position-z-auto',

// ring, shadow
'ring',
Expand Down

0 comments on commit 731a8c9

Please sign in to comment.