@pandacss/types 0.0.0-dev-20240130133424 → 0.0.0-dev-20240201185610

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.
@@ -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 = Nullable<{
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/hooks.d.ts CHANGED
@@ -1,16 +1,59 @@
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
7
  type MaybeAsyncReturn<T = void> = Promise<T> | T
7
8
 
9
+ interface TokenCssVarOptions {
10
+ fallback?: string
11
+ prefix?: string
12
+ hash?: boolean
13
+ }
14
+
15
+ interface TokenCssVar {
16
+ var: `--${string}`
17
+ ref: string
18
+ }
19
+
20
+ export interface TokenConfigureOptions {
21
+ formatTokenName?: (path: string[]) => string
22
+ formatCssVar?: (path: string[], options: TokenCssVarOptions) => TokenCssVar
23
+ }
24
+
25
+ export interface TokenCreatedHookArgs {
26
+ configure(opts: TokenConfigureOptions): void
27
+ }
28
+
29
+ export interface UtilityConfigureOptions {
30
+ toHash?(path: string[], toHash: (str: string) => string): string
31
+ }
32
+
33
+ export interface UtilityCreatedHookArgs {
34
+ configure(opts: UtilityConfigureOptions): void
35
+ }
36
+
37
+ export interface ConfigResolvedHookArgs {
38
+ config: LoadConfigResult['config']
39
+ path: string
40
+ dependencies: string[]
41
+ }
42
+
8
43
  export interface PandaHooks {
9
44
  /**
10
45
  * Called when the config is resolved, after all the presets are loaded and merged.
11
46
  * This is the first hook called, you can use it to tweak the config before the context is created.
12
47
  */
13
- 'config:resolved': (args: { conf: LoadConfigResult }) => MaybeAsyncReturn
48
+ 'config:resolved': (args: ConfigResolvedHookArgs) => MaybeAsyncReturn
49
+ /**
50
+ * Called when the token engine has been created
51
+ */
52
+ 'tokens:created': (args: TokenCreatedHookArgs) => MaybeAsyncReturn
53
+ /**
54
+ * Called when the classname engine has been created
55
+ */
56
+ 'utility:created': (args: UtilityCreatedHookArgs) => MaybeAsyncReturn
14
57
  /**
15
58
  * Called when the Panda context has been created and the API is ready to be used.
16
59
  */
@@ -30,6 +73,11 @@ export interface PandaHooks {
30
73
  * You can also use this hook to add your own extraction results from your custom parser to the ParserResult object.
31
74
  */
32
75
  'parser:after': (args: { filePath: string; result: ParserResultInterface | undefined }) => void
76
+ /**
77
+ * Called right before writing the codegen files to disk.
78
+ * You can use this hook to tweak the codegen files before they are written to disk.
79
+ */
80
+ 'codegen:prepare': (args: { artifacts: Artifact[]; changed: ArtifactId[] | undefined }) => MaybeAsyncReturn
33
81
  /**
34
82
  * Called after the codegen is completed
35
83
  */
@@ -44,18 +92,3 @@ export interface PandaHooks {
44
92
  content: string
45
93
  }) => string | void
46
94
  }
47
-
48
- export interface LoggerInterface {
49
- level: 'debug' | 'info' | 'warn' | 'error' | 'silent'
50
- print(data: any): void
51
- warn: (type: string, data: any) => void
52
- info: (type: string, data: any) => void
53
- debug: (type: string, data: any) => void
54
- error: (type: string, data: any) => void
55
- log: (data: string) => void
56
- time: {
57
- info: (msg: string) => (_msg?: string) => void
58
- debug: (msg: string) => (_msg?: string) => void
59
- }
60
- isDebug: boolean
61
- }
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export type * from './conditions'
5
5
  export type * from './config'
6
6
  export type * from './hooks'
7
7
  export type * from './hooks-api'
8
+ export type * from './logger'
8
9
  export type * from './parser'
9
10
  export type * from './parts'
10
11
  export type * from './pattern'
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.0.0-dev-20240130133424",
3
+ "version": "0.0.0-dev-20240201185610",
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.0.0-dev-20240130133424"
33
+ "@pandacss/extractor": "0.0.0-dev-20240201185610"
34
34
  },
35
35
  "scripts": {
36
36
  "dev": "tsx scripts/watch.ts",