-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ | |
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.4.0", | ||
"@types/react": "^18.0.21", | ||
"@types/styled-components": "^5.1.26", | ||
"@typescript-eslint/eslint-plugin": "^5.39.0", | ||
"@typescript-eslint/parser": "^5.39.0", | ||
"babel-jest": "^29.1.2", | ||
|
@@ -49,12 +48,13 @@ | |
"rollup": "^2.79.1", | ||
"rollup-plugin-dts": "^4.2.2", | ||
"rollup-plugin-esbuild": "^4.10.1", | ||
"styled-components": "^5.3.6", | ||
"styled-components": "^6.1.9", | ||
"typescript": "^4.8.4" | ||
}, | ||
"resolutions": { | ||
"smooth-doc/styled-components": "^5.2.3", | ||
"smooth-doc/gatsby-plugin-robots-txt": "1.5.6" | ||
"smooth-doc/gatsby-plugin-robots-txt": "1.5.6", | ||
"styled-components": "test" | ||
}, | ||
"bundlewatch": { | ||
"files": [ | ||
|
@@ -80,8 +80,5 @@ | |
} | ||
] | ||
}, | ||
"overrides": { | ||
"babel-plugin-styled-components": "2.0.2" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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.