-
-
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.
feat(styled-components): upgrade to use s-c v6
BREAKING CHANGE: update internals and migrate usages accordingly.
- Loading branch information
Showing
26 changed files
with
173 additions
and
129 deletions.
There are no files selected for viewing
Binary file added
BIN
+18.6 KB
.yarn/cache/@emotion-is-prop-valid-npm-1.2.2-53f93f2b2d-61f6b128ea.zip
Binary file not shown.
Binary file removed
BIN
-3.09 KB
.yarn/cache/@types-hoist-non-react-statics-npm-3.3.1-c0081332b2-2c0778570d.zip
Binary file not shown.
Binary file removed
BIN
-8.46 KB
.yarn/cache/@types-styled-components-npm-5.1.26-aabda06611-84f53b3101.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+557 KB
.yarn/cache/styled-components-npm-6.1.10-test.0-4a9f9f76e2-05bd9b2de0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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 |
---|---|---|
@@ -1,22 +1,19 @@ | ||
/* eslint-disable no-continue, no-loop-func, no-cond-assign */ | ||
import { | ||
css as scCss, | ||
FlattenSimpleInterpolation, | ||
ThemedCssFunction, | ||
} from 'styled-components' | ||
import { StyleGenerator, Theme } from '@xstyled/system' | ||
import { flattenStrings } from '@xstyled/util' | ||
import { createTransform } from '@xstyled/core' | ||
import { StyleGenerator } from '@xstyled/system' | ||
import { flattenStrings } from '@xstyled/util' | ||
import { css as scCss } from 'styled-components' | ||
|
||
export type XCSSFunction = ThemedCssFunction<Theme> | ||
export type XCSSFunction = typeof scCss | ||
|
||
export const createCssFunction = <TGen extends StyleGenerator>( | ||
generator: TGen, | ||
): XCSSFunction => { | ||
const transform = createTransform(generator) | ||
return ((...args: Parameters<XCSSFunction>) => { | ||
const scCssArgs = scCss(...args) | ||
|
||
return <Props extends object>(...args: Parameters<XCSSFunction>) => { | ||
const scCssArgs = scCss<Props>(...args) | ||
const flattenedArgs = flattenStrings(scCssArgs as any[]) | ||
return flattenedArgs.map(transform) as FlattenSimpleInterpolation | ||
}) as XCSSFunction | ||
return flattenedArgs.map(transform) as ReturnType<typeof scCss<Props>> | ||
} | ||
} |
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
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,6 +1,6 @@ | ||
import styled from 'styled-components' | ||
import styled, { Styled } from 'styled-components' | ||
|
||
// Provide interop since `styled-components` does not work out of the box with ESM | ||
export const scStyled = | ||
// @ts-ignore | ||
typeof styled === 'function' ? styled : styled.default | ||
// @ts-expect-error | ||
(typeof styled === 'function' ? styled : styled.default) as Styled |
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
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
Oops, something went wrong.