@pandacss/types 0.19.0 → 0.21.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.
@@ -0,0 +1,49 @@
1
+ import type { Nullable } from './shared'
2
+
3
+ export interface ArtifactContent {
4
+ file: string
5
+ code: string | undefined
6
+ }
7
+
8
+ export type ArtifactId =
9
+ | 'helpers'
10
+ | 'keyframes'
11
+ | 'design-tokens'
12
+ | 'types'
13
+ | 'css-fn'
14
+ | 'cva'
15
+ | 'sva'
16
+ | 'cx'
17
+ | 'create-recipe'
18
+ | 'recipes'
19
+ | 'recipes-index'
20
+ | 'patterns'
21
+ | 'patterns-index'
22
+ | 'jsx-is-valid-prop'
23
+ | 'jsx-helpers'
24
+ | 'jsx-factory'
25
+ | 'jsx-patterns'
26
+ | 'jsx-patterns-index'
27
+ | 'css-index'
28
+ | 'reset.css'
29
+ | 'global.css'
30
+ | 'static.css'
31
+ | 'package.json'
32
+ | 'styles.css'
33
+ | (string & {})
34
+
35
+ export type Artifact = Nullable<{
36
+ id: ArtifactId
37
+ dir?: string[]
38
+ files: ArtifactContent[]
39
+ }>
40
+
41
+ export interface AffectedArtifacts {
42
+ recipes: string[]
43
+ patterns: string[]
44
+ }
45
+
46
+ export interface ArtifactFilters {
47
+ ids?: ArtifactId[]
48
+ affecteds?: AffectedArtifacts
49
+ }
package/dist/config.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { TSConfig } from 'pkg-types'
2
2
  import type { Conditions, ExtendableConditions } from './conditions'
3
3
  import type { PandaHooks } from './hooks'
4
4
  import type { PatternConfig } from './pattern'
5
- import type { RequiredBy } from './shared'
5
+ import type { Keys, PathIn, RequiredBy } from './shared'
6
6
  import type { StaticCssOptions } from './static-css'
7
7
  import type { ExtendableGlobalStyleObject, GlobalStyleObject } from './system-types'
8
8
  import type { ExtendableTheme, Theme } from './theme'
