@pandacss/node 0.0.0-dev-20221126091729 → 0.0.0-dev-20221126123927

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.
Files changed (3) hide show
  1. package/dist/index.js +30 -19
  2. package/dist/index.mjs +30 -19
  3. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -160,7 +160,7 @@ function generateConditions(ctx) {
160
160
  var import_outdent2 = require("outdent");
161
161
  var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
162
162
  function generateCssFn(ctx) {
163
- const { utility, hash } = ctx;
163
+ const { utility, hash, conditions } = ctx;
164
164
  const { separator } = utility;
165
165
  return {
166
166
  dts: import_outdent2.outdent`
@@ -172,7 +172,10 @@ function generateCssFn(ctx) {
172
172
  import { sortConditions, finalizeConditions } from "./conditions"
173
173
 
174
174
  const classNameMap = ${stringify(utility.entries())}
175
+
175
176
  const shorthands = ${stringify(utility.shorthands)}
177
+
178
+ const breakpointKeys = ${JSON.stringify(conditions.breakpoints.keys)}
176
179
 
177
180
  const hasShorthand = ${utility.hasShorthand ? "true" : "false"}
178
181
 
@@ -186,11 +189,17 @@ function generateCssFn(ctx) {
186
189
  }
187
190
 
188
191
  const context = {
189
- transform,
190
- conditions: { shift: sortConditions, finalize: finalizeConditions },
191
192
  hash: ${hash ? "true" : "false"},
192
- hasShorthand,
193
- resolveShorthand,
193
+ conditions: {
194
+ shift: sortConditions,
195
+ finalize: finalizeConditions,
196
+ breakpoints: { keys: breakpointKeys }
197
+ },
198
+ utility: {
199
+ transform,
200
+ hasShorthand,
201
+ resolveShorthand,
202
+ }
194
203
  }
195
204
 
196
205
  export const css = createCss(context)
@@ -976,8 +985,8 @@ function generateRecipes(ctx) {
976
985
  import_outdent17.outdent`
977
986
  import { createCss, withoutSpace } from "../helpers"
978
987
 
979
- const createRecipe = (name) => {
980
- return (styles) => {
988
+ const createRecipe = (name, defaultVariants) => {
989
+ return (variants) => {
981
990
  const transform = (prop, value) => {
982
991
  if (value === '__ignore__') {
983
992
  return { className: name }
@@ -987,10 +996,20 @@ function generateRecipes(ctx) {
987
996
  return { className: \`\${name}--\${prop}${separator}\${value}\` }
988
997
  }
989
998
 
990
- const context = ${hash ? "{ transform, hash: true }" : "{ transform }"}
999
+ const context = {
1000
+ hash: ${hash ? "true" : "false"},
1001
+ utility: {
1002
+ transform,
1003
+ }
1004
+ }
1005
+
991
1006
  const css = createCss(context)
992
1007
 
993
- return css({ [name]: '__ignore__' , ...styles })
1008
+ return css({
1009
+ [name]: '__ignore__',
1010
+ ...defaultVariants,
1011
+ ...variants
1012
+ })
994
1013
  }
995
1014
  }
996
1015
  `
@@ -998,7 +1017,7 @@ function generateRecipes(ctx) {
998
1017
  const dts = [""];
999
1018
  Object.values(recipes).forEach((recipe) => {
1000
1019
  js.push(import_outdent17.outdent`
1001
- export const ${recipe.name} = createRecipe('${recipe.name}')
1020
+ export const ${recipe.name} = createRecipe('${recipe.name}', ${JSON.stringify(recipe.defaultVariants ?? {})})
1002
1021
  `);
1003
1022
  dts.push(import_outdent17.outdent`
1004
1023
  import { ConditionalValue } from "../types"
@@ -1645,18 +1664,10 @@ function createContext(conf, io = fileSystem) {
1645
1664
  );
1646
1665
  const context = () => ({
1647
1666
  root: import_postcss.default.root(),
1648
- breakpoints,
1649
1667
  conditions,
1650
1668
  hash,
1651
1669
  helpers,
1652
- utility,
1653
- hasShorthand: utility.hasShorthand,
1654
- resolveShorthand(prop) {
1655
- return utility.resolveShorthand(prop);
1656
- },
1657
- transform(prop, value) {
1658
- return utility.resolve(prop, value);
1659
- }
1670
+ utility
1660
1671
  });
1661
1672
  const patternExclude = ["layoutGrid"];
1662
1673
  function getPattern(name) {
package/dist/index.mjs CHANGED
@@ -115,7 +115,7 @@ function generateConditions(ctx) {
115
115
  import { outdent as outdent2 } from "outdent";
116
116
  var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
117
117
  function generateCssFn(ctx) {
118
- const { utility, hash } = ctx;
118
+ const { utility, hash, conditions } = ctx;
119
119
  const { separator } = utility;
120
120
  return {
121
121
  dts: outdent2`
@@ -127,7 +127,10 @@ function generateCssFn(ctx) {
127
127
  import { sortConditions, finalizeConditions } from "./conditions"
128
128
 
129
129
  const classNameMap = ${stringify(utility.entries())}
130
+
130
131
  const shorthands = ${stringify(utility.shorthands)}
132
+
133
+ const breakpointKeys = ${JSON.stringify(conditions.breakpoints.keys)}
131
134
 
132
135
  const hasShorthand = ${utility.hasShorthand ? "true" : "false"}
133
136
 
@@ -141,11 +144,17 @@ function generateCssFn(ctx) {
141
144
  }
142
145
 
143
146
  const context = {
144
- transform,
145
- conditions: { shift: sortConditions, finalize: finalizeConditions },
146
147
  hash: ${hash ? "true" : "false"},
147
- hasShorthand,
148
- resolveShorthand,
148
+ conditions: {
149
+ shift: sortConditions,
150
+ finalize: finalizeConditions,
151
+ breakpoints: { keys: breakpointKeys }
152
+ },
153
+ utility: {
154
+ transform,
155
+ hasShorthand,
156
+ resolveShorthand,
157
+ }
149
158
  }
150
159
 
151
160
  export const css = createCss(context)
@@ -931,8 +940,8 @@ function generateRecipes(ctx) {
931
940
  outdent17`
932
941
  import { createCss, withoutSpace } from "../helpers"
933
942
 
934
- const createRecipe = (name) => {
935
- return (styles) => {
943
+ const createRecipe = (name, defaultVariants) => {
944
+ return (variants) => {
936
945
  const transform = (prop, value) => {
937
946
  if (value === '__ignore__') {
938
947
  return { className: name }
@@ -942,10 +951,20 @@ function generateRecipes(ctx) {
942
951
  return { className: \`\${name}--\${prop}${separator}\${value}\` }
943
952
  }
944
953
 
945
- const context = ${hash ? "{ transform, hash: true }" : "{ transform }"}
954
+ const context = {
955
+ hash: ${hash ? "true" : "false"},
956
+ utility: {
957
+ transform,
958
+ }
959
+ }
960
+
946
961
  const css = createCss(context)
947
962
 
948
- return css({ [name]: '__ignore__' , ...styles })
963
+ return css({
964
+ [name]: '__ignore__',
965
+ ...defaultVariants,
966
+ ...variants
967
+ })
949
968
  }
950
969
  }
951
970
  `
@@ -953,7 +972,7 @@ function generateRecipes(ctx) {
953
972
  const dts = [""];
954
973
  Object.values(recipes).forEach((recipe) => {
955
974
  js.push(outdent17`
956
- export const ${recipe.name} = createRecipe('${recipe.name}')
975
+ export const ${recipe.name} = createRecipe('${recipe.name}', ${JSON.stringify(recipe.defaultVariants ?? {})})
957
976
  `);
958
977
  dts.push(outdent17`
959
978
  import { ConditionalValue } from "../types"
@@ -1606,18 +1625,10 @@ function createContext(conf, io = fileSystem) {
1606
1625
  );
1607
1626
  const context = () => ({
1608
1627
  root: postcss.root(),
1609
- breakpoints,
1610
1628
  conditions,
1611
1629
  hash,
1612
1630
  helpers,
1613
- utility,
1614
- hasShorthand: utility.hasShorthand,
1615
- resolveShorthand(prop) {
1616
- return utility.resolveShorthand(prop);
1617
- },
1618
- transform(prop, value) {
1619
- return utility.resolve(prop, value);
1620
- }
1631
+ utility
1621
1632
  });
1622
1633
  const patternExclude = ["layoutGrid"];
1623
1634
  function getPattern(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.0.0-dev-20221126091729",
3
+ "version": "0.0.0-dev-20221126123927",
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-20221126091729",
34
- "@pandacss/is-valid-prop": "0.0.0-dev-20221126091729",
35
- "@pandacss/error": "0.0.0-dev-20221126091729",
36
- "@pandacss/parser": "0.0.0-dev-20221126091729",
37
- "@pandacss/shared": "0.0.0-dev-20221126091729",
38
- "@pandacss/token-dictionary": "0.0.0-dev-20221126091729",
39
- "@pandacss/logger": "0.0.0-dev-20221126091729",
40
- "@pandacss/core": "0.0.0-dev-20221126091729",
41
- "@pandacss/config": "0.0.0-dev-20221126091729"
33
+ "@pandacss/types": "0.0.0-dev-20221126123927",
34
+ "@pandacss/is-valid-prop": "0.0.0-dev-20221126123927",
35
+ "@pandacss/error": "0.0.0-dev-20221126123927",
36
+ "@pandacss/parser": "0.0.0-dev-20221126123927",
37
+ "@pandacss/shared": "0.0.0-dev-20221126123927",
38
+ "@pandacss/token-dictionary": "0.0.0-dev-20221126123927",
39
+ "@pandacss/logger": "0.0.0-dev-20221126123927",
40
+ "@pandacss/core": "0.0.0-dev-20221126123927",
41
+ "@pandacss/config": "0.0.0-dev-20221126123927"
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-20221126091729"
49
+ "@pandacss/fixture": "0.0.0-dev-20221126123927"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",