@compiled/react 0.15.0 → 0.16.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.
Files changed (90) hide show
  1. package/package.json +2 -1
  2. package/src/css/__tests__/types.test.ts +11 -0
  3. package/dist/browser/class-names/index.js.flow +0 -53
  4. package/dist/browser/css/index.js.flow +0 -36
  5. package/dist/browser/css-map/index.js.flow +0 -125
  6. package/dist/browser/css-map/pseudos.js.flow +0 -57
  7. package/dist/browser/index.js.flow +0 -13
  8. package/dist/browser/keyframes/index.js.flow +0 -48
  9. package/dist/browser/runtime/ac.js.flow +0 -56
  10. package/dist/browser/runtime/ax.js.flow +0 -27
  11. package/dist/browser/runtime/cache.js.flow +0 -18
  12. package/dist/browser/runtime/css-custom-property.js.flow +0 -19
  13. package/dist/browser/runtime/dev-warnings.js.flow +0 -7
  14. package/dist/browser/runtime/index.js.flow +0 -11
  15. package/dist/browser/runtime/is-server-environment.js.flow +0 -19
  16. package/dist/browser/runtime/sheet.js.flow +0 -36
  17. package/dist/browser/runtime/style-cache.js.flow +0 -19
  18. package/dist/browser/runtime/style.js.flow +0 -16
  19. package/dist/browser/runtime/types.js.flow +0 -23
  20. package/dist/browser/runtime.js.flow +0 -7
  21. package/dist/browser/styled/index.js.flow +0 -66
  22. package/dist/browser/types.js.flow +0 -31
  23. package/dist/browser/utils/error.js.flow +0 -7
  24. package/dist/cjs/class-names/index.js.flow +0 -53
  25. package/dist/cjs/css/index.js.flow +0 -36
  26. package/dist/cjs/css-map/index.js.flow +0 -125
  27. package/dist/cjs/css-map/pseudos.js.flow +0 -57
  28. package/dist/cjs/index.js.flow +0 -13
  29. package/dist/cjs/keyframes/index.js.flow +0 -48
  30. package/dist/cjs/runtime/ac.js.flow +0 -56
  31. package/dist/cjs/runtime/ax.js.flow +0 -27
  32. package/dist/cjs/runtime/cache.js.flow +0 -18
  33. package/dist/cjs/runtime/css-custom-property.js.flow +0 -19
  34. package/dist/cjs/runtime/dev-warnings.js.flow +0 -7
  35. package/dist/cjs/runtime/index.js.flow +0 -11
  36. package/dist/cjs/runtime/is-server-environment.js.flow +0 -19
  37. package/dist/cjs/runtime/sheet.js.flow +0 -36
  38. package/dist/cjs/runtime/style-cache.js.flow +0 -19
  39. package/dist/cjs/runtime/style.js.flow +0 -16
  40. package/dist/cjs/runtime/types.js.flow +0 -23
  41. package/dist/cjs/runtime.js.flow +0 -7
  42. package/dist/cjs/styled/index.js.flow +0 -66
  43. package/dist/cjs/types.js.flow +0 -31
  44. package/dist/cjs/utils/error.js.flow +0 -7
  45. package/dist/esm/class-names/index.js.flow +0 -53
  46. package/dist/esm/css/index.js.flow +0 -36
  47. package/dist/esm/css-map/index.js.flow +0 -125
  48. package/dist/esm/css-map/pseudos.js.flow +0 -57
  49. package/dist/esm/index.js.flow +0 -13
  50. package/dist/esm/keyframes/index.js.flow +0 -48
  51. package/dist/esm/runtime/ac.js.flow +0 -56
  52. package/dist/esm/runtime/ax.js.flow +0 -27
  53. package/dist/esm/runtime/cache.js.flow +0 -18
  54. package/dist/esm/runtime/css-custom-property.js.flow +0 -19
  55. package/dist/esm/runtime/dev-warnings.js.flow +0 -7
  56. package/dist/esm/runtime/index.js.flow +0 -11
  57. package/dist/esm/runtime/is-server-environment.js.flow +0 -19
  58. package/dist/esm/runtime/sheet.js.flow +0 -36
  59. package/dist/esm/runtime/style-cache.js.flow +0 -19
  60. package/dist/esm/runtime/style.js.flow +0 -16
  61. package/dist/esm/runtime/types.js.flow +0 -23
  62. package/dist/esm/runtime.js.flow +0 -7
  63. package/dist/esm/styled/index.js.flow +0 -66
  64. package/dist/esm/types.js.flow +0 -31
  65. package/dist/esm/utils/error.js.flow +0 -7
  66. package/src/class-names/__tests__/types.test.js.flow +0 -35
  67. package/src/class-names/index.js.flow +0 -53
  68. package/src/css/__tests__/types.test.js.flow +0 -42
  69. package/src/css/index.js.flow +0 -36
  70. package/src/css-map/index.js.flow +0 -125
  71. package/src/css-map/pseudos.js.flow +0 -57
  72. package/src/index.js.flow +0 -13
  73. package/src/keyframes/__tests__/types.test.js.flow +0 -31
  74. package/src/keyframes/index.js.flow +0 -48
  75. package/src/runtime/ac.js.flow +0 -56
  76. package/src/runtime/ax.js.flow +0 -27
  77. package/src/runtime/cache.js.flow +0 -18
  78. package/src/runtime/css-custom-property.js.flow +0 -19
  79. package/src/runtime/dev-warnings.js.flow +0 -7
  80. package/src/runtime/index.js.flow +0 -11
  81. package/src/runtime/is-server-environment.js.flow +0 -19
  82. package/src/runtime/sheet.js.flow +0 -36
  83. package/src/runtime/style-cache.js.flow +0 -19
  84. package/src/runtime/style.js.flow +0 -16
  85. package/src/runtime/types.js.flow +0 -23
  86. package/src/runtime.js.flow +0 -7
  87. package/src/styled/__tests__/types.test.js.flow +0 -84
  88. package/src/styled/index.js.flow +0 -66
  89. package/src/types.js.flow +0 -31
  90. package/src/utils/error.js.flow +0 -7
