Socket
Socket
Sign inDemoInstall

@stitches/react

Package Overview
Dependencies
Maintainers
3
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stitches/react - npm Package Compare versions

Comparing version 1.0.0-canary.9 to 1.0.0-canary.10

types/config.d.ts

2

package.json
{
"name": "@stitches/react",
"version": "1.0.0-canary.9",
"version": "1.0.0-canary.10",
"description": "The modern CSS-in-JS library",

@@ -5,0 +5,0 @@ "type": "module",

import type * as CSS from './css'
import type * as Default from './default'
import type * as Config from './config'
import type * as ThemeUtil from './theme'

@@ -17,6 +17,7 @@ import type * as Util from './util'

export type CSS<
Media = Default.Media,
Media = {},
Theme = {},
ThemeMap = Default.ThemeMap,
Utils = {}
ThemeMap = Config.DefaultThemeMap,
Utils = {},
Flat = false
> = (

@@ -101,3 +102,3 @@ // nested at-rule css styles

// unknown css declaration styles
& {
& (true extends Flat ? Record<never, never> : {
/** Unknown property. */

@@ -111,3 +112,3 @@ [K in string]: (

)
}
})
)

@@ -114,0 +115,0 @@

@@ -1,14 +0,13 @@

import type CreateStitches from './create-stitches'
import type Stitches from './stitches'
import type * as Config from './config'
import type * as CSSUtil from './css-util'
import type * as Default from './default'
import type * as StyledComponent from './styled-component'
export type { CreateStitches, Stitches }
export type CreateStitches = Config.CreateStitches
export type CSSProperties = CSSUtil.CSSProperties
export type DefaultThemeMap = Default.ThemeMap
export type DefaultThemeMap = Config.DefaultThemeMap
/** Returns a Style interface from a configuration, leveraging the given media and style map. */
export type CSS<

@@ -30,7 +29,8 @@ Config extends {

Config['themeMap'],
Config['utils']
Config['utils'],
false
>
/** Returns the properties, attributes, and children expected by a component. */
export type ComponentProps<Component> = Parameters<Component>[0]
export type ComponentProps<Component> = Component extends ((...args: any[]) => any) ? Parameters<Component>[0] : never

@@ -37,0 +37,0 @@ /** Returns a type that expects a value to be a kind of CSS property value. */

import type * as CSSUtil from './css-util'
import type * as Default from './default'
import type * as StyledComponent from './styled-component'

@@ -9,8 +8,7 @@ import type * as ThemeUtil from './theme'

export default interface Stitches<
Prefix extends string = Default.Prefix,
Media = Default.Media,
Theme = {},
ThemeMap = Default.ThemeMap,
Utils = {},
CSS extends { [prelude: string]: unknown } = CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
Prefix extends string = '',
Media extends {} = {},
Theme extends {} = {},
ThemeMap extends {} = {},
Utils extends {} = {}
> {

@@ -31,3 +29,3 @@ config: {

(style: {
[prelude: string]: CSS
[prelude: string]: CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
}): {

@@ -39,3 +37,3 @@ (): string

(style: {
[offset: string]: CSS
[offset: string]: CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
}): {

@@ -108,3 +106,3 @@ (): string

(): string
},
}
css: {

@@ -122,56 +120,49 @@ <

[K in keyof Composers]: (
Composers[K] extends string
// Strings, React Components, and Functions can be skipped over
Composers[K] extends string | React.ExoticComponent<any> | React.JSXElementConstructor<any> | Util.Function
? Composers[K]
: Composers[K] extends React.ExoticComponent<any>
? Composers[K]
: Composers[K] extends React.JSXElementConstructor<any>
? Composers[K]
: Composers[K] extends Util.Function
? Composers[K]
: Composers[K] extends {
[K2 in keyof Composers[K]]: Composers[K][K2]
}
? (
& {
/** The **variants** property sets variants.
*
* [Read Documentation](https://stitches.dev/docs/variants)
*/
variants?: {
[name: string]: {
[pair in number | string]: CSS
}
}
/** Compound variants. */
compoundVariants?: (
& (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
} & Util.WideObject
: Util.WideObject
)
& {
css: CSS
}
)[]
defaultVariants?: (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
}
: Util.WideObject
)
: CSSUtil.CSS<Media, Theme, ThemeMap, Utils, true> & {
/** The **variants** property lets you set a subclass of styles based on a key-value pair.
*
* [Read Documentation](https://stitches.dev/docs/variants)
*/
variants?: {
[Name in string]: {
[Pair in number | string]: CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
}
}
/** The **variants** property lets you to set a subclass of styles based on a combination of active variants.
*
* [Read Documentation](https://stitches.dev/docs/variants#compound-variants)
*/
compoundVariants?: (
& (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
} & Util.WideObject
: Util.WideObject
)
& {
[Prelude in keyof Composers[K]]:
Prelude extends keyof CSS | 'compoundVariants' | 'defaultVariants' | 'variants'
? unknown
: Composers[K][Prelude] extends Record<string, unknown>
? CSS
: boolean | number | string
css: CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
}
& CSS
)[]
/** The **defaultVariants** property allows you to predefine the active key-value pairs of variants.
*
* [Read Documentation](https://stitches.dev/docs/variants#default-variants)
*/
defaultVariants?: (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
}
: Util.WideObject
)
: never
} & {
[K2 in keyof Composers[K]]: K2 extends 'compoundVariants' | 'defaultVariants' | 'variants'
? unknown
: K2 extends keyof CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
? CSSUtil.CSS<Media, Theme, ThemeMap, Utils>[K2]
: unknown
}
)

@@ -183,5 +174,5 @@ }

Media,
CSS
CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
>
},
}
styled: {

@@ -206,56 +197,49 @@ <

[K in keyof Composers]: (
Composers[K] extends string
// Strings, React Components, and Functions can be skipped over
Composers[K] extends string | React.ExoticComponent<any> | React.JSXElementConstructor<any> | Util.Function
? Composers[K]
: Composers[K] extends React.ExoticComponent<any>
? Composers[K]
: Composers[K] extends React.JSXElementConstructor<any>
? Composers[K]
: Composers[K] extends Util.Function
? Composers[K]
: Composers[K] extends {
[K2 in keyof Composers[K]]: Composers[K][K2]
}
? (
& {
/** The **variants** property sets variants.
*
* [Read Documentation](https://stitches.dev/docs/variants)
*/
variants?: {
[name: string]: {
[pair in number | string]: CSS
}
}
/** Compound variants. */
compoundVariants?: (
& (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
} & Util.WideObject
: Util.WideObject
)
& {
css: CSS
}
)[]
defaultVariants?: (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
}
: Util.WideObject
)
: CSSUtil.CSS<Media, Theme, ThemeMap, Utils, true> & {
/** The **variants** property lets you set a subclass of styles based on a key-value pair.
*
* [Read Documentation](https://stitches.dev/docs/variants)
*/
variants?: {
[Name in string]: {
[Pair in number | string]: CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
}
}
/** The **variants** property lets you to set a subclass of styles based on a combination of active variants.
*
* [Read Documentation](https://stitches.dev/docs/variants#compound-variants)
*/
compoundVariants?: (
& (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
} & Util.WideObject
: Util.WideObject
)
& {
[Prelude in keyof Composers[K]]:
Prelude extends keyof CSS | 'compoundVariants' | 'defaultVariants' | 'variants'
? unknown
: Composers[K][Prelude] extends Record<string, unknown>
? CSS
: boolean | number | string
css: CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
}
& CSS
)[]
/** The **defaultVariants** property allows you to predefine the active key-value pairs of variants.
*
* [Read Documentation](https://stitches.dev/docs/variants#default-variants)
*/
defaultVariants?: (
'variants' extends keyof Composers[K]
? {
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String
}
: Util.WideObject
)
: never
} & {
[K2 in keyof Composers[K]]: K2 extends 'compoundVariants' | 'defaultVariants' | 'variants'
? unknown
: K2 extends keyof CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
? CSSUtil.CSS<Media, Theme, ThemeMap, Utils>[K2]
: unknown
}
)

