styled-components 6.0.0-beta.10 → 6.0.0-beta.12
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 +4 -4
- package/dist/hoc/withTheme.d.ts +1 -1
- package/dist/models/StyleSheetManager.d.ts +3 -3
- package/dist/models/ThemeProvider.d.ts +3 -3
- package/dist/sheet/Sheet.d.ts +3 -3
- package/dist/sheet/types.d.ts +1 -1
- package/dist/styled-components.browser.cjs.js +2 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +2 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +2 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +2 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +8 -7
- 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/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +20 -20
- package/dist/utils/hoist.d.ts +3 -3
- package/dist/utils/stylis.d.ts +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 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +2 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/types.d.ts +20 -20
- package/native/dist/utils/hoist.d.ts +3 -3
- package/native/dist/utils/stylis.d.ts +1 -1
- package/package.json +31 -24
|
@@ -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;
|
package/dist/hoc/withTheme.d.ts
CHANGED
|
@@ -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
|
};
|
package/dist/sheet/Sheet.d.ts
CHANGED
|
@@ -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;
|
package/dist/sheet/types.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ var SC_ATTR = (typeof process !== 'undefined' && typeof process.env !== 'undefin
|
|
|
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.12";
|
|
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'
|
|
@@ -1002,6 +1002,7 @@ function recursivelySetNamepace(compiled, namespace) {
|
|
|
1002
1002
|
// add the namespace to the start
|
|
1003
1003
|
rule.value = "".concat(namespace, " ").concat(rule.value);
|
|
1004
1004
|
// add the namespace after each comma for subsequent selectors.
|
|
1005
|
+
// @ts-expect-error we target modern browsers but intentionally transpile to ES5 for speed
|
|
1005
1006
|
rule.value = rule.value.replaceAll(',', ",".concat(namespace, " "));
|
|
1006
1007
|
rule.props = rule.props.map(function (prop) {
|
|
1007
1008
|
return "".concat(namespace, " ").concat(prop);
|