@compiled/react 0.11.2 → 0.11.3

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 (35) hide show
  1. package/dist/browser/class-names/index.d.ts +2 -2
  2. package/dist/browser/jsx/jsx-local-namespace.d.ts +9 -9
  3. package/dist/browser/keyframes/index.d.ts +1 -1
  4. package/dist/browser/runtime/ax.js +2 -2
  5. package/dist/browser/runtime/ax.js.map +1 -1
  6. package/dist/browser/runtime/types.d.ts +3 -3
  7. package/dist/browser/styled/index.d.ts +5 -5
  8. package/dist/browser/styled/index.js.flow +2 -4
  9. package/dist/browser/styled/index.js.map +1 -1
  10. package/dist/browser/types.d.ts +5 -5
  11. package/dist/cjs/class-names/index.d.ts +2 -2
  12. package/dist/cjs/jsx/jsx-local-namespace.d.ts +9 -9
  13. package/dist/cjs/keyframes/index.d.ts +1 -1
  14. package/dist/cjs/runtime/ax.js +2 -2
  15. package/dist/cjs/runtime/ax.js.map +1 -1
  16. package/dist/cjs/runtime/types.d.ts +3 -3
  17. package/dist/cjs/styled/index.d.ts +5 -5
  18. package/dist/cjs/styled/index.js.flow +2 -4
  19. package/dist/cjs/styled/index.js.map +1 -1
  20. package/dist/cjs/types.d.ts +5 -5
  21. package/dist/esm/class-names/index.d.ts +2 -2
  22. package/dist/esm/jsx/jsx-local-namespace.d.ts +9 -9
  23. package/dist/esm/keyframes/index.d.ts +1 -1
  24. package/dist/esm/runtime/ax.js +2 -2
  25. package/dist/esm/runtime/ax.js.map +1 -1
  26. package/dist/esm/runtime/types.d.ts +3 -3
  27. package/dist/esm/styled/index.d.ts +5 -5
  28. package/dist/esm/styled/index.js.flow +2 -4
  29. package/dist/esm/styled/index.js.map +1 -1
  30. package/dist/esm/types.d.ts +5 -5
  31. package/package.json +3 -3
  32. package/src/runtime/__tests__/ax.test.ts +20 -2
  33. package/src/runtime/ax.ts +2 -2
  34. package/src/styled/index.js.flow +2 -4
  35. package/src/styled/index.ts +2 -4
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode, CSSProperties } from 'react';
2
2
  import type { CssType, CssFunction } from '../types';
3
- export declare type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
4
- export declare type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
3
+ export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
4
+ export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
5
5
  interface CssSignature<TProps> {
6
6
  (...interpolations: ObjectInterpolation<TProps>[]): string;
7
7
  (template: TemplateStringsArray, ...interpolations: TemplateStringsInterpolation<TProps>[]): string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { CssFunction } from '../types';
3
- declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
3
+ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
4
4
  /**
5
5
  * ## CSS prop
6
6
  *
@@ -41,14 +41,14 @@ declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ?
41
41
  */
42
42
  css?: CssFunction<void> | CssFunction<void>[];
43
43
  } : {} : {};
