@pandacss/types 0.0.0-dev-20230801082734 → 0.0.0-dev-20230801131515

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/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export type { ConfigResultWithHooks, PandaHooks, PandaHookable } from './hooks'
14
14
  export type { ParserResultType, ResultItem } from './parser'
15
15
  export type { Part, Parts } from './parts'
16
16
  export type { PatternConfig, PatternHelpers, PatternProperty } from './pattern'
17
- export type { RecipeConfig, RecipeVariantRecord } from './recipe'
17
+ export type { RecipeConfig, RecipeVariantRecord, SlotRecipeConfig, SlotRecipeVariantRecord } from './recipe'
18
18
  export type { Runtime } from './runtime'
19
19
  export type { AnyFunction, Artifact, Dict, RequiredBy } from './shared'
20
20
  export type { StaticCssOptions } from './static-css'
package/dist/parser.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { BoxNodeMap, BoxNodeLiteral, Unboxed } from '@pandacss/extractor'
3
3
  export type ResultItem = {
4
4
  name?: string
5
5
  data: Array<Unboxed['raw']>
6
- type?: 'object' | 'cva' | 'pattern' | 'recipe' | 'jsx-factory' | 'jsx-pattern' | 'jsx-recipe' | 'jsx'
6
+ type?: 'object' | 'cva' | 'sva' | 'pattern' | 'recipe' | 'jsx-factory' | 'jsx-pattern' | 'jsx-recipe' | 'jsx'
7
7
  box: BoxNodeMap | BoxNodeLiteral
8
8
  }
9
9
 
@@ -11,10 +11,12 @@ export type ParserResultType = {
11
11
  jsx: Set<ResultItem>
12
12
  css: Set<ResultItem>
13
13
  cva: Set<ResultItem>
14
+ sva: Set<ResultItem>
14
15
  recipe: Map<string, Set<ResultItem>>
15
16
  pattern: Map<string, Set<ResultItem>>
16
17
  filePath: string | undefined
17
18
  set: (name: 'cva' | 'css', result: ResultItem) => void
19
+ setSva: (result: ResultItem) => void
18
20
  setCva: (result: ResultItem) => void
19
21
  setJsx: (result: ResultItem) => void
20
22
  setRecipe: (name: string, result: ResultItem) => void
@@ -23,6 +25,7 @@ export type ParserResultType = {
23
25
  setFilePath: (filePath: string) => ParserResultType
24
26
  toArray: () => Array<ResultItem>
25
27
  toJSON: () => {
28
+ sva: Array<ResultItem>
26
29
  css: Array<ResultItem>
27
30
  cva: Array<ResultItem>
28
31
  recipe: Record<string, ResultItem[]>
package/dist/recipe.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { SystemStyleObject } from './system-types'
2
2
 
3
- type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
3
+ type Pretty<T> = { [K in keyof T]: T[K] } & {}
4
4
 
5
5
  type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
6
6
 
@@ -20,6 +20,10 @@ type RecipeVariantMap<T extends RecipeVariantRecord> = {
20
20
  [K in keyof T]: Array<keyof T[K]>
21
21
  }
22
22
 
23
+ /* -----------------------------------------------------------------------------
24
+ * Recipe / Standard
25
+ * -----------------------------------------------------------------------------*/
26
+
23
27
  export type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {
24
28
  __type: RecipeSelection<T>
25
29
  variantKeys: (keyof T)[]
@@ -58,7 +62,7 @@ export type RecipeDefinition<T extends RecipeVariantRecord> = {
58
62
 
59
63
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
60
64
 
61
- export type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & {
65
+ type RecipeConfigMeta = {
62
66
  /**
63
67
  * The name of the recipe.
64
68
  */
@@ -75,3 +79,59 @@ export type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> =
75
79
  */
76
80
  jsx?: Array<string | RegExp>
77
81
  }
82
+
83
+ export type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & RecipeConfigMeta
84
+
85
+ /* -----------------------------------------------------------------------------
86
+ * Recipe / Slot
87
+ * -----------------------------------------------------------------------------*/
88
+
89
+ type SlotRecord<S extends string, T> = Partial<Record<S, T>>
90
+
91
+ export type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>
92
+
93
+ export type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (
94
+ props?: RecipeSelection<T>,
95
+ ) => SlotRecord<S, string>
96
+
97
+ export type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {
98
+ variantKeys: (keyof T)[]
99
+ variantMap: RecipeVariantMap<T>
100
+ splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]
101
+ }
102
+
103
+ export type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {
104
+ css: SlotRecord<S, SystemStyleObject>
105
+ }
106
+
107
+ export type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> = {
108
+ /**
109
+ * The parts/slots of the recipe.
110
+ */
111
+ slots: S[] | Readonly<S[]>
112
+ /**
113
+ * The base styles of the recipe.
114
+ */
115
+ base?: SlotRecord<S, SystemStyleObject>
116
+ /**
117
+ * The multi-variant styles of the recipe.
118
+ */
119
+ variants?: T | SlotRecipeVariantRecord<S>
120
+ /**
121
+ * The default variants of the recipe.
122
+ */
123
+ defaultVariants?: RecipeSelection<T>
124
+ /**
125
+ * The styles to apply when a combination of variants is selected.
126
+ */
127
+ compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>
128
+ }
129
+
130
+ export type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(
131
+ config: SlotRecipeDefinition<S, T>,
132
+ ) => SlotRecipeRuntimeFn<S, T>
133
+
134
+ export type SlotRecipeConfig<
135
+ S extends string = string,
136
+ T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,
137
+ > = SlotRecipeDefinition<S, T> & RecipeConfigMeta
package/dist/theme.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { LayerStyles, TextStyles } from './composition'
2
- import type { RecipeConfig } from './recipe'
2
+ import type { RecipeConfig, SlotRecipeConfig } from './recipe'
3
3
  import type { CssKeyframes } from './system-types'
4
4
  import type { SemanticTokens, Tokens } from './tokens'
5
5
 
@@ -33,4 +33,8 @@ export type Theme = {
33
33
  * Useful for defining component styles.
34
34
  */
35
35
  recipes?: Record<string, RecipeConfig>
36
+ /**
37
+ * Multi-variant style definitions for component slots.
38
+ */
39
+ slotRecipes?: Record<string, SlotRecipeConfig>
36
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.0.0-dev-20230801082734",
3
+ "version": "0.0.0-dev-20230801131515",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -17,8 +17,8 @@
17
17
  "hookable": "5.5.3",
18
18
  "ncp": "^2.0.0",
19
19
  "pkg-types": "1.0.3",
20
- "@pandacss/extractor": "0.0.0-dev-20230801082734",
21
- "@pandacss/token-dictionary": "0.0.0-dev-20230801082734"
20
+ "@pandacss/extractor": "0.0.0-dev-20230801131515",
21
+ "@pandacss/token-dictionary": "0.0.0-dev-20230801131515"
22
22
  },
23
23
  "scripts": {
24
24
  "build": "tsx scripts/build.ts",