@@ -1,19 +0,0 @@
1
- /**
2
- * Flowtype definitions for style-cache
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { ProviderComponent, UseCacheHook } from './types';
8
- /**
9
- * Hook using the cache created on the server or client.
10
- */
11
- declare export var useCache: UseCacheHook;
12
- /**
13
- * On the server this ensures the minimal amount of styles will be rendered
14
- * safely using React Context.
15
- *
16
- * On the browser this turns into a fragment with no React Context.
17
- */
18
- declare var StyleCacheProvider: ProviderComponent;
19
- declare export default typeof StyleCacheProvider;
@@ -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;
@@ -1,7 +0,0 @@
1
- /**
2
- * Flowtype definitions for runtime
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- declare export { CC, CS, ax, ac, clearAcCache, ix } from './runtime/index';
@@ -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;
@@ -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,7 +0,0 @@
1
- /**
2
- * Flowtype definitions for error
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- declare export var createSetupError: () => Error;
@@ -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
- });
@@ -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/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;
@@ -1,56 +0,0 @@
1
- /**
2
- * Flowtype definitions for ac
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- /**
8
- * Memoize the result of ac so if it is called with the same args, it returns immediately.
9
- * Also, to prevent useless React rerenders
10
- */
11
- declare var cache: Map<any, any>;
12
- /**
13
- * `ac` returns an instance of AtomicGroups. The instance holds the knowledge of Atomic Group so we can chain `ac`.
14
- * e.g. <div className={ax([ax(['_aaaa_b']), '_aaaa_c'])} />
15
- */
16
- declare class AtomicGroups {
17
- values: Map<string, string>;
18
- constructor(values: Map<string, string>): this;
19
- toString(): string;
20
- }
21
- /**
22
- * Joins classes together and ensures atomic declarations of a single group exist.
23
- * Atomic declarations take the form of `_{group}{value}` (always prefixed with an underscore),
24
- * where both `group` and `value` are hashes **four characters long**.
25
- * Class names can be of any length,
26
- * this function can take both atomic declarations and class names.
27
- *
28
- * Input:
29
- *
30
- * ```
31
- * ax(['_aaaabbbb', '_aaaacccc'])
32
- * ```
33
- *
34
- * Output:
35
- *
36
- * ```
37
- * '_aaaacccc'
38
- * ```
39
- * @param classes
40
- */
41
- declare export function ac(
42
- classNames: (AtomicGroups | string | void | false)[]
43
- ): AtomicGroups | void;
44
- declare export function memoizedAc(
45
- classNames: (AtomicGroups | string | void | false)[]
46
- ): AtomicGroups | void;
47
- declare var _default: typeof ac;
48
- declare export default typeof _default;
49
- /**
50
- * Provide an opportunity to clear the cache to prevent memory leak.
51
- */
52
- declare export function clearCache(): void;
53
- /**
54
- * Expose cache
55
- */
56
- declare export function getCache(): typeof cache;