44
- declare type ReactJSXElement = JSX.Element;
45
- declare type ReactJSXElementClass = JSX.ElementClass;
46
- declare type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
47
- declare type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute;
48
- declare type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
49
- declare type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
50
- declare type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
51
- declare type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
44
+ type ReactJSXElement = JSX.Element;
45
+ type ReactJSXElementClass = JSX.ElementClass;
46
+ type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
47
+ type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute;
48
+ type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
49
+ type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
50
+ type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
51
+ type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
52
52
  export declare namespace CompiledJSX {
53
53
  type Element = ReactJSXElement;
54
54
  type ElementClass = ReactJSXElementClass;
@@ -1,5 +1,5 @@
1
1
  import type { BasicTemplateInterpolations, CSSProps } from '../types';
2
- export declare type KeyframeSteps = string | Record<string, CSSProps<void>>;
2
+ export type KeyframeSteps = string | Record<string, CSSProps<void>>;
3
3
  /**
4
4
  * ## Keyframes
5
5
  *
@@ -26,8 +26,8 @@ var ATOMIC_GROUP_LENGTH = 5;
26
26
  * @param classes
27
27
  */
28
28
  export default function ax(classNames) {
29
- if (classNames.length <= 1) {
30
- // short circuit if theres no custom class names.
29
+ if (classNames.length <= 1 && (!classNames[0] || classNames[0].indexOf(' ') === -1)) {
30
+ // short circuit if there's no custom class names.
31
31
  return classNames[0] || undefined;
32
32
  }
33
33
  var atomicGroups = {};
@@ -1 +1 @@
1
- {"version":3,"file":"ax.js","sourceRoot":"","sources":["../../../src/runtime/ax.ts"],"names":[],"mappings":"AAAA,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;GAGG;AACH,IAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,EAAE,CAAC,UAA0C;IACnE,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;QAC1B,iDAAiD;QACjD,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;KACnC;IAED,IAAM,YAAY,GAA2B,EAAE,CAAC;IAEhD,KAAK,IAAI,CAAC,GAAG,CAAC,EAA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AC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACnF,kDAAkD;QAClD,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;KACnC;IAED,IAAM,YAAY,GAA2B,EAAE,CAAC;IAEhD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG,EAAE;YACR,SAAS;SACV;QAED,IAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACzB,IAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAClC,CAAC,EACD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAC9E,CAAC;YACF,YAAY,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC;SACxC;KACF;IAED,IAAI,GAAG,GAAG,EAAE,CAAC;IAEb,KAAK,IAAM,GAAG,IAAI,YAAY,EAAE;QAC9B,IAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,GAAG,IAAI,KAAK,GAAG,GAAG,CAAC;KACpB;IAED,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC"}
@@ -10,8 +10,8 @@ export interface StyleSheetOpts {
10
10
  /**
11
11
  * Buckets under which we will group our stylesheets
12
12
  */
13
- export declare type Bucket = '' | 'l' | 'v' | 'w' | 'f' | 'i' | 'h' | 'a' | 'm';
14
- export declare type UseCacheHook = () => Record<string, true>;
15
- export declare type ProviderComponent = (props: {
13
+ export type Bucket = '' | 'l' | 'v' | 'w' | 'f' | 'i' | 'h' | 'a' | 'm';
14
+ export type UseCacheHook = () => Record<string, true>;
15
+ export type ProviderComponent = (props: {
16
16
  children: JSX.Element[] | JSX.Element;
17
17
  }) => JSX.Element;
@@ -6,17 +6,17 @@ import type { CssType, CssFunction } from '../types';
6
6
  export interface StyledProps {
7
7
  as?: keyof JSX.IntrinsicElements;
8
8
  }
9
- export declare type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
10
- export declare type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
11
- export interface StyledComponent<ComponentProps extends unknown> {
9
+ export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
10
+ export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
11
+ export interface StyledComponent<ComponentProps> {
12
12
  <TProps = {}>(...css: ObjectInterpolation<TProps>[]): React.ComponentType<TProps & ComponentProps & StyledProps>;
13
13
  <TProps = {}>(template: TemplateStringsArray, ...interpolations: TemplateStringsInterpolation<TProps>[]): React.ComponentType<TProps & ComponentProps & StyledProps>;
14
14
  }
15
- export declare type StyledComponentMap = {
15
+ export type StyledComponentMap = {
16
16
  [Tag in keyof JSX.IntrinsicElements]: StyledComponent<JSX.IntrinsicElements[Tag]>;
17
17
  };
18
18
  export interface CreateStyledComponent extends StyledComponentMap {
19
- <TInheritedProps extends unknown>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>;
19
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>;
20
20
  }
21
21
  /**
22
22
  * ## Styled component
@@ -14,7 +14,7 @@ export type StyledProps = {
14
14
  };
15
15
  export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
16
16
  export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
17
- export interface StyledComponent<ComponentProps: mixed> {
17
+ export interface StyledComponent<ComponentProps> {
18
18
  <TProps>(
19
19
  ...css: ObjectInterpolation<TProps>[]
20
20
  ): React$ComponentType<{ ...TProps, ...ComponentProps, ...StyledProps }>;
@@ -25,9 +25,7 @@ export interface StyledComponent<ComponentProps: mixed> {
25
25
  }
26
26
  export type StyledComponentMap = $ObjMapi<$JSXIntrinsics, <Tag>(Tag) => StyledComponent<mixed>>;
27
27
  export type CreateStyledComponent = {
28
- <TInheritedProps: mixed>(
29
- Component: ComponentType<TInheritedProps>
30
- ): StyledComponent<TInheritedProps>,
28
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>,
31
29
  ...
32
30
  } & StyledComponentMap;
33
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAsClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,IAAM,MAAM,GAA0B,IAAI,KAAK,CACpD,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.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,IAAM,MAAM,GAA0B,IAAI,KAAK,CACpD,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,gBAAgB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
@@ -2,19 +2,19 @@ import type * as CSS from 'csstype';
2
2
  /**
3
3
  * Typing for the interpolations.
4
4
  */
5
- export declare type BasicTemplateInterpolations = string | number;
5
+ export type BasicTemplateInterpolations = string | number;
6
6
  export interface FunctionInterpolation<TProps> {
7
7
  (props: TProps): CssFunction<TProps>;
8
8
  }
9
9
  /**
10
10
  * Possible types for a CSS value
11
11
  */
12
- export declare type CssType<TProps> = CSSProps<TProps> | CssObject<TProps> | FunctionInterpolation<TProps> | string;
12
+ export type CssType<TProps> = CSSProps<TProps> | CssObject<TProps> | FunctionInterpolation<TProps> | string;
13
13
  /**
14
14
  * These are all the CSS props that will exist.
15
15
  */
16
- export declare type CSSProps<TProps> = CSS.Properties<CssFunction<TProps>>;
17
- export declare type CssObject<TProps> = {
16
+ export type CSSProps<TProps> = CSS.Properties<CssFunction<TProps>>;
17
+ export type CssObject<TProps> = {
18
18
  [key: string]: CssFunction<TProps>;
19
19
  };
20
- export declare type CssFunction<TProps = unknown> = CssType<TProps> | BasicTemplateInterpolations | boolean | undefined;
20
+ export type CssFunction<TProps = unknown> = CssType<TProps> | BasicTemplateInterpolations | boolean | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode, CSSProperties } from 'react';
2
2
  import type { CssType, CssFunction } from '../types';
3
- export declare type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
4
- export declare type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
3
+ export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
4
+ export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
5
5
  interface CssSignature<TProps> {
6
6
  (...interpolations: ObjectInterpolation<TProps>[]): string;
7
7
  (template: TemplateStringsArray, ...interpolations: TemplateStringsInterpolation<TProps>[]): string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { CssFunction } from '../types';
3
- declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
3
+ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
4
4
  /**
5
5
  * ## CSS prop
6
6
  *
@@ -41,14 +41,14 @@ declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ?
41
41
  */
42
42
  css?: CssFunction<void> | CssFunction<void>[];
43
43
  } : {} : {};
44
- declare type ReactJSXElement = JSX.Element;
45
- declare type ReactJSXElementClass = JSX.ElementClass;
46
- declare type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
47
- declare type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute;
48
- declare type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
49
- declare type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
50
- declare type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
51
- declare type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
44
+ type ReactJSXElement = JSX.Element;
45
+ type ReactJSXElementClass = JSX.ElementClass;
46
+ type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
47
+ type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute;
48
+ type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
49
+ type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
50
+ type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
51
+ type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
52
52
  export declare namespace CompiledJSX {
53
53
  type Element = ReactJSXElement;
54
54
  type ElementClass = ReactJSXElementClass;
@@ -1,5 +1,5 @@
1
1
  import type { BasicTemplateInterpolations, CSSProps } from '../types';
2
- export declare type KeyframeSteps = string | Record<string, CSSProps<void>>;
2
+ export type KeyframeSteps = string | Record<string, CSSProps<void>>;
3
3
  /**
4
4
  * ## Keyframes
5
5
  *
@@ -28,8 +28,8 @@ var ATOMIC_GROUP_LENGTH = 5;
28
28
  * @param classes
29
29
  */
30
30
  function ax(classNames) {
31
- if (classNames.length <= 1) {
32
- // short circuit if theres no custom class names.
31
+ if (classNames.length <= 1 && (!classNames[0] || classNames[0].indexOf(' ') === -1)) {
32
+ // short circuit if there's no custom class names.
33
33
  return classNames[0] || undefined;
34
34
  }
35
35
  var atomicGroups = {};
@@ -1 +1 @@
1
- {"version":3,"file":"ax.js","sourceRoot":"","sources":["../../../src/runtime/ax.ts"],"names":[],"mappings":";;AAAA,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;GAGG;AACH,IAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAwB,EAAE,CAAC,UAA0C;IACnE,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;QAC1B,iDAAiD;QACjD,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;KACnC;IAED,IAAM,YAAY,GAA2B,EAAE,CAAC;IAEhD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG,EAAE;YACR,SAAS;SACV;QAED,IAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACzB,IAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAClC,CAAC,EACD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,mBAAmB,CAAC,C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CAAC,EAAE,EAAE;YACtC,IAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACzB,IAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAClC,CAAC,EACD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAC9E,CAAC;YACF,YAAY,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC;SACxC;KACF;IAED,IAAI,GAAG,GAAG,EAAE,CAAC;IAEb,KAAK,IAAM,GAAG,IAAI,YAAY,EAAE;QAC9B,IAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,GAAG,IAAI,KAAK,GAAG,GAAG,CAAC;KACpB;IAED,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAlCD,qBAkCC"}
@@ -10,8 +10,8 @@ export interface StyleSheetOpts {
10
10
  /**
11
11
  * Buckets under which we will group our stylesheets
12
12
  */
13
- export declare type Bucket = '' | 'l' | 'v' | 'w' | 'f' | 'i' | 'h' | 'a' | 'm';
14
- export declare type UseCacheHook = () => Record<string, true>;
15
- export declare type ProviderComponent = (props: {
13
+ export type Bucket = '' | 'l' | 'v' | 'w' | 'f' | 'i' | 'h' | 'a' | 'm';
14
+ export type UseCacheHook = () => Record<string, true>;
15
+ export type ProviderComponent = (props: {
16
16
  children: JSX.Element[] | JSX.Element;
17
17
  }) => JSX.Element;
@@ -6,17 +6,17 @@ import type { CssType, CssFunction } from '../types';
6
6
  export interface StyledProps {
7
7
  as?: keyof JSX.IntrinsicElements;
8
8
  }
9
- export declare type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
10
- export declare type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
11
- export interface StyledComponent<ComponentProps extends unknown> {
9
+ export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
10
+ export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
11
+ export interface StyledComponent<ComponentProps> {
12
12
  <TProps = {}>(...css: ObjectInterpolation<TProps>[]): React.ComponentType<TProps & ComponentProps & StyledProps>;
13
13
  <TProps = {}>(template: TemplateStringsArray, ...interpolations: TemplateStringsInterpolation<TProps>[]): React.ComponentType<TProps & ComponentProps & StyledProps>;
14
14
  }
15
- export declare type StyledComponentMap = {
15
+ export type StyledComponentMap = {
16
16
  [Tag in keyof JSX.IntrinsicElements]: StyledComponent<JSX.IntrinsicElements[Tag]>;
17
17
  };
18
18
  export interface CreateStyledComponent extends StyledComponentMap {
19
- <TInheritedProps extends unknown>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>;
19
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>;
20
20
  }
21
21
  /**
22
22
  * ## Styled component
@@ -14,7 +14,7 @@ export type StyledProps = {
14
14
  };
15
15
  export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
16
16
  export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
17
- export interface StyledComponent<ComponentProps: mixed> {
17
+ export interface StyledComponent<ComponentProps> {
18
18
  <TProps>(
19
19
  ...css: ObjectInterpolation<TProps>[]
20
20
  ): React$ComponentType<{ ...TProps, ...ComponentProps, ...StyledProps }>;
@@ -25,9 +25,7 @@ export interface StyledComponent<ComponentProps: mixed> {
25
25
  }
26
26
  export type StyledComponentMap = $ObjMapi<$JSXIntrinsics, <Tag>(Tag) => StyledComponent<mixed>>;
27
27
  export type CreateStyledComponent = {
28
- <TInheritedProps: mixed>(
29
- Component: ComponentType<TInheritedProps>
30
- ): StyledComponent<TInheritedProps>,
28
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>,
31
29
  ...
32
30
  } & StyledComponentMap;
33
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.ts"],"names":[],"mappings":";;;AAGA,wCAAkD;AAsClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACU,QAAA,MAAM,GAA0B,IAAI,KAAK,CACpD,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,IAAA,wBAAgB,GAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.ts"],"names":[],"mappings":";;;AAGA,wCAAkD;AAoClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACU,QAAA,MAAM,GAA0B,IAAI,KAAK,CACpD,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,IAAA,wBAAgB,GAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
@@ -2,19 +2,19 @@ import type * as CSS from 'csstype';
2
2
  /**
3
3
  * Typing for the interpolations.
4
4
  */
5
- export declare type BasicTemplateInterpolations = string | number;
5
+ export type BasicTemplateInterpolations = string | number;
6
6
  export interface FunctionInterpolation<TProps> {
7
7
  (props: TProps): CssFunction<TProps>;
8
8
  }
9
9
  /**
10
10
  * Possible types for a CSS value
11
11
  */
12
- export declare type CssType<TProps> = CSSProps<TProps> | CssObject<TProps> | FunctionInterpolation<TProps> | string;
12
+ export type CssType<TProps> = CSSProps<TProps> | CssObject<TProps> | FunctionInterpolation<TProps> | string;
13
13
  /**
14
14
  * These are all the CSS props that will exist.
15
15
  */
16
- export declare type CSSProps<TProps> = CSS.Properties<CssFunction<TProps>>;
17
- export declare type CssObject<TProps> = {
16
+ export type CSSProps<TProps> = CSS.Properties<CssFunction<TProps>>;
17
+ export type CssObject<TProps> = {
18
18
  [key: string]: CssFunction<TProps>;
19
19
  };
20
- export declare type CssFunction<TProps = unknown> = CssType<TProps> | BasicTemplateInterpolations | boolean | undefined;
20
+ export type CssFunction<TProps = unknown> = CssType<TProps> | BasicTemplateInterpolations | boolean | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode, CSSProperties } from 'react';
2
2
  import type { CssType, CssFunction } from '../types';
3
- export declare type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
4
- export declare type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
3
+ export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
4
+ export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
5
5
  interface CssSignature<TProps> {
6
6
  (...interpolations: ObjectInterpolation<TProps>[]): string;
7
7
  (template: TemplateStringsArray, ...interpolations: TemplateStringsInterpolation<TProps>[]): string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { CssFunction } from '../types';
3
- declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
3
+ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string extends TProps['className' & keyof TProps] ? {
4
4
  /**
5
5
  * ## CSS prop
6
6
  *
@@ -41,14 +41,14 @@ declare type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ?
41
41
  */
42
42
  css?: CssFunction<void> | CssFunction<void>[];
43
43
  } : {} : {};
44
- declare type ReactJSXElement = JSX.Element;
45
- declare type ReactJSXElementClass = JSX.ElementClass;
46
- declare type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
47
- declare type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute;
48
- declare type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
49
- declare type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
50
- declare type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
51
- declare type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
44
+ type ReactJSXElement = JSX.Element;
45
+ type ReactJSXElementClass = JSX.ElementClass;
46
+ type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
47
+ type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute;
48
+ type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
49
+ type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
50
+ type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
51
+ type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
52
52
  export declare namespace CompiledJSX {
53
53
  type Element = ReactJSXElement;
54
54
  type ElementClass = ReactJSXElementClass;
@@ -1,5 +1,5 @@
1
1
  import type { BasicTemplateInterpolations, CSSProps } from '../types';
2
- export declare type KeyframeSteps = string | Record<string, CSSProps<void>>;
2
+ export type KeyframeSteps = string | Record<string, CSSProps<void>>;
3
3
  /**
4
4
  * ## Keyframes
5
5
  *
@@ -26,8 +26,8 @@ var ATOMIC_GROUP_LENGTH = 5;
26
26
  * @param classes
27
27
  */
28
28
  export default function ax(classNames) {
29
- if (classNames.length <= 1) {
30
- // short circuit if theres no custom class names.
29
+ if (classNames.length <= 1 && (!classNames[0] || classNames[0].indexOf(' ') === -1)) {
30
+ // short circuit if there's no custom class names.
31
31
  return classNames[0] || undefined;
32
32
  }
33
33
  var atomicGroups = {};
@@ -1 +1 @@
1
- {"version":3,"file":"ax.js","sourceRoot":"","sources":["../../../src/runtime/ax.ts"],"names":[],"mappings":"AAAA,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;GAGG;AACH,IAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,EAAE,CAAC,UAA0C;IACnE,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;QAC1B,i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
@@ -10,8 +10,8 @@ export interface StyleSheetOpts {
10
10
  /**
11
11
  * Buckets under which we will group our stylesheets
12
12
  */
13
- export declare type Bucket = '' | 'l' | 'v' | 'w' | 'f' | 'i' | 'h' | 'a' | 'm';
14
- export declare type UseCacheHook = () => Record<string, true>;
15
- export declare type ProviderComponent = (props: {
13
+ export type Bucket = '' | 'l' | 'v' | 'w' | 'f' | 'i' | 'h' | 'a' | 'm';
14
+ export type UseCacheHook = () => Record<string, true>;
15
+ export type ProviderComponent = (props: {
16
16
  children: JSX.Element[] | JSX.Element;
17
17
  }) => JSX.Element;
@@ -6,17 +6,17 @@ import type { CssType, CssFunction } from '../types';
6
6
  export interface StyledProps {
7
7
  as?: keyof JSX.IntrinsicElements;
8
8
  }
9
- export declare type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
10
- export declare type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
11
- export interface StyledComponent<ComponentProps extends unknown> {
9
+ export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
10
+ export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
11
+ export interface StyledComponent<ComponentProps> {
12
12
  <TProps = {}>(...css: ObjectInterpolation<TProps>[]): React.ComponentType<TProps & ComponentProps & StyledProps>;
13
13
  <TProps = {}>(template: TemplateStringsArray, ...interpolations: TemplateStringsInterpolation<TProps>[]): React.ComponentType<TProps & ComponentProps & StyledProps>;
14
14
  }
15
- export declare type StyledComponentMap = {
15
+ export type StyledComponentMap = {
16
16
  [Tag in keyof JSX.IntrinsicElements]: StyledComponent<JSX.IntrinsicElements[Tag]>;
17
17
  };
18
18
  export interface CreateStyledComponent extends StyledComponentMap {
19
- <TInheritedProps extends unknown>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>;
19
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>;
20
20
  }
21
21
  /**
22
22
  * ## Styled component
@@ -14,7 +14,7 @@ export type StyledProps = {
14
14
  };
15
15
  export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
16
16
  export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
17
- export interface StyledComponent<ComponentProps: mixed> {
17
+ export interface StyledComponent<ComponentProps> {
18
18
  <TProps>(
19
19
  ...css: ObjectInterpolation<TProps>[]
20
20
  ): React$ComponentType<{ ...TProps, ...ComponentProps, ...StyledProps }>;
@@ -25,9 +25,7 @@ export interface StyledComponent<ComponentProps: mixed> {
25
25
  }
26
26
  export type StyledComponentMap = $ObjMapi<$JSXIntrinsics, <Tag>(Tag) => StyledComponent<mixed>>;
27
27
  export type CreateStyledComponent = {
28
- <TInheritedProps: mixed>(
29
- Component: ComponentType<TInheritedProps>
30
- ): StyledComponent<TInheritedProps>,
28
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>,
31
29
  ...
32
30
  } & StyledComponentMap;
33
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/styled/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAsClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,IAAM,MAAM,GAA0B,IAAI,KAAK,CACpD,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.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,IAAM,MAAM,GAA0B,IAAI,KAAK,CACpD,EAAE,EACF;IACE,GAAG;QACD,OAAO;YACL,8CAA8C;YAC9C,yDAAyD;YACzD,MAAM,gBAAgB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF,CACK,CAAC"}
@@ -2,19 +2,19 @@ import type * as CSS from 'csstype';
2
2
  /**
3
3
  * Typing for the interpolations.
4
4
  */
5
- export declare type BasicTemplateInterpolations = string | number;
5
+ export type BasicTemplateInterpolations = string | number;
6
6
  export interface FunctionInterpolation<TProps> {
7
7
  (props: TProps): CssFunction<TProps>;
8
8
  }
9
9
  /**
10
10
  * Possible types for a CSS value
11
11
  */
12
- export declare type CssType<TProps> = CSSProps<TProps> | CssObject<TProps> | FunctionInterpolation<TProps> | string;
12
+ export type CssType<TProps> = CSSProps<TProps> | CssObject<TProps> | FunctionInterpolation<TProps> | string;
13
13
  /**
14
14
  * These are all the CSS props that will exist.
15
15
  */
16
- export declare type CSSProps<TProps> = CSS.Properties<CssFunction<TProps>>;
17
- export declare type CssObject<TProps> = {
16
+ export type CSSProps<TProps> = CSS.Properties<CssFunction<TProps>>;
17
+ export type CssObject<TProps> = {
18
18
  [key: string]: CssFunction<TProps>;
19
19
  };
20
- export declare type CssFunction<TProps = unknown> = CssType<TProps> | BasicTemplateInterpolations | boolean | undefined;
20
+ export type CssFunction<TProps = unknown> = CssType<TProps> | BasicTemplateInterpolations | boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compiled/react",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "A familiar and performant compile time CSS-in-JS library for React.",
5
5
  "keywords": [
6
6
  "compiled",
@@ -72,13 +72,13 @@
72
72
  "jsx-dev-runtime"
73
73
  ],
74
74
  "dependencies": {
75
- "csstype": "^3.1.0"
75
+ "csstype": "^3.1.1"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@compiled/benchmark": "^1.0.1",
79
79
  "@testing-library/react": "^12.1.5",
80
80
  "@types/jsdom": "^16.2.15",
81
- "@types/react-dom": "^17.0.17",
81
+ "@types/react-dom": "^17.0.18",
82
82
  "jsdom": "^19.0.0",
83
83
  "react": "^17.0.2",
84
84
  "react-dom": "^17.0.2"
@@ -25,10 +25,22 @@ describe('ax', () => {
25
25
  expect(result).toEqual('_aaaacccc');
26
26
  });
27
27
 
28
+ it('should ensure the last atomic declaration of many single groups wins', () => {
29
+ const result = ax(['_aaaabbbb', '_aaaacccc', '_aaaadddd', '_aaaaeeee']);
30
+
31
+ expect(result).toEqual('_aaaaeeee');
32
+ });
33
+
28
34
  it('should ensure the last atomic declaration of a multi group wins', () => {
29
- const result = ax(['_aaaabbbb _aaaacccc', 'foo']);
35
+ const result = ax(['_aaaabbbb _aaaacccc']);
36
+
37
+ expect(result).toEqual('_aaaacccc');
38
+ });
39
+
40
+ it('should ensure the last atomic declaration of many multi groups wins', () => {
41
+ const result = ax(['_aaaabbbb _aaaacccc _aaaadddd _aaaaeeee']);
30
42
 
31
- expect(result).toEqual('_aaaacccc foo');
43
+ expect(result).toEqual('_aaaaeeee');
32
44
  });
33
45
 
34
46
  it('should not remove any atomic declarations if there are no duplicate groups', () => {
@@ -49,4 +61,10 @@ describe('ax', () => {
49
61
 
50
62
  expect(result).toEqual('hello_there hello_world');
51
63
  });
64
+
65
+ it('should ignore non atomic declarations when atomic declarations exist', () => {
66
+ const result = ax(['hello_there', 'hello_world', '_aaaabbbb']);
67
+
68
+ expect(result).toEqual('hello_there hello_world _aaaabbbb');
69
+ });
52
70
  });
package/src/runtime/ax.ts CHANGED
@@ -28,8 +28,8 @@ const ATOMIC_GROUP_LENGTH = 5;
28
28
  * @param classes
29
29
  */
30
30
  export default function ax(classNames: (string | undefined | false)[]): string | undefined {
31
- if (classNames.length <= 1) {
32
- // short circuit if theres no custom class names.
31
+ if (classNames.length <= 1 && (!classNames[0] || classNames[0].indexOf(' ') === -1)) {
32
+ // short circuit if there's no custom class names.
33
33
  return classNames[0] || undefined;
34
34
  }
35
35
 
@@ -14,7 +14,7 @@ export type StyledProps = {
14
14
  };
15
15
  export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
16
16
  export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
17
- export interface StyledComponent<ComponentProps: mixed> {
17
+ export interface StyledComponent<ComponentProps> {
18
18
  <TProps>(
19
19
  ...css: ObjectInterpolation<TProps>[]
20
20
  ): React$ComponentType<{ ...TProps, ...ComponentProps, ...StyledProps }>;
@@ -25,9 +25,7 @@ export interface StyledComponent<ComponentProps: mixed> {
25
25
  }
26
26
  export type StyledComponentMap = $ObjMapi<$JSXIntrinsics, <Tag>(Tag) => StyledComponent<mixed>>;
27
27
  export type CreateStyledComponent = {
28
- <TInheritedProps: mixed>(
29
- Component: ComponentType<TInheritedProps>
30
- ): StyledComponent<TInheritedProps>,
28
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>,
31
29
  ...
32
30
  } & StyledComponentMap;
33
31
  /**
@@ -13,7 +13,7 @@ export interface StyledProps {
13
13
  export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[];
14
14
  export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[];
15
15
 
16
- export interface StyledComponent<ComponentProps extends unknown> {
16
+ export interface StyledComponent<ComponentProps> {
17
17
  // Allows either string or object (`` or ({}))
18
18
  // We disable the ban types rule here as we need to join the empty object default with other props
19
19
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -34,9 +34,7 @@ export type StyledComponentMap = {
34
34
 
35
35
  export interface CreateStyledComponent extends StyledComponentMap {
36
36
  // Typing to enable consumers to compose components, e.g: `styled(Component)`
37
- <TInheritedProps extends unknown>(
38
- Component: ComponentType<TInheritedProps>
39
- ): StyledComponent<TInheritedProps>;
37
+ <TInheritedProps>(Component: ComponentType<TInheritedProps>): StyledComponent<TInheritedProps>;
40
38
  }
41
39
 
42
40
  /**