@compiled/react 0.7.0 → 0.10.0
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/CHANGELOG.md +68 -1
- package/dist/browser/class-names/index.d.ts +2 -2
- package/dist/browser/class-names/index.js.flow +45 -0
- package/dist/browser/class-names/index.js.map +1 -1
- package/dist/browser/css/index.d.ts +16 -3
- package/dist/browser/css/index.js +1 -13
- package/dist/browser/css/index.js.flow +35 -0
- package/dist/browser/css/index.js.map +1 -1
- package/dist/browser/index.d.ts +15 -23
- package/dist/browser/index.js +4 -0
- package/dist/browser/index.js.flow +15 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/jsx/jsx-dev-runtime.d.ts +2 -0
- package/dist/browser/jsx/jsx-dev-runtime.js +4 -0
- package/dist/browser/jsx/jsx-dev-runtime.js.map +1 -0
- package/dist/browser/jsx/jsx-local-namespace.d.ts +40 -0
- package/dist/browser/jsx/jsx-local-namespace.js +2 -0
- package/dist/browser/jsx/jsx-local-namespace.js.map +1 -0
- package/dist/browser/jsx/jsx-runtime.d.ts +2 -0
- package/dist/browser/jsx/jsx-runtime.js +4 -0
- package/dist/browser/jsx/jsx-runtime.js.map +1 -0
- package/dist/browser/keyframes/index.js.flow +54 -0
- package/dist/browser/runtime/ax.js.flow +27 -0
- package/dist/browser/runtime/css-custom-property.d.ts +1 -1
- package/dist/browser/runtime/css-custom-property.js.flow +19 -0
- package/dist/browser/runtime/css-custom-property.js.map +1 -1
- package/dist/browser/runtime/dev-warnings.d.ts +0 -1
- package/dist/browser/runtime/dev-warnings.js +1 -1
- package/dist/browser/runtime/dev-warnings.js.flow +7 -0
- package/dist/browser/runtime/dev-warnings.js.map +1 -1
- package/dist/browser/runtime/index.js.flow +10 -0
- package/dist/browser/runtime/is-node.js.flow +19 -0
- package/dist/browser/runtime/sheet.d.ts +1 -1
- package/dist/browser/runtime/sheet.js.flow +36 -0
- package/dist/browser/runtime/style-cache.d.ts +1 -1
- package/dist/browser/runtime/style-cache.js.flow +19 -0
- package/dist/browser/runtime/style-cache.js.map +1 -1
- package/dist/browser/runtime/style.d.ts +1 -1
- package/dist/browser/runtime/style.js +2 -2
- package/dist/browser/runtime/style.js.flow +17 -0
- package/dist/browser/runtime/style.js.map +1 -1
- package/dist/browser/runtime/types.js.flow +23 -0
- package/dist/browser/runtime.js.flow +7 -0
- package/dist/browser/styled/index.d.ts +6 -9
- package/dist/browser/styled/index.js.flow +69 -0
- package/dist/browser/styled/index.js.map +1 -1
- package/dist/browser/types.d.ts +6 -3
- package/dist/browser/types.js.flow +29 -0
- package/dist/browser/utils/error.js.flow +7 -0
- package/dist/cjs/class-names/index.d.ts +2 -2
- package/dist/cjs/class-names/index.js.flow +45 -0
- package/dist/cjs/class-names/index.js.map +1 -1
- package/dist/cjs/css/index.d.ts +16 -3
- package/dist/cjs/css/index.js +1 -13
- package/dist/cjs/css/index.js.flow +35 -0
- package/dist/cjs/css/index.js.map +1 -1
- package/dist/cjs/index.d.ts +15 -23
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.flow +15 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jsx/jsx-dev-runtime.d.ts +2 -0
- package/dist/cjs/jsx/jsx-dev-runtime.js +16 -0
- package/dist/cjs/jsx/jsx-dev-runtime.js.map +1 -0
- package/dist/cjs/jsx/jsx-local-namespace.d.ts +40 -0
- package/dist/cjs/jsx/jsx-local-namespace.js +3 -0
- package/dist/cjs/jsx/jsx-local-namespace.js.map +1 -0
- package/dist/cjs/jsx/jsx-runtime.d.ts +2 -0
- package/dist/cjs/jsx/jsx-runtime.js +16 -0
- package/dist/cjs/jsx/jsx-runtime.js.map +1 -0
- package/dist/cjs/keyframes/index.js.flow +54 -0
- package/dist/cjs/runtime/ax.js.flow +27 -0
- package/dist/cjs/runtime/css-custom-property.d.ts +1 -1
- package/dist/cjs/runtime/css-custom-property.js.flow +19 -0
- package/dist/cjs/runtime/css-custom-property.js.map +1 -1
- package/dist/cjs/runtime/dev-warnings.d.ts +0 -1
- package/dist/cjs/runtime/dev-warnings.js +2 -3
- package/dist/cjs/runtime/dev-warnings.js.flow +7 -0
- package/dist/cjs/runtime/dev-warnings.js.map +1 -1
- package/dist/cjs/runtime/index.js.flow +10 -0
- package/dist/cjs/runtime/is-node.js.flow +19 -0
- package/dist/cjs/runtime/sheet.d.ts +1 -1
- package/dist/cjs/runtime/sheet.js.flow +36 -0
- package/dist/cjs/runtime/style-cache.d.ts +1 -1
- package/dist/cjs/runtime/style-cache.js.flow +19 -0
- package/dist/cjs/runtime/style-cache.js.map +1 -1
- package/dist/cjs/runtime/style.d.ts +1 -1
- package/dist/cjs/runtime/style.js +2 -2
- package/dist/cjs/runtime/style.js.flow +17 -0
- package/dist/cjs/runtime/style.js.map +1 -1
- package/dist/cjs/runtime/types.js.flow +23 -0
- package/dist/cjs/runtime.js.flow +7 -0
- package/dist/cjs/styled/index.d.ts +6 -9
- package/dist/cjs/styled/index.js.flow +69 -0
- package/dist/cjs/styled/index.js.map +1 -1
- package/dist/cjs/types.d.ts +6 -3
- package/dist/cjs/types.js.flow +29 -0
- package/dist/cjs/utils/error.js.flow +7 -0
- package/dist/esm/class-names/index.d.ts +2 -2
- package/dist/esm/class-names/index.js.flow +45 -0
- package/dist/esm/class-names/index.js.map +1 -1
- package/dist/esm/css/index.d.ts +16 -3
- package/dist/esm/css/index.js +1 -13
- package/dist/esm/css/index.js.flow +35 -0
- package/dist/esm/css/index.js.map +1 -1
- package/dist/esm/index.d.ts +15 -23
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.flow +15 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/jsx/jsx-dev-runtime.d.ts +2 -0
- package/dist/esm/jsx/jsx-dev-runtime.js +4 -0
- package/dist/esm/jsx/jsx-dev-runtime.js.map +1 -0
- package/dist/esm/jsx/jsx-local-namespace.d.ts +40 -0
- package/dist/esm/jsx/jsx-local-namespace.js +2 -0
- package/dist/esm/jsx/jsx-local-namespace.js.map +1 -0
- package/dist/esm/jsx/jsx-runtime.d.ts +2 -0
- package/dist/esm/jsx/jsx-runtime.js +4 -0
- package/dist/esm/jsx/jsx-runtime.js.map +1 -0
- package/dist/esm/keyframes/index.js.flow +54 -0
- package/dist/esm/runtime/ax.js.flow +27 -0
- package/dist/esm/runtime/css-custom-property.d.ts +1 -1
- package/dist/esm/runtime/css-custom-property.js.flow +19 -0
- package/dist/esm/runtime/css-custom-property.js.map +1 -1
- package/dist/esm/runtime/dev-warnings.d.ts +0 -1
- package/dist/esm/runtime/dev-warnings.js +1 -1
- package/dist/esm/runtime/dev-warnings.js.flow +7 -0
- package/dist/esm/runtime/dev-warnings.js.map +1 -1
- package/dist/esm/runtime/index.js.flow +10 -0
- package/dist/esm/runtime/is-node.js.flow +19 -0
- package/dist/esm/runtime/sheet.d.ts +1 -1
- package/dist/esm/runtime/sheet.js.flow +36 -0
- package/dist/esm/runtime/style-cache.d.ts +1 -1
- package/dist/esm/runtime/style-cache.js.flow +19 -0
- package/dist/esm/runtime/style-cache.js.map +1 -1
- package/dist/esm/runtime/style.d.ts +1 -1
- package/dist/esm/runtime/style.js +2 -2
- package/dist/esm/runtime/style.js.flow +17 -0
- package/dist/esm/runtime/style.js.map +1 -1
- package/dist/esm/runtime/types.js.flow +23 -0
- package/dist/esm/runtime.js.flow +7 -0
- package/dist/esm/styled/index.d.ts +6 -9
- package/dist/esm/styled/index.js.flow +69 -0
- package/dist/esm/styled/index.js.map +1 -1
- package/dist/esm/types.d.ts +6 -3
- package/dist/esm/types.js.flow +29 -0
- package/dist/esm/utils/error.js.flow +7 -0
- package/jsx-dev-runtime/package.json +6 -0
- package/jsx-runtime/package.json +6 -0
- package/package.json +41 -15
- package/src/__tests__/browser.test.tsx +5 -5
- package/src/__tests__/jest-matcher.test.tsx +197 -0
- package/src/__tests__/server-side-hydrate.test.tsx +1 -0
- package/src/__tests__/ssr.test.tsx +2 -2
- package/src/class-names/__tests__/index.test.tsx +1 -1
- package/src/class-names/__tests__/types.test.js.flow +28 -0
- package/src/class-names/index.js.flow +45 -0
- package/src/class-names/index.tsx +3 -2
- package/src/css/__tests__/index.test.tsx +40 -0
- package/src/css/__tests__/types.test.js.flow +17 -0
- package/src/css/index.js.flow +35 -0
- package/src/css/index.tsx +27 -3
- package/src/index.js.flow +15 -0
- package/src/index.tsx +20 -26
- package/src/jsx/__tests__/index.test.tsx +1 -2
- package/src/jsx/__tests__/jsx-import-source-pragma.test.tsx +37 -0
- package/src/jsx/__tests__/jsx-pragma.test.tsx +39 -0
- package/src/jsx/jsx-dev-runtime.tsx +5 -0
- package/src/jsx/jsx-local-namespace.tsx +49 -0
- package/src/jsx/jsx-runtime.tsx +5 -0
- package/src/keyframes/__tests__/index.test.tsx +2 -1
- package/src/keyframes/__tests__/types.test.js.flow +31 -0
- package/src/keyframes/index.js.flow +54 -0
- package/src/runtime/__perf__/ax.test.ts +42 -0
- package/src/runtime/__perf__/cs.test.tsx +111 -0
- package/src/runtime/__perf__/sheet.test.ts +61 -0
- package/src/runtime/__perf__/utils/cs.tsx +60 -0
- package/src/runtime/__perf__/utils/sheet.tsx +151 -0
- package/src/runtime/__tests__/style-ssr.test.tsx +1 -0
- package/src/runtime/__tests__/style.test.tsx +92 -58
- package/src/runtime/ax.js.flow +27 -0
- package/src/runtime/css-custom-property.js.flow +19 -0
- package/src/runtime/css-custom-property.tsx +1 -1
- package/src/runtime/dev-warnings.js.flow +7 -0
- package/src/runtime/dev-warnings.tsx +1 -1
- package/src/runtime/index.js.flow +10 -0
- package/src/runtime/is-node.js.flow +19 -0
- package/src/runtime/sheet.js.flow +36 -0
- package/src/runtime/sheet.tsx +1 -1
- package/src/runtime/style-cache.js.flow +19 -0
- package/src/runtime/style-cache.tsx +2 -1
- package/src/runtime/style.js.flow +17 -0
- package/src/runtime/style.tsx +4 -3
- package/src/runtime/types.js.flow +23 -0
- package/src/runtime.js.flow +7 -0
- package/src/styled/__tests__/index.test.tsx +3 -3
- package/src/styled/__tests__/types.test.js.flow +30 -0
- package/src/styled/index.js.flow +69 -0
- package/src/styled/index.tsx +7 -10
- package/src/types.js.flow +29 -0
- package/src/types.tsx +7 -3
- package/src/utils/error.js.flow +7 -0
- package/dist/browser/codemods/codemods-helpers.d.ts +0 -60
- package/dist/browser/codemods/codemods-helpers.js +0 -201
- package/dist/browser/codemods/codemods-helpers.js.map +0 -1
- package/dist/browser/codemods/constants.d.ts +0 -3
- package/dist/browser/codemods/constants.js +0 -4
- package/dist/browser/codemods/constants.js.map +0 -1
- package/dist/browser/codemods/emotion-to-compiled/emotion-to-compiled.d.ts +0 -3
- package/dist/browser/codemods/emotion-to-compiled/emotion-to-compiled.js +0 -178
- package/dist/browser/codemods/emotion-to-compiled/emotion-to-compiled.js.map +0 -1
- package/dist/browser/codemods/emotion-to-compiled/index.d.ts +0 -1
- package/dist/browser/codemods/emotion-to-compiled/index.js +0 -2
- package/dist/browser/codemods/emotion-to-compiled/index.js.map +0 -1
- package/dist/browser/codemods/styled-components-to-compiled/index.d.ts +0 -1
- package/dist/browser/codemods/styled-components-to-compiled/index.js +0 -2
- package/dist/browser/codemods/styled-components-to-compiled/index.js.map +0 -1
- package/dist/browser/codemods/styled-components-to-compiled/styled-components-to-compiled.d.ts +0 -3
- package/dist/browser/codemods/styled-components-to-compiled/styled-components-to-compiled.js +0 -33
- package/dist/browser/codemods/styled-components-to-compiled/styled-components-to-compiled.js.map +0 -1
- package/dist/cjs/codemods/codemods-helpers.d.ts +0 -60
- package/dist/cjs/codemods/codemods-helpers.js +0 -217
- package/dist/cjs/codemods/codemods-helpers.js.map +0 -1
- package/dist/cjs/codemods/constants.d.ts +0 -3
- package/dist/cjs/codemods/constants.js +0 -7
- package/dist/cjs/codemods/constants.js.map +0 -1
- package/dist/cjs/codemods/emotion-to-compiled/emotion-to-compiled.d.ts +0 -3
- package/dist/cjs/codemods/emotion-to-compiled/emotion-to-compiled.js +0 -180
- package/dist/cjs/codemods/emotion-to-compiled/emotion-to-compiled.js.map +0 -1
- package/dist/cjs/codemods/emotion-to-compiled/index.d.ts +0 -1
- package/dist/cjs/codemods/emotion-to-compiled/index.js +0 -9
- package/dist/cjs/codemods/emotion-to-compiled/index.js.map +0 -1
- package/dist/cjs/codemods/styled-components-to-compiled/index.d.ts +0 -1
- package/dist/cjs/codemods/styled-components-to-compiled/index.js +0 -9
- package/dist/cjs/codemods/styled-components-to-compiled/index.js.map +0 -1
- package/dist/cjs/codemods/styled-components-to-compiled/styled-components-to-compiled.d.ts +0 -3
- package/dist/cjs/codemods/styled-components-to-compiled/styled-components-to-compiled.js +0 -35
- package/dist/cjs/codemods/styled-components-to-compiled/styled-components-to-compiled.js.map +0 -1
- package/dist/esm/codemods/codemods-helpers.d.ts +0 -60
- package/dist/esm/codemods/codemods-helpers.js +0 -201
- package/dist/esm/codemods/codemods-helpers.js.map +0 -1
- package/dist/esm/codemods/constants.d.ts +0 -3
- package/dist/esm/codemods/constants.js +0 -4
- package/dist/esm/codemods/constants.js.map +0 -1
- package/dist/esm/codemods/emotion-to-compiled/emotion-to-compiled.d.ts +0 -3
- package/dist/esm/codemods/emotion-to-compiled/emotion-to-compiled.js +0 -178
- package/dist/esm/codemods/emotion-to-compiled/emotion-to-compiled.js.map +0 -1
- package/dist/esm/codemods/emotion-to-compiled/index.d.ts +0 -1
- package/dist/esm/codemods/emotion-to-compiled/index.js +0 -2
- package/dist/esm/codemods/emotion-to-compiled/index.js.map +0 -1
- package/dist/esm/codemods/styled-components-to-compiled/index.d.ts +0 -1
- package/dist/esm/codemods/styled-components-to-compiled/index.js +0 -2
- package/dist/esm/codemods/styled-components-to-compiled/index.js.map +0 -1
- package/dist/esm/codemods/styled-components-to-compiled/styled-components-to-compiled.d.ts +0 -3
- package/dist/esm/codemods/styled-components-to-compiled/styled-components-to-compiled.js +0 -33
- package/dist/esm/codemods/styled-components-to-compiled/styled-components-to-compiled.js.map +0 -1
- package/src/codemods/README.md +0 -8
- package/src/codemods/codemods-helpers.tsx +0 -369
- package/src/codemods/constants.tsx +0 -3
- package/src/codemods/emotion-to-compiled/README.md +0 -71
- package/src/codemods/emotion-to-compiled/__tests__/emotion-to-compiled.test.tsx +0 -526
- package/src/codemods/emotion-to-compiled/emotion-to-compiled.tsx +0 -249
- package/src/codemods/emotion-to-compiled/index.tsx +0 -1
- package/src/codemods/styled-components-to-compiled/README.md +0 -37
- package/src/codemods/styled-components-to-compiled/__tests__/styled-components-to-compiled.test.tsx +0 -109
- package/src/codemods/styled-components-to-compiled/index.tsx +0 -1
- package/src/codemods/styled-components-to-compiled/styled-components-to-compiled.tsx +0 -45
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for index
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.15.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentType } from 'react';
|
|
8
|
+
import type { BasicTemplateInterpolations, CssFunction, FunctionInterpolation } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Typing for the CSS object.
|
|
11
|
+
*/
|
|
12
|
+
export type CssObject<TProps> = CssFunction<FunctionInterpolation<TProps>>;
|
|
13
|
+
/**
|
|
14
|
+
* Extra props added to the output Styled Component.
|
|
15
|
+
*/
|
|
16
|
+
export type StyledProps = {
|
|
17
|
+
as?: $Keys<$JSXIntrinsics>,
|
|
18
|
+
};
|
|
19
|
+
export type Interpolations<TProps: mixed> = (
|
|
20
|
+
| BasicTemplateInterpolations
|
|
21
|
+
| FunctionInterpolation<TProps>
|
|
22
|
+
| CssObject<TProps>
|
|
23
|
+
| CssObject<TProps>[]
|
|
24
|
+
)[];
|
|
25
|
+
/**
|
|
26
|
+
* This allows us to take the generic `TTag` (that will be a valid `DOM` tag) and then use it to
|
|
27
|
+
* define correct props based on it from `$JSXIntrinsics`, while also injecting our own
|
|
28
|
+
* props from `StyledProps`.
|
|
29
|
+
*/
|
|
30
|
+
export interface StyledFunctionFromTag<TTag: $Keys<$JSXIntrinsics>> {
|
|
31
|
+
<TProps: mixed>(
|
|
32
|
+
css: CssObject<TProps> | $ReadOnlyArray<CssObject<TProps>>,
|
|
33
|
+
...interpolations: Interpolations<TProps>
|
|
34
|
+
): React$ComponentType<{
|
|
35
|
+
...TProps,
|
|
36
|
+
...$Exact<$ElementType<$JSXIntrinsics, TTag>>,
|
|
37
|
+
...StyledProps,
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export interface StyledFunctionFromComponent<TInheritedProps: mixed> {
|
|
41
|
+
<TProps: mixed>(
|
|
42
|
+
css: CssObject<TProps> | $ReadOnlyArray<string>,
|
|
43
|
+
...interpolations: Interpolations<TProps>
|
|
44
|
+
): React$ComponentType<{ ...TProps, ...StyledProps, ...TInheritedProps }>;
|
|
45
|
+
}
|
|
46
|
+
export type StyledComponentMap = $ObjMapi<$JSXIntrinsics, <Tag>(Tag) => StyledFunctionFromTag<Tag>>;
|
|
47
|
+
export type StyledComponentInstantiator = {
|
|
48
|
+
/**
|
|
49
|
+
* Typing to enable consumers to compose components, e.g: `styled(Component)`
|
|
50
|
+
*/
|
|
51
|
+
<TInheritedProps: mixed>(
|
|
52
|
+
Component: ComponentType<TInheritedProps>
|
|
53
|
+
): StyledFunctionFromComponent<TInheritedProps>,
|
|
54
|
+
...
|
|
55
|
+
} & StyledComponentMap;
|
|
56
|
+
/**
|
|
57
|
+
* Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support.
|
|
58
|
+
*
|
|
59
|
+
* ```
|
|
60
|
+
* styled.div`font-size: 12px`; // Template literal CSS
|
|
61
|
+
* styled.div({ fontSize: 12 }); // Object CSS
|
|
62
|
+
* styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS
|
|
63
|
+
* styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* For more help, read the docs:
|
|
67
|
+
* https://compiledcssinjs.com/docs/api-styled
|
|
68
|
+
*/
|
|
69
|
+
declare export var styled: StyledComponentInstantiator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwDlD;;;;;;;;;;;;GAYG;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"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import * as CSS from 'csstype';
|
|
1
|
+
import type * as CSS from 'csstype';
|
|
2
2
|
/**
|
|
3
3
|
* Typing for the interpolations.
|
|
4
4
|
*/
|
|
5
5
|
export declare type BasicTemplateInterpolations = string | number;
|
|
6
|
+
export interface FunctionInterpolation<TProps> {
|
|
7
|
+
(props: TProps): CSSProps | BasicTemplateInterpolations | boolean | undefined;
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* These are all the CSS props that will exist.
|
|
8
11
|
*/
|
|
9
|
-
export declare type CSSProps = CSS.Properties<
|
|
12
|
+
export declare type CSSProps = CSS.Properties<BasicTemplateInterpolations>;
|
|
10
13
|
export declare type AnyKeyCssProps<TValue> = {
|
|
11
|
-
[key: string]: AnyKeyCssProps<TValue> | CSSProps |
|
|
14
|
+
[key: string]: AnyKeyCssProps<TValue> | CSSProps | BasicTemplateInterpolations | TValue;
|
|
12
15
|
};
|
|
13
16
|
export declare type CssFunction<TValue = void> = CSSProps | AnyKeyCssProps<TValue> | TemplateStringsArray | string | boolean | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for types
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.15.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as CSS from 'csstype';
|
|
8
|
+
/**
|
|
9
|
+
* Typing for the interpolations.
|
|
10
|
+
*/
|
|
11
|
+
export type BasicTemplateInterpolations = string | number;
|
|
12
|
+
export interface FunctionInterpolation<TProps> {
|
|
13
|
+
(props: TProps): CSSProps | BasicTemplateInterpolations | boolean | void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* These are all the CSS props that will exist.
|
|
17
|
+
*/
|
|
18
|
+
export type CSSProps = CSS.Properties<BasicTemplateInterpolations>;
|
|
19
|
+
export type AnyKeyCssProps<TValue> = {
|
|
20
|
+
[key: string]: AnyKeyCssProps<TValue> | CSSProps | BasicTemplateInterpolations | TValue,
|
|
21
|
+
...
|
|
22
|
+
};
|
|
23
|
+
export type CssFunction<TValue = void> =
|
|
24
|
+
| CSSProps
|
|
25
|
+
| AnyKeyCssProps<TValue>
|
|
26
|
+
| $ReadOnlyArray<string>
|
|
27
|
+
| string
|
|
28
|
+
| boolean
|
|
29
|
+
| void;
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compiled/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "A familiar and performant compile time CSS-in-JS library for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiled",
|
|
7
7
|
"css-in-js",
|
|
8
8
|
"styled-components",
|
|
9
|
-
"emotion-js",
|
|
10
9
|
"typescript"
|
|
11
10
|
],
|
|
12
11
|
"homepage": "https://compiledcssinjs.com",
|
|
@@ -21,16 +20,44 @@
|
|
|
21
20
|
"sideEffects": false,
|
|
22
21
|
"exports": {
|
|
23
22
|
".": {
|
|
24
|
-
"import":
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
23
|
+
"import": [
|
|
24
|
+
"./dist/esm/index.js",
|
|
25
|
+
"./src/index.tsx"
|
|
26
|
+
],
|
|
27
|
+
"require": [
|
|
28
|
+
"./dist/cjs/index.js",
|
|
29
|
+
"./src/index.tsx"
|
|
30
|
+
]
|
|
30
31
|
},
|
|
31
32
|
"./runtime": {
|
|
32
|
-
"import":
|
|
33
|
-
|
|
33
|
+
"import": [
|
|
34
|
+
"./dist/esm/runtime.js",
|
|
35
|
+
"./src/runtime.tsx"
|
|
36
|
+
],
|
|
37
|
+
"require": [
|
|
38
|
+
"./dist/cjs/runtime.js",
|
|
39
|
+
"./src/runtime.tsx"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"./jsx-runtime": {
|
|
43
|
+
"import": [
|
|
44
|
+
"./dist/esm/jsx/jsx-runtime.js",
|
|
45
|
+
"./src/jsx/jsx-runtime.tsx"
|
|
46
|
+
],
|
|
47
|
+
"require": [
|
|
48
|
+
"./dist/cjs/jsx/jsx-runtime.js",
|
|
49
|
+
"./src/jsx/jsx-runtime.tsx"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"./jsx-dev-runtime": {
|
|
53
|
+
"import": [
|
|
54
|
+
"./dist/esm/jsx/jsx-dev-runtime.js",
|
|
55
|
+
"./src/jsx/jsx-dev-runtime.tsx"
|
|
56
|
+
],
|
|
57
|
+
"require": [
|
|
58
|
+
"./dist/cjs/jsx/jsx-dev-runtime.js",
|
|
59
|
+
"./src/jsx/jsx-dev-runtime.tsx"
|
|
60
|
+
]
|
|
34
61
|
}
|
|
35
62
|
},
|
|
36
63
|
"main": "./dist/cjs/index.js",
|
|
@@ -40,17 +67,16 @@
|
|
|
40
67
|
"files": [
|
|
41
68
|
"dist",
|
|
42
69
|
"src",
|
|
43
|
-
"babel-plugin",
|
|
44
70
|
"runtime",
|
|
45
|
-
"
|
|
71
|
+
"jsx-runtime",
|
|
72
|
+
"jsx-dev-runtime"
|
|
46
73
|
],
|
|
47
74
|
"dependencies": {
|
|
48
|
-
"csstype": "^3.0.
|
|
75
|
+
"csstype": "^3.0.9"
|
|
49
76
|
},
|
|
50
77
|
"devDependencies": {
|
|
51
78
|
"@testing-library/react": "^11.2.7",
|
|
52
|
-
"@types/
|
|
53
|
-
"jscodeshift": "^0.12.0",
|
|
79
|
+
"@types/react-dom": "^17.0.10",
|
|
54
80
|
"react": "^17.0.2",
|
|
55
81
|
"react-dom": "^17.0.2"
|
|
56
82
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
1
|
import { styled } from '@compiled/react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
jest.mock('../../
|
|
5
|
+
// TODO: When we move back to browser checking (window vs. process) we can remove
|
|
6
|
+
// this and replace with the "jest-environment node" pragma.
|
|
7
|
+
jest.mock('../../src/runtime/is-node', () => ({
|
|
8
8
|
isNodeEnvironment: () => false,
|
|
9
9
|
}));
|
|
10
10
|
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/** @jsxImportSource @compiled/react */
|
|
2
|
+
import { styled } from '@compiled/react';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
describe('toHaveCompliedCss', () => {
|
|
6
|
+
it('should detect styles', () => {
|
|
7
|
+
const { getByText } = render(
|
|
8
|
+
<div
|
|
9
|
+
css={{
|
|
10
|
+
fontSize: '12px',
|
|
11
|
+
}}>
|
|
12
|
+
hello world
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should detect missing styles', () => {
|
|
20
|
+
const { getByText } = render(<div css={{ fontSize: '12px' }}>hello world</div>);
|
|
21
|
+
|
|
22
|
+
expect(getByText('hello world')).not.toHaveCompiledCss('color', 'blue');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should detect multiple styles', () => {
|
|
26
|
+
const { getByText } = render(<div css={{ fontSize: '12px', color: 'blue' }}>hello world</div>);
|
|
27
|
+
|
|
28
|
+
expect(getByText('hello world')).toHaveCompiledCss({
|
|
29
|
+
fontSize: '12px',
|
|
30
|
+
color: 'blue',
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should detect single missing styles', () => {
|
|
35
|
+
const { getByText } = render(<div css={{ fontSize: '12px', color: 'blue' }}>hello world</div>);
|
|
36
|
+
|
|
37
|
+
expect(getByText('hello world')).not.toHaveCompiledCss({
|
|
38
|
+
zindex: '9999',
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should detect multiple missing styles', () => {
|
|
43
|
+
const { getByText } = render(<div css={{ fontSize: '12px', color: 'blue' }}>hello world</div>);
|
|
44
|
+
|
|
45
|
+
expect(getByText('hello world')).not.toHaveCompiledCss({
|
|
46
|
+
backgroundColor: 'yellow',
|
|
47
|
+
zindex: '9999',
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should detect evaluated rule from array styles', () => {
|
|
52
|
+
const base = { color: 'blue' };
|
|
53
|
+
const next = ` font-size: 15px; `;
|
|
54
|
+
|
|
55
|
+
const { getByText } = render(<div css={[base, next]}>hello world</div>);
|
|
56
|
+
|
|
57
|
+
expect(getByText('hello world')).toHaveCompiledCss('font-size', '15px');
|
|
58
|
+
expect(getByText('hello world')).toHaveCompiledCss('color', 'blue');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should find styles composed from multiple sources', () => {
|
|
62
|
+
const StyledDiv = styled.div`
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
const { getByText } = render(<StyledDiv css={{ fontSize: 14 }}>Hello world</StyledDiv>);
|
|
67
|
+
|
|
68
|
+
expect(getByText('Hello world')).toHaveCompiledCss('font-size', '14px');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should find multiple styles composed from multiple sources', () => {
|
|
72
|
+
const StyledDiv = styled.div`
|
|
73
|
+
color: yellow;
|
|
74
|
+
background-color: red;
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
const { getByText } = render(<StyledDiv css={{ color: 'blue' }}>Hello world</StyledDiv>);
|
|
78
|
+
|
|
79
|
+
expect(getByText('Hello world')).toHaveCompiledCss({
|
|
80
|
+
backgroundColor: 'red',
|
|
81
|
+
color: 'blue',
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should match styles with target:hover', () => {
|
|
86
|
+
const { getByText } = render(
|
|
87
|
+
<div
|
|
88
|
+
css={{
|
|
89
|
+
fontSize: '12px',
|
|
90
|
+
':hover': {
|
|
91
|
+
transform: 'scale(2)',
|
|
92
|
+
},
|
|
93
|
+
}}>
|
|
94
|
+
hello world
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
const el = getByText('hello world');
|
|
98
|
+
expect(el).toHaveCompiledCss('transform', 'scale(2)', { target: ':hover' });
|
|
99
|
+
expect(el).not.toHaveCompiledCss('transform', 'scale(2)');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should match styles with target', () => {
|
|
103
|
+
const { getByText } = render(
|
|
104
|
+
<div
|
|
105
|
+
css={{
|
|
106
|
+
fontSize: '12px',
|
|
107
|
+
':hover': {
|
|
108
|
+
transform: 'scale(2)',
|
|
109
|
+
},
|
|
110
|
+
':active': {
|
|
111
|
+
color: 'blue',
|
|
112
|
+
},
|
|
113
|
+
}}>
|
|
114
|
+
hello world
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
const el = getByText('hello world');
|
|
118
|
+
expect(el).not.toHaveCompiledCss('color', 'blue', { target: ':hover' });
|
|
119
|
+
expect(el).not.toHaveCompiledCss('transform', 'scale(2)');
|
|
120
|
+
expect(el).not.toHaveCompiledCss('transform', 'scale(2)', { target: ':active' });
|
|
121
|
+
expect(el).toHaveCompiledCss('transform', 'scale(2)', { target: ':hover' });
|
|
122
|
+
expect(el).toHaveCompiledCss('color', 'blue', { target: ':active' });
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should match styles with media', () => {
|
|
126
|
+
const { getByText } = render(
|
|
127
|
+
<div
|
|
128
|
+
css={{
|
|
129
|
+
color: 'green',
|
|
130
|
+
'@media screen': {
|
|
131
|
+
color: 'yellow',
|
|
132
|
+
},
|
|
133
|
+
}}>
|
|
134
|
+
hello world
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
const el = getByText('hello world');
|
|
138
|
+
expect(el).toHaveCompiledCss('color', 'green');
|
|
139
|
+
expect(el).toHaveCompiledCss('color', 'yellow', { media: 'screen' });
|
|
140
|
+
// without narrowing to media -> screen
|
|
141
|
+
expect(el).not.toHaveCompiledCss('color', 'yellow');
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should match styles with media and target', () => {
|
|
145
|
+
const { getByText } = render(
|
|
146
|
+
<div
|
|
147
|
+
css={{
|
|
148
|
+
color: 'green',
|
|
149
|
+
'@media screen': {
|
|
150
|
+
color: 'yellow',
|
|
151
|
+
':hover': {
|
|
152
|
+
background: 'red',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
}}>
|
|
156
|
+
hello world
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
const el = getByText('hello world');
|
|
160
|
+
expect(el).toHaveCompiledCss('background-color', 'red', { media: 'screen', target: ':hover' });
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('should match styles with media nested inside class', () => {
|
|
164
|
+
const { getByText } = render(
|
|
165
|
+
<div
|
|
166
|
+
css={{
|
|
167
|
+
'@media (min-width: 2px)': {
|
|
168
|
+
color: 'blue',
|
|
169
|
+
'@media (min-width: 1px)': {
|
|
170
|
+
color: 'red',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
}}>
|
|
174
|
+
hello world
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
const el = getByText('hello world');
|
|
178
|
+
expect(el).toHaveCompiledCss('color', 'blue', { media: '(min-width: 2px)' });
|
|
179
|
+
expect(el).toHaveCompiledCss('color', 'red', { media: '(min-width: 1px)' });
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('should match complicated direct ancestors', () => {
|
|
183
|
+
const { getByText } = render(
|
|
184
|
+
<div
|
|
185
|
+
css={`
|
|
186
|
+
> :first-child {
|
|
187
|
+
color: red;
|
|
188
|
+
}
|
|
189
|
+
`}>
|
|
190
|
+
hello world
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const el = getByText('hello world');
|
|
195
|
+
expect(el).toHaveCompiledCss('color', 'red', { target: '> :first-child' });
|
|
196
|
+
});
|
|
197
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jest-environment node
|
|
3
3
|
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { renderToStaticMarkup } from 'react-dom/server';
|
|
6
4
|
import { styled } from '@compiled/react';
|
|
7
5
|
import { CC as CompiledRoot } from '@compiled/react/runtime';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
8
8
|
|
|
9
9
|
describe('SSR', () => {
|
|
10
10
|
it('should render styles inline', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ClassNames } from '@compiled/react';
|
|
1
2
|
import { render } from '@testing-library/react';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import { ClassNames } from '@compiled/react';
|
|
4
4
|
|
|
5
5
|
describe('class names component', () => {
|
|
6
6
|
it('should create css from object literal', () => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import React, { type Node } from 'react';
|
|
3
|
+
import { ClassNames, type CssFunction } from '@compiled/react';
|
|
4
|
+
|
|
5
|
+
// Object call expression
|
|
6
|
+
({ children }: { children: Node }): React$Element<typeof ClassNames> => (
|
|
7
|
+
<ClassNames>{({ css }) => <span className={css({ fontSize: 12 })}>{children}</span>}</ClassNames>
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
// Tagged template expression
|
|
11
|
+
({ children }: { children: Node }): React$Element<typeof ClassNames> => (
|
|
12
|
+
<ClassNames>
|
|
13
|
+
{({ css }) => (
|
|
14
|
+
<span
|
|
15
|
+
className={css`
|
|
16
|
+
font-size: 12px;
|
|
17
|
+
`}>
|
|
18
|
+
{children}
|
|
19
|
+
</span>
|
|
20
|
+
)}
|
|
21
|
+
</ClassNames>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// Array
|
|
25
|
+
({ children }: { children: Node }): React$Element<typeof ClassNames> => {
|
|
26
|
+
const classes: CssFunction<>[] = [{ fontSize: 12 }, `font-size: 12px`];
|
|
27
|
+
return <ClassNames>{({ css }) => <span className={css(classes)}>{children}</span>}</ClassNames>;
|
|
28
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for index
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.15.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import type { Node } from 'react';
|
|
8
|
+
import type { BasicTemplateInterpolations, CssFunction } from '../types';
|
|
9
|
+
export type Interpolations = (BasicTemplateInterpolations | CssFunction<> | CssFunction<>[])[];
|
|
10
|
+
export interface ClassNamesProps {
|
|
11
|
+
children: (opts: {
|
|
12
|
+
css: (css: CssFunction<> | CssFunction<>[], ...interpolations: Interpolations) => string,
|
|
13
|
+
style: {
|
|
14
|
+
[key: string]: string,
|
|
15
|
+
...
|
|
16
|
+
},
|
|
17
|
+
...
|
|
18
|
+
}) => Node;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Use a component where styles are not necessarily tied to an element.
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
* // Object CSS
|
|
25
|
+
* <ClassNames>
|
|
26
|
+
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
|
|
27
|
+
* </ClassNames>
|
|
28
|
+
*
|
|
29
|
+
* // Template literal CSS
|
|
30
|
+
* <ClassNames>
|
|
31
|
+
* {({ css, style }) => children({ className: css`font-size: 12px;` })}
|
|
32
|
+
* </ClassNames>
|
|
33
|
+
*
|
|
34
|
+
* // Array CSS
|
|
35
|
+
* <ClassNames>
|
|
36
|
+
* {({ css, style }) =>
|
|
37
|
+
* children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })}
|
|
38
|
+
* </ClassNames>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* For more help, read the docs:
|
|
42
|
+
* https://compiledcssinjs.com/docs/api-class-names
|
|
43
|
+
* @param props
|
|
44
|
+
*/
|
|
45
|
+
declare export function ClassNames(_: ClassNamesProps): React$Node;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { BasicTemplateInterpolations, CssFunction } from '../types';
|
|
2
4
|
import { createSetupError } from '../utils/error';
|
|
3
|
-
import { CssFunction, BasicTemplateInterpolations } from '../types';
|
|
4
5
|
|
|
5
6
|
export type Interpolations = (BasicTemplateInterpolations | CssFunction | CssFunction[])[];
|
|
6
7
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @jsxImportSource @compiled/react */
|
|
2
|
+
import { css } from '@compiled/react';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
describe('css prop', () => {
|
|
6
|
+
it('should create css from object literal', () => {
|
|
7
|
+
const { getByText } = render(<div css={css({ fontSize: '13px' })}>hello world</div>);
|
|
8
|
+
|
|
9
|
+
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should create css from object literal call expression', () => {
|
|
13
|
+
const style = css({ fontSize: '13px' });
|
|
14
|
+
const { getByText } = render(<div css={style}>hello world</div>);
|
|
15
|
+
|
|
16
|
+
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should create css from tagged template expression', () => {
|
|
20
|
+
const { getByText } = render(
|
|
21
|
+
<div
|
|
22
|
+
css={css`
|
|
23
|
+
font-size: 13px;
|
|
24
|
+
`}>
|
|
25
|
+
hello world
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should create css from tagged template expression variable', () => {
|
|
33
|
+
const style = css`
|
|
34
|
+
font-size: 13px;
|
|
35
|
+
`;
|
|
36
|
+
const { getByText } = render(<div css={style}>hello world</div>);
|
|
37
|
+
|
|
38
|
+
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { css } from '@compiled/react';
|
|
4
|
+
|
|
5
|
+
// Tagged template expression
|
|
6
|
+
(): React$Element<'div'> => {
|
|
7
|
+
const styles = css`
|
|
8
|
+
color: red;
|
|
9
|
+
`;
|
|
10
|
+
return <div css={styles}>red text</div>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// Object call expression
|
|
14
|
+
(): React$Element<'div'> => {
|
|
15
|
+
const styles = css({ color: 'red' });
|
|
16
|
+
return <div css={styles}>red text</div>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for index
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.15.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import type { BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* Create styles that can be re-used between components with a template literal.
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* css`color: red;`;
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* For more help, read the docs:
|
|
16
|
+
* https://compiledcssinjs.com/docs/api-css
|
|
17
|
+
* @param css
|
|
18
|
+
* @param values
|
|
19
|
+
*/
|
|
20
|
+
declare export default function css<T>(
|
|
21
|
+
_css: $ReadOnlyArray<string>,
|
|
22
|
+
..._values: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]
|
|
23
|
+
): CSSProps;
|
|
24
|
+
/**
|
|
25
|
+
* Create styles that can be re-used between components with an object
|
|
26
|
+
*
|
|
27
|
+
* ```
|
|
28
|
+
* css({ color: 'red' });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* For more help, read the docs:
|
|
32
|
+
* https://compiledcssinjs.com/docs/api-css
|
|
33
|
+
* @param css
|
|
34
|
+
*/
|
|
35
|
+
declare export default function css(_css: CSSProps): CSSProps;
|