@compiled/react 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/class-names/index.d.ts +21 -15
- package/dist/browser/class-names/index.js +1 -27
- package/dist/browser/class-names/index.js.map +1 -1
- package/dist/browser/css/index.d.ts +22 -19
- package/dist/browser/css/index.js +3 -3
- package/dist/browser/css/index.js.map +1 -1
- package/dist/browser/jsx/jsx-local-namespace.d.ts +32 -6
- package/dist/browser/keyframes/index.d.ts +20 -24
- package/dist/browser/keyframes/index.js.map +1 -1
- package/dist/browser/styled/index.d.ts +35 -7
- package/dist/browser/styled/index.js +35 -7
- package/dist/browser/styled/index.js.map +1 -1
- package/dist/cjs/class-names/index.d.ts +21 -15
- package/dist/cjs/class-names/index.js +1 -27
- package/dist/cjs/class-names/index.js.map +1 -1
- package/dist/cjs/css/index.d.ts +22 -19
- package/dist/cjs/css/index.js +3 -3
- package/dist/cjs/css/index.js.map +1 -1
- package/dist/cjs/jsx/jsx-local-namespace.d.ts +32 -6
- package/dist/cjs/keyframes/index.d.ts +20 -24
- package/dist/cjs/keyframes/index.js.map +1 -1
- package/dist/cjs/styled/index.d.ts +35 -7
- package/dist/cjs/styled/index.js +35 -7
- package/dist/cjs/styled/index.js.map +1 -1
- package/dist/esm/class-names/index.d.ts +21 -15
- package/dist/esm/class-names/index.js +1 -27
- package/dist/esm/class-names/index.js.map +1 -1
- package/dist/esm/css/index.d.ts +22 -19
- package/dist/esm/css/index.js +3 -3
- package/dist/esm/css/index.js.map +1 -1
- package/dist/esm/jsx/jsx-local-namespace.d.ts +32 -6
- package/dist/esm/keyframes/index.d.ts +20 -24
- package/dist/esm/keyframes/index.js.map +1 -1
- package/dist/esm/styled/index.d.ts +35 -7
- package/dist/esm/styled/index.js +35 -7
- package/dist/esm/styled/index.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/ssr.test.tsx +1 -1
- package/src/class-names/index.tsx +23 -13
- package/src/css/__tests__/index.test.tsx +7 -0
- package/src/css/index.tsx +32 -24
- package/src/jsx/jsx-local-namespace.tsx +32 -6
- package/src/keyframes/index.tsx +24 -28
- package/src/styled/index.tsx +35 -7
- package/CHANGELOG.md +0 -128
|
@@ -1,38 +1,44 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import type { BasicTemplateInterpolations, CssFunction } from '../types';
|
|
3
3
|
export declare type Interpolations = (BasicTemplateInterpolations | CssFunction | CssFunction[])[];
|
|
4
4
|
export interface ClassNamesProps {
|
|
5
5
|
children: (opts: {
|
|
6
6
|
css: (css: CssFunction | CssFunction[], ...interpolations: Interpolations) => string;
|
|
7
|
-
style:
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
7
|
+
style: CSSProperties;
|
|
10
8
|
}) => ReactNode;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
11
|
+
* ## Class names
|
|
14
12
|
*
|
|
13
|
+
* Use a component where styles are not necessarily used on a JSX element.
|
|
14
|
+
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names).
|
|
15
|
+
*
|
|
16
|
+
* ### Style with objects
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
15
19
|
* ```
|
|
16
|
-
* // Object CSS
|
|
17
20
|
* <ClassNames>
|
|
18
21
|
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
|
|
19
22
|
* </ClassNames>
|
|
23
|
+
* ```
|
|
20
24
|
*
|
|
21
|
-
*
|
|
25
|
+
* ### Style with template literals
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```
|
|
22
29
|
* <ClassNames>
|
|
23
30
|
* {({ css, style }) => children({ className: css`font-size: 12px;` })}
|
|
24
31
|
* </ClassNames>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* ### Compose styles with arrays
|
|
25
35
|
*
|
|
26
|
-
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```
|
|
27
38
|
* <ClassNames>
|
|
28
39
|
* {({ css, style }) =>
|
|
29
|
-
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })}
|
|
40
|
+
* children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })}
|
|
30
41
|
* </ClassNames>
|
|
31
42
|
* ```
|
|
32
|
-
*
|
|
33
|
-
* For more help, read the docs:
|
|
34
|
-
* https://compiledcssinjs.com/docs/api-class-names
|
|
35
|
-
*
|
|
36
|
-
* @param props
|
|
37
43
|
*/
|
|
38
|
-
export declare function ClassNames(
|
|
44
|
+
export declare function ClassNames({ children }: ClassNamesProps): JSX.Element;
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
import { createSetupError } from '../utils/error';
|
|
2
|
-
|
|
3
|
-
* Use a component where styles are not necessarily tied to an element.
|
|
4
|
-
*
|
|
5
|
-
* ```
|
|
6
|
-
* // Object CSS
|
|
7
|
-
* <ClassNames>
|
|
8
|
-
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
|
|
9
|
-
* </ClassNames>
|
|
10
|
-
*
|
|
11
|
-
* // Template literal CSS
|
|
12
|
-
* <ClassNames>
|
|
13
|
-
* {({ css, style }) => children({ className: css`font-size: 12px;` })}
|
|
14
|
-
* </ClassNames>
|
|
15
|
-
*
|
|
16
|
-
* // Array CSS
|
|
17
|
-
* <ClassNames>
|
|
18
|
-
* {({ css, style }) =>
|
|
19
|
-
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })}
|
|
20
|
-
* </ClassNames>
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* For more help, read the docs:
|
|
24
|
-
* https://compiledcssinjs.com/docs/api-class-names
|
|
25
|
-
*
|
|
26
|
-
* @param props
|
|
27
|
-
*/
|
|
28
|
-
export function ClassNames(_) {
|
|
2
|
+
export function ClassNames(_props) {
|
|
29
3
|
throw createSetupError();
|
|
30
4
|
}
|
|
31
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/class-names/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/class-names/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+ClD,MAAM,UAAU,UAAU,CAAC,MAAuB;IAChD,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import type { BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types';
|
|
1
|
+
import type { AnyKeyCssProps, BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ## CSS
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* css
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* For more help, read the docs:
|
|
10
|
-
* https://compiledcssinjs.com/docs/api-css
|
|
5
|
+
* Define styles that are statically typed and useable with other Compiled APIs.
|
|
6
|
+
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-css).
|
|
11
7
|
*
|
|
12
|
-
*
|
|
13
|
-
* @param values
|
|
14
|
-
*/
|
|
15
|
-
export default function css<T = void>(_css: TemplateStringsArray, ..._values: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps;
|
|
16
|
-
/**
|
|
17
|
-
* Create styles that can be re-used between components with an object
|
|
8
|
+
* ### Style with objects
|
|
18
9
|
*
|
|
10
|
+
* @example
|
|
19
11
|
* ```
|
|
20
|
-
* css({
|
|
12
|
+
* const redText = css({
|
|
13
|
+
* color: 'red',
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* <div css={redText} />
|
|
21
17
|
* ```
|
|
22
18
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
19
|
+
* ### Style with template literals
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* const redText = css`
|
|
24
|
+
* color: red;
|
|
25
|
+
* `;
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
+
* <div css={redText} />
|
|
28
|
+
* ```
|
|
27
29
|
*/
|
|
28
|
-
export default function css(
|
|
30
|
+
export default function css<T = void>(styles: TemplateStringsArray, ...interpolations: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps;
|
|
31
|
+
export default function css(styles: AnyKeyCssProps<void> | CSSProps): CSSProps;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
import { createSetupError } from '../utils/error';
|
|
3
|
-
export default function css(
|
|
4
|
-
var
|
|
3
|
+
export default function css(_styles) {
|
|
4
|
+
var _interpolations = [];
|
|
5
5
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
6
|
-
|
|
6
|
+
_interpolations[_i - 1] = arguments[_i];
|
|
7
7
|
}
|
|
8
8
|
throw createSetupError();
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/css/index.tsx"],"names":[],"mappings":"AAAA,kCAAkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/css/index.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAQlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAqClD,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,OAAwC;IACxC,yBAA8E;SAA9E,UAA8E,EAA9E,qBAA8E,EAA9E,IAA8E;QAA9E,wCAA8E;;IAE9E,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -2,16 +2,42 @@
|
|
|
2
2
|
import type { CssFunction } from '../types';
|
|
3
3
|
declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* ## CSS prop
|
|
6
6
|
*
|
|
7
|
+
* Style a JSX element.
|
|
8
|
+
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-css-prop).
|
|
9
|
+
*
|
|
10
|
+
* ### Style with objects
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* import { css } from '@compiled/react';
|
|
15
|
+
*
|
|
16
|
+
* <div css={css({ fontSize: 12 })} />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* ### Style with template literals
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* import { css } from '@compiled/react';
|
|
24
|
+
*
|
|
25
|
+
* <div css={css`color: red;`} />
|
|
7
26
|
* ```
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* ### Compose styles with arrays
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
11
31
|
* ```
|
|
32
|
+
* import { css } from '@compiled/react';
|
|
12
33
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
34
|
+
* <div
|
|
35
|
+
* css={[
|
|
36
|
+
* css({ fontSize: 12 }),
|
|
37
|
+
* css`color: red;`,
|
|
38
|
+
* ]}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
15
41
|
*/
|
|
16
42
|
css?: CssFunction | CssFunction[];
|
|
17
43
|
} : {} : {};
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
import type { BasicTemplateInterpolations, CSSProps } from '../types';
|
|
2
2
|
export declare type KeyframeSteps = string | Record<string, CSSProps>;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* ## Keyframes
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* from { opacity: 1; }
|
|
9
|
-
* to { opacity: 0; }
|
|
10
|
-
* `;
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @param _strings The input string values
|
|
14
|
-
* @param _interpolations The arguments used in the expression
|
|
15
|
-
*/
|
|
16
|
-
export declare function keyframes(_strings: TemplateStringsArray, ..._interpolations: BasicTemplateInterpolations[]): string;
|
|
17
|
-
/**
|
|
18
|
-
* Create keyframes using:
|
|
6
|
+
* Define keyframes to be used in a [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation).
|
|
7
|
+
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-keyframes).
|
|
19
8
|
*
|
|
20
|
-
*
|
|
9
|
+
* ### Style with objects
|
|
21
10
|
*
|
|
11
|
+
* @example
|
|
22
12
|
* ```
|
|
23
13
|
* const fadeOut = keyframes({
|
|
24
14
|
* from: {
|
|
@@ -28,20 +18,26 @@ export declare function keyframes(_strings: TemplateStringsArray, ..._interpolat
|
|
|
28
18
|
* opacity: 0,
|
|
29
19
|
* },
|
|
30
20
|
* });
|
|
21
|
+
*
|
|
22
|
+
* <div css={{ animation: `${fadeOut} 2s` }} />
|
|
31
23
|
* ```
|
|
32
24
|
*
|
|
33
|
-
*
|
|
25
|
+
* ### Style with template literals
|
|
34
26
|
*
|
|
27
|
+
* @example
|
|
35
28
|
* ```
|
|
36
|
-
* const fadeOut = keyframes
|
|
37
|
-
*
|
|
29
|
+
* const fadeOut = keyframes`
|
|
30
|
+
* from {
|
|
31
|
+
* opacity: 1;
|
|
32
|
+
* }
|
|
38
33
|
*
|
|
39
|
-
*
|
|
34
|
+
* to {
|
|
35
|
+
* opacity: 0;
|
|
36
|
+
* }
|
|
37
|
+
* `;
|
|
40
38
|
*
|
|
39
|
+
* <div css={{ animation: `${fadeOut} 2s` }} />
|
|
41
40
|
* ```
|
|
42
|
-
* const fadeOut = keyframes(`from { opacity: 1; } to { opacity: 0; }`);
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @param _steps The waypoints along the animation sequence
|
|
46
41
|
*/
|
|
47
|
-
export declare function keyframes(
|
|
42
|
+
export declare function keyframes(steps: KeyframeSteps): string;
|
|
43
|
+
export declare function keyframes(strings: TemplateStringsArray, ...interpolations: BasicTemplateInterpolations[]): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keyframes/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keyframes/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAkDlD,MAAM,UAAU,SAAS,CACvB,eAAqD;IACrD,yBAAiD;SAAjD,UAAiD,EAAjD,qBAAiD,EAAjD,IAAiD;QAAjD,wCAAiD;;IAEjD,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -32,16 +32,44 @@ export interface StyledComponentInstantiator extends StyledComponentMap {
|
|
|
32
32
|
<TInheritedProps extends unknown>(Component: ComponentType<TInheritedProps>): StyledFunctionFromComponent<TInheritedProps>;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* ## Styled component
|
|
36
36
|
*
|
|
37
|
+
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support.
|
|
38
|
+
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled).
|
|
39
|
+
*
|
|
40
|
+
* ### Style with objects
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```
|
|
44
|
+
* styled.div({
|
|
45
|
+
* fontSize: 12,
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ### Style with template literals
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
37
52
|
* ```
|
|
38
|
-
* styled.div`
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS
|
|
53
|
+
* styled.div`
|
|
54
|
+
* font-size: 12px
|
|
55
|
+
* `;
|
|
42
56
|
* ```
|
|
43
57
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
58
|
+
* ### Compose styles with arrays
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```
|
|
62
|
+
* import { css } from '@compiled/react';
|
|
63
|
+
*
|
|
64
|
+
* styled.div([
|
|
65
|
+
* { fontSize: 12 },
|
|
66
|
+
* css`font-size: 12px;`
|
|
67
|
+
* ]);
|
|
68
|
+
*
|
|
69
|
+
* styled.div(
|
|
70
|
+
* { fontSize: 12 },
|
|
71
|
+
* css`font-size: 12px`
|
|
72
|
+
* );
|
|
73
|
+
* ```
|
|
46
74
|
*/
|
|
47
75
|
export declare const styled: StyledComponentInstantiator;
|
|
@@ -1,16 +1,44 @@
|
|
|
1
1
|
import { createSetupError } from '../utils/error';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ## Styled component
|
|
4
4
|
*
|
|
5
|
+
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support.
|
|
6
|
+
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled).
|
|
7
|
+
*
|
|
8
|
+
* ### Style with objects
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* styled.div({
|
|
13
|
+
* fontSize: 12,
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ### Style with template literals
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
5
20
|
* ```
|
|
6
|
-
* styled.div`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS
|
|
21
|
+
* styled.div`
|
|
22
|
+
* font-size: 12px
|
|
23
|
+
* `;
|
|
10
24
|
* ```
|
|
11
25
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
26
|
+
* ### Compose styles with arrays
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```
|
|
30
|
+
* import { css } from '@compiled/react';
|
|
31
|
+
*
|
|
32
|
+
* styled.div([
|
|
33
|
+
* { fontSize: 12 },
|
|
34
|
+
* css`font-size: 12px;`
|
|
35
|
+
* ]);
|
|
36
|
+
*
|
|
37
|
+
* styled.div(
|
|
38
|
+
* { fontSize: 12 },
|
|
39
|
+
* css`font-size: 12px`
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
14
42
|
*/
|
|
15
43
|
export var styled = new Proxy({}, {
|
|
16
44
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwDlD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwDlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,IAAM,MAAM,GAAgC,IAAI,KAAK,CAC1D,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,gBAAgB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
|
|
@@ -1,38 +1,44 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import type { BasicTemplateInterpolations, CssFunction } from '../types';
|
|
3
3
|
export declare type Interpolations = (BasicTemplateInterpolations | CssFunction | CssFunction[])[];
|
|
4
4
|
export interface ClassNamesProps {
|
|
5
5
|
children: (opts: {
|
|
6
6
|
css: (css: CssFunction | CssFunction[], ...interpolations: Interpolations) => string;
|
|
7
|
-
style:
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
7
|
+
style: CSSProperties;
|
|
10
8
|
}) => ReactNode;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
11
|
+
* ## Class names
|
|
14
12
|
*
|
|
13
|
+
* Use a component where styles are not necessarily used on a JSX element.
|
|
14
|
+
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names).
|
|
15
|
+
*
|
|
16
|
+
* ### Style with objects
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
15
19
|
* ```
|
|
16
|
-
* // Object CSS
|
|
17
20
|
* <ClassNames>
|
|
18
21
|
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
|
|
19
22
|
* </ClassNames>
|
|
23
|
+
* ```
|
|
20
24
|
*
|
|
21
|
-
*
|
|
25
|
+
* ### Style with template literals
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```
|
|
22
29
|
* <ClassNames>
|
|
23
30
|
* {({ css, style }) => children({ className: css`font-size: 12px;` })}
|
|
24
31
|
* </ClassNames>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* ### Compose styles with arrays
|
|
25
35
|
*
|
|
26
|
-
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```
|
|
27
38
|
* <ClassNames>
|
|
28
39
|
* {({ css, style }) =>
|
|
29
|
-
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })}
|
|
40
|
+
* children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })}
|
|
30
41
|
* </ClassNames>
|
|
31
42
|
* ```
|
|
32
|
-
*
|
|
33
|
-
* For more help, read the docs:
|
|
34
|
-
* https://compiledcssinjs.com/docs/api-class-names
|
|
35
|
-
*
|
|
36
|
-
* @param props
|
|
37
43
|
*/
|
|
38
|
-
export declare function ClassNames(
|
|
44
|
+
export declare function ClassNames({ children }: ClassNamesProps): JSX.Element;
|
|
@@ -2,33 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClassNames = void 0;
|
|
4
4
|
var error_1 = require("../utils/error");
|
|
5
|
-
|
|
6
|
-
* Use a component where styles are not necessarily tied to an element.
|
|
7
|
-
*
|
|
8
|
-
* ```
|
|
9
|
-
* // Object CSS
|
|
10
|
-
* <ClassNames>
|
|
11
|
-
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
|
|
12
|
-
* </ClassNames>
|
|
13
|
-
*
|
|
14
|
-
* // Template literal CSS
|
|
15
|
-
* <ClassNames>
|
|
16
|
-
* {({ css, style }) => children({ className: css`font-size: 12px;` })}
|
|
17
|
-
* </ClassNames>
|
|
18
|
-
*
|
|
19
|
-
* // Array CSS
|
|
20
|
-
* <ClassNames>
|
|
21
|
-
* {({ css, style }) =>
|
|
22
|
-
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })}
|
|
23
|
-
* </ClassNames>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* For more help, read the docs:
|
|
27
|
-
* https://compiledcssinjs.com/docs/api-class-names
|
|
28
|
-
*
|
|
29
|
-
* @param props
|
|
30
|
-
*/
|
|
31
|
-
function ClassNames(_) {
|
|
5
|
+
function ClassNames(_props) {
|
|
32
6
|
throw error_1.createSetupError();
|
|
33
7
|
}
|
|
34
8
|
exports.ClassNames = ClassNames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/class-names/index.tsx"],"names":[],"mappings":";;;AAGA,wCAAkD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/class-names/index.tsx"],"names":[],"mappings":";;;AAGA,wCAAkD;AA+ClD,SAAgB,UAAU,CAAC,MAAuB;IAChD,MAAM,wBAAgB,EAAE,CAAC;AAC3B,CAAC;AAFD,gCAEC"}
|
package/dist/cjs/css/index.d.ts
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import type { BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types';
|
|
1
|
+
import type { AnyKeyCssProps, BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ## CSS
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* css
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* For more help, read the docs:
|
|
10
|
-
* https://compiledcssinjs.com/docs/api-css
|
|
5
|
+
* Define styles that are statically typed and useable with other Compiled APIs.
|
|
6
|
+
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-css).
|
|
11
7
|
*
|
|
12
|
-
*
|
|
13
|
-
* @param values
|
|
14
|
-
*/
|
|
15
|
-
export default function css<T = void>(_css: TemplateStringsArray, ..._values: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps;
|
|
16
|
-
/**
|
|
17
|
-
* Create styles that can be re-used between components with an object
|
|
8
|
+
* ### Style with objects
|
|
18
9
|
*
|
|
10
|
+
* @example
|
|
19
11
|
* ```
|
|
20
|
-
* css({
|
|
12
|
+
* const redText = css({
|
|
13
|
+
* color: 'red',
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* <div css={redText} />
|
|
21
17
|
* ```
|
|
22
18
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
19
|
+
* ### Style with template literals
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* const redText = css`
|
|
24
|
+
* color: red;
|
|
25
|
+
* `;
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
+
* <div css={redText} />
|
|
28
|
+
* ```
|
|
27
29
|
*/
|
|
28
|
-
export default function css(
|
|
30
|
+
export default function css<T = void>(styles: TemplateStringsArray, ...interpolations: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps;
|
|
31
|
+
export default function css(styles: AnyKeyCssProps<void> | CSSProps): CSSProps;
|
package/dist/cjs/css/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/* eslint-disable import/export */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
var error_1 = require("../utils/error");
|
|
5
|
-
function css(
|
|
6
|
-
var
|
|
5
|
+
function css(_styles) {
|
|
6
|
+
var _interpolations = [];
|
|
7
7
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
8
|
-
|
|
8
|
+
_interpolations[_i - 1] = arguments[_i];
|
|
9
9
|
}
|
|
10
10
|
throw error_1.createSetupError();
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/css/index.tsx"],"names":[],"mappings":";AAAA,kCAAkC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/css/index.tsx"],"names":[],"mappings":";AAAA,kCAAkC;;AAQlC,wCAAkD;AAqClD,SAAwB,GAAG,CACzB,OAAwC;IACxC,yBAA8E;SAA9E,UAA8E,EAA9E,qBAA8E,EAA9E,IAA8E;QAA9E,wCAA8E;;IAE9E,MAAM,wBAAgB,EAAE,CAAC;AAC3B,CAAC;AALD,sBAKC"}
|
|
@@ -2,16 +2,42 @@
|
|
|
2
2
|
import type { CssFunction } from '../types';
|
|
3
3
|
declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* ## CSS prop
|
|
6
6
|
*
|
|
7
|
+
* Style a JSX element.
|
|
8
|
+
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-css-prop).
|
|
9
|
+
*
|
|
10
|
+
* ### Style with objects
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* import { css } from '@compiled/react';
|
|
15
|
+
*
|
|
16
|
+
* <div css={css({ fontSize: 12 })} />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* ### Style with template literals
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* import { css } from '@compiled/react';
|
|
24
|
+
*
|
|
25
|
+
* <div css={css`color: red;`} />
|
|
7
26
|
* ```
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* ### Compose styles with arrays
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
11
31
|
* ```
|
|
32
|
+
* import { css } from '@compiled/react';
|
|
12
33
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
34
|
+
* <div
|
|
35
|
+
* css={[
|
|
36
|
+
* css({ fontSize: 12 }),
|
|
37
|
+
* css`color: red;`,
|
|
38
|
+
* ]}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
15
41
|
*/
|
|
16
42
|
css?: CssFunction | CssFunction[];
|
|
17
43
|
} : {} : {};
|