@pandacss/types 0.0.2 → 0.3.1

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Segun Adebayo
3
+ Copyright (c) 2023 Segun Adebayo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -114,20 +114,6 @@ type ReportMapsJSON = {
114
114
  colorsUsed: Record<string, Array<ReportItem['id']>>
115
115
  }
116
116
 
117
- type NodeRange = {
118
- startPosition: number
119
- startLineNumber: number
120
- startColumn: number
121
- endPosition: number
122
- endLineNumber: number
123
- endColumn: number
124
- }
125
-
126
- type MorphNodeJSON = {
127
- kind: string
128
- range: NodeRange
129
- }
130
-
131
117
  export type ReportItemJSON = {
132
118
  id: number
133
119
  from: string
@@ -143,8 +129,10 @@ export type ReportItemJSON = {
143
129
  box: {
144
130
  type: 'literal' | 'empty-initializer'
145
131
  value: string | number | boolean | undefined | null
146
- node: MorphNodeJSON
147
- stack: MorphNodeJSON[]
132
+ node: string
133
+ stack: string[]
134
+ line: number
135
+ column: number
148
136
  }
149
137
  }
150
138
 
@@ -152,7 +140,7 @@ export type ReportInstanceItemJSON = Pick<ReportItem, 'from' | 'type' | 'kind' |
152
140
  instanceId: number
153
141
  contains: Array<ReportItem['id']>
154
142
  value: Record<string, any>
155
- box: { type: 'map'; value: Record<string, any>; node: MorphNodeJSON; stack: MorphNodeJSON[] }
143
+ box: { type: 'map'; value: Record<string, any>; node: string; stack: string[]; line: number; column: number }
156
144
  }
157
145
 
