Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some missed scales and aliases #295

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/dripsy/src/core/css/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@ const transforms = [
const filterWebStyleKeys = (
styleProp: Exclude<SxProps, UseThemeFunction> = {}
): Exclude<SxProps, UseThemeFunction> => {
if (Platform.OS == 'web') {
if (Platform.OS === 'web') {
return styleProp
}

// avoid prop mutations
const finalStyles = { ...styleProp }
const webOnlyKeys = [
// from https://necolas.github.io/react-native-web/docs/styling/#non-standard-properties
// and https://github.com/necolas/react-native-web/blob/HEAD/packages/react-native-web/src/exports/View/types.js#L193
'animationKeyframes',
'animationFillMode',
'transitionProperty',
Expand All @@ -164,6 +165,9 @@ const filterWebStyleKeys = (
'animationDirection',
'animationIterationCount',
'outlineColor',
'outlineOffset',
'outlineStyle',
'outlineWidth',
]
webOnlyKeys.forEach((key) => {
if (finalStyles?.[key as keyof typeof styleProp]) {
Expand Down
14 changes: 14 additions & 0 deletions packages/dripsy/src/core/css/scales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export const aliases = {
pos: 'position',
t: 'top',
r: 'right',
e: 'end',
b: 'bottom',
l: 'left',
s: 'start',

ov: 'overflow',
ox: 'overflowX',
Expand Down Expand Up @@ -41,15 +43,19 @@ export const aliases = {
m: 'margin',
mt: 'marginTop',
mr: 'marginRight',
me: 'marginEnd',
mb: 'marginBottom',
ml: 'marginLeft',
ms: 'marginStart',
mx: 'marginHorizontal',
my: 'marginVertical',
p: 'padding',
pt: 'paddingTop',
pr: 'paddingRight',
pe: 'paddingEnd',
pb: 'paddingBottom',
pl: 'paddingLeft',
ps: 'paddingStart',
px: 'paddingHorizontal',
py: 'paddingVertical',

Expand Down Expand Up @@ -104,6 +110,12 @@ export const scales = {
// RN SPECIFIC SCALES FIRST
textShadowColor: 'colors',
shadowColor: 'colors',
marginEnd: 'space',
marginStart: 'space',
paddingEnd: 'space',
paddingStart: 'space',
end: 'space',
start: 'space',
// REST
color: 'colors',
backgroundColor: 'colors',
Expand Down Expand Up @@ -210,6 +222,8 @@ export const scales = {
borderStartEndRadius: 'radii',
borderStartStartRadius: 'radii',
outlineColor: 'colors',
outlineWidth: 'borderWidths',
outlineStyle: 'borderStyles',
boxShadow: 'shadows',
textShadow: 'shadows',
zIndex: 'zIndices',
Expand Down
4 changes: 2 additions & 2 deletions packages/dripsy/src/core/types-v2/sx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ export type MaybeVariantsFromThemeKey<
// testString('alignItems', false as never)
// #endregion

type VariantProp<
ThemeKey extends keyof DripsyFinalTheme | undefined | 'missing'
export type VariantProp<
ThemeKey extends keyof DripsyFinalTheme | undefined | 'missing' = 'missing'
> = ThemeKey extends 'missing' | undefined
? Variant
: ThemeKey extends keyof DripsyFinalTheme
Expand Down