@pandacss/generator 0.0.0-dev-20230613153802 → 0.0.0-dev-20230613163214
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 +120 -23
- package/dist/index.js +73 -80
- package/dist/index.mjs +87 -94
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,95 @@
|
|
|
1
|
+
import * as _pandacss_types_dist_shared from '@pandacss/types/dist/shared';
|
|
2
|
+
import * as _pandacss_core from '@pandacss/core';
|
|
3
|
+
import * as _pandacss_token_dictionary from '@pandacss/token-dictionary';
|
|
4
|
+
import * as _pandacss_types_dist_config from '@pandacss/types/dist/config';
|
|
1
5
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
6
|
import { LoadConfigResult } from '@pandacss/types';
|
|
3
|
-
import * as _pandacss_types_dist_config from '@pandacss/types/dist/config';
|
|
4
7
|
|
|
5
|
-
declare const
|
|
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
|
+
hash: {
|
|
64
|
+
tokens: boolean | undefined;
|
|
65
|
+
className: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
prefix: {
|
|
68
|
+
tokens: string | undefined;
|
|
69
|
+
className: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
tokens: _pandacss_token_dictionary.TokenDictionary;
|
|
72
|
+
utility: _pandacss_core.Utility;
|
|
73
|
+
properties: string[];
|
|
74
|
+
isValidProperty: (key: string) => boolean;
|
|
75
|
+
recipes: _pandacss_core.Recipes;
|
|
76
|
+
conditions: _pandacss_core.Conditions;
|
|
77
|
+
createSheetContext: () => _pandacss_core.StylesheetContext;
|
|
78
|
+
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
79
|
+
path: string;
|
|
80
|
+
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
|
|
81
|
+
dependencies: string[];
|
|
82
|
+
};
|
|
83
|
+
type Context = ReturnType<typeof getEngine>;
|
|
84
|
+
|
|
85
|
+
declare const artifactsGenerated: (ctx: Context) => () => string;
|
|
6
86
|
declare const configExists: (cmd: string) => string;
|
|
7
87
|
declare const thankYou: () => string;
|
|
8
88
|
declare const codegenComplete: () => string;
|
|
9
89
|
declare const noExtract: () => string;
|
|
10
90
|
declare const watch: () => string;
|
|
11
91
|
declare const buildComplete: (count: number) => string;
|
|
12
|
-
declare const getMessages: (ctx:
|
|
92
|
+
declare const getMessages: (ctx: Context) => {
|
|
13
93
|
artifactsGenerated: () => string;
|
|
14
94
|
configExists: (cmd: string) => string;
|
|
15
95
|
thankYou: () => string;
|
|
@@ -41,13 +121,19 @@ declare namespace messages {
|
|
|
41
121
|
}
|
|
42
122
|
|
|
43
123
|
declare const createGenerator: (conf: LoadConfigResult) => {
|
|
44
|
-
config:
|
|
45
|
-
path:
|
|
46
|
-
conditions:
|
|
47
|
-
utility:
|
|
48
|
-
hash:
|
|
49
|
-
|
|
50
|
-
|
|
124
|
+
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
|
|
125
|
+
path: string;
|
|
126
|
+
conditions: _pandacss_core.Conditions;
|
|
127
|
+
utility: _pandacss_core.Utility;
|
|
128
|
+
hash: {
|
|
129
|
+
tokens: boolean | undefined;
|
|
130
|
+
className: boolean | undefined;
|
|
131
|
+
};
|
|
132
|
+
prefix: {
|
|
133
|
+
tokens: string | undefined;
|
|
134
|
+
className: string | undefined;
|
|
135
|
+
};
|
|
136
|
+
tokens: _pandacss_token_dictionary.TokenDictionary;
|
|
51
137
|
jsx: {
|
|
52
138
|
factoryName: string;
|
|
53
139
|
upperName: string;
|
|
@@ -55,9 +141,7 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
55
141
|
componentName: string;
|
|
56
142
|
framework: _pandacss_types_dist_config.JsxFramework | undefined;
|
|
57
143
|
};
|
|
58
|
-
recipes:
|
|
59
|
-
configDependencies: any;
|
|
60
|
-
dependencies: any;
|
|
144
|
+
recipes: _pandacss_core.Recipes;
|
|
61
145
|
patterns: {
|
|
62
146
|
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
63
147
|
nodes: {
|
|
@@ -88,16 +172,14 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
88
172
|
getFnName: (jsx: string) => string;
|
|
89
173
|
isEmpty: () => boolean;
|
|
90
174
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
properties: any;
|
|
94
|
-
isValidProperty: any;
|
|
175
|
+
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
176
|
+
properties: string[];
|
|
95
177
|
getArtifacts: () => _pandacss_types.Artifact[];
|
|
96
178
|
getCss: (options: {
|
|
97
179
|
files: string[];
|
|
98
180
|
resolve?: boolean | undefined;
|
|
99
|
-
}) =>
|
|
100
|
-
getParserCss: (result: _pandacss_types.ParserResultType) =>
|
|
181
|
+
}) => string;
|
|
182
|
+
getParserCss: (result: _pandacss_types.ParserResultType) => string | undefined;
|
|
101
183
|
messages: {
|
|
102
184
|
artifactsGenerated: () => string;
|
|
103
185
|
configExists: (cmd: string) => string;
|
|
@@ -124,6 +206,9 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
124
206
|
import(mod: string, file: string): string;
|
|
125
207
|
export(file: string): string;
|
|
126
208
|
};
|
|
209
|
+
isValidProperty: (key: string) => boolean;
|
|
210
|
+
createSheetContext: () => _pandacss_core.StylesheetContext;
|
|
211
|
+
dependencies: string[];
|
|
127
212
|
parserOptions: {
|
|
128
213
|
importMap: {
|
|
129
214
|
css: string;
|
|
@@ -133,11 +218,23 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
133
218
|
};
|
|
134
219
|
jsx: {
|
|
135
220
|
factory: string;
|
|
136
|
-
isStyleProp:
|
|
137
|
-
nodes:
|
|
221
|
+
isStyleProp: (key: string) => boolean;
|
|
222
|
+
nodes: ({
|
|
223
|
+
type: "pattern";
|
|
224
|
+
name: string;
|
|
225
|
+
props: string[];
|
|
226
|
+
baseName: string;
|
|
227
|
+
} | {
|
|
228
|
+
type: "recipe";
|
|
229
|
+
name: string;
|
|
230
|
+
props: string[];
|
|
231
|
+
baseName: string;
|
|
232
|
+
jsx: (string | RegExp)[];
|
|
233
|
+
match: RegExp;
|
|
234
|
+
})[];
|
|
138
235
|
};
|
|
139
|
-
getRecipeName:
|
|
140
|
-
getRecipeByName:
|
|
236
|
+
getRecipeName: (jsxName: string) => string;
|
|
237
|
+
getRecipeByName: (name: string) => _pandacss_types.RecipeConfig | undefined;
|
|
141
238
|
};
|
|
142
239
|
};
|
|
143
240
|
type Generator = ReturnType<typeof createGenerator>;
|
package/dist/index.js
CHANGED
|
@@ -2546,91 +2546,84 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
2546
2546
|
// src/engines/base.ts
|
|
2547
2547
|
var import_core4 = require("@pandacss/core");
|
|
2548
2548
|
var import_is_valid_prop3 = require("@pandacss/is-valid-prop");
|
|
2549
|
-
var import_logger3 = require("@pandacss/logger");
|
|
2550
2549
|
var import_shared5 = require("@pandacss/shared");
|
|
2551
2550
|
var import_token_dictionary = require("@pandacss/token-dictionary");
|
|
2552
2551
|
var import_lil_fp = require("lil-fp");
|
|
2553
2552
|
var import_postcss3 = __toESM(require("postcss"));
|
|
2554
|
-
var helpers = {
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
})
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
helpers
|
|
2605
|
-
});
|
|
2606
|
-
}),
|
|
2607
|
-
import_lil_fp.Obj.bind("recipes", ({ config: { theme }, createSheetContext }) => {
|
|
2608
|
-
const context = createSheetContext();
|
|
2609
|
-
const recipes = new import_core4.Recipes(theme?.recipes ?? {}, context);
|
|
2610
|
-
recipes.save();
|
|
2611
|
-
return recipes;
|
|
2612
|
-
}),
|
|
2613
|
-
import_lil_fp.Obj.bind(
|
|
2614
|
-
"createSheet",
|
|
2615
|
-
({ config: { theme }, createSheetContext }) => (options) => {
|
|
2616
|
-
const context = createSheetContext();
|
|
2617
|
-
return new import_core4.Stylesheet(context, {
|
|
2618
|
-
content: options?.content,
|
|
2619
|
-
recipes: theme?.recipes
|
|
2620
|
-
});
|
|
2621
|
-
}
|
|
2622
|
-
),
|
|
2623
|
-
import_lil_fp.Obj.bind(
|
|
2624
|
-
"properties",
|
|
2625
|
-
({ utility, conditions }) => Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]))
|
|
2626
|
-
),
|
|
2627
|
-
import_lil_fp.Obj.bind("isValidProperty", ({ properties }) => {
|
|
2628
|
-
const propertyMap = new Map(properties.map((prop) => [prop, true]));
|
|
2629
|
-
return (0, import_shared5.memo)((key) => {
|
|
2630
|
-
return propertyMap.has(key) || (0, import_is_valid_prop3.isCssProperty)(key);
|
|
2553
|
+
var helpers = {
|
|
2554
|
+
map: import_shared5.mapObject
|
|
2555
|
+
};
|
|
2556
|
+
var getBaseEngine = (conf) => {
|
|
2557
|
+
const { config } = conf;
|
|
2558
|
+
const theme = config.theme ?? {};
|
|
2559
|
+
const hash = {
|
|
2560
|
+
tokens: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.cssVar,
|
|
2561
|
+
className: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.className
|
|
2562
|
+
};
|
|
2563
|
+
const prefix = {
|
|
2564
|
+
tokens: (0, import_lil_fp.isStr)(config.prefix) ? config.prefix : config.prefix?.cssVar,
|
|
2565
|
+
className: (0, import_lil_fp.isStr)(config.prefix) ? config.prefix : config.prefix?.className
|
|
2566
|
+
};
|
|
2567
|
+
const tokens = new import_token_dictionary.TokenDictionary({
|
|
2568
|
+
breakpoints: theme.breakpoints,
|
|
2569
|
+
tokens: theme.tokens,
|
|
2570
|
+
semanticTokens: theme.semanticTokens,
|
|
2571
|
+
prefix: prefix.tokens,
|
|
2572
|
+
hash: hash.tokens
|
|
2573
|
+
});
|
|
2574
|
+
const utility = new import_core4.Utility({
|
|
2575
|
+
prefix: prefix.className,
|
|
2576
|
+
tokens,
|
|
2577
|
+
config: config.utilities,
|
|
2578
|
+
separator: config.separator
|
|
2579
|
+
});
|
|
2580
|
+
const conditions = new import_core4.Conditions({
|
|
2581
|
+
conditions: config.conditions,
|
|
2582
|
+
breakpoints: config.theme?.breakpoints
|
|
2583
|
+
});
|
|
2584
|
+
const { textStyles, layerStyles } = theme;
|
|
2585
|
+
const compositions = (0, import_shared5.compact)({
|
|
2586
|
+
textStyle: textStyles,
|
|
2587
|
+
layerStyle: layerStyles
|
|
2588
|
+
});
|
|
2589
|
+
const compositionContext = { conditions, utility };
|
|
2590
|
+
(0, import_core4.assignCompositions)(compositions, compositionContext);
|
|
2591
|
+
const createSheetContext = () => ({
|
|
2592
|
+
root: import_postcss3.default.root(),
|
|
2593
|
+
conditions,
|
|
2594
|
+
utility,
|
|
2595
|
+
hash: hash.className,
|
|
2596
|
+
helpers
|
|
2597
|
+
});
|
|
2598
|
+
const createSheet = (options) => {
|
|
2599
|
+
const sheetContext = createSheetContext();
|
|
2600
|
+
return new import_core4.Stylesheet(sheetContext, {
|
|
2601
|
+
content: options?.content,
|
|
2602
|
+
recipes: theme?.recipes
|
|
2631
2603
|
});
|
|
2632
|
-
}
|
|
2633
|
-
);
|
|
2604
|
+
};
|
|
2605
|
+
const recipeContext = createSheetContext();
|
|
2606
|
+
const recipes = new import_core4.Recipes(theme?.recipes ?? {}, recipeContext);
|
|
2607
|
+
recipes.save();
|
|
2608
|
+
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
2609
|
+
const propertyMap = new Map(properties.map((prop) => [prop, true]));
|
|
2610
|
+
const isValidProperty = (0, import_shared5.memo)((key) => {
|
|
2611
|
+
return propertyMap.has(key) || (0, import_is_valid_prop3.isCssProperty)(key);
|
|
2612
|
+
});
|
|
2613
|
+
return {
|
|
2614
|
+
...conf,
|
|
2615
|
+
hash,
|
|
2616
|
+
prefix,
|
|
2617
|
+
tokens,
|
|
2618
|
+
utility,
|
|
2619
|
+
properties,
|
|
2620
|
+
isValidProperty,
|
|
2621
|
+
recipes,
|
|
2622
|
+
conditions,
|
|
2623
|
+
createSheetContext,
|
|
2624
|
+
createSheet
|
|
2625
|
+
};
|
|
2626
|
+
};
|
|
2634
2627
|
|
|
2635
2628
|
// src/engines/jsx.ts
|
|
2636
2629
|
var import_shared6 = require("@pandacss/shared");
|
package/dist/index.mjs
CHANGED
|
@@ -93,7 +93,7 @@ var getMessages = (ctx) => ({
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
// src/generator.ts
|
|
96
|
-
import { Obj as
|
|
96
|
+
import { Obj as Obj2, pipe as pipe3 } from "lil-fp";
|
|
97
97
|
|
|
98
98
|
// src/artifacts/index.ts
|
|
99
99
|
import { isObject } from "@pandacss/shared";
|
|
@@ -2521,91 +2521,84 @@ import {
|
|
|
2521
2521
|
assignCompositions
|
|
2522
2522
|
} from "@pandacss/core";
|
|
2523
2523
|
import { isCssProperty } from "@pandacss/is-valid-prop";
|
|
2524
|
-
import { logger as logger2 } from "@pandacss/logger";
|
|
2525
2524
|
import { compact, mapObject, memo } from "@pandacss/shared";
|
|
2526
2525
|
import { TokenDictionary } from "@pandacss/token-dictionary";
|
|
2527
|
-
import {
|
|
2526
|
+
import { isBool, isStr } from "lil-fp";
|
|
2528
2527
|
import postcss3 from "postcss";
|
|
2529
|
-
var helpers = {
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
})
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
helpers
|
|
2580
|
-
});
|
|
2581
|
-
}),
|
|
2582
|
-
Obj.bind("recipes", ({ config: { theme }, createSheetContext }) => {
|
|
2583
|
-
const context = createSheetContext();
|
|
2584
|
-
const recipes = new Recipes(theme?.recipes ?? {}, context);
|
|
2585
|
-
recipes.save();
|
|
2586
|
-
return recipes;
|
|
2587
|
-
}),
|
|
2588
|
-
Obj.bind(
|
|
2589
|
-
"createSheet",
|
|
2590
|
-
({ config: { theme }, createSheetContext }) => (options) => {
|
|
2591
|
-
const context = createSheetContext();
|
|
2592
|
-
return new Stylesheet(context, {
|
|
2593
|
-
content: options?.content,
|
|
2594
|
-
recipes: theme?.recipes
|
|
2595
|
-
});
|
|
2596
|
-
}
|
|
2597
|
-
),
|
|
2598
|
-
Obj.bind(
|
|
2599
|
-
"properties",
|
|
2600
|
-
({ utility, conditions }) => Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]))
|
|
2601
|
-
),
|
|
2602
|
-
Obj.bind("isValidProperty", ({ properties }) => {
|
|
2603
|
-
const propertyMap = new Map(properties.map((prop) => [prop, true]));
|
|
2604
|
-
return memo((key) => {
|
|
2605
|
-
return propertyMap.has(key) || isCssProperty(key);
|
|
2528
|
+
var helpers = {
|
|
2529
|
+
map: mapObject
|
|
2530
|
+
};
|
|
2531
|
+
var getBaseEngine = (conf) => {
|
|
2532
|
+
const { config } = conf;
|
|
2533
|
+
const theme = config.theme ?? {};
|
|
2534
|
+
const hash = {
|
|
2535
|
+
tokens: isBool(config.hash) ? config.hash : config.hash?.cssVar,
|
|
2536
|
+
className: isBool(config.hash) ? config.hash : config.hash?.className
|
|
2537
|
+
};
|
|
2538
|
+
const prefix = {
|
|
2539
|
+
tokens: isStr(config.prefix) ? config.prefix : config.prefix?.cssVar,
|
|
2540
|
+
className: isStr(config.prefix) ? config.prefix : config.prefix?.className
|
|
2541
|
+
};
|
|
2542
|
+
const tokens = new TokenDictionary({
|
|
2543
|
+
breakpoints: theme.breakpoints,
|
|
2544
|
+
tokens: theme.tokens,
|
|
2545
|
+
semanticTokens: theme.semanticTokens,
|
|
2546
|
+
prefix: prefix.tokens,
|
|
2547
|
+
hash: hash.tokens
|
|
2548
|
+
});
|
|
2549
|
+
const utility = new Utility({
|
|
2550
|
+
prefix: prefix.className,
|
|
2551
|
+
tokens,
|
|
2552
|
+
config: config.utilities,
|
|
2553
|
+
separator: config.separator
|
|
2554
|
+
});
|
|
2555
|
+
const conditions = new Conditions({
|
|
2556
|
+
conditions: config.conditions,
|
|
2557
|
+
breakpoints: config.theme?.breakpoints
|
|
2558
|
+
});
|
|
2559
|
+
const { textStyles, layerStyles } = theme;
|
|
2560
|
+
const compositions = compact({
|
|
2561
|
+
textStyle: textStyles,
|
|
2562
|
+
layerStyle: layerStyles
|
|
2563
|
+
});
|
|
2564
|
+
const compositionContext = { conditions, utility };
|
|
2565
|
+
assignCompositions(compositions, compositionContext);
|
|
2566
|
+
const createSheetContext = () => ({
|
|
2567
|
+
root: postcss3.root(),
|
|
2568
|
+
conditions,
|
|
2569
|
+
utility,
|
|
2570
|
+
hash: hash.className,
|
|
2571
|
+
helpers
|
|
2572
|
+
});
|
|
2573
|
+
const createSheet = (options) => {
|
|
2574
|
+
const sheetContext = createSheetContext();
|
|
2575
|
+
return new Stylesheet(sheetContext, {
|
|
2576
|
+
content: options?.content,
|
|
2577
|
+
recipes: theme?.recipes
|
|
2606
2578
|
});
|
|
2607
|
-
}
|
|
2608
|
-
);
|
|
2579
|
+
};
|
|
2580
|
+
const recipeContext = createSheetContext();
|
|
2581
|
+
const recipes = new Recipes(theme?.recipes ?? {}, recipeContext);
|
|
2582
|
+
recipes.save();
|
|
2583
|
+
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
2584
|
+
const propertyMap = new Map(properties.map((prop) => [prop, true]));
|
|
2585
|
+
const isValidProperty = memo((key) => {
|
|
2586
|
+
return propertyMap.has(key) || isCssProperty(key);
|
|
2587
|
+
});
|
|
2588
|
+
return {
|
|
2589
|
+
...conf,
|
|
2590
|
+
hash,
|
|
2591
|
+
prefix,
|
|
2592
|
+
tokens,
|
|
2593
|
+
utility,
|
|
2594
|
+
properties,
|
|
2595
|
+
isValidProperty,
|
|
2596
|
+
recipes,
|
|
2597
|
+
conditions,
|
|
2598
|
+
createSheetContext,
|
|
2599
|
+
createSheet
|
|
2600
|
+
};
|
|
2601
|
+
};
|
|
2609
2602
|
|
|
2610
2603
|
// src/engines/jsx.ts
|
|
2611
2604
|
import { capitalize as capitalize2 } from "@pandacss/shared";
|
|
@@ -2639,20 +2632,20 @@ var getPathEngine = ({ cwd, emitPackage, outdir }) => {
|
|
|
2639
2632
|
|
|
2640
2633
|
// src/engines/pattern.ts
|
|
2641
2634
|
import { capitalize as capitalize3, dashCase, mapObject as mapObject2, uncapitalize } from "@pandacss/shared";
|
|
2642
|
-
import { Obj
|
|
2635
|
+
import { Obj, pipe as pipe2 } from "lil-fp";
|
|
2643
2636
|
var helpers2 = { map: mapObject2 };
|
|
2644
2637
|
var getPatternEngine = (config) => {
|
|
2645
|
-
return
|
|
2638
|
+
return pipe2(
|
|
2646
2639
|
{ patterns: config.patterns ?? {} },
|
|
2647
|
-
|
|
2640
|
+
Obj.bind("getConfig", ({ patterns }) => {
|
|
2648
2641
|
return (name) => patterns[name];
|
|
2649
2642
|
}),
|
|
2650
|
-
|
|
2643
|
+
Obj.bind("transform", ({ getConfig }) => {
|
|
2651
2644
|
return (name, data) => {
|
|
2652
2645
|
return getConfig(name)?.transform?.(data, helpers2) ?? {};
|
|
2653
2646
|
};
|
|
2654
2647
|
}),
|
|
2655
|
-
|
|
2648
|
+
Obj.bind("getNames", ({ getConfig }) => (name) => {
|
|
2656
2649
|
const upperName = capitalize3(name);
|
|
2657
2650
|
return {
|
|
2658
2651
|
name,
|
|
@@ -2662,7 +2655,7 @@ var getPatternEngine = (config) => {
|
|
|
2662
2655
|
jsxName: getConfig(name)?.jsx ?? upperName
|
|
2663
2656
|
};
|
|
2664
2657
|
}),
|
|
2665
|
-
|
|
2658
|
+
Obj.bind("details", ({ getNames, patterns }) => {
|
|
2666
2659
|
return Object.entries(patterns).map(([name, pattern]) => ({
|
|
2667
2660
|
...getNames(name),
|
|
2668
2661
|
props: Object.keys(pattern?.properties ?? {}),
|
|
@@ -2670,7 +2663,7 @@ var getPatternEngine = (config) => {
|
|
|
2670
2663
|
config: pattern
|
|
2671
2664
|
}));
|
|
2672
2665
|
}),
|
|
2673
|
-
|
|
2666
|
+
Obj.bind("nodes", ({ patterns }) => {
|
|
2674
2667
|
return Object.entries(patterns).map(([name, pattern]) => ({
|
|
2675
2668
|
type: "pattern",
|
|
2676
2669
|
name: pattern.jsx ?? capitalize3(name),
|
|
@@ -2678,10 +2671,10 @@ var getPatternEngine = (config) => {
|
|
|
2678
2671
|
baseName: name
|
|
2679
2672
|
}));
|
|
2680
2673
|
}),
|
|
2681
|
-
|
|
2674
|
+
Obj.bind("getFnName", ({ nodes }) => (jsx) => {
|
|
2682
2675
|
return nodes.find((node) => node.name === jsx)?.baseName ?? uncapitalize(jsx);
|
|
2683
2676
|
}),
|
|
2684
|
-
|
|
2677
|
+
Obj.bind("isEmpty", ({ patterns }) => {
|
|
2685
2678
|
return () => Object.keys(patterns).length === 0;
|
|
2686
2679
|
})
|
|
2687
2680
|
);
|
|
@@ -2722,15 +2715,15 @@ var getImportMap = (outdir) => ({
|
|
|
2722
2715
|
pattern: `${outdir}/patterns`,
|
|
2723
2716
|
jsx: `${outdir}/jsx`
|
|
2724
2717
|
});
|
|
2725
|
-
var createGenerator = (conf) =>
|
|
2718
|
+
var createGenerator = (conf) => pipe3(
|
|
2726
2719
|
getEngine(defaults(conf)),
|
|
2727
|
-
|
|
2720
|
+
Obj2.assign((ctx) => ({
|
|
2728
2721
|
getArtifacts: generateArtifacts(ctx),
|
|
2729
2722
|
getCss: generateFlattenedCss(ctx),
|
|
2730
2723
|
getParserCss: generateParserCss(ctx),
|
|
2731
2724
|
messages: getMessages(ctx)
|
|
2732
2725
|
})),
|
|
2733
|
-
|
|
2726
|
+
Obj2.bind("parserOptions", ({ config: { outdir }, jsx, isValidProperty, patterns, recipes }) => ({
|
|
2734
2727
|
importMap: getImportMap(outdir),
|
|
2735
2728
|
jsx: {
|
|
2736
2729
|
factory: jsx.factoryName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230613163214",
|
|
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-
|
|
24
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
25
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
26
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
27
|
-
"@pandacss/types": "0.0.0-dev-
|
|
28
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
23
|
+
"@pandacss/core": "0.0.0-dev-20230613163214",
|
|
24
|
+
"@pandacss/logger": "0.0.0-dev-20230613163214",
|
|
25
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230613163214",
|
|
26
|
+
"@pandacss/shared": "0.0.0-dev-20230613163214",
|
|
27
|
+
"@pandacss/types": "0.0.0-dev-20230613163214",
|
|
28
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230613163214"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.29",
|
|
32
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
32
|
+
"@pandacss/fixture": "0.0.0-dev-20230613163214"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"prebuild": "tsx scripts/prebuild.ts",
|