@@ -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
- interface StudioOptions {
17
+ export interface StudioOptions {
18
18
  /**
19
19
  * Used to customize the design system studio
20
20
  * @default { title: 'Panda', logo: '🐼' }
@@ -52,6 +52,10 @@ interface PresetCore {
52
52
  * The global styles for your project.
53
53
  */
54
54
  globalCss: GlobalStyleObject
55
+ /**
56
+ * Used to generate css utility classes for your project.
57
+ */
58
+ staticCss: StaticCssOptions
55
59
  /**
56
60
  * The theme configuration for your project.
57
61
  */
@@ -71,6 +75,10 @@ interface ExtendablePatterns {
71
75
  extend?: Patterns | undefined
72
76
  }
73
77
 
78
+ interface ExtendableStaticCssOptions extends StaticCssOptions {
79
+ extend?: StaticCssOptions | undefined
80
+ }
81
+
74
82
  export interface ExtendableOptions {
75
83
  /**
76
84
  * The css selectors or media queries shortcuts.
@@ -81,6 +89,10 @@ export interface ExtendableOptions {
81
89
  * The global styles for your project.
82
90
  */
83
91
  globalCss?: ExtendableGlobalStyleObject
92
+ /**
93
+ * Used to generate css utility classes for your project.
94
+ */
95
+ staticCss?: ExtendableStaticCssOptions
84
96
  /**
85
97
  * The theme configuration for your project.
86
98
  */
@@ -125,7 +137,7 @@ interface FileSystemOptions {
125
137
  * }
126
138
  * ```
127
139
  */
128
- importMap?: OutdirImportMap
140
+ importMap?: string | OutdirImportMap
129
141
  /**
130
142
  * List of files glob to watch for changes.
131
143
  * @default []
@@ -232,11 +244,6 @@ interface CssgenOptions {
232
244
  * @default ':where(:host, :root)'
233
245
  */
234
246
  cssVarRoot?: string
235
- /**
236
- * @experimental
237
- * Used to generate css utility classes for your project.
238
- */
239
- staticCss?: StaticCssOptions
240
247
  /**
241
248
  * The css syntax kind to use
242
249
  * @default 'object-literal'
@@ -336,8 +343,11 @@ export interface ConfigTsOptions {
336
343
  }
337
344
 
338
345
  export interface LoadConfigResult {
346
+ /** Config path */
339
347
  path: string
340
348
  config: UserConfig
349
+ serialized: string
350
+ deserialize: () => Config
341
351
  tsconfig?: TSConfig
342
352
  tsOptions?: ConfigTsOptions
343
353
  tsconfigFile?: string
@@ -353,3 +363,14 @@ export interface PrefixOptions {
353
363
  tokens: string | undefined
354
364
  className: string | undefined
355
365
  }
366
+
367
+ type ReqConf = Required<UserConfig>
368
+
369
+ export type ConfigPath = Exclude<
370
+ | Exclude<NonNullable<Keys<ReqConf>>, 'theme'>
371
+ | PathIn<ReqConf, 'theme'>
372
+ | PathIn<ReqConf, 'patterns'>
373
+ | PathIn<ReqConf, 'staticCss'>
374
+ | (string & {}),
375
+ undefined
376
+ >
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type * from './analyze-report'
2
+ export type * from './artifact'
2
3
  export type * from './composition'
3
4
  export type * from './conditions'
4
5
  export type * from './config'
package/dist/recipe.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { RecipeRule } from './static-css'
1
2
  import type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'
2
3
 
3
4
  type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
@@ -62,6 +63,10 @@ export interface RecipeDefinition<T extends RecipeVariantRecord> {
62
63
  * The styles to apply when a combination of variants is selected.
63
64
  */
64
65
  compoundVariants?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]
66
+ /**
67
+ * Variants to pre-generate, will be include in the final `config.staticCss`
68
+ */
69
+ staticCss?: RecipeRule[]
65
70
  }
66
71
 
67
72
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
package/dist/shared.d.ts CHANGED
@@ -12,14 +12,26 @@ export type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pi
12
12
 
13
13
  export type AnyFunction<T = any> = (...args: T[]) => any
14
14
 
15
- type Nullable<T> = T | null | undefined
16
-
17
- export interface ArtifactContent {
18
- file: string
19
- code: string | undefined
20
- }
21
-
22
- export type Artifact = Nullable<{
23
- dir?: string[]
24
- files: ArtifactContent[]
25
- }>
15
+ export type Nullable<T> = T | null | undefined
16
+
17
+ export type Keys<T> = keyof NonNullable<T>
18
+
19
+ type Subtract<T extends number, D extends number> = T extends D ? 0 : T extends D | any ? Exclude<T, D> : never
20
+
21
+ /**
22
+ * Get all the (nested) paths of an object until a certain depth
23
+ * e.g. Paths<{a: {b: {c: 1}}}, '', 2> => 'a' | 'a.b' | 'a.b.c'
24
+ */
25
+ type Paths<T, Prefix extends string = '', Depth extends number = 0> = {
26
+ [K in keyof T]: Depth extends 0
27
+ ? never
28
+ : T[K] extends object
29
+ ? K extends string
30
+ ? `${Prefix}${K}` | Paths<T[K], `${Prefix}${K}.`, Depth extends 1 ? 0 : Subtract<Depth, 1>>
31
+ : never
32
+ : K extends string | number
33
+ ? `${Prefix}${K}`
34
+ : never
35
+ }[keyof T]
36
+
37
+ export type PathIn<T, Key extends keyof T> = Key extends string ? Paths<T[Key], `${Key}.`, 1> : never
@@ -17,7 +17,7 @@ interface CssRule {
17
17
  responsive?: boolean
18
18
  }
19
19
 
20
- type RecipeRule =
20
+ export type RecipeRule =
21
21
  | '*'
22
22
  | ({
23
23
  conditions?: string[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -24,7 +24,7 @@
24
24
  "hookable": "5.5.3",
25
25
  "ncp": "^2.0.0",
26
26
  "pkg-types": "1.0.3",
27
- "@pandacss/extractor": "0.19.0"
27
+ "@pandacss/extractor": "0.21.0"
28
28
  },
29
29
  "scripts": {
30
30
  "dev": "tsx scripts/watch.ts",