@pandacss/types 2.0.0-beta.1 → 2.0.0-beta.10

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
@@ -16,9 +16,10 @@ import type { ExtendableUtilityConfig, UtilityConfig } from './utility'
16
16
 
17
17
  export type { TSConfig }
18
18
 
19
- export type CascadeLayer = 'reset' | 'base' | 'tokens' | 'recipes' | 'utilities'
19
+ /** The five cascade layers, in emit order. */
20
+ export type StylesheetLayerName = 'reset' | 'base' | 'tokens' | 'recipes' | 'utilities'
20
21
 
21
- export type CascadeLayers = Record<CascadeLayer, string>
22
+ export type StylesheetLayers = Record<StylesheetLayerName, string>
22
23
 
23
24
  export interface Patterns {
24
25
  [pattern: string]: PatternConfig
@@ -198,7 +199,7 @@ export interface ImportMapOutput<T = string> {
198
199
  tokens: T[]
199
200
  }
200
201
 
201
- type ImportMapOption = string | ImportMapInput
202
+ export type ImportMapOption = string | ImportMapInput
202
203
 
203
204
  interface FileSystemOptions {
204
205
  /**
@@ -215,10 +216,12 @@ interface FileSystemOptions {
215
216
  * recipes: 'styled-system/recipes',
216
217
  * patterns: 'styled-system/patterns',
217
218
  * jsx: 'styled-system/jsx',
219
+ * tokens: 'styled-system/tokens',
218
220
  * }
219
221
  * ```
220
222
  */
221
223
  importMap?: ImportMapOption | Array<ImportMapOption>
224
+ designSystem?: string
222
225
  /**
223
226
  * List of files glob to watch for changes.
224
227
  * @default []
@@ -321,7 +324,17 @@ interface CssgenOptions {
321
324
  * Layer mappings used in the generated css.
322
325
  * @default 'true'
323
326
  */
324
- layers?: Partial<CascadeLayers>
327
+ layers?: Partial<StylesheetLayers>
328
+ /**
329
+ * Whether to minify the emitted css. The `--minify` CLI flag overrides this.
330
+ * @default false
331
+ */
332
+ minify?: boolean
333
+ /**
334
+ * Polyfill cascade layers for older browsers. `--polyfill` overrides this.
335
+ * @default false
336
+ */
337
+ polyfill?: boolean
325
338
  }
326
339
 
327
340
  export interface OptimizeOptions {
@@ -337,6 +350,11 @@ export interface OptimizeOptions {
337
350
  * Narrow compound variant CSS to statically selected variant combinations.
338
351
  */
339
352
  smartCompoundVariants?: boolean
353
+ /**
354
+ * Hydrate only build-info modules for design-system exports the app imports.
355
+ * Off by default. Namespace / side-effect imports still hydrate everything.
356
+ */
357
+ treeshakeDesignSystem?: boolean
340
358
  }
341
359
 
342
360
  interface CodegenOptions {
package/dist/hooks.d.ts CHANGED
@@ -62,19 +62,21 @@ export interface ConfigResolvedHookArgs {
62
62
  utils: ConfigResolvedHookUtils
63
63
  }
64
64
 
65
- export interface CodegenFile {
65
+ /** Hook-facing codegen file — `dependencies` stay plain strings for plugin authors. */
66
+ export interface CodegenPrepareFile {
66
67
  path: string
67
68
  code: string
68
69
  dependencies: string[]
69
70
  }
70
71
 
71
- export interface CodegenArtifact {
72
+ /** Hook-facing codegen artifact — distinct from the compiler `CodegenArtifact` API. */
73
+ export interface CodegenPrepareArtifact {
72
74
  id: string
73
- files: CodegenFile[]
75
+ files: CodegenPrepareFile[]
74
76
  }
75
77
 
76
78
  export interface CodegenPrepareHookArgs {
77
- artifacts: CodegenArtifact[]
79
+ artifacts: CodegenPrepareArtifact[]
78
80
  outdir: string
79
81
  cwd?: string | undefined
80
82
  }
@@ -85,6 +87,43 @@ export interface CodegenDoneHookArgs {
85
87
  cwd?: string | undefined
86
88
  }
87
89
 
90
+ export type CssgenArtifact = 'styles.css' | 'styles.layer' | 'styles.split'
91
+
92
+ export interface CssgenDoneManifestFile {
93
+ path: string
94
+ hash: string
95
+ }
96
+
97
+ export interface CssgenDoneManifest {
98
+ files: CssgenDoneManifestFile[]
99
+ tokens: string[]
100
+ }
101
+
102
+ export interface CssgenDoneLayerRange {
103
+ start: number
104
+ end: number
105
+ }
106
+
107
+ export interface CssgenDoneLayerRanges {
108
+ reset?: CssgenDoneLayerRange
109
+ base?: CssgenDoneLayerRange
110
+ tokens?: CssgenDoneLayerRange
111
+ recipes?: CssgenDoneLayerRange
112
+ utilities?: CssgenDoneLayerRange
113
+ }
114
+
115
+ export interface CssgenDoneHookArgs {
116
+ artifact: CssgenArtifact
117
+ content: string
118
+ /** Absolute path when written to disk; omitted for string sinks (Vite/PostCSS). */
119
+ path?: string | undefined
120
+ outfile?: string | undefined
121
+ outdir?: string | undefined
122
+ cwd?: string | undefined
123
+ manifest?: CssgenDoneManifest | undefined
124
+ layerRanges?: CssgenDoneLayerRanges | undefined
125
+ }
126
+
88
127
  export interface PandaHooks {
89
128
  /**
90
129
  * Called after authored presets are merged, before defaults and serialization.
@@ -102,11 +141,16 @@ export interface PandaHooks {
102
141
  /**
103
142
  * Called before generated files are written by a JS host.
104
143
  */
105
- 'codegen:prepare': (args: CodegenPrepareHookArgs) => void | CodegenArtifact[]
144
+ 'codegen:prepare': (args: CodegenPrepareHookArgs) => void | CodegenPrepareArtifact[]
106
145
  /**
107
146
  * Called after generated files are written by a JS host.
108
147
  */
109
148
  'codegen:done': (args: CodegenDoneHookArgs) => void
149
+ /**
150
+ * Called after final CSS is produced by a JS host (observe-only; no rewrite).
151
+ * Fires for CLI, Vite, and PostCSS string sinks. Use `optimize` or PostCSS to mutate CSS.
152
+ */
153
+ 'cssgen:done': (args: CssgenDoneHookArgs) => void
110
154
  }
111
155
 
112
156
  export type HookRegistry = {
package/dist/index.d.ts CHANGED
@@ -1,18 +1,12 @@
1
- export type * from './artifact'
2
1
  export type * from './composition'
3
2
  export type * from './conditions'
4
3
  export type * from './config'
5
4
  export type * from './hooks'
6
- export type * from './hooks-api'
7
- export type * from './logger'
8
5
  export type * from './parts'
9
6
  export type * from './pattern'
10
7
  export type * from './recipe'
11
- export type * from './runtime'
12
8
  export type * from './shared'
13
- export type * from './spec'
14
9
  export type * from './static-css'
15
- export type * from './style-rules'
16
10
  export type * from './system-types'
17
11
  export type * from './theme'
18
12
  export type * from './tokens'
package/dist/pattern.d.ts CHANGED
@@ -11,7 +11,7 @@ export type PatternProperty =
11
11
  | { type: 'string' | 'boolean' | 'number'; description?: string }
12
12
 
13
13
  export interface PatternHelpers {
14
- map: (value: any, fn: (value: string) => string | undefined) => any
14
+ map: (value: any, fn: (value: any) => any) => any
15
15
  isCssUnit: (value: any) => boolean
16
16
  isCssVar: (value: any) => boolean
17
17
  isCssFunction: (value: any) => boolean
@@ -89,6 +89,15 @@ export type NestedCssProperties = Nested<CssProperties>
89
89
 
90
90
  export type SystemStyleObject = Nested<(SystemProperties | GenericProperties) & CssVarProperties>
91
91
 
92
+ export interface ViewTransitionStyleObject {
93
+ group?: SystemStyleObject
94
+ imagePair?: SystemStyleObject
95
+ old?: SystemStyleObject
96
+ new?: SystemStyleObject
97
+ }
98
+
99
+ export type ViewTransitionFn = (options: ViewTransitionStyleObject) => string
100
+
92
101
  export interface GlobalStyleObject {
93
102
  [selector: string]: SystemStyleObject
94
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.10",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -28,10 +28,11 @@
28
28
  ],
29
29
  "devDependencies": {
30
30
  "csstype": "3.2.3",
31
- "microdiff": "1.5.0",
32
31
  "ncp": "2.0.0",
33
- "pkg-types": "2.3.0",
34
- "ts-morph": "28.0.0"
32
+ "pkg-types": "2.3.0"
33
+ },
34
+ "engines": {
35
+ "node": ">=22"
35
36
  },
36
37
  "scripts": {
37
38
  "dev": "tsx scripts/watch.ts",
@@ -1,65 +0,0 @@
1
- import { type Difference } from 'microdiff'
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-create-style-context'
27
- | 'jsx-patterns-index'
28
- | 'css-index'
29
- | 'themes'
30
- | 'package.json'
31
- | 'types-jsx'
32
- | 'types-entry'
33
- | 'types-styles'
34
- | 'types-conditions'
35
- | 'types-gen'
36
- | 'types-gen-system'
37
- | 'static-css'
38
- | 'styles.css'
39
- | 'styles'
40
- | `recipes.${string}`
41
- | `patterns.${string}`
42
-
43
- export type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes'
44
-
45
- export type Artifact = {
46
- id: ArtifactId
47
- dir?: string[]
48
- files: ArtifactContent[]
49
- }
50
-
51
- export interface AffectedArtifacts {
52
- recipes: string[]
53
- patterns: string[]
54
- }
55
-
56
- export interface ArtifactFilters {
57
- ids?: ArtifactId[]
58
- affecteds?: AffectedArtifacts
59
- }
60
-
61
- export interface DiffConfigResult {
62
- hasConfigChanged: boolean
63
- artifacts: Set<ArtifactId>
64
- diffs: Difference[]
65
- }
@@ -1,56 +0,0 @@
1
- import type { UserConfig } from './config'
2
- import type { RecipeDefinition, RecipeVariantRecord, SlotRecipeDefinition, SlotRecipeVariantRecord } from './recipe'
3
- import type { AtomicStyleResult, RecipeBaseResult } from './style-rules'
4
- import type { SystemStyleObject } from './system-types'
5
-
6
- export interface BaseRule {
7
- getClassNames: () => string[]
8
- toCss: () => string
9
- }
10
-
11
- export interface AtomicRule extends BaseRule {
12
- styles: SystemStyleObject
13
- }
14
-
15
- export interface AtomicRecipeRule extends BaseRule {
16
- config: RecipeDefinition<any> | SlotRecipeDefinition<string, any>
17
- }
18
-
19
- export interface RecipeVariantsRule extends BaseRule {
20
- variants: RecipeVariantRecord
21
- }
22
-
23
- export interface ProcessorInterface {
24
- css(styles: SystemStyleObject): AtomicRule
25
- cva(recipeConfig: RecipeDefinition<RecipeVariantRecord>): AtomicRecipeRule
26
- sva(recipeConfig: SlotRecipeDefinition<string, SlotRecipeVariantRecord<string>>): AtomicRecipeRule
27
- recipe(name: string, variants?: RecipeVariantRecord): RecipeVariantsRule | undefined
28
- }
29
-
30
- export interface HooksApiInterface {
31
- /**
32
- * The resolved config (after all the presets are loaded and merged)
33
- */
34
- config: UserConfig
35
- /**
36
- * The path to the config file
37
- */
38
- configPath: string
39
- /**
40
- * The list of all the config dependencies (direct/transitive imports) filepaths
41
- */
42
- configDependencies: string[]
43
- //
44
- /**
45
- * The processor can be used to generate atomic or recipe classes
46
- */
47
- processor: ProcessorInterface
48
- /**
49
- * Map that contains all the utility classNames
50
- */
51
- classNames: Map<string, string>
52
- /**
53
- * Map that contains all the classNames found (and therefore generated) in the app code
54
- */
55
- generatedClassNames: Map<string, AtomicStyleResult | RecipeBaseResult>
56
- }
package/dist/logger.d.ts DELETED
@@ -1,28 +0,0 @@
1
- export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent'
2
-
3
- export interface LogEntry {
4
- level: LogLevel | null
5
- msg: string
6
- [key: string]: any
7
- }
8
-
9
- export interface LoggerInterface {
10
- level: 'debug' | 'info' | 'warn' | 'error' | 'silent'
11
- print(data: any): void
12
- onLog?: (entry: LogEntry) => void
13
- warn: (type: string, data: any) => void
14
- info: (type: string, data: any) => void
15
- debug: (type: string, data: any) => void
16
- error: (type: string, data: any) => void
17
- /**
18
- * Log a caught error with context. Extracts the message for the error level,
19
- * and logs the full stack at debug level.
20
- */
21
- caughtError: (type: string, context: string, error: unknown) => void
22
- log: (data: string) => void
23
- time: {
24
- info: (msg: string) => (_msg?: string) => void
25
- debug: (msg: string) => (_msg?: string) => void
26
- }
27
- isDebug: boolean
28
- }
package/dist/runtime.d.ts DELETED
@@ -1,48 +0,0 @@
1
- interface Watcher {
2
- on(event: 'add' | 'addDir' | 'change', listener: (path: string) => void): this
3
- on(event: 'all', listener: (evt: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string) => void): this
4
- close(): Promise<void>
5
- }
6
-
7
- interface InputOptions {
8
- include: string[]
9
- exclude?: string[]
10
- cwd?: string
11
- }
12
-
13
- export type WatcherEventType = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'
14
-
15
- export interface WatchOptions extends InputOptions {
16
- poll?: boolean
17
- }
18
-
19
- interface FileSystem {
20
- readDirSync(dir: string): string[]
21
- existsSync(fileLike: string): boolean
22
- glob(opts: InputOptions): string[]
23
- readFileSync(filePath: string): string
24
- rmDirSync(dirPath: string): void
25
- writeFile(file: string, content: string): Promise<void>
26
- rmFileSync(file: string): void
27
- ensureDirSync(dirPath: string): void
28
- writeFileSync(filePath: string, content: string): void
29
- watch(options: WatchOptions): Watcher
30
- }
31
-
32
- interface Path {
33
- join(...paths: string[]): string
34
- dirname(path: string): string
35
- resolve(...paths: string[]): string
36
- extname(path: string): string
37
- relative(from: string, to: string): string
38
- isAbsolute(path: string): boolean
39
- sep: string
40
- abs(cwd: string, path: string): string
41
- }
42
-
43
- export interface Runtime {
44
- fs: FileSystem
45
- path: Path
46
- cwd(): string
47
- env(name: string): string | undefined
48
- }
package/dist/spec.d.ts DELETED
@@ -1,197 +0,0 @@
1
- export type SpecType =
2
- | 'tokens'
3
- | 'recipes'
4
- | 'patterns'
5
- | 'conditions'
6
- | 'keyframes'
7
- | 'semantic-tokens'
8
- | 'text-styles'
9
- | 'layer-styles'
10
- | 'animation-styles'
11
- | 'color-palette'
12
- | 'themes'
13
-
14
- interface Examples {
15
- functionExamples: string[]
16
- jsxExamples: string[]
17
- }
18
-
19
- export interface TokenValue {
20
- name: string
21
- value: any
22
- description?: string
23
- deprecated?: boolean | string
24
- cssVar?: string
25
- }
26
-
27
- export interface TokenGroupDefinition extends Examples {
28
- type: string
29
- values: TokenValue[]
30
- tokenFunctionExamples: string[]
31
- }
32
-
33
- export interface TokenSpec {
34
- type: 'tokens'
35
- data: TokenGroupDefinition[]
36
- }
37
-
38
- export interface SemanticTokenValue {
39
- name: string
40
- values: Array<{ value: string; condition?: string }>
41
- description?: string
42
- deprecated?: boolean | string
43
- cssVar?: string
44
- }
45
-
46
- export interface SemanticTokenGroupDefinition extends Examples {
47
- type: string
48
- values: SemanticTokenValue[]
49
- tokenFunctionExamples: string[]
50
- }
51
-
52
- export interface SemanticTokenSpec {
53
- type: 'semantic-tokens'
54
- data: SemanticTokenGroupDefinition[]
55
- }
56
-
57
- export interface RecipeSpecDefinition extends Examples {
58
- name: string
59
- description?: string
60
- variants: Record<string, string[]>
61
- defaultVariants: Record<string, any>
62
- }
63
-
64
- export interface RecipeSpec {
65
- type: 'recipes'
66
- data: RecipeSpecDefinition[]
67
- }
68
-
69
- export interface PatternSpecProperty {
70
- name: string
71
- type: string
72
- description?: string
73
- required?: boolean
74
- defaultValue?: any
75
- }
76
-
77
- export interface PatternSpecDefinition extends Examples {
78
- name: string
79
- description?: string
80
- properties: PatternSpecProperty[]
81
- jsx?: string
82
- }
83
-
84
- export interface PatternSpec {
85
- type: 'patterns'
86
- data: PatternSpecDefinition[]
87
- }
88
-
89
- export interface ConditionSpecDefinition extends Examples {
90
- name: string
91
- value: string
92
- }
93
-
94
- export interface ConditionSpec {
95
- type: 'conditions'
96
- data: ConditionSpecDefinition[]
97
- }
98
-
99
- export interface KeyframeSpecDefinition extends Examples {
100
- name: string
101
- }
102
-
103
- export interface KeyframeSpec {
104
- type: 'keyframes'
105
- data: KeyframeSpecDefinition[]
106
- }
107
-
108
- export interface TextStyleSpecDefinition extends Examples {
109
- name: string
110
- description?: string
111
- }
112
-
113
- export interface TextStyleSpec {
114
- type: 'text-styles'
115
- data: TextStyleSpecDefinition[]
116
- }
117
-
118
- export interface LayerStyleSpecDefinition extends Examples {
119
- name: string
120
- description?: string
121
- }
122
-
123
- export interface LayerStyleSpec {
124
- type: 'layer-styles'
125
- data: LayerStyleSpecDefinition[]
126
- }
127
-
128
- export interface AnimationStyleSpecDefinition extends Examples {
129
- name: string
130
- description?: string
131
- }
132
-
133
- export interface AnimationStyleSpec {
134
- type: 'animation-styles'
135
- data: AnimationStyleSpecDefinition[]
136
- }
137
-
138
- export interface ColorPaletteSpec {
139
- type: 'color-palette'
140
- data: {
141
- values: string[]
142
- functionExamples: string[]
143
- jsxExamples: string[]
144
- }
145
- }
146
-
147
- export interface ThemeTokenValue {
148
- name: string
149
- values: Array<{ value: string; condition?: string }>
150
- description?: string
151
- deprecated?: boolean | string
152
- cssVar?: string
153
- }
154
-
155
- export interface ThemeTokenGroupDefinition extends Examples {
156
- type: string
157
- values: ThemeTokenValue[]
158
- tokenFunctionExamples: string[]
159
- }
160
-
161
- export interface ThemeSpecDefinition {
162
- name: string
163
- tokens: ThemeTokenGroupDefinition[]
164
- semanticTokens: ThemeTokenGroupDefinition[]
165
- }
166
-
167
- export interface ThemesSpec {
168
- type: 'themes'
169
- data: ThemeSpecDefinition[]
170
- }
171
-
172
- export type SpecFile =
173
- | TokenSpec
174
- | SemanticTokenSpec
175
- | RecipeSpec
176
- | PatternSpec
177
- | ConditionSpec
178
- | KeyframeSpec
179
- | TextStyleSpec
180
- | LayerStyleSpec
181
- | AnimationStyleSpec
182
- | ColorPaletteSpec
183
- | ThemesSpec
184
-
185
- export interface SpecTypeMap {
186
- tokens: TokenSpec
187
- 'semantic-tokens': SemanticTokenSpec
188
- recipes: RecipeSpec
189
- patterns: PatternSpec
190
- conditions: ConditionSpec
191
- keyframes: KeyframeSpec
192
- 'text-styles': TextStyleSpec
193
- 'layer-styles': LayerStyleSpec
194
- 'animation-styles': AnimationStyleSpec
195
- 'color-palette': ColorPaletteSpec
196
- themes: ThemesSpec
197
- }
@@ -1,41 +0,0 @@
1
- import type { ConditionDetails } from './conditions'
2
-
3
- export interface StyleResultObject {
4
- [key: string]: any
5
- }
6
- export interface StyleProps extends StyleResultObject {
7
- css?: StyleResultObject
8
- }
9
-
10
- export interface StyleEntry {
11
- prop: string
12
- value: string | number | boolean
13
- cond: string
14
- recipe?: string
15
- slot?: string
16
- layer?: string
17
- variants?: boolean
18
- }
19
-
20
- export interface AtomicStyleResult {
21
- result: StyleResultObject
22
- entry: StyleEntry
23
- hash: string
24
- className: string
25
- conditions?: ConditionDetails[]
26
- layer?: string
27
- }
28
-
29
- export interface GroupedResult extends Pick<AtomicStyleResult, 'result' | 'className'> {
30
- hashSet: Set<string>
31
- details: GroupedStyleResultDetails[]
32
- }
33
-
34
- export interface RecipeBaseResult extends GroupedResult {
35
- recipe: string
36
- slot?: string
37
- }
38
-
39
- export interface GroupedStyleResultDetails extends Pick<AtomicStyleResult, 'hash' | 'entry' | 'conditions'> {
40
- result: StyleResultObject
41
- }