@pandacss/node 0.0.0-dev-20230204123646 → 0.0.0-dev-20230204134735
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.js +143 -124
- package/dist/index.mjs +143 -124
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -82,16 +82,16 @@ function extractFiles(ctx) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
function extractGlobalCss(ctx) {
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
85
|
+
const css3 = ctx.getGlobalCss();
|
|
86
|
+
if (!css3)
|
|
87
87
|
return;
|
|
88
|
-
return ctx.chunks.write("system/global.css",
|
|
88
|
+
return ctx.chunks.write("system/global.css", css3);
|
|
89
89
|
}
|
|
90
90
|
function extractStaticCss(ctx) {
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
91
|
+
const css3 = ctx.getStaticCss();
|
|
92
|
+
if (!css3)
|
|
93
93
|
return;
|
|
94
|
-
return ctx.chunks.write("system/static.css",
|
|
94
|
+
return ctx.chunks.write("system/static.css", css3);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// src/chunks.ts
|
|
@@ -99,6 +99,7 @@ async function extractChunks(ctx) {
|
|
|
99
99
|
const sheet = new import_core.Stylesheet(ctx.context(), {
|
|
100
100
|
content: [
|
|
101
101
|
"@layer reset, base, tokens, recipes, utilities;",
|
|
102
|
+
"@import './layout-grid.css';",
|
|
102
103
|
ctx.preflight && "@import './reset.css';",
|
|
103
104
|
!ctx.tokens.isEmpty && "@import './tokens/index.css';",
|
|
104
105
|
ctx.theme.keyframes && "@import './tokens/keyframes.css';"
|
|
@@ -107,15 +108,15 @@ async function extractChunks(ctx) {
|
|
|
107
108
|
const files = ctx.chunks.getFiles();
|
|
108
109
|
await Promise.all(
|
|
109
110
|
files.map(async (file) => {
|
|
110
|
-
const
|
|
111
|
-
sheet.append(
|
|
111
|
+
const css3 = await ctx.chunks.readFile(file);
|
|
112
|
+
sheet.append(css3);
|
|
112
113
|
})
|
|
113
114
|
);
|
|
114
115
|
return sheet.toCss({ minify: ctx.minify });
|
|
115
116
|
}
|
|
116
117
|
async function bundleChunks(ctx) {
|
|
117
|
-
const
|
|
118
|
-
await ctx.write(ctx.paths.root, [{ file: "styles.css", code:
|
|
118
|
+
const css3 = await extractChunks(ctx);
|
|
119
|
+
await ctx.write(ctx.paths.root, [{ file: "styles.css", code: css3 }]);
|
|
119
120
|
}
|
|
120
121
|
async function writeFileChunk(ctx, file) {
|
|
121
122
|
import_logger2.logger.info("chunk:change", `File changed: ${file}`);
|
|
@@ -127,7 +128,7 @@ async function writeFileChunk(ctx, file) {
|
|
|
127
128
|
|
|
128
129
|
// src/generators/index.ts
|
|
129
130
|
var import_fs2 = require("fs");
|
|
130
|
-
var
|
|
131
|
+
var import_outdent24 = __toESM(require("outdent"));
|
|
131
132
|
|
|
132
133
|
// src/generators/conditions.ts
|
|
133
134
|
var import_outdent = __toESM(require("outdent"));
|
|
@@ -992,9 +993,45 @@ function generateLayoutGrid(ctx) {
|
|
|
992
993
|
return layoutGridMap[ctx.jsxFramework]();
|
|
993
994
|
}
|
|
994
995
|
|
|
996
|
+
// src/generators/layout-grid.ts
|
|
997
|
+
var import_outdent17 = require("outdent");
|
|
998
|
+
var css = (v) => v[0];
|
|
999
|
+
var layoutGrid = css`
|
|
1000
|
+
.panda-layout-grid {
|
|
1001
|
+
display: grid;
|
|
1002
|
+
gap: var(--gutter);
|
|
1003
|
+
grid-template-columns: repeat(var(--count), 1fr);
|
|
1004
|
+
height: 100%;
|
|
1005
|
+
width: 100%;
|
|
1006
|
+
position: absolute;
|
|
1007
|
+
inset: 0;
|
|
1008
|
+
pointer-events: none;
|
|
1009
|
+
max-width: var(--max-width);
|
|
1010
|
+
margin-inline: var(--margin-x);
|
|
1011
|
+
padding-inline: var(--padding-x);
|
|
1012
|
+
}
|
|
1013
|
+
.panda-layout-grid__item {
|
|
1014
|
+
display: flex;
|
|
1015
|
+
--color: rgba(255, 0, 0, 0.1);
|
|
1016
|
+
height: 100%;
|
|
1017
|
+
}
|
|
1018
|
+
.panda-layout-grid__item[data-variant='bg'] {
|
|
1019
|
+
background: var(--color);
|
|
1020
|
+
}
|
|
1021
|
+
.panda-layout-grid__item[data-variant='outline'] {
|
|
1022
|
+
border-inline: 1px solid var(--color);
|
|
1023
|
+
}
|
|
1024
|
+
`;
|
|
1025
|
+
function generateLayoutGridCss() {
|
|
1026
|
+
return import_outdent17.outdent`
|
|
1027
|
+
@layer base {
|
|
1028
|
+
${layoutGrid}
|
|
1029
|
+
}`;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
995
1032
|
// src/generators/pattern.ts
|
|
996
1033
|
var import_shared = require("@pandacss/shared");
|
|
997
|
-
var
|
|
1034
|
+
var import_outdent18 = require("outdent");
|
|
998
1035
|
var import_javascript_stringify = require("javascript-stringify");
|
|
999
1036
|
var import_ts_pattern4 = require("ts-pattern");
|
|
1000
1037
|
function generate4(ctx, name, pattern) {
|
|
@@ -1002,7 +1039,7 @@ function generate4(ctx, name, pattern) {
|
|
|
1002
1039
|
const { upperName, styleFn, blocklistType } = ctx.getPatternDetails(name, pattern);
|
|
1003
1040
|
return {
|
|
1004
1041
|
name: (0, import_shared.dashCase)(name),
|
|
1005
|
-
dts:
|
|
1042
|
+
dts: import_outdent18.outdent`
|
|
1006
1043
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
1007
1044
|
import type { PropertyValue } from '../types/prop-type'
|
|
1008
1045
|
import type { Properties } from '../types/csstype'
|
|
@@ -1026,7 +1063,7 @@ function generate4(ctx, name, pattern) {
|
|
|
1026
1063
|
}).join("\n ")}
|
|
1027
1064
|
}
|
|
1028
1065
|
|
|
1029
|
-
${strict ?
|
|
1066
|
+
${strict ? import_outdent18.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent18.outdent`
|
|
1030
1067
|
|
|
1031
1068
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
1032
1069
|
|
|
@@ -1035,7 +1072,7 @@ function generate4(ctx, name, pattern) {
|
|
|
1035
1072
|
`}
|
|
1036
1073
|
|
|
1037
1074
|
`,
|
|
1038
|
-
js:
|
|
1075
|
+
js: import_outdent18.outdent`
|
|
1039
1076
|
${ctx.getImport("mapObject", "../helpers")}
|
|
1040
1077
|
${ctx.getImport("css", "../css/index")}
|
|
1041
1078
|
|
|
@@ -1074,11 +1111,11 @@ function generatePackageJSON(ctx) {
|
|
|
1074
1111
|
}
|
|
1075
1112
|
|
|
1076
1113
|
// src/generators/prop-types.ts
|
|
1077
|
-
var
|
|
1114
|
+
var import_outdent19 = require("outdent");
|
|
1078
1115
|
function generatePropTypes(utility, strict) {
|
|
1079
1116
|
const strictText = `${strict ? "" : " | NativeValue<T>"}`;
|
|
1080
1117
|
const result = [
|
|
1081
|
-
|
|
1118
|
+
import_outdent19.outdent`
|
|
1082
1119
|
import type { ConditionalValue } from './conditions';
|
|
1083
1120
|
import type { Properties as CSSProperties } from './csstype'
|
|
1084
1121
|
import type { Tokens } from './token'
|
|
@@ -1101,7 +1138,7 @@ function generatePropTypes(utility, strict) {
|
|
|
1101
1138
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
1102
1139
|
});
|
|
1103
1140
|
result.push("}");
|
|
1104
|
-
return
|
|
1141
|
+
return import_outdent19.outdent`
|
|
1105
1142
|
${result.join("\n")}
|
|
1106
1143
|
|
|
1107
1144
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -1114,14 +1151,14 @@ function generatePropTypes(utility, strict) {
|
|
|
1114
1151
|
|
|
1115
1152
|
// src/generators/recipe.ts
|
|
1116
1153
|
var import_shared2 = require("@pandacss/shared");
|
|
1117
|
-
var
|
|
1154
|
+
var import_outdent20 = require("outdent");
|
|
1118
1155
|
function generateRecipes(ctx) {
|
|
1119
1156
|
const { recipes = {}, hash, hasRecipes, utility } = ctx;
|
|
1120
1157
|
const { separator } = utility;
|
|
1121
1158
|
if (!hasRecipes)
|
|
1122
1159
|
return;
|
|
1123
1160
|
const js = [
|
|
1124
|
-
|
|
1161
|
+
import_outdent20.outdent`
|
|
1125
1162
|
${ctx.getImport("createCss, withoutSpace, compact", "../helpers")}
|
|
1126
1163
|
|
|
1127
1164
|
const createRecipe = (name, defaultVariants) => {
|
|
@@ -1155,17 +1192,17 @@ function generateRecipes(ctx) {
|
|
|
1155
1192
|
`
|
|
1156
1193
|
];
|
|
1157
1194
|
const dts = [
|
|
1158
|
-
|
|
1195
|
+
import_outdent20.outdent`
|
|
1159
1196
|
import type { ConditionalValue } from '../types'
|
|
1160
1197
|
`
|
|
1161
1198
|
];
|
|
1162
1199
|
Object.values(recipes).forEach((recipe) => {
|
|
1163
1200
|
const { name, description, defaultVariants, variants } = recipe;
|
|
1164
|
-
js.push(
|
|
1201
|
+
js.push(import_outdent20.outdent`
|
|
1165
1202
|
export const ${name} = createRecipe('${name}', ${JSON.stringify(defaultVariants ?? {})})
|
|
1166
1203
|
${name}.variants = ${JSON.stringify(Object.keys(variants ?? {}))}
|
|
1167
1204
|
`);
|
|
1168
|
-
dts.push(
|
|
1205
|
+
dts.push(import_outdent20.outdent`
|
|
1169
1206
|
export type ${(0, import_shared2.capitalize)(name)}Variants = {
|
|
1170
1207
|
${Object.keys(variants ?? {}).map((key) => {
|
|
1171
1208
|
const value = variants[key];
|
|
@@ -1179,14 +1216,14 @@ function generateRecipes(ctx) {
|
|
|
1179
1216
|
`);
|
|
1180
1217
|
});
|
|
1181
1218
|
return {
|
|
1182
|
-
js:
|
|
1183
|
-
dts:
|
|
1219
|
+
js: import_outdent20.outdent.string(js.join("\n\n")),
|
|
1220
|
+
dts: import_outdent20.outdent.string(dts.join("\n\n"))
|
|
1184
1221
|
};
|
|
1185
1222
|
}
|
|
1186
1223
|
|
|
1187
1224
|
// src/generators/reset.ts
|
|
1188
|
-
var
|
|
1189
|
-
var reset =
|
|
1225
|
+
var css2 = (v) => v[0];
|
|
1226
|
+
var reset = css2`
|
|
1190
1227
|
* {
|
|
1191
1228
|
margin: 0;
|
|
1192
1229
|
}
|
|
@@ -1279,7 +1316,7 @@ var reset = css`
|
|
|
1279
1316
|
top: -0.5em;
|
|
1280
1317
|
}
|
|
1281
1318
|
`;
|
|
1282
|
-
function
|
|
1319
|
+
function generateResetCss() {
|
|
1283
1320
|
return `@layer reset {
|
|
1284
1321
|
${reset}
|
|
1285
1322
|
}`;
|
|
@@ -1302,11 +1339,11 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
1302
1339
|
if (Object.keys(varsObj).length === 0)
|
|
1303
1340
|
continue;
|
|
1304
1341
|
if (key === "base") {
|
|
1305
|
-
const { css:
|
|
1306
|
-
results.push(
|
|
1342
|
+
const { css: css4 } = (0, import_core2.toCss)({ [root]: varsObj });
|
|
1343
|
+
results.push(css4);
|
|
1307
1344
|
} else {
|
|
1308
1345
|
const keys = key.split(":");
|
|
1309
|
-
const { css:
|
|
1346
|
+
const { css: css4 } = (0, import_core2.toCss)(varsObj);
|
|
1310
1347
|
const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
|
|
1311
1348
|
const parent = (0, import_core2.extractParentSelectors)(condition);
|
|
1312
1349
|
return parent ? `&${parent}` : condition;
|
|
@@ -1314,13 +1351,13 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
1314
1351
|
const rule = getDeepestRule(root, mapped);
|
|
1315
1352
|
if (!rule)
|
|
1316
1353
|
continue;
|
|
1317
|
-
getDeepestNode(rule)?.append(
|
|
1354
|
+
getDeepestNode(rule)?.append(css4);
|
|
1318
1355
|
results.push((0, import_core2.expandNestedCss)(rule.toString()));
|
|
1319
1356
|
}
|
|
1320
1357
|
}
|
|
1321
|
-
const
|
|
1358
|
+
const css3 = results.join("\n\n");
|
|
1322
1359
|
return `@layer tokens {
|
|
1323
|
-
${(0, import_core2.prettifyCss)(cleanupSelectors(
|
|
1360
|
+
${(0, import_core2.prettifyCss)(cleanupSelectors(css3, root))}
|
|
1324
1361
|
}
|
|
1325
1362
|
`;
|
|
1326
1363
|
}
|
|
@@ -1344,8 +1381,8 @@ function getDeepestNode(node) {
|
|
|
1344
1381
|
}
|
|
1345
1382
|
return node;
|
|
1346
1383
|
}
|
|
1347
|
-
function cleanupSelectors(
|
|
1348
|
-
const root = import_postcss.default.parse(
|
|
1384
|
+
function cleanupSelectors(css3, varSelector) {
|
|
1385
|
+
const root = import_postcss.default.parse(css3);
|
|
1349
1386
|
root.walkRules((rule) => {
|
|
1350
1387
|
rule.selectors.forEach((selector) => {
|
|
1351
1388
|
const res = selector.split(varSelector).filter(Boolean);
|
|
@@ -1359,7 +1396,7 @@ function cleanupSelectors(css2, varSelector) {
|
|
|
1359
1396
|
|
|
1360
1397
|
// src/generators/token-dts.ts
|
|
1361
1398
|
var import_shared3 = require("@pandacss/shared");
|
|
1362
|
-
var
|
|
1399
|
+
var import_outdent21 = require("outdent");
|
|
1363
1400
|
var import_pluralize = __toESM(require("pluralize"));
|
|
1364
1401
|
function generateTokenDts(dict) {
|
|
1365
1402
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -1377,11 +1414,11 @@ function generateTokenDts(dict) {
|
|
|
1377
1414
|
}
|
|
1378
1415
|
result.add("} & { [token: string]: never }");
|
|
1379
1416
|
set.add(Array.from(result).join("\n"));
|
|
1380
|
-
return
|
|
1417
|
+
return import_outdent21.outdent.string(Array.from(set).join("\n\n"));
|
|
1381
1418
|
}
|
|
1382
1419
|
|
|
1383
1420
|
// src/generators/token-js.ts
|
|
1384
|
-
var
|
|
1421
|
+
var import_outdent22 = __toESM(require("outdent"));
|
|
1385
1422
|
function generateTokenJs(dict) {
|
|
1386
1423
|
const map = /* @__PURE__ */ new Map();
|
|
1387
1424
|
dict.allTokens.forEach((token) => {
|
|
@@ -1391,7 +1428,7 @@ function generateTokenJs(dict) {
|
|
|
1391
1428
|
});
|
|
1392
1429
|
const obj = Object.fromEntries(map);
|
|
1393
1430
|
return {
|
|
1394
|
-
js:
|
|
1431
|
+
js: import_outdent22.default`
|
|
1395
1432
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1396
1433
|
|
|
1397
1434
|
export function token(path, fallback) {
|
|
@@ -1404,7 +1441,7 @@ function generateTokenJs(dict) {
|
|
|
1404
1441
|
|
|
1405
1442
|
token.var = tokenVar
|
|
1406
1443
|
`,
|
|
1407
|
-
dts:
|
|
1444
|
+
dts: import_outdent22.default`
|
|
1408
1445
|
import type { Token } from '../types/token'
|
|
1409
1446
|
|
|
1410
1447
|
export declare function token(path: Token, fallback?: string): string & {
|
|
@@ -1417,7 +1454,7 @@ function generateTokenJs(dict) {
|
|
|
1417
1454
|
// src/generators/types.ts
|
|
1418
1455
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
1419
1456
|
var import_fs_extra = require("fs-extra");
|
|
1420
|
-
var
|
|
1457
|
+
var import_outdent23 = __toESM(require("outdent"));
|
|
1421
1458
|
function getType(file) {
|
|
1422
1459
|
const filepath = getEntrypoint("@pandacss/types", { dev: file });
|
|
1423
1460
|
return (0, import_fs_extra.readFileSync)(filepath, "utf8");
|
|
@@ -1430,7 +1467,7 @@ function generateCssType(ctx) {
|
|
|
1430
1467
|
selectors: getType("selectors.d.ts"),
|
|
1431
1468
|
recipe: getType("recipe.d.ts"),
|
|
1432
1469
|
composition: getType("composition.d.ts"),
|
|
1433
|
-
global:
|
|
1470
|
+
global: import_outdent23.default`
|
|
1434
1471
|
import { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1435
1472
|
import { GlobalStyleObject } from './system-types'
|
|
1436
1473
|
import { CompositionStyles } from './composition'
|
|
@@ -1442,14 +1479,14 @@ function generateCssType(ctx) {
|
|
|
1442
1479
|
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
1443
1480
|
}
|
|
1444
1481
|
`,
|
|
1445
|
-
exported:
|
|
1482
|
+
exported: import_outdent23.default`
|
|
1446
1483
|
import './global'
|
|
1447
1484
|
export { ConditionalValue } from './conditions'
|
|
1448
1485
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1449
1486
|
|
|
1450
1487
|
export type Assign<Target, Override> = Omit<Target, keyof Override> & Override
|
|
1451
1488
|
`,
|
|
1452
|
-
styleProps:
|
|
1489
|
+
styleProps: import_outdent23.default`
|
|
1453
1490
|
import { PropertyValue } from './prop-type'
|
|
1454
1491
|
import { Token } from './token'
|
|
1455
1492
|
|
|
@@ -1483,11 +1520,11 @@ function setupDesignTokens(ctx) {
|
|
|
1483
1520
|
if (ctx.tokens.isEmpty)
|
|
1484
1521
|
return;
|
|
1485
1522
|
const code = generateTokenJs(ctx.tokens);
|
|
1486
|
-
const
|
|
1523
|
+
const css3 = generateTokenCss(ctx);
|
|
1487
1524
|
return {
|
|
1488
1525
|
dir: ctx.paths.token,
|
|
1489
1526
|
files: [
|
|
1490
|
-
{ file: "index.css", code:
|
|
1527
|
+
{ file: "index.css", code: css3 },
|
|
1491
1528
|
{ file: "index.d.ts", code: code.dts },
|
|
1492
1529
|
{ file: ctx.getExt("index"), code: code.js }
|
|
1493
1530
|
]
|
|
@@ -1564,8 +1601,8 @@ function setupPatterns(ctx) {
|
|
|
1564
1601
|
if (!files)
|
|
1565
1602
|
return;
|
|
1566
1603
|
const index = {
|
|
1567
|
-
js:
|
|
1568
|
-
dts:
|
|
1604
|
+
js: import_outdent24.default.string(files.map((file) => ctx.getExport(`./${file.name}`)).join("\n")),
|
|
1605
|
+
dts: import_outdent24.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
1569
1606
|
};
|
|
1570
1607
|
return {
|
|
1571
1608
|
dir: ctx.paths.pattern,
|
|
@@ -1584,17 +1621,17 @@ function setupJsx(ctx) {
|
|
|
1584
1621
|
const types = generateJsxTypes(ctx);
|
|
1585
1622
|
const factory = generateJsxFactory(ctx);
|
|
1586
1623
|
const patterns = generateJsxPatterns(ctx);
|
|
1587
|
-
const
|
|
1624
|
+
const layoutGrid2 = generateLayoutGrid(ctx);
|
|
1588
1625
|
const index = {
|
|
1589
|
-
js:
|
|
1626
|
+
js: import_outdent24.default`
|
|
1590
1627
|
${ctx.getExport("./factory")}
|
|
1591
1628
|
${ctx.getExport("./layout-grid")}
|
|
1592
|
-
${
|
|
1629
|
+
${import_outdent24.default.string(patterns.map((file) => ctx.getExport(`./${file.name}`)).join("\n"))}
|
|
1593
1630
|
`,
|
|
1594
|
-
dts:
|
|
1631
|
+
dts: import_outdent24.default`
|
|
1595
1632
|
export * from './factory'
|
|
1596
1633
|
export * from './layout-grid'
|
|
1597
|
-
${
|
|
1634
|
+
${import_outdent24.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1598
1635
|
export type { ${ctx.jsxFactoryDetails.typeName} } from '../types/jsx'
|
|
1599
1636
|
`
|
|
1600
1637
|
};
|
|
@@ -1603,8 +1640,8 @@ function setupJsx(ctx) {
|
|
|
1603
1640
|
files: [
|
|
1604
1641
|
...patterns.map((file) => ({ file: ctx.getExt(file.name), code: file.js })),
|
|
1605
1642
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
1606
|
-
{ file: ctx.getExt("layout-grid"), code:
|
|
1607
|
-
{ file: "layout-grid.d.ts", code:
|
|
1643
|
+
{ file: ctx.getExt("layout-grid"), code: layoutGrid2.js },
|
|
1644
|
+
{ file: "layout-grid.d.ts", code: layoutGrid2.dts },
|
|
1608
1645
|
{ file: ctx.getExt("is-valid-prop"), code: isValidProp.js },
|
|
1609
1646
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
1610
1647
|
{ file: ctx.getExt("factory"), code: factory.js },
|
|
@@ -1615,12 +1652,12 @@ function setupJsx(ctx) {
|
|
|
1615
1652
|
}
|
|
1616
1653
|
function setupCssIndex(ctx) {
|
|
1617
1654
|
const index = {
|
|
1618
|
-
js:
|
|
1655
|
+
js: import_outdent24.default`
|
|
1619
1656
|
${ctx.getExport("./css")}
|
|
1620
1657
|
${ctx.getExport("./cx")}
|
|
1621
1658
|
${ctx.getExport("./cva")}
|
|
1622
1659
|
`,
|
|
1623
|
-
dts:
|
|
1660
|
+
dts: import_outdent24.default`
|
|
1624
1661
|
export * from './css'
|
|
1625
1662
|
export * from './cx'
|
|
1626
1663
|
export * from './cva'
|
|
@@ -1634,12 +1671,16 @@ function setupCssIndex(ctx) {
|
|
|
1634
1671
|
]
|
|
1635
1672
|
};
|
|
1636
1673
|
}
|
|
1637
|
-
function
|
|
1674
|
+
function setupResetCss(ctx) {
|
|
1638
1675
|
if (!ctx.preflight)
|
|
1639
1676
|
return;
|
|
1640
|
-
const code =
|
|
1677
|
+
const code = generateResetCss();
|
|
1641
1678
|
return { files: [{ file: "reset.css", code }] };
|
|
1642
1679
|
}
|
|
1680
|
+
function setupLayoutGridCss() {
|
|
1681
|
+
const code = generateLayoutGridCss();
|
|
1682
|
+
return { files: [{ file: "layout-grid.css", code }] };
|
|
1683
|
+
}
|
|
1643
1684
|
function setupPackageJson(ctx) {
|
|
1644
1685
|
if (!ctx.emitPackage)
|
|
1645
1686
|
return;
|
|
@@ -1660,37 +1701,38 @@ function generateSystem(ctx) {
|
|
|
1660
1701
|
setupPatterns(ctx),
|
|
1661
1702
|
setupCssIndex(ctx),
|
|
1662
1703
|
setupJsx(ctx),
|
|
1663
|
-
|
|
1704
|
+
setupResetCss(ctx),
|
|
1705
|
+
setupLayoutGridCss(),
|
|
1664
1706
|
setupPackageJson(ctx)
|
|
1665
1707
|
].filter(Boolean);
|
|
1666
1708
|
}
|
|
1667
1709
|
|
|
1668
1710
|
// src/messages.ts
|
|
1669
1711
|
var import_logger3 = require("@pandacss/logger");
|
|
1670
|
-
var
|
|
1712
|
+
var import_outdent25 = require("outdent");
|
|
1671
1713
|
var tick = import_logger3.colors.green().bold("\u2714\uFE0F");
|
|
1672
1714
|
function artifactsGeneratedMessage(ctx) {
|
|
1673
1715
|
return [
|
|
1674
|
-
|
|
1716
|
+
import_outdent25.outdent`
|
|
1675
1717
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/css")}: the css function to author styles
|
|
1676
1718
|
`,
|
|
1677
|
-
ctx.hasTokens &&
|
|
1719
|
+
ctx.hasTokens && import_outdent25.outdent`
|
|
1678
1720
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
1679
1721
|
`,
|
|
1680
|
-
ctx.hasPatterns &&
|
|
1722
|
+
ctx.hasPatterns && import_outdent25.outdent`
|
|
1681
1723
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/patterns")}: functions to implement common css patterns
|
|
1682
1724
|
`,
|
|
1683
|
-
ctx.hasRecipes &&
|
|
1725
|
+
ctx.hasRecipes && import_outdent25.outdent`
|
|
1684
1726
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/recipes")}: functions to create multi-variant styles
|
|
1685
1727
|
`,
|
|
1686
|
-
ctx.jsxFramework &&
|
|
1728
|
+
ctx.jsxFramework && import_outdent25.outdent`
|
|
1687
1729
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/jsx")}: style prop powered elements for ${ctx.jsxFramework}
|
|
1688
1730
|
`,
|
|
1689
1731
|
"\n"
|
|
1690
1732
|
].filter(Boolean).join("\n");
|
|
1691
1733
|
}
|
|
1692
1734
|
function configExistsMessage(cmd) {
|
|
1693
|
-
return
|
|
1735
|
+
return import_outdent25.outdent`
|
|
1694
1736
|
\n
|
|
1695
1737
|
It looks like you already have panda created\`.
|
|
1696
1738
|
|
|
@@ -1699,7 +1741,7 @@ function configExistsMessage(cmd) {
|
|
|
1699
1741
|
`;
|
|
1700
1742
|
}
|
|
1701
1743
|
function thankYouMessage() {
|
|
1702
|
-
return
|
|
1744
|
+
return import_outdent25.outdent`
|
|
1703
1745
|
|
|
1704
1746
|
🚀 Thanks for choosing ${import_logger3.colors.cyan("Panda")} to write your css.
|
|
1705
1747
|
|
|
@@ -1711,7 +1753,7 @@ var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
|
|
|
1711
1753
|
var pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
|
1712
1754
|
function scaffoldCompleteMessage() {
|
|
1713
1755
|
return import_logger3.logger.box(
|
|
1714
|
-
|
|
1756
|
+
import_outdent25.outdent`
|
|
1715
1757
|
|
|
1716
1758
|
${import_logger3.colors.bold().cyan("Next steps:")}
|
|
1717
1759
|
|
|
@@ -1727,12 +1769,12 @@ function scaffoldCompleteMessage() {
|
|
|
1727
1769
|
);
|
|
1728
1770
|
}
|
|
1729
1771
|
function watchMessage() {
|
|
1730
|
-
return
|
|
1772
|
+
return import_outdent25.outdent`
|
|
1731
1773
|
Watching for file changes...
|
|
1732
1774
|
`;
|
|
1733
1775
|
}
|
|
1734
1776
|
function buildCompleteMessage(ctx) {
|
|
1735
|
-
return
|
|
1777
|
+
return import_outdent25.outdent`
|
|
1736
1778
|
Successfully extracted css from ${ctx.files.length} file(s) ✨
|
|
1737
1779
|
`;
|
|
1738
1780
|
}
|
|
@@ -1756,16 +1798,6 @@ async function extractCss(ctx) {
|
|
|
1756
1798
|
await bundleChunks(ctx);
|
|
1757
1799
|
return buildCompleteMessage(ctx);
|
|
1758
1800
|
}
|
|
1759
|
-
function getBaseCss(ctx) {
|
|
1760
|
-
const css2 = [
|
|
1761
|
-
generateReset(),
|
|
1762
|
-
generateTokenCss(ctx),
|
|
1763
|
-
generateKeyframes(ctx.theme.keyframes),
|
|
1764
|
-
ctx.getGlobalCss(),
|
|
1765
|
-
ctx.getStaticCss()
|
|
1766
|
-
];
|
|
1767
|
-
return css2.filter(Boolean).join("\n\n");
|
|
1768
|
-
}
|
|
1769
1801
|
|
|
1770
1802
|
// src/builder.ts
|
|
1771
1803
|
var import_core4 = require("@pandacss/core");
|
|
@@ -1776,6 +1808,19 @@ var import_fs4 = require("fs");
|
|
|
1776
1808
|
var import_fs_extra3 = require("fs-extra");
|
|
1777
1809
|
var import_path4 = require("path");
|
|
1778
1810
|
|
|
1811
|
+
// src/get-base-css.ts
|
|
1812
|
+
function getBaseCss(ctx) {
|
|
1813
|
+
const css3 = [
|
|
1814
|
+
generateResetCss(),
|
|
1815
|
+
generateLayoutGridCss(),
|
|
1816
|
+
generateTokenCss(ctx),
|
|
1817
|
+
generateKeyframes(ctx.theme.keyframes),
|
|
1818
|
+
ctx.getGlobalCss(),
|
|
1819
|
+
ctx.getStaticCss()
|
|
1820
|
+
];
|
|
1821
|
+
return css3.filter(Boolean).join("\n\n");
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1779
1824
|
// src/config.ts
|
|
1780
1825
|
var import_config = require("@pandacss/config");
|
|
1781
1826
|
var import_look_it_up = require("look-it-up");
|
|
@@ -2007,10 +2052,10 @@ function createContext(conf, io = fileSystem) {
|
|
|
2007
2052
|
format(file) {
|
|
2008
2053
|
return (0, import_path2.relative)(cwd, file).replaceAll(import_path2.sep, "__").replace((0, import_path2.extname)(file), ".css");
|
|
2009
2054
|
},
|
|
2010
|
-
async write(file,
|
|
2055
|
+
async write(file, css3) {
|
|
2011
2056
|
const fileName = chunks.format(file);
|
|
2012
2057
|
const oldCss = await chunks.readFile(file);
|
|
2013
|
-
const newCss = (0, import_core3.mergeCss)(oldCss,
|
|
2058
|
+
const newCss = (0, import_core3.mergeCss)(oldCss, css3);
|
|
2014
2059
|
import_logger4.logger.debug("chunk:write", { file, path: fileName });
|
|
2015
2060
|
return write(paths.chunk, [{ file: fileName, code: newCss }]);
|
|
2016
2061
|
},
|
|
@@ -2053,33 +2098,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
2053
2098
|
function getGlobalCss() {
|
|
2054
2099
|
const sheet = new import_core3.Stylesheet(context());
|
|
2055
2100
|
sheet.processGlobalCss({
|
|
2056
|
-
":root": {
|
|
2057
|
-
"--made-with-panda": `'\u{1F43C}'`
|
|
2058
|
-
},
|
|
2059
|
-
".panda-layout-grid": {
|
|
2060
|
-
display: "grid",
|
|
2061
|
-
gap: "var(--gutter)",
|
|
2062
|
-
gridTemplateColumns: "repeat(var(--count), 1fr)",
|
|
2063
|
-
height: "100%",
|
|
2064
|
-
width: "100%",
|
|
2065
|
-
position: "absolute",
|
|
2066
|
-
inset: "0",
|
|
2067
|
-
pointerEvents: "none",
|
|
2068
|
-
maxWidth: "var(--max-width)",
|
|
2069
|
-
marginInline: "var(--margin-x)",
|
|
2070
|
-
paddingInline: "var(--padding-x)"
|
|
2071
|
-
},
|
|
2072
|
-
".panda-layout-grid__item": {
|
|
2073
|
-
display: "flex",
|
|
2074
|
-
"--color": "rgba(255, 0, 0, 0.1)",
|
|
2075
|
-
height: "100%",
|
|
2076
|
-
"&[data-variant=bg]": {
|
|
2077
|
-
background: "var(--color)"
|
|
2078
|
-
},
|
|
2079
|
-
"&[data-variant=outline]": {
|
|
2080
|
-
borderInline: "1px solid var(--color)"
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2101
|
+
":root": { "--made-with-panda": `'\u{1F43C}'` }
|
|
2083
2102
|
});
|
|
2084
2103
|
if (globalCss) {
|
|
2085
2104
|
sheet.processGlobalCss(globalCss);
|
|
@@ -2099,8 +2118,8 @@ function createContext(conf, io = fileSystem) {
|
|
|
2099
2118
|
return recipes2[recipe];
|
|
2100
2119
|
}
|
|
2101
2120
|
});
|
|
2102
|
-
results.css.forEach((
|
|
2103
|
-
sheet.processAtomic(
|
|
2121
|
+
results.css.forEach((css3) => {
|
|
2122
|
+
sheet.processAtomic(css3);
|
|
2104
2123
|
});
|
|
2105
2124
|
results.recipes.forEach((result) => {
|
|
2106
2125
|
Object.entries(result).forEach(([key, value]) => {
|
|
@@ -2122,8 +2141,8 @@ function createContext(conf, io = fileSystem) {
|
|
|
2122
2141
|
});
|
|
2123
2142
|
collector.jsx.forEach((result) => {
|
|
2124
2143
|
const { data, type, name } = result;
|
|
2125
|
-
const { css:
|
|
2126
|
-
const styles = { ...
|
|
2144
|
+
const { css: css3 = {}, ...rest } = data;
|
|
2145
|
+
const styles = { ...css3, ...rest };
|
|
2127
2146
|
(0, import_ts_pattern5.match)([name, type]).with([import_ts_pattern5.P.string, "pattern"], ([name2]) => {
|
|
2128
2147
|
collector.setPattern(getPatternFnName(name2), { data: styles });
|
|
2129
2148
|
}).with([import_ts_pattern5.P.string, "recipe"], ([name2]) => {
|
|
@@ -2289,9 +2308,9 @@ var Builder = class {
|
|
|
2289
2308
|
fileCssMap = /* @__PURE__ */ new Map();
|
|
2290
2309
|
context;
|
|
2291
2310
|
configChanged = true;
|
|
2292
|
-
updateFile(file,
|
|
2311
|
+
updateFile(file, css3) {
|
|
2293
2312
|
const oldCss = this.fileCssMap?.get(file) ?? "";
|
|
2294
|
-
const newCss = (0, import_core4.mergeCss)(oldCss,
|
|
2313
|
+
const newCss = (0, import_core4.mergeCss)(oldCss, css3);
|
|
2295
2314
|
this.fileCssMap?.set(file, newCss);
|
|
2296
2315
|
}
|
|
2297
2316
|
async setup() {
|
|
@@ -2339,8 +2358,8 @@ var Builder = class {
|
|
|
2339
2358
|
toString() {
|
|
2340
2359
|
const ctx = this.ensure();
|
|
2341
2360
|
const sheet = new import_core4.Stylesheet(ctx.context());
|
|
2342
|
-
const
|
|
2343
|
-
sheet.append(
|
|
2361
|
+
const css3 = Array.from(this.fileCssMap.values()).join("\n\n");
|
|
2362
|
+
sheet.append(css3);
|
|
2344
2363
|
return sheet.toCss({ minify: ctx.minify });
|
|
2345
2364
|
}
|
|
2346
2365
|
isValidRoot(root) {
|
|
@@ -2495,9 +2514,9 @@ async function generate5(config, configPath) {
|
|
|
2495
2514
|
// src/git-ignore.ts
|
|
2496
2515
|
var import_fs5 = require("fs");
|
|
2497
2516
|
var import_look_it_up2 = require("look-it-up");
|
|
2498
|
-
var
|
|
2517
|
+
var import_outdent26 = __toESM(require("outdent"));
|
|
2499
2518
|
function setupGitIgnore(ctx) {
|
|
2500
|
-
const txt =
|
|
2519
|
+
const txt = import_outdent26.default`## CSS Panda
|
|
2501
2520
|
${ctx.outdir}
|
|
2502
2521
|
${ctx.outdir}-static
|
|
2503
2522
|
`;
|
|
@@ -2515,7 +2534,7 @@ function setupGitIgnore(ctx) {
|
|
|
2515
2534
|
var import_logger9 = require("@pandacss/logger");
|
|
2516
2535
|
var import_fs_extra4 = require("fs-extra");
|
|
2517
2536
|
var import_look_it_up3 = require("look-it-up");
|
|
2518
|
-
var
|
|
2537
|
+
var import_outdent27 = require("outdent");
|
|
2519
2538
|
var import_path5 = require("path");
|
|
2520
2539
|
var import_preferred_pm2 = __toESM(require("preferred-pm"));
|
|
2521
2540
|
async function setupConfig(cwd, { force }) {
|
|
@@ -2529,7 +2548,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
2529
2548
|
if (!force && configFile) {
|
|
2530
2549
|
import_logger9.logger.warn("init:config", configExistsMessage(cmd));
|
|
2531
2550
|
} else {
|
|
2532
|
-
const content =
|
|
2551
|
+
const content = import_outdent27.outdent`
|
|
2533
2552
|
import { defineConfig } from "css-panda"
|
|
2534
2553
|
|
|
2535
2554
|
export default defineConfig({
|
|
@@ -2555,7 +2574,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
2555
2574
|
}
|
|
2556
2575
|
async function setupPostcss(cwd) {
|
|
2557
2576
|
import_logger9.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger9.quote)("postcss.config.cjs")}`);
|
|
2558
|
-
const content =
|
|
2577
|
+
const content = import_outdent27.outdent`
|
|
2559
2578
|
module.exports = {
|
|
2560
2579
|
plugins: {
|
|
2561
2580
|
'css-panda/postcss': {},
|