158
146
  export type AnalysisReportJSON = {
@@ -64,8 +64,8 @@ type Placement =
64
64
  | 'BlockEnd'
65
65
 
66
66
  type Radius =
67
- | `Top${'Right' | 'Left' | 'Start' | 'End'}`
68
- | `Bottom${'Right' | 'Left' | 'Start' | 'End'}`
67
+ | `Top${'Right' | 'Left'}`
68
+ | `Bottom${'Right' | 'Left'}`
69
69
  | `Start${'Start' | 'End'}`
70
70
  | `End${'Start' | 'End'}`
71
71
 
@@ -93,6 +93,7 @@ type LayerStyleProperty =
93
93
  | 'backgroundSize'
94
94
  | `border${Placement}`
95
95
  | `border${Placement}Width`
96
+ | 'borderRadius'
96
97
  | `border${Radius}Radius`
97
98
  | `border${Placement}Color`
98
99
  | `border${Placement}Style`
@@ -1,5 +1,4 @@
1
1
  import type { AnySelector, Selectors } from './selectors'
2
- import type { Dict, StringKeyOf } from './shared'
3
2
 
4
3
  export type ConditionType = 'at-rule' | 'parent-nesting' | 'self-nesting' | 'combinator-nesting'
5
4
 
@@ -12,11 +11,6 @@ export type ConditionDetails = {
12
11
 
13
12
  export type RawCondition = ConditionDetails & { raw: string }
14
13
 
15
- export type ExtractConditions<Conditions extends Dict, Breakpoints extends Dict> =
16
- | StringKeyOf<Breakpoints>
17
- | StringKeyOf<Conditions>
18
- | 'base'
19
-
20
14
  /* -----------------------------------------------------------------------------
21
15
  * Shadowed export (in CLI): DO NOT REMOVE
22
16
  * -----------------------------------------------------------------------------*/
package/dist/config.d.ts CHANGED
@@ -1,209 +1,218 @@
1
- import type { LayerStyles, TextStyles } from './composition'
2
- import type { Conditions as TConditions } from './conditions'
3
- import type { AnyPatternConfig, PatternConfig } from './pattern'
4
- import type { AnyRecipeConfig, RecipeConfig } from './recipe'
1
+ import type { Conditions } from './conditions'
2
+ import type { PandaHooks } from './hooks'
3
+ import type { PatternConfig } from './pattern'
5
4
  import type { Extendable, RequiredBy, UnwrapExtend } from './shared'
6
5
  import type { StaticCssOptions } from './static-css'
7
- import type { CssKeyframes, GlobalStyleObject } from './system-types'
8
- import type { SemanticTokens, Tokens } from './tokens'
6
+ import type { GlobalStyleObject } from './system-types'
7
+ import type { Theme } from './theme'
9
8
  import type { UtilityConfig } from './utility'
10
9
 
11
- export type Preset = Pick<Config, 'utilities' | 'theme' | 'patterns' | 'presets' | 'conditions' | 'globalCss'>
12
-
13
- type Studio = {
14
- title: string
15
- logo: string
16
- }
17
-
18
- type Theme<RecipeVariants> = {
10
+ type StudioOptions = {
19
11
  /**
20
- * The breakpoints for your project.
21
- */
22
- breakpoints?: Record<string, string>
23
- /**
24
- * The css animation keyframes definitions.
12
+ * Used to customize the design system studio
13
+ * @default { title: 'Panda', logo: '🐼' }
25
14
  */
26
- keyframes?: CssKeyframes
15
+ studio?: {
16
+ /**
17
+ * The output directory for the design system studio when the build command is run.
18
+ */
19
+ outdir?: string
20
+ /**
21
+ * The logo url for the design system studio.
22
+ */
23
+ logo?: string
24
+ /**
25
+ * Used to inject custom html into the head or body of the studio
26
+ */
27
+ inject?: {
28
+ head?: string
29
+ body?: string
30
+ }
31
+ }
32
+ }
33
+
34
+ type PresetCore = {
27
35
  /**
28
- * The design tokens for your project.
36
+ * The css selectors or media queries shortcuts.
37
+ * @example `{ hover: "&:hover" }`
29
38
  */
30
- tokens?: Tokens
39
+ conditions: Conditions
31
40
  /**
32
- * The semantic design tokens for your project.
41
+ * The global styles for your project.
33
42
  */
34
- semanticTokens?: SemanticTokens
43
+ globalCss: GlobalStyleObject
35
44
  /**
36
- * The typography styles for your project.
45
+ * The theme configuration for your project.
37
46
  */
38
- textStyles?: TextStyles
47
+ theme: Theme
39
48
  /**
40
- * The layer styles for your project.
49
+ * The css utility definitions.
41
50
  */
42
- layerStyles?: LayerStyles
51
+ utilities: UtilityConfig
43
52
  /**
44
- * Multi-variant style definitions for your project.
45
- * Useful for defining component styles.
53
+ * Common styling or layout patterns for your project.
46
54
  */
47
- recipes?: Record<string, RecipeConfig<RecipeVariants>>
55
+ patterns: Record<string, PatternConfig>
48
56
  }
49
- type AnyTheme = Theme<Record<string, AnyRecipeConfig>>
50
57
 
51
- export type GenericConfig<RecipeVariants, PatternProps> = Omit<Config, 'theme' | 'patterns'> & {
52
- theme?: Extendable<Theme<RecipeVariants>>
53
- patterns?: Extendable<Record<string, PatternConfig<PatternProps>>>
58
+ type ExtendableOptions = {
59
+ [K in keyof PresetCore]?: Extendable<PresetCore[K]>
54
60
  }
55
61
 
56
- export type Config = {
62
+ type FileSystemOptions = {
57
63
  /**
58
- * Whether to emit the artifacts to `node_modules` as a package.
64
+ * Whether to clean the output directory before generating the css.
59
65
  * @default false
60
66
  */
61
- emitPackage?: boolean
67
+ clean?: boolean
62
68
  /**
63
- * Whether to only emit the `tokens` directory
64
- * @default false
69
+ * The output directory.
70
+ * @default 'styled-system'
65
71
  */
66
- emitTokensOnly?: boolean
72
+ outdir?: string
67
73
  /**
68
- * The namespace prefix for the generated css classes and css variables.
69
- * @default ''
74
+ * List of files glob to watch for changes.
75
+ * @default []
70
76
  */
71
- prefix?: string
77
+ include?: string[]
72
78
  /**
73
- * Whether to update the .gitignore file.
74
- * @default 'true'
79
+ * List of files glob to ignore.
80
+ * @default []
75
81
  */
76
- gitignore?: boolean
82
+ exclude?: string[]
77
83
  /**
78
- * The value separator used in the generated class names.
79
- * @default '_'
84
+ * Whether to watch for changes and regenerate the css.
85
+ * @default false
80
86
  */
81
- separator?: '_' | '=' | '-'
87
+ watch?: boolean
82
88
  /**
83
- * Used to customize the design system studio
84
- * @default { title: 'Panda', logo: '🐼' }
89
+ * Whether to use polling instead of filesystem events when watching.
90
+ * @default false
85
91
  */
86
- studio?: Partial<Studio>
92
+ poll?: boolean
93
+ /**
94
+ * The current working directory.
95
+ * @default 'process.cwd()'
96
+ */
97
+ cwd?: string
98
+ /**
99
+ * File extension for generated javascript files.
100
+ */
101
+ outExtension?: 'mjs' | 'js'
87
102
  /**
88
103
  * The log level for the built-in logger.
89
104
  * @default 'info'
90
105
  */
91
106
  logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'
107
+ }
108
+
109
+ type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik'
110
+
111
+ type JsxOptions = {
92
112
  /**
93
- * Used to create reusable config presets for your project or team.
113
+ * The framework to use for generating supercharged elements.
94
114
  */
95
- presets?: (string | Preset | Promise<Preset>)[]
115
+ jsxFramework?: JsxFramework
96
116
  /**
97
- * Whether to include css reset styles in the generated css.
98
- * @default true
117
+ * The factory name of the element
118
+ * @default 'styled'
119
+ *
120
+ * @example
121
+ * ```jsx
122
+ * <styled.button marginTop="40px">Click me</styled.button>
123
+ * ```
99
124
  */
100
- preflight?: boolean
125
+ jsxFactory?: string
126
+ }
127
+
128
+ type CssgenOptions = {
101
129
  /**
102
- * Whether to optimize the generated css.
130
+ * Whether to include css reset styles in the generated css.
103
131
  * @default true
104
132
  */
105
- optimize?: boolean
133
+ preflight?: boolean | { scope: string }
106
134
  /**
107
- * Whether to minify the generated css.
108
- * @default false
135
+ * The namespace prefix for the generated css classes and css variables.
136
+ * @default ''
109
137
  */
110
- minify?: boolean
138
+ prefix?: string | { cssVar: string; className: string }
111
139
  /**
112
- * The current working directory.
113
- * @default 'process.cwd()'
140
+ * The value separator used in the generated class names.
141
+ * @default '_'
114
142
  */
115
- cwd?: string
143
+ separator?: '_' | '=' | '-'
116
144
  /**
117
- * Whether to hash the generated class names.
118
- * This is useful if want to shorten the class names.
119
- * @default false
145
+ * Whether to optimize the generated css.
146
+ * @default true
120
147
  */
121
- hash?: boolean
148
+ optimize?: boolean
122
149
  /**
123
- * Whether to clean the output directory before generating the css.
150
+ * Whether to minify the generated css.
124
151
  * @default false
125
152
  */
126
- clean?: boolean
127
- /**
128
- * The output directory.
129
- * @default 'styled-system'
130
- */
131
- outdir?: string
153
+ minify?: boolean
132
154
  /**
133
155
  * The root selector for the css variables.
134
156
  * @default ':where(:host, :root)'
135
157
  */
136
158
  cssVarRoot?: string
137
159
  /**
138
- * List of files glob to watch for changes.
139
- * @default []
140
- */
141
- include?: string[]
142
- /**
143
- * List of files glob to ignore.
144
- * @default []
160
+ * @experimental
161
+ * Used to generate css utility classes for your project.
145
162
  */
146
- exclude?: string[]
163
+ staticCss?: StaticCssOptions
164
+ }
165
+
166
+ type CodegenOptions = {
147
167
  /**
148
- * Whether to watch for changes and regenerate the css.
168
+ * Whether to emit the artifacts to `node_modules` as a package.
149
169
  * @default false
150
170
  */
151
- watch?: boolean
171
+ emitPackage?: boolean
152
172
  /**
153
- * Whether to use polling instead of filesystem events when watching.
173
+ * Whether to only emit the `tokens` directory
154
174
  * @default false
155
175
  */
156
- poll?: boolean
157
- /**
158
- * The css selectors or media queries shortcuts.
159
- * @example `{ hover: "&:hover" }`
160
- */
161
- conditions?: Extendable<TConditions>
162
- /**
163
- * The global styles for your project.
164
- */
165
- globalCss?: Extendable<GlobalStyleObject>
166
- /**
167
- * The theme configuration for your project.
168
- */
169
- theme?: Extendable<AnyTheme>
170
- /**
171
- * The css utility definitions.
172
- */
173
- utilities?: Extendable<UtilityConfig>
174
- /**
175
- * Common styling or layout patterns for your project.
176
- */
177
- patterns?: Extendable<Record<string, AnyPatternConfig>>
178
- /**
179
- * The framework to use for generating supercharged elements.
180
- */
181
- jsxFramework?: 'react' | 'solid' | 'preact' | 'vue'
176
+ emitTokensOnly?: boolean
182
177
  /**
183
- * The factory name of the element
184
- * @default 'panda'
185
- *
186
- * @example
187
- * ```jsx
188
- * <panda.button marginTop="40px">Click me</panda.button>
189
- * ```
178
+ * Whether to hash the generated class names.
179
+ * This is useful if want to shorten the class names.
180
+ * @default false
190
181
  */
191
- jsxFactory?: string
182
+ hash?: boolean | { cssVar: boolean; className: boolean }
192
183
  /**
193
184
  * Options for the generated typescript definitions.
194
185
  */
195
186
  strictTokens?: boolean
196
187
  /**
197
- * @experimental
198
- * Used to generate css utility classes for your project.
188
+ * Whether to update the .gitignore file.
189
+ * @default 'true'
199
190
  */
200
- staticCss?: StaticCssOptions
191
+ gitignore?: boolean
192
+ }
193
+
194
+ type PresetOptions = {
201
195
  /**
202
- * File extension for generated javascript files.
196
+ * Used to create reusable config presets for your project or team.
203
197
  */
204
- outExtension?: 'mjs' | 'js'
198
+ presets?: (string | Preset | Promise<Preset>)[]
199
+ }
200
+
201
+ type HooksOptions = {
202
+ hooks?: Partial<PandaHooks>
205
203
  }
206
204
 
205
+ export type Config = StudioOptions &
206
+ ExtendableOptions &
207
+ CssgenOptions &
208
+ CodegenOptions &
209
+ FileSystemOptions &
210
+ JsxOptions &
211
+ PresetOptions &
212
+ HooksOptions
213
+
214
+ export type Preset = ExtendableOptions & PresetOptions
215
+
207
216
  export type UserConfig = UnwrapExtend<RequiredBy<Config, 'outdir' | 'cwd' | 'include'>>
208
217
 
209
218
  export type LoadConfigResult = {
@@ -0,0 +1,45 @@
1
+ import type { TokenDictionary } from '@pandacss/token-dictionary'
2
+ import type { HookKeys, Hookable } from 'hookable'
3
+ import type { LoadConfigResult, UserConfig } from './config'
4
+ import type { ParserResultType } from './parser'
5
+
6
+ type MaybeAsyncReturn = Promise<void> | void
7
+
8
+ export interface PandaHooks {
9
+ /**
10
+ * Called when the config is resolved, after all the presets are loaded and merged.
11
+ */
12
+ 'config:resolved': (conf: LoadConfigResult) => MaybeAsyncReturn
13
+ /**
14
+ * Called when the config file or one of its dependencies (imports) has changed.
15
+ */
16
+ 'config:change': (ctx: UserConfig) => MaybeAsyncReturn
17
+ /**
18
+ * Called after creating the TokenDictionary from the resolved config.
19
+ */
20
+ 'generator:tokens': (tokenDictionary: TokenDictionary) => void
21
+ /**
22
+ * Called after reading the file content but before parsing it.
23
+ */
24
+ 'parser:before': (file: string, content: string) => void
25
+ /**
26
+ * Called after the file styles are extracted and processed into the resulting ParserResult object.
27
+ */
28
+ 'parser:after': (file: string, result: ParserResultType | undefined) => void
29
+ /**
30
+ * Called after the extracted ParserResult has been transformed to a CSS string
31
+ */
32
+ 'parser:css': (file: string, css: string | undefined) => void
33
+ /**
34
+ * Called before generating the design-system CSS files (global, static, preflight, tokens, keyframes)
35
+ */
36
+ 'generator:css': (
37
+ file: 'global.css' | 'static.css' | 'reset.css' | 'tokens.css' | 'keyframes.css',
38
+ css: string,
39
+ ) => void
40
+ }
41
+
42
+ export type PandaHookable = Hookable<PandaHooks, HookKeys<PandaHooks>>
43
+ export interface ConfigResultWithHooks extends LoadConfigResult {
44
+ hooks: PandaHookable
45
+ }
package/dist/index.d.ts CHANGED
@@ -1,22 +1,24 @@
1
1
  export type {
2
- ReportInstanceItem,
3
- ReportItem,
4
- ReportItemType,
5
2
  AnalysisReport,
6
3
  AnalysisReportJSON,
4
+ ReportInstanceItem,
7
5
  ReportInstanceItemJSON,
6
+ ReportItem,
8
7
  ReportItemJSON,
8
+ ReportItemType,
9
9
  } from './analyze-report'
10
10
  export type { CompositionStyles, LayerStyles, TextStyles } from './composition'
11
- export type { ConditionDetails, Conditions, ConditionType, RawCondition } from './conditions'
12
- export type { Config, GenericConfig, LoadConfigResult, Preset, UserConfig } from './config'
13
- export type { ParserResult, ResultItem } from './parser'
11
+ export type { ConditionDetails, ConditionType, Conditions, RawCondition } from './conditions'
12
+ export type { Config, LoadConfigResult, Preset, UserConfig } from './config'
13
+ export type { ConfigResultWithHooks, PandaHooks, PandaHookable } from './hooks'
14
+ export type { ParserResultType, ResultItem } from './parser'
14
15
  export type { Part, Parts } from './parts'
15
- export type { AnyPatternConfig, PatternConfig, PatternHelpers, PatternProperty } from './pattern'
16
- export type { AnyRecipeConfig, RecipeConfig, RecipeVariantRecord } from './recipe'
16
+ export type { PatternConfig, PatternHelpers, PatternProperty } from './pattern'
17
+ export type { RecipeConfig, RecipeVariantRecord } from './recipe'
17
18
  export type { Runtime } from './runtime'
18
19
  export type { AnyFunction, Artifact, Dict, RequiredBy } from './shared'
19
20
  export type { StaticCssOptions } from './static-css'
20
21
  export type { CssKeyframes, GlobalStyleObject, SystemStyleObject } from './system-types'
22
+ export type { Theme } from './theme'
21
23
  export type { SemanticToken, SemanticTokens, Token, TokenCategory, TokenDataTypes, Tokens } from './tokens'
22
24
  export type { PropertyConfig, PropertyTransform, PropertyValues, UtilityConfig } from './utility'
package/dist/parser.d.ts CHANGED
@@ -7,17 +7,27 @@ export type ResultItem = {
7
7
  box: BoxNodeMap
8
8
  }
9
9
 
10
- export type ParserResult = {
10
+ export type ParserResultType = {
11
11
  jsx: Set<ResultItem>
12
12
  css: Set<ResultItem>
13
13
  cva: Set<ResultItem>
14
14
  recipe: Map<string, Set<ResultItem>>
15
15
  pattern: Map<string, Set<ResultItem>>
16
+ filePath: string | undefined
16
17
  set: (name: 'cva' | 'css', result: ResultItem) => void
17
18
  setCva: (result: ResultItem) => void
18
19
  setJsx: (result: ResultItem) => void
19
20
  setRecipe: (name: string, result: ResultItem) => void
20
21
  setPattern: (name: string, result: ResultItem) => void
21
22
  isEmpty: () => boolean
22
- getAll: () => Array<ResultItem>
23
+ setFilePath: (filePath: string) => ParserResultType
24
+ toArray: () => Array<ResultItem>
25
+ toJSON: () => {
26
+ css: Array<ResultItem>
27
+ cva: Array<ResultItem>
28
+ recipe: Record<string, ResultItem[]>
29
+ pattern: Record<string, ResultItem[]>
30
+ jsx: Array<ResultItem>
31
+ }
32
+ merge: (result: ParserResultType) => ParserResultType
23
33
  }
package/dist/pattern.d.ts CHANGED
@@ -14,7 +14,11 @@ export type PatternHelpers = {
14
14
  map: (value: any, fn: (value: string) => string | undefined) => any
15
15
  }
16
16
 
17
- export type PatternConfig<T> = {
17
+ type PatternProperties = Record<string, PatternProperty>
18
+
19
+ type Props<T> = Record<LiteralUnion<keyof T>, any>
20
+
21
+ export type PatternConfig<T extends PatternProperties = PatternProperties> = {
18
22
  /**
19
23
  * The description of the pattern. This will be used in the JSDoc comment.
20
24
  */
@@ -27,14 +31,11 @@ export type PatternConfig<T> = {
27
31
  /**
28
32
  * The properties of the pattern.
29
33
  */
30
- properties: T extends Record<string, PatternProperty> ? T : Record<string, PatternProperty>
34
+ properties: T
31
35
  /**
32
36
  * The css object this pattern will generate.
33
37
  */
34
- transform?: (
35
- props: T extends Record<infer Keys, PatternProperty> ? Record<Keys, any> : Record<string, PatternProperty>,
36
- helpers: PatternHelpers,
37
- ) => SystemStyleObject
38
+ transform?: (props: Props<T>, helpers: PatternHelpers) => SystemStyleObject
38
39
  /**
39
40
  * The jsx element name this pattern will generate.
40
41
  */
@@ -50,5 +51,3 @@ export type PatternConfig<T> = {
50
51
  */
51
52
  blocklist?: LiteralUnion<CssProperty>[]
52
53
  }
53
-
54
- export type AnyPatternConfig = PatternConfig<PatternProperty>
package/dist/recipe.d.ts CHANGED
@@ -4,18 +4,26 @@ type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
4
4
 
5
5
  type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
6
6
 
7
- export type RecipeVariantRecord = Record<string, Record<string, SystemStyleObject>>
7
+ export type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>
8
8
 
9
- export type RecipeSelection<T extends RecipeVariantRecord> = {
10
- [K in keyof T]?: StringToBoolean<keyof T[K]>
11
- }
9
+ export type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T
10
+ ? {}
11
+ : {
12
+ [K in keyof T]?: StringToBoolean<keyof T[K]>
13
+ }
12
14
 
13
15
  export type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string
14
16
 
15
17
  export type RecipeVariantProps<T extends RecipeVariantFn<RecipeVariantRecord>> = Pretty<Parameters<T>[0]>
16
18
 
19
+ type RecipeVariantMap<T extends RecipeVariantRecord> = {
20
+ [K in keyof T]: Array<keyof T[K]>
21
+ }
22
+
17
23
  export type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {
18
- variants: (keyof T)[]
24
+ __type: RecipeSelection<T>
25
+ variantKeys: (keyof T)[]
26
+ variantMap: RecipeVariantMap<T>
19
27
  resolve: (props: RecipeSelection<T>) => SystemStyleObject
20
28
  config: RecipeConfig<T>
21
29
  splitVariantProps<Props extends RecipeSelection<T>>(
@@ -23,11 +31,8 @@ export type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T>
23
31
  ): [RecipeSelection<T>, Pretty<Omit<Props, keyof RecipeVariantRecord>>]
24
32
  }
25
33
 
26
- export type RecipeCompoundSelection<
27
- T extends RecipeVariantRecord,
28
- Key extends Exclude<keyof T, 'css'> = Exclude<keyof T, 'css'>,
29
- > = {
30
- [K in Key]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>
34
+ export type RecipeCompoundSelection<T extends RecipeVariantRecord> = {
35
+ [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>
31
36
  }
32
37
 
33
38
  export type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {
@@ -55,7 +60,7 @@ export type RecipeDefinition<T extends RecipeVariantRecord> = {
55
60
 
56
61
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
57
62
 
58
- export type RecipeConfig<T> = RecipeDefinition<T extends RecipeVariantRecord ? T : RecipeVariantRecord> & {
63
+ export type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & {
59
64
  /**
60
65
  * The name of the recipe.
61
66
  */
@@ -72,4 +77,3 @@ export type RecipeConfig<T> = RecipeDefinition<T extends RecipeVariantRecord ? T
72
77
  */
73
78
  jsx?: Array<string | RegExp>
74
79
  }
75
- export type AnyRecipeConfig = RecipeConfig<RecipeVariantRecord>
package/dist/shared.d.ts CHANGED
@@ -1,28 +1,24 @@
1
- export type Primitive = string | number | boolean | null | undefined
1
+ type Primitive = string | number | boolean | null | undefined
2
2
 
3
3
  export type LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)
4
4
 
5
5
  export type Recursive<T> = { [key: string]: T | Recursive<T> }
6
6
 
7
- export type Entry<T> = [keyof T, T[keyof T]]
8
-
9
7
  export type Dict<T = any> = Record<string, T>
10
8
 
11
9
  export type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>
12
10
 
13
11
  export type AnyFunction<T = any> = (...args: T[]) => any
14
12
 
15
- export type StringKeyOf<T> = Extract<keyof T, string>
16
-
17
13
  type DeepPartial<T> = {
18
14
  [P in keyof T]+?: DeepPartial<T[P]>
19
15
  }
20
16
 
21
- export type Extendable<T> = T | { extend?: T | DeepPartial<T> }
17
+ export type Extendable<T extends Record<any, any>> = T | { extend?: DeepPartial<T> }
22
18
 
23
19
  type Nullable<T> = T | null | undefined
24
20
 
25
- export type UnwrapExtend<T extends Record<string, unknown>> = {
21
+ export type UnwrapExtend<T> = {
26
22
  [K in keyof T]: T[K] extends Nullable<Extendable<infer U>> ? U : T[K]
27
23
  }
28
24
 
@@ -58,7 +58,7 @@ export type JsxStyleProps = SystemProperties &
58
58
 
59
59
  type Assign<T, U> = Omit<T, keyof U> & U
60
60
 
61
- type HTMLProps = {
61
+ export type PatchedHTMLProps = {
62
62
  htmlSize?: string | number
63
63
  htmlWidth?: string | number
64
64
  htmlHeight?: string | number
@@ -66,8 +66,9 @@ type HTMLProps = {
66
66
  htmlContent?: string
67
67
  }
68
68
 
69
- type WithHTMLProps<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'> &
70
- HTMLProps
69
+ export type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'
70
+
71
+ type WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps
71
72
 
72
73
  export type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<
73
74
  WithHTMLProps<T>,
@@ -0,0 +1,36 @@
1
+ import type { LayerStyles, TextStyles } from './composition'
2
+ import type { RecipeConfig } from './recipe'
3
+ import type { CssKeyframes } from './system-types'
4
+ import type { SemanticTokens, Tokens } from './tokens'
5
+
6
+ export type Theme = {
7
+ /**
8
+ * The breakpoints for your project.
9
+ */
10
+ breakpoints?: Record<string, string>
11
+ /**
12
+ * The css animation keyframes definitions.
13
+ */
14
+ keyframes?: CssKeyframes
15
+ /**
16
+ * The design tokens for your project.
17
+ */
18
+ tokens?: Tokens
19
+ /**
20
+ * The semantic design tokens for your project.
21
+ */
22
+ semanticTokens?: SemanticTokens
23
+ /**
24
+ * The typography styles for your project.
25
+ */
26
+ textStyles?: TextStyles
27
+ /**
28
+ * The layer styles for your project.
29
+ */
30
+ layerStyles?: LayerStyles
31
+ /**
32
+ * Multi-variant style definitions for your project.
33
+ * Useful for defining component styles.
34
+ */
35
+ recipes?: Record<string, RecipeConfig>
36
+ }
package/dist/utility.d.ts CHANGED
@@ -13,7 +13,12 @@ export type PropertyValues =
13
13
  | Record<string, string>
14
14
  | ThemeFn
15
15
 
16
- export type PropertyTransform = (value: any, token: Getter) => NestedCssProperties | undefined
16
+ type TransformArgs = {
17
+ token: Getter
18
+ raw: any
19
+ }
20
+
21
+ export type PropertyTransform = (value: any, args: TransformArgs) => NestedCssProperties | undefined
17
22
 
18
23
  export type PropertyConfig = {
19
24
  /**
@@ -40,7 +45,7 @@ export type PropertyConfig = {
40
45
  /**
41
46
  * The shorthand of the property.
42
47
  */
43
- shorthand?: string
48
+ shorthand?: string | string[]
44
49
  }
45
50
 
46
51
  export type UtilityConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.0.2",
3
+ "version": "0.3.1",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -13,10 +13,10 @@
13
13
  ],
14
14
  "devDependencies": {
15
15
  "chokidar-cli": "^3.0.0",
16
- "csstype": "3.1.2"
17
- },
18
- "dependencies": {
19
- "@pandacss/extractor": "0.0.2"
16
+ "csstype": "3.1.2",
17
+ "hookable": "5.5.3",
18
+ "@pandacss/extractor": "0.3.1",
19
+ "@pandacss/token-dictionary": "0.3.1"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tsx scripts/build.ts",