@compiled/react 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/browser/class-names/index.d.ts +21 -15
  2. package/dist/browser/class-names/index.js +1 -27
  3. package/dist/browser/class-names/index.js.map +1 -1
  4. package/dist/browser/css/index.d.ts +22 -19
  5. package/dist/browser/css/index.js +3 -3
  6. package/dist/browser/css/index.js.map +1 -1
  7. package/dist/browser/jsx/jsx-local-namespace.d.ts +32 -6
  8. package/dist/browser/keyframes/index.d.ts +20 -24
  9. package/dist/browser/keyframes/index.js.map +1 -1
  10. package/dist/browser/styled/index.d.ts +35 -7
  11. package/dist/browser/styled/index.js +35 -7
  12. package/dist/browser/styled/index.js.map +1 -1
  13. package/dist/cjs/class-names/index.d.ts +21 -15
  14. package/dist/cjs/class-names/index.js +1 -27
  15. package/dist/cjs/class-names/index.js.map +1 -1
  16. package/dist/cjs/css/index.d.ts +22 -19
  17. package/dist/cjs/css/index.js +3 -3
  18. package/dist/cjs/css/index.js.map +1 -1
  19. package/dist/cjs/jsx/jsx-local-namespace.d.ts +32 -6
  20. package/dist/cjs/keyframes/index.d.ts +20 -24
  21. package/dist/cjs/keyframes/index.js.map +1 -1
  22. package/dist/cjs/styled/index.d.ts +35 -7
  23. package/dist/cjs/styled/index.js +35 -7
  24. package/dist/cjs/styled/index.js.map +1 -1
  25. package/dist/esm/class-names/index.d.ts +21 -15
  26. package/dist/esm/class-names/index.js +1 -27
  27. package/dist/esm/class-names/index.js.map +1 -1
  28. package/dist/esm/css/index.d.ts +22 -19
  29. package/dist/esm/css/index.js +3 -3
  30. package/dist/esm/css/index.js.map +1 -1
  31. package/dist/esm/jsx/jsx-local-namespace.d.ts +32 -6
  32. package/dist/esm/keyframes/index.d.ts +20 -24
  33. package/dist/esm/keyframes/index.js.map +1 -1
  34. package/dist/esm/styled/index.d.ts +35 -7
  35. package/dist/esm/styled/index.js +35 -7
  36. package/dist/esm/styled/index.js.map +1 -1
  37. package/package.json +3 -3
  38. package/src/__tests__/ssr.test.tsx +1 -1
  39. package/src/class-names/index.tsx +23 -13
  40. package/src/css/__tests__/index.test.tsx +7 -0
  41. package/src/css/index.tsx +32 -24
  42. package/src/jsx/jsx-local-namespace.tsx +32 -6
  43. package/src/keyframes/index.tsx +24 -28
  44. package/src/styled/index.tsx +35 -7
  45. package/CHANGELOG.md +0 -128
@@ -1,24 +1,14 @@
1
1
  import type { BasicTemplateInterpolations, CSSProps } from '../types';
2
2
  export declare type KeyframeSteps = string | Record<string, CSSProps>;
3
3
  /**
4
- * Create keyframes using a tagged template expression:
4
+ * ## Keyframes
5
5
  *
6
- * ```
7
- * const fadeOut = keyframes`
8
- * from { opacity: 1; }
9
- * to { opacity: 0; }
10
- * `;
11
- * ```
12
- *
13
- * @param _strings The input string values
14
- * @param _interpolations The arguments used in the expression
15
- */
16
- export declare function keyframes(_strings: TemplateStringsArray, ..._interpolations: BasicTemplateInterpolations[]): string;
17
- /**
18
- * Create keyframes using:
6
+ * Define keyframes to be used in a [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation).
7
+ * For further details [read the API documentation](https://compiledcssinjs.com/docs/api-keyframes).
19
8
  *
20
- * 1. An object expression
9
+ * ### Style with objects
21
10
  *
11
+ * @example
22
12
  * ```
23
13
  * const fadeOut = keyframes({
24
14
  * from: {
@@ -28,20 +18,26 @@ export declare function keyframes(_strings: TemplateStringsArray, ..._interpolat
28
18
  * opacity: 0,
29
19
  * },
30
20
  * });
21
+ *
22
+ * <div css={{ animation: `${fadeOut} 2s` }} />
31
23
  * ```
32
24
  *
33
- * 2. A string
25
+ * ### Style with template literals
34
26
  *
27
+ * @example
35
28
  * ```
36
- * const fadeOut = keyframes('from { opacity: 1; } to { opacity: 0; }');
37
- * ```
29
+ * const fadeOut = keyframes`
30
+ * from {
31
+ * opacity: 1;
32
+ * }
38
33
  *
39
- * 3. A template literal
34
+ * to {
35
+ * opacity: 0;
36
+ * }
37
+ * `;
40
38
  *
39
+ * <div css={{ animation: `${fadeOut} 2s` }} />
41
40
  * ```
42
- * const fadeOut = keyframes(`from { opacity: 1; } to { opacity: 0; }`);
43
- * ```
44
- *
45
- * @param _steps The waypoints along the animation sequence
46
41
  */
