styled-components 6.0.0-beta.1 → 6.0.0-beta.2
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.
- package/dist/constructors/constructWithOptions.d.ts +16 -21
- package/dist/constructors/css.d.ts +2 -2
- package/dist/constructors/styled.d.ts +179 -179
- package/dist/models/StyledComponent.d.ts +1 -1
- package/dist/models/StyledNativeComponent.d.ts +2 -2
- package/dist/native/index.d.ts +29 -29
- package/dist/styled-components-macro.cjs.js +47 -1
- package/dist/styled-components-macro.cjs.js.map +1 -1
- package/dist/styled-components-macro.esm.js +38 -1
- package/dist/styled-components-macro.esm.js.map +1 -1
- package/dist/styled-components.browser.cjs.js +1854 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1829 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1874 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1849 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +2074 -1
- package/dist/styled-components.js.map +1 -1
- package/dist/styled-components.min.js +1 -1
- package/dist/styled-components.min.js.map +1 -1
- package/dist/test/utils.d.ts +178 -178
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +32 -43
- package/dist/utils/generateDisplayName.d.ts +1 -1
- package/dist/utils/getComponentName.d.ts +1 -1
- package/dist/utils/isStyledComponent.d.ts +1 -1
- package/dist/utils/isTag.d.ts +1 -1
- package/native/dist/constructors/constructWithOptions.d.ts +16 -21
- package/native/dist/constructors/css.d.ts +2 -2
- package/native/dist/constructors/styled.d.ts +179 -179
- package/native/dist/models/StyledComponent.d.ts +1 -1
- package/native/dist/models/StyledNativeComponent.d.ts +2 -2
- package/native/dist/native/index.d.ts +29 -29
- package/native/dist/styled-components.native.cjs.js +6 -10
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +6 -10
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/utils.d.ts +178 -178
- package/native/dist/types.d.ts +32 -43
- package/native/dist/utils/generateDisplayName.d.ts +1 -1
- package/native/dist/utils/getComponentName.d.ts +1 -1
- package/native/dist/utils/isStyledComponent.d.ts +1 -1
- package/native/dist/utils/isTag.d.ts +1 -1
- package/package.json +1 -2
package/native/dist/types.d.ts
CHANGED
|
@@ -6,19 +6,18 @@ interface ExoticComponentWithDisplayName<P = unknown> extends React.ExoticCompon
|
|
|
6
6
|
defaultProps?: Partial<P>;
|
|
7
7
|
displayName?: string;
|
|
8
8
|
}
|
|
9
|
+
export declare type OmitNever<T> = {
|
|
10
|
+
[K in keyof T as T[K] extends never ? never : K]: T[K];
|
|
11
|
+
};
|
|
12
|
+
export declare type Runtime = 'web' | 'native';
|
|
9
13
|
export { DefaultTheme };
|
|
10
14
|
export declare type AnyComponent<P = any> = ExoticComponentWithDisplayName<P> | React.ComponentType<P>;
|
|
11
|
-
export interface StyledOptions<Props> {
|
|
15
|
+
export interface StyledOptions<R extends Runtime, Props> {
|
|
12
16
|
attrs?: Attrs<Props>[];
|
|
13
|
-
componentId?: string;
|
|
17
|
+
componentId?: R extends 'web' ? string : never;
|
|
14
18
|
displayName?: string;
|
|
15
|
-
parentComponentId?: string;
|
|
16
|
-
shouldForwardProp?: ShouldForwardProp
|
|
17
|
-
}
|
|
18
|
-
export interface StyledNativeOptions<Props> {
|
|
19
|
-
attrs?: Attrs<Props>[];
|
|
20
|
-
displayName?: string;
|
|
21
|
-
shouldForwardProp?: ShouldForwardProp;
|
|
19
|
+
parentComponentId?: R extends 'web' ? string : never;
|
|
20
|
+
shouldForwardProp?: ShouldForwardProp<R>;
|
|
22
21
|
}
|
|
23
22
|
export declare type KnownTarget = keyof JSX.IntrinsicElements | AnyComponent;
|
|
24
23
|
export declare type WebTarget = string | KnownTarget;
|
|
@@ -36,11 +35,11 @@ export interface ExtensibleObject extends BaseExtensibleObject {
|
|
|
36
35
|
export interface ExecutionContext extends ExtensibleObject {
|
|
37
36
|
theme: DefaultTheme;
|
|
38
37
|
}
|
|
39
|
-
export interface StyleFunction<Props =
|
|
40
|
-
(executionContext: Props): Interpolation<Props>;
|
|
38
|
+
export interface StyleFunction<Props = BaseExtensibleObject> {
|
|
39
|
+
(executionContext: ExecutionContext & Props): Interpolation<Props>;
|
|
41
40
|
}
|
|
42
|
-
export declare type Interpolation<Props> = StyleFunction<Props> | StyledObject<Props> | TemplateStringsArray | string | number | Keyframes | IStyledComponent<any, any> | Interpolation<Props>[];
|
|
43
|
-
export declare type Attrs<Props> = (ExtensibleObject & Props) | ((props: Props) => Partial<Props>);
|
|
41
|
+
export declare type Interpolation<Props> = StyleFunction<Props> | StyledObject<Props> | TemplateStringsArray | string | number | undefined | null | Keyframes | IStyledComponent<'web', any, any> | Interpolation<Props>[];
|
|
42
|
+
export declare type Attrs<Props> = (ExtensibleObject & Props) | ((props: ExecutionContext & Props) => Partial<Props>);
|
|
44
43
|
export declare type RuleSet<Props> = Interpolation<Props>[];
|
|
45
44
|
export declare type Styles<Props> = TemplateStringsArray | StyledObject<Props> | StyleFunction<Props>;
|
|
46
45
|
export declare type NameGenerator = (hash: number) => string;
|
|
@@ -60,49 +59,39 @@ export interface Stringifier {
|
|
|
60
59
|
(css: string, selector?: string, prefix?: string, componentId?: string): string[];
|
|
61
60
|
hash: string;
|
|
62
61
|
}
|
|
63
|
-
export interface ShouldForwardProp {
|
|
64
|
-
(prop: string,
|
|
62
|
+
export interface ShouldForwardProp<R extends Runtime> {
|
|
63
|
+
(prop: string, elementToBeCreated?: StyledTarget<R>): boolean;
|
|
65
64
|
}
|
|
66
|
-
export interface CommonStatics<Props> {
|
|
65
|
+
export interface CommonStatics<R extends Runtime, Props> {
|
|
67
66
|
attrs: Attrs<Props>[];
|
|
68
|
-
target: StyledTarget
|
|
69
|
-
shouldForwardProp?: ShouldForwardProp
|
|
67
|
+
target: StyledTarget<R>;
|
|
68
|
+
shouldForwardProp?: ShouldForwardProp<R>;
|
|
70
69
|
withComponent: any;
|
|
71
70
|
}
|
|
72
|
-
export interface IStyledStatics<OuterProps = unknown> extends CommonStatics<OuterProps> {
|
|
73
|
-
componentStyle: ComponentStyle;
|
|
74
|
-
foldedComponentIds: Array<string
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
export interface IStyledStatics<R extends Runtime, OuterProps = unknown> extends CommonStatics<R, OuterProps> {
|
|
72
|
+
componentStyle: R extends 'web' ? ComponentStyle : never;
|
|
73
|
+
foldedComponentIds: R extends 'web' ? Array<string> : never;
|
|
74
|
+
inlineStyle: R extends 'native' ? InstanceType<IInlineStyleConstructor<OuterProps>> : never;
|
|
75
|
+
target: StyledTarget<R>;
|
|
76
|
+
styledComponentId: R extends 'web' ? string : never;
|
|
77
|
+
warnTooManyClasses?: R extends 'web' ? ReturnType<typeof createWarnTooManyClasses> : never;
|
|
78
|
+
withComponent: <Target extends StyledTarget<R>, Props = unknown>(tag: Target) => IStyledComponent<R, Target, OuterProps & Props>;
|
|
79
79
|
}
|
|
80
|
-
declare type PolymorphicComponentProps<ActualComponent extends StyledTarget
|
|
80
|
+
declare type PolymorphicComponentProps<R extends Runtime, ActualComponent extends StyledTarget<R>, PropsToBeInjectedIntoActualComponent extends {}, ActualComponentProps = ActualComponent extends KnownTarget ? React.ComponentPropsWithRef<ActualComponent> : {}> = React.HTMLAttributes<ActualComponent> & Omit<PropsToBeInjectedIntoActualComponent, keyof ActualComponentProps | 'as' | '$as'> & ActualComponentProps & ({
|
|
81
81
|
$as: ActualComponent;
|
|
82
82
|
as?: AnyComponent;
|
|
83
83
|
} | {
|
|
84
84
|
as?: ActualComponent;
|
|
85
85
|
});
|
|
86
|
-
interface PolymorphicComponent<FallbackComponent extends StyledTarget
|
|
87
|
-
<ActualComponent extends StyledTarget = FallbackComponent>(props: PolymorphicComponentProps<ActualComponent, ExpectedProps & PropsToBeInjectedIntoActualComponent>): React.ReactElement<PolymorphicComponentProps<ActualComponent, ExecutionContext & ExpectedProps & PropsToBeInjectedIntoActualComponent>, ActualComponent>;
|
|
86
|
+
interface PolymorphicComponent<R extends Runtime, FallbackComponent extends StyledTarget<R>, ExpectedProps = unknown, PropsToBeInjectedIntoActualComponent = unknown> extends React.ForwardRefExoticComponent<ExpectedProps> {
|
|
87
|
+
<ActualComponent extends StyledTarget<R> = FallbackComponent>(props: PolymorphicComponentProps<R, ActualComponent, ExpectedProps & PropsToBeInjectedIntoActualComponent>): React.ReactElement<PolymorphicComponentProps<R, ActualComponent, ExecutionContext & ExpectedProps & PropsToBeInjectedIntoActualComponent>, ActualComponent>;
|
|
88
88
|
}
|
|
89
|
-
export interface IStyledComponent<
|
|
89
|
+
export interface IStyledComponent<R extends Runtime, Target extends StyledTarget<R>, Props = unknown> extends PolymorphicComponent<R, Target, Props, ExecutionContext>, IStyledStatics<R, Props> {
|
|
90
90
|
defaultProps?: Partial<ExtensibleObject & (Target extends KnownTarget ? React.ComponentProps<Target> : {}) & Props>;
|
|
91
91
|
toString: () => string;
|
|
92
92
|
}
|
|
93
|
-
export interface IStyledComponentFactory<
|
|
94
|
-
(target: Target, options: StyledOptions<Props>, rules: RuleSet<Props>): IStyledComponent<Target, Props> & Statics;
|
|
95
|
-
}
|
|
96
|
-
export interface IStyledNativeStatics<OuterProps = unknown> extends CommonStatics<OuterProps> {
|
|
97
|
-
inlineStyle: InstanceType<IInlineStyleConstructor<OuterProps>>;
|
|
98
|
-
target: NativeTarget;
|
|
99
|
-
withComponent: <Target extends NativeTarget, Props = unknown>(tag: Target) => IStyledNativeComponent<Target, OuterProps & Props>;
|
|
100
|
-
}
|
|
101
|
-
export interface IStyledNativeComponent<Target extends NativeTarget, Props = unknown> extends PolymorphicComponent<Target, Props, ExecutionContext>, IStyledNativeStatics<Props> {
|
|
102
|
-
defaultProps?: Partial<ExtensibleObject & (Target extends KnownTarget ? React.ComponentProps<Target> : {}) & Props>;
|
|
103
|
-
}
|
|
104
|
-
export interface IStyledNativeComponentFactory<Target extends NativeTarget, Props = unknown, Statics = unknown> {
|
|
105
|
-
(target: Target, options: StyledNativeOptions<Props>, rules: RuleSet<Props>): IStyledNativeComponent<Target, Props> & Statics;
|
|
93
|
+
export interface IStyledComponentFactory<R extends Runtime, Target extends StyledTarget<R>, Props = unknown, Statics = unknown> {
|
|
94
|
+
(target: Target, options: StyledOptions<R, Props>, rules: RuleSet<Props>): IStyledComponent<R, Target, Props> & Statics;
|
|
106
95
|
}
|
|
107
96
|
export interface IInlineStyleConstructor<Props = unknown> {
|
|
108
97
|
new (rules: RuleSet<Props>): IInlineStyle<Props>;
|
|
@@ -111,7 +100,7 @@ export interface IInlineStyle<Props = unknown> {
|
|
|
111
100
|
rules: RuleSet<Props>;
|
|
112
101
|
generateStyleObject(executionContext: Object): Object;
|
|
113
102
|
}
|
|
114
|
-
export declare type StyledTarget = WebTarget
|
|
103
|
+
export declare type StyledTarget<R extends Runtime> = R extends 'web' ? WebTarget : NativeTarget;
|
|
115
104
|
export interface StyledObject<Props = ExecutionContext> {
|
|
116
105
|
[key: string]: BaseExtensibleObject | string | number | StyleFunction<Props>;
|
|
117
106
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { StyledTarget } from '../types';
|
|
2
|
-
export default function generateDisplayName(target: StyledTarget): string;
|
|
2
|
+
export default function generateDisplayName(target: StyledTarget<any>): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { StyledTarget } from '../types';
|
|
2
|
-
export default function getComponentName(target: StyledTarget): string;
|
|
2
|
+
export default function getComponentName(target: StyledTarget<any>): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IStyledComponent } from '../types';
|
|
2
|
-
export default function isStyledComponent(target: any): target is IStyledComponent<any>;
|
|
2
|
+
export default function isStyledComponent(target: any): target is IStyledComponent<'web', any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { StyledTarget } from '../types';
|
|
2
|
-
export default function isTag(target: StyledTarget):
|
|
2
|
+
export default function isTag(target: StyledTarget<'web'>): target is string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "styled-components",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.2",
|
|
4
4
|
"description": "Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/styled-components.cjs.js",
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"@babel/preset-react": "^7.18.6",
|
|
70
70
|
"@babel/preset-typescript": "^7.18.6",
|
|
71
71
|
"@babel/traverse": "^7.18.8",
|
|
72
|
-
"@emotion/is-prop-valid": "^1.1.3",
|
|
73
72
|
"@emotion/unitless": "^0.7.4",
|
|
74
73
|
"css-to-react-native": "^3.0.0",
|
|
75
74
|
"shallowequal": "^1.1.0",
|