@pandacss/generator 0.0.0-dev-20230613112708 → 0.0.0-dev-20230613150904

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.ts CHANGED
@@ -1,87 +1,15 @@
1
- import * as _pandacss_token_dictionary from '@pandacss/token-dictionary';
2
- import * as _pandacss_core from '@pandacss/core';
3
- import * as _pandacss_types_dist_shared from '@pandacss/types/dist/shared';
4
- import * as _pandacss_types_dist_config from '@pandacss/types/dist/config';
5
1
  import * as _pandacss_types from '@pandacss/types';
6
2
  import { LoadConfigResult } from '@pandacss/types';
3
+ import * as _pandacss_types_dist_config from '@pandacss/types/dist/config';
7
4
 
8
- declare const getEngine: (conf: LoadConfigResult) => {
9
- patterns: {
10
- transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
11
- nodes: {
12
- type: "pattern";
13
- name: string;
14
- props: string[];
15
- baseName: string;
16
- }[];
17
- patterns: Record<string, _pandacss_types.PatternConfig>;
18
- getConfig: (name: string) => _pandacss_types.PatternConfig;
19
- getNames: (name: string) => {
20
- name: string;
21
- upperName: string;
22
- dashName: string;
23
- styleFnName: string;
24
- jsxName: string;
25
- };
26
- details: {
27
- props: string[];
28
- blocklistType: string;
29
- config: _pandacss_types.PatternConfig;
30
- name: string;
31
- upperName: string;
32
- dashName: string;
33
- styleFnName: string;
34
- jsxName: string;
35
- }[];
36
- getFnName: (jsx: string) => string;
37
- isEmpty: () => boolean;
38
- };
39
- jsx: {
40
- factoryName: string;
41
- upperName: string;
42
- typeName: string;
43
- componentName: string;
44
- framework: _pandacss_types_dist_config.JsxFramework | undefined;
45
- };
46
- paths: {
47
- get: (file?: string | undefined) => string[];
48
- root: string[];
49
- css: string[];
50
- token: string[];
51
- types: string[];
52
- recipe: string[];
53
- pattern: string[];
54
- chunk: string[];
55
- outCss: string[];
56
- jsx: string[];
57
- };
58
- file: {
59
- ext(file: string): string;
60
- import(mod: string, file: string): string;
61
- export(file: string): string;
62
- };
63
- config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
64
- path: string;
65
- conditions: _pandacss_core.Conditions;
66
- utility: _pandacss_core.Utility;
67
- tokens: _pandacss_token_dictionary.TokenDictionary;
68
- recipes: _pandacss_core.Recipes;
69
- configDependencies: string[];
70
- dependencies: string[];
71
- createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
72
- properties: string[];
73
- isValidProperty: (key: string) => boolean;
74
- };
75
- type Context = ReturnType<typeof getEngine>;
76
-
77
- declare const artifactsGenerated: (ctx: Context) => () => string;
5
+ declare const artifactsGenerated: (ctx: any) => () => string;
78
6
  declare const configExists: (cmd: string) => string;
79
7
  declare const thankYou: () => string;
80
8
  declare const codegenComplete: () => string;
81
9
  declare const noExtract: () => string;
82
10
  declare const watch: () => string;
83
11
  declare const buildComplete: (count: number) => string;
