@pandacss/node 0.0.0-dev-20221126165718 → 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 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?: _pandacss_types.Dict<any> | undefined;
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
@@ -1598,10 +1598,10 @@ var import_config = require("@pandacss/config");
1598
1598
  var import_look_it_up2 = require("look-it-up");
1599
1599
 
1600
1600
  // src/context.ts
1601
- var import_parser = require("@pandacss/parser");
1602
1601
  var import_core3 = require("@pandacss/core");
1603
1602
  var import_error = require("@pandacss/error");
1604
1603
  var import_logger4 = require("@pandacss/logger");
1604
+ var import_parser = require("@pandacss/parser");
1605
1605
  var import_shared11 = require("@pandacss/shared");
1606
1606
  var import_token_dictionary = require("@pandacss/token-dictionary");
1607
1607
  var import_fast_glob = __toESM(require("fast-glob"));
@@ -1610,6 +1610,7 @@ var import_fs_extra2 = require("fs-extra");
1610
1610
  var import_promises = require("fs/promises");
1611
1611
  var import_path3 = require("path");
1612
1612
  var import_postcss = __toESM(require("postcss"));
1613
+ var import_ts_pattern6 = require("ts-pattern");
1613
1614
  var helpers = {
1614
1615
  map: import_shared11.mapObject
1615
1616
  };
@@ -1624,6 +1625,18 @@ var fileSystem = {
1624
1625
  return (0, import_promises.unlink)(path);
1625
1626
  }
