@pandacss/types 0.15.1 → 0.15.3

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.
@@ -2,7 +2,7 @@ import type { BoxNodeEmptyInitializer, BoxNodeLiteral, BoxNodeMap } from '@panda
2
2
  import type { Config } from './config'
3
3
 
4
4
  export type ReportItemType = 'object' | 'cva' | 'pattern' | 'recipe' | 'jsx' | 'jsx-factory'
5
- export type ReportItem = {
5
+ export interface ReportItem {
6
6
  id: number
7
7
  from: string
8
8
  type: ReportItemType
@@ -21,14 +21,14 @@ export type ReportItem = {
21
21
  * An instance is either a component usage or a function usage
22
22
  * @example an instance name could be 'Button', 'css', 'panda.div', 'vstack', ...
23
23
  */
24
- export type ReportInstanceItem = Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> & {
24
+ export interface ReportInstanceItem extends Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> {
25
25
  instanceId: number
26
26
  contains: Array<ReportItem['id']>
27
27
  value: Record<string, any>
28
28
  box: BoxNodeMap
29
29
  }
30
30
 
31
- export type ReportMaps = {
31
+ export interface ReportMaps {
32
32
  byInstanceOfKind: Map<'function' | 'component', Set<ReportInstanceItem['instanceId']>>
33
33
  byPropertyName: Map<string, Set<ReportItem['id']>>
34
34
  byCategory: Map<string, Set<ReportItem['id']>>
@@ -42,7 +42,7 @@ export type ReportMaps = {
42
42
  colorsUsed: Map<string, Set<ReportItem['id']>>
43
43
  }
44
44
 
45
- export type ReportCounts = {
45
+ export interface ReportCounts {
46
46
  filesWithTokens: number
47
47
  propNameUsed: number
48
48
  tokenUsed: number
@@ -55,8 +55,11 @@ export type ReportCounts = {
55
55
  colorsUsed: number
56
56
  }
57
57
 
58
- export type MostUsedItem = { key: string; count: number }
59
- export type ReportStats = {
58
+ export interface MostUsedItem {
59
+ key: string
60
+ count: number
61
+ }
62
+ export interface ReportStats {
60
63
  filesWithMostInstance: Record<string, number>
61
64
  filesWithMostPropValueCombinations: Record<string, number>
62
65
  mostUseds: {
@@ -74,7 +77,7 @@ export type ReportStats = {
74
77
  }
75
78
  }
76
79
 
77
- export type ReportDetails = {
80
+ export interface ReportDetails {
78
81
  counts: ReportCounts
79
82
  stats: ReportStats
80
83
  details: {
@@ -87,7 +90,7 @@ export type ReportDetails = {
87
90
  }
88
91
  }
89
92
 
90
- type FileSizes = {
93
+ interface FileSizes {
91
94
  normal: string
92
95
  minified: string
93
96
  gzip: {
@@ -96,11 +99,11 @@ type FileSizes = {
96
99
  }
97
100
  }
98
101
 
99
- export type AnalysisReport = ReportDetails & {
102
+ export interface AnalysisReport extends ReportDetails {
100
103
  fileSizes: FileSizes
101
104
  }
102
105
 
103
- type ReportMapsJSON = {
106
+ interface ReportMapsJSON {
104
107
  byInstanceOfKind: Record<'function' | 'component', Array<ReportInstanceItem['instanceId']>>
105
108
  byPropertyName: Record<string, Array<ReportItem['id']>>
106
109
  byCategory: Record<string, Array<ReportItem['id']>>
@@ -114,7 +117,7 @@ type ReportMapsJSON = {
114
117
  colorsUsed: Record<string, Array<ReportItem['id']>>
115
118
  }
116
119
 
117
- export type ReportItemJSON = {
120
+ export interface ReportItemJSON {
118
121
  id: number
119
122
  from: string
120
123
  type: ReportItemType
@@ -136,14 +139,14 @@ export type ReportItemJSON = {
136
139
  }
137
140
  }
138
141
 
139
- export type ReportInstanceItemJSON = Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> & {
142
+ export interface ReportInstanceItemJSON extends Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> {
140
143
  instanceId: number
141
144
  contains: Array<ReportItem['id']>
142
145
  value: Record<string, any>
143
146
  box: { type: 'map'; value: Record<string, any>; node: string; stack: string[]; line: number; column: number }
144
147
  }
145
148
 
146
- export type AnalysisReportJSON = {
149
+ export interface AnalysisReportJSON {
147
150
  counts: ReportCounts
148
151
  stats: ReportStats
149
152
  details: {
@@ -1,10 +1,10 @@
1
1
  import type { CompositionStyleObject } from './system-types'
2
2
 
3
- type Recursive<T> = {
3
+ interface Recursive<T> {
4
4
  [key: string]: Recursive<T> | T
5
5
  }
6
6
 
7
- export type Token<Value = any> = {
7
+ export interface Token<Value = any> {
8
8
  value: Value
9
9
  description?: string
10
10
  }
@@ -104,7 +104,7 @@ export type LayerStyle = CompositionStyleObject<LayerStyleProperty>
104
104
 
105
105
  export type LayerStyles = Recursive<Token<LayerStyle>>
106
106
 
107
- export type CompositionStyles = {
107
+ export interface CompositionStyles {
108
108
  textStyles: TextStyles
109
109
  layerStyles: LayerStyles
110
110
  }
@@ -2,22 +2,28 @@ import type { AnySelector, Selectors } from './selectors'
2
2
 
3
3
  export type ConditionType = 'at-rule' | 'parent-nesting' | 'self-nesting' | 'combinator-nesting'
4
4
 
5
- export type ConditionDetails = {
5
+ export interface ConditionDetails {
6
6
  type: ConditionType
7
7
  value: string
8
8
  name?: string
9
9
  rawValue?: string
10
10
  }
11
11
 
12
- export type RawCondition = ConditionDetails & { raw: string }
12
+ export interface RawCondition extends ConditionDetails {
13
+ raw: string
14
+ }
13
15
 
14
16
  /* -----------------------------------------------------------------------------
15
17
  * Shadowed export (in CLI): DO NOT REMOVE
16
18
  * -----------------------------------------------------------------------------*/
17
19
 
18
- export type Conditions = {
20
+ export interface Conditions {
19
21
  [condition: string]: string
20
22
  }
23
+ export interface ExtendableConditions {
24
+ [condition: string]: string | Conditions | undefined
25
+ extend?: Conditions | undefined
26
+ }
21
27
 
22
28
  export type Condition = string
23
29
 
package/dist/config.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import type { TSConfig } from 'pkg-types'
2
- import type { Conditions } from './conditions'
2
+ import type { Conditions, ExtendableConditions } from './conditions'
3
3
  import type { PandaHooks } from './hooks'
4
4
  import type { PatternConfig } from './pattern'
5
- import type { Extendable, RequiredBy, UnwrapExtend } from './shared'
5
+ import type { RequiredBy } from './shared'
6
6
  import type { StaticCssOptions } from './static-css'
7
- import type { GlobalStyleObject } from './system-types'
8
- import type { Theme } from './theme'
9
- import type { UtilityConfig } from './utility'
7
+ import type { ExtendableGlobalStyleObject, GlobalStyleObject } from './system-types'
8
+ import type { ExtendableTheme, Theme } from './theme'
9
+ import type { ExtendableUtilityConfig, UtilityConfig } from './utility'
10
10
 
11
11
  export type { TSConfig }
12
12
 
@@ -14,7 +14,7 @@ export type CascadeLayer = 'reset' | 'base' | 'tokens' | 'recipes' | 'utilities'
14
14
 
15
15
  export type CascadeLayers = Record<CascadeLayer, string>
16
16
 
17
- type StudioOptions = {
17
+ interface StudioOptions {
18
18
  /**
19
19
  * Used to customize the design system studio
20
20
  * @default { title: 'Panda', logo: '🐼' }
@@ -38,7 +38,11 @@ type StudioOptions = {
38
38
  }
39
39
  }
40
40
 
41
- type PresetCore = {
41
+ interface Patterns {
42
+ [pattern: string]: PatternConfig
43
+ }
44
+
45
+ interface PresetCore {
42
46
  /**
43
47
  * The css selectors or media queries shortcuts.
44
48
  * @example `{ hover: "&:hover" }`
@@ -62,11 +66,43 @@ type PresetCore = {
62
66
  patterns: Record<string, PatternConfig>
63
67
  }
64
68
 
65
- type ExtendableOptions = {
66
- [K in keyof PresetCore]?: Extendable<PresetCore[K]>
69
+ interface ExtendablePatterns {
70
+ [pattern: string]: PatternConfig | Patterns | undefined
71
+ extend?: Patterns | undefined
67
72
  }
68
73
 
69
- type FileSystemOptions = {
74
+ export interface ExtendableOptions {
75
+ /**
76
+ * The css selectors or media queries shortcuts.
77
+ * @example `{ hover: "&:hover" }`
78
+ */
79
+ conditions?: ExtendableConditions
80
+ /**
81
+ * The global styles for your project.
82
+ */
83
+ globalCss?: ExtendableGlobalStyleObject
84
+ /**
85
+ * The theme configuration for your project.
86
+ */
87
+ theme?: ExtendableTheme
88
+ /**
89
+ * The css utility definitions.
90
+ */
91
+ utilities?: ExtendableUtilityConfig
92
+ /**
93
+ * Common styling or layout patterns for your project.
94
+ */
95
+ patterns?: ExtendablePatterns
96
+ }
97
+
98
+ export interface OutdirImportMap {
99
+ css: string
100
+ recipes: string
101
+ patterns: string
102
+ jsx?: string
103
+ }
104
+
105
+ interface FileSystemOptions {
70
106
  /**
71
107
  * Whether to clean the output directory before generating the css.
72
108
  * @default false
@@ -77,6 +113,19 @@ type FileSystemOptions = {
77
113
  * @default 'styled-system'
78
114
  */
79
115
  outdir?: string
116
+ /**
117
+ * Allows you to customize the import paths for the generated outdir.
118
+ * @default
119
+ * ```js
120
+ * {
121
+ * css: 'styled-system/css',
122
+ * recipes: 'styled-system/recipes',
123
+ * patterns: 'styled-system/patterns',
124
+ * jsx: 'styled-system/jsx',
125
+ * }
126
+ * ```
127
+ */
128
+ importMap?: OutdirImportMap
80
129
  /**
81
130
  * List of files glob to watch for changes.
82
131
  * @default []
@@ -111,7 +160,7 @@ type FileSystemOptions = {
111
160
 
112
161
  type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik'
113
162
 
114
- type JsxOptions = {
163
+ interface JsxOptions {
115
164
  /**
116
165
  * The framework to use for generating supercharged elements.
117
166
  */
@@ -152,7 +201,7 @@ type JsxOptions = {
152
201
  jsxStyleProps?: 'all' | 'minimal' | 'none'
153
202
  }
154
203
 
155
- type CssgenOptions = {
204
+ interface CssgenOptions {
156
205
  /**
157
206
  * Whether to include css reset styles in the generated css.
158
207
  * @default true
@@ -195,7 +244,7 @@ type CssgenOptions = {
195
244
  syntax?: 'template-literal' | 'object-literal'
196
245
  }
197
246
 
198
- type CodegenOptions = {
247
+ interface CodegenOptions {
199
248
  /**
200
249
  * Whether to emit the artifacts to `node_modules` as a package.
201
250
  * @default false
@@ -244,7 +293,7 @@ type CodegenOptions = {
244
293
  forceConsistentTypeExtension?: boolean
245
294
  }
246
295
 
247
- type PresetOptions = {
296
+ interface PresetOptions {
248
297
  /**
249
298
  * Used to create reusable config presets for your project or team.
250
299
  */
@@ -256,29 +305,32 @@ type PresetOptions = {
256
305
  eject?: boolean
257
306
  }
258
307
 
259
- type HooksOptions = {
308
+ interface HooksOptions {
260
309
  hooks?: Partial<PandaHooks>
261
310
  }
262
311
 
263
- export type Config = StudioOptions &
264
- ExtendableOptions &
265
- CssgenOptions &
266
- CodegenOptions &
267
- FileSystemOptions &
268
- JsxOptions &
269
- PresetOptions &
270
- HooksOptions
312
+ export interface Config
313
+ extends StudioOptions,
314
+ ExtendableOptions,
315
+ CssgenOptions,
316
+ CodegenOptions,
317
+ FileSystemOptions,
318
+ JsxOptions,
319
+ PresetOptions,
320
+ HooksOptions {}
271
321
 
272
- export type Preset = ExtendableOptions & PresetOptions
322
+ export interface Preset extends ExtendableOptions, PresetOptions {}
273
323
 
274
- export type UserConfig = UnwrapExtend<RequiredBy<Config, 'outdir' | 'cwd' | 'include'>>
324
+ export interface UserConfig
325
+ extends Partial<PresetCore>,
326
+ RequiredBy<Omit<Config, keyof PresetCore>, 'outdir' | 'cwd' | 'include'> {}
275
327
 
276
- export type PathMapping = {
328
+ export interface PathMapping {
277
329
  pattern: RegExp
278
330
  paths: string[]
279
331
  }
280
332
 
281
- export type ConfigTsOptions = {
333
+ export interface ConfigTsOptions {
282
334
  baseUrl?: string | undefined
283
335
  pathMappings: PathMapping[]
284
336
  }
package/dist/index.d.ts CHANGED
@@ -9,7 +9,16 @@ export type {
9
9
  } from './analyze-report'
10
10
  export type { CompositionStyles, LayerStyles, TextStyles } from './composition'
11
11
  export type { ConditionDetails, ConditionType, Conditions, RawCondition } from './conditions'
12
- export type { Config, ConfigTsOptions, LoadConfigResult, Preset, UserConfig, TSConfig, CascadeLayers } from './config'
12
+ export type {
13
+ Config,
14
+ ConfigTsOptions,
15
+ LoadConfigResult,
16
+ Preset,
17
+ UserConfig,
18
+ TSConfig,
19
+ CascadeLayers,
20
+ OutdirImportMap,
21
+ } from './config'
13
22
  export type { ConfigResultWithHooks, PandaHooks, PandaHookable } from './hooks'
14
23
  export type { ParserResultType, ResultItem } from './parser'
15
24
  export type { Part, Parts } from './parts'
package/dist/parser.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import type { BoxNodeMap, BoxNodeLiteral, Unboxed, BoxNodeArray } from '@pandacss/extractor'
2
2
 
3
- export type ResultItem = {
3
+ export interface ResultItem {
4
4
  name?: string
5
5
  data: Array<Unboxed['raw']>
6
6
  type?: 'object' | 'cva' | 'sva' | 'pattern' | 'recipe' | 'jsx-factory' | 'jsx-pattern' | 'jsx-recipe' | 'jsx'
7
7
  box: BoxNodeMap | BoxNodeLiteral | BoxNodeArray
8
8
  }
9
9
 
10
- export type ParserResultType = {
10
+ export interface ParserResultType {
11
11
  jsx: Set<ResultItem>
12
12
  css: Set<ResultItem>
13
13
  cva: Set<ResultItem>
package/dist/parts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type Part = {
1
+ export interface Part {
2
2
  selector: string
3
3
  }
4
4
 
package/dist/pattern.d.ts CHANGED
@@ -10,7 +10,7 @@ export type PatternProperty =
10
10
  | { type: 'token'; value: TokenCategory; property?: CssProperty }
11
11
  | { type: 'string' | 'boolean' | 'number' }
12
12
 
13
- export type PatternHelpers = {
13
+ export interface PatternHelpers {
14
14
  map: (value: any, fn: (value: string) => string | undefined) => any
15
15
  }
16
16
 
@@ -18,7 +18,7 @@ export type PatternProperties = Record<string, PatternProperty>
18
18
 
19
19
  type Props<T> = Record<LiteralUnion<keyof T>, any>
20
20
 
21
- export type PatternConfig<T extends PatternProperties = PatternProperties> = {
21
+ export interface PatternConfig<T extends PatternProperties = PatternProperties> {
22
22
  /**
23
23
  * The description of the pattern. This will be used in the JSDoc comment.
24
24
  */
@@ -5,7 +5,7 @@ import type { CssProperties } from './system-types'
5
5
  * Shadowed export (in CLI): DO NOT REMOVE
6
6
  * -----------------------------------------------------------------------------*/
7
7
 
8
- export type PropertyTypes = {}
8
+ export interface PropertyTypes {}
9
9
 
10
10
  export type PropertyValue<K extends string> = K extends keyof PropertyTypes
11
11
  ? ConditionalValue<PropertyTypes[K]>
package/dist/recipe.d.ts CHANGED
@@ -26,7 +26,7 @@ type RecipeVariantMap<T extends RecipeVariantRecord> = {
26
26
  * Recipe / Standard
27
27
  * -----------------------------------------------------------------------------*/
28
28
 
29
- export type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {
29
+ export interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {
30
30
  __type: RecipeSelection<T>
31
31
  variantKeys: (keyof T)[]
32
32
  variantMap: RecipeVariantMap<T>
@@ -37,15 +37,17 @@ export type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T>
37
37
  ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]
38
38
  }
39
39
 
40
- export type RecipeCompoundSelection<T extends RecipeVariantRecord> = {
41
- [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>
40
+ type OneOrMore<T> = T | Array<T>
41
+
42
+ export type RecipeCompoundSelection<T> = {
43
+ [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>>
42
44
  }
43
45
 
44
- export type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {
46
+ export type RecipeCompoundVariant<T> = T & {
45
47
  css: SystemStyleObject
46
48
  }
47
49
 
48
- export type RecipeDefinition<T extends RecipeVariantRecord> = {
50
+ export interface RecipeDefinition<T extends RecipeVariantRecord> {
49
51
  /**
50
52
  * The base styles of the recipe.
51
53
  */
@@ -53,7 +55,7 @@ export type RecipeDefinition<T extends RecipeVariantRecord> = {
53
55
  /**
54
56
  * The multi-variant styles of the recipe.
55
57
  */
56
- variants?: T | RecipeVariantRecord
58
+ variants?: T
57
59
  /**
58
60
  * The default variants of the recipe.
59
61
  */
@@ -61,12 +63,12 @@ export type RecipeDefinition<T extends RecipeVariantRecord> = {
61
63
  /**
62
64
  * The styles to apply when a combination of variants is selected.
63
65
  */
64
- compoundVariants?: Array<RecipeCompoundVariant<T>>
66
+ compoundVariants?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]
65
67
  }
66
68
 
67
69
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
68
70
 
69
- type RecipeConfigMeta = {
71
+ interface RecipeConfigMeta {
70
72
  /**
71
73
  * The name of the recipe.
72
74
  */
@@ -84,7 +86,9 @@ type RecipeConfigMeta = {
84
86
  jsx?: Array<string | RegExp>
85
87
  }
86
88
 
87
- export type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & RecipeConfigMeta
89
+ export interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>
90
+ extends RecipeDefinition<T>,
91
+ RecipeConfigMeta {}
88
92
 
89
93
  /* -----------------------------------------------------------------------------
90
94
  * Recipe / Slot
@@ -98,18 +102,19 @@ export type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord>
98
102
  props?: RecipeSelection<T>,
99
103
  ) => SlotRecord<S, string>
100
104
 
101
- export type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {
105
+ export interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>
106
+ extends SlotRecipeVariantFn<S, T> {
102
107
  raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>
103
108
  variantKeys: (keyof T)[]
104
109
  variantMap: RecipeVariantMap<T>
105
110
  splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]
106
111
  }
107
112
 
108
- export type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {
113
+ export type SlotRecipeCompoundVariant<S extends string, T> = T & {
109
114
  css: SlotRecord<S, SystemStyleObject>
110
115
  }
111
116
 
112
- export type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> = {
117
+ export interface SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> {
113
118
  /**
114
119
  * The parts/slots of the recipe.
115
120
  */
@@ -121,7 +126,7 @@ export type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRe
121
126
  /**
122
127
  * The multi-variant styles of the recipe.
123
128
  */
124
- variants?: T | SlotRecipeVariantRecord<S>
129
+ variants?: T
125
130
  /**
126
131
  * The default variants of the recipe.
127
132
  */
@@ -129,7 +134,7 @@ export type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRe
129
134
  /**
130
135
  * The styles to apply when a combination of variants is selected.
131
136
  */
132
- compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>
137
+ compoundVariants?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]
133
138
  }
134
139
 
135
140
  export type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(
package/dist/runtime.d.ts CHANGED
@@ -4,7 +4,7 @@ interface Watcher {
4
4
  close(): Promise<void>
5
5
  }
6
6
 
7
- type InputOptions = {
7
+ interface InputOptions {
8
8
  include: string[]
9
9
  exclude?: string[]
10
10
  cwd?: string
package/dist/shared.d.ts CHANGED
@@ -2,7 +2,9 @@ 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
- export type Recursive<T> = { [key: string]: T | Recursive<T> }
5
+ export interface Recursive<T> {
6
+ [key: string]: T | Recursive<T>
7
+ }
6
8
 
7
9
  export type Dict<T = any> = Record<string, T>
8
10
 
@@ -10,19 +12,8 @@ export type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pi
10
12
 
11
13
  export type AnyFunction<T = any> = (...args: T[]) => any
12
14
 
13
- type DeepPartialObject<T extends object> = {
14
- [K in keyof T]?: DeepPartial<T[K]>
15
- }
16
- export type DeepPartial<T> = T extends object ? DeepPartialObject<T> : T
17
-
18
- export type Extendable<T extends Record<any, any>> = T | { extend?: DeepPartial<T> }
19
-
20
15
  type Nullable<T> = T | null | undefined
21
16
 
22
- export type UnwrapExtend<T> = {
23
- [K in keyof T]: T[K] extends Nullable<Extendable<infer U>> ? U : T[K]
24
- }
25
-
26
17
  export type Artifact = Nullable<{
27
18
  dir?: string[]
28
19
  files: Array<{
@@ -1,4 +1,4 @@
1
- type CssRule = {
1
+ interface CssRule {
2
2
  /**
3
3
  * The css properties to generate utilities for.
4
4
  * @example ['margin', 'padding']
@@ -24,7 +24,7 @@ type RecipeRule =
24
24
  responsive?: boolean
25
25
  } & { [variant: string]: boolean | string[] })
26
26
 
27
- export type StaticCssOptions = {
27
+ export interface StaticCssOptions {
28
28
  /**
29
29
  * The css utility classes to generate.
30
30
  */
@@ -11,9 +11,9 @@ type Number = number & {}
11
11
 
12
12
  export type CssProperty = keyof PropertiesFallback
13
13
 
14
- export type CssProperties = PropertiesFallback<String | Number> & CssVarProperties
14
+ export interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {}
15
15
 
16
- export type CssKeyframes = {
16
+ export interface CssKeyframes {
17
17
  [name: string]: {
18
18
  [time: string]: CssProperties
19
19
  }
@@ -27,7 +27,7 @@ type MinimalNested<P> = {
27
27
  [K in keyof Conditions]?: Nested<P>
28
28
  }
29
29
 
30
- type GenericProperties = {
30
+ interface GenericProperties {
31
31
  [key: string]: ConditionalValue<String | Number | boolean>
32
32
  }
33
33
 
@@ -39,9 +39,13 @@ export type NestedCssProperties = Nested<CssProperties>
39
39
 
40
40
  export type SystemStyleObject = Nested<(SystemProperties | GenericProperties) & CssVarProperties>
41
41
 
42
- export type GlobalStyleObject = {
42
+ export interface GlobalStyleObject {
43
43
  [selector: string]: SystemStyleObject
44
44
  }
45
+ export interface ExtendableGlobalStyleObject {
46
+ [selector: string]: SystemStyleObject | undefined
47
+ extend?: GlobalStyleObject | undefined
48
+ }
45
49
 
46
50
  export type CompositionStyleObject<Property extends string> = Nested<{
47
51
  [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown
@@ -50,7 +54,9 @@ export type CompositionStyleObject<Property extends string> = Nested<{
50
54
  /* -----------------------------------------------------------------------------
51
55
  * Jsx style props
52
56
  * -----------------------------------------------------------------------------*/
53
- type WithCss = { css?: SystemStyleObject }
57
+ interface WithCss {
58
+ css?: SystemStyleObject
59
+ }
54
60
  type StyleProps = SystemProperties & MinimalNested<SystemStyleObject>
55
61
 
56
62
  export type JsxStyleProps = StyleProps & WithCss
@@ -61,7 +67,7 @@ export type Assign<T, U> = {
61
67
  [K in keyof T]: K extends keyof U ? U[K] : T[K]
62
68
  } & U
63
69
 
64
- export type PatchedHTMLProps = {
70
+ export interface PatchedHTMLProps {
65
71
  htmlWidth?: string | number
66
72
  htmlHeight?: string | number
67
73
  htmlTranslate?: 'yes' | 'no' | undefined
package/dist/theme.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { RecipeConfig, SlotRecipeConfig } from './recipe'
3
3
  import type { CssKeyframes } from './system-types'
4
4
  import type { SemanticTokens, Tokens } from './tokens'
5
5
 
6
- export type Theme = {
6
+ export interface Theme {
7
7
  /**
8
8
  * The breakpoints for your project.
9
9
  */
@@ -38,3 +38,19 @@ export type Theme = {
38
38
  */
39
39
  slotRecipes?: Record<string, SlotRecipeConfig>
40
40
  }
41
+
42
+ interface PartialTheme extends Omit<Theme, 'recipes' | 'slotRecipes'> {
43
+ /**
44
+ * Multi-variant style definitions for your project.
45
+ * Useful for defining component styles.
46
+ */
47
+ recipes?: Record<string, Partial<RecipeConfig>>
48
+ /**
49
+ * Multi-variant style definitions for component slots.
50
+ */
51
+ slotRecipes?: Record<string, Partial<SlotRecipeConfig>>
52
+ }
53
+
54
+ export interface ExtendableTheme extends Theme {
55
+ extend?: PartialTheme | undefined
56
+ }
package/dist/tokens.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { Recursive } from './shared'
2
2
 
3
3
  export type TokenStatus = 'deprecated' | 'experimental' | 'new'
4
4
 
5
- export type Token<Value = any> = {
5
+ export interface Token<Value = any> {
6
6
  value: Value
7
7
  description?: string
8
8
  type?: string
@@ -18,7 +18,8 @@ type RecursiveToken<C extends string, V> =
18
18
  [K in C]: RecursiveToken<C, V>
19
19
  }
20
20
 
21
- export type SemanticToken<Value = string, Condition extends string = string> = Token<RecursiveToken<Condition, Value>>
21
+ export interface SemanticToken<Value = string, Condition extends string = string>
22
+ extends Token<RecursiveToken<Condition, Value>> {}
22
23
 
23
24
  /* -----------------------------------------------------------------------------
24
25
  * Token data types
@@ -36,13 +37,13 @@ type BorderStyle =
36
37
  | 'ridge'
37
38
  | 'solid'
38
39
 
39
- type Border = {
40
+ interface Border {
40
41
  color: string
41
42
  width: string | number
42
43
  style: BorderStyle
43
44
  }
44
45
 
45
- type Shadow = {
46
+ interface Shadow {
46
47
  offsetX: number
47
48
  offsetY: number
48
49
  blur: number
@@ -51,7 +52,7 @@ type Shadow = {
51
52
  inset?: boolean
52
53
  }
53
54
 
54
- type Gradient = {
55
+ interface Gradient {
55
56
  type: 'linear' | 'radial'
56
57
  placement: string | number
57
58
  stops:
@@ -62,9 +63,12 @@ type Gradient = {
62
63
  | Array<string>
63
64
  }
64
65
 
65
- type Asset = { type: 'url' | 'svg'; value: string }
66
+ interface Asset {
67
+ type: 'url' | 'svg'
68
+ value: string
69
+ }
66
70
 
67
- export type TokenDataTypes = {
71
+ export interface TokenDataTypes {
68
72
  zIndex: string | number
69
73
  opacity: string | number
70
74
  colors: string
package/dist/utility.d.ts CHANGED
@@ -16,14 +16,14 @@ export type PropertyValues =
16
16
  | Record<string, string>
17
17
  | ThemeFn
18
18
 
19
- type TransformArgs = {
19
+ interface TransformArgs {
20
20
  token: TokenFn
21
21
  raw: any
22
22
  }
23
23
 
24
24
  export type PropertyTransform = (value: any, args: TransformArgs) => NestedCssProperties | undefined
25
25
 
26
- export type PropertyConfig = {
26
+ export interface PropertyConfig {
27
27
  /**
28
28
  * @internal
29
29
  * The cascade layer to which the property belongs
@@ -54,3 +54,11 @@ export type PropertyConfig = {
54
54
  export type UtilityConfig = {
55
55
  [property in LiteralUnion<CssProperty>]?: PropertyConfig
56
56
  }
57
+
58
+ type UtilityConfigWithExtend = {
59
+ [pattern in LiteralUnion<CssProperty>]?: PropertyConfig | UtilityConfig | undefined
60
+ }
61
+
62
+ export type ExtendableUtilityConfig = UtilityConfigWithExtend & {
63
+ extend?: UtilityConfig | undefined
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -17,7 +17,7 @@
17
17
  "hookable": "5.5.3",
18
18
  "ncp": "^2.0.0",
19
19
  "pkg-types": "1.0.3",
20
- "@pandacss/extractor": "0.15.1"
20
+ "@pandacss/extractor": "0.15.3"
21
21
  },
22
22
  "scripts": {
23
23
  "build": "tsx scripts/build.ts",