@pandacss/types 0.30.1 → 0.31.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 +11 -5
- package/dist/hooks.d.ts +93 -21
- package/dist/recipe.d.ts +11 -0
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -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'
|
package/dist/hooks.d.ts
CHANGED
|
@@ -21,44 +21,45 @@ export interface PandaHooks {
|
|
|
21
21
|
/**
|
|
22
22
|
* Called when the Panda context has been created and the API is ready to be used.
|
|
23
23
|
*/
|
|
24
|
-
'context:created': (args:
|
|
24
|
+
'context:created': (args: ContextCreatedHookArgs) => void
|
|
25
25
|
/**
|
|
26
26
|
* Called when the config file or one of its dependencies (imports) has changed.
|
|
27
27
|
*/
|
|
28
|
-
'config:change': (args:
|
|
28
|
+
'config:change': (args: ConfigChangeHookArgs) => MaybeAsyncReturn
|
|
29
29
|
/**
|
|
30
30
|
* Called after reading the file content but before parsing it.
|
|
31
31
|
* You can use this hook to transform the file content to a tsx-friendly syntax so that Panda's parser can parse it.
|
|
32
32
|
* You can also use this hook to parse the file's content on your side using a custom parser, in this case you don't have to return anything.
|
|
33
33
|
*/
|
|
34
|
-
'parser:before': (args:
|
|
34
|
+
'parser:before': (args: ParserResultBeforeHookArgs) => string | void
|
|
35
35
|
/**
|
|
36
36
|
* Called after the file styles are extracted and processed into the resulting ParserResult object.
|
|
37
37
|
* You can also use this hook to add your own extraction results from your custom parser to the ParserResult object.
|
|
38
38
|
*/
|
|
39
|
-
'parser:after': (args:
|
|
39
|
+
'parser:after': (args: ParserResultAfterHookArgs) => void
|
|
40
40
|
/**
|
|
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:
|
|
44
|
+
'codegen:prepare': (args: CodegenPrepareHookArgs) => MaybeAsyncReturn
|
|
45
45
|
/**
|
|
46
46
|
* Called after the codegen is completed
|
|
47
47
|
*/
|
|
48
|
-
'codegen:done': (args:
|
|
48
|
+
'codegen:done': (args: CodegenDoneHookArgs) => MaybeAsyncReturn
|
|
49
49
|
/**
|
|
50
50
|
* Called right before adding the design-system CSS (global, static, preflight, tokens, keyframes) to the final CSS
|
|
51
51
|
* Called right before writing/injecting the final CSS (styles.css) that contains the design-system CSS and the parser CSS
|
|
52
52
|
* You can use it to tweak the CSS content before it's written to disk or injected through the postcss plugin.
|
|
53
53
|
*/
|
|
54
|
-
'cssgen:done': (args:
|
|
55
|
-
artifact: 'global' | 'static' | 'reset' | 'tokens' | 'keyframes' | 'styles.css'
|
|
56
|
-
content: string
|
|
57
|
-
}) => string | void
|
|
54
|
+
'cssgen:done': (args: CssgenDoneHookArgs) => string | void
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
type MaybeAsyncReturn<T = void> = Promise<T> | T
|
|
61
58
|
|
|
59
|
+
/* -----------------------------------------------------------------------------
|
|
60
|
+
* Token hooks
|
|
61
|
+
* -----------------------------------------------------------------------------*/
|
|
62
|
+
|
|
62
63
|
interface TokenCssVarOptions {
|
|
63
64
|
fallback?: string
|
|
64
65
|
prefix?: string
|
|
@@ -79,6 +80,10 @@ export interface TokenCreatedHookArgs {
|
|
|
79
80
|
configure(opts: TokenConfigureOptions): void
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
/* -----------------------------------------------------------------------------
|
|
84
|
+
* Utility hooks
|
|
85
|
+
* -----------------------------------------------------------------------------*/
|
|
86
|
+
|
|
82
87
|
export interface UtilityConfigureOptions {
|
|
83
88
|
toHash?(path: string[], toHash: (str: string) => string): string
|
|
84
89
|
}
|
|
@@ -87,6 +92,29 @@ export interface UtilityCreatedHookArgs {
|
|
|
87
92
|
configure(opts: UtilityConfigureOptions): void
|
|
88
93
|
}
|
|
89
94
|
|
|
95
|
+
/* -----------------------------------------------------------------------------
|
|
96
|
+
* Config hooks
|
|
97
|
+
* -----------------------------------------------------------------------------*/
|
|
98
|
+
|
|
99
|
+
interface CallbackItem {
|
|
100
|
+
value: any
|
|
101
|
+
path: string
|
|
102
|
+
depth: number
|
|
103
|
+
parent: any[] | Record<string, unknown>
|
|
104
|
+
key: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type CallbackFn = (args: CallbackItem) => void
|
|
108
|
+
|
|
109
|
+
interface TraverseOptions {
|
|
110
|
+
separator: string
|
|
111
|
+
maxDepth?: number | undefined
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface TraverseFn {
|
|
115
|
+
(obj: any, callback: CallbackFn, options?: TraverseOptions): void
|
|
116
|
+
}
|
|
117
|
+
|
|
90
118
|
interface ConfigResolvedHookUtils {
|
|
91
119
|
omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Omit<T, K>
|
|
92
120
|
traverse: TraverseFn
|
|
@@ -99,16 +127,60 @@ export interface ConfigResolvedHookArgs {
|
|
|
99
127
|
utils: ConfigResolvedHookUtils
|
|
100
128
|
}
|
|
101
129
|
|
|
102
|
-
|
|
103
|
-
|
|
130
|
+
export interface ConfigChangeHookArgs {
|
|
131
|
+
config: UserConfig
|
|
132
|
+
changes: DiffConfigResult
|
|
133
|
+
}
|
|
104
134
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
135
|
+
/* -----------------------------------------------------------------------------
|
|
136
|
+
* Parser hooks
|
|
137
|
+
* -----------------------------------------------------------------------------*/
|
|
138
|
+
|
|
139
|
+
export interface ParserResultConfigureOptions {
|
|
140
|
+
matchTag?: (tag: string, isPandaComponent: boolean) => boolean
|
|
141
|
+
matchTagProp?: (tag: string, prop: string) => boolean
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface ParserResultBeforeHookArgs {
|
|
145
|
+
filePath: string
|
|
146
|
+
content: string
|
|
147
|
+
configure: (opts: ParserResultConfigureOptions) => void
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface ParserResultAfterHookArgs {
|
|
151
|
+
filePath: string
|
|
152
|
+
result: ParserResultInterface | undefined
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* -----------------------------------------------------------------------------
|
|
156
|
+
* Codegen hooks
|
|
157
|
+
* -----------------------------------------------------------------------------*/
|
|
158
|
+
|
|
159
|
+
export interface CodegenPrepareHookArgs {
|
|
160
|
+
artifacts: Artifact[]
|
|
161
|
+
changed: ArtifactId[] | undefined
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface CodegenDoneHookArgs {
|
|
165
|
+
changed: ArtifactId[] | undefined
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* -----------------------------------------------------------------------------
|
|
169
|
+
* Cssgen hooks
|
|
170
|
+
* -----------------------------------------------------------------------------*/
|
|
171
|
+
|
|
172
|
+
type CssgenArtifact = 'global' | 'static' | 'reset' | 'tokens' | 'keyframes' | 'styles.css'
|
|
173
|
+
|
|
174
|
+
export interface CssgenDoneHookArgs {
|
|
175
|
+
artifact: CssgenArtifact
|
|
176
|
+
content: string
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* -----------------------------------------------------------------------------
|
|
180
|
+
* Context hooks
|
|
181
|
+
* -----------------------------------------------------------------------------*/
|
|
182
|
+
|
|
183
|
+
export interface ContextCreatedHookArgs {
|
|
184
|
+
ctx: HooksApiInterface
|
|
185
|
+
logger: LoggerInterface
|
|
114
186
|
}
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "The types for css panda",
|
|
5
5
|
"main": "dist/index.d.ts",
|
|
6
6
|
"author": "Segun Adebayo <joseshegs@gmail.com>",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"microdiff": "^1.3.2",
|
|
31
31
|
"ncp": "^2.0.0",
|
|
32
32
|
"pkg-types": "1.0.3",
|
|
33
|
-
"@pandacss/extractor": "0.
|
|
33
|
+
"@pandacss/extractor": "0.31.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"dev": "tsx scripts/watch.ts",
|