@stitches/react
Advanced tools
Comparing version 1.0.0-canary.6 to 1.0.0-canary.7
{ | ||
"name": "@stitches/react", | ||
"version": "1.0.0-canary.6", | ||
"version": "1.0.0-canary.7", | ||
"description": "The modern CSS-in-JS library", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -38,48 +38,46 @@ import type * as CSS from './css' | ||
& { | ||
[K in keyof Utils]?: ( | ||
K extends keyof CSSProperties | ||
? unknown | ||
: ( | ||
[K in keyof Utils]?: K extends keyof CSSProperties | ||
? unknown | ||
: Utils[K] extends (arg: infer P) => any | ||
? ( | ||
| ( | ||
Utils[K] extends (arg: infer P) => any | ||
P extends any[] | ||
? ( | ||
P extends any[] | ||
? ( | ||
$$PropertyValue extends keyof P[0] | ||
? ( | ||
| ValueByPropertyName<P[0][$$PropertyValue]> | ||
| TokenByPropertyName<P[0][$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| ThemeUtil.ScaleValue | ||
| undefined | ||
) | ||
: $$ScaleValue extends keyof P[0] | ||
? ( | ||
| TokenByScaleName<P[0][$$ScaleValue], Theme> | ||
| { scale: P[0][$$ScaleValue] } | ||
| undefined | ||
) | ||
: never | ||
)[] | ||
| P | ||
: $$PropertyValue extends keyof P | ||
? ( | ||
| ValueByPropertyName<P[$$PropertyValue]> | ||
| TokenByPropertyName<P[$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| undefined | ||
) | ||
: $$ScaleValue extends keyof P | ||
? ( | ||
| TokenByScaleName<P[$$ScaleValue], Theme> | ||
| { scale: P[$$ScaleValue] } | ||
| undefined | ||
) | ||
: never | ||
| ( | ||
$$PropertyValue extends keyof P[0] | ||
? ( | ||
| ValueByPropertyName<P[0][$$PropertyValue]> | ||
| TokenByPropertyName<P[0][$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| ThemeUtil.ScaleValue | ||
| undefined | ||
) | ||
: $$ScaleValue extends keyof P[0] | ||
? ( | ||
| TokenByScaleName<P[0][$$ScaleValue], Theme> | ||
| { scale: P[0][$$ScaleValue] } | ||
| undefined | ||
) | ||
: never | ||
)[] | ||
| P | ||
) | ||
| P | ||
: $$PropertyValue extends keyof P | ||
? ( | ||
| ValueByPropertyName<P[$$PropertyValue]> | ||
| TokenByPropertyName<P[$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| undefined | ||
) | ||
: $$ScaleValue extends keyof P | ||
? ( | ||
| TokenByScaleName<P[$$ScaleValue], Theme> | ||
| { scale: P[$$ScaleValue] } | ||
| undefined | ||
) | ||
: never | ||
) | ||
| P | ||
) | ||
) | ||
: never | ||
} | ||
@@ -105,3 +103,9 @@ // known theme styles | ||
/** Unknown property. */ | ||
[K in string]: number | string | CSS<Media, Theme, ThemeMap, Utils> | {} | undefined | ||
[K in string]: ( | ||
| number | ||
| string | ||
| CSS<Media, Theme, ThemeMap, Utils> | ||
| {} | ||
| undefined | ||
) | ||
} | ||
@@ -139,32 +143,32 @@ ) | ||
Utils[K] extends (arg: infer P) => any | ||
? P extends any[] | ||
? ( | ||
$$PropertyValue extends keyof P[0] | ||
? ( | ||
| ValueByPropertyName<P[0][$$PropertyValue]> | ||
| TokenByPropertyName<P[0][$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| ThemeUtil.ScaleValue | ||
) | ||
: $$ScaleValue extends keyof P[0] | ||
? ( | ||
| TokenByScaleName<P[0][$$ScaleValue], Theme> | ||
| ThemeUtil.ScaleValue | ||
) | ||
: never | ||
)[] | ||
: $$PropertyValue extends keyof P | ||
? ( | ||
| ValueByPropertyName<P[$$PropertyValue]> | ||
| TokenByPropertyName<P[$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| ThemeUtil.ScaleValue | ||
) | ||
: $$ScaleValue extends keyof P | ||
? ( | ||
| TokenByScaleName<P[$$ScaleValue], Theme> | ||
| ThemeUtil.ScaleValue | ||
) | ||
? P extends any[] | ||
? ( | ||
$$PropertyValue extends keyof P[0] | ||
? ( | ||
| ValueByPropertyName<P[0][$$PropertyValue]> | ||
| TokenByPropertyName<P[0][$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| ThemeUtil.ScaleValue | ||
) | ||
: $$ScaleValue extends keyof P[0] | ||
? ( | ||
| TokenByScaleName<P[0][$$ScaleValue], Theme> | ||
| ThemeUtil.ScaleValue | ||
) | ||
: never | ||
)[] | ||
: $$PropertyValue extends keyof P | ||
? ( | ||
| ValueByPropertyName<P[$$PropertyValue]> | ||
| TokenByPropertyName<P[$$PropertyValue], Theme, ThemeMap> | ||
| CSS.Globals | ||
| ThemeUtil.ScaleValue | ||
) | ||
: $$ScaleValue extends keyof P | ||
? ( | ||
| TokenByScaleName<P[$$ScaleValue], Theme> | ||
| ThemeUtil.ScaleValue | ||
) | ||
: never | ||
: never | ||
) | ||
@@ -171,0 +175,0 @@ ) |
@@ -93,3 +93,8 @@ import type * as CSSUtil from './css-util' | ||
[Scale in keyof Theme]: { | ||
[Token in keyof Theme[Scale]]: ThemeUtil.Token<Extract<Token, string | number>, string, Extract<Scale, string>, Prefix> | ||
[Token in keyof Theme[Scale]]: ThemeUtil.Token< | ||
Extract<Token, string | number>, | ||
string, | ||
Extract<Scale, string | void>, | ||
Extract<Prefix, string | void> | ||
> | ||
} | ||
@@ -162,4 +167,4 @@ } | ||
? unknown | ||
: Composers[K][Prelude] extends {} | ||
? CSS[Prelude] | ||
: Composers[K][Prelude] extends Record<string, unknown> | ||
? CSS | ||
: boolean | number | string | ||
@@ -174,4 +179,5 @@ } | ||
StyledComponent.StyledComponentType<Composers>, | ||
StyledComponent.StyledComponentProps<Composers> & { css?: CSS }, | ||
Media | ||
StyledComponent.StyledComponentProps<Composers>, | ||
Media, | ||
CSS | ||
> | ||
@@ -245,4 +251,4 @@ }, | ||
? unknown | ||
: Composers[K][Prelude] extends {} | ||
? CSS[Prelude] | ||
: Composers[K][Prelude] extends Record<string, unknown> | ||
? CSS | ||
: boolean | number | string | ||
@@ -257,6 +263,5 @@ } | ||
Type, | ||
StyledComponent.StyledComponentProps<Composers> & { | ||
css?: CSS | ||
}, | ||
Media | ||
StyledComponent.StyledComponentProps<Composers>, | ||
Media, | ||
CSS | ||
> | ||
@@ -269,8 +274,8 @@ } | ||
[Token in keyof Values[Scale]]: ThemeUtil.Token< | ||
Token, | ||
Extract<Token, number | string>, | ||
Values[Scale][Token], | ||
Scale, | ||
Prefix | ||
Extract<Scale, string | void>, | ||
Extract<Prefix, string | void> | ||
> | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
import type * as CSSUtil from './css-util' | ||
import type * as Default from './default' | ||
@@ -11,3 +10,4 @@ import type * as React from 'react' | ||
Media = Default.Media, | ||
TransformedProps = TransformProps<Omit<Props, 'css'>, Media> & { css?: Props['css'] } | ||
CSS = {}, | ||
TransformedProps = TransformProps<Props, Media> | ||
> extends React.ForwardRefExoticComponent< | ||
@@ -18,13 +18,15 @@ Util.Assign< | ||
: never, | ||
TransformedProps & { as?: Type } | ||
TransformedProps & { as?: Type } & { css?: CSS } | ||
> | ||
> { | ||
<As = Type>( | ||
props: As extends '' | ||
? { as: keyof JSX.IntrinsicElements } | ||
: As extends React.ComponentType<infer P> | ||
? Util.Assign<P, TransformedProps & { as: As }> | ||
: As extends keyof JSX.IntrinsicElements | ||
? Util.Assign<JSX.IntrinsicElements[As], TransformedProps & { as: As }> | ||
: never | ||
props: ( | ||
As extends '' | ||
? { as: keyof JSX.IntrinsicElements } | ||
: As extends React.ComponentType<infer P> | ||
? Util.Assign<P, TransformedProps & { as: As }> | ||
: As extends keyof JSX.IntrinsicElements | ||
? Util.Assign<JSX.IntrinsicElements[As], TransformedProps & { as: As }> | ||
: never | ||
) | ||
): React.ReactElement | null | ||
@@ -36,6 +38,10 @@ | ||
[$$StyledComponentType]: Type | ||
[$$StyledComponentProps]: Omit<Props, 'css'> | ||
[$$StyledComponentProps]: Props | ||
[$$StyledComponentMedia]: Media | ||
} | ||
type InferLate<CSS extends {} = {}, Props extends {} = {}> = { | ||
[K in keyof Props]: K extends 'css' ? CSS : unknown | ||
} | ||
/** Returns a new CSS Component. */ | ||
@@ -46,3 +52,4 @@ export interface CssComponent< | ||
Media = Default.Media, | ||
TransformedProps = TransformProps<Omit<Props, 'css'>, Media> & { css?: Props['css'] } | ||
CSS = {}, | ||
TransformedProps = TransformProps<Props, Media> | ||
> { | ||
@@ -53,2 +60,5 @@ ( | ||
& { | ||
css?: CSS | ||
} | ||
& { | ||
[name in number | string]: any | ||
@@ -59,3 +69,3 @@ } | ||
selector: string | ||
props: object | ||
props: {} | ||
} | ||
@@ -67,3 +77,3 @@ | ||
[$$StyledComponentType]: Type | ||
[$$StyledComponentProps]: Omit<Props, 'css'> | ||
[$$StyledComponentProps]: Props | ||
[$$StyledComponentMedia]: Media | ||
@@ -73,11 +83,12 @@ } | ||
export type TransformProps<Props, Media> = { | ||
[K in keyof Props]: | ||
| Props[K] | ||
| ( | ||
& { | ||
[KMedia in Util.Prefixed<'@', 'initial' | keyof Media>]?: Props[K] | ||
} | ||
& { | ||
[KMedia in string]: Props[K] | ||
} | ||
[K in keyof Props]: ( | ||
| Props[K] | ||
| ( | ||
& { | ||
[KMedia in Util.Prefixed<'@', 'initial' | keyof Media>]?: Props[K] | ||
} | ||
& { | ||
[KMedia in string]: Props[K] | ||
} | ||
) | ||
) | ||
@@ -84,0 +95,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
519705
10419