Skip to content

Commit 34b5c48

Browse files
authored
fix(preset-wind4): fix ring offset size rule (#4741)
1 parent 8fa9e3c commit 34b5c48

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages-presets/preset-wind4/src/rules/ring.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export const rings: Rule<Theme>[] = [
3737
[/^inset-ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ '--un-inset-ring-opacity': h.bracket.percent.cssvar(opacity) }), { autocomplete: 'inset-ring-(op|opacity)-<percent>' }],
3838

3939
// offset
40-
[/^ring-offset(?:-(.+))?$/, ([, d]) => {
41-
const v = h.bracket.px(d || '1')
40+
[/^ring-offset(?:-(?:width-|size-)?(.+))?$/, ([, d]) => {
41+
const v = h.bracket.cssvar.px(d || '1')
4242
if (v != null) {
4343
return {
4444
'--un-ring-offset-width': v,
@@ -48,7 +48,6 @@ export const rings: Rule<Theme>[] = [
4848
}, { autocomplete: 'ring-offset-$colors' }],
4949
[/^ring-offset-(.+)$/, colorResolver(`--un-ring-offset-color`, 'ring-offset'), { autocomplete: 'ring-offset-$colors' }],
5050
[/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ '--un-ring-offset-opacity': h.bracket.percent.cssvar(opacity) }), { autocomplete: 'ring-offset-(op|opacity)-<percent>' }],
51-
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ '--un-ring-offset-width': h.bracket.cssvar.px(d) })],
5251

5352
// style
5453
['ring-inset', { '--un-ring-inset': 'inset' }],

test/assets/output/preset-wind4-targets.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@property --un-contain-style{syntax:"*";inherits:false;}
2323
@property --un-content{syntax:"*";inherits:false;initial-value:"";}
2424
@property --un-ring-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
25+
@property --un-ring-offset-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
2526
@property --un-shadow-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
2627
@property --un-inset-ring-color{syntax:"*";inherits:false;}
2728
@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}
@@ -1006,12 +1007,12 @@ unocss .scope-\[unocss\]\:block{display:block;}
10061007
.ring-op-\$opacity-variable{--un-ring-opacity:var(--opacity-variable);}
10071008
.ring-op-5{--un-ring-opacity:5%;}
10081009
.ring-offset{--un-ring-offset-width:1px;--un-ring-offset-shadow:var(--un-ring-inset,) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);}
1010+
.ring-offset-4{--un-ring-offset-width:4px;--un-ring-offset-shadow:var(--un-ring-inset,) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);}
1011+
.ring-offset-size-\$variable,
1012+
.ring-offset-width-\$variable{--un-ring-offset-width:var(--variable);--un-ring-offset-shadow:var(--un-ring-inset,) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);}
1013+
.ring-offset-\$variable{--un-ring-offset-color:color-mix(in oklab, var(--variable) var(--un-ring-offset-opacity), transparent) /* var(--variable) */;}
10091014
.ring-offset-op-\$opacity-variable{--un-ring-offset-opacity:var(--opacity-variable);}
10101015
.ring-offset-op-5{--un-ring-offset-opacity:5%;}
1011-
.ring-offset-\$variable,
1012-
.ring-offset-size-\$variable,
1013-
.ring-offset-width-\$variable{--un-ring-offset-width:var(--variable);}
1014-
.ring-offset-4{--un-ring-offset-width:4px;}
10151016
.ring-inset{--un-ring-inset:inset;}
10161017
.shadow{--un-shadow:0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / 0.1)),0 1px 2px -1px var(--un-shadow-color, rgb(0 0 0 / 0.1));box-shadow:var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow);}
10171018
.shadow-\[\#fff\]{--un-shadow-color:color-mix(in oklab, #fff var(--un-shadow-opacity), transparent) /* #fff */;}

0 commit comments

Comments
 (0)