@compiled/react 0.14.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 (106) hide show
  1. package/dist/browser/css-map/index.d.ts +94 -3
  2. package/dist/browser/css-map/index.js +17 -0
  3. package/dist/browser/css-map/index.js.map +1 -1
  4. package/dist/browser/css-map/pseudos.d.ts +1 -0
  5. package/dist/browser/css-map/pseudos.js +5 -0
  6. package/dist/browser/css-map/pseudos.js.map +1 -0
  7. package/dist/cjs/css-map/index.d.ts +94 -3
  8. package/dist/cjs/css-map/index.js +17 -0
  9. package/dist/cjs/css-map/index.js.map +1 -1
  10. package/dist/cjs/css-map/pseudos.d.ts +1 -0
  11. package/dist/cjs/css-map/pseudos.js +6 -0
  12. package/dist/cjs/css-map/pseudos.js.map +1 -0
  13. package/dist/esm/css-map/index.d.ts +94 -3
  14. package/dist/esm/css-map/index.js +17 -0
  15. package/dist/esm/css-map/index.js.map +1 -1
  16. package/dist/esm/css-map/pseudos.d.ts +1 -0
  17. package/dist/esm/css-map/pseudos.js +5 -0
  18. package/dist/esm/css-map/pseudos.js.map +1 -0
  19. package/package.json +2 -1
  20. package/src/css/__tests__/types.test.ts +11 -0
  21. package/src/css-map/index.ts +104 -5
  22. package/src/css-map/pseudos.ts +59 -0
  23. package/dist/browser/class-names/index.js.flow +0 -53
  24. package/dist/browser/css/index.js.flow +0 -36
  25. package/dist/browser/css-map/index.js.flow +0 -26
  26. package/dist/browser/index.js.flow +0 -13
  27. package/dist/browser/keyframes/index.js.flow +0 -48
  28. package/dist/browser/runtime/ac.js.flow +0 -56
  29. package/dist/browser/runtime/ax.js.flow +0 -27
  30. package/dist/browser/runtime/cache.js.flow +0 -18
  31. package/dist/browser/runtime/css-custom-property.js.flow +0 -19
  32. package/dist/browser/runtime/dev-warnings.js.flow +0 -7
  33. package/dist/browser/runtime/index.js.flow +0 -11
  34. package/dist/browser/runtime/is-server-environment.js.flow +0 -19
  35. package/dist/browser/runtime/sheet.js.flow +0 -36
  36. package/dist/browser/runtime/style-cache.js.flow +0 -19
  37. package/dist/browser/runtime/style.js.flow +0 -16
  38. package/dist/browser/runtime/types.js.flow +0 -23
  39. package/dist/browser/runtime.js.flow +0 -7
  40. package/dist/browser/styled/index.js.flow +0 -66
  41. package/dist/browser/types.js.flow +0 -31
  42. package/dist/browser/utils/error.js.flow +0 -7
  43. package/dist/cjs/class-names/index.js.flow +0 -53
  44. package/dist/cjs/css/index.js.flow +0 -36
  45. package/dist/cjs/css-map/index.js.flow +0 -26
  46. package/dist/cjs/index.js.flow +0 -13
  47. package/dist/cjs/keyframes/index.js.flow +0 -48
  48. package/dist/cjs/runtime/ac.js.flow +0 -56
  49. package/dist/cjs/runtime/ax.js.flow +0 -27
  50. package/dist/cjs/runtime/cache.js.flow +0 -18
  51. package/dist/cjs/runtime/css-custom-property.js.flow +0 -19
  52. package/dist/cjs/runtime/dev-warnings.js.flow +0 -7
  53. package/dist/cjs/runtime/index.js.flow +0 -11
  54. package/dist/cjs/runtime/is-server-environment.js.flow +0 -19
  55. package/dist/cjs/runtime/sheet.js.flow +0 -36
  56. package/dist/cjs/runtime/style-cache.js.flow +0 -19
  57. package/dist/cjs/runtime/style.js.flow +0 -16
  58. package/dist/cjs/runtime/types.js.flow +0 -23
  59. package/dist/cjs/runtime.js.flow +0 -7
  60. package/dist/cjs/styled/index.js.flow +0 -66
  61. package/dist/cjs/types.js.flow +0 -31
  62. package/dist/cjs/utils/error.js.flow +0 -7
  63. package/dist/esm/class-names/index.js.flow +0 -53
  64. package/dist/esm/css/index.js.flow +0 -36
  65. package/dist/esm/css-map/index.js.flow +0 -26
  66. package/dist/esm/index.js.flow +0 -13
  67. package/dist/esm/keyframes/index.js.flow +0 -48
  68. package/dist/esm/runtime/ac.js.flow +0 -56
  69. package/dist/esm/runtime/ax.js.flow +0 -27
  70. package/dist/esm/runtime/cache.js.flow +0 -18
  71. package/dist/esm/runtime/css-custom-property.js.flow +0 -19
  72. package/dist/esm/runtime/dev-warnings.js.flow +0 -7
  73. package/dist/esm/runtime/index.js.flow +0 -11
  74. package/dist/esm/runtime/is-server-environment.js.flow +0 -19
  75. package/dist/esm/runtime/sheet.js.flow +0 -36
  76. package/dist/esm/runtime/style-cache.js.flow +0 -19
  77. package/dist/esm/runtime/style.js.flow +0 -16
  78. package/dist/esm/runtime/types.js.flow +0 -23
  79. package/dist/esm/runtime.js.flow +0 -7
  80. package/dist/esm/styled/index.js.flow +0 -66
  81. package/dist/esm/types.js.flow +0 -31
  82. package/dist/esm/utils/error.js.flow +0 -7
  83. package/src/class-names/__tests__/types.test.js.flow +0 -35
  84. package/src/class-names/index.js.flow +0 -53
  85. package/src/css/__tests__/types.test.js.flow +0 -42
  86. package/src/css/index.js.flow +0 -36
  87. package/src/css-map/index.js.flow +0 -26
  88. package/src/index.js.flow +0 -13
  89. package/src/keyframes/__tests__/types.test.js.flow +0 -31
  90. package/src/keyframes/index.js.flow +0 -48
  91. package/src/runtime/ac.js.flow +0 -56
  92. package/src/runtime/ax.js.flow +0 -27
  93. package/src/runtime/cache.js.flow +0 -18
  94. package/src/runtime/css-custom-property.js.flow +0 -19
  95. package/src/runtime/dev-warnings.js.flow +0 -7
  96. package/src/runtime/index.js.flow +0 -11
  97. package/src/runtime/is-server-environment.js.flow +0 -19
  98. package/src/runtime/sheet.js.flow +0 -36
  99. package/src/runtime/style-cache.js.flow +0 -19
  100. package/src/runtime/style.js.flow +0 -16
  101. package/src/runtime/types.js.flow +0 -23
  102. package/src/runtime.js.flow +0 -7
  103. package/src/styled/__tests__/types.test.js.flow +0 -84
  104. package/src/styled/index.js.flow +0 -66
  105. package/src/types.js.flow +0 -31
  106. package/src/utils/error.js.flow +0 -7
@@ -1,27 +0,0 @@
1
- /**
2
- * Flowtype definitions for ax
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- /**
8
- * Joins classes together and ensures atomic declarations of a single group exist.
9
- * Atomic declarations take the form of `_{group}{value}` (always prefixed with an underscore),
10
- * where both `group` and `value` are hashes **four characters long**.
11
- * Class names can be of any length,
12
- * this function can take both atomic declarations and class names.
13
- *
14
- * Input:
15
- *
16
- * ```
17
- * ax(['_aaaabbbb', '_aaaacccc'])
18
- * ```
19
- *
20
- * Output:
21
- *
22
- * ```
23
- * '_aaaacccc'
24
- * ```
25
- * @param classes
26
- */
27
- declare export default function ax(classNames: (string | void | false)[]): string | void;
@@ -1,18 +0,0 @@
1
- /**
2
- * Flowtype definitions for cache
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- /**
8
- * Returns `true` when caching should be disabled, else `false`.
9
- *
10
- * Any code within this check will be removed in the output bundles:
11
- *
12
- * ```js
13
- * if (isCacheDisabled()) {
14
- * // This code will be removed from the output bundles
15
- * }
16
- * ```
17
- */
18
- declare export var isCacheDisabled: () => boolean;
@@ -1,19 +0,0 @@
1
- /**
2
- * Flowtype definitions for css-custom-property
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- /**
8
- * Returns a CSS custom property value with an optional suffix & prefix.
9
- * Prefix will only be added if there is a suffix.
10
- * If the value is undefined a fallback value will be returned to prevent children inheriting parent values.
11
- * @param value
12
- * @param suffix
13
- * @param prefix
14
- */
15
- declare export default function cssCustomPropertyValue(
16
- value: string | number | null | void,
17
- suffix?: string | void | null,
18
- prefix?: string | void | null
19
- ): string | number;
@@ -1,7 +0,0 @@
1
- /**
2
- * Flowtype definitions for dev-warnings
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- declare export var analyzeCssInDev: (sheet: string) => void;
@@ -1,11 +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
- declare export { default as CS } from './style';
8
- declare export { default as CC } from './style-cache';
9
- declare export { default as ax } from './ax';
10
- declare export { default as ac, clearCache as clearAcCache } from './ac';
11
- declare export { default as ix } from './css-custom-property';
@@ -1,19 +0,0 @@
1
- /**
2
- * Flowtype definitions for is-server-environment
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- /**
8
- * Returns `true` when inside a node environment,
9
- * else `false`.
10
- *
11
- * When using this it will remove any node code from the browser bundle - for example:
12
- *
13
- * ```js
14
- * if (isServerEnvironment()) {
15
- * // This code will be removed from the browser bundle
16
- * }
17
- * ```
18
- */
19
- declare export var isServerEnvironment: () => boolean;
@@ -1,36 +0,0 @@
1
- /**
2
- * Flowtype definitions for sheet
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { Bucket, StyleSheetOpts } from './types';
8
- /**
9
- * Ordered style buckets using their short psuedo name.
10
- * If changes are needed make sure that it aligns with the definition in `sort-at-rule-pseudos.tsx`.
11
- */
12
- declare export var styleBucketOrdering: Bucket[];
13
- /**
14
- * Gets the bucket depending on the sheet.
15
- * This function makes assumptions as to the form of the input class name.
16
- *
17
- * Input:
18
- *
19
- * ```
20
- * "._a1234567:hover{ color: red; }"
21
- * ```
22
- *
23
- * Output:
24
- *
25
- * ```
26
- * "h"
27
- * ```
28
- * @param sheet styles for which we are getting the bucket
29
- */
30
- declare export var getStyleBucketName: (sheet: string) => Bucket;
31
- /**
32
- * Used to move styles to the head of the application during runtime.
33
- * @param css string
34
- * @param opts StyleSheetOpts
35
- */
36
- declare export default function insertRule(css: string, opts: StyleSheetOpts): void;
@@ -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,26 +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 } from '../types';
8
- /**
9
- * ## cssMap
10
- *
11
- * Creates a collection of named CSS rules that are statically typed and useable with other Compiled APIs.
12
- * For further details [read the documentation](https://compiledcssinjs.com/docs/api-cssmap).
13
- * @example ```
14
- * const borderStyleMap = cssMap({
15
- * none: { borderStyle: 'none' },
16
- * solid: { borderStyle: 'solid' },
17
- * });
18
- * const Component = ({ borderStyle }) => <div css={css(borderStyleMap[borderStyle])} />
19
- *
20
- * <Component borderStyle="solid" />
21
- * ```
22
- */
23
- declare type returnType<T: string, P> = { [key: T]: CSSProps<P> };
24
- declare export default function cssMap<T: string, TProps>(_styles: {
25
- [key: T]: CssObject<TProps> | CssObject<TProps>[],
26
- }): $ReadOnly<returnType<T, TProps>>;
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;