@pandacss/types 0.29.1 → 0.30.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.
- package/dist/artifact.d.ts +2 -3
- package/dist/config.d.ts +2 -2
- package/dist/hooks.d.ts +70 -17
- package/dist/index.d.ts +1 -0
- package/dist/logger.d.ts +23 -0
- package/dist/parser.d.ts +1 -1
- package/package.json +2 -2
package/dist/artifact.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Difference } from 'microdiff'
|
|
2
|
-
import type { Nullable } from './shared'
|
|
3
2
|
|
|
4
3
|
export interface ArtifactContent {
|
|
5
4
|
file: string
|
|
@@ -31,11 +30,11 @@ export type ArtifactId =
|
|
|
31
30
|
|
|
32
31
|
export type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes'
|
|
33
32
|
|
|
34
|
-
export type Artifact =
|
|
33
|
+
export type Artifact = {
|
|
35
34
|
id: ArtifactId
|
|
36
35
|
dir?: string[]
|
|
37
36
|
files: ArtifactContent[]
|
|
38
|
-
}
|
|
37
|
+
}
|
|
39
38
|
|
|
40
39
|
export interface AffectedArtifacts {
|
|
41
40
|
recipes: string[]
|
package/dist/config.d.ts
CHANGED
|
@@ -354,12 +354,12 @@ export interface Config
|
|
|
354
354
|
*/
|
|
355
355
|
eject?: boolean
|
|
356
356
|
/**
|
|
357
|
-
* The validation
|
|
357
|
+
* The validation strictness to use when validating the config.
|
|
358
358
|
* - When set to 'none', no validation will be performed.
|
|
359
359
|
* - When set to 'warn', warnings will be logged when validation fails.
|
|
360
360
|
* - When set to 'error', errors will be thrown when validation fails.
|
|
361
361
|
*
|
|
362
|
-
* @default '
|
|
362
|
+
* @default 'warn'
|
|
363
363
|
*/
|
|
364
364
|
validation?: 'none' | 'warn' | 'error'
|
|
365
365
|
}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import type { ArtifactId, DiffConfigResult } from './artifact'
|
|
1
|
+
import type { Artifact, ArtifactId, DiffConfigResult } from './artifact'
|
|
2
2
|
import type { LoadConfigResult, UserConfig } from './config'
|
|
3
3
|
import type { HooksApiInterface } from './hooks-api'
|
|
4
|
+
import type { LoggerInterface } from './logger'
|
|
4
5
|
import type { ParserResultInterface } from './parser'
|
|
5
6
|
|
|
6
|
-
type MaybeAsyncReturn<T = void> = Promise<T> | T
|
|
7
|
-
|
|
8
7
|
export interface PandaHooks {
|
|
9
8
|
/**
|
|
10
9
|
* Called when the config is resolved, after all the presets are loaded and merged.
|
|
11
10
|
* This is the first hook called, you can use it to tweak the config before the context is created.
|
|
12
11
|
*/
|
|
13
|
-
'config:resolved': (args:
|
|
12
|
+
'config:resolved': (args: ConfigResolvedHookArgs) => MaybeAsyncReturn<void | ConfigResolvedHookArgs['config']>
|
|
13
|
+
/**
|
|
14
|
+
* Called when the token engine has been created
|
|
15
|
+
*/
|
|
16
|
+
'tokens:created': (args: TokenCreatedHookArgs) => MaybeAsyncReturn
|
|
17
|
+
/**
|
|
18
|
+
* Called when the classname engine has been created
|
|
19
|
+
*/
|
|
20
|
+
'utility:created': (args: UtilityCreatedHookArgs) => MaybeAsyncReturn
|
|
14
21
|
/**
|
|
15
22
|
* Called when the Panda context has been created and the API is ready to be used.
|
|
16
23
|
*/
|
|
@@ -30,6 +37,11 @@ export interface PandaHooks {
|
|
|
30
37
|
* You can also use this hook to add your own extraction results from your custom parser to the ParserResult object.
|
|
31
38
|
*/
|
|
32
39
|
'parser:after': (args: { filePath: string; result: ParserResultInterface | undefined }) => void
|
|
40
|
+
/**
|
|
41
|
+
* Called right before writing the codegen files to disk.
|
|
42
|
+
* You can use this hook to tweak the codegen files before they are written to disk.
|
|
43
|
+
*/
|
|
44
|
+
'codegen:prepare': (args: { artifacts: Artifact[]; changed: ArtifactId[] | undefined }) => MaybeAsyncReturn
|
|
33
45
|
/**
|
|
34
46
|
* Called after the codegen is completed
|
|
35
47
|
*/
|
|
@@ -45,17 +57,58 @@ export interface PandaHooks {
|
|
|
45
57
|
}) => string | void
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
type MaybeAsyncReturn<T = void> = Promise<T> | T
|
|
61
|
+
|
|
62
|
+
interface TokenCssVarOptions {
|
|
63
|
+
fallback?: string
|
|
64
|
+
prefix?: string
|
|
65
|
+
hash?: boolean
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface TokenCssVar {
|
|
69
|
+
var: `--${string}`
|
|
70
|
+
ref: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface TokenConfigureOptions {
|
|
74
|
+
formatTokenName?: (path: string[]) => string
|
|
75
|
+
formatCssVar?: (path: string[], options: TokenCssVarOptions) => TokenCssVar
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface TokenCreatedHookArgs {
|
|
79
|
+
configure(opts: TokenConfigureOptions): void
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface UtilityConfigureOptions {
|
|
83
|
+
toHash?(path: string[], toHash: (str: string) => string): string
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface UtilityCreatedHookArgs {
|
|
87
|
+
configure(opts: UtilityConfigureOptions): void
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface ConfigResolvedHookUtils {
|
|
91
|
+
omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Omit<T, K>
|
|
92
|
+
traverse: TraverseFn
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface ConfigResolvedHookArgs {
|
|
96
|
+
config: LoadConfigResult['config']
|
|
97
|
+
path: string
|
|
98
|
+
dependencies: string[]
|
|
99
|
+
utils: ConfigResolvedHookUtils
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type CallbackFn = (args: CallbackItem) => void
|
|
103
|
+
type CallbackItem = { value: any; path: string; depth: number; parent: any[] | Record<string, unknown>; key: string }
|
|
104
|
+
|
|
105
|
+
interface TraverseFn {
|
|
106
|
+
(
|
|
107
|
+
obj: any,
|
|
108
|
+
callback: CallbackFn,
|
|
109
|
+
options?: {
|
|
110
|
+
separator: string
|
|
111
|
+
maxDepth?: number | undefined
|
|
112
|
+
},
|
|
113
|
+
): void
|
|
61
114
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
log: (data: string) => void
|
|
18
|
+
time: {
|
|
19
|
+
info: (msg: string) => (_msg?: string) => void
|
|
20
|
+
debug: (msg: string) => (_msg?: string) => void
|
|
21
|
+
}
|
|
22
|
+
isDebug: boolean
|
|
23
|
+
}
|
package/dist/parser.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { BoxNodeArray, BoxNodeLiteral, BoxNodeMap, Unboxed } from '@pandacs
|
|
|
3
3
|
export interface ResultItem {
|
|
4
4
|
name?: string
|
|
5
5
|
data: Array<Unboxed['raw']>
|
|
6
|
-
type?: '
|
|
6
|
+
type?: 'css' | 'cva' | 'sva' | 'pattern' | 'recipe' | 'jsx-factory' | 'jsx-pattern' | 'jsx-recipe' | 'jsx'
|
|
7
7
|
box?: BoxNodeMap | BoxNodeLiteral | BoxNodeArray
|
|
8
8
|
}
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.1",
|
|
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.30.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"dev": "tsx scripts/watch.ts",
|