84
- declare const getMessages: (ctx: Context) => {
12
+ declare const getMessages: (ctx: any) => {
85
13
  artifactsGenerated: () => string;
86
14
  configExists: (cmd: string) => string;
87
15
  thankYou: () => string;
@@ -113,11 +41,13 @@ declare namespace messages {
113
41
  }
114
42
 
115
43
  declare const createGenerator: (conf: LoadConfigResult) => {
116
- config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
117
- path: string;
118
- conditions: _pandacss_core.Conditions;
119
- utility: _pandacss_core.Utility;
120
- tokens: _pandacss_token_dictionary.TokenDictionary;
44
+ config: any;
45
+ path: any;
46
+ conditions: any;
47
+ utility: any;
48
+ hash: any;
49
+ prefix: any;
50
+ tokens: any;
121
51
  jsx: {
122
52
  factoryName: string;
123
53
  upperName: string;
@@ -125,9 +55,9 @@ declare const createGenerator: (conf: LoadConfigResult) => {
125
55
  componentName: string;
126
56
  framework: _pandacss_types_dist_config.JsxFramework | undefined;
127
57
  };
128
- recipes: _pandacss_core.Recipes;
129
- configDependencies: string[];
130
- dependencies: string[];
58
+ recipes: any;
59
+ configDependencies: any;
60
+ dependencies: any;
131
61
  patterns: {
132
62
  transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
133
63
  nodes: {
@@ -158,15 +88,16 @@ declare const createGenerator: (conf: LoadConfigResult) => {
158
88
  getFnName: (jsx: string) => string;
159
89
  isEmpty: () => boolean;
160
90
  };
161
- createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
162
- properties: string[];
163
- isValidProperty: (key: string) => boolean;
91
+ createSheetContext: any;
92
+ createSheet: any;
93
+ properties: any;
94
+ isValidProperty: any;
164
95
  getArtifacts: () => _pandacss_types.Artifact[];
165
96
  getCss: (options: {
166
97
  files: string[];
167
98
  resolve?: boolean | undefined;
168
- }) => string;
169
- getParserCss: (result: _pandacss_types.ParserResultType) => string | undefined;
99
+ }) => any;
100
+ getParserCss: (result: _pandacss_types.ParserResultType) => any;
170
101
  messages: {
171
102
  artifactsGenerated: () => string;
172
103
  configExists: (cmd: string) => string;
@@ -202,23 +133,11 @@ declare const createGenerator: (conf: LoadConfigResult) => {
202
133
  };
203
134
  jsx: {
204
135
  factory: string;
205
- isStyleProp: (key: string) => boolean;
206
- nodes: ({
207
- type: "pattern";
208
- name: string;
209
- props: string[];
210
- baseName: string;
211
- } | {
212
- type: "recipe";
213
- name: string;
214
- props: string[];
215
- baseName: string;
216
- jsx: (string | RegExp)[];
217
- match: RegExp;
218
- })[];
136
+ isStyleProp: any;
137
+ nodes: any[];
219
138
  };
220
- getRecipeName: (jsxName: string) => string;
221
- getRecipeByName: (name: string) => _pandacss_types.RecipeConfig | undefined;
139
+ getRecipeName: any;
140
+ getRecipeByName: any;
222
141
  };
223
142
  };
224
143
  type Generator = ReturnType<typeof createGenerator>;
package/dist/index.js CHANGED
@@ -2555,36 +2555,65 @@ var helpers = { map: import_shared5.mapObject };
2555
2555
  var getBaseEngine = (conf) => (0, import_lil_fp.pipe)(
2556
2556
  conf,
2557
2557
  import_lil_fp.Obj.bind("configDependencies", ({ dependencies }) => dependencies ?? []),
2558
- import_lil_fp.Obj.bind("tokens", ({ config: { theme = {}, prefix, hash } }) => {
2558
+ import_lil_fp.Obj.assign(({ config: { hash, prefix } }) => ({
2559
+ hash: {
2560
+ tokens: (0, import_lil_fp.isBool)(hash) ? hash : hash?.cssVar,
2561
+ className: (0, import_lil_fp.isBool)(hash) ? hash : hash?.className
2562
+ },
2563
+ prefix: {
2564
+ tokens: (0, import_lil_fp.isStr)(prefix) ? prefix : prefix?.cssVar,
2565
+ className: (0, import_lil_fp.isStr)(prefix) ? prefix : prefix?.className
2566
+ }
2567
+ })),
2568
+ import_lil_fp.Obj.bind("tokens", ({ hash, prefix, config: { theme = {} } }) => {
2559
2569
  const { breakpoints, tokens, semanticTokens } = theme;
2560
- return new import_token_dictionary.TokenDictionary({ breakpoints, tokens, semanticTokens, prefix, hash });
2570
+ return new import_token_dictionary.TokenDictionary({
2571
+ breakpoints,
2572
+ tokens,
2573
+ semanticTokens,
2574
+ prefix: prefix.tokens,
2575
+ hash: hash.tokens
2576
+ });
2561
2577
  }),
2562
2578
  (0, import_lil_fp.tap)(({ tokens }) => {
2563
2579
  import_logger3.logger.debug("generator:tokens", tokens.allNames);
2564
2580
  }),
2565
- import_lil_fp.Obj.bind("utility", ({ config: { prefix, utilities, separator }, tokens }) => {
2566
- return new import_core4.Utility({ prefix, tokens, config: utilities, separator });
2581
+ import_lil_fp.Obj.bind("utility", ({ config: { utilities, separator }, tokens, prefix }) => {
2582
+ return new import_core4.Utility({
2583
+ prefix: prefix.className,
2584
+ tokens,
2585
+ config: utilities,
2586
+ separator
2587
+ });
2567
2588
  }),
2568
2589
  import_lil_fp.Obj.bind("conditions", ({ config: { conditions, theme } }) => {
2569
2590
  const { breakpoints } = theme ?? {};
2570
2591
  return new import_core4.Conditions({ conditions, breakpoints });
2571
2592
  }),
2572
2593
  (0, import_lil_fp.tap)(({ conditions, utility, config: { theme } }) => {
2573
- import_logger3.logger.debug("generator:conditions", conditions);
2574
2594
  const { textStyles, layerStyles } = theme ?? {};
2575
2595
  const compositions = (0, import_shared5.compact)({ textStyle: textStyles, layerStyle: layerStyles });
2576
2596
  (0, import_core4.assignCompositions)({ conditions, utility }, compositions);
2577
2597
  }),
2578
- import_lil_fp.Obj.bind("recipes", ({ conditions, utility, config: { hash, theme } }) => {
2579
- const context = { root: import_postcss3.default.root(), conditions, utility, hash, helpers };
2598
+ import_lil_fp.Obj.bind("createSheetContext", ({ conditions, utility, hash }) => {
2599
+ return () => ({
2600
+ root: import_postcss3.default.root(),
2601
+ conditions,
2602
+ utility,
2603
+ hash: hash.className,
2604
+ helpers
2605
+ });
2606
+ }),
2607
+ import_lil_fp.Obj.bind("recipes", ({ config: { theme }, createSheetContext }) => {
2608
+ const context = createSheetContext();
2580
2609
  const recipes = new import_core4.Recipes(theme?.recipes ?? {}, context);
2581
2610
  recipes.save();
2582
2611
  return recipes;
2583
2612
  }),
2584
2613
  import_lil_fp.Obj.bind(
2585
2614
  "createSheet",
2586
- ({ conditions, utility, config: { hash, theme } }) => (options) => {
2587
- const context = { root: import_postcss3.default.root(), conditions, utility, hash, helpers };
2615
+ ({ config: { theme }, createSheetContext }) => (options) => {
2616
+ const context = createSheetContext();
2588
2617
  return new import_core4.Stylesheet(context, {
2589
2618
  content: options?.content,
2590
2619
  recipes: theme?.recipes
package/dist/index.mjs CHANGED
@@ -2513,47 +2513,82 @@ var generateParserCss = (ctx) => (result) => pipe(
2513
2513
  );
2514
2514
 
2515
2515
  // src/engines/base.ts
2516
- import { Conditions, Recipes, Stylesheet, Utility, assignCompositions } from "@pandacss/core";
2516
+ import {
2517
+ Conditions,
2518
+ Recipes,
2519
+ Stylesheet,
2520
+ Utility,
2521
+ assignCompositions
2522
+ } from "@pandacss/core";
2517
2523
  import { isCssProperty } from "@pandacss/is-valid-prop";
2518
2524
  import { logger as logger2 } from "@pandacss/logger";
2519
2525
  import { compact, mapObject, memo } from "@pandacss/shared";
2520
2526
  import { TokenDictionary } from "@pandacss/token-dictionary";
2521
- import { Obj, pipe as pipe2, tap as tap2 } from "lil-fp";
2527
+ import { Obj, isBool, isStr, pipe as pipe2, tap as tap2 } from "lil-fp";
2522
2528
  import postcss3 from "postcss";
2523
2529
  var helpers = { map: mapObject };
2524
2530
  var getBaseEngine = (conf) => pipe2(
2525
2531
  conf,
2526
2532
  Obj.bind("configDependencies", ({ dependencies }) => dependencies ?? []),
2527
- Obj.bind("tokens", ({ config: { theme = {}, prefix, hash } }) => {
2533
+ Obj.assign(({ config: { hash, prefix } }) => ({
2534
+ hash: {
2535
+ tokens: isBool(hash) ? hash : hash?.cssVar,
2536
+ className: isBool(hash) ? hash : hash?.className
2537
+ },
2538
+ prefix: {
2539
+ tokens: isStr(prefix) ? prefix : prefix?.cssVar,
2540
+ className: isStr(prefix) ? prefix : prefix?.className
2541
+ }
2542
+ })),
2543
+ Obj.bind("tokens", ({ hash, prefix, config: { theme = {} } }) => {
2528
2544
  const { breakpoints, tokens, semanticTokens } = theme;
2529
- return new TokenDictionary({ breakpoints, tokens, semanticTokens, prefix, hash });
2545
+ return new TokenDictionary({
2546
+ breakpoints,
2547
+ tokens,
2548
+ semanticTokens,
2549
+ prefix: prefix.tokens,
2550
+ hash: hash.tokens
2551
+ });
2530
2552
  }),
2531
2553
  tap2(({ tokens }) => {
2532
2554
  logger2.debug("generator:tokens", tokens.allNames);
2533
2555
  }),
2534
- Obj.bind("utility", ({ config: { prefix, utilities, separator }, tokens }) => {
2535
- return new Utility({ prefix, tokens, config: utilities, separator });
2556
+ Obj.bind("utility", ({ config: { utilities, separator }, tokens, prefix }) => {
2557
+ return new Utility({
2558
+ prefix: prefix.className,
2559
+ tokens,
2560
+ config: utilities,
2561
+ separator
2562
+ });
2536
2563
  }),
2537
2564
  Obj.bind("conditions", ({ config: { conditions, theme } }) => {
2538
2565
  const { breakpoints } = theme ?? {};
2539
2566
  return new Conditions({ conditions, breakpoints });
2540
2567
  }),
2541
2568
  tap2(({ conditions, utility, config: { theme } }) => {
2542
- logger2.debug("generator:conditions", conditions);
2543
2569
  const { textStyles, layerStyles } = theme ?? {};
2544
2570
  const compositions = compact({ textStyle: textStyles, layerStyle: layerStyles });
2545
2571
  assignCompositions({ conditions, utility }, compositions);
2546
2572
  }),
2547
- Obj.bind("recipes", ({ conditions, utility, config: { hash, theme } }) => {
2548
- const context = { root: postcss3.root(), conditions, utility, hash, helpers };
2573
+ Obj.bind("createSheetContext", ({ conditions, utility, hash }) => {
2574
+ return () => ({
2575
+ root: postcss3.root(),
2576
+ conditions,
2577
+ utility,
2578
+ hash: hash.className,
2579
+ helpers
2580
+ });
2581
+ }),
2582
+ Obj.bind("recipes", ({ config: { theme }, createSheetContext }) => {
2583
+ const context = createSheetContext();
2549
2584
  const recipes = new Recipes(theme?.recipes ?? {}, context);
2550
2585
  recipes.save();
2551
2586
  return recipes;
2552
2587
  }),
2553
2588
  Obj.bind(
2554
2589
  "createSheet",
2555
- ({ conditions, utility, config: { hash, theme } }) => (options) => {
2556
- const context = { root: postcss3.root(), conditions, utility, hash, helpers };
2590
+ ({ config: { theme }, createSheetContext }) => (options) => {
2591
+ const context = createSheetContext();
2557
2592
  return new Stylesheet(context, {
2558
2593
  content: options?.content,
2559
2594
  recipes: theme?.recipes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20230613112708",
3
+ "version": "0.0.0-dev-20230613150904",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,16 +20,16 @@
20
20
  "pluralize": "8.0.0",
21
21
  "postcss": "8.4.24",
22
22
  "ts-pattern": "4.3.0",
23
- "@pandacss/core": "0.0.0-dev-20230613112708",
24
- "@pandacss/logger": "0.0.0-dev-20230613112708",
25
- "@pandacss/is-valid-prop": "0.0.0-dev-20230613112708",
26
- "@pandacss/shared": "0.0.0-dev-20230613112708",
27
- "@pandacss/types": "0.0.0-dev-20230613112708",
28
- "@pandacss/token-dictionary": "0.0.0-dev-20230613112708"
23
+ "@pandacss/core": "0.0.0-dev-20230613150904",
24
+ "@pandacss/logger": "0.0.0-dev-20230613150904",
25
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230613150904",
26
+ "@pandacss/shared": "0.0.0-dev-20230613150904",
27
+ "@pandacss/types": "0.0.0-dev-20230613150904",
28
+ "@pandacss/token-dictionary": "0.0.0-dev-20230613150904"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.29",
32
- "@pandacss/fixture": "0.0.0-dev-20230613112708"
32
+ "@pandacss/fixture": "0.0.0-dev-20230613150904"
33
33
  },
34
34
  "scripts": {
35
35
  "prebuild": "tsx scripts/prebuild.ts",