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