Skip to content

Commit

Permalink
feat: add more global keywords unocss/unocss#1171
Browse files Browse the repository at this point in the history
  • Loading branch information
MellowCo committed Jul 10, 2022
1 parent 7677393 commit bc70a23
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/rules/border.ts
Expand Up @@ -2,7 +2,7 @@ import type { CSSEntries, CSSObject, Rule, RuleContext } from '@unocss/core'
import type { Theme } from '../theme'
import { colorOpacityToString, colorToString, cornerMap, directionMap, globalKeywords, handler as h, hasParseableColor, parseColor } from '../utils'

const borderStyles = ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none', 'groove', 'ridge', 'inset', 'outset', ...globalKeywords]
export const borderStyles = ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none', 'groove', 'ridge', 'inset', 'outset', ...globalKeywords]

export const borders: Rule[] = [
// compound
Expand Down
10 changes: 5 additions & 5 deletions src/rules/typography.ts
Expand Up @@ -63,11 +63,11 @@ export const fonts: Rule<Theme>[] = [
],

// synthesis
[
/^font-synthesis-(.+)$/,
([, s]) => ({ 'font-synthesis': s }),
{ autocomplete: 'font-synthesis-(none|weight|style|small-caps)' },
],
['font-synthesis-weight', { 'font-synthesis': 'weight' }],
['font-synthesis-style', { 'font-synthesis': 'style' }],
['font-synthesis-small-caps', { 'font-synthesis': 'small-caps' }],
['font-synthesis-none', { 'font-synthesis': 'none' }],
[/^font-synthesis-(.+)$/, ([, s]) => ({ 'font-synthesis': h.bracket.cssvar.global(s) })],

// tracking
[
Expand Down
6 changes: 4 additions & 2 deletions test/__snapshots__/preset-mini.test.ts.snap
Expand Up @@ -300,9 +300,11 @@ div:hover .group-\\\\[div\\\\:hover\\\\]-\\\\[combinator\\\\:test-4\\\\]{combina
.lh-\\\\$variable{line-height:var(--variable);}
.leading-inherit{line-height:inherit;}
.lh-\\\\[1\\\\.5\\\\]{line-height:1.5;}
.font-synthesis-inherit{font-synthesis:inherit;}
.font-synthesis-small-caps{font-synthesis:small-caps;}
.font-synthesis-weight{font-synthesis:weight;}
.font-synthesis-small-caps{font-synthesis:small-caps;}
.font-synthesis-\\\\[weight_style\\\\]{font-synthesis:weight style;}
.font-synthesis-\\\\$synth{font-synthesis:var(--synth);}
.font-synthesis-inherit{font-synthesis:inherit;}
.font-tracking-1em{letter-spacing:1em;}
.tracking-\\\\[2\\\\/5\\\\]{letter-spacing:2/5;}
.tracking-\\\\$variable{letter-spacing:var(--variable);}
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/preset-weapp.test.ts.snap
Expand Up @@ -393,8 +393,8 @@ exports[`preset-weapp > typography 1`] = `
.font-leading-2,
.leading-2{line-height:16rpx;}
.leading-inherit{line-height:inherit;}
.font-synthesis-small-caps{font-synthesis:small-caps;}
.font-synthesis-weight{font-synthesis:weight;}
.font-synthesis-small-caps{font-synthesis:small-caps;}
.font-tracking-1em{letter-spacing:1em;}
.tracking-2{letter-spacing:16rpx;}
.tracking-inherit{letter-spacing:inherit;}
Expand Down
2 changes: 2 additions & 0 deletions test/assets/preset-mini-targets.ts
Expand Up @@ -721,6 +721,8 @@ export const presetMiniTargets: string[] = [
'font-50',
'font-synthesis-weight',
'font-synthesis-small-caps',
'font-synthesis-[weight_style]',
'font-synthesis-$synth',
'font-synthesis-inherit',
'font-inherit',
'fw-900',
Expand Down

0 comments on commit bc70a23

Please sign in to comment.