Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #481 from gluestack/release/@gluestack-style/react…
Browse files Browse the repository at this point in the history
…@1.0.6

Release/@gluestack style/[email protected]
  • Loading branch information
ankit-tailor authored Oct 16, 2023
2 parents 618ae8f + 159f79e commit 68a1888
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 67 deletions.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@gluestack-style/react",
"description": "A universal & performant styling library for React Native, Next.js & React",
"version": "1.0.5",
"version": "1.0.6",
"keywords": [
"React Native",
"Next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/StyledProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const StyledProvider: React.FC<{
colorMode?: COLORMODES;
children?: React.ReactNode;
globalStyles?: any;
_experimentalNestedProvider: boolean;
_experimentalNestedProvider?: boolean;
}> = ({
config,
colorMode,
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/core/styled-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const CSSPropertiesMap = {
borderTopWidth: '0',
borderEndWidth: '0',
borderStartWidth: '0',
borderEndEndRadius: '0',
borderStartStartRadius: '0',
borderStartEndRadius: '0',
borderEndStartRadius: '0',
borderWidth: '0',
bottom: 'auto',
direction: 'ltr',
Expand Down Expand Up @@ -65,6 +69,9 @@ export const CSSPropertiesMap = {
borderBottomLeftRadius: '0',
borderBottomRightRadius: '0',
borderColor: 'initial',
borderBlockColor: 'initial',
borderBlockEndColor: 'initial',
borderBlockStartColor: 'initial',
borderRadius: '0',
borderTopLeftRadius: '0',
borderTopRightRadius: '0',
Expand Down Expand Up @@ -92,6 +99,7 @@ export const CSSPropertiesMap = {
textShadowOffset: '0px 0px',
textShadowRadius: '0',
textAlignVertical: 'auto',
verticalAlign: 'auto',
letterSpacing: 'normal',
textDecorationColor: 'initial',
textDecorationStyle: 'solid',
Expand All @@ -101,6 +109,7 @@ export const CSSPropertiesMap = {
borderStartColor: 'initial',
borderTopEndRadius: '0',
borderTopStartRadius: '0',
userSelect: 'auto',
};

export const reservedKeys = {
Expand Down
10 changes: 10 additions & 0 deletions packages/react/src/propertyTokenMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,17 @@ export const propertyTokenMap = {
textDecorationColor: colors,
shadowColor: colors,

borderBlockColor: colors,
borderBlockEndColor: colors,
borderBlockStartColor: colors,

borderEndEndRadius: radii,
borderStartStartRadius: radii,
borderStartEndRadius: radii,
borderEndStartRadius: radii,

shadowOpacity: opacity,
opacity: opacity,

shadow: shadows,
// Media Query
Expand Down
8 changes: 1 addition & 7 deletions packages/react/src/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {
OrderedSXResolved,
StyleIds,
ComponentProps,
UtilityProps,
IVerbosedTheme,
ITheme,
ExtendedConfigType,
Expand Down Expand Up @@ -996,12 +995,7 @@ export function verboseStyled<P, Variants, ComCon>(
// sxHash: BUILD_TIME_sxHash = '',
...componentProps
}: Omit<
Omit<P, keyof Variants> &
Partial<ComponentProps<ITypeReactNativeStyles, Variants, P, ComCon>> &
Partial<UtilityProps<ITypeReactNativeStyles>> & {
as?: any;
children?: any;
},
ComponentProps<ITypeReactNativeStyles, Variants, P, ComCon>,
'animationComponentGluestack'
>,
ref: React.ForwardedRef<P>
Expand Down
125 changes: 67 additions & 58 deletions packages/react/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface Tokens {
breakpoints?: { [key: GenericKey]: Record<string, any> & {} };
mediaQueries?: { [key: GenericKey]: Record<string, any> & {} };
letterSpacings?: { [key: GenericKey]: Record<string, any> & {} };
opacity?: { [key: GenericKey]: Record<string, any> & {} };
lineHeights?: { [key: GenericKey]: any };
fontWeights?: { [key: GenericKey]: any };
fonts?: { [key: GenericKey]: any };
Expand Down Expand Up @@ -734,61 +735,71 @@ interface GenericComponents {
/********************* COMPONENT PROPS TYPE *****************************************/

export type ComponentProps<GenericComponentStyles, Variants, P, ComCon> =
SxStyleProps<
GenericComponentStyles,
Variants,
P,
'animationComponentGluestack' extends keyof P
? P['animationComponentGluestack'] extends true
? Plugins
: []
: []
> & {
states?: {
[K in IState]?: boolean;
};
} & (GSConfig['globalStyle'] extends object
? {
[Key in keyof MergeNestedThree<
GlobalVariants,
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>]?: keyof MergeNestedThree<
GlobalVariants,
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key] extends 'true' | 'false'
? boolean
: keyof MergeNestedThree<
GlobalVariants,
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key];
} & Omit<P, keyof Variants>
: {
[Key in keyof MergeNested<
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>]?: keyof MergeNested<
Variants, // @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key] extends 'true' | 'false'
? boolean
: keyof MergeNested<
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key];
});
Partial<
Omit<P, keyof Variants> &
SxStyleProps<
GenericComponentStyles,
Variants,
P,
'animationComponentGluestack' extends keyof P
? P['animationComponentGluestack'] extends true
? Plugins
: []
: []
> & {
as?: any;
children?: any;
} & UtilityProps<GenericComponentStyles, P> & {
states?: {
[K in IState]?: boolean;
};
} & (GSConfig['globalStyle'] extends object
? {
[Key in keyof MergeNestedThree<
GlobalVariants,
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>]?: keyof MergeNestedThree<
GlobalVariants,
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key] extends 'true' | 'false'
? boolean
: keyof MergeNestedThree<
GlobalVariants,
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key];
} & Omit<P, keyof Variants>
: {
[Key in keyof MergeNested<
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>]?: keyof MergeNested<
Variants, // @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key] extends 'true' | 'false'
? boolean
: keyof MergeNested<
Variants,
// @ts-ignore
Components[`${ComCon}`]['theme']['variants']
>[Key];
})
>;

export type UtilityProps<GenericComponentStyles> = TokenizedRNStyleProps<
GetRNStyles<GenericComponentStyles>
export type UtilityProps<GenericComponentStyles, GenericComponentProps> = Omit<
TokenizedRNStyleProps<GetRNStyles<GenericComponentStyles>>,
keyof GenericComponentProps
> &
AliasesProps<RNStyles<GenericComponentStyles>>;
Omit<
AliasesProps<RNStyles<GenericComponentStyles>>,
keyof GenericComponentProps
>;

/********************* UTILITY TYPE *****************************************/

Expand Down Expand Up @@ -887,14 +898,12 @@ export type ExtendRNStyle<GenericComponentStyles, key> =
GenericComponentStyles[key];

type WithSizeNegativeValue<Tokens> = keyof Tokens extends 'sizes'
? WithNegativeValue<
//@ts-expect-error
| StringifyToken<keyof Tokens['sizes']>
? //@ts-expect-error
| StringifyToken<keyof Tokens['sizes']>
//@ts-expect-error
| StringifyToken<keyof Tokens['space']>
>
: //@ts-expect-error
WithNegativeValue<StringifyToken<keyof Tokens['space']>>;
StringifyToken<keyof Tokens['space']>;

export type TokenizedRNStyleProps<
GenericComponentStyles,
Expand Down

0 comments on commit 68a1888

Please sign in to comment.