47
- export declare function keyframes(_steps: KeyframeSteps): string;
42
+ export declare function keyframes(steps: KeyframeSteps): string;
43
+ export declare function keyframes(strings: TemplateStringsArray, ...interpolations: BasicTemplateInterpolations[]): string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keyframes/index.tsx"],"names":[],"mappings":";;;AACA,wCAAkD;AAsDlD,SAAgB,SAAS,CACvB,eAAqD;IACrD,yBAAiD;SAAjD,UAAiD,EAAjD,qBAAiD,EAAjD,IAAiD;QAAjD,wCAAiD;;IAEjD,MAAM,wBAAgB,EAAE,CAAC;AAC3B,CAAC;AALD,8BAKC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keyframes/index.tsx"],"names":[],"mappings":";;;AACA,wCAAkD;AAkDlD,SAAgB,SAAS,CACvB,eAAqD;IACrD,yBAAiD;SAAjD,UAAiD,EAAjD,qBAAiD,EAAjD,IAAiD;QAAjD,wCAAiD;;IAEjD,MAAM,wBAAgB,EAAE,CAAC;AAC3B,CAAC;AALD,8BAKC"}
@@ -32,16 +32,44 @@ export interface StyledComponentInstantiator extends StyledComponentMap {
32
32
  <TInheritedProps extends unknown>(Component: ComponentType<TInheritedProps>): StyledFunctionFromComponent<TInheritedProps>;
33
33
  }
34
34
  /**
35
- * Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support.
35
+ * ## Styled component
36
36
  *
37
+ * Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support.
38
+ * For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled).
39
+ *
40
+ * ### Style with objects
41
+ *
42
+ * @example
43
+ * ```
44
+ * styled.div({
45
+ * fontSize: 12,
46
+ * });
47
+ * ```
48
+ *
49
+ * ### Style with template literals
50
+ *
51
+ * @example
37
52
  * ```
38
- * styled.div`font-size: 12px`; // Template literal CSS
39
- * styled.div({ fontSize: 12 }); // Object CSS
40
- * styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS
41
- * styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS
53
+ * styled.div`
54
+ * font-size: 12px
55
+ * `;
42
56
  * ```
43
57
  *
44
- * For more help, read the docs:
45
- * https://compiledcssinjs.com/docs/api-styled
58
+ * ### Compose styles with arrays
59
+ *
60
+ * @example
61
+ * ```
62
+ * import { css } from '@compiled/react';
63
+ *
64
+ * styled.div([
65
+ * { fontSize: 12 },
66
+ * css`font-size: 12px;`
67
+ * ]);
68
+ *
69
+ * styled.div(
70
+ * { fontSize: 12 },
71
+ * css`font-size: 12px`
72
+ * );
73
+ * ```
46
74
  */
47
75
  export declare const styled: StyledComponentInstantiator;
@@ -3,17 +3,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.styled = void 0;
4
4
  var error_1 = require("../utils/error");
5
5
  /**
6
- * Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support.
6
+ * ## Styled component
7
7
  *
8
+ * Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support.
9
+ * For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled).
10
+ *
11
+ * ### Style with objects
12
+ *
13
+ * @example
14
+ * ```
15
+ * styled.div({
16
+ * fontSize: 12,
17
+ * });
18
+ * ```
19
+ *
20
+ * ### Style with template literals
21
+ *
22
+ * @example
8
23
  * ```
9
- * styled.div`font-size: 12px`; // Template literal CSS
10
- * styled.div({ fontSize: 12 }); // Object CSS
11
- * styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS
12
- * styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS
24
+ * styled.div`
25
+ * font-size: 12px
26
+ * `;
13
27
  * ```
14
28
  *
15
- * For more help, read the docs:
16
- * https://compiledcssinjs.com/docs/api-styled
29
+ * ### Compose styles with arrays
30
+ *
31
+ * @example
32
+ * ```
33
+ * import { css } from '@compiled/react';
34
+ *
35
+ * styled.div([
36
+ * { fontSize: 12 },
37
+ * css`font-size: 12px;`
38
+ * ]);
39
+ *
40
+ * styled.div(
41
+ * { fontSize: 12 },
42
+ * css`font-size: 12px`
43
+ * );
44
+ * ```
17
45
  */
