@pandacss/generator 0.22.1 → 0.24.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/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
+ import { CoreContext, PatternDetail, RecipeNode, Stylesheet, StyleDecoder } from '@pandacss/core';
1
2
  import * as _pandacss_types from '@pandacss/types';
2
- import { UserConfig, PatternConfig, Dict, ArtifactFilters, ConfigResultWithHooks, RequiredBy, StudioOptions, HashOptions, PrefixOptions, Theme, CascadeLayers, TSConfig, ArtifactId, ParserResultType } from '@pandacss/types';
3
- import { Utility, Recipes, Conditions, Layers, Stylesheet, RecipeContext, RecipeNode } from '@pandacss/core';
4
- import { TokenDictionary } from '@pandacss/token-dictionary';
3
+ import { UserConfig, ConfigResultWithHooks, TSConfig, ArtifactId, CssArtifactType } from '@pandacss/types';
5
4
 
6
5
  declare class FileEngine {
7
6
  private config;
@@ -38,7 +37,7 @@ declare class PathEngine {
38
37
  private get cwd();
39
38
  private get emitPackage();
40
39
  private get outdir();
41
- private getFilePath;
40
+ getFilePath(file?: string): string[];
42
41
  get root(): string[];
43
42
  get css(): string[];
44
43
  get token(): string[];
@@ -49,68 +48,12 @@ declare class PathEngine {
49
48
  get jsx(): string[];
50
49
  }
51
50
 
52
- declare class Patterns {
53
- patterns: Record<string, PatternConfig>;
54
- details: PatternDetail[];
55
- constructor(config: UserConfig);
56
- private createDetail;
57
- get keys(): string[];
58
- getConfig(name: string): PatternConfig;
59
- transform(name: string, data: Dict): Dict;
60
- getNames(name: string): PatternNames;
61
- find: (jsxName: string) => string;
62
- filter: (jsxName: string) => PatternDetail[];
63
- isEmpty(): boolean;
64
- saveOne(name: string, pattern: PatternConfig): void;
65
- remove(name: string): void;
66
- filterDetails(filters?: ArtifactFilters): PatternDetail[];
67
- }
68
- interface PatternNames {
69
- upperName: string;
70
- baseName: string;
71
- dashName: string;
72
- styleFnName: string;
73
- jsxName: string;
74
- }
75
- interface PatternDetail extends PatternNames {
76
- props: string[];
77
- blocklistType: string;
78
- config: PatternConfig;
79
- type: 'pattern';
80
- match: RegExp;
81
- jsx: NonNullable<PatternConfig['jsx']>;
82
- }
83
-
84
- declare class Context {
51
+ declare class Context extends CoreContext {
85
52
  conf: ConfigResultWithHooks;
86
- studio: RequiredBy<NonNullable<StudioOptions['studio']>, 'outdir'>;
87
- tokens: TokenDictionary;
88
- utility: Utility;
89
- recipes: Recipes;
90
- conditions: Conditions;
91
- patterns: Patterns;
92
- layers: Layers;
93
53
  jsx: JsxEngine;
94
54
  paths: PathEngine;
95
55
  file: FileEngine;
96
- stylesheet: Stylesheet;
97
- properties: Set<string>;
98
- isValidProperty: (key: string) => boolean;
99
56
  constructor(conf: ConfigResultWithHooks);
100
- get config(): UserConfig;
101
- get hooks(): _pandacss_types.PandaHookable;
102
- get isTemplateLiteralSyntax(): boolean;
103
- get hash(): HashOptions;
104
- get prefix(): PrefixOptions;
105
- createTokenDictionary(theme: Theme): TokenDictionary;
106
- createUtility(config: UserConfig): Utility;
107
- createConditions(config: UserConfig): Conditions;
108
- createLayers(layers: CascadeLayers): Layers;
109
- setupCompositions(theme: Theme): void;
110
- setupProperties(): void;
111
- private get baseSheetContext();
112
- createSheet(): Stylesheet;
113
- createRecipes(theme: Theme, context: RecipeContext): Recipes;
114
57
  }
115
58
 
116
59
  declare const artifactsGenerated: (ctx: Context) => () => string;
@@ -145,18 +88,7 @@ declare const messages_noExtract: typeof noExtract;
145
88
  declare const messages_thankYou: typeof thankYou;
146
89
  declare const messages_watch: typeof watch;
147
90
  declare namespace messages {
148
- export {
149
- messages_artifactsGenerated as artifactsGenerated,
150
- messages_buildComplete as buildComplete,
151
- messages_codegenComplete as codegenComplete,
152
- messages_configExists as configExists,
153
- messages_configWatch as configWatch,
154
- messages_cssArtifactComplete as cssArtifactComplete,
155
- messages_getMessages as getMessages,
156
- messages_noExtract as noExtract,
157
- messages_thankYou as thankYou,
158
- messages_watch as watch,
159
- };
91
+ export { messages_artifactsGenerated as artifactsGenerated, messages_buildComplete as buildComplete, messages_codegenComplete as codegenComplete, messages_configExists as configExists, messages_configWatch as configWatch, messages_cssArtifactComplete as cssArtifactComplete, messages_getMessages as getMessages, messages_noExtract as noExtract, messages_thankYou as thankYou, messages_watch as watch };
160
92
  }
161
93
 
162
94
  interface ParserImportMap {
@@ -165,6 +97,7 @@ interface ParserImportMap {
165
97
  pattern: string[];
166
98
  jsx: string[];
167
99
  }
100
+
168
101
  interface ParserJsxOptions {
169
102
  framework: Context['jsx']['framework'];
170
103
  factory: Context['jsx']['factoryName'];
@@ -173,27 +106,30 @@ interface ParserJsxOptions {
173
106
  nodes: Array<PatternDetail | RecipeNode>;
174
107
  }
175
108
  interface ParserOptions {
176
- importMap: ParserImportMap;
109
+ hash: Context['hash'];
110
+ importMap: ParserImportMap | string;
177
111
  jsx: ParserJsxOptions;
178
- patternKeys: Context['patterns']['keys'];
179
- recipeKeys: Context['recipes']['keys'];
180
- getRecipesByJsxName: Context['recipes']['filter'];
181
- getPatternsByJsxName: Context['patterns']['filter'];
112
+ syntax: Context['config']['syntax'];
113
+ isValidProperty: Context['isValidProperty'];
114
+ recipes: Context['recipes'];
115
+ patterns: Context['patterns'];
116
+ encoder: Context['encoder'];
117
+ join: (...paths: string[]) => string;
182
118
  compilerOptions: TSConfig['compilerOptions'];
183
119
  tsOptions: ConfigResultWithHooks['tsOptions'];
184
120
  }
185
121
 
186
- type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
187
122
  declare class Generator extends Context {
188
123
  messages: ReturnType<typeof getMessages>;
189
124
  parserOptions: ParserOptions;
190
125
  constructor(conf: ConfigResultWithHooks);
191
- getArtifacts(ids?: ArtifactId[] | undefined): _pandacss_types.Artifact[];
192
- appendCss(type: CssArtifactType): void;
193
- appendLayerParams(): void;
194
- appendBaselineCss(): void;
195
- appendParserCss(...results: Array<ParserResultType | undefined>): void;
196
- getCss(): string;
126
+ getArtifacts: (ids?: ArtifactId[] | undefined) => _pandacss_types.Artifact[];
127
+ appendCssOfType: (type: CssArtifactType, sheet: Stylesheet) => void;
128
+ appendLayerParams: (sheet: Stylesheet) => void;
129
+ appendBaselineCss: (sheet: Stylesheet) => void;
130
+ appendParserCss: (sheet: Stylesheet) => void;
131
+ getParserCss: (decoder: StyleDecoder, filePath?: string) => string;
132
+ getCss: (stylesheet?: Stylesheet) => string;
197
133
  }
198
134
 
199
- export { CssArtifactType, Generator, messages };
135
+ export { Generator, type ParserOptions, messages };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
+ import { CoreContext, PatternDetail, RecipeNode, Stylesheet, StyleDecoder } from '@pandacss/core';
1
2
  import * as _pandacss_types from '@pandacss/types';
2
- import { UserConfig, PatternConfig, Dict, ArtifactFilters, ConfigResultWithHooks, RequiredBy, StudioOptions, HashOptions, PrefixOptions, Theme, CascadeLayers, TSConfig, ArtifactId, ParserResultType } from '@pandacss/types';
3
- import { Utility, Recipes, Conditions, Layers, Stylesheet, RecipeContext, RecipeNode } from '@pandacss/core';
4
- import { TokenDictionary } from '@pandacss/token-dictionary';
3
+ import { UserConfig, ConfigResultWithHooks, TSConfig, ArtifactId, CssArtifactType } from '@pandacss/types';
5
4
 
6
5
  declare class FileEngine {
7
6
  private config;
@@ -38,7 +37,7 @@ declare class PathEngine {
38
37
  private get cwd();
39
38
  private get emitPackage();
40
39
  private get outdir();
41
- private getFilePath;
40
+ getFilePath(file?: string): string[];
42
41
  get root(): string[];
43
42
  get css(): string[];
44
43
  get token(): string[];
@@ -49,68 +48,12 @@ declare class PathEngine {
49
48
  get jsx(): string[];
50
49
  }
51
50
 
52
- declare class Patterns {
53
- patterns: Record<string, PatternConfig>;
54
- details: PatternDetail[];
55
- constructor(config: UserConfig);
56
- private createDetail;
57
- get keys(): string[];
58
- getConfig(name: string): PatternConfig;
59
- transform(name: string, data: Dict): Dict;
60
- getNames(name: string): PatternNames;
61
- find: (jsxName: string) => string;
62
- filter: (jsxName: string) => PatternDetail[];
63
- isEmpty(): boolean;
64
- saveOne(name: string, pattern: PatternConfig): void;
65
- remove(name: string): void;
66
- filterDetails(filters?: ArtifactFilters): PatternDetail[];
67
- }
68
- interface PatternNames {
69
- upperName: string;
70
- baseName: string;
71
- dashName: string;
72
- styleFnName: string;
73
- jsxName: string;
74
- }
75
- interface PatternDetail extends PatternNames {
76
- props: string[];
77
- blocklistType: string;
78
- config: PatternConfig;
79
- type: 'pattern';
80
- match: RegExp;
81
- jsx: NonNullable<PatternConfig['jsx']>;
82
- }
83
-
84
- declare class Context {
51
+ declare class Context extends CoreContext {
85
52
  conf: ConfigResultWithHooks;
86
- studio: RequiredBy<NonNullable<StudioOptions['studio']>, 'outdir'>;
87
- tokens: TokenDictionary;
88
- utility: Utility;
89
- recipes: Recipes;
90
- conditions: Conditions;
91
- patterns: Patterns;
92
- layers: Layers;
93
53
  jsx: JsxEngine;
94
54
  paths: PathEngine;
95
55
  file: FileEngine;
96
- stylesheet: Stylesheet;
97
- properties: Set<string>;
98
- isValidProperty: (key: string) => boolean;
99
56
  constructor(conf: ConfigResultWithHooks);
100
- get config(): UserConfig;
101
- get hooks(): _pandacss_types.PandaHookable;
102
- get isTemplateLiteralSyntax(): boolean;
103
- get hash(): HashOptions;
104
- get prefix(): PrefixOptions;
105
- createTokenDictionary(theme: Theme): TokenDictionary;
106
- createUtility(config: UserConfig): Utility;
107
- createConditions(config: UserConfig): Conditions;
108
- createLayers(layers: CascadeLayers): Layers;
109
- setupCompositions(theme: Theme): void;
110
- setupProperties(): void;
111
- private get baseSheetContext();
112
- createSheet(): Stylesheet;
113
- createRecipes(theme: Theme, context: RecipeContext): Recipes;
114
57
  }
115
58
 
116
59
  declare const artifactsGenerated: (ctx: Context) => () => string;
@@ -145,18 +88,7 @@ declare const messages_noExtract: typeof noExtract;
145
88
  declare const messages_thankYou: typeof thankYou;
146
89
  declare const messages_watch: typeof watch;
147
90
  declare namespace messages {
148
- export {
149
- messages_artifactsGenerated as artifactsGenerated,
150
- messages_buildComplete as buildComplete,
151
- messages_codegenComplete as codegenComplete,
152
- messages_configExists as configExists,
153
- messages_configWatch as configWatch,
154
- messages_cssArtifactComplete as cssArtifactComplete,
155
- messages_getMessages as getMessages,
156
- messages_noExtract as noExtract,
157
- messages_thankYou as thankYou,
158
- messages_watch as watch,
159
- };
91
+ export { messages_artifactsGenerated as artifactsGenerated, messages_buildComplete as buildComplete, messages_codegenComplete as codegenComplete, messages_configExists as configExists, messages_configWatch as configWatch, messages_cssArtifactComplete as cssArtifactComplete, messages_getMessages as getMessages, messages_noExtract as noExtract, messages_thankYou as thankYou, messages_watch as watch };
160
92
  }
161
93
 
162
94
  interface ParserImportMap {
@@ -165,6 +97,7 @@ interface ParserImportMap {
165
97
  pattern: string[];
166
98
  jsx: string[];
167
99
  }
100
+
168
101
  interface ParserJsxOptions {
169
102
  framework: Context['jsx']['framework'];
170
103
  factory: Context['jsx']['factoryName'];
@@ -173,27 +106,30 @@ interface ParserJsxOptions {
173
106
  nodes: Array<PatternDetail | RecipeNode>;
174
107
  }
175
108
  interface ParserOptions {
176
- importMap: ParserImportMap;
109
+ hash: Context['hash'];
110
+ importMap: ParserImportMap | string;
177
111
  jsx: ParserJsxOptions;
178
- patternKeys: Context['patterns']['keys'];
179
- recipeKeys: Context['recipes']['keys'];
180
- getRecipesByJsxName: Context['recipes']['filter'];
181
- getPatternsByJsxName: Context['patterns']['filter'];
112
+ syntax: Context['config']['syntax'];
113
+ isValidProperty: Context['isValidProperty'];
114
+ recipes: Context['recipes'];
115
+ patterns: Context['patterns'];
116
+ encoder: Context['encoder'];
117
+ join: (...paths: string[]) => string;
182
118
  compilerOptions: TSConfig['compilerOptions'];
183
119
  tsOptions: ConfigResultWithHooks['tsOptions'];
184
120
  }
185
121
 
186
- type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
187
122
  declare class Generator extends Context {
188
123
  messages: ReturnType<typeof getMessages>;
189
124
  parserOptions: ParserOptions;
190
125
  constructor(conf: ConfigResultWithHooks);
191
- getArtifacts(ids?: ArtifactId[] | undefined): _pandacss_types.Artifact[];
192
- appendCss(type: CssArtifactType): void;
193
- appendLayerParams(): void;
194
- appendBaselineCss(): void;
195
- appendParserCss(...results: Array<ParserResultType | undefined>): void;
196
- getCss(): string;
126
+ getArtifacts: (ids?: ArtifactId[] | undefined) => _pandacss_types.Artifact[];
127
+ appendCssOfType: (type: CssArtifactType, sheet: Stylesheet) => void;
128
+ appendLayerParams: (sheet: Stylesheet) => void;
129
+ appendBaselineCss: (sheet: Stylesheet) => void;
130
+ appendParserCss: (sheet: Stylesheet) => void;
131
+ getParserCss: (decoder: StyleDecoder, filePath?: string) => string;
132
+ getCss: (stylesheet?: Stylesheet) => string;
197
133
  }
198
134
 
199
- export { CssArtifactType, Generator, messages };
135
+ export { Generator, type ParserOptions, messages };