-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Also add utilities: animationDuration, animationTimingFunction, maskSize. - Add a new option "multiple" on `style` for comma separated values. "shorthand" remain for space separated values. - Add "cssProps" option on `style`. Useful to specify which css properties must be interpolated when using `css` or `styled`. - Introduce `createCss` function to create a complete set of binded xstyled functions. BREAKING CHANGE: - Remove `x.extend` - Remove `createX` - TypeScript: use `Theme` from `@xstyled/system` everywhere.
- Loading branch information
Showing
45 changed files
with
657 additions
and
737 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,7 +1,6 @@ | ||
export * from './breakpoints' | ||
export * from './colorModes' | ||
export * from './createBox' | ||
export * from './propGetters' | ||
export * from './transform' | ||
export * from './theme' | ||
export * from './types' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { StyleGenerator } from '@xstyled/system' | ||
import { createCssFunction, XCSSFunction } from './createCssFunction' | ||
import { createX, X } from './createX' | ||
import { createStyled, XStyled } from './createStyled' | ||
import { | ||
createCreateGlobalStyle, | ||
XCreateGlobalStyle, | ||
} from './createCreateGlobalStyle' | ||
import { createCx, Cx } from './createCx' | ||
import { createJsx, XJsx } from './createJsx' | ||
|
||
interface XStyledSet<TGen extends StyleGenerator> { | ||
css: XCSSFunction | ||
x: X<TGen> | ||
styled: XStyled<TGen> | ||
createGlobalStyle: XCreateGlobalStyle | ||
cx: Cx | ||
jsx: XJsx | ||
} | ||
|
||
export const createCss = <TGen extends StyleGenerator>( | ||
generator: TGen, | ||
): XStyledSet<TGen> => { | ||
return { | ||
css: createCssFunction(generator), | ||
x: createX(generator), | ||
styled: createStyled(generator), | ||
createGlobalStyle: createCreateGlobalStyle(generator), | ||
cx: createCx(generator), | ||
jsx: createJsx(generator), | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import * as React from 'react' | ||
import { Global, useTheme } from '@emotion/react' | ||
import { StyleGenerator } from '@xstyled/system' | ||
import { createCssFunction, XCSSFunction } from './createCssFunction' | ||
|
||
export interface XCreateGlobalStyle<P extends object = {}> { | ||
(...styles: Parameters<XCSSFunction>): React.FC<P> | ||
} | ||
|
||
export const createCreateGlobalStyle = <TGen extends StyleGenerator>( | ||
generator: TGen, | ||
): XCreateGlobalStyle => { | ||
const css = createCssFunction(generator) | ||
return <P extends object = {}>(...styles: Parameters<typeof css>) => { | ||
const GlobalStyle = (props: P) => { | ||
const theme = useTheme() | ||
return <Global styles={css(...styles)({ theme, ...props })} /> | ||
} | ||
GlobalStyle.displayName = 'GlobalStyle' | ||
return GlobalStyle | ||
} | ||
} |
Oops, something went wrong.