Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pandacss/types

Package Overview
Dependencies
Maintainers
1
Versions
1151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pandacss/types - npm Package Compare versions

Comparing version 0.0.0-dev-20221228072806 to 0.0.0-dev-20221229135204

26

dist/composition.d.ts

@@ -1,5 +0,7 @@

import type { Conditional, NativeCssProperties, Nested } from './system-types'
import type { LiteralUnion, Primitive, Recursive } from './shared'
import type { CompositionStyleObject } from './system-types'
import type { LiteralUnion, Recursive } from './shared'
export type Composition<Value = any> = {
type Cond = Record<string, string>
export type Token<Value = any> = {
value: Value

@@ -44,10 +46,6 @@ description?: string

type TCondition = Record<string, string>
export type TextStyle<Conditions extends Cond = {}> = CompositionStyleObject<Conditions, TextStyleProperty>
export type TextStyle<T extends TCondition = TCondition> = Nested<{
[K in TextStyleProperty]?: Conditional<T, K extends keyof NativeCssProperties ? NativeCssProperties[K] : Primitive>
}>
export type TextStyles<T extends Cond = {}> = Recursive<Token<TextStyle<T>>>
export type TextStyles<T extends TCondition = TCondition> = Recursive<Composition<TextStyle<T>>>
/* -----------------------------------------------------------------------------

@@ -106,9 +104,3 @@ * Layer styles

export type LayerStyle<Conditions extends TCondition = TCondition> = Nested<{
[K in LayerStyleProperty]?: Conditional<
Conditions,
K extends keyof NativeCssProperties ? NativeCssProperties[K] : Primitive
>
}>
export type LayerStyles<Conditions extends TCondition = TCondition> = Recursive<Composition<LayerStyle<Conditions>>>
export type LayerStyle<Conditions extends Cond = {}> = CompositionStyleObject<Conditions, LayerStyleProperty>
export type LayerStyles<Conditions extends Cond = {}> = Recursive<Token<LayerStyle<Conditions>>>

@@ -7,3 +7,3 @@ export type { ConditionDetails, ConditionType, Conditions, RawCondition, RecursiveCondition } from './conditions'

export type { RecipeConfig, RecipeVariant } from './recipe'
export type { Composition, TextStyles, LayerStyles } from './composition'
export type { TextStyles, LayerStyles } from './composition'
export type { Token, TokenCategory, TokenDataTypes, Tokens, SemanticToken, SemanticTokens } from './tokens'

@@ -10,0 +10,0 @@ export type { Dict, RequiredBy, AnyFunction } from './shared'

import type * as CSS from './csstype'
type Loose<T = string> = T & { __type?: never }
type Dict<T = unknown> = Record<string, T>
type NeverType = { __type?: 'never' }
type String = string & {}
type Number = number & {}
// list of aria states selectors

@@ -43,8 +45,8 @@ type AriaAttributes =

| '[data-placeholder-shown]'
| `[data-part=${string}']`
| `[data-attr=${string}']`
| `[data-placement=${string}']`
| `[data-theme=${string}']`
| `[data-size=${string}']`
| `[data-state=${string}']`
| `[data-part=${string}]`
| `[data-attr=${string}]`
| `[data-placement=${string}]`
| `[data-theme=${string}]`
| `[data-size=${string}]`
| `[data-state=${string}]`
| '[data-empty]'

@@ -58,24 +60,12 @@ | '[data-loading]'

type Selectors = `&${CSS.Pseudos | DataAttributes | AriaAttributes}` | `${DataAttributes} &` | `${AriaAttributes} &`
type AttributeSelector = `&${CSS.Pseudos | DataAttributes | AriaAttributes}`
type ParentSelector = `${DataAttributes | AriaAttributes} &`
type AnySelector = `${string}&` | `&${string}`
/**
* We currently allow group css properties for better maintainability.
*/
type Grouped<T> = {
selectors?: {
[key in Selectors | Loose]?: T
}
'@media'?: {
[query: string]: T
}
'@container'?: {
[query: string]: T
}
'@supports'?: {
[query: string]: T
}
}
type Selectors = AttributeSelector | ParentSelector
export type Nested<T> = T & {
[key in Selectors | Loose]?: Nested<T> | Loose<string | number | boolean>
type ContainerProperties = {
container?: string
containerType?: 'size' | 'inline-size' | String
containerName?: string
}

@@ -87,18 +77,16 @@

type ContainerProperties = {
container?: string
containerType?: 'size' | 'inline-size' | Loose
containerName?: string
type CssVarProperties = {
[key in `--${string}`]?: string | number
}
export type NativeCssProperties = CSS.PropertiesFallback<Loose<string | number>> & ContainerProperties
export type NativeCssProperties = CSS.PropertiesFallback<String | Number> & ContainerProperties & CssVarProperties
export type NativeCssProperty = keyof NativeCssProperties
export type CssProperties = NativeCssProperties & {
[property: string]: string | number | boolean | Record<string, any> | undefined
}
export type CssProperties = NativeCssProperties & CssVarProperties
export type CssKeyframes = {
[time: string]: CssProperties
[name: string]: {
[time: string]: CssProperties
}
}

@@ -110,7 +98,7 @@

type TCondition = Record<string, string>
type Cond = Record<string, string>
export type Conditional<C extends TCondition, V> =
export type Conditional<C extends Cond, V> =
| V
| V[] // responsive array
| Array<V | null>
| {

@@ -120,38 +108,68 @@ [K in keyof C]?: Conditional<C, V>

type NestedConditional<C extends TCondition, V> = {
[K in keyof V]?: Conditional<C, V[K]>
/* -----------------------------------------------------------------------------
* Groupings and Conditions
* -----------------------------------------------------------------------------*/
/**
* Group properties for better maintainability
*/
type Grouped<T> = T & {
selectors?: {
[key in Selectors]?: T
}
'@media'?: {
[query: string]: T
}
'@container'?: {
[query: string]: T
}
'@supports'?: {
[query: string]: T
}
}
/**
* Support arbitrary nesting of selectors
*/
type Nested<C extends Cond, P> = P & {
[K in Selectors | keyof C]?: Nested<C, P>
} & {
[K in AnySelector]?: Nested<C, P>
}
/* -----------------------------------------------------------------------------
* Mixed css properties (native + conditional + custom properties)
C - condition record
P - custom properties or utilities
S - strict mode? true or false
* -----------------------------------------------------------------------------*/
type UnionOf<Key extends string, Native extends Record<Key, any>, Custom> = Custom extends NeverType
? Native[Key]
: Key extends keyof Custom
? Native[Key] | Custom[Key]
: Native[Key]
type NativeCssValue<T> = T extends NativeCssProperty ? NativeCssProperties[T] : never
type EitherOf<Key extends string, Native extends Record<Key, any>, Custom> = Key extends keyof Custom
? Custom[Key]
: Native[Key]
type NativeProperties<Conditions extends Cond, PropTypes extends Dict, Overrides extends Dict> = {
[K in Exclude<NativeCssProperty, keyof PropTypes | keyof Overrides>]?: Conditional<Conditions, NativeCssProperties[K]>
}
type StrictCssProperties<P extends Record<string, any> = NeverType, Strict extends boolean = false> = {
[Key in NativeCssProperty]?: true extends Strict
? EitherOf<Key, NativeCssProperties, P>
: UnionOf<Key, NativeCssProperties, P>
type CustomProperties<
Conditions extends Cond,
PropTypes extends Dict,
StrictMode extends boolean,
Overrides extends Dict,
> = {
[K in Exclude<keyof PropTypes, keyof Overrides>]?: Conditional<
Conditions,
true extends StrictMode ? PropTypes[K] : PropTypes[K] | NativeCssValue<K>
>
}
type CustomCssProperties<P extends Record<string, any> = NeverType> = {
[Key in keyof Omit<P, NativeCssProperty>]?: P[Key]
type GenericProperties<Conditions extends Cond> = {
[key: string]: Conditional<Conditions, boolean | String | Number | undefined>
}
type MixedCssProperties<
C extends TCondition = TCondition,
P extends Record<string, any> = NeverType,
S extends boolean = false,
> = NestedConditional<C, StrictCssProperties<P, S>> &
NestedConditional<C, CustomCssProperties<P>> & {
[Key in keyof C]?: MixedCssProperties<Omit<C, Key>, P, S>
}
type Css<Conditions extends Cond, PropTypes extends Dict, StrictMode extends boolean, Overrides extends Dict> =
| (Partial<Overrides> &
NativeProperties<Conditions, PropTypes, Overrides> &
CustomProperties<Conditions, PropTypes, StrictMode, Overrides>)
| GenericProperties<Conditions>

@@ -162,24 +180,40 @@ /* -----------------------------------------------------------------------------

export type NestedCssProperties = Nested<CssProperties>
export type NestedCssProperties = Nested<{}, CssProperties>
export type StyleObject<
C extends TCondition = TCondition,
P extends Record<string, any> = NeverType,
S extends boolean = false,
> = Nested<MixedCssProperties<C, P, S>> | Grouped<MixedCssProperties<C, P, S>>
Conditions extends Cond = {},
PropTypes extends Dict = {},
StrictMode extends boolean = false,
Overrides extends Dict = {},
> = Grouped<Nested<Conditions, Css<Conditions, PropTypes, StrictMode, Overrides>>>
export type JSXStyleProperties<
C extends TCondition = TCondition,
P extends Record<string, any> = NeverType,
S extends boolean = false,
> = Nested<MixedCssProperties<C, P, S>> & {
css?: JSXStyleProperties<C, P, S>
type WithJsxStyleProps<P> = P & {
css?: P
sx?: P
}
export type JsxStyleProps<
Conditions extends Cond = {},
PropTypes extends Dict = {},
StrictMode extends boolean = false,
Overrides extends Dict = {},
> = WithJsxStyleProps<StyleObject<Conditions, PropTypes, StrictMode, Overrides>>
export type GlobalStyleObject<
C extends TCondition = TCondition,
P extends Record<string, any> = NeverType,
S extends boolean = false,
Conditions extends Cond = {},
PropTypes extends Dict = {},
StrictMode extends boolean = false,
Overrides extends Dict = {},
> = {
[selector: string]: Nested<MixedCssProperties<C, P, S>>
[selector: string]: StyleObject<Conditions, PropTypes, StrictMode, Overrides>
}
export type CompositionStyleObject<Conditions extends Cond, PropTypes> = Nested<
Conditions,
{
[K in Extract<PropTypes, string>]?: Conditional<
Conditions,
K extends NativeCssProperty ? NativeCssProperties[K] : unknown
>
}
>
{
"name": "@pandacss/types",
"version": "0.0.0-dev-20221228072806",
"version": "0.0.0-dev-20221229135204",
"description": "The types for css panda",

@@ -5,0 +5,0 @@ "main": "dist/index.d.ts",

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