18
46
  exports.styled = new Proxy({}, {
19
47
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":";;;AAGA,wCAAkD;AAwDlD;;;;;;;;;;;;GAYG;AACU,QAAA,MAAM,GAAgC,IAAI,KAAK,CAC1D,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,wBAAgB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":";;;AAGA,wCAAkD;AAwDlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACU,QAAA,MAAM,GAAgC,IAAI,KAAK,CAC1D,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,wBAAgB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
@@ -1,38 +1,44 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ReactNode, CSSProperties } from 'react';
2
2
  import type { BasicTemplateInterpolations, CssFunction } from '../types';
3
3
  export declare type Interpolations = (BasicTemplateInterpolations | CssFunction | CssFunction[])[];
4
4
  export interface ClassNamesProps {
5
5
  children: (opts: {
6
6
  css: (css: CssFunction | CssFunction[], ...interpolations: Interpolations) => string;
7
- style: {
8
- [key: string]: string;
9
- };
7
+ style: CSSProperties;
10
8
  }) => ReactNode;
11
9
  }
12
10
  /**
13
- * Use a component where styles are not necessarily tied to an element.
11
+ * ## Class names
14
12
  *
13
+ * Use a component where styles are not necessarily used on a JSX element.
14
+ * For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names).
15
+ *
16
+ * ### Style with objects
17
+ *
18
+ * @example
15
19
  * ```
16
- * // Object CSS
17
20
  * <ClassNames>
18
21
  * {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
19
22
  * </ClassNames>
23
+ * ```
20
24
  *
21
- * // Template literal CSS
25
+ * ### Style with template literals
26
+ *
27
+ * @example
28
+ * ```
22
29
  * <ClassNames>
23
30
  * {({ css, style }) => children({ className: css`font-size: 12px;` })}
24
31
  * </ClassNames>
32
+ * ```
33
+ *
34
+ * ### Compose styles with arrays
25
35
  *
26
- * // Array CSS
36
+ * @example
37
+ * ```
27
38
  * <ClassNames>
28
39
  * {({ css, style }) =>
29
- * children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })}
40
+ * children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })}
30
41
  * </ClassNames>
31
42
  * ```
32
- *
33
- * For more help, read the docs:
34
- * https://compiledcssinjs.com/docs/api-class-names
35
- *
36
- * @param props
37
43
  */
38
- export declare function ClassNames(_: ClassNamesProps): JSX.Element;
44
+ export declare function ClassNames({ children }: ClassNamesProps): JSX.Element;
@@ -1,31 +1,5 @@
1
1
  import { createSetupError } from '../utils/error';
2
- /**
3
- * Use a component where styles are not necessarily tied to an element.
4
- *
5
- * ```
6
- * // Object CSS
7
- * <ClassNames>
8
- * {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
9
- * </ClassNames>
10
- *
11
- * // Template literal CSS
12
- * <ClassNames>
13
- * {({ css, style }) => children({ className: css`font-size: 12px;` })}
14
- * </ClassNames>
15
- *
16
- * // Array CSS
17
- * <ClassNames>
18
- * {({ css, style }) =>
19
- * children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })}
20
- * </ClassNames>
21
- * ```
22
- *
23
- * For more help, read the docs:
24
- * https://compiledcssinjs.com/docs/api-class-names
25
- *
26
- * @param props
27
- */
28
- export function ClassNames(_) {
2
+ export function ClassNames(_props) {
29
3
  throw createSetupError();
30
4
  }
31
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/class-names/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAWlD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,UAAU,CAAC,CAAkB;IAC3C,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/class-names/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+ClD,MAAM,UAAU,UAAU,CAAC,MAAuB;IAChD,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
@@ -1,28 +1,31 @@
1
- import type { BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types';
1
+ import type { AnyKeyCssProps, BasicTemplateInterpolations, CSSProps, FunctionInterpolation } from '../types';
2
2
  /**
3
- * Create styles that can be re-used between components with a template literal.
3
+ * ## CSS
4
4
  *
5
- * ```
6
- * css`color: red;`;
7
- * ```
8
- *
9
- * For more help, read the docs:
10
- * https://compiledcssinjs.com/docs/api-css
5
+ * Define styles that are statically typed and useable with other Compiled APIs.
6
+ * For further details [read the documentation](https://compiledcssinjs.com/docs/api-css).
11
7
  *
12
- * @param css
13
- * @param values
14
- */
15
- export default function css<T = void>(_css: TemplateStringsArray, ..._values: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps;
16
- /**
17
- * Create styles that can be re-used between components with an object
8
+ * ### Style with objects
18
9
  *
10
+ * @example
19
11
  * ```
20
- * css({ color: 'red' });
12
+ * const redText = css({
13
+ * color: 'red',
14
+ * });
15
+ *
16
+ * <div css={redText} />
21
17
  * ```
22
18
  *
23
- * For more help, read the docs:
24
- * https://compiledcssinjs.com/docs/api-css
19
+ * ### Style with template literals
20
+ *
21
+ * @example
22
+ * ```
23
+ * const redText = css`
24
+ * color: red;
25
+ * `;
25
26
  *
26
- * @param css
27
+ * <div css={redText} />
28
+ * ```
27
29
  */
28
- export default function css(_css: CSSProps): CSSProps;
30
+ export default function css<T = void>(styles: TemplateStringsArray, ...interpolations: (BasicTemplateInterpolations | FunctionInterpolation<T>)[]): CSSProps;
31
+ export default function css(styles: AnyKeyCssProps<void> | CSSProps): CSSProps;
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable import/export */
2
2
  import { createSetupError } from '../utils/error';
3
- export default function css(_css) {
4
- var _values = [];
3
+ export default function css(_styles) {
4
+ var _interpolations = [];
5
5
  for (var _i = 1; _i < arguments.length; _i++) {
6
- _values[_i - 1] = arguments[_i];
6
+ _interpolations[_i - 1] = arguments[_i];
7
7
  }
8
8
  throw createSetupError();
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/css/index.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAkClD,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,IAAqC;IACrC,iBAAsE;SAAtE,UAAsE,EAAtE,qBAAsE,EAAtE,IAAsE;QAAtE,gCAAsE;;IAEtE,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/css/index.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAQlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAqClD,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,OAAwC;IACxC,yBAA8E;SAA9E,UAA8E,EAA9E,qBAA8E,EAA9E,IAA8E;QAA9E,wCAA8E;;IAE9E,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
@@ -2,16 +2,42 @@
2
2
  import type { CssFunction } from '../types';
3
3
  declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
4
4
  /**
5
- * Tie styles to an element.
5
+ * ## CSS prop
6
6
  *
7
+ * Style a JSX element.
8
+ * For further details [read the API documentation](https://compiledcssinjs.com/docs/api-css-prop).
9
+ *
10
+ * ### Style with objects
11
+ *
12
+ * @example
13
+ * ```
14
+ * import { css } from '@compiled/react';
15
+ *
16
+ * <div css={css({ fontSize: 12 })} />
17
+ * ```
18
+ *
19
+ * ### Style with template literals
20
+ *
21
+ * @example
22
+ * ```
23
+ * import { css } from '@compiled/react';
24
+ *
25
+ * <div css={css`color: red;`} />
7
26
  * ```
8
- * css={{ fontSize: 12 }} // Object CSS
9
- * css={`font-size: 12px;`} // Template literal CSS
10
- * css={[{ fontSize: 12 }, `font-size: 12px;`]} // Array CSS
27
+ *
28
+ * ### Compose styles with arrays
29
+ *
30
+ * @example
11
31
  * ```
32
+ * import { css } from '@compiled/react';
12
33
  *
13
- * For more help, read the docs:
14
- * https://compiledcssinjs.com/docs/api-css-prop
34
+ * <div
35
+ * css={[
36
+ * css({ fontSize: 12 }),
37
+ * css`color: red;`,
38
+ * ]}
39
+ * />
40
+ * ```
15
41
  */
16
42
  css?: CssFunction | CssFunction[];
17
43
  } : {} : {};
@@ -1,24 +1,14 @@
1
1
  import type { BasicTemplateInterpolations, CSSProps } from '../types';
2
2
  export declare type KeyframeSteps = string | Record<string, CSSProps>;
3
3
  /**
4
- * Create keyframes using a tagged template expression:
4
+ * ## Keyframes
5
5
  *
6
- * ```
7
- * const fadeOut = keyframes`
8
- * from { opacity: 1; }
9
- * to { opacity: 0; }
10
- * `;
11
- * ```
12
- *
13
- * @param _strings The input string values
14
- * @param _interpolations The arguments used in the expression
15
- */
16
- export declare function keyframes(_strings: TemplateStringsArray, ..._interpolations: BasicTemplateInterpolations[]): string;
17
- /**
18
- * Create keyframes using:
6
+ * Define keyframes to be used in a [CSS animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation).
7
+ * For further details [read the API documentation](https://compiledcssinjs.com/docs/api-keyframes).
19
8
  *
20
- * 1. An object expression
9
+ * ### Style with objects
21
10
  *
11
+ * @example
22
12
  * ```
23
13
  * const fadeOut = keyframes({
24
14
  * from: {
@@ -28,20 +18,26 @@ export declare function keyframes(_strings: TemplateStringsArray, ..._interpolat
28
18
  * opacity: 0,
29
19
  * },
30
20
  * });
21
+ *
22
+ * <div css={{ animation: `${fadeOut} 2s` }} />
31
23
  * ```
32
24
  *
33
- * 2. A string
25
+ * ### Style with template literals
34
26
  *
27
+ * @example
35
28
  * ```
36
- * const fadeOut = keyframes('from { opacity: 1; } to { opacity: 0; }');
37
- * ```
29
+ * const fadeOut = keyframes`
30
+ * from {
31
+ * opacity: 1;
32
+ * }
38
33
  *
39
- * 3. A template literal
34
+ * to {
35
+ * opacity: 0;
36
+ * }
37
+ * `;
40
38
  *
39
+ * <div css={{ animation: `${fadeOut} 2s` }} />
41
40
  * ```
42
- * const fadeOut = keyframes(`from { opacity: 1; } to { opacity: 0; }`);
43
- * ```
44
- *
45
- * @param _steps The waypoints along the animation sequence
46
41
  */
47
- export declare function keyframes(_steps: KeyframeSteps): string;
42
+ export declare function keyframes(steps: KeyframeSteps): string;
43
+ export declare function keyframes(strings: TemplateStringsArray, ...interpolations: BasicTemplateInterpolations[]): string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keyframes/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAsDlD,MAAM,UAAU,SAAS,CACvB,eAAqD;IACrD,yBAAiD;SAAjD,UAAiD,EAAjD,qBAAiD,EAAjD,IAAiD;QAAjD,wCAAiD;;IAEjD,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/keyframes/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAkDlD,MAAM,UAAU,SAAS,CACvB,eAAqD;IACrD,yBAAiD;SAAjD,UAAiD,EAAjD,qBAAiD,EAAjD,IAAiD;QAAjD,wCAAiD;;IAEjD,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC"}
@@ -32,16 +32,44 @@ export interface StyledComponentInstantiator extends StyledComponentMap {
32
32
  <TInheritedProps extends unknown>(Component: ComponentType<TInheritedProps>): StyledFunctionFromComponent<TInheritedProps>;
33
33
  }
34
34
  /**
35
- * Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support.
35
+ * ## Styled component
36
36
  *
37
+ * Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support.
38
+ * For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled).
39
+ *
40
+ * ### Style with objects
41
+ *
42
+ * @example
43
+ * ```
44
+ * styled.div({
45
+ * fontSize: 12,
46
+ * });
47
+ * ```
48
+ *
49
+ * ### Style with template literals
50
+ *
51
+ * @example
37
52
  * ```
38
- * styled.div`font-size: 12px`; // Template literal CSS
39
- * styled.div({ fontSize: 12 }); // Object CSS
40
- * styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS
41
- * styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS
53
+ * styled.div`
54
+ * font-size: 12px
55
+ * `;
42
56
  * ```
43
57
  *
44
- * For more help, read the docs:
45
- * https://compiledcssinjs.com/docs/api-styled
58
+ * ### Compose styles with arrays
59
+ *
60
+ * @example
61
+ * ```
62
+ * import { css } from '@compiled/react';
63
+ *
64
+ * styled.div([
65
+ * { fontSize: 12 },
66
+ * css`font-size: 12px;`
67
+ * ]);
68
+ *
69
+ * styled.div(
70
+ * { fontSize: 12 },
71
+ * css`font-size: 12px`
72
+ * );
73
+ * ```
46
74
  */
47
75
  export declare const styled: StyledComponentInstantiator;
@@ -1,16 +1,44 @@
1
1
  import { createSetupError } from '../utils/error';
2
2
  /**
3
- * Create a component that ties styles to an element which comes with built-in behavior such as `ref` and `as` prop support.
3
+ * ## Styled component
4
4
  *
5
+ * Create a component that styles a JSX element which comes with built-in behavior such as `ref` and `as` prop support.
6
+ * For further details [read the documentation](https://compiledcssinjs.com/docs/api-styled).
7
+ *
8
+ * ### Style with objects
9
+ *
10
+ * @example
11
+ * ```
12
+ * styled.div({
13
+ * fontSize: 12,
14
+ * });
15
+ * ```
16
+ *
17
+ * ### Style with template literals
18
+ *
19
+ * @example
5
20
  * ```
6
- * styled.div`font-size: 12px`; // Template literal CSS
7
- * styled.div({ fontSize: 12 }); // Object CSS
8
- * styled.div([{ fontSize: 12 }, `font-size: 12px;`]) // Array CSS
9
- * styled.div({ fontSize: 12 }, `font-size: 12px`) Multi arguments CSS
21
+ * styled.div`
22
+ * font-size: 12px
23
+ * `;
10
24
  * ```
11
25
  *
12
- * For more help, read the docs:
13
- * https://compiledcssinjs.com/docs/api-styled
26
+ * ### Compose styles with arrays
27
+ *
28
+ * @example
29
+ * ```
30
+ * import { css } from '@compiled/react';
31
+ *
32
+ * styled.div([
33
+ * { fontSize: 12 },
34
+ * css`font-size: 12px;`
35
+ * ]);
36
+ *
37
+ * styled.div(
38
+ * { fontSize: 12 },
39
+ * css`font-size: 12px`
40
+ * );
41
+ * ```
14
42
  */
15
43
  export var styled = new Proxy({}, {
16
44
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwDlD;;;;;;;;;;;;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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwDlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,IAAM,MAAM,GAAgC,IAAI,KAAK,CAC1D,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,gBAAgB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compiled/react",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "A familiar and performant compile time CSS-in-JS library for React.",
5
5
  "keywords": [
6
6
  "compiled",
@@ -8,7 +8,7 @@
8
8
  "styled-components",
9
9
  "typescript"
10
10
  ],
11
- "homepage": "https://compiledcssinjs.com",
11
+ "homepage": "https://compiledcssinjs.com/docs/pkg-react",
12
12
  "bugs": "https://github.com/atlassian-labs/compiled/issues/new?assignees=&labels=bug&template=bug_report.md",
13
13
  "repository": {
14
14
  "type": "git",
@@ -72,7 +72,7 @@
72
72
  "jsx-dev-runtime"
73
73
  ],
74
74
  "dependencies": {
75
- "csstype": "^3.0.9"
75
+ "csstype": "^3.0.10"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@testing-library/react": "^11.2.7",
@@ -134,7 +134,7 @@ describe('SSR', () => {
134
134
 
135
135
  expect(result.split('</style>').join('</style>\n')).toMatchInlineSnapshot(`
136
136
  "<style data-cmpld=\\"true\\" nonce=\\"k0Mp1lEd\\">._1e0c1txw{display:flex}._1wyb12am{font-size:50px}._syaz1cnh{color:purple}._ysv75scu:link{color:red}._105332ev:visited{color:pink}._f8pjbf54:focus{color:green}._30l31gy6:hover{color:yellow}._9h8h13q2:active{color:blue}@supports (display:grid){._1df61gy6:focus{color:yellow}._7okp11x8:active{color:black}}@media (max-width:800px){._1o8z1gy6:focus{color:yellow}._1cld11x8:active{color:black}}</style>
137
- <a href=\\"https://atlassian.design\\" class=\\"_1e0c1txw _1wyb12am _syaz1cnh _30l31gy6 _9h8h13q2 _ysv75scu _7okp11x8 _1df61gy6 _f8pjbf54 _105332ev _1cld11x8 _1o8z1gy6\\">Atlassian Design System</a>"
137
+ <a href=\\"https://atlassian.design\\" class=\\"_1e0c1txw _1wyb12am _syaz1cnh _30l31gy6 _9h8h13q2 _ysv75scu _1df61gy6 _7okp11x8 _f8pjbf54 _105332ev _1o8z1gy6 _1cld11x8\\">Atlassian Design System</a>"
138
138
  `);
139
139
  });
140
140