@pandacss/types 0.0.0-dev-20221122153914 → 0.0.0-dev-20221124070053

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.
@@ -0,0 +1,9 @@
1
+ export type { ConditionDetails, ConditionType, Conditions, RawCondition, RecursiveCondition } from './conditions'
2
+ export type { Config, UserConfig } from './config'
3
+ export type { PropertyConfig, PropertyTransform, PropertyValues, UtilityConfig } from './utility'
4
+ export type { StyleObject, CssKeyframes } from './system-types'
5
+ export type { PatternConfig, PatternProperty, TransformHelpers } from './pattern'
6
+ export type { RecipeConfig, RecipeVariant } from './recipe'
7
+ export type { Composition, TextStyles, LayerStyles } from './composition'
8
+ export type { Token, TokenCategory, TokenDataTypes, Tokens, SemanticToken, SemanticTokens } from './tokens'
9
+ export type { Dict, RequiredBy, AnyFunction } from './shared'
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.0.0-dev-20221122153914",
3
+ "version": "0.0.0-dev-20221124070053",
4
4
  "description": "The types for css panda",
5
- "main": "src/index.d.ts",
5
+ "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
7
7
  "sideEffects": false,
8
8
  "publishConfig": {
@@ -12,7 +12,12 @@
12
12
  "src"
13
13
  ],
14
14
  "devDependencies": {
15
- "csstype": "3.1.1"
15
+ "csstype": "3.1.1",
16
+ "chokidar-cli": "^3.0.0"
16
17
  },
17
- "scripts": {}
18
+ "scripts": {
19
+ "build": "tsx scripts/build.ts",
20
+ "build-fast": "tsx scripts/build.ts",
21
+ "dev": "chokidar -c 'pnpm build' src"
22
+ }
18
23
  }
@@ -1,15 +1,16 @@
1
- import type { PandaConditionalValue, Properties } from './panda-csstype'
1
+ import type { Conditional, NativeCssProperties, Nested } from './system-types'
2
+ import type { LiteralUnion, Primitive, Recursive } from './shared'
2
3
 
