@pandacss/types 0.30.2 → 0.32.0

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/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'
@@ -273,6 +273,17 @@ interface CssgenOptions {
273
273
  * @see https://www.npmjs.com/package/browserslist
274
274
  */
275
275
  browserslist?: string[]
276
+ /**
277
+ * Layer mappings used in the generated css.
278
+ * @default 'true'
279
+ */
280
+ layers?: Partial<CascadeLayers>
281
+ /**
282
+ * Polyfill CSS @layers at-rules for older browsers.
283
+ * @default 'false'
284
+ * @see https://www.npmjs.com/package/@csstools/postcss-cascade-layers
285
+ */
286
+ polyfill?: boolean
276
287
  }
277
288
 
278
289
  interface CodegenOptions {
@@ -310,11 +321,6 @@ interface CodegenOptions {
310
321
  * @default 'true'
311
322
  */
312
323
  shorthands?: boolean
313
- /**
314
- * Layer mappings used in the generated css.
315
- * @default 'true'
316
- */
317
- layers?: Partial<CascadeLayers>
318
324
  /**
319
325
  * File extension for generated javascript files.
320
326
  * @default 'mjs'
@@ -335,10 +341,18 @@ interface PresetOptions {
335
341
  presets?: (string | Preset | Promise<Preset>)[]
336
342
  }
337
343
 
338
- interface HooksOptions {
344
+ export interface HooksOptions {
339
345
  hooks?: Partial<PandaHooks>
340
346
  }
341
347
 
348
+ export interface PandaPlugin extends HooksOptions {
349
+ name: string
350
+ }
351
+
352
+ export interface PluginsOptions {
353
+ plugins?: PandaPlugin[]
354
+ }
355
+
342
356
  export interface Config
343
357
  extends StudioOptions,
344
358
  ExtendableOptions,
@@ -347,7 +361,8 @@ export interface Config
347
361
  FileSystemOptions,
348
362
  JsxOptions,
349
363
  PresetOptions,
350
- HooksOptions {
364
+ HooksOptions,
365
+ PluginsOptions {
351
366
  /**
352
367
  * Whether to opt-out of the defaults config presets: [`@pandacss/preset-base`, `@pandacss/preset-panda`]
353
368
  * @default 'false'
package/dist/hooks.d.ts CHANGED
@@ -41,7 +41,14 @@ 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: {
45
+ artifacts: Artifact[]
46
+ /**
47
+ * The original state of the artifacts, as it was generated by Panda, without any modification from other preset hooks
48
+ */
49
+ original?: Artifact[]
50
+ changed: ArtifactId[] | undefined
51
+ }) => MaybeAsyncReturn<Artifact[]>
45
52
  /**
46
53
  * Called after the codegen is completed
47
54
  */
@@ -173,7 +180,14 @@ type CssgenArtifact = 'global' | 'static' | 'reset' | 'tokens' | 'keyframes' | '
173
180
 
174
181
  export interface CssgenDoneHookArgs {
175
182
  artifact: CssgenArtifact
183
+ /**
184
+ * The current state of the CSS, if any other preset hook has modified the CSS, this will be the modified state
185
+ */
176
186
  content: string
187
+ /**
188
+ * The original state of the CSS, as it was generated by Panda, without any modification from other preset hooks
189
+ */
190
+ original?: string
177
191
  }
178
192
 
179
193
  /* -----------------------------------------------------------------------------
package/dist/recipe.d.ts CHANGED
@@ -13,10 +13,21 @@ export type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends k
13
13
 
14
14
  export type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string
15
15
 
16
+ /**
17
+ * Extract the variant as optional props from a `cva` function.
18
+ * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.
19
+ */
16
20
  export type RecipeVariantProps<
17
21
  T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,
18
22
  > = Pretty<Parameters<T>[0]>
19
23
 
24
+ /**
25
+ * Extract the variants from a `cva` function.
26
+ */
27
+ export type RecipeVariant<
28
+ T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,
29
+ > = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>
30
+
20
31
  type RecipeVariantMap<T extends RecipeVariantRecord> = {
21
32
  [K in keyof T]: Array<keyof T[K]>
22
33
  }
@@ -63,10 +74,6 @@ export interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantR
63
74
  * The styles to apply when a combination of variants is selected.
64
75
  */
65
76
  compoundVariants?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]
66
- /**
67
- * Variants to pre-generate, will be include in the final `config.staticCss`
68
- */
69
- staticCss?: RecipeRule[]
70
77
  }
71
78
 
72
79
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
@@ -87,6 +94,10 @@ interface RecipeConfigMeta {
87
94
  * @example ['Button', 'Link', /Button$/]
88
95
  */
89
96
  jsx?: Array<string | RegExp>
97
+ /**
98
+ * Variants to pre-generate, will be include in the final `config.staticCss`
99
+ */
100
+ staticCss?: RecipeRule[]
90
101
  }
91
102
 
92
103
  export interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>
@@ -141,10 +152,6 @@ export interface SlotRecipeDefinition<
141
152
  * The styles to apply when a combination of variants is selected.
142
153
  */
143
154
  compoundVariants?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]
144
- /**
145
- * Variants to pre-generate, will be include in the final `config.staticCss`
146
- */
147
- staticCss?: RecipeRule[]
148
155
  }
149
156
 
150
157
  export type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.30.2",
3
+ "version": "0.32.0",
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.30.2"
33
+ "@pandacss/extractor": "0.32.0"
34
34
  },
35
35
  "scripts": {
36
36
  "dev": "tsx scripts/watch.ts",