@pandacss/node 0.0.0-dev-20221126164420 → 0.0.0-dev-20221127075519
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 +10 -7
- package/dist/index.js +59 -11
- package/dist/index.mjs +59 -11
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ import * as _pandacss_types_dist_recipe from '@pandacss/types/dist/recipe';
|
|
|
7
7
|
import * as _pandacss_types_dist_system_types from '@pandacss/types/dist/system-types';
|
|
8
8
|
import * as ts_morph from 'ts-morph';
|
|
9
9
|
import * as _pandacss_types from '@pandacss/types';
|
|
10
|
-
import { PatternConfig, RecipeConfig, Config } from '@pandacss/types';
|
|
11
|
-
import * as _pandacss_parser from '@pandacss/parser';
|
|
12
|
-
import { Collector } from '@pandacss/parser';
|
|
10
|
+
import { PatternConfig, RecipeConfig, Dict, Config } from '@pandacss/types';
|
|
13
11
|
import * as _pandacss_config from '@pandacss/config';
|
|
14
12
|
import { LoadConfigResult } from '@pandacss/config';
|
|
13
|
+
import * as _pandacss_parser from '@pandacss/parser';
|
|
14
|
+
import { Collector } from '@pandacss/parser';
|
|
15
15
|
import * as _pandacss_shared from '@pandacss/shared';
|
|
16
16
|
import { mapObject } from '@pandacss/shared';
|
|
17
17
|
import * as _pandacss_token_dictionary from '@pandacss/token-dictionary';
|
|
@@ -92,6 +92,7 @@ declare function createContext(conf: LoadConfigResult, io?: IO): {
|
|
|
92
92
|
getPattern: (name: string) => PatternConfig | undefined;
|
|
93
93
|
execPattern: (name: string, data: Record<string, any>) => _pandacss_types.StyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false>;
|
|
94
94
|
patternNodes: {
|
|
95
|
+
type: "pattern";
|
|
95
96
|
name: string;
|
|
96
97
|
props: string[];
|
|
97
98
|
baseName: string;
|
|
@@ -115,11 +116,10 @@ declare function createContext(conf: LoadConfigResult, io?: IO): {
|
|
|
115
116
|
hash?: boolean | undefined;
|
|
116
117
|
semanticTokens?: _pandacss_types.SemanticTokens<string> | undefined;
|
|
117
118
|
separator?: "-" | "_" | "=" | undefined;
|
|
118
|
-
breakpoints?:
|
|
119
|
+
breakpoints?: Dict<any> | undefined;
|
|
119
120
|
keyframes?: _pandacss_types.CssKeyframes | undefined;
|
|
120
121
|
minify?: boolean | undefined;
|
|
121
122
|
utilities?: _pandacss_types.UtilityConfig | undefined;
|
|
122
|
-
globalCss?: _pandacss_types_dist_system_types.GlobalStyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false> | undefined;
|
|
123
123
|
logLevel?: "debug" | "info" | "warn" | "error" | "silent" | undefined;
|
|
124
124
|
presets?: string[] | undefined;
|
|
125
125
|
preflight?: boolean | undefined;
|
|
@@ -127,6 +127,7 @@ declare function createContext(conf: LoadConfigResult, io?: IO): {
|
|
|
127
127
|
cssVarPrefix?: string | undefined;
|
|
128
128
|
watch?: boolean | undefined;
|
|
129
129
|
poll?: boolean | undefined;
|
|
130
|
+
globalCss?: _pandacss_types_dist_system_types.GlobalStyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false> | undefined;
|
|
130
131
|
textStyles?: _pandacss_types.TextStyles<_pandacss_types_dist_composition.TCondition> | undefined;
|
|
131
132
|
layerStyles?: _pandacss_types.LayerStyles<_pandacss_types_dist_composition.TCondition> | undefined;
|
|
132
133
|
strictTokens?: boolean | undefined;
|
|
@@ -208,6 +209,7 @@ declare class Builder {
|
|
|
208
209
|
getPattern: (name: string) => _pandacss_types.PatternConfig | undefined;
|
|
209
210
|
execPattern: (name: string, data: Record<string, any>) => _pandacss_types.StyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false>;
|
|
210
211
|
patternNodes: {
|
|
212
|
+
type: "pattern";
|
|
211
213
|
name: string;
|
|
212
214
|
props: string[];
|
|
213
215
|
baseName: string;
|
|
@@ -235,7 +237,6 @@ declare class Builder {
|
|
|
235
237
|
keyframes?: _pandacss_types.CssKeyframes | undefined;
|
|
236
238
|
minify?: boolean | undefined;
|
|
237
239
|
utilities?: _pandacss_types.UtilityConfig | undefined;
|
|
238
|
-
globalCss?: _pandacss_types_dist_system_types.GlobalStyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false> | undefined;
|
|
239
240
|
logLevel?: "debug" | "info" | "warn" | "error" | "silent" | undefined;
|
|
240
241
|
presets?: string[] | undefined;
|
|
241
242
|
preflight?: boolean | undefined;
|
|
@@ -243,6 +244,7 @@ declare class Builder {
|
|
|
243
244
|
cssVarPrefix?: string | undefined;
|
|
244
245
|
watch?: boolean | undefined;
|
|
245
246
|
poll?: boolean | undefined;
|
|
247
|
+
globalCss?: _pandacss_types_dist_system_types.GlobalStyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false> | undefined;
|
|
246
248
|
textStyles?: _pandacss_types.TextStyles<_pandacss_types_dist_composition.TCondition> | undefined;
|
|
247
249
|
layerStyles?: _pandacss_types.LayerStyles<_pandacss_types_dist_composition.TCondition> | undefined;
|
|
248
250
|
strictTokens?: boolean | undefined;
|
|
@@ -322,6 +324,7 @@ declare function loadConfigAndCreateContext(options?: {
|
|
|
322
324
|
getPattern: (name: string) => _pandacss_types.PatternConfig | undefined;
|
|
323
325
|
execPattern: (name: string, data: Record<string, any>) => _pandacss_types.StyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false>;
|
|
324
326
|
patternNodes: {
|
|
327
|
+
type: "pattern";
|
|
325
328
|
name: string;
|
|
326
329
|
props: string[];
|
|
327
330
|
baseName: string;
|
|
@@ -349,7 +352,6 @@ declare function loadConfigAndCreateContext(options?: {
|
|
|
349
352
|
keyframes?: _pandacss_types.CssKeyframes | undefined;
|
|
350
353
|
minify?: boolean | undefined;
|
|
351
354
|
utilities?: _pandacss_types.UtilityConfig | undefined;
|
|
352
|
-
globalCss?: _pandacss_types_dist_system_types.GlobalStyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false> | undefined;
|
|
353
355
|
logLevel?: "debug" | "info" | "warn" | "error" | "silent" | undefined;
|
|
354
356
|
presets?: string[] | undefined;
|
|
355
357
|
preflight?: boolean | undefined;
|
|
@@ -357,6 +359,7 @@ declare function loadConfigAndCreateContext(options?: {
|
|
|
357
359
|
cssVarPrefix?: string | undefined;
|
|
358
360
|
watch?: boolean | undefined;
|
|
359
361
|
poll?: boolean | undefined;
|
|
362
|
+
globalCss?: _pandacss_types_dist_system_types.GlobalStyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false> | undefined;
|
|
360
363
|
textStyles?: _pandacss_types.TextStyles<_pandacss_types_dist_composition.TCondition> | undefined;
|
|
361
364
|
layerStyles?: _pandacss_types.LayerStyles<_pandacss_types_dist_composition.TCondition> | undefined;
|
|
362
365
|
strictTokens?: boolean | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1555,6 +1555,16 @@ function scaffoldCompleteMessage() {
|
|
|
1555
1555
|
`\u{1F43C} ${pickRandom(randomWords)}! \u2728`
|
|
1556
1556
|
);
|
|
1557
1557
|
}
|
|
1558
|
+
function watchMessage() {
|
|
1559
|
+
return import_outdent23.outdent`
|
|
1560
|
+
Watching for file changes...
|
|
1561
|
+
`;
|
|
1562
|
+
}
|
|
1563
|
+
function buildCompleteMessage(ctx) {
|
|
1564
|
+
return import_outdent23.outdent`
|
|
1565
|
+
Successfully extracted CSS from ${ctx.files.length} file(s) ✨
|
|
1566
|
+
`;
|
|
1567
|
+
}
|
|
1558
1568
|
|
|
1559
1569
|
// src/artifacts.ts
|
|
1560
1570
|
async function emitArtifacts(ctx) {
|
|
@@ -1588,10 +1598,10 @@ var import_config = require("@pandacss/config");
|
|
|
1588
1598
|
var import_look_it_up2 = require("look-it-up");
|
|
1589
1599
|
|
|
1590
1600
|
// src/context.ts
|
|
1591
|
-
var import_parser = require("@pandacss/parser");
|
|
1592
1601
|
var import_core3 = require("@pandacss/core");
|
|
1593
1602
|
var import_error = require("@pandacss/error");
|
|
1594
1603
|
var import_logger4 = require("@pandacss/logger");
|
|
1604
|
+
var import_parser = require("@pandacss/parser");
|
|
1595
1605
|
var import_shared11 = require("@pandacss/shared");
|
|
1596
1606
|
var import_token_dictionary = require("@pandacss/token-dictionary");
|
|
1597
1607
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
@@ -1600,6 +1610,7 @@ var import_fs_extra2 = require("fs-extra");
|
|
|
1600
1610
|
var import_promises = require("fs/promises");
|
|
1601
1611
|
var import_path3 = require("path");
|
|
1602
1612
|
var import_postcss = __toESM(require("postcss"));
|
|
1613
|
+
var import_ts_pattern6 = require("ts-pattern");
|
|
1603
1614
|
var helpers = {
|
|
1604
1615
|
map: import_shared11.mapObject
|
|
1605
1616
|
};
|
|
@@ -1614,6 +1625,18 @@ var fileSystem = {
|
|
|
1614
1625
|
return (0, import_promises.unlink)(path);
|
|
1615
1626
|
}
|
|
1616
1627
|
};
|
|
1628
|
+
function splitProps(obj, keys) {
|
|
1629
|
+
const omitted = {};
|
|
1630
|
+
const picked = {};
|
|
1631
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1632
|
+
if (keys.includes(key)) {
|
|
1633
|
+
picked[key] = value;
|
|
1634
|
+
} else {
|
|
1635
|
+
omitted[key] = value;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
return [picked, omitted];
|
|
1639
|
+
}
|
|
1617
1640
|
function createContext(conf, io = fileSystem) {
|
|
1618
1641
|
const { config } = conf;
|
|
1619
1642
|
const {
|
|
@@ -1682,6 +1705,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1682
1705
|
return pattern?.transform?.(data, helpers) ?? {};
|
|
1683
1706
|
}
|
|
1684
1707
|
const patternNodes = Object.entries(patterns).map(([name, pattern]) => ({
|
|
1708
|
+
type: "pattern",
|
|
1685
1709
|
name: pattern.jsx ?? (0, import_shared11.capitalize)(name),
|
|
1686
1710
|
props: Object.keys(pattern.properties),
|
|
1687
1711
|
baseName: name
|
|
@@ -1696,6 +1720,21 @@ function createContext(conf, io = fileSystem) {
|
|
|
1696
1720
|
}
|
|
1697
1721
|
return recipe;
|
|
1698
1722
|
}
|
|
1723
|
+
const recipeNodes = Object.entries(recipes).map(([name, recipe]) => ({
|
|
1724
|
+
type: "recipe",
|
|
1725
|
+
name: recipe.jsx ?? (0, import_shared11.capitalize)(name),
|
|
1726
|
+
props: Object.keys(recipe.variants ?? {}),
|
|
1727
|
+
baseName: name
|
|
1728
|
+
}));
|
|
1729
|
+
function getRecipeFnName(jsx) {
|
|
1730
|
+
return recipeNodes.find((node) => node.name === jsx)?.baseName ?? (0, import_shared11.uncapitalize)(jsx);
|
|
1731
|
+
}
|
|
1732
|
+
function splitRecipeProps(name, props) {
|
|
1733
|
+
const recipe = recipeNodes.find((node) => node.name === name);
|
|
1734
|
+
if (!recipe)
|
|
1735
|
+
return [{}, props];
|
|
1736
|
+
return splitProps(props, recipe.props);
|
|
1737
|
+
}
|
|
1699
1738
|
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
1700
1739
|
function isProperty(prop) {
|
|
1701
1740
|
const regex = new RegExp("^(?:" + properties.join("|") + ")$");
|
|
@@ -1783,7 +1822,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1783
1822
|
jsx: {
|
|
1784
1823
|
factory: jsxFactory,
|
|
1785
1824
|
isStyleProp: isProperty,
|
|
1786
|
-
nodes: patternNodes
|
|
1825
|
+
nodes: [...patternNodes, ...recipeNodes]
|
|
1787
1826
|
}
|
|
1788
1827
|
});
|
|
1789
1828
|
function collectStyles(collector, file) {
|
|
@@ -1806,11 +1845,15 @@ function createContext(conf, io = fileSystem) {
|
|
|
1806
1845
|
const { data, type, name } = result;
|
|
1807
1846
|
const { css: css2 = {}, ...rest } = data;
|
|
1808
1847
|
const styles = { ...css2, ...rest };
|
|
1809
|
-
|
|
1810
|
-
collector.setPattern(getPatternFnName(
|
|
1811
|
-
}
|
|
1848
|
+
(0, import_ts_pattern6.match)([name, type]).with([import_ts_pattern6.P.string, "pattern"], ([name2]) => {
|
|
1849
|
+
collector.setPattern(getPatternFnName(name2), { data: styles });
|
|
1850
|
+
}).with([import_ts_pattern6.P.string, "recipe"], ([name2]) => {
|
|
1851
|
+
const [recipeProps, atomicProps] = splitRecipeProps(name2, styles);
|
|
1852
|
+
collector.setRecipe(getRecipeFnName(name2), { data: recipeProps });
|
|
1853
|
+
sheet.processAtomic(atomicProps);
|
|
1854
|
+
}).otherwise(() => {
|
|
1812
1855
|
sheet.processAtomic(styles);
|
|
1813
|
-
}
|
|
1856
|
+
});
|
|
1814
1857
|
});
|
|
1815
1858
|
collector.recipe.forEach((result, name) => {
|
|
1816
1859
|
try {
|
|
@@ -2061,6 +2104,9 @@ async function execCommand(cmd, cwd) {
|
|
|
2061
2104
|
}
|
|
2062
2105
|
}
|
|
2063
2106
|
|
|
2107
|
+
// src/generate.ts
|
|
2108
|
+
var import_logger8 = require("@pandacss/logger");
|
|
2109
|
+
|
|
2064
2110
|
// src/watch.ts
|
|
2065
2111
|
var import_logger7 = require("@pandacss/logger");
|
|
2066
2112
|
var import_chokidar = __toESM(require("chokidar"));
|
|
@@ -2142,6 +2188,7 @@ process.on("uncaughtException", (err) => {
|
|
|
2142
2188
|
async function generate5(config, configPath) {
|
|
2143
2189
|
const ctx = await loadConfigAndCreateContext({ config, configPath });
|
|
2144
2190
|
await emitAndExtract(ctx);
|
|
2191
|
+
import_logger8.logger.info(buildCompleteMessage(ctx));
|
|
2145
2192
|
if (ctx.watch) {
|
|
2146
2193
|
process.stdin.on("end", () => process.exit());
|
|
2147
2194
|
await watch(ctx, {
|
|
@@ -2155,11 +2202,12 @@ async function generate5(config, configPath) {
|
|
|
2155
2202
|
return writeFileChunk(ctx, file);
|
|
2156
2203
|
}
|
|
2157
2204
|
});
|
|
2205
|
+
import_logger8.logger.info(watchMessage());
|
|
2158
2206
|
}
|
|
2159
2207
|
}
|
|
2160
2208
|
|
|
2161
2209
|
// src/scaffold.ts
|
|
2162
|
-
var
|
|
2210
|
+
var import_logger9 = require("@pandacss/logger");
|
|
2163
2211
|
var import_fs_extra4 = require("fs-extra");
|
|
2164
2212
|
var import_look_it_up3 = require("look-it-up");
|
|
2165
2213
|
var import_outdent24 = require("outdent");
|
|
@@ -2172,9 +2220,9 @@ async function setupConfig(cwd, { force }) {
|
|
|
2172
2220
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2173
2221
|
const isTs = (0, import_look_it_up3.lookItUpSync)("tsconfig.json", cwd);
|
|
2174
2222
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2175
|
-
|
|
2223
|
+
import_logger9.logger.info({ type: "init", msg: `creating panda config file: ${(0, import_logger9.quote)(file)}` });
|
|
2176
2224
|
if (!force && configFile) {
|
|
2177
|
-
|
|
2225
|
+
import_logger9.logger.warn("config exists", configExistsMessage(cmd));
|
|
2178
2226
|
} else {
|
|
2179
2227
|
const content = import_outdent24.outdent`
|
|
2180
2228
|
import { defineConfig } from "css-panda"
|
|
@@ -2197,11 +2245,11 @@ async function setupConfig(cwd, { force }) {
|
|
|
2197
2245
|
})
|
|
2198
2246
|
`;
|
|
2199
2247
|
await (0, import_fs_extra4.writeFile)((0, import_path7.join)(cwd, file), content);
|
|
2200
|
-
|
|
2248
|
+
import_logger9.logger.log(thankYouMessage());
|
|
2201
2249
|
}
|
|
2202
2250
|
}
|
|
2203
2251
|
async function setupPostcss(cwd) {
|
|
2204
|
-
|
|
2252
|
+
import_logger9.logger.info({ type: "init", msg: `creating postcss config file: ${(0, import_logger9.quote)("postcss.config.cjs")}` });
|
|
2205
2253
|
const content = import_outdent24.outdent`
|
|
2206
2254
|
module.exports = {
|
|
2207
2255
|
plugins: {
|
package/dist/index.mjs
CHANGED
|
@@ -1510,6 +1510,16 @@ function scaffoldCompleteMessage() {
|
|
|
1510
1510
|
`\u{1F43C} ${pickRandom(randomWords)}! \u2728`
|
|
1511
1511
|
);
|
|
1512
1512
|
}
|
|
1513
|
+
function watchMessage() {
|
|
1514
|
+
return outdent23`
|
|
1515
|
+
Watching for file changes...
|
|
1516
|
+
`;
|
|
1517
|
+
}
|
|
1518
|
+
function buildCompleteMessage(ctx) {
|
|
1519
|
+
return outdent23`
|
|
1520
|
+
Successfully extracted CSS from ${ctx.files.length} file(s) ✨
|
|
1521
|
+
`;
|
|
1522
|
+
}
|
|
1513
1523
|
|
|
1514
1524
|
// src/artifacts.ts
|
|
1515
1525
|
async function emitArtifacts(ctx) {
|
|
@@ -1543,7 +1553,6 @@ import { loadConfigFile } from "@pandacss/config";
|
|
|
1543
1553
|
import { lookItUpSync as lookItUpSync2 } from "look-it-up";
|
|
1544
1554
|
|
|
1545
1555
|
// src/context.ts
|
|
1546
|
-
import { createParser, createProject } from "@pandacss/parser";
|
|
1547
1556
|
import {
|
|
1548
1557
|
assignCompositions,
|
|
1549
1558
|
Conditions,
|
|
@@ -1553,6 +1562,7 @@ import {
|
|
|
1553
1562
|
} from "@pandacss/core";
|
|
1554
1563
|
import { NotFoundError } from "@pandacss/error";
|
|
1555
1564
|
import { logger as logger4 } from "@pandacss/logger";
|
|
1565
|
+
import { createParser, createProject } from "@pandacss/parser";
|
|
1556
1566
|
import { capitalize as capitalize10, compact, mapObject, uncapitalize } from "@pandacss/shared";
|
|
1557
1567
|
import { TokenDictionary } from "@pandacss/token-dictionary";
|
|
1558
1568
|
import glob from "fast-glob";
|
|
@@ -1561,6 +1571,7 @@ import { emptyDir, ensureDir, existsSync } from "fs-extra";
|
|
|
1561
1571
|
import { readFile, unlink, writeFile } from "fs/promises";
|
|
1562
1572
|
import { extname, isAbsolute, join as join2, relative, resolve, sep } from "path";
|
|
1563
1573
|
import postcss from "postcss";
|
|
1574
|
+
import { match as match6, P } from "ts-pattern";
|
|
1564
1575
|
var helpers = {
|
|
1565
1576
|
map: mapObject
|
|
1566
1577
|
};
|
|
@@ -1575,6 +1586,18 @@ var fileSystem = {
|
|
|
1575
1586
|
return unlink(path);
|
|
1576
1587
|
}
|
|
1577
1588
|
};
|
|
1589
|
+
function splitProps(obj, keys) {
|
|
1590
|
+
const omitted = {};
|
|
1591
|
+
const picked = {};
|
|
1592
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1593
|
+
if (keys.includes(key)) {
|
|
1594
|
+
picked[key] = value;
|
|
1595
|
+
} else {
|
|
1596
|
+
omitted[key] = value;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
return [picked, omitted];
|
|
1600
|
+
}
|
|
1578
1601
|
function createContext(conf, io = fileSystem) {
|
|
1579
1602
|
const { config } = conf;
|
|
1580
1603
|
const {
|
|
@@ -1643,6 +1666,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1643
1666
|
return pattern?.transform?.(data, helpers) ?? {};
|
|
1644
1667
|
}
|
|
1645
1668
|
const patternNodes = Object.entries(patterns).map(([name, pattern]) => ({
|
|
1669
|
+
type: "pattern",
|
|
1646
1670
|
name: pattern.jsx ?? capitalize10(name),
|
|
1647
1671
|
props: Object.keys(pattern.properties),
|
|
1648
1672
|
baseName: name
|
|
@@ -1657,6 +1681,21 @@ function createContext(conf, io = fileSystem) {
|
|
|
1657
1681
|
}
|
|
1658
1682
|
return recipe;
|
|
1659
1683
|
}
|
|
1684
|
+
const recipeNodes = Object.entries(recipes).map(([name, recipe]) => ({
|
|
1685
|
+
type: "recipe",
|
|
1686
|
+
name: recipe.jsx ?? capitalize10(name),
|
|
1687
|
+
props: Object.keys(recipe.variants ?? {}),
|
|
1688
|
+
baseName: name
|
|
1689
|
+
}));
|
|
1690
|
+
function getRecipeFnName(jsx) {
|
|
1691
|
+
return recipeNodes.find((node) => node.name === jsx)?.baseName ?? uncapitalize(jsx);
|
|
1692
|
+
}
|
|
1693
|
+
function splitRecipeProps(name, props) {
|
|
1694
|
+
const recipe = recipeNodes.find((node) => node.name === name);
|
|
1695
|
+
if (!recipe)
|
|
1696
|
+
return [{}, props];
|
|
1697
|
+
return splitProps(props, recipe.props);
|
|
1698
|
+
}
|
|
1660
1699
|
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
1661
1700
|
function isProperty(prop) {
|
|
1662
1701
|
const regex = new RegExp("^(?:" + properties.join("|") + ")$");
|
|
@@ -1744,7 +1783,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1744
1783
|
jsx: {
|
|
1745
1784
|
factory: jsxFactory,
|
|
1746
1785
|
isStyleProp: isProperty,
|
|
1747
|
-
nodes: patternNodes
|
|
1786
|
+
nodes: [...patternNodes, ...recipeNodes]
|
|
1748
1787
|
}
|
|
1749
1788
|
});
|
|
1750
1789
|
function collectStyles(collector, file) {
|
|
@@ -1767,11 +1806,15 @@ function createContext(conf, io = fileSystem) {
|
|
|
1767
1806
|
const { data, type, name } = result;
|
|
1768
1807
|
const { css: css2 = {}, ...rest } = data;
|
|
1769
1808
|
const styles = { ...css2, ...rest };
|
|
1770
|
-
|
|
1771
|
-
collector.setPattern(getPatternFnName(
|
|
1772
|
-
}
|
|
1809
|
+
match6([name, type]).with([P.string, "pattern"], ([name2]) => {
|
|
1810
|
+
collector.setPattern(getPatternFnName(name2), { data: styles });
|
|
1811
|
+
}).with([P.string, "recipe"], ([name2]) => {
|
|
1812
|
+
const [recipeProps, atomicProps] = splitRecipeProps(name2, styles);
|
|
1813
|
+
collector.setRecipe(getRecipeFnName(name2), { data: recipeProps });
|
|
1814
|
+
sheet.processAtomic(atomicProps);
|
|
1815
|
+
}).otherwise(() => {
|
|
1773
1816
|
sheet.processAtomic(styles);
|
|
1774
|
-
}
|
|
1817
|
+
});
|
|
1775
1818
|
});
|
|
1776
1819
|
collector.recipe.forEach((result, name) => {
|
|
1777
1820
|
try {
|
|
@@ -2022,6 +2065,9 @@ async function execCommand(cmd, cwd) {
|
|
|
2022
2065
|
}
|
|
2023
2066
|
}
|
|
2024
2067
|
|
|
2068
|
+
// src/generate.ts
|
|
2069
|
+
import { logger as logger8 } from "@pandacss/logger";
|
|
2070
|
+
|
|
2025
2071
|
// src/watch.ts
|
|
2026
2072
|
import { logger as logger7 } from "@pandacss/logger";
|
|
2027
2073
|
import chokidar from "chokidar";
|
|
@@ -2103,6 +2149,7 @@ process.on("uncaughtException", (err) => {
|
|
|
2103
2149
|
async function generate5(config, configPath) {
|
|
2104
2150
|
const ctx = await loadConfigAndCreateContext({ config, configPath });
|
|
2105
2151
|
await emitAndExtract(ctx);
|
|
2152
|
+
logger8.info(buildCompleteMessage(ctx));
|
|
2106
2153
|
if (ctx.watch) {
|
|
2107
2154
|
process.stdin.on("end", () => process.exit());
|
|
2108
2155
|
await watch(ctx, {
|
|
@@ -2116,11 +2163,12 @@ async function generate5(config, configPath) {
|
|
|
2116
2163
|
return writeFileChunk(ctx, file);
|
|
2117
2164
|
}
|
|
2118
2165
|
});
|
|
2166
|
+
logger8.info(watchMessage());
|
|
2119
2167
|
}
|
|
2120
2168
|
}
|
|
2121
2169
|
|
|
2122
2170
|
// src/scaffold.ts
|
|
2123
|
-
import { logger as
|
|
2171
|
+
import { logger as logger9, quote as quote3 } from "@pandacss/logger";
|
|
2124
2172
|
import { writeFile as writeFile2 } from "fs-extra";
|
|
2125
2173
|
import { lookItUpSync as lookItUpSync3 } from "look-it-up";
|
|
2126
2174
|
import { outdent as outdent24 } from "outdent";
|
|
@@ -2133,9 +2181,9 @@ async function setupConfig(cwd, { force }) {
|
|
|
2133
2181
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2134
2182
|
const isTs = lookItUpSync3("tsconfig.json", cwd);
|
|
2135
2183
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2136
|
-
|
|
2184
|
+
logger9.info({ type: "init", msg: `creating panda config file: ${quote3(file)}` });
|
|
2137
2185
|
if (!force && configFile) {
|
|
2138
|
-
|
|
2186
|
+
logger9.warn("config exists", configExistsMessage(cmd));
|
|
2139
2187
|
} else {
|
|
2140
2188
|
const content = outdent24`
|
|
2141
2189
|
import { defineConfig } from "css-panda"
|
|
@@ -2158,11 +2206,11 @@ async function setupConfig(cwd, { force }) {
|
|
|
2158
2206
|
})
|
|
2159
2207
|
`;
|
|
2160
2208
|
await writeFile2(join4(cwd, file), content);
|
|
2161
|
-
|
|
2209
|
+
logger9.log(thankYouMessage());
|
|
2162
2210
|
}
|
|
2163
2211
|
}
|
|
2164
2212
|
async function setupPostcss(cwd) {
|
|
2165
|
-
|
|
2213
|
+
logger9.info({ type: "init", msg: `creating postcss config file: ${quote3("postcss.config.cjs")}` });
|
|
2166
2214
|
const content = outdent24`
|
|
2167
2215
|
module.exports = {
|
|
2168
2216
|
plugins: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20221127075519",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"telejson": "6.0.8",
|
|
31
31
|
"ts-pattern": "4.0.6",
|
|
32
32
|
"ts-morph": "17.0.1",
|
|
33
|
-
"@pandacss/types": "0.0.0-dev-
|
|
34
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
35
|
-
"@pandacss/error": "0.0.0-dev-
|
|
36
|
-
"@pandacss/parser": "0.0.0-dev-
|
|
37
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
38
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
39
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
40
|
-
"@pandacss/core": "0.0.0-dev-
|
|
41
|
-
"@pandacss/config": "0.0.0-dev-
|
|
33
|
+
"@pandacss/types": "0.0.0-dev-20221127075519",
|
|
34
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20221127075519",
|
|
35
|
+
"@pandacss/error": "0.0.0-dev-20221127075519",
|
|
36
|
+
"@pandacss/parser": "0.0.0-dev-20221127075519",
|
|
37
|
+
"@pandacss/shared": "0.0.0-dev-20221127075519",
|
|
38
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20221127075519",
|
|
39
|
+
"@pandacss/logger": "0.0.0-dev-20221127075519",
|
|
40
|
+
"@pandacss/core": "0.0.0-dev-20221127075519",
|
|
41
|
+
"@pandacss/config": "0.0.0-dev-20221127075519"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/fs-extra": "9.0.13",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/glob-parent": "^5.1.1",
|
|
47
47
|
"@types/pluralize": "0.0.29",
|
|
48
48
|
"@types/lodash.merge": "4.6.7",
|
|
49
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
49
|
+
"@pandacss/fixture": "0.0.0-dev-20221127075519"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|