@pandacss/types 0.0.0-dev-20230605172509 → 0.0.0-dev-20230607103128

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.
@@ -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,103 +1,128 @@
1
- import type { LayerStyles, TextStyles } from './composition'
2
1
  import type { Conditions as TConditions } from './conditions'
3
- import type { AnyPatternConfig, PatternConfig } from './pattern'
4
- import type { AnyRecipeConfig, RecipeConfig } from './recipe'
2
+ import type { PatternConfig } from './pattern'
5
3
  import type { Extendable, RequiredBy, UnwrapExtend } from './shared'
6
4
  import type { StaticCssOptions } from './static-css'
7
- import type { CssKeyframes, GlobalStyleObject } from './system-types'
8
- import type { SemanticTokens, Tokens } from './tokens'
5
+ import type { GlobalStyleObject } from './system-types'
6
+ import type { Theme } from './theme'
9
7
  import type { UtilityConfig } from './utility'
10
8
 
11
- export type Preset = Pick<Config, 'utilities' | 'theme' | 'patterns' | 'presets' | 'conditions' | 'globalCss'>
12
-
13
- type Studio = {
14
- title: string
15
- logo: string
9
+ type StudioOptions = {
10
+ /**
11
+ * Used to customize the design system studio
12
+ * @default { title: 'Panda', logo: '🐼' }
13
+ */
14
+ studio?: {
15
+ title?: string
16
+ logo?: string
17
+ }
16
18
  }
17
19
 
18
- type Theme<RecipeVariants> = {
20
+ type ExtendableOptions = {
19
21
  /**
20
- * The breakpoints for your project.
22
+ * The css selectors or media queries shortcuts.
23
+ * @example `{ hover: "&:hover" }`
21
24
  */
22
- breakpoints?: Record<string, string>
25
+ conditions?: Extendable<TConditions>
23
26
  /**
24
- * The css animation keyframes definitions.
27
+ * The global styles for your project.
25
28
  */
26
- keyframes?: CssKeyframes
29
+ globalCss?: Extendable<GlobalStyleObject>
27
30
  /**
28
- * The design tokens for your project.
31
+ * The theme configuration for your project.
29
32
  */
30
- tokens?: Tokens
33
+ theme?: Extendable<Theme>
31
34
  /**
32
- * The semantic design tokens for your project.
35
+ * The css utility definitions.
33
36
  */
34
- semanticTokens?: SemanticTokens
37
+ utilities?: Extendable<UtilityConfig>
35
38
  /**
36
- * The typography styles for your project.
39
+ * Common styling or layout patterns for your project.
37
40
  */
38
- textStyles?: TextStyles
41
+ patterns?: Extendable<Record<string, PatternConfig>>
42
+ }
43
+
44
+ type FileSystemOptions = {
39
45
  /**
40
- * The layer styles for your project.
46
+ * Whether to clean the output directory before generating the css.
47
+ * @default false
41
48
  */
42
- layerStyles?: LayerStyles
49
+ clean?: boolean
43
50
  /**
44
- * Multi-variant style definitions for your project.
45
- * Useful for defining component styles.
51
+ * The output directory.
52
+ * @default 'styled-system'
46
53
  */
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
-
56
- export type Config = {
54
+ outdir?: string
57
55
  /**
58
- * Whether to emit the artifacts to `node_modules` as a package.
59
- * @default false
56
+ * List of files glob to watch for changes.
57
+ * @default []
60
58
  */
61
- emitPackage?: boolean
59
+ include?: string[]
62
60
  /**
63
- * Whether to only emit the `tokens` directory
64
- * @default false
61
+ * List of files glob to ignore.
62
+ * @default []
65
63
  */
66
- emitTokensOnly?: boolean
64
+ exclude?: string[]
67
65
  /**
68
- * The namespace prefix for the generated css classes and css variables.
69
- * @default ''
66
+ * Whether to watch for changes and regenerate the css.
67
+ * @default false
70
68
  */
71
- prefix?: string
69
+ watch?: boolean
72
70
  /**
73
- * Whether to update the .gitignore file.
74
- * @default 'true'
71
+ * Whether to use polling instead of filesystem events when watching.
72
+ * @default false
75
73
  */
76
- gitignore?: boolean
74
+ poll?: boolean
77
75
  /**
78
- * The value separator used in the generated class names.
79
- * @default '_'
76
+ * The current working directory.
77
+ * @default 'process.cwd()'
80
78
  */
81
- separator?: '_' | '=' | '-'
79
+ cwd?: string
82
80
  /**
83
- * Used to customize the design system studio
84
- * @default { title: 'Panda', logo: '🐼' }
81
+ * File extension for generated javascript files.
85
82
  */
86
- studio?: Partial<Studio>
83
+ outExtension?: 'mjs' | 'js'
87
84
  /**
88
85
  * The log level for the built-in logger.
89
86
  * @default 'info'
90
87
  */
91
88
  logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'
89
+ }
90
+
91
+ type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik'
92
+
93
+ type JsxOptions = {
92
94
  /**
93
- * Used to create reusable config presets for your project or team.
95
+ * The framework to use for generating supercharged elements.
94
96
  */
95
- presets?: (string | Preset | Promise<Preset>)[]
97
+ jsxFramework?: JsxFramework
98
+ /**
99
+ * The factory name of the element
100
+ * @default 'styled'
101
+ *
102
+ * @example
103
+ * ```jsx
104
+ * <styled.button marginTop="40px">Click me</styled.button>
105
+ * ```
106
+ */
107
+ jsxFactory?: string
108
+ }
109
+
110
+ type CssgenOptions = {
96
111
  /**
97
112
  * Whether to include css reset styles in the generated css.
98
113
  * @default true
99
114
  */
100
115
  preflight?: boolean | { scope: string }
116
+ /**
117
+ * The namespace prefix for the generated css classes and css variables.
118
+ * @default ''
119
+ */
120
+ prefix?: string
121
+ /**
122
+ * The value separator used in the generated class names.
123
+ * @default '_'
124
+ */
125
+ separator?: '_' | '=' | '-'
101
126
  /**
102
127
  * Whether to optimize the generated css.
103
128
  * @default true
@@ -108,103 +133,62 @@ export type Config = {
108
133
  * @default false
109
134
  */
110
135
  minify?: boolean
111
- /**
112
- * The current working directory.
113
- * @default 'process.cwd()'
114
- */
115
- cwd?: string
116
- /**
117
- * Whether to hash the generated class names.
118
- * This is useful if want to shorten the class names.
119
- * @default false
120
- */
121
- hash?: boolean
122
- /**
123
- * Whether to clean the output directory before generating the css.
124
- * @default false
125
- */
126
- clean?: boolean
127
- /**
128
- * The output directory.
129
- * @default 'styled-system'
130
- */
131
- outdir?: string
132
136
  /**
133
137
  * The root selector for the css variables.
134
138
  * @default ':where(:host, :root)'
135
139
  */
136
140
  cssVarRoot?: string
137
141
  /**
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 []
142
+ * @experimental
143
+ * Used to generate css utility classes for your project.
145
144
  */
146
- exclude?: string[]
145
+ staticCss?: StaticCssOptions
146
+ }
147
+
148
+ type CodegenOptions = {
147
149
  /**
148
- * Whether to watch for changes and regenerate the css.
150
+ * Whether to emit the artifacts to `node_modules` as a package.
149
151
  * @default false
150
152
  */
151
- watch?: boolean
153
+ emitPackage?: boolean
152
154
  /**
153
- * Whether to use polling instead of filesystem events when watching.
155
+ * Whether to only emit the `tokens` directory
154
156
  * @default false
155
157
  */
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?: JsxFramework
158
+ emitTokensOnly?: boolean
182
159
  /**
183
- * The factory name of the element
184
- * @default 'styled'
185
- *
186
- * @example
187
- * ```jsx
188
- * <panda.button marginTop="40px">Click me</panda.button>
189
- * ```
160
+ * Whether to hash the generated class names.
161
+ * This is useful if want to shorten the class names.
162
+ * @default false
190
163
  */
191
- jsxFactory?: string
164
+ hash?: boolean
192
165
  /**
193
166
  * Options for the generated typescript definitions.
194
167
  */
195
168
  strictTokens?: boolean
196
169
  /**
197
- * @experimental
198
- * Used to generate css utility classes for your project.
170
+ * Whether to update the .gitignore file.
171
+ * @default 'true'
199
172
  */
200
- staticCss?: StaticCssOptions
173
+ gitignore?: boolean
174
+ }
175
+
176
+ type PresetOptions = {
201
177
  /**
202
- * File extension for generated javascript files.
178
+ * Used to create reusable config presets for your project or team.
203
179
  */
204
- outExtension?: 'mjs' | 'js'
180
+ presets?: (string | Preset | Promise<Preset>)[]
205
181
  }
206
182
 
207
- type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik'
183
+ export type Config = StudioOptions &
184
+ ExtendableOptions &
185
+ CssgenOptions &
186
+ CodegenOptions &
187
+ FileSystemOptions &
188
+ JsxOptions &
189
+ PresetOptions
190
+
191
+ export type Preset = ExtendableOptions & PresetOptions
208
192
 
209
193
  export type UserConfig = UnwrapExtend<RequiredBy<Config, 'outdir' | 'cwd' | 'include'>>
210
194
 
package/dist/index.d.ts CHANGED
@@ -9,11 +9,11 @@ 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, GenericConfig, LoadConfigResult, Preset, UserConfig } from './config'
12
+ export type { Config, LoadConfigResult, Preset, UserConfig } from './config'
13
13
  export type { ParserResultType, ResultItem } from './parser'
14
14
  export type { Part, Parts } from './parts'
15
- export type { AnyPatternConfig, PatternConfig, PatternHelpers, PatternProperty } from './pattern'
16
- export type { AnyRecipeConfig, RecipeConfig, RecipeVariantRecord } from './recipe'
15
+ export type { PatternConfig, PatternHelpers, PatternProperty } from './pattern'
16
+ export type { RecipeConfig, RecipeVariantRecord } from './recipe'
17
17
  export type { Runtime } from './runtime'
18
18
  export type { AnyFunction, Artifact, Dict, RequiredBy } from './shared'
19
19
  export type { StaticCssOptions } from './static-css'
package/dist/pattern.d.ts CHANGED
@@ -14,7 +14,7 @@ export type PatternHelpers = {
14
14
  map: (value: any, fn: (value: string) => string | undefined) => any
15
15
  }
16
16
 
17
- export type PatternConfig<T> = {
17
+ export type PatternConfig<T = PatternProperty> = {
18
18
  /**
19
19
  * The description of the pattern. This will be used in the JSDoc comment.
20
20
  */
@@ -50,5 +50,3 @@ export type PatternConfig<T> = {
50
50
  */
51
51
  blocklist?: LiteralUnion<CssProperty>[]
52
52
  }
53
-
54
- export type AnyPatternConfig = PatternConfig<PatternProperty>
package/dist/recipe.d.ts CHANGED
@@ -61,7 +61,9 @@ export type RecipeDefinition<T extends RecipeVariantRecord> = {
61
61
 
62
62
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
63
63
 
64
- export type RecipeConfig<T> = RecipeDefinition<T extends RecipeVariantRecord ? T : RecipeVariantRecord> & {
64
+ export type RecipeConfig<T = RecipeVariantRecord> = RecipeDefinition<
65
+ T extends RecipeVariantRecord ? T : RecipeVariantRecord
66
+ > & {
65
67
  /**
66
68
  * The name of the recipe.
67
69
  */
@@ -78,4 +80,3 @@ export type RecipeConfig<T> = RecipeDefinition<T extends RecipeVariantRecord ? T
78
80
  */
79
81
  jsx?: Array<string | RegExp>
80
82
  }
81
- export type AnyRecipeConfig = RecipeConfig<RecipeVariantRecord>
package/dist/shared.d.ts CHANGED
@@ -1,19 +1,15 @@
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
  }
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.0.0-dev-20230605172509",
3
+ "version": "0.0.0-dev-20230607103128",
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-20230605172509"
19
+ "@pandacss/extractor": "0.0.0-dev-20230607103128"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tsx scripts/build.ts",