Skip to content

Commit

Permalink
feat(preset-mini): support font-size-
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 2, 2023
1 parent f1675ce commit 3addbfe
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/_rules/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const fonts: Rule<Theme>[] = [
},
{ autocomplete: 'text-$fontSize' },
],
[/^text-size-(.+)$/, ([, s], { theme }) => {
[/^(?:text|font)-size-(.+)$/, ([, s], { theme }) => {
const themed = toArray(theme.fontSize?.[s])
const size = themed?.[0] ?? h.bracket.cssvar.global.rem(s)
if (size != null)
Expand Down
2 changes: 2 additions & 0 deletions test/assets/output/preset-mini-targets.css
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ unocss .scope-\[unocss\]\:block{display:block;}
.peer:is(:placeholder-shown)~.peer-is-placeholder-shown\:text-3xl,
.peer:not(:placeholder-shown)~.peer-not-placeholder-shown\:text-3xl{font-size:1.875rem;line-height:2.25rem;}
.peer:not(:placeholder-shown)~.peer-not-placeholder-shown\:text-2xl{font-size:1.5rem;line-height:2rem;}
.font-size-1\.5rem{font-size:1.5rem;}
.text-size-1em{font-size:1em;}
.text-size-unset{font-size:unset;}
.as-parent .group .group-\[\.as-parent_\&\]\:font-13{font-weight:13;}
.as-parent .group\/label .group-\[\.as-parent_\&\]\/label\:font-18{font-weight:18;}
Expand Down
2 changes: 2 additions & 0 deletions test/assets/preset-mini-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ export const presetMiniTargets: string[] = [
'text-[11px]/4',
'text-[12px]/[13px]',
'text-[length:var(--size)]:$leading',
'text-size-1em',
'font-size-1.5rem',

// color - bg
'bg-[#153]/10',
Expand Down

0 comments on commit 3addbfe

Please sign in to comment.