@@ -267,3 +251,3 @@ }

Media,
CSS
CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
>

@@ -270,0 +254,0 @@ }

@@ -1,2 +0,1 @@

import type * as Default from './default'
import type * as React from 'react'

@@ -9,5 +8,4 @@ import type * as Util from './util'

Props = {},
Media = Default.Media,
CSS = {},
TransformedProps = TransformProps<Props, Media>
Media = {},
CSS = {}
> extends React.ForwardRefExoticComponent<

@@ -18,3 +16,3 @@ Util.Assign<

: never,
TransformedProps & { as?: Type } & { css?: CSS }
TransformProps<Props, Media> & { css?: CSS }
>

@@ -27,5 +25,5 @@ > {

: As extends React.ComponentType<infer P>
? Util.Assign<P, TransformedProps & { as: As, css?: CSS }>
? Util.Assign<P, TransformProps<Props, Media> & { as: As, css?: CSS }>
: As extends keyof JSX.IntrinsicElements
? Util.Assign<JSX.IntrinsicElements[As], TransformedProps & { as: As, css?: CSS }>
? Util.Assign<JSX.IntrinsicElements[As], TransformProps<Props, Media> & { as: As, css?: CSS }>
: never

@@ -47,9 +45,8 @@ )

Props = {},
Media = Default.Media,
CSS = {},
TransformedProps = TransformProps<Props, Media>
Media = {},
CSS = {}
> {
(
props?:
& TransformedProps
& TransformProps<Props, Media>
& {

@@ -56,0 +53,0 @@ css?: CSS

@@ -32,2 +32,2 @@ /* Utilities */

/** Widened object. */
export type WideObject = { [name in number | string]: boolean | number | string | undefined | object }
export type WideObject = { [name in number | string]: boolean | number | string | undefined | WideObject }
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc