-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rule): update border radius rules
- Loading branch information
Showing
4 changed files
with
44 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import { EmptyKeyPlaceholder } from '../constants' | ||
import type { AtomicComposed, DynamicPropAtomicMap, PropsAtomicMap, StaticPropAtomicMap } from '../types' | ||
|
||
export const position = ['top', 'bottom', 'left', 'right'] | ||
export const positionShort = ['t', 'b', 'l', 'r'] | ||
|
||
export const positions: PropsAtomicMap[] = [ | ||
...position.map<StaticPropAtomicMap>((p, i) => [p, [p, positionShort[i]]]), | ||
['position', EmptyKeyPlaceholder, { separator: '' }], | ||
['z-index', 'z'], | ||
] | ||
|
||
export function createPos4Props(prop: string, atom: string, shortAtom?: string): DynamicPropAtomicMap { | ||
return [ | ||
new RegExp(`^${prop}-(top|bottom|left|right)(?:-\\w+)?$`), | ||
([, p]) => { | ||
const index = position.indexOf(p) | ||
if (index > -1) { | ||
return [atom, shortAtom].filter(Boolean).map(s => `${s}-${positionShort[index]}`) as AtomicComposed | ||
} | ||
return [atom, shortAtom].filter(Boolean).map(s => `${s}-${positionShort[index]}`) as AtomicComposed | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters