styled-components 6.0.0-rc.3 → 6.0.0-rc.5
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 -42
- package/dist/constructors/css.d.ts +2 -2
- package/dist/constructors/keyframes.d.ts +1 -1
- package/dist/constructors/styled.d.ts +524 -6
- package/dist/hoc/withTheme.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/models/Keyframes.d.ts +0 -1
- package/dist/models/ServerStyleSheet.d.ts +2 -1
- package/dist/models/StyledComponent.d.ts +2 -2
- package/dist/models/StyledNativeComponent.d.ts +2 -2
- package/dist/models/ThemeProvider.d.ts +8 -1
- package/dist/native/index.d.ts +28 -29
- package/dist/sheet/Sheet.d.ts +0 -2
- package/dist/styled-components.browser.cjs.js +1 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +93 -38
- 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 +523 -179
- package/dist/types.d.ts +48 -54
- package/dist/utils/errors.d.ts +1 -0
- package/dist/utils/isStyledComponent.d.ts +2 -2
- package/dist/utils/joinStrings.d.ts +1 -1
- package/dist/utils/setToString.d.ts +17 -0
- package/native/dist/constructors/constructWithOptions.d.ts +16 -42
- package/native/dist/constructors/css.d.ts +2 -2
- package/native/dist/constructors/keyframes.d.ts +1 -1
- package/native/dist/constructors/styled.d.ts +524 -6
- package/native/dist/hoc/withTheme.d.ts +1 -1
- package/native/dist/index.d.ts +1 -1
- package/native/dist/models/Keyframes.d.ts +0 -1
- package/native/dist/models/ServerStyleSheet.d.ts +2 -1
- package/native/dist/models/StyledComponent.d.ts +2 -2
- package/native/dist/models/StyledNativeComponent.d.ts +2 -2
- package/native/dist/models/ThemeProvider.d.ts +8 -1
- package/native/dist/native/index.d.ts +28 -29
- package/native/dist/sheet/Sheet.d.ts +0 -2
- package/native/dist/styled-components.native.cjs.js +1 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +1 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/utils.d.ts +523 -179
- package/native/dist/types.d.ts +48 -54
- package/native/dist/utils/errors.d.ts +1 -0
- package/native/dist/utils/isStyledComponent.d.ts +2 -2
- package/native/dist/utils/joinStrings.d.ts +1 -1
- package/native/dist/utils/setToString.d.ts +17 -0
- package/package.json +8 -3
- package/test-utils/index.ts +3 -6
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,44 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { Interpolation, IStyledComponent, IStyledComponentFactory, NoInfer, Runtime,
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<MoreOtherProps extends object = {}, MoreStatics extends object = {}>(initialStyles: Styles<ThemedProps<StyledComponentPropsWithRef<R, Target> & OtherProps & NoInfer<MoreOtherProps>>>, ...interpolations: Interpolation<ThemedProps<StyledComponentPropsWithRef<R, Target> & OtherProps & NoInfer<MoreOtherProps>>>[]): IStyledComponent<R, Target, OtherProps & NoInfer<MoreOtherProps>, AttrProps> & OtherStatics & MoreStatics;
|
|
17
|
-
attrs<AsC extends StyledTarget<R> = Target, NewA extends AttrPropValues<R, Target, OtherProps> & {
|
|
18
|
-
as?: AsC;
|
|
19
|
-
} = AttrPropValues<R, Target, OtherProps> & {
|
|
20
|
-
as?: AsC;
|
|
21
|
-
}>(attrs: NewA & AttrValueType<NewA> & {
|
|
22
|
-
as?: AsC;
|
|
23
|
-
}): Styled<R, AsC, OtherProps & Omit<NewA, 'as'>, AttrProps | keyof NewA>;
|
|
24
|
-
attrs<NewProps extends object = never, AsC extends StyledTarget<R> = Target, NewA extends AttrPropValues<R, Target, OtherProps & NewProps> & {
|
|
25
|
-
as?: AsC;
|
|
26
|
-
} = AttrPropValues<R, Target, OtherProps & NewProps> & {
|
|
27
|
-
as?: AsC;
|
|
28
|
-
}>(attrs: NewA & AttrValueType<NewA> & {
|
|
29
|
-
as?: AsC;
|
|
30
|
-
}): Styled<R, AsC, OtherProps & Omit<NewProps, 'as'>, AttrProps | keyof NewA>;
|
|
31
|
-
attrs<AsC extends StyledTarget<R>, Factory extends (props: AttrFactoryProps<R, Target, OtherProps>) => AttrPropValues<R, Target, OtherProps & {
|
|
32
|
-
as?: AsC;
|
|
33
|
-
}>>(attrFactory: Factory & StrictAttrFactory<Factory, R, Target, OtherProps & {
|
|
34
|
-
as?: AsC;
|
|
35
|
-
}>): Styled<R, FactoryAsC<R, Target, Factory>, OtherProps & Omit<ReturnType<Factory>, 'as' | keyof StyledComponentPropsWithRef<R, Target>>, AttrProps | keyof ReturnType<Factory>>;
|
|
36
|
-
attrs<NewProps extends object = {}, AsC extends StyledTarget<R> = Target, Factory extends (props: AttrFactoryProps<R, Target, OtherProps & NoInfer<NewProps>>) => AttrPropValues<R, Target, OtherProps & NoInfer<NewProps> & {
|
|
37
|
-
as?: AsC;
|
|
38
|
-
}> = (props: AttrFactoryProps<R, Target, OtherProps & NoInfer<NewProps>>) => AttrPropValues<R, Target, OtherProps & NoInfer<NewProps> & {
|
|
39
|
-
as?: AsC;
|
|
40
|
-
}>>(attrFactory: Factory & StrictAttrFactory<Factory, R, Target, OtherProps & NoInfer<NewProps>>): Styled<R, FactoryAsC<R, Target, Factory>, OtherProps & Omit<NewProps, 'as'>, AttrProps | keyof ReturnType<Factory>>;
|
|
41
|
-
withConfig: <Props extends OtherProps = OtherProps>(config: StyledOptions<R, StyledComponentPropsWithRef<R, Target> & Props>) => Styled<R, Target, Props, AttrProps>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Attrs, BaseObject, ExecutionProps, Interpolation, IStyledComponent, IStyledComponentFactory, KnownTarget, NoInfer, Runtime, StyledOptions, StyledTarget, Styles, Substitute } from '../types';
|
|
3
|
+
type AttrsResult<T extends Attrs<any>> = T extends (...args: any) => infer P ? P extends object ? P : never : T extends object ? T : never;
|
|
4
|
+
/**
|
|
5
|
+
* Based on Attrs being a simple object or function that returns
|
|
6
|
+
* a prop object, inspect the attrs result and attempt to extract
|
|
7
|
+
* any "as" prop usage to modify the runtime target.
|
|
8
|
+
*/
|
|
9
|
+
type AttrsTarget<R extends Runtime, T extends Attrs<any>, FallbackTarget extends StyledTarget<R>, Result extends ExecutionProps = AttrsResult<T>> = Result extends {
|
|
10
|
+
as: infer RuntimeTarget;
|
|
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> {
|
|
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
|
+
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
|
+
withConfig: (config: StyledOptions<R, OuterProps>) => Styled<R, Target, OuterProps, OuterStatics>;
|
|
42
16
|
}
|
|
43
|
-
export default function constructWithOptions<R extends Runtime, Target extends StyledTarget<R>,
|
|
17
|
+
export default function constructWithOptions<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.ComponentPropsWithRef<Target> : BaseObject, OuterStatics extends object = BaseObject>(componentConstructor: IStyledComponentFactory<R, StyledTarget<R>, object, any>, tag: StyledTarget<R>, options?: StyledOptions<R, OuterProps>): Styled<R, Target, OuterProps, OuterStatics>;
|
|
44
18
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Interpolation, RuleSet, Styles } from '../types';
|
|
1
|
+
import { Interpolation, NoInfer, RuleSet, Styles } from '../types';
|
|
2
2
|
declare function css(styles: Styles<object>, ...interpolations: Interpolation<object>[]): RuleSet<object>;
|
|
3
|
-
declare function css<Props extends object>(styles: Styles<Props
|
|
3
|
+
declare function css<Props extends object>(styles: Styles<NoInfer<Props>>, ...interpolations: Interpolation<NoInfer<Props>>[]): RuleSet<NoInfer<Props>>;
|
|
4
4
|
export default css;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import Keyframes from '../models/Keyframes';
|
|
2
2
|
import { Interpolation, Styles } from '../types';
|
|
3
|
-
export default function keyframes<Props extends object =
|
|
3
|
+
export default function keyframes<Props extends object = {}>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): Keyframes;
|