@compiled/react
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -1,2 +0,2 @@ | ||
import type { ReactNode } from 'react'; | ||
import type { ReactNode, CSSProperties } from 'react'; | ||
import type { BasicTemplateInterpolations, CssFunction } from '../types'; | ||
@@ -7,33 +7,39 @@ export declare type Interpolations = (BasicTemplateInterpolations | CssFunction | CssFunction[])[]; | ||
css: (css: CssFunction | CssFunction[], ...interpolations: Interpolations) => string; | ||
style: { | ||
[key: string]: string; | ||
}; | ||
style: CSSProperties; | ||
}) => ReactNode; | ||
} | ||
/** | ||
* Use a component where styles are not necessarily tied to an element. | ||
* ## Class names | ||
* | ||
* Use a component where styles are not necessarily used on a JSX element. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* // Object CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* // Template literal CSS | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css`font-size: 12px;` })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* // Array CSS | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* <ClassNames> | ||
* {({ css, style }) => | ||
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })} | ||
* children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-class-names | ||
* | ||
* @param props | ||
*/ | ||
export declare function ClassNames(_: ClassNamesProps): JSX.Element; | ||
export declare function ClassNames({ children }: ClassNamesProps): JSX.Element; |
import { createSetupError } from '../utils/error'; | ||
/** | ||
* Use a component where styles are not necessarily tied to an element. | ||
* | ||
* ``` | ||
* // Object CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })} | ||
* </ClassNames> | ||
* | ||
* // Template literal CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css`font-size: 12px;` })} | ||
* </ClassNames> | ||
* | ||
* // Array CSS | ||
* <ClassNames> | ||
* {({ css, style }) => | ||
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-class-names | ||
* | ||
* @param props | ||
*/ | ||
export function ClassNames(_) { | ||
export function ClassNames(_props) { | ||
throw createSetupError(); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -1,28 +0,31 @@ | ||
import type { BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types'; | ||
import type { AnyKeyCssProps, BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types'; | ||
/** | ||
* Create styles that can be re-used between components with a template literal. | ||
* ## CSS | ||
* | ||
* Define styles that are statically typed and useable with other Compiled APIs. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-css). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* css`color: red;`; | ||
* const redText = css({ | ||
* color: 'red', | ||
* }); | ||
* | ||
* <div css={redText} /> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css | ||
* ### Style with template literals | ||
* | ||
* @param css | ||
* @param values | ||
*/ | ||
export default function css<T = void>(_css: TemplateStringsArray, ..._values: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps; | ||
/** | ||
* Create styles that can be re-used between components with an object | ||
* @example | ||
* ``` | ||
* const redText = css` | ||
* color: red; | ||
* `; | ||
* | ||
* <div css={redText} /> | ||
* ``` | ||
* css({ color: 'red' }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css | ||
* | ||
* @param css | ||
*/ | ||
export default function css(_css: CSSProps): CSSProps; | ||
export default function css<T = void>(styles: TemplateStringsArray, ...interpolations: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps; | ||
export default function css(styles: AnyKeyCssProps<void> | CSSProps): CSSProps; |
/* eslint-disable import/export */ | ||
import { createSetupError } from '../utils/error'; | ||
export default function css(_css) { | ||
var _values = []; | ||
export default function css(_styles) { | ||
var _interpolations = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
_values[_i - 1] = arguments[_i]; | ||
_interpolations[_i - 1] = arguments[_i]; | ||
} | ||
@@ -8,0 +8,0 @@ throw createSetupError(); |
@@ -5,12 +5,38 @@ /// <reference types="react" /> | ||
/** | ||
* Tie styles to an element. | ||
* ## CSS prop | ||
* | ||
* Style a JSX element. | ||
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-css-prop). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* css={{ fontSize: 12 }} // Object CSS | ||
* css={`font-size: 12px;`} // Template literal CSS | ||
* css={[{ fontSize: 12 }, `font-size: 12px;`]} // Array CSS | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div css={css({ fontSize: 12 })} /> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css-prop | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div css={css`color: red;`} /> | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div | ||
* css={[ | ||
* css({ fontSize: 12 }), | ||
* css`color: red;`, | ||
* ]} | ||
* /> | ||
* ``` | ||
*/ | ||
@@ -17,0 +43,0 @@ css?: CssFunction | CssFunction[]; |
import type { BasicTemplateInterpolations, CSSProps } from '../types'; | ||
export declare type KeyframeSteps = string | Record<string, CSSProps>; | ||
/** | ||
* Create keyframes using a tagged template expression: | ||
* ## Keyframes | ||
* | ||
* ``` | ||
* const fadeOut = keyframes` | ||
* from { opacity: 1; } | ||
* to { opacity: 0; } | ||
* `; | ||
* ``` | ||
* Define keyframes to be used in a [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation). | ||
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-keyframes). | ||
* | ||
* @param _strings The input string values | ||
* @param _interpolations The arguments used in the expression | ||
*/ | ||
export declare function keyframes(_strings: TemplateStringsArray, ..._interpolations: BasicTemplateInterpolations[]): string; | ||
/** | ||
* Create keyframes using: | ||
* ### Style with objects | ||
* | ||
* 1. An object expression | ||
* | ||
* @example | ||
* ``` | ||
@@ -31,18 +21,24 @@ * const fadeOut = keyframes({ | ||
* }); | ||
* | ||
* <div css={{ animation: `${fadeOut} 2s` }} /> | ||
* ``` | ||
* | ||
* 2. A string | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* const fadeOut = keyframes('from { opacity: 1; } to { opacity: 0; }'); | ||
* ``` | ||
* const fadeOut = keyframes` | ||
* from { | ||
* opacity: 1; | ||
* } | ||
* | ||
* 3. A template literal | ||
* to { | ||
* opacity: 0; | ||
* } | ||
* `; | ||
* | ||
* <div css={{ animation: `${fadeOut} 2s` }} /> | ||
* ``` | ||
* const fadeOut = keyframes(`from { opacity: 1; } to { opacity: 0; }`); | ||
* ``` | ||
* | ||
* @param _steps The waypoints along the animation sequence | ||
*/ | ||
export declare function keyframes(_steps: KeyframeSteps): string; | ||
export declare function keyframes(steps: KeyframeSteps): string; | ||
export declare function keyframes(strings: TemplateStringsArray, ...interpolations: BasicTemplateInterpolations[]): string; |
@@ -35,14 +35,42 @@ import type { ComponentType } from 'react'; | ||
/** | ||
* Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* ## Styled component | ||
* | ||
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* styled.div`font-size: 12px`; // Template literal CSS | ||
* styled.div({ fontSize: 12 }); // Object CSS | ||
* styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS | ||
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS | ||
* styled.div({ | ||
* fontSize: 12, | ||
* }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-styled | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* styled.div` | ||
* font-size: 12px | ||
* `; | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* styled.div([ | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px;` | ||
* ]); | ||
* | ||
* styled.div( | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px` | ||
* ); | ||
* ``` | ||
*/ | ||
export declare const styled: StyledComponentInstantiator; |
import { createSetupError } from '../utils/error'; | ||
/** | ||
* Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* ## Styled component | ||
* | ||
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* styled.div`font-size: 12px`; // Template literal CSS | ||
* styled.div({ fontSize: 12 }); // Object CSS | ||
* styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS | ||
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS | ||
* styled.div({ | ||
* fontSize: 12, | ||
* }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-styled | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* styled.div` | ||
* font-size: 12px | ||
* `; | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* styled.div([ | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px;` | ||
* ]); | ||
* | ||
* styled.div( | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px` | ||
* ); | ||
* ``` | ||
*/ | ||
@@ -15,0 +43,0 @@ export var styled = new Proxy({}, { |
@@ -1,2 +0,2 @@ | ||
import type { ReactNode } from 'react'; | ||
import type { ReactNode, CSSProperties } from 'react'; | ||
import type { BasicTemplateInterpolations, CssFunction } from '../types'; | ||
@@ -7,33 +7,39 @@ export declare type Interpolations = (BasicTemplateInterpolations | CssFunction | CssFunction[])[]; | ||
css: (css: CssFunction | CssFunction[], ...interpolations: Interpolations) => string; | ||
style: { | ||
[key: string]: string; | ||
}; | ||
style: CSSProperties; | ||
}) => ReactNode; | ||
} | ||
/** | ||
* Use a component where styles are not necessarily tied to an element. | ||
* ## Class names | ||
* | ||
* Use a component where styles are not necessarily used on a JSX element. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* // Object CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* // Template literal CSS | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css`font-size: 12px;` })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* // Array CSS | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* <ClassNames> | ||
* {({ css, style }) => | ||
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })} | ||
* children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-class-names | ||
* | ||
* @param props | ||
*/ | ||
export declare function ClassNames(_: ClassNamesProps): JSX.Element; | ||
export declare function ClassNames({ children }: ClassNamesProps): JSX.Element; |
@@ -5,29 +5,3 @@ "use strict"; | ||
var error_1 = require("../utils/error"); | ||
/** | ||
* Use a component where styles are not necessarily tied to an element. | ||
* | ||
* ``` | ||
* // Object CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })} | ||
* </ClassNames> | ||
* | ||
* // Template literal CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css`font-size: 12px;` })} | ||
* </ClassNames> | ||
* | ||
* // Array CSS | ||
* <ClassNames> | ||
* {({ css, style }) => | ||
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-class-names | ||
* | ||
* @param props | ||
*/ | ||
function ClassNames(_) { | ||
function ClassNames(_props) { | ||
throw error_1.createSetupError(); | ||
@@ -34,0 +8,0 @@ } |
@@ -1,28 +0,31 @@ | ||
import type { BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types'; | ||
import type { AnyKeyCssProps, BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types'; | ||
/** | ||
* Create styles that can be re-used between components with a template literal. | ||
* ## CSS | ||
* | ||
* Define styles that are statically typed and useable with other Compiled APIs. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-css). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* css`color: red;`; | ||
* const redText = css({ | ||
* color: 'red', | ||
* }); | ||
* | ||
* <div css={redText} /> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css | ||
* ### Style with template literals | ||
* | ||
* @param css | ||
* @param values | ||
*/ | ||
export default function css<T = void>(_css: TemplateStringsArray, ..._values: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps; | ||
/** | ||
* Create styles that can be re-used between components with an object | ||
* @example | ||
* ``` | ||
* const redText = css` | ||
* color: red; | ||
* `; | ||
* | ||
* <div css={redText} /> | ||
* ``` | ||
* css({ color: 'red' }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css | ||
* | ||
* @param css | ||
*/ | ||
export default function css(_css: CSSProps): CSSProps; | ||
export default function css<T = void>(styles: TemplateStringsArray, ...interpolations: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps; | ||
export default function css(styles: AnyKeyCssProps<void> | CSSProps): CSSProps; |
@@ -5,6 +5,6 @@ "use strict"; | ||
var error_1 = require("../utils/error"); | ||
function css(_css) { | ||
var _values = []; | ||
function css(_styles) { | ||
var _interpolations = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
_values[_i - 1] = arguments[_i]; | ||
_interpolations[_i - 1] = arguments[_i]; | ||
} | ||
@@ -11,0 +11,0 @@ throw error_1.createSetupError(); |
@@ -5,12 +5,38 @@ /// <reference types="react" /> | ||
/** | ||
* Tie styles to an element. | ||
* ## CSS prop | ||
* | ||
* Style a JSX element. | ||
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-css-prop). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* css={{ fontSize: 12 }} // Object CSS | ||
* css={`font-size: 12px;`} // Template literal CSS | ||
* css={[{ fontSize: 12 }, `font-size: 12px;`]} // Array CSS | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div css={css({ fontSize: 12 })} /> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css-prop | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div css={css`color: red;`} /> | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div | ||
* css={[ | ||
* css({ fontSize: 12 }), | ||
* css`color: red;`, | ||
* ]} | ||
* /> | ||
* ``` | ||
*/ | ||
@@ -17,0 +43,0 @@ css?: CssFunction | CssFunction[]; |
import type { BasicTemplateInterpolations, CSSProps } from '../types'; | ||
export declare type KeyframeSteps = string | Record<string, CSSProps>; | ||
/** | ||
* Create keyframes using a tagged template expression: | ||
* ## Keyframes | ||
* | ||
* ``` | ||
* const fadeOut = keyframes` | ||
* from { opacity: 1; } | ||
* to { opacity: 0; } | ||
* `; | ||
* ``` | ||
* Define keyframes to be used in a [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation). | ||
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-keyframes). | ||
* | ||
* @param _strings The input string values | ||
* @param _interpolations The arguments used in the expression | ||
*/ | ||
export declare function keyframes(_strings: TemplateStringsArray, ..._interpolations: BasicTemplateInterpolations[]): string; | ||
/** | ||
* Create keyframes using: | ||
* ### Style with objects | ||
* | ||
* 1. An object expression | ||
* | ||
* @example | ||
* ``` | ||
@@ -31,18 +21,24 @@ * const fadeOut = keyframes({ | ||
* }); | ||
* | ||
* <div css={{ animation: `${fadeOut} 2s` }} /> | ||
* ``` | ||
* | ||
* 2. A string | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* const fadeOut = keyframes('from { opacity: 1; } to { opacity: 0; }'); | ||
* ``` | ||
* const fadeOut = keyframes` | ||
* from { | ||
* opacity: 1; | ||
* } | ||
* | ||
* 3. A template literal | ||
* to { | ||
* opacity: 0; | ||
* } | ||
* `; | ||
* | ||
* <div css={{ animation: `${fadeOut} 2s` }} /> | ||
* ``` | ||
* const fadeOut = keyframes(`from { opacity: 1; } to { opacity: 0; }`); | ||
* ``` | ||
* | ||
* @param _steps The waypoints along the animation sequence | ||
*/ | ||
export declare function keyframes(_steps: KeyframeSteps): string; | ||
export declare function keyframes(steps: KeyframeSteps): string; | ||
export declare function keyframes(strings: TemplateStringsArray, ...interpolations: BasicTemplateInterpolations[]): string; |
@@ -35,14 +35,42 @@ import type { ComponentType } from 'react'; | ||
/** | ||
* Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* ## Styled component | ||
* | ||
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* styled.div`font-size: 12px`; // Template literal CSS | ||
* styled.div({ fontSize: 12 }); // Object CSS | ||
* styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS | ||
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS | ||
* styled.div({ | ||
* fontSize: 12, | ||
* }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-styled | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* styled.div` | ||
* font-size: 12px | ||
* `; | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* styled.div([ | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px;` | ||
* ]); | ||
* | ||
* styled.div( | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px` | ||
* ); | ||
* ``` | ||
*/ | ||
export declare const styled: StyledComponentInstantiator; |
@@ -6,13 +6,41 @@ "use strict"; | ||
/** | ||
* Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* ## Styled component | ||
* | ||
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* styled.div`font-size: 12px`; // Template literal CSS | ||
* styled.div({ fontSize: 12 }); // Object CSS | ||
* styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS | ||
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS | ||
* styled.div({ | ||
* fontSize: 12, | ||
* }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-styled | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* styled.div` | ||
* font-size: 12px | ||
* `; | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* styled.div([ | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px;` | ||
* ]); | ||
* | ||
* styled.div( | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px` | ||
* ); | ||
* ``` | ||
*/ | ||
@@ -19,0 +47,0 @@ exports.styled = new Proxy({}, { |
@@ -1,2 +0,2 @@ | ||
import type { ReactNode } from 'react'; | ||
import type { ReactNode, CSSProperties } from 'react'; | ||
import type { BasicTemplateInterpolations, CssFunction } from '../types'; | ||
@@ -7,33 +7,39 @@ export declare type Interpolations = (BasicTemplateInterpolations | CssFunction | CssFunction[])[]; | ||
css: (css: CssFunction | CssFunction[], ...interpolations: Interpolations) => string; | ||
style: { | ||
[key: string]: string; | ||
}; | ||
style: CSSProperties; | ||
}) => ReactNode; | ||
} | ||
/** | ||
* Use a component where styles are not necessarily tied to an element. | ||
* ## Class names | ||
* | ||
* Use a component where styles are not necessarily used on a JSX element. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* // Object CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* // Template literal CSS | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css`font-size: 12px;` })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* // Array CSS | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* <ClassNames> | ||
* {({ css, style }) => | ||
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })} | ||
* children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-class-names | ||
* | ||
* @param props | ||
*/ | ||
export declare function ClassNames(_: ClassNamesProps): JSX.Element; | ||
export declare function ClassNames({ children }: ClassNamesProps): JSX.Element; |
import { createSetupError } from '../utils/error'; | ||
/** | ||
* Use a component where styles are not necessarily tied to an element. | ||
* | ||
* ``` | ||
* // Object CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })} | ||
* </ClassNames> | ||
* | ||
* // Template literal CSS | ||
* <ClassNames> | ||
* {({ css, style }) => children({ className: css`font-size: 12px;` })} | ||
* </ClassNames> | ||
* | ||
* // Array CSS | ||
* <ClassNames> | ||
* {({ css, style }) => | ||
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })} | ||
* </ClassNames> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-class-names | ||
* | ||
* @param props | ||
*/ | ||
export function ClassNames(_) { | ||
export function ClassNames(_props) { | ||
throw createSetupError(); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -1,28 +0,31 @@ | ||
import type { BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types'; | ||
import type { AnyKeyCssProps, BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types'; | ||
/** | ||
* Create styles that can be re-used between components with a template literal. | ||
* ## CSS | ||
* | ||
* Define styles that are statically typed and useable with other Compiled APIs. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-css). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* css`color: red;`; | ||
* const redText = css({ | ||
* color: 'red', | ||
* }); | ||
* | ||
* <div css={redText} /> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css | ||
* ### Style with template literals | ||
* | ||
* @param css | ||
* @param values | ||
*/ | ||
export default function css<T = void>(_css: TemplateStringsArray, ..._values: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps; | ||
/** | ||
* Create styles that can be re-used between components with an object | ||
* @example | ||
* ``` | ||
* const redText = css` | ||
* color: red; | ||
* `; | ||
* | ||
* <div css={redText} /> | ||
* ``` | ||
* css({ color: 'red' }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css | ||
* | ||
* @param css | ||
*/ | ||
export default function css(_css: CSSProps): CSSProps; | ||
export default function css<T = void>(styles: TemplateStringsArray, ...interpolations: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps; | ||
export default function css(styles: AnyKeyCssProps<void> | CSSProps): CSSProps; |
/* eslint-disable import/export */ | ||
import { createSetupError } from '../utils/error'; | ||
export default function css(_css) { | ||
var _values = []; | ||
export default function css(_styles) { | ||
var _interpolations = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
_values[_i - 1] = arguments[_i]; | ||
_interpolations[_i - 1] = arguments[_i]; | ||
} | ||
@@ -8,0 +8,0 @@ throw createSetupError(); |
@@ -5,12 +5,38 @@ /// <reference types="react" /> | ||
/** | ||
* Tie styles to an element. | ||
* ## CSS prop | ||
* | ||
* Style a JSX element. | ||
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-css-prop). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* css={{ fontSize: 12 }} // Object CSS | ||
* css={`font-size: 12px;`} // Template literal CSS | ||
* css={[{ fontSize: 12 }, `font-size: 12px;`]} // Array CSS | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div css={css({ fontSize: 12 })} /> | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-css-prop | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div css={css`color: red;`} /> | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* <div | ||
* css={[ | ||
* css({ fontSize: 12 }), | ||
* css`color: red;`, | ||
* ]} | ||
* /> | ||
* ``` | ||
*/ | ||
@@ -17,0 +43,0 @@ css?: CssFunction | CssFunction[]; |
import type { BasicTemplateInterpolations, CSSProps } from '../types'; | ||
export declare type KeyframeSteps = string | Record<string, CSSProps>; | ||
/** | ||
* Create keyframes using a tagged template expression: | ||
* ## Keyframes | ||
* | ||
* ``` | ||
* const fadeOut = keyframes` | ||
* from { opacity: 1; } | ||
* to { opacity: 0; } | ||
* `; | ||
* ``` | ||
* Define keyframes to be used in a [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation). | ||
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-keyframes). | ||
* | ||
* @param _strings The input string values | ||
* @param _interpolations The arguments used in the expression | ||
*/ | ||
export declare function keyframes(_strings: TemplateStringsArray, ..._interpolations: BasicTemplateInterpolations[]): string; | ||
/** | ||
* Create keyframes using: | ||
* ### Style with objects | ||
* | ||
* 1. An object expression | ||
* | ||
* @example | ||
* ``` | ||
@@ -31,18 +21,24 @@ * const fadeOut = keyframes({ | ||
* }); | ||
* | ||
* <div css={{ animation: `${fadeOut} 2s` }} /> | ||
* ``` | ||
* | ||
* 2. A string | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* const fadeOut = keyframes('from { opacity: 1; } to { opacity: 0; }'); | ||
* ``` | ||
* const fadeOut = keyframes` | ||
* from { | ||
* opacity: 1; | ||
* } | ||
* | ||
* 3. A template literal | ||
* to { | ||
* opacity: 0; | ||
* } | ||
* `; | ||
* | ||
* <div css={{ animation: `${fadeOut} 2s` }} /> | ||
* ``` | ||
* const fadeOut = keyframes(`from { opacity: 1; } to { opacity: 0; }`); | ||
* ``` | ||
* | ||
* @param _steps The waypoints along the animation sequence | ||
*/ | ||
export declare function keyframes(_steps: KeyframeSteps): string; | ||
export declare function keyframes(steps: KeyframeSteps): string; | ||
export declare function keyframes(strings: TemplateStringsArray, ...interpolations: BasicTemplateInterpolations[]): string; |
@@ -35,14 +35,42 @@ import type { ComponentType } from 'react'; | ||
/** | ||
* Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* ## Styled component | ||
* | ||
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* styled.div`font-size: 12px`; // Template literal CSS | ||
* styled.div({ fontSize: 12 }); // Object CSS | ||
* styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS | ||
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS | ||
* styled.div({ | ||
* fontSize: 12, | ||
* }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-styled | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* styled.div` | ||
* font-size: 12px | ||
* `; | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* styled.div([ | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px;` | ||
* ]); | ||
* | ||
* styled.div( | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px` | ||
* ); | ||
* ``` | ||
*/ | ||
export declare const styled: StyledComponentInstantiator; |
import { createSetupError } from '../utils/error'; | ||
/** | ||
* Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* ## Styled component | ||
* | ||
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support. | ||
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled). | ||
* | ||
* ### Style with objects | ||
* | ||
* @example | ||
* ``` | ||
* styled.div`font-size: 12px`; // Template literal CSS | ||
* styled.div({ fontSize: 12 }); // Object CSS | ||
* styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS | ||
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS | ||
* styled.div({ | ||
* fontSize: 12, | ||
* }); | ||
* ``` | ||
* | ||
* For more help, read the docs: | ||
* https://compiledcssinjs.com/docs/api-styled | ||
* ### Style with template literals | ||
* | ||
* @example | ||
* ``` | ||
* styled.div` | ||
* font-size: 12px | ||
* `; | ||
* ``` | ||
* | ||
* ### Compose styles with arrays | ||
* | ||
* @example | ||
* ``` | ||
* import { css } from '@compiled/react'; | ||
* | ||
* styled.div([ | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px;` | ||
* ]); | ||
* | ||
* styled.div( | ||
* { fontSize: 12 }, | ||
* css`font-size: 12px` | ||
* ); | ||
* ``` | ||
*/ | ||
@@ -15,0 +43,0 @@ export var styled = new Proxy({}, { |
{ | ||
"name": "@compiled/react", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "A familiar and performant compile time CSS-in-JS library for React.", | ||
@@ -11,3 +11,3 @@ "keywords": [ | ||
], | ||
"homepage": "https://compiledcssinjs.com", | ||
"homepage": "https://compiledcssinjs.com/docs/pkg-react", | ||
"bugs": "https://github.com/atlassian-labs/compiled/issues/new?assignees=&labels=bug&template=bug_report.md", | ||
@@ -76,3 +76,3 @@ "repository": { | ||
"dependencies": { | ||
"csstype": "^3.0.9" | ||
"csstype": "^3.0.10" | ||
}, | ||
@@ -79,0 +79,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5570
291713
309
1
Updatedcsstype@^3.0.10