@compiled/react 0.15.0 → 0.16.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/css-map/index.d.ts +15 -26
- package/dist/browser/css-map/index.js +5 -4
- package/dist/browser/css-map/index.js.map +1 -1
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.js +1 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/jsx/jsx-local-namespace.d.ts +5 -1
- package/dist/browser/runtime/ac.d.ts +2 -2
- package/dist/browser/runtime/ac.js.map +1 -1
- package/dist/browser/runtime/ax.d.ts +1 -1
- package/dist/browser/runtime/ax.js.map +1 -1
- package/dist/browser/types.d.ts +9 -1
- package/dist/browser/xcss-prop/index.d.ts +130 -0
- package/dist/browser/xcss-prop/index.js +26 -0
- package/dist/browser/xcss-prop/index.js.map +1 -0
- package/dist/cjs/css-map/index.d.ts +15 -26
- package/dist/cjs/css-map/index.js +5 -4
- package/dist/cjs/css-map/index.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jsx/jsx-local-namespace.d.ts +5 -1
- package/dist/cjs/runtime/ac.d.ts +2 -2
- package/dist/cjs/runtime/ac.js.map +1 -1
- package/dist/cjs/runtime/ax.d.ts +1 -1
- package/dist/cjs/runtime/ax.js.map +1 -1
- package/dist/cjs/types.d.ts +9 -1
- package/dist/cjs/xcss-prop/index.d.ts +130 -0
- package/dist/cjs/xcss-prop/index.js +30 -0
- package/dist/cjs/xcss-prop/index.js.map +1 -0
- package/dist/esm/css-map/index.d.ts +15 -26
- package/dist/esm/css-map/index.js +5 -4
- package/dist/esm/css-map/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/jsx/jsx-local-namespace.d.ts +5 -1
- package/dist/esm/runtime/ac.d.ts +2 -2
- package/dist/esm/runtime/ac.js.map +1 -1
- package/dist/esm/runtime/ax.d.ts +1 -1
- package/dist/esm/runtime/ax.js.map +1 -1
- package/dist/esm/types.d.ts +9 -1
- package/dist/esm/xcss-prop/index.d.ts +130 -0
- package/dist/esm/xcss-prop/index.js +26 -0
- package/dist/esm/xcss-prop/index.js.map +1 -0
- package/package.json +3 -2
- package/src/css/__tests__/types.test.ts +12 -0
- package/src/css-map/index.ts +19 -33
- package/src/index.ts +1 -0
- package/src/jsx/jsx-local-namespace.ts +8 -1
- package/src/runtime/ac.ts +1 -1
- package/src/runtime/ax.ts +1 -1
- package/src/types.ts +68 -0
- package/src/xcss-prop/__tests__/xcss-prop.test.tsx +294 -0
- package/src/xcss-prop/index.ts +174 -0
- package/dist/browser/class-names/index.js.flow +0 -53
- package/dist/browser/css/index.js.flow +0 -36
- package/dist/browser/css-map/index.js.flow +0 -125
- package/dist/browser/css-map/pseudos.d.ts +0 -1
- package/dist/browser/css-map/pseudos.js +0 -5
- package/dist/browser/css-map/pseudos.js.flow +0 -57
- package/dist/browser/css-map/pseudos.js.map +0 -1
- package/dist/browser/index.js.flow +0 -13
- package/dist/browser/keyframes/index.js.flow +0 -48
- package/dist/browser/runtime/ac.js.flow +0 -56
- package/dist/browser/runtime/ax.js.flow +0 -27
- package/dist/browser/runtime/cache.js.flow +0 -18
- package/dist/browser/runtime/css-custom-property.js.flow +0 -19
- package/dist/browser/runtime/dev-warnings.js.flow +0 -7
- package/dist/browser/runtime/index.js.flow +0 -11
- package/dist/browser/runtime/is-server-environment.js.flow +0 -19
- package/dist/browser/runtime/sheet.js.flow +0 -36
- package/dist/browser/runtime/style-cache.js.flow +0 -19
- package/dist/browser/runtime/style.js.flow +0 -16
- package/dist/browser/runtime/types.js.flow +0 -23
- package/dist/browser/runtime.js.flow +0 -7
- package/dist/browser/styled/index.js.flow +0 -66
- package/dist/browser/types.js.flow +0 -31
- package/dist/browser/utils/error.js.flow +0 -7
- package/dist/cjs/class-names/index.js.flow +0 -53
- package/dist/cjs/css/index.js.flow +0 -36
- package/dist/cjs/css-map/index.js.flow +0 -125
- package/dist/cjs/css-map/pseudos.d.ts +0 -1
- package/dist/cjs/css-map/pseudos.js +0 -6
- package/dist/cjs/css-map/pseudos.js.flow +0 -57
- package/dist/cjs/css-map/pseudos.js.map +0 -1
- package/dist/cjs/index.js.flow +0 -13
- package/dist/cjs/keyframes/index.js.flow +0 -48
- package/dist/cjs/runtime/ac.js.flow +0 -56
- package/dist/cjs/runtime/ax.js.flow +0 -27
- package/dist/cjs/runtime/cache.js.flow +0 -18
- package/dist/cjs/runtime/css-custom-property.js.flow +0 -19
- package/dist/cjs/runtime/dev-warnings.js.flow +0 -7
- package/dist/cjs/runtime/index.js.flow +0 -11
- package/dist/cjs/runtime/is-server-environment.js.flow +0 -19
- package/dist/cjs/runtime/sheet.js.flow +0 -36
- package/dist/cjs/runtime/style-cache.js.flow +0 -19
- package/dist/cjs/runtime/style.js.flow +0 -16
- package/dist/cjs/runtime/types.js.flow +0 -23
- package/dist/cjs/runtime.js.flow +0 -7
- package/dist/cjs/styled/index.js.flow +0 -66
- package/dist/cjs/types.js.flow +0 -31
- package/dist/cjs/utils/error.js.flow +0 -7
- package/dist/esm/class-names/index.js.flow +0 -53
- package/dist/esm/css/index.js.flow +0 -36
- package/dist/esm/css-map/index.js.flow +0 -125
- package/dist/esm/css-map/pseudos.d.ts +0 -1
- package/dist/esm/css-map/pseudos.js +0 -5
- package/dist/esm/css-map/pseudos.js.flow +0 -57
- package/dist/esm/css-map/pseudos.js.map +0 -1
- package/dist/esm/index.js.flow +0 -13
- package/dist/esm/keyframes/index.js.flow +0 -48
- package/dist/esm/runtime/ac.js.flow +0 -56
- package/dist/esm/runtime/ax.js.flow +0 -27
- package/dist/esm/runtime/cache.js.flow +0 -18
- package/dist/esm/runtime/css-custom-property.js.flow +0 -19
- package/dist/esm/runtime/dev-warnings.js.flow +0 -7
- package/dist/esm/runtime/index.js.flow +0 -11
- package/dist/esm/runtime/is-server-environment.js.flow +0 -19
- package/dist/esm/runtime/sheet.js.flow +0 -36
- package/dist/esm/runtime/style-cache.js.flow +0 -19
- package/dist/esm/runtime/style.js.flow +0 -16
- package/dist/esm/runtime/types.js.flow +0 -23
- package/dist/esm/runtime.js.flow +0 -7
- package/dist/esm/styled/index.js.flow +0 -66
- package/dist/esm/types.js.flow +0 -31
- package/dist/esm/utils/error.js.flow +0 -7
- package/src/class-names/__tests__/types.test.js.flow +0 -35
- package/src/class-names/index.js.flow +0 -53
- package/src/css/__tests__/types.test.js.flow +0 -42
- package/src/css/index.js.flow +0 -36
- package/src/css-map/index.js.flow +0 -125
- package/src/css-map/pseudos.js.flow +0 -57
- package/src/css-map/pseudos.ts +0 -59
- package/src/index.js.flow +0 -13
- package/src/keyframes/__tests__/types.test.js.flow +0 -31
- package/src/keyframes/index.js.flow +0 -48
- package/src/runtime/ac.js.flow +0 -56
- package/src/runtime/ax.js.flow +0 -27
- package/src/runtime/cache.js.flow +0 -18
- package/src/runtime/css-custom-property.js.flow +0 -19
- package/src/runtime/dev-warnings.js.flow +0 -7
- package/src/runtime/index.js.flow +0 -11
- package/src/runtime/is-server-environment.js.flow +0 -19
- package/src/runtime/sheet.js.flow +0 -36
- package/src/runtime/style-cache.js.flow +0 -19
- package/src/runtime/style.js.flow +0 -16
- package/src/runtime/types.js.flow +0 -23
- package/src/runtime.js.flow +0 -7
- package/src/styled/__tests__/types.test.js.flow +0 -84
- package/src/styled/index.js.flow +0 -66
- package/src/types.js.flow +0 -31
- package/src/utils/error.js.flow +0 -7
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for style
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import type { StyleSheetOpts } from './types';
|
|
8
|
-
declare type StyleProps = {
|
|
9
|
-
/**
|
|
10
|
-
* CSS Rules.
|
|
11
|
-
* Ensure each rule is a separate element in the array.
|
|
12
|
-
*/
|
|
13
|
-
children: string[],
|
|
14
|
-
...
|
|
15
|
-
} & StyleSheetOpts;
|
|
16
|
-
declare export default function Style(props: StyleProps): React$Node | null;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for types
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
export interface StyleSheetOpts {
|
|
8
|
-
/**
|
|
9
|
-
* Used to set a nonce on the style element.
|
|
10
|
-
* This is needed when using a strict CSP and should be a random hash generated every server load.
|
|
11
|
-
* Check out https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src for more information.
|
|
12
|
-
*/
|
|
13
|
-
nonce?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Buckets under which we will group our stylesheets
|
|
17
|
-
*/
|
|
18
|
-
export type Bucket = '' | 'l' | 'v' | 'w' | 'f' | 'i' | 'h' | 'a' | 'm';
|
|
19
|
-
export type UseCacheHook = () => { [key: string]: true };
|
|
20
|
-
export type ProviderComponent = (props: {
|
|
21
|
-
children: React$Node[] | React$Node,
|
|
22
|
-
...
|
|
23
|
-
}) => React$Node;
|
package/dist/esm/runtime.js.flow
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for index
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import type { ComponentType } from 'react';
|
|
8
|
-
import type { CssType, CssFunction } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* Extra props added to the output Styled Component.
|
|
11
|
-
*/
|
|
12
|
-
export type StyledProps = {
|
|
13
|
-
as?: $Keys<$JSXIntrinsics>,
|
|
14
|
-
};
|
|
15
|
-
export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
|
|
16
|
-
export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
|
|
17
|
-
export interface StyledComponent<ComponentProps> {
|
|
18
|
-
<TProps>(
|
|
19
|
-
...css: ObjectInterpolation<TProps>[]
|
|
20
|
-
): React$ComponentType<{ ...TProps, ...ComponentProps, ...StyledProps }>;
|
|
21
|
-
<TProps>(
|
|
22
|
-
template: $ReadOnlyArray<string>,
|
|
23
|
-
...interpolations: TemplateStringsInterpolation<TProps>[]
|
|
24
|
-
): React$ComponentType<{ ...TProps, ...ComponentProps, ...StyledProps }>;
|
|
25
|
-
}
|
|
26
|
-
export type StyledComponentMap = $ObjMapi<$JSXIntrinsics, <Tag>(Tag) => StyledComponent<mixed>>;
|
|
27
|
-
export type CreateStyledComponent = {
|
|
28
|
-
<TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>,
|
|
29
|
-
...
|
|
30
|
-
} & StyledComponentMap;
|
|
31
|
-
/**
|
|
32
|
-
* ## Styled component
|
|
33
|
-
*
|
|
34
|
-
* Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support.
|
|
35
|
-
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled).
|
|
36
|
-
*
|
|
37
|
-
* ### Style with objects
|
|
38
|
-
* @example ```
|
|
39
|
-
* styled.div({
|
|
40
|
-
* fontSize: 12,
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* ### Style with template literals
|
|
45
|
-
* @example ```
|
|
46
|
-
* styled.div`
|
|
47
|
-
* font-size: 12px
|
|
48
|
-
* `;
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* ### Compose styles with arrays
|
|
52
|
-
* @example ```
|
|
53
|
-
* import type { css } from '@compiled/react';
|
|
54
|
-
*
|
|
55
|
-
* styled.div([
|
|
56
|
-
* { fontSize: 12 },
|
|
57
|
-
* css`font-size: 12px;`
|
|
58
|
-
* ]);
|
|
59
|
-
*
|
|
60
|
-
* styled.div(
|
|
61
|
-
* { fontSize: 12 },
|
|
62
|
-
* css`font-size: 12px`
|
|
63
|
-
* );
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
declare export var styled: CreateStyledComponent;
|
package/dist/esm/types.js.flow
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for types
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.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): CssFunction<TProps>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Possible types for a CSS value
|
|
17
|
-
*/
|
|
18
|
-
export type CssType<TProps> = CssObject<TProps> | FunctionInterpolation<TProps> | string;
|
|
19
|
-
/**
|
|
20
|
-
* These are all the CSS props that will exist.
|
|
21
|
-
*/
|
|
22
|
-
export type CSSProps<TProps> = $ReadOnly<CSS.Properties<CssFunction<TProps>>>;
|
|
23
|
-
export type CssObject<TProps> = $ReadOnly<{
|
|
24
|
-
...CSSProps<TProps>,
|
|
25
|
-
[key: string]: CssFunction<TProps>,
|
|
26
|
-
}>;
|
|
27
|
-
export type CssFunction<TProps = mixed> =
|
|
28
|
-
| CssType<TProps>
|
|
29
|
-
| BasicTemplateInterpolations
|
|
30
|
-
| boolean
|
|
31
|
-
| void;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
import React, { type Node } from 'react';
|
|
3
|
-
import { ClassNames, type CssType } 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
|
-
return (
|
|
27
|
-
<ClassNames>
|
|
28
|
-
{({ css }) => (
|
|
29
|
-
<span className={css(([{ fontSize: 12 }, `font-size: 12px`]: CssType<void>[]))}>
|
|
30
|
-
{children}
|
|
31
|
-
</span>
|
|
32
|
-
)}
|
|
33
|
-
</ClassNames>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for index
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import type { Node } from 'react';
|
|
8
|
-
import type { CssType, CssFunction } from '../types';
|
|
9
|
-
export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
|
|
10
|
-
export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
|
|
11
|
-
declare interface CssSignature<TProps> {
|
|
12
|
-
(...interpolations: ObjectInterpolation<TProps>[]): string;
|
|
13
|
-
(
|
|
14
|
-
template: $ReadOnlyArray<string>,
|
|
15
|
-
...interpolations: TemplateStringsInterpolation<TProps>[]
|
|
16
|
-
): string;
|
|
17
|
-
}
|
|
18
|
-
export interface ClassNamesProps<TProps> {
|
|
19
|
-
children: (opts: {
|
|
20
|
-
css: CssSignature<TProps>,
|
|
21
|
-
style: $Shape<CSSStyleDeclaration>,
|
|
22
|
-
...
|
|
23
|
-
}) => Node;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* ## Class names
|
|
27
|
-
*
|
|
28
|
-
* Use a component where styles are not necessarily used on a JSX element.
|
|
29
|
-
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names).
|
|
30
|
-
*
|
|
31
|
-
* ### Style with objects
|
|
32
|
-
* @example ```
|
|
33
|
-
* <ClassNames>
|
|
34
|
-
* {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
|
|
35
|
-
* </ClassNames>
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* ### Style with template literals
|
|
39
|
-
* @example ```
|
|
40
|
-
* <ClassNames>
|
|
41
|
-
* {({ css, style }) => children({ className: css`font-size: 12px;` })}
|
|
42
|
-
* </ClassNames>
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* ### Compose styles with arrays
|
|
46
|
-
* @example ```
|
|
47
|
-
* <ClassNames>
|
|
48
|
-
* {({ css, style }) =>
|
|
49
|
-
* children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })}
|
|
50
|
-
* </ClassNames>
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
declare export function ClassNames<TProps>(x: ClassNamesProps<TProps>): React$Node;
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
};
|
|
18
|
-
|
|
19
|
-
// Object call with function call
|
|
20
|
-
(): React$Element<'div'> => {
|
|
21
|
-
const styles = css({
|
|
22
|
-
backgroundColor: token('elevation.surface', 'white'),
|
|
23
|
-
zIndex: layers.modal(),
|
|
24
|
-
});
|
|
25
|
-
return <div css={styles}>red text</div>;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// Media query selector
|
|
29
|
-
css({
|
|
30
|
-
/* Style only for Google Chrome */
|
|
31
|
-
'@media screen and (-webkit-min-device-pixel-ratio: 0)': {
|
|
32
|
-
wordBreak: 'break-word',
|
|
33
|
-
},
|
|
34
|
-
/* Style only for Safari */
|
|
35
|
-
'@media screen and (-webkit-transition)': {
|
|
36
|
-
wordBreak: 'break-word',
|
|
37
|
-
},
|
|
38
|
-
/* Style only for Mozilla Firefox */
|
|
39
|
-
'@-moz-document url-prefix()': {
|
|
40
|
-
overflowWrap: 'anywhere',
|
|
41
|
-
},
|
|
42
|
-
});
|
package/src/css/index.js.flow
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for index
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import type { CSSProps, CssObject, CssFunction } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* ## CSS
|
|
10
|
-
*
|
|
11
|
-
* Define styles that are statically typed and useable with other Compiled APIs.
|
|
12
|
-
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-css).
|
|
13
|
-
*
|
|
14
|
-
* ### Style with objects
|
|
15
|
-
* @example ```
|
|
16
|
-
* const redText = css({
|
|
17
|
-
* color: 'red',
|
|
18
|
-
* });
|
|
19
|
-
*
|
|
20
|
-
* <div css={redText} />
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* ### Style with template literals
|
|
24
|
-
* @example ```
|
|
25
|
-
* const redText = css`
|
|
26
|
-
* color: red;
|
|
27
|
-
* `;
|
|
28
|
-
*
|
|
29
|
-
* <div css={redText} />
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
declare export default function css<TProps>(
|
|
33
|
-
styles: $ReadOnlyArray<string>,
|
|
34
|
-
...interpolations: CssFunction<TProps>[]
|
|
35
|
-
): CSSProps<TProps>;
|
|
36
|
-
declare export default function css<T>(styles: CssObject<T> | CssObject<T>[]): CSSProps<T>;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for index
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import type { Properties, AtRules } from 'csstype';
|
|
8
|
-
import type { Pseudos } from './pseudos';
|
|
9
|
-
/**
|
|
10
|
-
* These are all the CSS props that will exist.
|
|
11
|
-
* Only 'string' and 'number' are valid CSS values.
|
|
12
|
-
* @example ```
|
|
13
|
-
* const style: CssProps = {
|
|
14
|
-
* color: 'red',
|
|
15
|
-
* margin: 10,
|
|
16
|
-
* };
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare type CssProps = $ReadOnly<Properties<string | number>>;
|
|
20
|
-
declare type AllPseudos = $ObjMapi<
|
|
21
|
-
{ [k: Pseudos]: any },
|
|
22
|
-
<key>(key) => { ...CssProps, ...AllPseudos }
|
|
23
|
-
>;
|
|
24
|
-
declare type AtRuleSecondHalf = string;
|
|
25
|
-
declare type WhitelistedAtRule = $ObjMapi<
|
|
26
|
-
{ [k: AtRules]: any },
|
|
27
|
-
<atRuleFirstHalf>(atRuleFirstHalf) => $ObjMapi<
|
|
28
|
-
{ [k: AtRuleSecondHalf]: any },
|
|
29
|
-
<atRuleSecondHalf>(atRuleSecondHalf) => {
|
|
30
|
-
...CssProps,
|
|
31
|
-
...AllPseudos,
|
|
32
|
-
...WhitelistedAtRule,
|
|
33
|
-
}
|
|
34
|
-
>
|
|
35
|
-
>;
|
|
36
|
-
declare type WhitelistedSelector = { ...AllPseudos, ...WhitelistedAtRule };
|
|
37
|
-
declare type ExtendedSelector = {
|
|
38
|
-
...{
|
|
39
|
-
[key: string]: CssProps | ExtendedSelector,
|
|
40
|
-
},
|
|
41
|
-
...{
|
|
42
|
-
/**
|
|
43
|
-
* Using `selectors` is not valid here - you cannot nest a `selectors` object
|
|
44
|
-
* inside another `selectors` object.
|
|
45
|
-
*/
|
|
46
|
-
selectors?: empty,
|
|
47
|
-
...
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
declare type ExtendedSelectors = {
|
|
51
|
-
/**
|
|
52
|
-
* Provides a way to use selectors that have not been explicitly whitelisted
|
|
53
|
-
* in cssMap.
|
|
54
|
-
*
|
|
55
|
-
* This does not provide any type-checking for the selectors (thus allowing
|
|
56
|
-
* more expressive selectors), though this is more flexible and allows
|
|
57
|
-
* nesting selectors in other selectors.
|
|
58
|
-
*
|
|
59
|
-
* A selector defined both outside of the `selectors` object and
|
|
60
|
-
* inside the `selectors` object is a runtime error.
|
|
61
|
-
*
|
|
62
|
-
* Note that you cannot nest a `selectors` object inside another
|
|
63
|
-
* `selectors` object.
|
|
64
|
-
*
|
|
65
|
-
* Only use if absolutely necessary.
|
|
66
|
-
* @example ```
|
|
67
|
-
* const myMap = cssMap({
|
|
68
|
-
* danger: {
|
|
69
|
-
* color: 'red',
|
|
70
|
-
* '@media': {
|
|
71
|
-
* '(min-width: 100px)': {
|
|
72
|
-
* font-size: '1.5em',
|
|
73
|
-
* },
|
|
74
|
-
* },
|
|
75
|
-
* '&:hover': {
|
|
76
|
-
* color: 'pink',
|
|
77
|
-
* },
|
|
78
|
-
* selectors: {
|
|
79
|
-
* '&:not(:active)': {
|
|
80
|
-
* backgroundColor: 'yellow',
|
|
81
|
-
* }
|
|
82
|
-
* },
|
|
83
|
-
* },
|
|
84
|
-
* success: {
|
|
85
|
-
* color: 'green',
|
|
86
|
-
* '@media': {
|
|
87
|
-
* '(min-width: 100px)': {
|
|
88
|
-
* font-size: '1.3em',
|
|
89
|
-
* },
|
|
90
|
-
* },
|
|
91
|
-
* '&:hover': {
|
|
92
|
-
* color: '#8f8',
|
|
93
|
-
* },
|
|
94
|
-
* selectors: {
|
|
95
|
-
* '&:not(:active)': {
|
|
96
|
-
* backgroundColor: 'white',
|
|
97
|
-
* }
|
|
98
|
-
* },
|
|
99
|
-
* },
|
|
100
|
-
* });
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
selectors?: ExtendedSelector,
|
|
104
|
-
...
|
|
105
|
-
};
|
|
106
|
-
declare type Variants<VariantName: string> = {
|
|
107
|
-
[key: VariantName]: { ...CssProps, ...WhitelistedSelector, ...ExtendedSelectors },
|
|
108
|
-
};
|
|
109
|
-
declare type ReturnType<VariantName: string> = { [key: VariantName]: CssProps };
|
|
110
|
-
/**
|
|
111
|
-
* ## cssMap
|
|
112
|
-
*
|
|
113
|
-
* Creates a collection of named CSS rules that are statically typed and useable with other Compiled APIs.
|
|
114
|
-
* For further details [read the documentation](https://compiledcssinjs.com/docs/api-cssmap).
|
|
115
|
-
* @example ```
|
|
116
|
-
* const borderStyleMap = cssMap({
|
|
117
|
-
* none: { borderStyle: 'none' },
|
|
118
|
-
* solid: { borderStyle: 'solid' },
|
|
119
|
-
* });
|
|
120
|
-
* const Component = ({ borderStyle }) => <div css={css(borderStyleMap[borderStyle])} />
|
|
121
|
-
*
|
|
122
|
-
* <Component borderStyle="solid" />
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
declare export default function cssMap<T: string>(_styles: Variants<T>): $ReadOnly<ReturnType<T>>;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for pseudos
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
export type Pseudos =
|
|
8
|
-
| '&::after'
|
|
9
|
-
| '&::backdrop'
|
|
10
|
-
| '&::before'
|
|
11
|
-
| '&::cue'
|
|
12
|
-
| '&::cue-region'
|
|
13
|
-
| '&::first-letter'
|
|
14
|
-
| '&::first-line'
|
|
15
|
-
| '&::grammar-error'
|
|
16
|
-
| '&::marker'
|
|
17
|
-
| '&::placeholder'
|
|
18
|
-
| '&::selection'
|
|
19
|
-
| '&::spelling-error'
|
|
20
|
-
| '&::target-text'
|
|
21
|
-
| '&::view-transition'
|
|
22
|
-
| '&:active'
|
|
23
|
-
| '&:autofill'
|
|
24
|
-
| '&:blank'
|
|
25
|
-
| '&:checked'
|
|
26
|
-
| '&:default'
|
|
27
|
-
| '&:defined'
|
|
28
|
-
| '&:disabled'
|
|
29
|
-
| '&:empty'
|
|
30
|
-
| '&:enabled'
|
|
31
|
-
| '&:first'
|
|
32
|
-
| '&:focus'
|
|
33
|
-
| '&:focus-visible'
|
|
34
|
-
| '&:focus-within'
|
|
35
|
-
| '&:fullscreen'
|
|
36
|
-
| '&:hover'
|
|
37
|
-
| '&:in-range'
|
|
38
|
-
| '&:indeterminate'
|
|
39
|
-
| '&:invalid'
|
|
40
|
-
| '&:left'
|
|
41
|
-
| '&:link'
|
|
42
|
-
| '&:local-link'
|
|
43
|
-
| '&:optional'
|
|
44
|
-
| '&:out-of-range'
|
|
45
|
-
| '&:paused'
|
|
46
|
-
| '&:picture-in-picture'
|
|
47
|
-
| '&:placeholder-shown'
|
|
48
|
-
| '&:playing'
|
|
49
|
-
| '&:read-only'
|
|
50
|
-
| '&:read-write'
|
|
51
|
-
| '&:required'
|
|
52
|
-
| '&:right'
|
|
53
|
-
| '&:target'
|
|
54
|
-
| '&:user-invalid'
|
|
55
|
-
| '&:user-valid'
|
|
56
|
-
| '&:valid'
|
|
57
|
-
| '&:visited';
|
package/src/css-map/pseudos.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// List of pseudo-classes and pseudo-elements are from csstype
|
|
2
|
-
// but with & added in the front, so that we target the current element
|
|
3
|
-
// (instead of a child element)
|
|
4
|
-
|
|
5
|
-
// We also exclude anything that requires providing an argument
|
|
6
|
-
// (e.g. &:not(...) ), and anything that uses information from elements
|
|
7
|
-
// outside of the current element (e.g. &:first-of-type)
|
|
8
|
-
|
|
9
|
-
export type Pseudos =
|
|
10
|
-
| '&::after'
|
|
11
|
-
| '&::backdrop'
|
|
12
|
-
| '&::before'
|
|
13
|
-
| '&::cue'
|
|
14
|
-
| '&::cue-region'
|
|
15
|
-
| '&::first-letter'
|
|
16
|
-
| '&::first-line'
|
|
17
|
-
| '&::grammar-error'
|
|
18
|
-
| '&::marker'
|
|
19
|
-
| '&::placeholder'
|
|
20
|
-
| '&::selection'
|
|
21
|
-
| '&::spelling-error'
|
|
22
|
-
| '&::target-text'
|
|
23
|
-
| '&::view-transition'
|
|
24
|
-
| '&:active'
|
|
25
|
-
| '&:autofill'
|
|
26
|
-
| '&:blank'
|
|
27
|
-
| '&:checked'
|
|
28
|
-
| '&:default'
|
|
29
|
-
| '&:defined'
|
|
30
|
-
| '&:disabled'
|
|
31
|
-
| '&:empty'
|
|
32
|
-
| '&:enabled'
|
|
33
|
-
| '&:first'
|
|
34
|
-
| '&:focus'
|
|
35
|
-
| '&:focus-visible'
|
|
36
|
-
| '&:focus-within'
|
|
37
|
-
| '&:fullscreen'
|
|
38
|
-
| '&:hover'
|
|
39
|
-
| '&:in-range'
|
|
40
|
-
| '&:indeterminate'
|
|
41
|
-
| '&:invalid'
|
|
42
|
-
| '&:left'
|
|
43
|
-
| '&:link'
|
|
44
|
-
| '&:local-link'
|
|
45
|
-
| '&:optional'
|
|
46
|
-
| '&:out-of-range'
|
|
47
|
-
| '&:paused'
|
|
48
|
-
| '&:picture-in-picture'
|
|
49
|
-
| '&:placeholder-shown'
|
|
50
|
-
| '&:playing'
|
|
51
|
-
| '&:read-only'
|
|
52
|
-
| '&:read-write'
|
|
53
|
-
| '&:required'
|
|
54
|
-
| '&:right'
|
|
55
|
-
| '&:target'
|
|
56
|
-
| '&:user-invalid'
|
|
57
|
-
| '&:user-valid'
|
|
58
|
-
| '&:valid'
|
|
59
|
-
| '&:visited';
|
package/src/index.js.flow
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for index
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import type { CssFunction, CSSProps, CssType } from './types';
|
|
8
|
-
export type { CSSProps, CssFunction, CssType };
|
|
9
|
-
declare export { keyframes } from './keyframes';
|
|
10
|
-
declare export { styled } from './styled';
|
|
11
|
-
declare export { ClassNames } from './class-names';
|
|
12
|
-
declare export { default as css } from './css';
|
|
13
|
-
declare export { default as cssMap } from './css-map';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { css, ClassNames, styled, keyframes } from '@compiled/react';
|
|
4
|
-
|
|
5
|
-
// Tagged template expression
|
|
6
|
-
(): React$Element<'div'> => {
|
|
7
|
-
const fadeOut = keyframes`
|
|
8
|
-
from { opacity: 1; }
|
|
9
|
-
to { opacity: 0; }
|
|
10
|
-
`;
|
|
11
|
-
return <div css={{ animationName: fadeOut }}>hello world</div>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Object call expression
|
|
15
|
-
(): React$Element<'div'> => {
|
|
16
|
-
const fadeOut = keyframes({
|
|
17
|
-
from: {
|
|
18
|
-
opacity: 1,
|
|
19
|
-
},
|
|
20
|
-
to: {
|
|
21
|
-
opacity: 0,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
return <div css={{ animationName: fadeOut }}>hello world</div>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// String call expression
|
|
28
|
-
(): React$Element<'div'> => {
|
|
29
|
-
const fadeOut = keyframes('from { opacity: 1; } to { opacity: 0; }');
|
|
30
|
-
return <div css={{ animationName: fadeOut }}>hello world</div>;
|
|
31
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for index
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import type { BasicTemplateInterpolations, CSSProps } from '../types';
|
|
8
|
-
export type KeyframeSteps = string | { [key: string]: CSSProps<void> };
|
|
9
|
-
/**
|
|
10
|
-
* ## Keyframes
|
|
11
|
-
*
|
|
12
|
-
* Define keyframes to be used in a [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation).
|
|
13
|
-
* For further details [read the API documentation](https://compiledcssinjs.com/docs/api-keyframes).
|
|
14
|
-
*
|
|
15
|
-
* ### Style with objects
|
|
16
|
-
* @example ```
|
|
17
|
-
* const fadeOut = keyframes({
|
|
18
|
-
* from: {
|
|
19
|
-
* opacity: 1,
|
|
20
|
-
* },
|
|
21
|
-
* to: {
|
|
22
|
-
* opacity: 0,
|
|
23
|
-
* },
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* <div css={{ animation: `${fadeOut} 2s` }} />
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* ### Style with template literals
|
|
30
|
-
* @example ```
|
|
31
|
-
* const fadeOut = keyframes`
|
|
32
|
-
* from {
|
|
33
|
-
* opacity: 1;
|
|
34
|
-
* }
|
|
35
|
-
*
|
|
36
|
-
* to {
|
|
37
|
-
* opacity: 0;
|
|
38
|
-
* }
|
|
39
|
-
* `;
|
|
40
|
-
*
|
|
41
|
-
* <div css={{ animation: `${fadeOut} 2s` }} />
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
declare export function keyframes(steps: KeyframeSteps): string;
|
|
45
|
-
declare export function keyframes(
|
|
46
|
-
strings: $ReadOnlyArray<string>,
|
|
47
|
-
...interpolations: BasicTemplateInterpolations[]
|
|
48
|
-
): string;
|