@pandacss/node 0.0.0-dev-20230203184408 → 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.mjs CHANGED
@@ -13,8 +13,7 @@ function extractFile(ctx, file) {
13
13
  let result;
14
14
  const done = logger.time.debug(`Extracted ${quote(file)}`);
15
15
  try {
16
- const source = ctx.getSourceFile(file);
17
- data = ctx.parseSourceFile(source);
16
+ data = ctx.project.parseSourceFile(ctx.absPath(file));
18
17
  } catch (error) {
19
18
  logger.error("file:parse", error);
20
19
  }
@@ -36,16 +35,16 @@ function extractFiles(ctx) {
36
35
  });
37
36
  }
38
37
  function extractGlobalCss(ctx) {
39
- const css2 = ctx.getGlobalCss();
40
- if (!css2)
38
+ const css3 = ctx.getGlobalCss();
39
+ if (!css3)
41
40
  return;
42
- return ctx.chunks.write("system/global.css", css2);
41
+ return ctx.chunks.write("system/global.css", css3);
43
42
  }
44
43
  function extractStaticCss(ctx) {
45
- const css2 = ctx.getStaticCss();
46
- if (!css2)
44
+ const css3 = ctx.getStaticCss();
45
+ if (!css3)
47
46
  return;
48
- return ctx.chunks.write("system/static.css", css2);
47
+ return ctx.chunks.write("system/static.css", css3);
49
48
  }
50
49
 
51
50
  // src/chunks.ts
