@pandacss/types 0.31.0 → 0.32.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.
@@ -26,7 +26,14 @@ export type ArtifactId =
26
26
  | 'jsx-patterns-index'
27
27
  | 'css-index'
28
28
  | 'package.json'
29
- | (string & {})
29
+ | 'types-jsx'
30
+ | 'types-entry'
31
+ | 'types-styles'
32
+ | 'types-conditions'
33
+ | 'types-gen'
34
+ | 'types-gen-system'
35
+ | `recipes.${string}`
36
+ | `patterns.${string}`
30
37
 
31
38
  export type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes'
32
39
 
@@ -1,27 +1,40 @@
1
1
  import type { AnySelector, Selectors } from './selectors'
2
2
 
3
- export type ConditionType = 'at-rule' | 'parent-nesting' | 'self-nesting' | 'combinator-nesting'
3
+ export type ConditionType = 'at-rule' | 'parent-nesting' | 'self-nesting' | 'combinator-nesting' | 'mixed'
4
4
 
5
- export interface ConditionDetails {
6
- type: ConditionType
5
+ export type ConditionDetails = AtRuleCondition | SelectorCondition | MixedCondition
6
+
7
+ export interface AtRuleCondition {
8
+ type: 'at-rule'
7
9
  value: string
8
- name?: string
9
- rawValue?: string
10
+ raw: string
11
+ name: string
12
+ params: string
10
13
  }
11
14
 
12
- export interface RawCondition extends ConditionDetails {
15
+ export interface SelectorCondition {
16
+ type: 'self-nesting' | 'parent-nesting' | 'combinator-nesting'
17
+ value: string
13
18
  raw: string
14
19
  }
15
20
 
21
+ export interface MixedCondition {
22
+ type: 'mixed'
23
+ value: ConditionDetails[]
24
+ raw: string[]
25
+ }
26
+
16
27
  /* -----------------------------------------------------------------------------
17
28
  * Shadowed export (in CLI): DO NOT REMOVE
18
29
  * -----------------------------------------------------------------------------*/
19
30
 
31
+ export type ConditionQuery = string | string[]
32
+
20
33
  export interface Conditions {
21
- [condition: string]: string
34
+ [condition: string]: ConditionQuery
22
35
  }
23
36
  export interface ExtendableConditions {
24
- [condition: string]: string | Conditions | undefined
37
+ [condition: string]: ConditionQuery | Conditions | undefined
25
38
  extend?: Conditions | undefined
26
39
  }
27
40
 
package/dist/config.d.ts CHANGED
@@ -184,13 +184,13 @@ interface FileSystemOptions {
184
184
  logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'
185
185
  }
186
186
 
187
- type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik'
187
+ export type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik'
188
188
 
189
189
  interface JsxOptions {
190
190
  /**
191
191
  * The framework to use for generating supercharged elements.
192
192
  */
193
- jsxFramework?: JsxFramework
193
+ jsxFramework?: JsxFramework | (string & {})
194
194
  /**
195
195
  * The factory name of the element
196
196
  * @default 'styled'
@@ -341,10 +341,18 @@ interface PresetOptions {
341
341
  presets?: (string | Preset | Promise<Preset>)[]
342
342
  }
343
343
 
344
- interface HooksOptions {
344
+ export interface HooksOptions {
345
345
  hooks?: Partial<PandaHooks>
346
346
  }
347
347
 
348
+ export interface PandaPlugin extends HooksOptions {
349
+ name: string
350
+ }
351
+
352
+ export interface PluginsOptions {
353
+ plugins?: PandaPlugin[]
354
+ }
355
+
348
356
  export interface Config
349
357
  extends StudioOptions,
350
358
  ExtendableOptions,
@@ -353,7 +361,8 @@ export interface Config
353
361
  FileSystemOptions,
354
362
  JsxOptions,
355
363
  PresetOptions,
356
- HooksOptions {
364
+ HooksOptions,
365
+ PluginsOptions {
357
366
  /**
358
367
  * Whether to opt-out of the defaults config presets: [`@pandacss/preset-base`, `@pandacss/preset-panda`]
359
368
  * @default 'false'
package/dist/hooks.d.ts CHANGED
@@ -41,7 +41,7 @@ export interface PandaHooks {
41
41
  * Called right before writing the codegen files to disk.
42
42
  * You can use this hook to tweak the codegen files before they are written to disk.
43
43
  */
44
- 'codegen:prepare': (args: CodegenPrepareHookArgs) => MaybeAsyncReturn
44
+ 'codegen:prepare': (args: CodegenPrepareHookArgs) => MaybeAsyncReturn<void | Artifact[]>
45
45
  /**
46
46
  * Called after the codegen is completed
47
47
  */
@@ -158,9 +158,12 @@ export interface ParserResultAfterHookArgs {
158
158
 
159
159
  export interface CodegenPrepareHookArgs {
160
160
  artifacts: Artifact[]
161
+ /**
162
+ * The original state of the artifacts, as it was generated by Panda, without any modification from other preset hooks
163
+ */
164
+ original?: Artifact[]
161
165
  changed: ArtifactId[] | undefined
162
166
  }
163
-
164
167
  export interface CodegenDoneHookArgs {
165
168
  changed: ArtifactId[] | undefined
166
169
  }
@@ -173,7 +176,14 @@ type CssgenArtifact = 'global' | 'static' | 'reset' | 'tokens' | 'keyframes' | '
173
176
 
174
177
  export interface CssgenDoneHookArgs {
175
178
  artifact: CssgenArtifact
179
+ /**
180
+ * The current state of the CSS, if any other preset hook has modified the CSS, this will be the modified state
181
+ */
176
182
  content: string
183
+ /**
184
+ * The original state of the CSS, as it was generated by Panda, without any modification from other preset hooks
185
+ */
186
+ original?: string
177
187
  }
178
188
 
179
189
  /* -----------------------------------------------------------------------------
package/dist/recipe.d.ts CHANGED
@@ -74,10 +74,6 @@ export interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantR
74
74
  * The styles to apply when a combination of variants is selected.
75
75
  */
76
76
  compoundVariants?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]
77
- /**
78
- * Variants to pre-generate, will be include in the final `config.staticCss`
79
- */
80
- staticCss?: RecipeRule[]
81
77
  }
82
78
 
83
79
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
@@ -98,6 +94,10 @@ interface RecipeConfigMeta {
98
94
  * @example ['Button', 'Link', /Button$/]
99
95
  */
100
96
  jsx?: Array<string | RegExp>
97
+ /**
98
+ * Variants to pre-generate, will be include in the final `config.staticCss`
99
+ */
100
+ staticCss?: RecipeRule[]
101
101
  }
102
102
 
103
103
  export interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>
@@ -152,10 +152,6 @@ export interface SlotRecipeDefinition<
152
152
  * The styles to apply when a combination of variants is selected.
153
153
  */
154
154
  compoundVariants?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]
155
- /**
156
- * Variants to pre-generate, will be include in the final `config.staticCss`
157
- */
158
- staticCss?: RecipeRule[]
159
155
  }
