@pandacss/generator 0.0.0-dev-20230525095129 → 0.0.0-dev-20230525192325
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 +5 -61
- package/dist/index.js +19 -71
- package/dist/index.mjs +20 -72
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -35,35 +35,6 @@ declare const getEngine: (conf: LoadConfigResult) => {
|
|
|
35
35
|
getFnName: (jsx: string) => string;
|
|
36
36
|
isEmpty: () => boolean;
|
|
37
37
|
};
|
|
38
|
-
recipes: {
|
|
39
|
-
nodes: {
|
|
40
|
-
type: "recipe";
|
|
41
|
-
name: string;
|
|
42
|
-
props: string[];
|
|
43
|
-
baseName: string;
|
|
44
|
-
jsx: (string | RegExp)[];
|
|
45
|
-
match: RegExp;
|
|
46
|
-
}[];
|
|
47
|
-
recipes: Record<string, _pandacss_types.RecipeConfig<Record<string, _pandacss_types.AnyRecipeConfig>>>;
|
|
48
|
-
getConfig: (name: string) => _pandacss_types.AnyRecipeConfig | undefined;
|
|
49
|
-
getNames: (name: string) => {
|
|
50
|
-
upperName: string;
|
|
51
|
-
dashName: string;
|
|
52
|
-
jsxName: string;
|
|
53
|
-
};
|
|
54
|
-
details: {
|
|
55
|
-
config: _pandacss_types.RecipeConfig<Record<string, _pandacss_types.AnyRecipeConfig>>;
|
|
56
|
-
variantKeyMap: {
|
|
57
|
-
[k: string]: string[];
|
|
58
|
-
};
|
|
59
|
-
upperName: string;
|
|
60
|
-
dashName: string;
|
|
61
|
-
jsxName: string;
|
|
62
|
-
}[];
|
|
63
|
-
getFnName: (jsx: string) => string;
|
|
64
|
-
splitProps: (name: string, props: Record<string, any>) => Record<string, any>[];
|
|
65
|
-
isEmpty: () => boolean;
|
|
66
|
-
};
|
|
67
38
|
jsx: {
|
|
68
39
|
factoryName: string;
|
|
69
40
|
upperName: string;
|
|
@@ -93,9 +64,10 @@ declare const getEngine: (conf: LoadConfigResult) => {
|
|
|
93
64
|
conditions: _pandacss_core.Conditions;
|
|
94
65
|
utility: _pandacss_core.Utility;
|
|
95
66
|
tokens: _pandacss_token_dictionary.TokenDictionary;
|
|
67
|
+
recipes: _pandacss_core.Recipes;
|
|
96
68
|
configDependencies: string[];
|
|
97
69
|
dependencies: string[];
|
|
98
|
-
createSheet: (options?: _pandacss_core.StylesheetOptions | undefined) => _pandacss_core.Stylesheet;
|
|
70
|
+
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
99
71
|
properties: string[];
|
|
100
72
|
isValidProperty: (key: string) => boolean;
|
|
101
73
|
};
|
|
@@ -152,35 +124,7 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
152
124
|
componentName: string;
|
|
153
125
|
framework: "solid" | "react" | "preact" | "vue" | undefined;
|
|
154
126
|
};
|
|
155
|
-
recipes:
|
|
156
|
-
nodes: {
|
|
157
|
-
type: "recipe";
|
|
158
|
-
name: string;
|
|
159
|
-
props: string[];
|
|
160
|
-
baseName: string;
|
|
161
|
-
jsx: (string | RegExp)[];
|
|
162
|
-
match: RegExp;
|
|
163
|
-
}[];
|
|
164
|
-
recipes: Record<string, _pandacss_types.RecipeConfig<Record<string, _pandacss_types.AnyRecipeConfig>>>;
|
|
165
|
-
getConfig: (name: string) => _pandacss_types.AnyRecipeConfig | undefined;
|
|
166
|
-
getNames: (name: string) => {
|
|
167
|
-
upperName: string;
|
|
168
|
-
dashName: string;
|
|
169
|
-
jsxName: string;
|
|
170
|
-
};
|
|
171
|
-
details: {
|
|
172
|
-
config: _pandacss_types.RecipeConfig<Record<string, _pandacss_types.AnyRecipeConfig>>;
|
|
173
|
-
variantKeyMap: {
|
|
174
|
-
[k: string]: string[];
|
|
175
|
-
};
|
|
176
|
-
upperName: string;
|
|
177
|
-
dashName: string;
|
|
178
|
-
jsxName: string;
|
|
179
|
-
}[];
|
|
180
|
-
getFnName: (jsx: string) => string;
|
|
181
|
-
splitProps: (name: string, props: Record<string, any>) => Record<string, any>[];
|
|
182
|
-
isEmpty: () => boolean;
|
|
183
|
-
};
|
|
127
|
+
recipes: _pandacss_core.Recipes;
|
|
184
128
|
configDependencies: string[];
|
|
185
129
|
dependencies: string[];
|
|
186
130
|
patterns: {
|
|
@@ -213,7 +157,7 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
213
157
|
getFnName: (jsx: string) => string;
|
|
214
158
|
isEmpty: () => boolean;
|
|
215
159
|
};
|
|
216
|
-
createSheet: (options?: _pandacss_core.StylesheetOptions | undefined) => _pandacss_core.Stylesheet;
|
|
160
|
+
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
217
161
|
properties: string[];
|
|
218
162
|
isValidProperty: (key: string) => boolean;
|
|
219
163
|
getArtifacts: () => _pandacss_types.Artifact[];
|
|
@@ -272,7 +216,7 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
272
216
|
match: RegExp;
|
|
273
217
|
})[];
|
|
274
218
|
};
|
|
275
|
-
getRecipeName: (
|
|
219
|
+
getRecipeName: (jsxName: string) => string;
|
|
276
220
|
getRecipeByName: (name: string) => _pandacss_types.AnyRecipeConfig | undefined;
|
|
277
221
|
};
|
|
278
222
|
};
|
package/dist/index.js
CHANGED
|
@@ -124,7 +124,7 @@ var getMessages = (ctx) => ({
|
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
// src/generator.ts
|
|
127
|
-
var
|
|
127
|
+
var import_lil_fp3 = require("lil-fp");
|
|
128
128
|
|
|
129
129
|
// src/artifacts/index.ts
|
|
130
130
|
var import_shared4 = require("@pandacss/shared");
|
|
@@ -1711,7 +1711,7 @@ var csstype_d_ts_default = {
|
|
|
1711
1711
|
|
|
1712
1712
|
// src/artifacts/generated/system-types.d.ts.json
|
|
1713
1713
|
var system_types_d_ts_default = {
|
|
1714
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<
|
|
1714
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\ntype Assign<T, U> = Omit<T, keyof U> & U\n\ntype HTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\ntype WithHTMLProps<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'> &\n HTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
1715
1715
|
};
|
|
1716
1716
|
|
|
1717
1717
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -2247,10 +2247,22 @@ var getBaseEngine = (conf) => (0, import_lil_fp.pipe)(
|
|
|
2247
2247
|
const compositions = (0, import_shared5.compact)({ textStyle: textStyles, layerStyle: layerStyles });
|
|
2248
2248
|
(0, import_core4.assignCompositions)({ conditions, utility }, compositions);
|
|
2249
2249
|
}),
|
|
2250
|
-
import_lil_fp.Obj.bind("
|
|
2250
|
+
import_lil_fp.Obj.bind("recipes", ({ conditions, utility, config: { hash, theme } }) => {
|
|
2251
2251
|
const context = { root: import_postcss3.default.root(), conditions, utility, hash, helpers };
|
|
2252
|
-
|
|
2252
|
+
const recipes = new import_core4.Recipes(theme?.recipes, context);
|
|
2253
|
+
recipes.save();
|
|
2254
|
+
return recipes;
|
|
2253
2255
|
}),
|
|
2256
|
+
import_lil_fp.Obj.bind(
|
|
2257
|
+
"createSheet",
|
|
2258
|
+
({ conditions, utility, config: { hash, theme } }) => (options) => {
|
|
2259
|
+
const context = { root: import_postcss3.default.root(), conditions, utility, hash, helpers };
|
|
2260
|
+
return new import_core4.Stylesheet(context, {
|
|
2261
|
+
content: options?.content,
|
|
2262
|
+
recipes: theme?.recipes
|
|
2263
|
+
});
|
|
2264
|
+
}
|
|
2265
|
+
),
|
|
2254
2266
|
import_lil_fp.Obj.bind(
|
|
2255
2267
|
"properties",
|
|
2256
2268
|
({ utility, conditions }) => Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]))
|
|
@@ -2343,74 +2355,10 @@ var getPatternEngine = (config) => {
|
|
|
2343
2355
|
);
|
|
2344
2356
|
};
|
|
2345
2357
|
|
|
2346
|
-
// src/engines/recipe.ts
|
|
2347
|
-
var import_shared8 = require("@pandacss/shared");
|
|
2348
|
-
var import_lil_fp3 = require("lil-fp");
|
|
2349
|
-
var mergeRegex = (item) => {
|
|
2350
|
-
const regex = item.map((item2) => typeof item2 === "string" ? item2 : item2.source).join("|");
|
|
2351
|
-
return new RegExp(`^${regex}$`);
|
|
2352
|
-
};
|
|
2353
|
-
var getRecipeEngine = (config) => {
|
|
2354
|
-
return (0, import_lil_fp3.pipe)(
|
|
2355
|
-
{ recipes: config.theme?.recipes ?? {} },
|
|
2356
|
-
import_lil_fp3.Obj.bind("getConfig", ({ recipes }) => {
|
|
2357
|
-
return (name) => recipes[name];
|
|
2358
|
-
}),
|
|
2359
|
-
import_lil_fp3.Obj.bind("getNames", () => {
|
|
2360
|
-
return (name) => ({
|
|
2361
|
-
upperName: (0, import_shared8.capitalize)(name),
|
|
2362
|
-
dashName: (0, import_shared8.dashCase)(name),
|
|
2363
|
-
jsxName: (0, import_shared8.capitalize)(name)
|
|
2364
|
-
});
|
|
2365
|
-
}),
|
|
2366
|
-
import_lil_fp3.Obj.bind("nodes", ({ recipes }) => {
|
|
2367
|
-
return Object.entries(recipes).map(([name, recipe]) => {
|
|
2368
|
-
const jsx = recipe.jsx ?? [(0, import_shared8.capitalize)(name)];
|
|
2369
|
-
const match6 = mergeRegex(jsx);
|
|
2370
|
-
return {
|
|
2371
|
-
type: "recipe",
|
|
2372
|
-
name: (0, import_shared8.capitalize)(name),
|
|
2373
|
-
props: Object.keys(recipe.variants ?? {}),
|
|
2374
|
-
baseName: name,
|
|
2375
|
-
jsx,
|
|
2376
|
-
match: match6
|
|
2377
|
-
};
|
|
2378
|
-
});
|
|
2379
|
-
}),
|
|
2380
|
-
import_lil_fp3.Obj.bind("getFnName", ({ nodes }) => {
|
|
2381
|
-
return (jsx) => {
|
|
2382
|
-
const recipe = nodes.find((node) => node.match.test(jsx));
|
|
2383
|
-
return recipe?.baseName ?? (0, import_shared8.uncapitalize)(jsx);
|
|
2384
|
-
};
|
|
2385
|
-
}),
|
|
2386
|
-
import_lil_fp3.Obj.bind("splitProps", ({ nodes }) => {
|
|
2387
|
-
return (name, props) => {
|
|
2388
|
-
const recipe = nodes.find((node) => node.match.test(name));
|
|
2389
|
-
if (!recipe)
|
|
2390
|
-
return [{}, props];
|
|
2391
|
-
return (0, import_shared8.splitProps)(props, recipe.props);
|
|
2392
|
-
};
|
|
2393
|
-
}),
|
|
2394
|
-
import_lil_fp3.Obj.bind("details", ({ getNames, recipes }) => {
|
|
2395
|
-
return Object.entries(recipes).map(([name, recipe]) => ({
|
|
2396
|
-
...getNames(name),
|
|
2397
|
-
config: recipe,
|
|
2398
|
-
variantKeyMap: Object.fromEntries(
|
|
2399
|
-
Object.entries(recipe.variants ?? {}).map(([key, value]) => [key, Object.keys(value)])
|
|
2400
|
-
)
|
|
2401
|
-
}));
|
|
2402
|
-
}),
|
|
2403
|
-
import_lil_fp3.Obj.bind("isEmpty", ({ recipes }) => {
|
|
2404
|
-
return () => Object.keys(recipes).length === 0;
|
|
2405
|
-
})
|
|
2406
|
-
);
|
|
2407
|
-
};
|
|
2408
|
-
|
|
2409
2358
|
// src/engines/index.ts
|
|
2410
2359
|
var getEngine = (conf) => ({
|
|
2411
2360
|
...getBaseEngine(conf),
|
|
2412
2361
|
patterns: getPatternEngine(conf.config),
|
|
2413
|
-
recipes: getRecipeEngine(conf.config),
|
|
2414
2362
|
jsx: getJsxEngine(conf.config),
|
|
2415
2363
|
paths: getPathEngine(conf.config),
|
|
2416
2364
|
file: {
|
|
@@ -2442,15 +2390,15 @@ var getImportMap = (outdir) => ({
|
|
|
2442
2390
|
pattern: `${outdir}/patterns`,
|
|
2443
2391
|
jsx: `${outdir}/jsx`
|
|
2444
2392
|
});
|
|
2445
|
-
var createGenerator = (conf) => (0,
|
|
2393
|
+
var createGenerator = (conf) => (0, import_lil_fp3.pipe)(
|
|
2446
2394
|
getEngine(defaults(conf)),
|
|
2447
|
-
|
|
2395
|
+
import_lil_fp3.Obj.assign((ctx) => ({
|
|
2448
2396
|
getArtifacts: generateArtifacts(ctx),
|
|
2449
2397
|
getCss: generateFlattenedCss(ctx),
|
|
2450
2398
|
getParserCss: generateParserCss(ctx),
|
|
2451
2399
|
messages: getMessages(ctx)
|
|
2452
2400
|
})),
|
|
2453
|
-
|
|
2401
|
+
import_lil_fp3.Obj.bind("parserOptions", ({ config: { outdir }, jsx, isValidProperty, patterns, recipes }) => ({
|
|
2454
2402
|
importMap: getImportMap(outdir),
|
|
2455
2403
|
jsx: {
|
|
2456
2404
|
factory: jsx.factoryName,
|
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 Obj3, pipe as pipe4 } from "lil-fp";
|
|
97
97
|
|
|
98
98
|
// src/artifacts/index.ts
|
|
99
99
|
import { isObject } from "@pandacss/shared";
|
|
@@ -1680,7 +1680,7 @@ var csstype_d_ts_default = {
|
|
|
1680
1680
|
|
|
1681
1681
|
// src/artifacts/generated/system-types.d.ts.json
|
|
1682
1682
|
var system_types_d_ts_default = {
|
|
1683
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<
|
|
1683
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\ntype Assign<T, U> = Omit<T, keyof U> & U\n\ntype HTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\ntype WithHTMLProps<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'> &\n HTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
1684
1684
|
};
|
|
1685
1685
|
|
|
1686
1686
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -2185,7 +2185,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
2185
2185
|
);
|
|
2186
2186
|
|
|
2187
2187
|
// src/engines/base.ts
|
|
2188
|
-
import { Conditions, Stylesheet, Utility, assignCompositions } from "@pandacss/core";
|
|
2188
|
+
import { Conditions, Recipes, Stylesheet, Utility, assignCompositions } from "@pandacss/core";
|
|
2189
2189
|
import { isCssProperty } from "@pandacss/is-valid-prop";
|
|
2190
2190
|
import { logger as logger2 } from "@pandacss/logger";
|
|
2191
2191
|
import { compact, mapObject, memo } from "@pandacss/shared";
|
|
@@ -2216,10 +2216,22 @@ var getBaseEngine = (conf) => pipe2(
|
|
|
2216
2216
|
const compositions = compact({ textStyle: textStyles, layerStyle: layerStyles });
|
|
2217
2217
|
assignCompositions({ conditions, utility }, compositions);
|
|
2218
2218
|
}),
|
|
2219
|
-
Obj.bind("
|
|
2219
|
+
Obj.bind("recipes", ({ conditions, utility, config: { hash, theme } }) => {
|
|
2220
2220
|
const context = { root: postcss3.root(), conditions, utility, hash, helpers };
|
|
2221
|
-
|
|
2221
|
+
const recipes = new Recipes(theme?.recipes, context);
|
|
2222
|
+
recipes.save();
|
|
2223
|
+
return recipes;
|
|
2222
2224
|
}),
|
|
2225
|
+
Obj.bind(
|
|
2226
|
+
"createSheet",
|
|
2227
|
+
({ conditions, utility, config: { hash, theme } }) => (options) => {
|
|
2228
|
+
const context = { root: postcss3.root(), conditions, utility, hash, helpers };
|
|
2229
|
+
return new Stylesheet(context, {
|
|
2230
|
+
content: options?.content,
|
|
2231
|
+
recipes: theme?.recipes
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
),
|
|
2223
2235
|
Obj.bind(
|
|
2224
2236
|
"properties",
|
|
2225
2237
|
({ utility, conditions }) => Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]))
|
|
@@ -2312,74 +2324,10 @@ var getPatternEngine = (config) => {
|
|
|
2312
2324
|
);
|
|
2313
2325
|
};
|
|
2314
2326
|
|
|
2315
|
-
// src/engines/recipe.ts
|
|
2316
|
-
import { capitalize as capitalize4, dashCase as dashCase2, splitProps, uncapitalize as uncapitalize2 } from "@pandacss/shared";
|
|
2317
|
-
import { Obj as Obj3, pipe as pipe4 } from "lil-fp";
|
|
2318
|
-
var mergeRegex = (item) => {
|
|
2319
|
-
const regex = item.map((item2) => typeof item2 === "string" ? item2 : item2.source).join("|");
|
|
2320
|
-
return new RegExp(`^${regex}$`);
|
|
2321
|
-
};
|
|
2322
|
-
var getRecipeEngine = (config) => {
|
|
2323
|
-
return pipe4(
|
|
2324
|
-
{ recipes: config.theme?.recipes ?? {} },
|
|
2325
|
-
Obj3.bind("getConfig", ({ recipes }) => {
|
|
2326
|
-
return (name) => recipes[name];
|
|
2327
|
-
}),
|
|
2328
|
-
Obj3.bind("getNames", () => {
|
|
2329
|
-
return (name) => ({
|
|
2330
|
-
upperName: capitalize4(name),
|
|
2331
|
-
dashName: dashCase2(name),
|
|
2332
|
-
jsxName: capitalize4(name)
|
|
2333
|
-
});
|
|
2334
|
-
}),
|
|
2335
|
-
Obj3.bind("nodes", ({ recipes }) => {
|
|
2336
|
-
return Object.entries(recipes).map(([name, recipe]) => {
|
|
2337
|
-
const jsx = recipe.jsx ?? [capitalize4(name)];
|
|
2338
|
-
const match6 = mergeRegex(jsx);
|
|
2339
|
-
return {
|
|
2340
|
-
type: "recipe",
|
|
2341
|
-
name: capitalize4(name),
|
|
2342
|
-
props: Object.keys(recipe.variants ?? {}),
|
|
2343
|
-
baseName: name,
|
|
2344
|
-
jsx,
|
|
2345
|
-
match: match6
|
|
2346
|
-
};
|
|
2347
|
-
});
|
|
2348
|
-
}),
|
|
2349
|
-
Obj3.bind("getFnName", ({ nodes }) => {
|
|
2350
|
-
return (jsx) => {
|
|
2351
|
-
const recipe = nodes.find((node) => node.match.test(jsx));
|
|
2352
|
-
return recipe?.baseName ?? uncapitalize2(jsx);
|
|
2353
|
-
};
|
|
2354
|
-
}),
|
|
2355
|
-
Obj3.bind("splitProps", ({ nodes }) => {
|
|
2356
|
-
return (name, props) => {
|
|
2357
|
-
const recipe = nodes.find((node) => node.match.test(name));
|
|
2358
|
-
if (!recipe)
|
|
2359
|
-
return [{}, props];
|
|
2360
|
-
return splitProps(props, recipe.props);
|
|
2361
|
-
};
|
|
2362
|
-
}),
|
|
2363
|
-
Obj3.bind("details", ({ getNames, recipes }) => {
|
|
2364
|
-
return Object.entries(recipes).map(([name, recipe]) => ({
|
|
2365
|
-
...getNames(name),
|
|
2366
|
-
config: recipe,
|
|
2367
|
-
variantKeyMap: Object.fromEntries(
|
|
2368
|
-
Object.entries(recipe.variants ?? {}).map(([key, value]) => [key, Object.keys(value)])
|
|
2369
|
-
)
|
|
2370
|
-
}));
|
|
2371
|
-
}),
|
|
2372
|
-
Obj3.bind("isEmpty", ({ recipes }) => {
|
|
2373
|
-
return () => Object.keys(recipes).length === 0;
|
|
2374
|
-
})
|
|
2375
|
-
);
|
|
2376
|
-
};
|
|
2377
|
-
|
|
2378
2327
|
// src/engines/index.ts
|
|
2379
2328
|
var getEngine = (conf) => ({
|
|
2380
2329
|
...getBaseEngine(conf),
|
|
2381
2330
|
patterns: getPatternEngine(conf.config),
|
|
2382
|
-
recipes: getRecipeEngine(conf.config),
|
|
2383
2331
|
jsx: getJsxEngine(conf.config),
|
|
2384
2332
|
paths: getPathEngine(conf.config),
|
|
2385
2333
|
file: {
|
|
@@ -2411,15 +2359,15 @@ var getImportMap = (outdir) => ({
|
|
|
2411
2359
|
pattern: `${outdir}/patterns`,
|
|
2412
2360
|
jsx: `${outdir}/jsx`
|
|
2413
2361
|
});
|
|
2414
|
-
var createGenerator = (conf) =>
|
|
2362
|
+
var createGenerator = (conf) => pipe4(
|
|
2415
2363
|
getEngine(defaults(conf)),
|
|
2416
|
-
|
|
2364
|
+
Obj3.assign((ctx) => ({
|
|
2417
2365
|
getArtifacts: generateArtifacts(ctx),
|
|
2418
2366
|
getCss: generateFlattenedCss(ctx),
|
|
2419
2367
|
getParserCss: generateParserCss(ctx),
|
|
2420
2368
|
messages: getMessages(ctx)
|
|
2421
2369
|
})),
|
|
2422
|
-
|
|
2370
|
+
Obj3.bind("parserOptions", ({ config: { outdir }, jsx, isValidProperty, patterns, recipes }) => ({
|
|
2423
2371
|
importMap: getImportMap(outdir),
|
|
2424
2372
|
jsx: {
|
|
2425
2373
|
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-20230525192325",
|
|
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.23",
|
|
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-20230525192325",
|
|
24
|
+
"@pandacss/logger": "0.0.0-dev-20230525192325",
|
|
25
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230525192325",
|
|
26
|
+
"@pandacss/shared": "0.0.0-dev-20230525192325",
|
|
27
|
+
"@pandacss/types": "0.0.0-dev-20230525192325",
|
|
28
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230525192325"
|
|
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-20230525192325"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"prebuild": "tsx scripts/prebuild.ts",
|