@@ -53,6 +52,7 @@ async function extractChunks(ctx) {
53
52
  const sheet = new Stylesheet(ctx.context(), {
54
53
  content: [
55
54
  "@layer reset, base, tokens, recipes, utilities;",
55
+ "@import './layout-grid.css';",
56
56
  ctx.preflight && "@import './reset.css';",
57
57
  !ctx.tokens.isEmpty && "@import './tokens/index.css';",
58
58
  ctx.theme.keyframes && "@import './tokens/keyframes.css';"
@@ -61,15 +61,15 @@ async function extractChunks(ctx) {
61
61
  const files = ctx.chunks.getFiles();
62
62
  await Promise.all(
63
63
  files.map(async (file) => {
64
- const css2 = await ctx.chunks.readFile(file);
65
- sheet.append(css2);
64
+ const css3 = await ctx.chunks.readFile(file);
65
+ sheet.append(css3);
66
66
  })
67
67
  );
68
68
  return sheet.toCss({ minify: ctx.minify });
69
69
  }
70
70
  async function bundleChunks(ctx) {
71
- const css2 = await extractChunks(ctx);
72
- await ctx.write(ctx.paths.root, [{ file: "styles.css", code: css2 }]);
71
+ const css3 = await extractChunks(ctx);
72
+ await ctx.write(ctx.paths.root, [{ file: "styles.css", code: css3 }]);
73
73
  }
74
74
  async function writeFileChunk(ctx, file) {
75
75
  logger2.info("chunk:change", `File changed: ${file}`);
@@ -81,7 +81,7 @@ async function writeFileChunk(ctx, file) {
81
81
 
82
82
  // src/generators/index.ts
83
83
  import { readFileSync as readFileSync3 } from "fs";
84
- import outdent23 from "outdent";
84
+ import outdent24 from "outdent";
85
85
 
86
86
  // src/generators/conditions.ts
87
87
  import outdent from "outdent";
@@ -946,9 +946,45 @@ function generateLayoutGrid(ctx) {
946
946
  return layoutGridMap[ctx.jsxFramework]();
947
947
  }
948
948
 
949
+ // src/generators/layout-grid.ts
950
+ import { outdent as outdent17 } from "outdent";
951
+ var css = (v) => v[0];
952
+ var layoutGrid = css`
953
+ .panda-layout-grid {
954
+ display: grid;
955
+ gap: var(--gutter);
956
+ grid-template-columns: repeat(var(--count), 1fr);
957
+ height: 100%;
958
+ width: 100%;
959
+ position: absolute;
960
+ inset: 0;
961
+ pointer-events: none;
962
+ max-width: var(--max-width);
963
+ margin-inline: var(--margin-x);
964
+ padding-inline: var(--padding-x);
965
+ }
966
+ .panda-layout-grid__item {
967
+ display: flex;
968
+ --color: rgba(255, 0, 0, 0.1);
969
+ height: 100%;
970
+ }
971
+ .panda-layout-grid__item[data-variant='bg'] {
972
+ background: var(--color);
973
+ }
974
+ .panda-layout-grid__item[data-variant='outline'] {
975
+ border-inline: 1px solid var(--color);
976
+ }
977
+ `;
978
+ function generateLayoutGridCss() {
979
+ return outdent17`
980
+ @layer base {
981
+ ${layoutGrid}
982
+ }`;
983
+ }
984
+
949
985
  // src/generators/pattern.ts
950
986
  import { capitalize, dashCase, unionType } from "@pandacss/shared";
951
- import { outdent as outdent17 } from "outdent";
987
+ import { outdent as outdent18 } from "outdent";
952
988
  import { stringify as stringify2 } from "javascript-stringify";
953
989
  import { match as match4 } from "ts-pattern";
954
990
  function generate4(ctx, name, pattern) {
@@ -956,7 +992,7 @@ function generate4(ctx, name, pattern) {
956
992
  const { upperName, styleFn, blocklistType } = ctx.getPatternDetails(name, pattern);
957
993
  return {
958
994
  name: dashCase(name),
959
- dts: outdent17`
995
+ dts: outdent18`
960
996
  import type { SystemStyleObject, ConditionalValue } from '../types'
961
997
  import type { PropertyValue } from '../types/prop-type'
962
998
  import type { Properties } from '../types/csstype'
@@ -980,7 +1016,7 @@ function generate4(ctx, name, pattern) {
980
1016
  }).join("\n ")}
981
1017
  }
982
1018
 
983
- ${strict ? outdent17`export declare function ${name}(options: ${upperName}Properties): string` : outdent17`
1019
+ ${strict ? outdent18`export declare function ${name}(options: ${upperName}Properties): string` : outdent18`
984
1020
 
985
1021
  type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
986
1022
 
@@ -989,7 +1025,7 @@ function generate4(ctx, name, pattern) {
989
1025
  `}
990
1026
 
991
1027
  `,
992
- js: outdent17`
1028
+ js: outdent18`
993
1029
  ${ctx.getImport("mapObject", "../helpers")}
994
1030
  ${ctx.getImport("css", "../css/index")}
995
1031
 
@@ -1028,11 +1064,11 @@ function generatePackageJSON(ctx) {
1028
1064
  }
1029
1065
 
1030
1066
  // src/generators/prop-types.ts
1031
- import { outdent as outdent18 } from "outdent";
1067
+ import { outdent as outdent19 } from "outdent";
1032
1068
  function generatePropTypes(utility, strict) {
1033
1069
  const strictText = `${strict ? "" : " | NativeValue<T>"}`;
1034
1070
  const result = [
1035
- outdent18`
1071
+ outdent19`
1036
1072
  import type { ConditionalValue } from './conditions';
1037
1073
  import type { Properties as CSSProperties } from './csstype'
1038
1074
  import type { Tokens } from './token'
@@ -1055,7 +1091,7 @@ function generatePropTypes(utility, strict) {
1055
1091
  result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
1056
1092
  });
1057
1093
  result.push("}");
1058
- return outdent18`
1094
+ return outdent19`
1059
1095
  ${result.join("\n")}
1060
1096
 
1061
1097
  export type PropertyValue<T extends string> = T extends keyof PropertyTypes
@@ -1068,14 +1104,14 @@ function generatePropTypes(utility, strict) {
1068
1104
 
1069
1105
  // src/generators/recipe.ts
1070
1106
  import { capitalize as capitalize2, unionType as unionType2 } from "@pandacss/shared";
1071
- import { outdent as outdent19 } from "outdent";
1107
+ import { outdent as outdent20 } from "outdent";
1072
1108
  function generateRecipes(ctx) {
1073
1109
  const { recipes = {}, hash, hasRecipes, utility } = ctx;
1074
1110
  const { separator } = utility;
1075
1111
  if (!hasRecipes)
1076
1112
  return;
1077
1113
  const js = [
1078
- outdent19`
1114
+ outdent20`
1079
1115
  ${ctx.getImport("createCss, withoutSpace, compact", "../helpers")}
1080
1116
 
1081
1117
  const createRecipe = (name, defaultVariants) => {
@@ -1109,17 +1145,17 @@ function generateRecipes(ctx) {
1109
1145
  `
1110
1146
  ];
1111
1147
  const dts = [
1112
- outdent19`
1148
+ outdent20`
1113
1149
  import type { ConditionalValue } from '../types'
1114
1150
  `
1115
1151
  ];
1116
1152
  Object.values(recipes).forEach((recipe) => {
1117
1153
  const { name, description, defaultVariants, variants } = recipe;
1118
- js.push(outdent19`
1154
+ js.push(outdent20`
1119
1155
  export const ${name} = createRecipe('${name}', ${JSON.stringify(defaultVariants ?? {})})
1120
1156
  ${name}.variants = ${JSON.stringify(Object.keys(variants ?? {}))}
1121
1157
  `);
1122
- dts.push(outdent19`
1158
+ dts.push(outdent20`
1123
1159
  export type ${capitalize2(name)}Variants = {
1124
1160
  ${Object.keys(variants ?? {}).map((key) => {
1125
1161
  const value = variants[key];
@@ -1133,14 +1169,14 @@ function generateRecipes(ctx) {
1133
1169
  `);
1134
1170
  });
1135
1171
  return {
1136
- js: outdent19.string(js.join("\n\n")),
1137
- dts: outdent19.string(dts.join("\n\n"))
1172
+ js: outdent20.string(js.join("\n\n")),
1173
+ dts: outdent20.string(dts.join("\n\n"))
1138
1174
  };
1139
1175
  }
1140
1176
 
1141
1177
  // src/generators/reset.ts
1142
- var css = (v) => v[0];
1143
- var reset = css`
1178
+ var css2 = (v) => v[0];
1179
+ var reset = css2`
1144
1180
  * {
1145
1181
  margin: 0;
1146
1182
  }
@@ -1233,7 +1269,7 @@ var reset = css`
1233
1269
  top: -0.5em;
1234
1270
  }
1235
1271
  `;
1236
- function generateReset() {
1272
+ function generateResetCss() {
1237
1273
  return `@layer reset {
1238
1274
  ${reset}
1239
1275
  }`;
@@ -1256,11 +1292,11 @@ function generateTokenCss(ctx, varRoot) {
1256
1292
  if (Object.keys(varsObj).length === 0)
1257
1293
  continue;
1258
1294
  if (key === "base") {
1259
- const { css: css3 } = toCss({ [root]: varsObj });
1260
- results.push(css3);
1295
+ const { css: css4 } = toCss({ [root]: varsObj });
1296
+ results.push(css4);
1261
1297
  } else {
1262
1298
  const keys = key.split(":");
1263
- const { css: css3 } = toCss(varsObj);
1299
+ const { css: css4 } = toCss(varsObj);
1264
1300
  const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
1265
1301
  const parent = extractParentSelectors(condition);
1266
1302
  return parent ? `&${parent}` : condition;
@@ -1268,13 +1304,13 @@ function generateTokenCss(ctx, varRoot) {
1268
1304
  const rule = getDeepestRule(root, mapped);
1269
1305
  if (!rule)
1270
1306
  continue;
1271
- getDeepestNode(rule)?.append(css3);
1307
+ getDeepestNode(rule)?.append(css4);
1272
1308
  results.push(expandNestedCss(rule.toString()));
1273
1309
  }
1274
1310
  }
1275
- const css2 = results.join("\n\n");
1311
+ const css3 = results.join("\n\n");
1276
1312
  return `@layer tokens {
1277
- ${prettifyCss(cleanupSelectors(css2, root))}
1313
+ ${prettifyCss(cleanupSelectors(css3, root))}
1278
1314
  }
1279
1315
  `;
1280
1316
  }
@@ -1298,8 +1334,8 @@ function getDeepestNode(node) {
1298
1334
  }
1299
1335
  return node;
1300
1336
  }
1301
- function cleanupSelectors(css2, varSelector) {
1302
- const root = postcss.parse(css2);
1337
+ function cleanupSelectors(css3, varSelector) {
1338
+ const root = postcss.parse(css3);
1303
1339
  root.walkRules((rule) => {
1304
1340
  rule.selectors.forEach((selector) => {
1305
1341
  const res = selector.split(varSelector).filter(Boolean);
@@ -1313,7 +1349,7 @@ function cleanupSelectors(css2, varSelector) {
1313
1349
 
1314
1350
  // src/generators/token-dts.ts
1315
1351
  import { unionType as unionType3, capitalize as capitalize3 } from "@pandacss/shared";
1316
- import { outdent as outdent20 } from "outdent";
1352
+ import { outdent as outdent21 } from "outdent";
1317
1353
  import pluralize from "pluralize";
1318
1354
  function generateTokenDts(dict) {
1319
1355
  const set = /* @__PURE__ */ new Set();
@@ -1331,11 +1367,11 @@ function generateTokenDts(dict) {
1331
1367
  }
1332
1368
  result.add("} & { [token: string]: never }");
1333
1369
  set.add(Array.from(result).join("\n"));
1334
- return outdent20.string(Array.from(set).join("\n\n"));
1370
+ return outdent21.string(Array.from(set).join("\n\n"));
1335
1371
  }
1336
1372
 
1337
1373
  // src/generators/token-js.ts
1338
- import outdent21 from "outdent";
1374
+ import outdent22 from "outdent";
1339
1375
  function generateTokenJs(dict) {
1340
1376
  const map = /* @__PURE__ */ new Map();
1341
1377
  dict.allTokens.forEach((token) => {
@@ -1345,7 +1381,7 @@ function generateTokenJs(dict) {
1345
1381
  });
1346
1382
  const obj = Object.fromEntries(map);
1347
1383
  return {
1348
- js: outdent21`
1384
+ js: outdent22`
1349
1385
  const tokens = ${JSON.stringify(obj, null, 2)}
1350
1386
 
1351
1387
  export function token(path, fallback) {
@@ -1358,7 +1394,7 @@ function generateTokenJs(dict) {
1358
1394
 
1359
1395
  token.var = tokenVar
1360
1396
  `,
1361
- dts: outdent21`
1397
+ dts: outdent22`
1362
1398
  import type { Token } from '../types/token'
1363
1399
 
1364
1400
  export declare function token(path: Token, fallback?: string): string & {
@@ -1371,7 +1407,7 @@ function generateTokenJs(dict) {
1371
1407
  // src/generators/types.ts
1372
1408
  import { allCssProperties } from "@pandacss/is-valid-prop";
1373
1409
  import { readFileSync as readFileSync2 } from "fs-extra";
1374
- import outdent22 from "outdent";
1410
+ import outdent23 from "outdent";
1375
1411
  function getType(file) {
1376
1412
  const filepath = getEntrypoint("@pandacss/types", { dev: file });
1377
1413
  return readFileSync2(filepath, "utf8");
@@ -1384,7 +1420,7 @@ function generateCssType(ctx) {
1384
1420
  selectors: getType("selectors.d.ts"),
1385
1421
  recipe: getType("recipe.d.ts"),
1386
1422
  composition: getType("composition.d.ts"),
1387
- global: outdent22`
1423
+ global: outdent23`
1388
1424
  import { RecipeVariantRecord, RecipeConfig } from './recipe'
1389
1425
  import { GlobalStyleObject } from './system-types'
1390
1426
  import { CompositionStyles } from './composition'
@@ -1396,14 +1432,14 @@ function generateCssType(ctx) {
1396
1432
  export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
1397
1433
  }
1398
1434
  `,
1399
- exported: outdent22`
1435
+ exported: outdent23`
1400
1436
  import './global'
1401
1437
  export { ConditionalValue } from './conditions'
1402
1438
  export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
1403
1439
 
1404
1440
  export type Assign<Target, Override> = Omit<Target, keyof Override> & Override
1405
1441
  `,
1406
- styleProps: outdent22`
1442
+ styleProps: outdent23`
1407
1443
  import { PropertyValue } from './prop-type'
1408
1444
  import { Token } from './token'
1409
1445
 
@@ -1437,11 +1473,11 @@ function setupDesignTokens(ctx) {
1437
1473
  if (ctx.tokens.isEmpty)
1438
1474
  return;
1439
1475
  const code = generateTokenJs(ctx.tokens);
1440
- const css2 = generateTokenCss(ctx);
1476
+ const css3 = generateTokenCss(ctx);
1441
1477
  return {
1442
1478
  dir: ctx.paths.token,
1443
1479
  files: [
1444
- { file: "index.css", code: css2 },
1480
+ { file: "index.css", code: css3 },
1445
1481
  { file: "index.d.ts", code: code.dts },
1446
1482
  { file: ctx.getExt("index"), code: code.js }
1447
1483
  ]
@@ -1518,8 +1554,8 @@ function setupPatterns(ctx) {
1518
1554
  if (!files)
1519
1555
  return;
1520
1556
  const index = {
1521
- js: outdent23.string(files.map((file) => ctx.getExport(`./${file.name}`)).join("\n")),
1522
- dts: outdent23.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
1557
+ js: outdent24.string(files.map((file) => ctx.getExport(`./${file.name}`)).join("\n")),
1558
+ dts: outdent24.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
1523
1559
  };
1524
1560
  return {
1525
1561
  dir: ctx.paths.pattern,
@@ -1538,17 +1574,17 @@ function setupJsx(ctx) {
1538
1574
  const types = generateJsxTypes(ctx);
1539
1575
  const factory = generateJsxFactory(ctx);
1540
1576
  const patterns = generateJsxPatterns(ctx);
1541
- const layoutGrid = generateLayoutGrid(ctx);
1577
+ const layoutGrid2 = generateLayoutGrid(ctx);
1542
1578
  const index = {
1543
- js: outdent23`
1579
+ js: outdent24`
1544
1580
  ${ctx.getExport("./factory")}
1545
1581
  ${ctx.getExport("./layout-grid")}
1546
- ${outdent23.string(patterns.map((file) => ctx.getExport(`./${file.name}`)).join("\n"))}
1582
+ ${outdent24.string(patterns.map((file) => ctx.getExport(`./${file.name}`)).join("\n"))}
1547
1583
  `,
1548
- dts: outdent23`
1584
+ dts: outdent24`
1549
1585
  export * from './factory'
1550
1586
  export * from './layout-grid'
1551
- ${outdent23.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
1587
+ ${outdent24.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
1552
1588
  export type { ${ctx.jsxFactoryDetails.typeName} } from '../types/jsx'
1553
1589
  `
1554
1590
  };
@@ -1557,8 +1593,8 @@ function setupJsx(ctx) {
1557
1593
  files: [
1558
1594
  ...patterns.map((file) => ({ file: ctx.getExt(file.name), code: file.js })),
1559
1595
  ...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
1560
- { file: ctx.getExt("layout-grid"), code: layoutGrid.js },
1561
- { file: "layout-grid.d.ts", code: layoutGrid.dts },
1596
+ { file: ctx.getExt("layout-grid"), code: layoutGrid2.js },
1597
+ { file: "layout-grid.d.ts", code: layoutGrid2.dts },
1562
1598
  { file: ctx.getExt("is-valid-prop"), code: isValidProp.js },
1563
1599
  { file: "factory.d.ts", code: types.jsxFactory },
1564
1600
  { file: ctx.getExt("factory"), code: factory.js },
@@ -1569,12 +1605,12 @@ function setupJsx(ctx) {
1569
1605
  }
1570
1606
  function setupCssIndex(ctx) {
1571
1607
  const index = {
1572
- js: outdent23`
1608
+ js: outdent24`
1573
1609
  ${ctx.getExport("./css")}
1574
1610
  ${ctx.getExport("./cx")}
1575
1611
  ${ctx.getExport("./cva")}
1576
1612
  `,
1577
- dts: outdent23`
1613
+ dts: outdent24`
1578
1614
  export * from './css'
1579
1615
  export * from './cx'
1580
1616
  export * from './cva'
@@ -1588,12 +1624,16 @@ function setupCssIndex(ctx) {
1588
1624
  ]
1589
1625
  };
1590
1626
  }
1591
- function setupReset(ctx) {
1627
+ function setupResetCss(ctx) {
1592
1628
  if (!ctx.preflight)
1593
1629
  return;
1594
- const code = generateReset();
1630
+ const code = generateResetCss();
1595
1631
  return { files: [{ file: "reset.css", code }] };
1596
1632
  }
1633
+ function setupLayoutGridCss() {
1634
+ const code = generateLayoutGridCss();
1635
+ return { files: [{ file: "layout-grid.css", code }] };
1636
+ }
1597
1637
  function setupPackageJson(ctx) {
1598
1638
  if (!ctx.emitPackage)
1599
1639
  return;
@@ -1614,37 +1654,38 @@ function generateSystem(ctx) {
1614
1654
  setupPatterns(ctx),
1615
1655
  setupCssIndex(ctx),
1616
1656
  setupJsx(ctx),
1617
- setupReset(ctx),
1657
+ setupResetCss(ctx),
1658
+ setupLayoutGridCss(),
1618
1659
  setupPackageJson(ctx)
1619
1660
  ].filter(Boolean);
1620
1661
  }
1621
1662
 
1622
1663
  // src/messages.ts
1623
1664
  import { colors, logger as logger3, quote as quote2 } from "@pandacss/logger";
1624
- import { outdent as outdent24 } from "outdent";
1665
+ import { outdent as outdent25 } from "outdent";
1625
1666
  var tick = colors.green().bold("\u2714\uFE0F");
1626
1667
  function artifactsGeneratedMessage(ctx) {
1627
1668
  return [
1628
- outdent24`
1669
+ outdent25`
1629
1670
  ${tick} ${quote2(ctx.outdir, "/css")}: the css function to author styles
1630
1671
  `,
1631
- ctx.hasTokens && outdent24`
1672
+ ctx.hasTokens && outdent25`
1632
1673
  ${tick} ${quote2(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
1633
1674
  `,
1634
- ctx.hasPatterns && outdent24`
1675
+ ctx.hasPatterns && outdent25`
1635
1676
  ${tick} ${quote2(ctx.outdir, "/patterns")}: functions to implement common css patterns
1636
1677
  `,
1637
- ctx.hasRecipes && outdent24`
1678
+ ctx.hasRecipes && outdent25`
1638
1679
  ${tick} ${quote2(ctx.outdir, "/recipes")}: functions to create multi-variant styles
1639
1680
  `,
1640
- ctx.jsxFramework && outdent24`
1681
+ ctx.jsxFramework && outdent25`
1641
1682
  ${tick} ${quote2(ctx.outdir, "/jsx")}: style prop powered elements for ${ctx.jsxFramework}
1642
1683
  `,
1643
1684
  "\n"
1644
1685
  ].filter(Boolean).join("\n");
1645
1686
  }
1646
1687
  function configExistsMessage(cmd) {
1647
- return outdent24`
1688
+ return outdent25`
1648
1689
  \n
1649
1690
  It looks like you already have panda created\`.
1650
1691
 
@@ -1653,7 +1694,7 @@ function configExistsMessage(cmd) {
1653
1694
  `;
1654
1695
  }
1655
1696
  function thankYouMessage() {
1656
- return outdent24`
1697
+ return outdent25`
1657
1698
 
1658
1699
  🚀 Thanks for choosing ${colors.cyan("Panda")} to write your css.
1659
1700
 
@@ -1665,7 +1706,7 @@ var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
1665
1706
  var pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
1666
1707
  function scaffoldCompleteMessage() {
1667
1708
  return logger3.box(
1668
- outdent24`
1709
+ outdent25`
1669
1710
 
1670
1711
  ${colors.bold().cyan("Next steps:")}
1671
1712
 
@@ -1681,12 +1722,12 @@ function scaffoldCompleteMessage() {
1681
1722
  );
1682
1723
  }
1683
1724
  function watchMessage() {
1684
- return outdent24`
1725
+ return outdent25`
1685
1726
  Watching for file changes...
1686
1727
  `;
1687
1728
  }
1688
1729
  function buildCompleteMessage(ctx) {
1689
- return outdent24`
1730
+ return outdent25`
1690
1731
  Successfully extracted css from ${ctx.files.length} file(s) ✨
1691
1732
  `;
1692
1733
  }
@@ -1710,16 +1751,6 @@ async function extractCss(ctx) {
1710
1751
  await bundleChunks(ctx);
1711
1752
  return buildCompleteMessage(ctx);
1712
1753
  }
1713
- function getBaseCss(ctx) {
1714
- const css2 = [
1715
- generateReset(),
1716
- generateTokenCss(ctx),
1717
- generateKeyframes(ctx.theme.keyframes),
1718
- ctx.getGlobalCss(),
1719
- ctx.getStaticCss()
1720
- ];
1721
- return css2.filter(Boolean).join("\n\n");
1722
- }
1723
1754
 
1724
1755
  // src/builder.ts
1725
1756
  import { discardDuplicate, mergeCss as mergeCss2, Stylesheet as Stylesheet3 } from "@pandacss/core";
@@ -1730,6 +1761,19 @@ import { existsSync as existsSync2, readFileSync as readFileSync5 } from "fs";
1730
1761
  import { statSync } from "fs-extra";
1731
1762
  import { resolve as resolve3 } from "path";
1732
1763
 
1764
+ // src/get-base-css.ts
1765
+ function getBaseCss(ctx) {
1766
+ const css3 = [
1767
+ generateResetCss(),
1768
+ generateLayoutGridCss(),
1769
+ generateTokenCss(ctx),
1770
+ generateKeyframes(ctx.theme.keyframes),
1771
+ ctx.getGlobalCss(),
1772
+ ctx.getStaticCss()
1773
+ ];
1774
+ return css3.filter(Boolean).join("\n\n");
1775
+ }
1776
+
1733
1777
  // src/config.ts
1734
1778
  import { loadConfigFile } from "@pandacss/config";
1735
1779
  import { lookItUpSync } from "look-it-up";
@@ -1745,7 +1789,7 @@ import {
1745
1789
  } from "@pandacss/core";
1746
1790
  import { isCssProperty } from "@pandacss/is-valid-prop";
1747
1791
  import { logger as logger4 } from "@pandacss/logger";
1748
- import { createParser, createProject } from "@pandacss/parser";
1792
+ import { createProject } from "@pandacss/parser";
1749
1793
  import { capitalize as capitalize4, compact, dashCase as dashCase2, mapObject, splitProps, uncapitalize } from "@pandacss/shared";
1750
1794
  import { TokenDictionary } from "@pandacss/token-dictionary";
1751
1795
  import glob from "fast-glob";
@@ -1754,7 +1798,6 @@ import { emptyDir, ensureDir, existsSync } from "fs-extra";
1754
1798
  import { readFile, unlink, writeFile } from "fs/promises";
1755
1799
  import { extname, isAbsolute, join as join2, relative, resolve, sep } from "path";
1756
1800
  import postcss2 from "postcss";
1757
- import { ScriptKind } from "ts-morph";
1758
1801
  import { match as match5, P } from "ts-pattern";
1759
1802
  var helpers = {
1760
1803
  map: mapObject
@@ -1969,10 +2012,10 @@ function createContext(conf, io = fileSystem) {
1969
2012
  format(file) {
1970
2013
  return relative(cwd, file).replaceAll(sep, "__").replace(extname(file), ".css");
1971
2014
  },
1972
- async write(file, css2) {
2015
+ async write(file, css3) {
1973
2016
  const fileName = chunks.format(file);
1974
2017
  const oldCss = await chunks.readFile(file);
1975
- const newCss = mergeCss(oldCss, css2);
2018
+ const newCss = mergeCss(oldCss, css3);
1976
2019
  logger4.debug("chunk:write", { file, path: fileName });
1977
2020
  return write(paths.chunk, [{ file: fileName, code: newCss }]);
1978
2021
  },
@@ -1992,84 +2035,30 @@ function createContext(conf, io = fileSystem) {
1992
2035
  }
1993
2036
  const files = getFiles();
1994
2037
  logger4.debug("ctx:files", files);
1995
- const tsProject = createProject();
1996
- function addSourceFile(file) {
1997
- tsProject.createSourceFile(file, readFileSync4(file, "utf8"), {
1998
- overwrite: true,
1999
- scriptKind: ScriptKind.TSX
2000
- });
2001
- }
2002
- function reloadSourceFile(file) {
2003
- const sourceFile = tsProject.getSourceFile(file);
2004
- sourceFile?.refreshFromFileSystemSync();
2005
- }
2006
- function reloadSourceFiles() {
2007
- const files2 = getFiles();
2008
- for (const file of files2) {
2009
- const source = tsProject.getSourceFile(file);
2010
- if (source) {
2011
- source.refreshFromFileSystemSync();
2012
- } else {
2013
- tsProject.addSourceFileAtPath(file);
2014
- }
2015
- }
2016
- }
2017
- function getSourceFile(file) {
2018
- return tsProject.getSourceFile(absPath(file));
2019
- }
2020
- function removeSourceFile(file) {
2021
- const sourceFile = tsProject.getSourceFile(absPath(file));
2022
- if (sourceFile) {
2023
- return tsProject.removeSourceFile(sourceFile);
2024
- }
2025
- }
2026
- files.forEach((file) => {
2027
- addSourceFile(file);
2028
- });
2029
2038
  const importMap = {
2030
2039
  css: `${outdir}/css`,
2031
2040
  recipe: `${outdir}/recipes`,
2032
2041
  pattern: `${outdir}/patterns`,
2033
2042
  jsx: `${outdir}/jsx`
2034
2043
  };
2035
- const parseSourceFile = createParser({
2036
- importMap,
2037
- jsx: {
2038
- factory: jsxFactory,
2039
- isStyleProp,
2040
- nodes: [...patternNodes, ...recipeNodes]
2044
+ const project = createProject({
2045
+ getFiles,
2046
+ readFile(filePath) {
2047
+ return readFileSync4(filePath, "utf8");
2048
+ },
2049
+ parserOptions: {
2050
+ importMap,
2051
+ jsx: {
2052
+ factory: jsxFactory,
2053
+ isStyleProp,
2054
+ nodes: [...patternNodes, ...recipeNodes]
2055
+ }
2041
2056
  }
2042
2057
  });
2043
2058
  function getGlobalCss() {
2044
2059
  const sheet = new Stylesheet2(context());
2045
2060
  sheet.processGlobalCss({
2046
- ":root": {
2047
- "--made-with-panda": `'\u{1F43C}'`
2048
- },
2049
- ".panda-layout-grid": {
2050
- display: "grid",
2051
- gap: "var(--gutter)",
2052
- gridTemplateColumns: "repeat(var(--count), 1fr)",
2053
- height: "100%",
2054
- width: "100%",
2055
- position: "absolute",
2056
- inset: "0",
2057
- pointerEvents: "none",
2058
- maxWidth: "var(--max-width)",
2059
- marginInline: "var(--margin-x)",
2060
- paddingInline: "var(--padding-x)"
2061
- },
2062
- ".panda-layout-grid__item": {
2063
- display: "flex",
2064
- "--color": "rgba(255, 0, 0, 0.1)",
2065
- height: "100%",
2066
- "&[data-variant=bg]": {
2067
- background: "var(--color)"
2068
- },
2069
- "&[data-variant=outline]": {
2070
- borderInline: "1px solid var(--color)"
2071
- }
2072
- }
2061
+ ":root": { "--made-with-panda": `'\u{1F43C}'` }
2073
2062
  });
2074
2063
  if (globalCss) {
2075
2064
  sheet.processGlobalCss(globalCss);
@@ -2089,8 +2078,8 @@ function createContext(conf, io = fileSystem) {
2089
2078
  return recipes2[recipe];
2090
2079
  }
2091
2080
  });
2092
- results.css.forEach((css2) => {
2093
- sheet.processAtomic(css2);
2081
+ results.css.forEach((css3) => {
2082
+ sheet.processAtomic(css3);
2094
2083
  });
2095
2084
  results.recipes.forEach((result) => {
2096
2085
  Object.entries(result).forEach(([key, value]) => {
@@ -2112,8 +2101,8 @@ function createContext(conf, io = fileSystem) {
2112
2101
  });
2113
2102
  collector.jsx.forEach((result) => {
2114
2103
  const { data, type, name } = result;
2115
- const { css: css2 = {}, ...rest } = data;
2116
- const styles = { ...css2, ...rest };
2104
+ const { css: css3 = {}, ...rest } = data;
2105
+ const styles = { ...css3, ...rest };
2117
2106
  match5([name, type]).with([P.string, "pattern"], ([name2]) => {
2118
2107
  collector.setPattern(getPatternFnName(name2), { data: styles });
2119
2108
  }).with([P.string, "recipe"], ([name2]) => {
@@ -2146,7 +2135,7 @@ function createContext(conf, io = fileSystem) {
2146
2135
  logger4.error("pattern", error);
2147
2136
  }
2148
2137
  });
2149
- if (collector.isEmpty) {
2138
+ if (collector.isEmpty()) {
2150
2139
  return;
2151
2140
  }
2152
2141
  return {
@@ -2171,12 +2160,8 @@ function createContext(conf, io = fileSystem) {
2171
2160
  exclude,
2172
2161
  conditions,
2173
2162
  importMap,
2174
- reloadSourceFiles,
2175
- getSourceFile,
2176
- addSourceFile,
2177
- reloadSourceFile,
2178
- removeSourceFile,
2179
- parseSourceFile,
2163
+ absPath,
2164
+ project,
2180
2165
  getPath,
2181
2166
  paths,
2182
2167
  write,
@@ -2283,16 +2268,16 @@ var Builder = class {
2283
2268
  fileCssMap = /* @__PURE__ */ new Map();
2284
2269
  context;
2285
2270
  configChanged = true;
2286
- updateFile(file, css2) {
2271
+ updateFile(file, css3) {
2287
2272
  const oldCss = this.fileCssMap?.get(file) ?? "";
2288
- const newCss = mergeCss2(oldCss, css2);
2273
+ const newCss = mergeCss2(oldCss, css3);
2289
2274
  this.fileCssMap?.set(file, newCss);
2290
2275
  }
2291
2276
  async setup() {
2292
2277
  const configHash = getConfigHash();
2293
2278
  const cachedContext = contextCache.get(configHash);
2294
2279
  if (cachedContext) {
2295
- cachedContext.reloadSourceFiles();
2280
+ cachedContext.project.reloadSourceFiles();
2296
2281
  this.context = cachedContext;
2297
2282
  this.fileCssMap = builderCache.get(cachedContext).fileCssMap;
2298
2283
  this.fileModifiedMap = builderCache.get(cachedContext).fileModifiedMap;
@@ -2333,8 +2318,8 @@ var Builder = class {
2333
2318
  toString() {
2334
2319
  const ctx = this.ensure();
2335
2320
  const sheet = new Stylesheet3(ctx.context());
2336
- const css2 = Array.from(this.fileCssMap.values()).join("\n\n");
2337
- sheet.append(css2);
2321
+ const css3 = Array.from(this.fileCssMap.values()).join("\n\n");
2322
+ sheet.append(css3);
2338
2323
  return sheet.toCss({ minify: ctx.minify });
2339
2324
  }
2340
2325
  isValidRoot(root) {
@@ -2424,13 +2409,13 @@ async function createContentWatcher(ctx, callback) {
2424
2409
  watcher.on("all", async (event, file) => {
2425
2410
  logger7.debug(`file:${event}`, file);
2426
2411
  match6(event).with("unlink", () => {
2427
- ctx.removeSourceFile(file);
2412
+ ctx.project.removeSourceFile(ctx.absPath(file));
2428
2413
  ctx.chunks.rm(file);
2429
2414
  }).with("change", async () => {
2430
- ctx.reloadSourceFile(file);
2415
+ ctx.project.reloadSourceFile(file);
2431
2416
  await callback(file);
2432
2417
  }).with("add", async () => {
2433
- ctx.addSourceFile(file);
2418
+ ctx.project.createSourceFile(file);
2434
2419
  await callback(file);
2435
2420
  }).otherwise(() => {
2436
2421
  });
@@ -2489,9 +2474,9 @@ async function generate5(config, configPath) {
2489
2474
  // src/git-ignore.ts
2490
2475
  import { appendFileSync, readFileSync as readFileSync6, writeFileSync } from "fs";
2491
2476
  import { lookItUpSync as lookItUpSync2 } from "look-it-up";
2492
- import outdent25 from "outdent";
2477
+ import outdent26 from "outdent";
2493
2478
  function setupGitIgnore(ctx) {
2494
- const txt = outdent25`## CSS Panda
2479
+ const txt = outdent26`## CSS Panda
2495
2480
  ${ctx.outdir}
2496
2481
  ${ctx.outdir}-static
2497
2482
  `;
@@ -2509,7 +2494,7 @@ function setupGitIgnore(ctx) {
2509
2494
  import { logger as logger9, quote as quote3 } from "@pandacss/logger";
2510
2495
  import { writeFile as writeFile2 } from "fs-extra";
2511
2496
  import { lookItUpSync as lookItUpSync3 } from "look-it-up";
2512
- import { outdent as outdent26 } from "outdent";
2497
+ import { outdent as outdent27 } from "outdent";
2513
2498
  import { join as join3 } from "path";
2514
2499
  import getPackageManager2 from "preferred-pm";
2515
2500
  async function setupConfig(cwd, { force }) {
@@ -2523,7 +2508,7 @@ async function setupConfig(cwd, { force }) {
2523
2508
  if (!force && configFile) {
2524
2509
  logger9.warn("init:config", configExistsMessage(cmd));
2525
2510
  } else {
2526
- const content = outdent26`
2511
+ const content = outdent27`
2527
2512
  import { defineConfig } from "css-panda"
2528
2513
 
2529
2514
  export default defineConfig({
@@ -2549,7 +2534,7 @@ async function setupConfig(cwd, { force }) {
2549
2534
  }
2550
2535
  async function setupPostcss(cwd) {
2551
2536
  logger9.info("init:postcss", `creating postcss config file: ${quote3("postcss.config.cjs")}`);
2552
- const content = outdent26`
2537
+ const content = outdent27`
2553
2538
  module.exports = {
2554
2539
  plugins: {
2555
2540
  'css-panda/postcss': {},