styled-components 6.4.3 → 6.4.4
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.esm.js +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.js +1 -1
- package/dist/styled-components.min.js +1 -1
- package/dist/types.d.ts +28 -29
- package/native/dist/dist/types.d.ts +28 -29
- package/native/dist/types.d.ts +28 -29
- package/package.json +1 -1
package/native/dist/types.d.ts
CHANGED
|
@@ -118,51 +118,50 @@ export interface IStyledStatics<out R extends Runtime, in out OuterProps extends
|
|
|
118
118
|
styledComponentId: R extends 'web' ? string : never;
|
|
119
119
|
warnTooManyClasses?: (R extends 'web' ? ReturnType<typeof createWarnTooManyClasses> : never) | undefined;
|
|
120
120
|
}
|
|
121
|
+
/** ExecutionProps sans as/forwardedAs, pre-resolved so call sites relate against a concrete interface. */
|
|
122
|
+
interface ThemedExecutionProps {
|
|
123
|
+
theme?: DefaultTheme | undefined;
|
|
124
|
+
}
|
|
121
125
|
/**
|
|
122
126
|
* Used by PolymorphicComponent to define prop override cascading order.
|
|
123
127
|
*/
|
|
124
128
|
export type PolymorphicComponentProps<R extends Runtime, BaseProps extends BaseObject, AsTarget extends StyledTarget<R> | (BaseProps extends {
|
|
125
129
|
as?: infer A;
|
|
126
|
-
} ? A : never) | void, ForwardedAsTarget extends StyledTarget<R> | void, AsTargetProps extends BaseObject = AsTarget extends KnownTarget ? React.ComponentPropsWithRef<AsTarget> : {}, ForwardedAsTargetProps extends BaseObject = ForwardedAsTarget extends KnownTarget ? React.ComponentPropsWithRef<ForwardedAsTarget> : {}> = OverrideStyle<NoInfer<FastOmit<Substitute<BaseProps, Substitute<ForwardedAsTargetProps, AsTargetProps>>, keyof ExecutionProps>> &
|
|
130
|
+
} ? A : never) | void, ForwardedAsTarget extends StyledTarget<R> | void, AsTargetProps extends BaseObject = AsTarget extends KnownTarget ? React.ComponentPropsWithRef<AsTarget> : {}, ForwardedAsTargetProps extends BaseObject = ForwardedAsTarget extends KnownTarget ? React.ComponentPropsWithRef<ForwardedAsTarget> : {}> = OverrideStyle<NoInfer<FastOmit<Substitute<BaseProps, Substitute<ForwardedAsTargetProps, AsTargetProps>>, keyof ExecutionProps>> & ThemedExecutionProps & {
|
|
127
131
|
as?: AsTarget;
|
|
128
132
|
forwardedAs?: ForwardedAsTarget;
|
|
129
133
|
}>;
|
|
130
134
|
/**
|
|
131
|
-
* Resolves the call-site props for one usage of a polymorphic component
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* infer with spread props (#5687), the wrapped `as` type stays assignable and
|
|
139
|
-
* optional (#5734), and BaseProps keys keep completing for plain usage (#5741).
|
|
140
|
-
* - `forwardedAs` only: substitute the forwarded target's props.
|
|
135
|
+
* Resolves the call-site props for one usage of a polymorphic component from its
|
|
136
|
+
* `as` / `forwardedAs` targets. An `as` render target substitutes that target's
|
|
137
|
+
* props and requires `as`; plain usage (or `as` being the wrapped component's own
|
|
138
|
+
* non-target type, e.g. Next.js Link's `as?: Url`) keeps Substitute-free base
|
|
139
|
+
* props so ref callbacks infer with spread props (#5687), the wrapped `as` stays
|
|
140
|
+
* assignable (#5734), and BaseProps keys keep completing (#5741); `forwardedAs`
|
|
141
|
+
* substitutes the forwarded target's props.
|
|
141
142
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
143
|
+
* The target test is `string | AnyComponent`, not `KnownTarget`: narrowing it
|
|
144
|
+
* drops custom element strings (`as="my-element"`) out of the target branch.
|
|
144
145
|
*
|
|
145
|
-
*
|
|
146
|
-
* (
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
146
|
+
* Load-bearing shape, do not simplify: two conditionals with `unknown` sibling
|
|
147
|
+
* branches (not one three-way conditional), a leading flat `{ as?; forwardedAs? }`
|
|
148
|
+
* member, and positive `extends [string | AnyComponent]` discriminants. Collapsing
|
|
149
|
+
* the conditionals, dropping the flat member, or using a `[void]` discriminant
|
|
150
|
+
* each regress plain-call-site cost, `as`-target completion, or ref-callback
|
|
151
|
+
* inference (#5687) respectively.
|
|
151
152
|
*/
|
|
152
153
|
type PolymorphicCallProps<R extends Runtime, BaseProps extends BaseObject, AsTarget extends StyledTarget<R> | (BaseProps extends {
|
|
153
154
|
as?: infer A;
|
|
154
|
-
} ? A : never) | void, ForwardedAsTarget extends StyledTarget<R> | void> =
|
|
155
|
+
} ? A : never) | void, ForwardedAsTarget extends StyledTarget<R> | void> = {
|
|
156
|
+
as?: AsTarget | undefined;
|
|
157
|
+
forwardedAs?: ForwardedAsTarget | undefined;
|
|
158
|
+
} & ([
|
|
159
|
+
AsTarget
|
|
160
|
+
] extends [string | AnyComponent] ? PolymorphicComponentProps<R, BaseProps, AsTarget, ForwardedAsTarget> & {
|
|
155
161
|
as: AsTarget;
|
|
156
|
-
} : [
|
|
157
|
-
as?: BaseProps extends {
|
|
158
|
-
as?: infer A;
|
|
159
|
-
} ? A : void;
|
|
160
|
-
forwardedAs?: BaseProps extends {
|
|
161
|
-
forwardedAs?: infer A;
|
|
162
|
-
} ? A : void;
|
|
163
|
-
}> : PolymorphicComponentProps<R, BaseProps, void, ForwardedAsTarget> & {
|
|
162
|
+
} : unknown) & ([AsTarget] extends [string | AnyComponent] ? unknown : [ForwardedAsTarget] extends [string | AnyComponent] ? PolymorphicComponentProps<R, BaseProps, void, ForwardedAsTarget> & {
|
|
164
163
|
forwardedAs: ForwardedAsTarget;
|
|
165
|
-
};
|
|
164
|
+
} : OverrideStyle<NoInfer<FastOmit<BaseProps, keyof ExecutionProps>> & ThemedExecutionProps>);
|
|
166
165
|
/**
|
|
167
166
|
* This type forms the signature for a forwardRef-enabled component
|
|
168
167
|
* that accepts the "as" prop to dynamically change the underlying
|