@pandacss/types 0.0.0-dev-20240130182551 → 0.0.0-dev-20240201214314

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,4 +1,4 @@
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
4
  import type { LoggerInterface } from './logger'
@@ -6,12 +6,54 @@ import type { ParserResultInterface } from './parser'
6
6
 
7
7
  type MaybeAsyncReturn<T = void> = Promise<T> | T
8
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
+
9
43
  export interface PandaHooks {
10
44
  /**
11
45
  * Called when the config is resolved, after all the presets are loaded and merged.
12
46
  * This is the first hook called, you can use it to tweak the config before the context is created.
13
47
  */
14
- '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
15
57
  /**
16
58
  * Called when the Panda context has been created and the API is ready to be used.
17
59
  */
@@ -31,6 +73,11 @@ export interface PandaHooks {
31
73
  * You can also use this hook to add your own extraction results from your custom parser to the ParserResult object.
32
74
  */
33
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
34
81
  /**
35
82
  * Called after the codegen is completed
36
83
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.0.0-dev-20240130182551",
3
+ "version": "0.0.0-dev-20240201214314",
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-20240130182551"
33
+ "@pandacss/extractor": "0.0.0-dev-20240201214314"
34
34
  },
35
35
  "scripts": {
36
36
  "dev": "tsx scripts/watch.ts",