styled-components 5.3.6 → 5.3.8
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/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 +1 -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/native/dist/base.d.ts +3 -3
- package/native/dist/constructors/constructWithOptions.d.ts +24 -14
- package/native/dist/constructors/createGlobalStyle.d.ts +2 -2
- package/native/dist/constructors/css.d.ts +4 -4
- package/native/dist/constructors/keyframes.d.ts +1 -1
- package/native/dist/constructors/styled.d.ts +176 -180
- package/native/dist/hoc/withTheme.d.ts +2 -2
- package/native/dist/index.d.ts +2 -2
- package/native/dist/models/GlobalStyle.d.ts +1 -1
- package/native/dist/models/InlineStyle.d.ts +1 -1
- package/native/dist/models/StyleSheetManager.d.ts +58 -14
- package/native/dist/models/StyledComponent.d.ts +1 -1
- package/native/dist/models/StyledNativeComponent.d.ts +2 -2
- package/native/dist/models/ThemeProvider.d.ts +4 -4
- package/native/dist/native/index.d.ts +27 -31
- package/native/dist/sheet/Sheet.d.ts +3 -3
- package/native/dist/sheet/types.d.ts +1 -1
- package/native/dist/styled-components.native.cjs.js +4 -4
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +4 -4
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/types.d.ts +1 -0
- package/native/dist/test/utils.d.ts +176 -180
- package/native/dist/types.d.ts +70 -52
- package/native/dist/utils/determineTheme.d.ts +2 -2
- package/native/dist/utils/domElements.d.ts +1 -1
- package/native/dist/utils/empties.d.ts +2 -2
- package/native/dist/utils/flatten.d.ts +3 -3
- package/native/dist/utils/hoist.d.ts +3 -3
- package/native/dist/utils/interleave.d.ts +1 -1
- package/native/dist/utils/isStaticRules.d.ts +1 -1
- package/native/dist/utils/joinStrings.d.ts +1 -1
- package/native/dist/utils/mixinDeep.d.ts +1 -2
- package/native/dist/utils/stylis.d.ts +3 -3
- package/package.json +2 -4
- package/primitives/dist/styled-components-primitives.cjs.js +4 -4
- package/primitives/dist/styled-components-primitives.cjs.js.map +1 -1
- package/primitives/dist/styled-components-primitives.esm.js +4 -4
- package/primitives/dist/styled-components-primitives.esm.js.map +1 -1
- package/native/dist/base.d.ts.map +0 -1
- package/native/dist/constants.d.ts.map +0 -1
- package/native/dist/constructors/constructWithOptions.d.ts.map +0 -1
- package/native/dist/constructors/createGlobalStyle.d.ts.map +0 -1
- package/native/dist/constructors/css.d.ts.map +0 -1
- package/native/dist/constructors/keyframes.d.ts.map +0 -1
- package/native/dist/constructors/styled.d.ts.map +0 -1
- package/native/dist/dist/base.d.ts +0 -18
- package/native/dist/dist/base.d.ts.map +0 -1
- package/native/dist/dist/constants.d.ts +0 -9
- package/native/dist/dist/constants.d.ts.map +0 -1
- package/native/dist/dist/constructors/constructWithOptions.d.ts +0 -20
- package/native/dist/dist/constructors/constructWithOptions.d.ts.map +0 -1
- package/native/dist/dist/constructors/createGlobalStyle.d.ts +0 -4
- package/native/dist/dist/constructors/createGlobalStyle.d.ts.map +0 -1
- package/native/dist/dist/constructors/css.d.ts +0 -5
- package/native/dist/dist/constructors/css.d.ts.map +0 -1
- package/native/dist/dist/constructors/keyframes.d.ts +0 -4
- package/native/dist/dist/constructors/keyframes.d.ts.map +0 -1
- package/native/dist/dist/constructors/styled.d.ts +0 -186
- package/native/dist/dist/constructors/styled.d.ts.map +0 -1
- package/native/dist/dist/hoc/withTheme.d.ts +0 -4
- package/native/dist/dist/hoc/withTheme.d.ts.map +0 -1
- package/native/dist/dist/hoc/withTheme.spec.d.ts +0 -2
- package/native/dist/dist/hoc/withTheme.spec.d.ts.map +0 -1
- package/native/dist/dist/hooks/useTheme.d.ts +0 -4
- package/native/dist/dist/hooks/useTheme.d.ts.map +0 -1
- package/native/dist/dist/index-standalone.d.ts +0 -3
- package/native/dist/dist/index-standalone.d.ts.map +0 -1
- package/native/dist/dist/index.d.ts +0 -4
- package/native/dist/dist/index.d.ts.map +0 -1
- package/native/dist/dist/macro/index.d.ts +0 -3
- package/native/dist/dist/macro/index.d.ts.map +0 -1
- package/native/dist/dist/macro/test/babel.config.d.ts +0 -1
- package/native/dist/dist/macro/test/babel.config.d.ts.map +0 -1
- package/native/dist/dist/models/ComponentStyle.d.ts +0 -16
- package/native/dist/dist/models/ComponentStyle.d.ts.map +0 -1
- package/native/dist/dist/models/GlobalStyle.d.ts +0 -12
- package/native/dist/dist/models/GlobalStyle.d.ts.map +0 -1
- package/native/dist/dist/models/InlineStyle.d.ts +0 -7
- package/native/dist/dist/models/InlineStyle.d.ts.map +0 -1
- package/native/dist/dist/models/Keyframes.d.ts +0 -12
- package/native/dist/dist/models/Keyframes.d.ts.map +0 -1
- package/native/dist/dist/models/ServerStyleSheet.d.ts +0 -16
- package/native/dist/dist/models/ServerStyleSheet.d.ts.map +0 -1
- package/native/dist/dist/models/StyleSheetManager.d.ts +0 -22
- package/native/dist/dist/models/StyleSheetManager.d.ts.map +0 -1
- package/native/dist/dist/models/StyledComponent.d.ts +0 -4
- package/native/dist/dist/models/StyledComponent.d.ts.map +0 -1
- package/native/dist/dist/models/StyledNativeComponent.d.ts +0 -4
- package/native/dist/dist/models/StyledNativeComponent.d.ts.map +0 -1
- package/native/dist/dist/models/ThemeProvider.d.ts +0 -18
- package/native/dist/dist/models/ThemeProvider.d.ts.map +0 -1
- package/native/dist/dist/native/index.d.ts +0 -65
- package/native/dist/dist/native/index.d.ts.map +0 -1
- package/native/dist/dist/primitives/index.d.ts +0 -23
- package/native/dist/dist/primitives/index.d.ts.map +0 -1
- package/native/dist/dist/secretInternals.d.ts +0 -6
- package/native/dist/dist/secretInternals.d.ts.map +0 -1
- package/native/dist/dist/sheet/GroupIDAllocator.d.ts +0 -5
- package/native/dist/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
- package/native/dist/dist/sheet/GroupedTag.d.ts +0 -12
- package/native/dist/dist/sheet/GroupedTag.d.ts.map +0 -1
- package/native/dist/dist/sheet/Rehydration.d.ts +0 -4
- package/native/dist/dist/sheet/Rehydration.d.ts.map +0 -1
- package/native/dist/dist/sheet/Sheet.d.ts +0 -41
- package/native/dist/dist/sheet/Sheet.d.ts.map +0 -1
- package/native/dist/dist/sheet/Tag.d.ts +0 -55
- package/native/dist/dist/sheet/Tag.d.ts.map +0 -1
- package/native/dist/dist/sheet/dom.d.ts +0 -5
- package/native/dist/dist/sheet/dom.d.ts.map +0 -1
- package/native/dist/dist/sheet/index.d.ts +0 -2
- package/native/dist/dist/sheet/index.d.ts.map +0 -1
- package/native/dist/dist/sheet/types.d.ts +0 -35
- package/native/dist/dist/sheet/types.d.ts.map +0 -1
- package/native/dist/dist/test/globals.d.ts +0 -3
- package/native/dist/dist/test/globals.d.ts.map +0 -1
- package/native/dist/dist/test/utils.d.ts +0 -192
- package/native/dist/dist/test/utils.d.ts.map +0 -1
- package/native/dist/dist/types.d.ts +0 -121
- package/native/dist/dist/types.d.ts.map +0 -1
- package/native/dist/dist/utils/addUnitIfNeeded.d.ts +0 -2
- package/native/dist/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
- package/native/dist/dist/utils/checkDynamicCreation.d.ts +0 -2
- package/native/dist/dist/utils/checkDynamicCreation.d.ts.map +0 -1
- package/native/dist/dist/utils/createWarnTooManyClasses.d.ts +0 -4
- package/native/dist/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
- package/native/dist/dist/utils/determineTheme.d.ts +0 -3
- package/native/dist/dist/utils/determineTheme.d.ts.map +0 -1
- package/native/dist/dist/utils/domElements.d.ts +0 -3
- package/native/dist/dist/utils/domElements.d.ts.map +0 -1
- package/native/dist/dist/utils/empties.d.ts +0 -4
- package/native/dist/dist/utils/empties.d.ts.map +0 -1
- package/native/dist/dist/utils/error.d.ts +0 -6
- package/native/dist/dist/utils/error.d.ts.map +0 -1
- package/native/dist/dist/utils/errors.d.ts +0 -21
- package/native/dist/dist/utils/errors.d.ts.map +0 -1
- package/native/dist/dist/utils/escape.d.ts +0 -6
- package/native/dist/dist/utils/escape.d.ts.map +0 -1
- package/native/dist/dist/utils/flatten.d.ts +0 -5
- package/native/dist/dist/utils/flatten.d.ts.map +0 -1
- package/native/dist/dist/utils/generateAlphabeticName.d.ts +0 -2
- package/native/dist/dist/utils/generateAlphabeticName.d.ts.map +0 -1
- package/native/dist/dist/utils/generateComponentId.d.ts +0 -2
- package/native/dist/dist/utils/generateComponentId.d.ts.map +0 -1
- package/native/dist/dist/utils/generateDisplayName.d.ts +0 -3
- package/native/dist/dist/utils/generateDisplayName.d.ts.map +0 -1
- package/native/dist/dist/utils/getComponentName.d.ts +0 -3
- package/native/dist/dist/utils/getComponentName.d.ts.map +0 -1
- package/native/dist/dist/utils/hash.d.ts +0 -4
- package/native/dist/dist/utils/hash.d.ts.map +0 -1
- package/native/dist/dist/utils/hoist.d.ts +0 -52
- package/native/dist/dist/utils/hoist.d.ts.map +0 -1
- package/native/dist/dist/utils/hyphenateStyleName.d.ts +0 -15
- package/native/dist/dist/utils/hyphenateStyleName.d.ts.map +0 -1
- package/native/dist/dist/utils/interleave.d.ts +0 -3
- package/native/dist/dist/utils/interleave.d.ts.map +0 -1
- package/native/dist/dist/utils/isFunction.d.ts +0 -2
- package/native/dist/dist/utils/isFunction.d.ts.map +0 -1
- package/native/dist/dist/utils/isPlainObject.d.ts +0 -2
- package/native/dist/dist/utils/isPlainObject.d.ts.map +0 -1
- package/native/dist/dist/utils/isStatelessFunction.d.ts +0 -2
- package/native/dist/dist/utils/isStatelessFunction.d.ts.map +0 -1
- package/native/dist/dist/utils/isStaticRules.d.ts +0 -3
- package/native/dist/dist/utils/isStaticRules.d.ts.map +0 -1
- package/native/dist/dist/utils/isStyledComponent.d.ts +0 -3
- package/native/dist/dist/utils/isStyledComponent.d.ts.map +0 -1
- package/native/dist/dist/utils/isTag.d.ts +0 -3
- package/native/dist/dist/utils/isTag.d.ts.map +0 -1
- package/native/dist/dist/utils/joinStrings.d.ts +0 -5
- package/native/dist/dist/utils/joinStrings.d.ts.map +0 -1
- package/native/dist/dist/utils/mixinDeep.d.ts +0 -8
- package/native/dist/dist/utils/mixinDeep.d.ts.map +0 -1
- package/native/dist/dist/utils/nonce.d.ts +0 -2
- package/native/dist/dist/utils/nonce.d.ts.map +0 -1
- package/native/dist/dist/utils/stylis.d.ts +0 -10
- package/native/dist/dist/utils/stylis.d.ts.map +0 -1
- package/native/dist/hoc/withTheme.d.ts.map +0 -1
- package/native/dist/hoc/withTheme.spec.d.ts.map +0 -1
- package/native/dist/hooks/useTheme.d.ts.map +0 -1
- package/native/dist/index-standalone.d.ts.map +0 -1
- package/native/dist/index.d.ts.map +0 -1
- package/native/dist/macro/index.d.ts.map +0 -1
- package/native/dist/macro/test/babel.config.d.ts +0 -1
- package/native/dist/macro/test/babel.config.d.ts.map +0 -1
- package/native/dist/models/ComponentStyle.d.ts.map +0 -1
- package/native/dist/models/GlobalStyle.d.ts.map +0 -1
- package/native/dist/models/InlineStyle.d.ts.map +0 -1
- package/native/dist/models/Keyframes.d.ts.map +0 -1
- package/native/dist/models/ServerStyleSheet.d.ts.map +0 -1
- package/native/dist/models/StyleSheetManager.d.ts.map +0 -1
- package/native/dist/models/StyledComponent.d.ts.map +0 -1
- package/native/dist/models/StyledNativeComponent.d.ts.map +0 -1
- package/native/dist/models/ThemeProvider.d.ts.map +0 -1
- package/native/dist/native/index.d.ts.map +0 -1
- package/native/dist/primitives/index.d.ts +0 -23
- package/native/dist/primitives/index.d.ts.map +0 -1
- package/native/dist/secretInternals.d.ts.map +0 -1
- package/native/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
- package/native/dist/sheet/GroupedTag.d.ts.map +0 -1
- package/native/dist/sheet/Rehydration.d.ts.map +0 -1
- package/native/dist/sheet/Sheet.d.ts.map +0 -1
- package/native/dist/sheet/Tag.d.ts.map +0 -1
- package/native/dist/sheet/dom.d.ts.map +0 -1
- package/native/dist/sheet/index.d.ts.map +0 -1
- package/native/dist/sheet/types.d.ts.map +0 -1
- package/native/dist/test/globals.d.ts.map +0 -1
- package/native/dist/test/utils.d.ts.map +0 -1
- package/native/dist/types.d.ts.map +0 -1
- package/native/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
- package/native/dist/utils/checkDynamicCreation.d.ts.map +0 -1
- package/native/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
- package/native/dist/utils/determineTheme.d.ts.map +0 -1
- package/native/dist/utils/domElements.d.ts.map +0 -1
- package/native/dist/utils/empties.d.ts.map +0 -1
- package/native/dist/utils/error.d.ts.map +0 -1
- package/native/dist/utils/errors.d.ts.map +0 -1
- package/native/dist/utils/escape.d.ts.map +0 -1
- package/native/dist/utils/flatten.d.ts.map +0 -1
- package/native/dist/utils/generateAlphabeticName.d.ts.map +0 -1
- package/native/dist/utils/generateComponentId.d.ts.map +0 -1
- package/native/dist/utils/generateDisplayName.d.ts.map +0 -1
- package/native/dist/utils/getComponentName.d.ts.map +0 -1
- package/native/dist/utils/hash.d.ts.map +0 -1
- package/native/dist/utils/hoist.d.ts.map +0 -1
- package/native/dist/utils/hyphenateStyleName.d.ts.map +0 -1
- package/native/dist/utils/interleave.d.ts.map +0 -1
- package/native/dist/utils/isFunction.d.ts.map +0 -1
- package/native/dist/utils/isPlainObject.d.ts.map +0 -1
- package/native/dist/utils/isStatelessFunction.d.ts.map +0 -1
- package/native/dist/utils/isStaticRules.d.ts.map +0 -1
- package/native/dist/utils/isStyledComponent.d.ts.map +0 -1
- package/native/dist/utils/isTag.d.ts.map +0 -1
- package/native/dist/utils/joinStrings.d.ts.map +0 -1
- package/native/dist/utils/mixinDeep.d.ts.map +0 -1
- package/native/dist/utils/nonce.d.ts.map +0 -1
- package/native/dist/utils/stylis.d.ts.map +0 -1
- package/postinstall.js +0 -82
package/native/dist/types.d.ts
CHANGED
|
@@ -2,47 +2,60 @@ import React from 'react';
|
|
|
2
2
|
import ComponentStyle from './models/ComponentStyle';
|
|
3
3
|
import { DefaultTheme } from './models/ThemeProvider';
|
|
4
4
|
import createWarnTooManyClasses from './utils/createWarnTooManyClasses';
|
|
5
|
-
interface ExoticComponentWithDisplayName<P =
|
|
5
|
+
interface ExoticComponentWithDisplayName<P = any> extends React.ExoticComponent<P> {
|
|
6
6
|
defaultProps?: Partial<P>;
|
|
7
7
|
displayName?: string;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type OmitNever<T> = {
|
|
10
10
|
[K in keyof T as T[K] extends never ? never : K]: T[K];
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Runtime = 'web' | 'native';
|
|
13
13
|
export { DefaultTheme };
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
|
|
14
|
+
export type AnyComponent<P = any> = ExoticComponentWithDisplayName<P> | React.ComponentType<P>;
|
|
15
|
+
export type KnownTarget = keyof JSX.IntrinsicElements | AnyComponent;
|
|
16
|
+
export type WebTarget = string | KnownTarget;
|
|
17
|
+
export type NativeTarget = AnyComponent;
|
|
18
|
+
export type StyledTarget<R extends Runtime> = R extends 'web' ? WebTarget : NativeTarget;
|
|
19
|
+
export interface StyledOptions<R extends Runtime, Props extends object> {
|
|
20
|
+
attrs?: AttrsArg<Props>[];
|
|
17
21
|
componentId?: R extends 'web' ? string : never;
|
|
18
22
|
displayName?: string;
|
|
19
23
|
parentComponentId?: R extends 'web' ? string : never;
|
|
20
24
|
shouldForwardProp?: ShouldForwardProp<R>;
|
|
21
25
|
}
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export interface
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export type Dict<T> = {
|
|
27
|
+
[key: string]: T;
|
|
28
|
+
};
|
|
29
|
+
export interface ExecutionProps {
|
|
30
|
+
/**
|
|
31
|
+
* Dynamically adjust the rendered component or HTML tag, e.g.
|
|
32
|
+
* ```
|
|
33
|
+
* const StyledButton = styled.button``
|
|
34
|
+
*
|
|
35
|
+
* <StyledButton as="a" href="/foo">
|
|
36
|
+
* I'm an anchor now
|
|
37
|
+
* </StyledButton>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
31
40
|
as?: KnownTarget;
|
|
32
41
|
forwardedAs?: KnownTarget;
|
|
33
42
|
theme?: DefaultTheme;
|
|
34
43
|
}
|
|
35
|
-
|
|
44
|
+
/**
|
|
45
|
+
* ExecutionProps but with `theme` required.
|
|
46
|
+
*/
|
|
47
|
+
export interface ExecutionContext extends ExecutionProps {
|
|
36
48
|
theme: DefaultTheme;
|
|
37
49
|
}
|
|
38
|
-
export interface StyleFunction<Props
|
|
39
|
-
(executionContext: ExecutionContext & Props): Interpolation<Props>;
|
|
50
|
+
export interface StyleFunction<Props extends object> {
|
|
51
|
+
(executionContext: ExecutionContext & Omit<Props, keyof ExecutionContext>): Interpolation<Props>;
|
|
40
52
|
}
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
53
|
+
export type Interpolation<Props extends object> = StyleFunction<Props> | StyledObject<Props> | TemplateStringsArray | string | number | false | undefined | null | Keyframes | IStyledComponent<'web', any, any> | Interpolation<Props>[];
|
|
54
|
+
export type AttrsArg<Props extends object> = (Omit<ExecutionProps, keyof Props> & Props) | ((props: Omit<ExecutionContext, keyof Props> & Props) => Partial<Props>);
|
|
55
|
+
export type Attrs = object | ((...args: any) => object);
|
|
56
|
+
export type RuleSet<Props extends object> = Interpolation<Props>[];
|
|
57
|
+
export type Styles<Props extends object> = TemplateStringsArray | StyledObject<Props> | StyleFunction<Props>;
|
|
58
|
+
export type NameGenerator = (hash: number) => string;
|
|
46
59
|
export interface StyleSheet {
|
|
47
60
|
create: Function;
|
|
48
61
|
}
|
|
@@ -51,59 +64,64 @@ export interface Keyframes {
|
|
|
51
64
|
name: string;
|
|
52
65
|
rules: string;
|
|
53
66
|
}
|
|
54
|
-
export interface Flattener<Props> {
|
|
67
|
+
export interface Flattener<Props extends object> {
|
|
55
68
|
(chunks: Interpolation<Props>[], executionContext: Object | null | undefined, styleSheet: Object | null | undefined): Interpolation<Props>[];
|
|
56
69
|
}
|
|
57
|
-
export
|
|
70
|
+
export type FlattenerResult<Props extends object> = RuleSet<Props> | number | string | string[] | IStyledComponent<'web', any, any> | Keyframes;
|
|
58
71
|
export interface Stringifier {
|
|
59
72
|
(css: string, selector?: string, prefix?: string, componentId?: string): string[];
|
|
60
73
|
hash: string;
|
|
61
74
|
}
|
|
62
75
|
export interface ShouldForwardProp<R extends Runtime> {
|
|
63
|
-
(prop: string, elementToBeCreated
|
|
76
|
+
(prop: string, elementToBeCreated: StyledTarget<R>): boolean;
|
|
64
77
|
}
|
|
65
|
-
export interface CommonStatics<R extends Runtime, Props> {
|
|
66
|
-
attrs:
|
|
78
|
+
export interface CommonStatics<R extends Runtime, Props extends object> {
|
|
79
|
+
attrs: AttrsArg<Props>[];
|
|
67
80
|
target: StyledTarget<R>;
|
|
68
81
|
shouldForwardProp?: ShouldForwardProp<R>;
|
|
69
|
-
withComponent: any;
|
|
70
82
|
}
|
|
71
|
-
export interface IStyledStatics<R extends Runtime, OuterProps extends
|
|
83
|
+
export interface IStyledStatics<R extends Runtime, OuterProps extends object> extends CommonStatics<R, OuterProps> {
|
|
72
84
|
componentStyle: R extends 'web' ? ComponentStyle : never;
|
|
73
85
|
foldedComponentIds: R extends 'web' ? Array<string> : never;
|
|
74
86
|
inlineStyle: R extends 'native' ? InstanceType<IInlineStyleConstructor<OuterProps>> : never;
|
|
75
87
|
target: StyledTarget<R>;
|
|
76
88
|
styledComponentId: R extends 'web' ? string : never;
|
|
77
89
|
warnTooManyClasses?: R extends 'web' ? ReturnType<typeof createWarnTooManyClasses> : never;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
as
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Used by PolymorphicComponent to define prop override cascading order.
|
|
93
|
+
*/
|
|
94
|
+
export type PolymorphicComponentProps<R extends Runtime, E extends StyledTarget<R>, P extends object> = Omit<E extends KnownTarget ? P & Omit<React.ComponentPropsWithRef<E>, keyof P> : P, 'as' | 'theme'> & {
|
|
95
|
+
as?: P extends {
|
|
96
|
+
as?: string | AnyComponent;
|
|
97
|
+
} ? P['as'] : E;
|
|
98
|
+
theme?: DefaultTheme;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* This type forms the signature for a forwardRef-enabled component that accepts
|
|
102
|
+
* the "as" prop to dynamically change the underlying rendered JSX. The interface will
|
|
103
|
+
* automatically attempt to extract props from the given rendering target to
|
|
104
|
+
* get proper typing for any specialized props in the target component.
|
|
105
|
+
*/
|
|
106
|
+
export interface PolymorphicComponent<R extends Runtime, P extends object, FallbackComponent extends StyledTarget<R>> extends React.ForwardRefExoticComponent<P> {
|
|
107
|
+
<E extends StyledTarget<R> = FallbackComponent>(props: PolymorphicComponentProps<R, E, P>): React.ReactElement | null;
|
|
108
|
+
}
|
|
109
|
+
export interface IStyledComponent<R extends Runtime, Target extends StyledTarget<R>, Props extends object> extends PolymorphicComponent<R, Props, Target>, IStyledStatics<R, Props> {
|
|
110
|
+
defaultProps?: Partial<(Target extends KnownTarget ? ExecutionProps & Omit<React.ComponentProps<Target>, keyof ExecutionProps> : ExecutionProps) & Props>;
|
|
92
111
|
toString: () => string;
|
|
93
112
|
}
|
|
94
|
-
export interface IStyledComponentFactory<R extends Runtime, Target extends StyledTarget<R>,
|
|
95
|
-
(target: Target, options: StyledOptions<R, Props>, rules: RuleSet<Props>): IStyledComponent<R, Target, Props> & Statics;
|
|
113
|
+
export interface IStyledComponentFactory<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object, OuterStatics extends object = object> {
|
|
114
|
+
<Props extends object = object, Statics extends object = object>(target: Target, options: StyledOptions<R, OuterProps & Props>, rules: RuleSet<OuterProps & Props>): IStyledComponent<R, Target, OuterProps & Props> & OuterStatics & Statics;
|
|
96
115
|
}
|
|
97
|
-
export interface IInlineStyleConstructor<Props
|
|
116
|
+
export interface IInlineStyleConstructor<Props extends object> {
|
|
98
117
|
new (rules: RuleSet<Props>): IInlineStyle<Props>;
|
|
99
118
|
}
|
|
100
|
-
export interface IInlineStyle<Props
|
|
119
|
+
export interface IInlineStyle<Props extends object> {
|
|
101
120
|
rules: RuleSet<Props>;
|
|
102
121
|
generateStyleObject(executionContext: Object): Object;
|
|
103
122
|
}
|
|
104
|
-
export
|
|
105
|
-
|
|
106
|
-
[key: string]: BaseExtensibleObject | string | number | StyleFunction<Props>;
|
|
123
|
+
export interface StyledObject<Props extends object> {
|
|
124
|
+
[key: string]: Dict<any> | string | number | StyleFunction<Props> | StyledObject<Props>;
|
|
107
125
|
}
|
|
108
126
|
/**
|
|
109
127
|
* Override DefaultTheme to get accurate typings for your project.
|
|
@@ -127,4 +145,4 @@ export interface StyledObject<Props = ExecutionContext> {
|
|
|
127
145
|
* }
|
|
128
146
|
* ```
|
|
129
147
|
*/
|
|
130
|
-
export
|
|
148
|
+
export type CSSProp = string | StyledObject<any> | StyleFunction<any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default function determineTheme(props:
|
|
1
|
+
import { ExecutionProps } from '../types';
|
|
2
|
+
export default function determineTheme(props: ExecutionProps, providedTheme: any, defaultProps?: any): any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
|
|
1
|
+
declare const _default: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
|
|
2
2
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dict } from '../types';
|
|
2
2
|
export declare const EMPTY_ARRAY: readonly any[];
|
|
3
|
-
export declare const EMPTY_OBJECT: Readonly<
|
|
3
|
+
export declare const EMPTY_OBJECT: Readonly<Dict<any>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import StyleSheet from '../sheet';
|
|
2
|
-
import {
|
|
3
|
-
export declare const objToCssArray: (obj:
|
|
4
|
-
export default function flatten<Props
|
|
2
|
+
import { Dict, ExecutionContext, Interpolation, RuleSet, Stringifier } from '../types';
|
|
3
|
+
export declare const objToCssArray: (obj: Dict<any>, prevKey?: string) => string[];
|
|
4
|
+
export default function flatten<Props extends object>(chunk: Interpolation<Props>, executionContext?: ExecutionContext & Props, styleSheet?: StyleSheet, stylisInstance?: Stringifier): RuleSet<Props>;
|
|
@@ -40,11 +40,11 @@ declare const MEMO_STATICS: {
|
|
|
40
40
|
propTypes: boolean;
|
|
41
41
|
type: boolean;
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
type OmniComponent = AnyComponent;
|
|
44
|
+
type ExcludeList = {
|
|
45
45
|
[key: string]: true;
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
type NonReactStatics<S extends OmniComponent, C extends ExcludeList = {}> = {
|
|
48
48
|
[key in Exclude<keyof S, S extends React.MemoExoticComponent<any> ? keyof typeof MEMO_STATICS | keyof C : S extends React.ForwardRefExoticComponent<any> ? keyof typeof FORWARD_REF_STATICS | keyof C : keyof typeof REACT_STATICS | keyof typeof KNOWN_STATICS | keyof C>]: S[key];
|
|
49
49
|
};
|
|
50
50
|
export default function hoistNonReactStatics<T extends OmniComponent, S extends OmniComponent, C extends ExcludeList = {}>(targetComponent: T, sourceComponent: S, excludelist?: C): T & NonReactStatics<S, C>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Interpolation } from '../types';
|
|
2
|
-
export default function interleave<Props
|
|
2
|
+
export default function interleave<Props extends object>(strings: readonly string[], interpolations: Interpolation<Props>[]): Interpolation<Props>[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RuleSet } from '../types';
|
|
2
|
-
export default function isStaticRules<Props
|
|
2
|
+
export default function isStaticRules<Props extends object>(rules: RuleSet<Props>): boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ExtensibleObject } from '../types';
|
|
2
1
|
/**
|
|
3
2
|
* Arrays & POJOs merged recursively, other objects and value types are overridden
|
|
4
3
|
* If target is not a POJO or an Array, it will get source properties injected via shallow merge
|
|
5
4
|
* Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
|
|
6
5
|
*/
|
|
7
|
-
export default function mixinDeep(target
|
|
6
|
+
export default function mixinDeep(target: any, ...sources: any[]): any;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Middleware } from 'stylis';
|
|
2
2
|
import { Stringifier } from '../types';
|
|
3
|
-
|
|
3
|
+
export type ICreateStylisInstance = {
|
|
4
4
|
options?: {
|
|
5
|
+
namespace?: string;
|
|
5
6
|
prefix?: boolean;
|
|
6
7
|
};
|
|
7
8
|
plugins?: Middleware[];
|
|
8
9
|
};
|
|
9
|
-
export default function createStylisInstance({ options, plugins, }?:
|
|
10
|
-
export {};
|
|
10
|
+
export default function createStylisInstance({ options, plugins, }?: ICreateStylisInstance): Stringifier;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "styled-components",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.8",
|
|
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
|
"main": "dist/styled-components.cjs.js",
|
|
6
6
|
"jsnext:main": "dist/styled-components.esm.js",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"lint": "eslint src",
|
|
31
31
|
"lint:size": "bundlewatch",
|
|
32
32
|
"prettier": "prettier */**/*.js --write",
|
|
33
|
-
"postinstall": "node ./postinstall.js",
|
|
34
33
|
"prepublishOnly": "npm run build",
|
|
35
34
|
"dev": "cross-env BABEL_ENV=cjs babel-node example/startServer.js"
|
|
36
35
|
},
|
|
@@ -46,8 +45,7 @@
|
|
|
46
45
|
"primitives",
|
|
47
46
|
"scripts",
|
|
48
47
|
"test-utils",
|
|
49
|
-
"macro"
|
|
50
|
-
"postinstall.js"
|
|
48
|
+
"macro"
|
|
51
49
|
],
|
|
52
50
|
"keywords": [
|
|
53
51
|
"react",
|
|
@@ -152,13 +152,13 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
//
|
|
155
|
-
var SC_ATTR = typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
|
|
155
|
+
var SC_ATTR = typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
|
|
156
156
|
var SC_ATTR_ACTIVE = 'active';
|
|
157
157
|
var SC_ATTR_VERSION = 'data-styled-version';
|
|
158
|
-
var SC_VERSION = "5.3.
|
|
158
|
+
var SC_VERSION = "5.3.8";
|
|
159
159
|
var SPLITTER = '/*!sc*/\n';
|
|
160
160
|
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
161
|
-
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean' ? SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' && process.env.REACT_APP_SC_DISABLE_SPEEDY !== '' ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false' ? false : process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process
|
|
161
|
+
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean' ? SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env !== 'undefined' ? typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' && process.env.REACT_APP_SC_DISABLE_SPEEDY !== '' ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false' ? false : process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' && process.env.SC_DISABLE_SPEEDY !== '' ? process.env.SC_DISABLE_SPEEDY === 'false' ? false : process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== 'production' : false); // Shared empty execution context when generating static styles
|
|
162
162
|
|
|
163
163
|
//
|
|
164
164
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
@@ -5994,7 +5994,7 @@ var StyledNativeComponent = /*#__PURE__*/function (_Component) {
|
|
|
5994
5994
|
propsForElement.style = typeof style === 'function' ? function (state) {
|
|
5995
5995
|
return [generatedStyles].concat(style(state));
|
|
5996
5996
|
} : [generatedStyles].concat(style);
|
|
5997
|
-
propsForElement.testID = testID;
|
|
5997
|
+
propsForElement.testID = testID || propsForElement.testID;
|
|
5998
5998
|
if (forwardedRef) propsForElement.ref = forwardedRef;
|
|
5999
5999
|
if (forwardedAs) propsForElement.as = forwardedAs;
|
|
6000
6000
|
return React.createElement(elementToBeRendered, propsForElement);
|