styled-components 6.0.0-beta.3 → 6.0.0-beta.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/base.d.ts +1 -1
- package/dist/constructors/constructWithOptions.d.ts +8 -14
- package/dist/constructors/createGlobalStyle.d.ts +1 -1
- package/dist/constructors/css.d.ts +4 -4
- package/dist/constructors/styled.d.ts +1 -1
- package/dist/native/index.d.ts +25 -25
- package/dist/styled-components.browser.cjs.js +38 -44
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +38 -44
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +38 -44
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +38 -44
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +39 -45
- 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 +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +22 -14
- package/dist/utils/flatten.d.ts +1 -1
- package/dist/utils/interleave.d.ts +1 -1
- package/dist/utils/joinStrings.d.ts +1 -1
- package/dist/utils/mixinDeep.d.ts +1 -2
- package/native/dist/base.d.ts +1 -1
- package/native/dist/constructors/constructWithOptions.d.ts +8 -14
- package/native/dist/constructors/createGlobalStyle.d.ts +1 -1
- package/native/dist/constructors/css.d.ts +4 -4
- package/native/dist/constructors/styled.d.ts +1 -1
- package/native/dist/native/index.d.ts +25 -25
- package/native/dist/styled-components.native.cjs.js +15 -21
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +15 -21
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/utils.d.ts +1 -1
- package/native/dist/types.d.ts +22 -14
- package/native/dist/utils/flatten.d.ts +1 -1
- package/native/dist/utils/interleave.d.ts +1 -1
- package/native/dist/utils/joinStrings.d.ts +1 -1
- package/native/dist/utils/mixinDeep.d.ts +1 -2
- package/package.json +3 -3
- package/test-utils/index.ts +10 -6
- 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/dist/base.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ declare global {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
export * from './secretInternals';
|
|
17
|
-
export { Attrs, DefaultTheme, ShouldForwardProp } from './types';
|
|
17
|
+
export { AttrsArg as Attrs, DefaultTheme, ShouldForwardProp } from './types';
|
|
18
18
|
export { createGlobalStyle, css, isStyledComponent, keyframes, ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, ThemeProvider, useTheme, SC_VERSION as version, withTheme, };
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import { Attrs, Interpolation, IStyledComponent, IStyledComponentFactory, KnownTarget, Runtime, StyledOptions, StyledTarget, Styles } from '../types';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Attrs, AttrsArg, Interpolation, IStyledComponent, IStyledComponentFactory, KnownTarget, Runtime, StyledOptions, StyledTarget, Styles } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* for types a and b, if b shares a field with a, mark a's field as optional
|
|
5
5
|
*/
|
|
6
|
-
declare type
|
|
7
|
-
[K in keyof
|
|
6
|
+
declare type OptionalIntersection<A, B> = {
|
|
7
|
+
[K in Extract<keyof A, keyof B>]?: A[K];
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
* attrs can be an object or function that returns an object; attrs are always
|
|
11
|
-
* optional and should hole-punch required base types if we're providing the
|
|
12
|
-
* value via attrs
|
|
13
|
-
*/
|
|
14
|
-
declare type InferAttrResultType<T extends Attrs<object>> = Partial<T extends (...args: any) => infer P ? P : T>;
|
|
15
9
|
/**
|
|
16
10
|
* If attrs type is a function (no type provided, inferring from usage), extract the return value
|
|
17
11
|
* and merge it with the existing type to hole-punch any required fields that are satisfied as
|
|
18
12
|
* a result of running attrs. Otherwise if we have a definite type then union the base props
|
|
19
13
|
* with the passed attr type to capture any intended overrides.
|
|
20
14
|
*/
|
|
21
|
-
declare type
|
|
22
|
-
export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object> {
|
|
15
|
+
declare type MarkPropsSatisfiedByAttrs<T extends Attrs, Props extends object> = T extends (...args: any) => infer P ? Omit<Props, keyof P> & OptionalIntersection<Props, P> : Omit<Props, keyof T> & Partial<T>;
|
|
16
|
+
export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? R extends 'web' ? React.HTMLAttributes<Target> : object & React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object> {
|
|
23
17
|
<Props extends object = object, Statics extends object = object>(initialStyles: Styles<OuterProps & Props>, ...interpolations: Interpolation<OuterProps & Props>[]): IStyledComponent<R, Target, OuterProps & Props> & OuterStatics & Statics;
|
|
24
|
-
attrs: <T extends Attrs
|
|
18
|
+
attrs: <T extends Attrs>(attrs: AttrsArg<T extends (...args: any) => infer P ? OuterProps & P : OuterProps & T>) => Styled<R, Target, MarkPropsSatisfiedByAttrs<T, OuterProps>, OuterStatics>;
|
|
25
19
|
withConfig: (config: StyledOptions<R, OuterProps>) => Styled<R, Target, OuterProps, OuterStatics>;
|
|
26
20
|
}
|
|
27
|
-
export default function constructWithOptions<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object>(componentConstructor: IStyledComponentFactory<R, Target, OuterProps, OuterStatics>, tag: Target, options?: StyledOptions<R, OuterProps>): Styled<R, Target, OuterProps, OuterStatics>;
|
|
21
|
+
export default function constructWithOptions<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? R extends 'web' ? React.HTMLAttributes<Target> : object & React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object>(componentConstructor: IStyledComponentFactory<R, Target, OuterProps, OuterStatics>, tag: Target, options?: StyledOptions<R, OuterProps>): Styled<R, Target, OuterProps, OuterStatics>;
|
|
28
22
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExecutionProps, Interpolation, Styles } from '../types';
|
|
3
|
-
export default function createGlobalStyle<Props extends object>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): React.NamedExoticComponent<ExecutionProps>;
|
|
3
|
+
export default function createGlobalStyle<Props extends object>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): React.NamedExoticComponent<ExecutionProps & Props>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Interpolation,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Interpolation, RuleSet, Styles } from '../types';
|
|
2
|
+
declare function css(styles: Styles<object>, ...interpolations: Interpolation<object>[]): RuleSet<object>;
|
|
3
|
+
declare function css<Props extends object>(styles: Styles<Props>, ...interpolations: Interpolation<Props>[]): RuleSet<Props>;
|
|
4
|
+
export default css;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WebTarget } from '../types';
|
|
3
3
|
import { Styled } from './constructWithOptions';
|
|
4
|
-
declare const styled: (<Target extends WebTarget>(tag: Target) => Styled<"web", Target,
|
|
4
|
+
declare const styled: (<Target extends WebTarget>(tag: Target) => Styled<"web", Target, Target_1 extends import("../types").KnownTarget ? R extends "web" ? import("react").HTMLAttributes<Target_1> : object & import("react").ComponentPropsWithRef<Target_1> : object, object>) & {
|
|
5
5
|
a: Styled<"web", "a", import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, object>;
|
|
6
6
|
abbr: Styled<"web", "abbr", import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, object>;
|
|
7
7
|
address: Styled<"web", "address", import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, object>;
|
package/dist/native/index.d.ts
CHANGED
|
@@ -6,31 +6,31 @@ import useTheme from '../hooks/useTheme';
|
|
|
6
6
|
import ThemeProvider, { ThemeConsumer, ThemeContext } from '../models/ThemeProvider';
|
|
7
7
|
import { NativeTarget } from '../types';
|
|
8
8
|
import isStyledComponent from '../utils/isStyledComponent';
|
|
9
|
-
declare const styled: (<Target extends NativeTarget>(tag: Target) => Styled<"native", Target, Target extends import("../types").KnownTarget ? React.ComponentPropsWithRef<Target> : object, object>) & {
|
|
10
|
-
ActivityIndicator: Styled<"native", typeof import("react-native").ActivityIndicator, import("react-native").ActivityIndicatorProps & React.RefAttributes<import("react-native").ActivityIndicator>, object>;
|
|
11
|
-
Button: Styled<"native", typeof import("react-native").Button, import("react-native").ButtonProps & React.RefAttributes<import("react-native").Button>, object>;
|
|
12
|
-
DatePickerIOS: Styled<"native", typeof import("react-native").DatePickerIOS, import("react-native").DatePickerIOSProps & React.RefAttributes<import("react-native").DatePickerIOS>, object>;
|
|
13
|
-
DrawerLayoutAndroid: Styled<"native", typeof import("react-native").DrawerLayoutAndroid, import("react-native").DrawerLayoutAndroidProps & React.RefAttributes<import("react-native").DrawerLayoutAndroid>, object>;
|
|
14
|
-
FlatList: Styled<"native", typeof import("react-native").FlatList, import("react-native").FlatListProps<unknown> & React.RefAttributes<import("react-native").FlatList<unknown>>, object>;
|
|
15
|
-
Image: Styled<"native", typeof import("react-native").Image, import("react-native").ImageProps & React.RefAttributes<import("react-native").Image>, object>;
|
|
16
|
-
ImageBackground: Styled<"native", typeof import("react-native").ImageBackground, import("react-native").ImageBackgroundProps & React.RefAttributes<import("react-native").ImageBackground>, object>;
|
|
17
|
-
KeyboardAvoidingView: Styled<"native", typeof import("react-native").KeyboardAvoidingView, import("react-native").KeyboardAvoidingViewProps & React.RefAttributes<import("react-native").KeyboardAvoidingView>, object>;
|
|
18
|
-
Modal: Styled<"native", typeof import("react-native").Modal, import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & React.RefAttributes<import("react-native").Modal>, object>;
|
|
19
|
-
Pressable: Styled<"native", import("react").ForwardRefExoticComponent<import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>>, import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>, object>;
|
|
20
|
-
ProgressBarAndroid: Styled<"native", typeof import("react-native").ProgressBarAndroid, import("react-native").ProgressBarAndroidProps & React.RefAttributes<import("react-native").ProgressBarAndroid>, object>;
|
|
21
|
-
ProgressViewIOS: Styled<"native", typeof import("react-native").ProgressViewIOS, import("react-native").ProgressViewIOSProps & React.RefAttributes<import("react-native").ProgressViewIOS>, object>;
|
|
22
|
-
RefreshControl: Styled<"native", typeof import("react-native").RefreshControl, import("react-native").RefreshControlProps & React.RefAttributes<import("react-native").RefreshControl>, object>;
|
|
23
|
-
SafeAreaView: Styled<"native", typeof import("react-native").SafeAreaView, import("react-native").ViewProps & React.RefAttributes<import("react-native").SafeAreaView>, object>;
|
|
24
|
-
ScrollView: Styled<"native", typeof import("react-native").ScrollView, import("react-native").ScrollViewProps & React.RefAttributes<import("react-native").ScrollView>, object>;
|
|
25
|
-
SectionList: Styled<"native", typeof import("react-native").SectionList, import("react-native").SectionListProps<unknown, unknown> & React.RefAttributes<import("react-native").SectionList<unknown, unknown>>, object>;
|
|
26
|
-
Slider: Styled<"native", typeof import("react-native").Slider, import("react-native").SliderProps & React.RefAttributes<import("react-native").Slider>, object>;
|
|
27
|
-
Switch: Styled<"native", typeof import("react-native").Switch, import("react-native").SwitchProps & React.RefAttributes<import("react-native").Switch>, object>;
|
|
28
|
-
Text: Styled<"native", typeof import("react-native").Text, import("react-native").TextProps & React.RefAttributes<import("react-native").Text>, object>;
|
|
29
|
-
TextInput: Styled<"native", typeof import("react-native").TextInput, import("react-native").TextInputProps & React.RefAttributes<import("react-native").TextInput>, object>;
|
|
30
|
-
TouchableHighlight: Styled<"native", typeof import("react-native").TouchableHighlight, import("react-native").TouchableHighlightProps & React.RefAttributes<import("react-native").TouchableHighlight>, object>;
|
|
31
|
-
TouchableOpacity: Styled<"native", typeof import("react-native").TouchableOpacity, import("react-native").TouchableOpacityProps & React.RefAttributes<import("react-native").TouchableOpacity>, object>;
|
|
32
|
-
View: Styled<"native", typeof import("react-native").View, import("react-native").ViewProps & React.RefAttributes<import("react-native").View>, object>;
|
|
33
|
-
VirtualizedList: Styled<"native", typeof import("react-native").VirtualizedList, import("react-native").VirtualizedListProps<unknown> & React.RefAttributes<import("react-native").VirtualizedList<unknown>>, object>;
|
|
9
|
+
declare const styled: (<Target extends NativeTarget>(tag: Target) => Styled<"native", Target, Target extends import("../types").KnownTarget ? object & React.ComponentPropsWithRef<Target> : object, object>) & {
|
|
10
|
+
ActivityIndicator: Styled<"native", typeof import("react-native").ActivityIndicator, object & import("react-native").ActivityIndicatorProps & React.RefAttributes<import("react-native").ActivityIndicator>, object>;
|
|
11
|
+
Button: Styled<"native", typeof import("react-native").Button, object & import("react-native").ButtonProps & React.RefAttributes<import("react-native").Button>, object>;
|
|
12
|
+
DatePickerIOS: Styled<"native", typeof import("react-native").DatePickerIOS, object & import("react-native").DatePickerIOSProps & React.RefAttributes<import("react-native").DatePickerIOS>, object>;
|
|
13
|
+
DrawerLayoutAndroid: Styled<"native", typeof import("react-native").DrawerLayoutAndroid, object & import("react-native").DrawerLayoutAndroidProps & React.RefAttributes<import("react-native").DrawerLayoutAndroid>, object>;
|
|
14
|
+
FlatList: Styled<"native", typeof import("react-native").FlatList, object & import("react-native").FlatListProps<unknown> & React.RefAttributes<import("react-native").FlatList<unknown>>, object>;
|
|
15
|
+
Image: Styled<"native", typeof import("react-native").Image, object & import("react-native").ImageProps & React.RefAttributes<import("react-native").Image>, object>;
|
|
16
|
+
ImageBackground: Styled<"native", typeof import("react-native").ImageBackground, object & import("react-native").ImageBackgroundProps & React.RefAttributes<import("react-native").ImageBackground>, object>;
|
|
17
|
+
KeyboardAvoidingView: Styled<"native", typeof import("react-native").KeyboardAvoidingView, object & import("react-native").KeyboardAvoidingViewProps & React.RefAttributes<import("react-native").KeyboardAvoidingView>, object>;
|
|
18
|
+
Modal: Styled<"native", typeof import("react-native").Modal, object & import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & React.RefAttributes<import("react-native").Modal>, object>;
|
|
19
|
+
Pressable: Styled<"native", import("react").ForwardRefExoticComponent<import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>>, object & import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>, object>;
|
|
20
|
+
ProgressBarAndroid: Styled<"native", typeof import("react-native").ProgressBarAndroid, object & import("react-native").ProgressBarAndroidProps & React.RefAttributes<import("react-native").ProgressBarAndroid>, object>;
|
|
21
|
+
ProgressViewIOS: Styled<"native", typeof import("react-native").ProgressViewIOS, object & import("react-native").ProgressViewIOSProps & React.RefAttributes<import("react-native").ProgressViewIOS>, object>;
|
|
22
|
+
RefreshControl: Styled<"native", typeof import("react-native").RefreshControl, object & import("react-native").RefreshControlProps & React.RefAttributes<import("react-native").RefreshControl>, object>;
|
|
23
|
+
SafeAreaView: Styled<"native", typeof import("react-native").SafeAreaView, object & import("react-native").ViewProps & React.RefAttributes<import("react-native").SafeAreaView>, object>;
|
|
24
|
+
ScrollView: Styled<"native", typeof import("react-native").ScrollView, object & import("react-native").ScrollViewProps & React.RefAttributes<import("react-native").ScrollView>, object>;
|
|
25
|
+
SectionList: Styled<"native", typeof import("react-native").SectionList, object & import("react-native").SectionListProps<unknown, unknown> & React.RefAttributes<import("react-native").SectionList<unknown, unknown>>, object>;
|
|
26
|
+
Slider: Styled<"native", typeof import("react-native").Slider, object & import("react-native").SliderProps & React.RefAttributes<import("react-native").Slider>, object>;
|
|
27
|
+
Switch: Styled<"native", typeof import("react-native").Switch, object & import("react-native").SwitchProps & React.RefAttributes<import("react-native").Switch>, object>;
|
|
28
|
+
Text: Styled<"native", typeof import("react-native").Text, object & import("react-native").TextProps & React.RefAttributes<import("react-native").Text>, object>;
|
|
29
|
+
TextInput: Styled<"native", typeof import("react-native").TextInput, object & import("react-native").TextInputProps & React.RefAttributes<import("react-native").TextInput>, object>;
|
|
30
|
+
TouchableHighlight: Styled<"native", typeof import("react-native").TouchableHighlight, object & import("react-native").TouchableHighlightProps & React.RefAttributes<import("react-native").TouchableHighlight>, object>;
|
|
31
|
+
TouchableOpacity: Styled<"native", typeof import("react-native").TouchableOpacity, object & import("react-native").TouchableOpacityProps & React.RefAttributes<import("react-native").TouchableOpacity>, object>;
|
|
32
|
+
View: Styled<"native", typeof import("react-native").View, object & import("react-native").ViewProps & React.RefAttributes<import("react-native").View>, object>;
|
|
33
|
+
VirtualizedList: Styled<"native", typeof import("react-native").VirtualizedList, object & import("react-native").VirtualizedListProps<unknown> & React.RefAttributes<import("react-native").VirtualizedList<unknown>>, object>;
|
|
34
34
|
};
|
|
35
35
|
export { IStyledComponent, IStyledComponentFactory, IStyledStatics, NativeTarget, StyledOptions, } from '../types';
|
|
36
36
|
export { css, isStyledComponent, ThemeProvider, ThemeConsumer, ThemeContext, withTheme, useTheme };
|
|
@@ -18,7 +18,7 @@ var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR
|
|
|
18
18
|
'data-styled';
|
|
19
19
|
var SC_ATTR_ACTIVE = 'active';
|
|
20
20
|
var SC_ATTR_VERSION = 'data-styled-version';
|
|
21
|
-
var SC_VERSION = "6.0.0-beta.
|
|
21
|
+
var SC_VERSION = "6.0.0-beta.5";
|
|
22
22
|
var SPLITTER = '/*!sc*/\n';
|
|
23
23
|
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
24
24
|
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
|
|
@@ -447,8 +447,12 @@ function isStyledComponent(target) {
|
|
|
447
447
|
/**
|
|
448
448
|
* Convenience function for joining strings to form className chains
|
|
449
449
|
*/
|
|
450
|
-
function joinStrings(
|
|
451
|
-
|
|
450
|
+
function joinStrings() {
|
|
451
|
+
var args = [];
|
|
452
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
453
|
+
args[_i] = arguments[_i];
|
|
454
|
+
}
|
|
455
|
+
return args.filter(Boolean).join(' ');
|
|
452
456
|
}
|
|
453
457
|
|
|
454
458
|
function isPlainObject(x) {
|
|
@@ -487,7 +491,6 @@ function mixinRecursively(target, source, forceMerge) {
|
|
|
487
491
|
* Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
|
|
488
492
|
*/
|
|
489
493
|
function mixinDeep(target) {
|
|
490
|
-
if (target === void 0) { target = {}; }
|
|
491
494
|
var sources = [];
|
|
492
495
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
493
496
|
sources[_i - 1] = arguments[_i];
|
|
@@ -1199,21 +1202,18 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
|
|
|
1199
1202
|
var ruleSet = [];
|
|
1200
1203
|
for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
|
|
1201
1204
|
result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
|
|
1202
|
-
if (result ===
|
|
1205
|
+
if (result.length === 0)
|
|
1203
1206
|
continue;
|
|
1204
|
-
|
|
1205
|
-
ruleSet.push.apply(ruleSet, result);
|
|
1206
|
-
else
|
|
1207
|
-
ruleSet.push(result);
|
|
1207
|
+
ruleSet.push.apply(ruleSet, result);
|
|
1208
1208
|
}
|
|
1209
1209
|
return ruleSet;
|
|
1210
1210
|
}
|
|
1211
1211
|
if (isFalsish(chunk)) {
|
|
1212
|
-
return
|
|
1212
|
+
return [];
|
|
1213
1213
|
}
|
|
1214
1214
|
/* Handle other components */
|
|
1215
1215
|
if (isStyledComponent(chunk)) {
|
|
1216
|
-
return ".".concat(chunk.styledComponentId);
|
|
1216
|
+
return [".".concat(chunk.styledComponentId)];
|
|
1217
1217
|
}
|
|
1218
1218
|
/* Either execute or defer the function */
|
|
1219
1219
|
if (isFunction(chunk)) {
|
|
@@ -1230,19 +1230,21 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
return flatten(result, executionContext, styleSheet, stylisInstance);
|
|
1232
1232
|
}
|
|
1233
|
-
else
|
|
1234
|
-
return chunk;
|
|
1233
|
+
else {
|
|
1234
|
+
return [chunk];
|
|
1235
|
+
}
|
|
1235
1236
|
}
|
|
1236
1237
|
if (chunk instanceof Keyframes) {
|
|
1237
1238
|
if (styleSheet) {
|
|
1238
1239
|
chunk.inject(styleSheet, stylisInstance);
|
|
1239
|
-
return chunk.getName(stylisInstance);
|
|
1240
|
+
return [chunk.getName(stylisInstance)];
|
|
1241
|
+
}
|
|
1242
|
+
else {
|
|
1243
|
+
return [chunk];
|
|
1240
1244
|
}
|
|
1241
|
-
else
|
|
1242
|
-
return chunk;
|
|
1243
1245
|
}
|
|
1244
1246
|
/* Handle objects */
|
|
1245
|
-
return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
|
|
1247
|
+
return isPlainObject(chunk) ? objToCssArray(chunk) : [chunk.toString()];
|
|
1246
1248
|
}
|
|
1247
1249
|
|
|
1248
1250
|
function isStaticRules(rules) {
|
|
@@ -1405,18 +1407,14 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
|
|
|
1405
1407
|
var theme = determineTheme(props, React.useContext(ThemeContext), defaultProps) || EMPTY_OBJECT;
|
|
1406
1408
|
var context = componentAttrs.reduce(function (p, attrDef) {
|
|
1407
1409
|
var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(p) : attrDef;
|
|
1408
|
-
var key;
|
|
1409
1410
|
/* eslint-disable guard-for-in */
|
|
1410
|
-
for (key in resolvedAttrDef) {
|
|
1411
|
+
for (var key in resolvedAttrDef) {
|
|
1411
1412
|
// @ts-expect-error bad types
|
|
1412
1413
|
p[key] =
|
|
1413
1414
|
key === 'className'
|
|
1414
|
-
?
|
|
1415
|
-
joinStrings(p[key], resolvedAttrDef[key])
|
|
1415
|
+
? joinStrings(p[key], resolvedAttrDef[key])
|
|
1416
1416
|
: key === 'style'
|
|
1417
|
-
?
|
|
1418
|
-
tslib.__assign(tslib.__assign({}, p[key]), resolvedAttrDef[key]) : // @ts-expect-error bad types
|
|
1419
|
-
resolvedAttrDef[key];
|
|
1417
|
+
? tslib.__assign(tslib.__assign({}, p[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
|
|
1420
1418
|
}
|
|
1421
1419
|
/* eslint-enable guard-for-in */
|
|
1422
1420
|
return p;
|
|
@@ -1425,22 +1423,21 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
|
|
|
1425
1423
|
var refToForward = forwardedRef;
|
|
1426
1424
|
var elementToBeCreated = context.as || target;
|
|
1427
1425
|
var isTargetTag = isTag(elementToBeCreated);
|
|
1426
|
+
var propsForElement = {};
|
|
1428
1427
|
// eslint-disable-next-line guard-for-in
|
|
1429
1428
|
for (var key in context) {
|
|
1430
|
-
// @ts-expect-error
|
|
1431
|
-
if (key
|
|
1432
|
-
|
|
1429
|
+
// @ts-expect-error for..in iterates strings instead of keyof
|
|
1430
|
+
if (context[key] === undefined) ;
|
|
1431
|
+
else if (key[0] === '$' || key === 'as' || key === 'theme') ;
|
|
1433
1432
|
else if (key === 'forwardedAs') {
|
|
1434
|
-
|
|
1435
|
-
context[key] = undefined;
|
|
1433
|
+
propsForElement.as = context.forwardedAs;
|
|
1436
1434
|
}
|
|
1437
|
-
else if (shouldForwardProp
|
|
1438
|
-
//
|
|
1439
|
-
|
|
1440
|
-
context[key] = undefined;
|
|
1435
|
+
else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
|
|
1436
|
+
// @ts-expect-error for..in iterates strings instead of keyof
|
|
1437
|
+
propsForElement[key] = context[key];
|
|
1441
1438
|
}
|
|
1442
1439
|
}
|
|
1443
|
-
|
|
1440
|
+
propsForElement[
|
|
1444
1441
|
// handle custom elements which React doesn't properly alias
|
|
1445
1442
|
isTargetTag &&
|
|
1446
1443
|
domElements.indexOf(elementToBeCreated) === -1
|
|
@@ -1449,9 +1446,8 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
|
|
|
1449
1446
|
.concat(styledComponentId, generatedClassName !== styledComponentId ? generatedClassName : '', context.className || '')
|
|
1450
1447
|
.filter(Boolean)
|
|
1451
1448
|
.join(' ');
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
return React.createElement(elementToBeCreated, context);
|
|
1449
|
+
propsForElement.ref = refToForward;
|
|
1450
|
+
return React.createElement(elementToBeCreated, propsForElement);
|
|
1455
1451
|
}
|
|
1456
1452
|
function createStyledComponent(target, options, rules) {
|
|
1457
1453
|
var isTargetStyledComp = isStyledComponent(target);
|
|
@@ -1463,7 +1459,9 @@ function createStyledComponent(target, options, rules) {
|
|
|
1463
1459
|
: options.componentId || componentId;
|
|
1464
1460
|
// fold the underlying StyledComponent attrs up (implicit extend)
|
|
1465
1461
|
var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
|
|
1466
|
-
? styledComponentTarget.attrs
|
|
1462
|
+
? styledComponentTarget.attrs
|
|
1463
|
+
.concat(attrs)
|
|
1464
|
+
.filter(Boolean)
|
|
1467
1465
|
: attrs;
|
|
1468
1466
|
var shouldForwardProp = options.shouldForwardProp;
|
|
1469
1467
|
if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
|
|
@@ -1558,11 +1556,7 @@ function interleave(strings, interpolations) {
|
|
|
1558
1556
|
* expand an array of styles.
|
|
1559
1557
|
*/
|
|
1560
1558
|
var addTag = function (arg) {
|
|
1561
|
-
|
|
1562
|
-
// eslint-disable-next-line no-param-reassign
|
|
1563
|
-
arg.isCss = true;
|
|
1564
|
-
}
|
|
1565
|
-
return arg;
|
|
1559
|
+
return Object.assign(arg, { isCss: true });
|
|
1566
1560
|
};
|
|
1567
1561
|
function css(styles) {
|
|
1568
1562
|
var interpolations = [];
|
|
@@ -1579,7 +1573,7 @@ function css(styles) {
|
|
|
1579
1573
|
if (interpolations.length === 0 &&
|
|
1580
1574
|
styleStringArray.length === 1 &&
|
|
1581
1575
|
typeof styleStringArray[0] === 'string') {
|
|
1582
|
-
return styleStringArray;
|
|
1576
|
+
return flatten(styleStringArray);
|
|
1583
1577
|
}
|
|
1584
1578
|
return addTag(flatten(interleave(styleStringArray, interpolations)));
|
|
1585
1579
|
}
|