styled-components 5.3.7 → 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/constructors/constructWithOptions.d.ts +4 -4
- package/native/dist/hoc/withTheme.d.ts +1 -1
- package/native/dist/models/StyleSheetManager.d.ts +3 -3
- package/native/dist/models/ThemeProvider.d.ts +3 -3
- 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 +2 -2
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +2 -2
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/types.d.ts +18 -18
- package/native/dist/utils/hoist.d.ts +3 -3
- package/native/dist/utils/stylis.d.ts +1 -1
- package/package.json +1 -1
- package/primitives/dist/styled-components-primitives.cjs.js +2 -2
- package/primitives/dist/styled-components-primitives.cjs.js.map +1 -1
- package/primitives/dist/styled-components-primitives.esm.js +2 -2
- package/primitives/dist/styled-components-primitives.esm.js.map +1 -1
|
@@ -3,18 +3,18 @@ import { Attrs, AttrsArg, ExecutionProps, Interpolation, IStyledComponent, IStyl
|
|
|
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
|
-
|
|
6
|
+
type OptionalIntersection<A, B> = {
|
|
7
7
|
[K in Extract<keyof A, keyof B>]?: A[K];
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type AttrsResult<T extends Attrs> = T extends (...args: any) => infer P ? P : T;
|
|
10
|
+
type ExtractAttrsTarget<R extends Runtime, P extends ExecutionProps, DefaultTarget extends StyledTarget<R>> = P['as'] extends KnownTarget ? P['as'] : DefaultTarget;
|
|
11
11
|
/**
|
|
12
12
|
* If attrs type is a function (no type provided, inferring from usage), extract the return value
|
|
13
13
|
* and merge it with the existing type to hole-punch any required fields that are satisfied as
|
|
14
14
|
* a result of running attrs. Otherwise if we have a definite type then union the base props
|
|
15
15
|
* with the passed attr type to capture any intended overrides.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
type PropsSatisfiedByAttrs<T extends Attrs, Props extends object, Result extends ExecutionProps = AttrsResult<T>> = Omit<Props, keyof Result> & OptionalIntersection<Props, Result> & Partial<Omit<Result, keyof Props | 'as'>>;
|
|
18
18
|
export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = object, OuterStatics extends object = object, RuntimeInjectedProps extends ExecutionProps = object> {
|
|
19
19
|
<Props extends object = object, Statics extends object = object>(initialStyles: Styles<OuterProps & RuntimeInjectedProps & Props>, ...interpolations: Interpolation<OuterProps & RuntimeInjectedProps & Props>[]): // @ts-expect-error KnownTarget is a subset of StyledTarget<R>
|
|
20
20
|
IStyledComponent<R, ExtractAttrsTarget<R, RuntimeInjectedProps, Target>, OuterProps & Props> & OuterStatics & Statics;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnyComponent, ExecutionProps } from '../types';
|
|
3
|
-
export default function withTheme<T extends AnyComponent>(Component: T): React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<T, ExecutionProps>> & React.RefAttributes<T>> & { [key in Exclude<keyof T, T extends React.MemoExoticComponent<any> ? "propTypes" | "
|
|
3
|
+
export default function withTheme<T extends AnyComponent>(Component: T): React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<T, ExecutionProps>> & React.RefAttributes<T>> & { [key in Exclude<keyof T, T extends React.MemoExoticComponent<any> ? "propTypes" | "type" | "defaultProps" | "displayName" | "$$typeof" | "compare" : T extends React.ForwardRefExoticComponent<any> ? "propTypes" | "defaultProps" | "displayName" | "$$typeof" | "render" : "length" | "propTypes" | "type" | "contextType" | "contextTypes" | "childContextTypes" | "defaultProps" | "displayName" | "getDerivedStateFromProps" | "getDerivedStateFromError" | "getDefaultProps" | "mixins" | "name" | "prototype" | "caller" | "callee" | "arguments" | "arity">]: T[key]; };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import StyleSheet from '../sheet';
|
|
3
3
|
import { ShouldForwardProp, Stringifier } from '../types';
|
|
4
|
-
export
|
|
4
|
+
export type IStyleSheetContext = {
|
|
5
5
|
shouldForwardProp?: ShouldForwardProp<'web'>;
|
|
6
6
|
styleSheet?: StyleSheet;
|
|
7
7
|
};
|
|
8
8
|
export declare const StyleSheetContext: React.Context<IStyleSheetContext>;
|
|
9
9
|
export declare const StyleSheetConsumer: React.Consumer<IStyleSheetContext>;
|
|
10
|
-
export
|
|
10
|
+
export type IStylisContext = Stringifier | void;
|
|
11
11
|
export declare const StylisContext: React.Context<IStylisContext>;
|
|
12
12
|
export declare const StylisConsumer: React.Consumer<IStylisContext>;
|
|
13
13
|
export declare const mainSheet: StyleSheet;
|
|
@@ -15,7 +15,7 @@ export declare const mainStylis: Stringifier;
|
|
|
15
15
|
export declare function useShouldForwardProp(): ShouldForwardProp<"web"> | undefined;
|
|
16
16
|
export declare function useStyleSheet(): StyleSheet;
|
|
17
17
|
export declare function useStylis(): Stringifier;
|
|
18
|
-
export
|
|
18
|
+
export type IStyleSheetManager = React.PropsWithChildren<{
|
|
19
19
|
/**
|
|
20
20
|
* If desired, you can pass this prop to disable "speedy" insertion mode, which
|
|
21
21
|
* uses the browser [CSSOM APIs](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet).
|
|
@@ -24,9 +24,9 @@ import React from 'react';
|
|
|
24
24
|
export interface DefaultTheme {
|
|
25
25
|
[key: string]: any;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
type ThemeFn = (outerTheme?: DefaultTheme) => DefaultTheme;
|
|
28
|
+
type ThemeArgument = DefaultTheme | ThemeFn;
|
|
29
|
+
type Props = {
|
|
30
30
|
children?: React.ReactNode;
|
|
31
31
|
theme: ThemeArgument;
|
|
32
32
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { GroupedTag, Sheet, SheetOptions } from './types';
|
|
2
|
-
|
|
2
|
+
type SheetConstructorArgs = {
|
|
3
3
|
isServer?: boolean;
|
|
4
4
|
useCSSOMInjection?: boolean;
|
|
5
5
|
target?: HTMLElement;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type GlobalStylesAllocationMap = {
|
|
8
8
|
[key: string]: number;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type NamesAllocationMap = Map<string, Set<string>>;
|
|
11
11
|
/** Contains the main stylesheet logic for stringification and caching */
|
|
12
12
|
export default class StyleSheet implements Sheet {
|
|
13
13
|
gs: GlobalStylesAllocationMap;
|
|
@@ -154,10 +154,10 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
154
154
|
var SC_ATTR = typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
|
|
155
155
|
var SC_ATTR_ACTIVE = 'active';
|
|
156
156
|
var SC_ATTR_VERSION = 'data-styled-version';
|
|
157
|
-
var SC_VERSION = "5.3.
|
|
157
|
+
var SC_VERSION = "5.3.8";
|
|
158
158
|
var SPLITTER = '/*!sc*/\n';
|
|
159
159
|
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
160
|
-
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean' ? SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env !== 'undefined'
|
|
160
|
+
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
|
|
161
161
|
|
|
162
162
|
//
|
|
163
163
|
var EMPTY_ARRAY = Object.freeze([]);
|