1626
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
+ }
1627
1640
  function createContext(conf, io = fileSystem) {
1628
1641
  const { config } = conf;
1629
1642
  const {
@@ -1692,6 +1705,7 @@ function createContext(conf, io = fileSystem) {
1692
1705
  return pattern?.transform?.(data, helpers) ?? {};
1693
1706
  }
1694
1707
  const patternNodes = Object.entries(patterns).map(([name, pattern]) => ({
1708
+ type: "pattern",
1695
1709
  name: pattern.jsx ?? (0, import_shared11.capitalize)(name),
1696
1710
  props: Object.keys(pattern.properties),
1697
1711
  baseName: name
@@ -1706,6 +1720,21 @@ function createContext(conf, io = fileSystem) {
1706
1720
  }
1707
1721
  return recipe;
1708
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
+ }
1709
1738
  const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
1710
1739
  function isProperty(prop) {
1711
1740
  const regex = new RegExp("^(?:" + properties.join("|") + ")$");
@@ -1793,7 +1822,7 @@ function createContext(conf, io = fileSystem) {
1793
1822
  jsx: {
1794
1823
  factory: jsxFactory,
1795
1824
  isStyleProp: isProperty,
1796
- nodes: patternNodes
1825
+ nodes: [...patternNodes, ...recipeNodes]
1797
1826
  }
1798
1827
  });
1799
1828
  function collectStyles(collector, file) {
@@ -1816,11 +1845,15 @@ function createContext(conf, io = fileSystem) {
1816
1845
  const { data, type, name } = result;
1817
1846
  const { css: css2 = {}, ...rest } = data;
1818
1847
  const styles = { ...css2, ...rest };
1819
- if (name && type === "pattern") {
1820
- collector.setPattern(getPatternFnName(name), { data: styles });
1821
- } else {
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(() => {
1822
1855
  sheet.processAtomic(styles);
1823
- }
1856
+ });
1824
1857
  });
1825
1858
  collector.recipe.forEach((result, name) => {
1826
1859
  try {
package/dist/index.mjs CHANGED
@@ -1553,7 +1553,6 @@ import { loadConfigFile } from "@pandacss/config";
1553
1553
  import { lookItUpSync as lookItUpSync2 } from "look-it-up";
1554
1554
 
1555
1555
  // src/context.ts
1556
- import { createParser, createProject } from "@pandacss/parser";
1557
1556
  import {
1558
1557
  assignCompositions,
1559
1558
  Conditions,
@@ -1563,6 +1562,7 @@ import {
1563
1562
  } from "@pandacss/core";
1564
1563
  import { NotFoundError } from "@pandacss/error";
1565
1564
  import { logger as logger4 } from "@pandacss/logger";
1565
+ import { createParser, createProject } from "@pandacss/parser";
1566
1566
  import { capitalize as capitalize10, compact, mapObject, uncapitalize } from "@pandacss/shared";
1567
1567
  import { TokenDictionary } from "@pandacss/token-dictionary";
1568
1568
  import glob from "fast-glob";
@@ -1571,6 +1571,7 @@ import { emptyDir, ensureDir, existsSync } from "fs-extra";
1571
1571
  import { readFile, unlink, writeFile } from "fs/promises";
1572
1572
  import { extname, isAbsolute, join as join2, relative, resolve, sep } from "path";
1573
1573
  import postcss from "postcss";
1574
+ import { match as match6, P } from "ts-pattern";
1574
1575
  var helpers = {
1575
1576
  map: mapObject
1576
1577
  };
@@ -1585,6 +1586,18 @@ var fileSystem = {
1585
1586
  return unlink(path);
1586
1587
  }
1587
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
+ }
1588
1601
  function createContext(conf, io = fileSystem) {
1589
1602
  const { config } = conf;
1590
1603
  const {
@@ -1653,6 +1666,7 @@ function createContext(conf, io = fileSystem) {
1653
1666
  return pattern?.transform?.(data, helpers) ?? {};
1654
1667
  }
1655
1668
  const patternNodes = Object.entries(patterns).map(([name, pattern]) => ({
1669
+ type: "pattern",
1656
1670
  name: pattern.jsx ?? capitalize10(name),
1657
1671
  props: Object.keys(pattern.properties),
1658
1672
  baseName: name
@@ -1667,6 +1681,21 @@ function createContext(conf, io = fileSystem) {
1667
1681
  }
1668
1682
  return recipe;
1669
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
+ }
1670
1699
  const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
1671
1700
  function isProperty(prop) {
1672
1701
  const regex = new RegExp("^(?:" + properties.join("|") + ")$");
@@ -1754,7 +1783,7 @@ function createContext(conf, io = fileSystem) {
1754
1783
  jsx: {
1755
1784
  factory: jsxFactory,
1756
1785
  isStyleProp: isProperty,
1757
- nodes: patternNodes
1786
+ nodes: [...patternNodes, ...recipeNodes]
1758
1787
  }
1759
1788
  });
1760
1789
  function collectStyles(collector, file) {
@@ -1777,11 +1806,15 @@ function createContext(conf, io = fileSystem) {
1777
1806
  const { data, type, name } = result;
1778
1807
  const { css: css2 = {}, ...rest } = data;
1779
1808
  const styles = { ...css2, ...rest };
1780
- if (name && type === "pattern") {
1781
- collector.setPattern(getPatternFnName(name), { data: styles });
1782
- } else {
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(() => {
1783
1816
  sheet.processAtomic(styles);
1784
- }
1817
+ });
1785
1818
  });
1786
1819
  collector.recipe.forEach((result, name) => {
1787
1820
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.0.0-dev-20221126165718",
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-20221126165718",
34
- "@pandacss/is-valid-prop": "0.0.0-dev-20221126165718",
35
- "@pandacss/error": "0.0.0-dev-20221126165718",
36
- "@pandacss/parser": "0.0.0-dev-20221126165718",
37
- "@pandacss/shared": "0.0.0-dev-20221126165718",
38
- "@pandacss/token-dictionary": "0.0.0-dev-20221126165718",
39
- "@pandacss/logger": "0.0.0-dev-20221126165718",
40
- "@pandacss/core": "0.0.0-dev-20221126165718",
41
- "@pandacss/config": "0.0.0-dev-20221126165718"
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-20221126165718"
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",