styled-components 6.0.0-rc.6 → 6.0.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 (34) hide show
  1. package/dist/constructors/constructWithOptions.d.ts +1 -1
  2. package/dist/constructors/styled.d.ts +175 -522
  3. package/dist/hoc/withTheme.d.ts +1 -1
  4. package/dist/models/ComponentStyle.d.ts +2 -2
  5. package/dist/models/GlobalStyle.d.ts +2 -2
  6. package/dist/styled-components.browser.cjs.js +1 -1
  7. package/dist/styled-components.browser.cjs.js.map +1 -1
  8. package/dist/styled-components.browser.esm.js +1 -1
  9. package/dist/styled-components.browser.esm.js.map +1 -1
  10. package/dist/styled-components.cjs.js +1 -1
  11. package/dist/styled-components.cjs.js.map +1 -1
  12. package/dist/styled-components.esm.js +1 -1
  13. package/dist/styled-components.esm.js.map +1 -1
  14. package/dist/styled-components.js +12 -10
  15. package/dist/styled-components.js.map +1 -1
  16. package/dist/styled-components.min.js +1 -1
  17. package/dist/styled-components.min.js.map +1 -1
  18. package/dist/test/utils.d.ts +175 -522
  19. package/dist/types.d.ts +5 -6
  20. package/dist/utils/flatten.d.ts +1 -1
  21. package/native/dist/constructors/constructWithOptions.d.ts +1 -1
  22. package/native/dist/constructors/styled.d.ts +175 -522
  23. package/native/dist/hoc/withTheme.d.ts +1 -1
  24. package/native/dist/models/ComponentStyle.d.ts +2 -2
  25. package/native/dist/models/GlobalStyle.d.ts +2 -2
  26. package/native/dist/styled-components.native.cjs.js +1 -1
  27. package/native/dist/styled-components.native.cjs.js.map +1 -1
  28. package/native/dist/styled-components.native.esm.js +1 -1
  29. package/native/dist/styled-components.native.esm.js.map +1 -1
  30. package/native/dist/test/utils.d.ts +175 -522
  31. package/native/dist/types.d.ts +5 -6
  32. package/native/dist/utils/flatten.d.ts +1 -1
  33. package/package.json +4 -4
  34. package/dist/test/types.d.ts +0 -9
package/dist/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Properties } from 'csstype';
1
+ import type * as CSS from 'csstype';
2
2
  import React from 'react';
3
3
  import ComponentStyle from './models/ComponentStyle';
4
4
  import { DefaultTheme } from './models/ThemeProvider';
5
5
  import createWarnTooManyClasses from './utils/createWarnTooManyClasses';
6
- export { DefaultTheme };
6
+ export { CSS, DefaultTheme };
7
7
  interface ExoticComponentWithDisplayName<P = any> extends React.ExoticComponent<P> {
8
8
  defaultProps?: Partial<P>;
9
9
  displayName?: string;
@@ -60,7 +60,7 @@ export interface ExecutionContext extends ExecutionProps {
60
60
  theme: DefaultTheme;
61
61
  }
62
62
  export interface StyleFunction<Props extends object> {
63
- (executionContext: ExecutionContext & Props): Interpolation<Props>;
63
+ (executionContext: ExecutionContext & Props): Interpolation<object>;
64
64
  }
65
65
  export type Interpolation<Props extends object> = StyleFunction<Props> | StyledObject<Props> | TemplateStringsArray | string | number | false | undefined | null | Keyframes | StyledComponentBrand | RuleSet<object> | Interpolation<Props>[];
66
66
  export type Attrs<Props extends object = BaseObject> = (ExecutionProps & Partial<Props>) | ((props: ExecutionContext & Props) => ExecutionProps & Partial<Props>);
@@ -78,7 +78,6 @@ export interface Keyframes {
78
78
  export interface Flattener<Props extends object> {
79
79
  (chunks: Interpolation<Props>[], executionContext: object | null | undefined, styleSheet: StyleSheet | null | undefined): Interpolation<Props>[];
80
80
  }
81
- export type FlattenerResult<Props extends object> = RuleSet<Props> | number | string | string[] | StyledComponentBrand | Keyframes;
82
81
  export interface Stringifier {
83
82
  (css: string, selector?: string, prefix?: string, componentId?: string): string[];
84
83
  hash: string;
@@ -128,9 +127,9 @@ export interface IInlineStyleConstructor<Props extends object> {
128
127
  }
129
128
  export interface IInlineStyle<Props extends object> {
130
129
  rules: RuleSet<Props>;
131
- generateStyleObject(executionContext: Object): Object;
130
+ generateStyleObject(executionContext: ExecutionContext & Props): object;
132
131
  }
133
- export type StyledObject<Props extends object> = Properties & Props & {
132
+ export type StyledObject<Props extends object> = Substitute<Props, CSS.Properties> & {
134
133
  [key: string]: string | number | StyleFunction<Props> | StyledObject<Props> | RuleSet<any> | undefined;
135
134
  };
136
135
  /**
@@ -1,4 +1,4 @@
1
1
  import StyleSheet from '../sheet';
2
2
  import { Dict, ExecutionContext, Interpolation, RuleSet, Stringifier } from '../types';
3
3
  export declare const objToCssArray: (obj: Dict<any>) => string[];
4
- export default function flatten<Props extends object>(chunk: Interpolation<Props>, executionContext?: ExecutionContext & Props, styleSheet?: StyleSheet, stylisInstance?: Stringifier): RuleSet<Props>;
4
+ export default function flatten<Props extends object>(chunk: Interpolation<object>, executionContext?: ExecutionContext & Props, styleSheet?: StyleSheet, stylisInstance?: Stringifier): RuleSet<Props>;
@@ -9,7 +9,7 @@ type AttrsResult<T extends Attrs<any>> = T extends (...args: any) => infer P ? P
9
9
  type AttrsTarget<R extends Runtime, T extends Attrs<any>, FallbackTarget extends StyledTarget<R>, Result extends ExecutionProps = AttrsResult<T>> = Result extends {
10
10
  as: infer RuntimeTarget;
11
11
  } ? RuntimeTarget extends KnownTarget ? RuntimeTarget : FallbackTarget : FallbackTarget;
12
- export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.ComponentPropsWithRef<Target> : BaseObject, OuterStatics extends object = BaseObject> {
12
+ export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object, OuterStatics extends object = BaseObject> {
13
13
  <Props extends object = BaseObject, Statics extends object = BaseObject>(initialStyles: Styles<Substitute<OuterProps, NoInfer<Props>>>, ...interpolations: Interpolation<Substitute<OuterProps, NoInfer<Props>>>[]): IStyledComponent<R, Substitute<OuterProps, Props>> & OuterStatics & Statics;
14
14
  attrs: <Props extends object = BaseObject, PrivateMergedProps extends object = Substitute<OuterProps, Props>, PrivateAttrsArg extends Attrs<PrivateMergedProps> = Attrs<PrivateMergedProps>, PrivateResolvedTarget extends StyledTarget<R> = AttrsTarget<R, PrivateAttrsArg, Target>>(attrs: PrivateAttrsArg) => Styled<R, PrivateResolvedTarget, PrivateResolvedTarget extends KnownTarget ? Substitute<Substitute<OuterProps, React.ComponentPropsWithRef<PrivateResolvedTarget>>, Props> : PrivateMergedProps, OuterStatics>;
15
15
  withConfig: (config: StyledOptions<R, OuterProps>) => Styled<R, Target, OuterProps, OuterStatics>;