160
156
 
161
157
  export type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(
@@ -1,4 +1,4 @@
1
- import type { RawCondition } from './conditions'
1
+ import type { ConditionDetails } from './conditions'
2
2
 
3
3
  export interface StyleResultObject {
4
4
  [key: string]: any
@@ -17,16 +17,12 @@ export interface StyleEntry {
17
17
  variants?: boolean
18
18
  }
19
19
 
20
- interface ExpandedCondition extends RawCondition {
21
- params?: string
22
- }
23
-
24
20
  export interface AtomicStyleResult {
25
21
  result: StyleResultObject
26
22
  entry: StyleEntry
27
23
  hash: string
28
24
  className: string
29
- conditions?: ExpandedCondition[]
25
+ conditions?: ConditionDetails[]
30
26
  layer?: string
31
27
  }
32
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -27,10 +27,10 @@
27
27
  ],
28
28
  "devDependencies": {
29
29
  "csstype": "3.1.3",
30
- "microdiff": "^1.3.2",
31
- "ncp": "^2.0.0",
30
+ "microdiff": "1.3.2",
31
+ "ncp": "2.0.0",
32
32
  "pkg-types": "1.0.3",
33
- "@pandacss/extractor": "0.31.0"
33
+ "@pandacss/extractor": "0.32.1"
34
34
  },
35
35
  "scripts": {
36
36
  "dev": "tsx scripts/watch.ts",