3
- export type Composition<V = any> = {
4
- value: V
4
+ export type Composition<Value = any> = {
5
+ value: Value
5
6
  description?: string
6
7
  }
7
8
 
8
- type Nested<T> = {
9
- [key: string]: T | Nested<T>
10
- }
9
+ /* -----------------------------------------------------------------------------
10
+ * Text styles
11
+ * -----------------------------------------------------------------------------*/
11
12
 
12
- type TextStyleProperty =
13
+ type TextStyleProperty = LiteralUnion<
13
14
  | 'fontSize'
14
15
  | 'fontSizeAdjust'
15
16
  | 'fontVariationSettings'
@@ -38,13 +39,19 @@ type TextStyleProperty =
38
39
  | 'textOrientation'
39
40
  | 'textOverflow'
40
41
  | 'textRendering'
41
- | (string & {})
42
+ >
42
43
 
43
44
  type TCondition = Record<string, string>
44
45
 
45
- type TextStyle<Conditions extends TCondition = TCondition> = {
46
- [K in TextStyleProperty]?: PandaConditionalValue<Conditions, Properties[K] | (string & {})>
47
- }
46
+ export type TextStyle<T extends TCondition = TCondition> = Nested<{
47
+ [K in TextStyleProperty]?: Conditional<T, K extends keyof NativeCssProperties ? NativeCssProperties[K] : Primitive>
48
+ }>
49
+
50
+ export type TextStyles<T extends TCondition = TCondition> = Recursive<Composition<TextStyle<T>>>
51
+
52
+ /* -----------------------------------------------------------------------------
53
+ * Layer styles
54
+ * -----------------------------------------------------------------------------*/
48
55
 
49
56
  type Placement =
50
57
  | 'Top'
@@ -64,7 +71,7 @@ type Radius =
64
71
  | `Start${'Start' | 'End'}`
65
72
  | `End${'Start' | 'End'}`
66
73
 
67
- type LayerStyleProperty =
74
+ type LayerStyleProperty = LiteralUnion<
68
75
  | 'background'
69
76
  | 'backgroundColor'
70
77
  | 'backgroundImage'
@@ -93,14 +100,13 @@ type LayerStyleProperty =
93
100
  | `border${Placement}Style`
94
101
  | 'padding'
95
102
  | `padding${Placement}`
96
- | 'margin'
97
- | `margin${Placement}`
98
- | (string & {})
99
-
100
- type LayerStyle<Conditions extends TCondition = TCondition> = {
101
- [K in LayerStyleProperty]?: PandaConditionalValue<Conditions, Properties[K]>
102
- }
103
+ >
103
104
 
104
- export type TextStyles<Conditions extends TCondition = TCondition> = Nested<Composition<TextStyle<Conditions>>>
105
+ export type LayerStyle<Conditions extends TCondition = TCondition> = Nested<{
106
+ [K in LayerStyleProperty]?: Conditional<
107
+ Conditions,
108
+ K extends keyof NativeCssProperties ? NativeCssProperties[K] : Primitive
109
+ >
110
+ }>
105
111
 
106
- export type LayerStyles<Conditions extends TCondition = TCondition> = Nested<Composition<LayerStyle<Conditions>>>
112
+ export type LayerStyles<Conditions extends TCondition = TCondition> = Recursive<Composition<LayerStyle<Conditions>>>
@@ -0,0 +1,25 @@
1
+ import type { Dict, StringKeyOf } from './shared'
2
+
3
+ export type ConditionType = 'at-rule' | 'parent-nesting' | 'self-nesting' | 'combinator-nesting'
4
+
5
+ export type ConditionDetails = {
6
+ type: ConditionType
7
+ value: string
8
+ [key: string]: string
9
+ }
10
+
11
+ export type RawCondition = ConditionDetails & { raw: string }
12
+
13
+ export type Conditions = {
14
+ [condition: string]: string
15
+ }
16
+
17
+ export type RecursiveCondition<T extends string, C extends string> =
18
+ | T
19
+ | { [K in C]?: RecursiveCondition<T, Exclude<C, K>> }
20
+
21
+ export type ExtractConditions<Conditions extends Dict, Breakpoints extends Dict> =
22
+ | StringKeyOf<Breakpoints>
23
+ | StringKeyOf<Conditions>
24
+ | 'base'
25
+ | '_'
@@ -1,10 +1,10 @@
1
1
  import type { LayerStyles, TextStyles } from './composition'
2
2
  import type { Conditions as TConditions } from './conditions'
3
- import type { Keyframes, GlobalCss } from './panda-csstype'
3
+ import type { CssKeyframes, GlobalStyleObject } from './system-types'
4
4
  import type { PatternConfig } from './pattern'
5
5
  import type { RecipeConfig } from './recipe'
6
- import type { Dict, RequiredBy } from './shared'
7
- import type { PartialTokens, SemanticTokens } from './tokens'
6
+ import type { Dict, RequiredBy, StringKeyOf } from './shared'
7
+ import type { SemanticTokens, Tokens as PartialTokens } from './tokens'
8
8
  import type { UtilityConfig } from './utility'
9
9
  import type { ClassGeneratorOptions } from './generator'
10
10
 
@@ -88,11 +88,11 @@ export type Config<
88
88
  /**
89
89
  * The css animation keyframes definitions.
90
90
  */
91
- keyframes?: Keyframes
91
+ keyframes?: CssKeyframes
92
92
  /**
93
93
  * The global styles for your project.
94
94
  */
95
- globalCss?: GlobalCss
95
+ globalCss?: GlobalStyleObject
96
96
  /**
97
97
  * The design tokens for your project.
98
98
  */
@@ -100,7 +100,7 @@ export type Config<
100
100
  /**
101
101
  * The semantic design tokens for your project.
102
102
  */
103
- semanticTokens?: SemanticTokens<keyof Conditions | keyof Breakpoints | 'base' | '_'>
103
+ semanticTokens?: SemanticTokens<StringKeyOf<Conditions> | StringKeyOf<Breakpoints> | 'base' | '_'>
104
104
  /**
105
105
  * The typography styles for your project.
106
106
  */