@pandacss/types 0.0.0-dev-20230417092334 → 0.0.0-dev-20230417175111

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/config.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { LayerStyles, TextStyles } from './composition'
2
2
  import type { Conditions as TConditions } from './conditions'
3
- import type { PatternConfig } from './pattern'
4
- import type { AnyRecipeConfig } from './recipe'
3
+ import type { AnyPatternConfig, PatternConfig } from './pattern'
4
+ import type { AnyRecipeConfig, RecipeConfig } from './recipe'
5
5
  import type { Extendable, RequiredBy, UnwrapExtend } from './shared'
6
6
  import type { StaticCssOptions } from './static-css'
7
7
  import type { CssKeyframes, GlobalStyleObject } from './system-types'
@@ -15,6 +15,44 @@ type Studio = {
15
15
  logo: string
16
16
  }
17
17
 
18
+ type Theme<RecipeVariants> = {
19
+ /**
20
+ * The breakpoints for your project.
21
+ */
22
+ breakpoints?: Record<string, string>
23
+ /**
24
+ * The css animation keyframes definitions.
25
+ */
26
+ keyframes?: CssKeyframes
27
+ /**
28
+ * The design tokens for your project.
29
+ */
30
+ tokens?: Tokens
31
+ /**
32
+ * The semantic design tokens for your project.
33
+ */
34
+ semanticTokens?: SemanticTokens
35
+ /**
36
+ * The typography styles for your project.
37
+ */
38
+ textStyles?: TextStyles
39
+ /**
40
+ * The layer styles for your project.
41
+ */
42
+ layerStyles?: LayerStyles
43
+ /**
44
+ * Multi-variant style definitions for your project.
45
+ * Useful for defining component styles.
46
+ */
47
+ recipes?: Record<string, RecipeConfig<RecipeVariants>>
48
+ }
49
+ type AnyTheme = Theme<Record<string, AnyRecipeConfig>>
50
+
51
+ export type GenericConfig<RecipeVariants, PatternProps> = Omit<Config, 'theme' | 'patterns'> & {
52
+ theme?: Extendable<Theme<RecipeVariants>>
53
+ patterns?: Extendable<Record<string, PatternConfig<PatternProps>>>
54
+ }
55
+
18
56
  export type Config = {
19
57
  /**
20
58
  * Whether to emit the artifacts to `node_modules` as a package.
@@ -103,37 +141,7 @@ export type Config = {
103
141
  /**
104
142
  * The theme configuration for your project.
105
143
  */
106
- theme?: Extendable<{
107
- /**
108
- * The breakpoints for your project.
109
- */
110
- breakpoints?: Record<string, string>
111
- /**
112
- * The css animation keyframes definitions.
113
- */
114
- keyframes?: CssKeyframes
115
- /**
116
- * The design tokens for your project.
117
- */
118
- tokens?: Tokens
119
- /**
120
- * The semantic design tokens for your project.
121
- */
122
- semanticTokens?: SemanticTokens
123
- /**
124
- * The typography styles for your project.
125
- */
126
- textStyles?: TextStyles
127
- /**
128
- * The layer styles for your project.
129
- */
130
- layerStyles?: LayerStyles
131
- /**
132
- * Multi-variant style definitions for your project.
133
- * Useful for defining component styles.
134
- */
135
- recipes?: Record<string, AnyRecipeConfig>
136
- }>
144
+ theme?: Extendable<AnyTheme>
137
145
  /**
138
146
  * The css utility definitions.
139
147
  */
@@ -141,7 +149,7 @@ export type Config = {
141
149
  /**
142
150
  * Common styling or layout patterns for your project.
143
151
  */
144
- patterns?: Extendable<Record<string, PatternConfig>>
152
+ patterns?: Extendable<Record<string, AnyPatternConfig>>
145
153
  /**
146
154
  * The framework to use for generating supercharged elements.
147
155
  * @default 'react'
package/dist/index.d.ts CHANGED
@@ -9,10 +9,10 @@ export type {
9
9
  } from './analyze-report'
10
10
  export type { CompositionStyles, LayerStyles, TextStyles } from './composition'
11
11
  export type { ConditionDetails, Conditions, ConditionType, RawCondition } from './conditions'
12
- export type { Config, LoadConfigResult, Preset, UserConfig } from './config'
12
+ export type { Config, GenericConfig, LoadConfigResult, Preset, UserConfig } from './config'
13
13
  export type { ParserResult, ResultItem } from './parser'
14
14
  export type { Part, Parts } from './parts'
15
- export type { PatternConfig, PatternHelpers, PatternProperty } from './pattern'
15
+ export type { AnyPatternConfig, PatternConfig, PatternHelpers, PatternProperty } from './pattern'
16
16
  export type { AnyRecipeConfig, RecipeConfig, RecipeVariantRecord } from './recipe'
17
17
  export type { Runtime } from './runtime'
18
18
  export type { AnyFunction, Artifact, Dict, RequiredBy } from './shared'
package/dist/pattern.d.ts CHANGED
@@ -12,7 +12,7 @@ export type PatternHelpers = {
12
12
  map: (value: any, fn: (value: string) => string | undefined) => any
13
13
  }
14
14
 
15
- export type PatternConfig = {
15
+ export type PatternConfig<T> = {
16
16
  /**
17
17
  * The description of the pattern. This will be used in the JSDoc comment.
18
18
  */
@@ -25,11 +25,14 @@ export type PatternConfig = {
25
25
  /**
26
26
  * The properties of the pattern.
27
27
  */
28
- properties: Record<string, PatternProperty>
28
+ properties: T extends Record<string, PatternProperty> ? T : Record<string, PatternProperty>
29
29
  /**
30
30
  * The css object this pattern will generate.
31
31
  */
32
- transform?: (props: Record<string, any>, helpers: PatternHelpers) => SystemStyleObject
32
+ transform?: (
33
+ props: T extends Record<infer Keys, PatternProperty> ? Record<Keys, any> : Record<string, PatternProperty>,
34
+ helpers: PatternHelpers,
35
+ ) => SystemStyleObject
33
36
  /**
34
37
  * The jsx element name this pattern will generate.
35
38
  */
@@ -45,3 +48,5 @@ export type PatternConfig = {
45
48
  */
46
49
  blocklist?: LiteralUnion<NativeCssProperty>[]
47
50
  }
51
+
52
+ export type AnyPatternConfig = PatternConfig<PatternProperty>
package/dist/recipe.d.ts CHANGED
@@ -52,7 +52,7 @@ export type RecipeDefinition<T extends RecipeVariantRecord> = {
52
52
 
53
53
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
54
54
 
55
- export type RecipeConfig<T extends RecipeVariantRecord> = RecipeDefinition<T> & {
55
+ export type RecipeConfig<T> = RecipeDefinition<T extends RecipeVariantRecord ? T : RecipeVariantRecord> & {
56
56
  /**
57
57
  * The name of the recipe.
58
58
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.0.0-dev-20230417092334",
3
+ "version": "0.0.0-dev-20230417175111",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -16,7 +16,7 @@
16
16
  "csstype": "3.1.2"
17
17
  },
18
18
  "dependencies": {
19
- "@pandacss/extractor": "0.0.0-dev-20230417092334"
19
+ "@pandacss/extractor": "0.0.0-dev-20230417175111"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tsx scripts/build.ts",