@pandacss/generator 0.0.0-dev-20240315222821 → 0.0.0-dev-20240319203029

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 CHANGED
@@ -3676,7 +3676,7 @@ function generateStyleProps(ctx) {
3676
3676
  ${ctx.file.importType("Token", "../tokens/index")}
3677
3677
 
3678
3678
  type AnyString = (string & {})
3679
- ${cssVars ? `type CssVars = ${cssVars}` : ""}
3679
+ type CssVars = ${[cssVars || "`var(--${string})`"].filter(Boolean).join(" | ")}
3680
3680
  type CssVarValue = ConditionalValue<Token${ctx.globalVars.isEmpty() ? "" : " | CssVars"} | AnyString | (number & {})>
3681
3681
 
3682
3682
  type CssVarName = ${(0, import_shared3.unionType)(ctx.globalVars.names)} | AnyString
@@ -3691,19 +3691,22 @@ function generateStyleProps(ctx) {
3691
3691
  const prop = ctx.utility.shorthands.get(key) ?? key;
3692
3692
  const union = [];
3693
3693
  const cssFallback = import_is_valid_prop.allCssProperties.includes(prop) ? `CssProperties["${prop}"]` : "";
3694
- if (!propTypes.has(prop))
3695
- union.push(cssFallback);
3696
- else {
3697
- union.push(
3698
- strictPropertyValue(prop, `UtilityValues["${prop}"]`, ctx.config.strictTokens ? "" : cssFallback)
3699
- );
3694
+ if (propTypes.has(prop)) {
3695
+ const utilityValue = `UtilityValues["${prop}"]`;
3696
+ if (strictPropertyList.has(key)) {
3697
+ union.push([utilityValue, "CssVars"].join(" | "));
3698
+ } else {
3699
+ union.push([utilityValue, ctx.config.strictTokens ? "" : cssFallback].filter(Boolean).join(" | "));
3700
+ }
3701
+ } else {
3702
+ union.push([strictPropertyList.has(key) ? "CssVars" : "", cssFallback].filter(Boolean).join(" | "));
3700
3703
  }
3701
3704
  const filtered = union.filter(Boolean);
3702
3705
  if (!filtered.length) {
3703
3706
  filtered.push("string | number");
3704
3707
  }
3705
3708
  const comment = csstype_d_ts_default.comments?.[prop] || "";
3706
- const value = filtered.concat(ctx.globalVars.isEmpty() ? "" : "CssVars").filter(Boolean).join(" | ");
3709
+ const value = filtered.filter(Boolean).join(" | ");
3707
3710
  const line = `${key}?: ${restrict(prop, value, ctx.config)}`;
3708
3711
  return " " + [comment, line].filter(Boolean).join("\n");
3709
3712
  }).join("\n")}
@@ -3774,7 +3777,6 @@ var strictPropertyList = /* @__PURE__ */ new Set([
3774
3777
  "wordBreak",
3775
3778
  "writingMode"
3776
3779
  ]);
3777
- var strictPropertyValue = (key, value, fallback) => strictPropertyList.has(key) ? value : [value, fallback].filter(Boolean).join(" | ");
3778
3780
  var restrict = (key, value, config) => {
3779
3781
  if (config.strictPropertyValues && strictPropertyList.has(key)) {
3780
3782
  return `ConditionalValue<WithEscapeHatch<OnlyKnown<"${key}", ${value}>>>`;
package/dist/index.mjs CHANGED
@@ -3640,7 +3640,7 @@ function generateStyleProps(ctx) {
3640
3640
  ${ctx.file.importType("Token", "../tokens/index")}
3641
3641
 
3642
3642
  type AnyString = (string & {})
3643
- ${cssVars ? `type CssVars = ${cssVars}` : ""}
3643
+ type CssVars = ${[cssVars || "`var(--${string})`"].filter(Boolean).join(" | ")}
3644
3644
  type CssVarValue = ConditionalValue<Token${ctx.globalVars.isEmpty() ? "" : " | CssVars"} | AnyString | (number & {})>
3645
3645
 
3646
3646
  type CssVarName = ${unionType3(ctx.globalVars.names)} | AnyString
@@ -3655,19 +3655,22 @@ function generateStyleProps(ctx) {
3655
3655
  const prop = ctx.utility.shorthands.get(key) ?? key;
3656
3656
  const union = [];
3657
3657
  const cssFallback = allCssProperties.includes(prop) ? `CssProperties["${prop}"]` : "";
3658
- if (!propTypes.has(prop))
3659
- union.push(cssFallback);
3660
- else {
3661
- union.push(
3662
- strictPropertyValue(prop, `UtilityValues["${prop}"]`, ctx.config.strictTokens ? "" : cssFallback)
3663
- );
3658
+ if (propTypes.has(prop)) {
3659
+ const utilityValue = `UtilityValues["${prop}"]`;
3660
+ if (strictPropertyList.has(key)) {
3661
+ union.push([utilityValue, "CssVars"].join(" | "));
3662
+ } else {
3663
+ union.push([utilityValue, ctx.config.strictTokens ? "" : cssFallback].filter(Boolean).join(" | "));
3664
+ }
3665
+ } else {
3666
+ union.push([strictPropertyList.has(key) ? "CssVars" : "", cssFallback].filter(Boolean).join(" | "));
3664
3667
  }
3665
3668
  const filtered = union.filter(Boolean);
3666
3669
  if (!filtered.length) {
3667
3670
  filtered.push("string | number");
3668
3671
  }
3669
3672
  const comment = csstype_d_ts_default.comments?.[prop] || "";
3670
- const value = filtered.concat(ctx.globalVars.isEmpty() ? "" : "CssVars").filter(Boolean).join(" | ");
3673
+ const value = filtered.filter(Boolean).join(" | ");
3671
3674
  const line = `${key}?: ${restrict(prop, value, ctx.config)}`;
3672
3675
  return " " + [comment, line].filter(Boolean).join("\n");
3673
3676
  }).join("\n")}
@@ -3738,7 +3741,6 @@ var strictPropertyList = /* @__PURE__ */ new Set([
3738
3741
  "wordBreak",
3739
3742
  "writingMode"
3740
3743
  ]);
3741
- var strictPropertyValue = (key, value, fallback) => strictPropertyList.has(key) ? value : [value, fallback].filter(Boolean).join(" | ");
3742
3744
  var restrict = (key, value, config) => {
3743
3745
  if (config.strictPropertyValues && strictPropertyList.has(key)) {
3744
3746
  return `ConditionalValue<WithEscapeHatch<OnlyKnown<"${key}", ${value}>>>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20240315222821",
3
+ "version": "0.0.0-dev-20240319203029",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -37,12 +37,12 @@
37
37
  "pluralize": "8.0.0",
38
38
  "postcss": "8.4.35",
39
39
  "ts-pattern": "5.0.8",
40
- "@pandacss/core": "0.0.0-dev-20240315222821",
41
- "@pandacss/is-valid-prop": "^0.0.0-dev-20240315222821",
42
- "@pandacss/logger": "0.0.0-dev-20240315222821",
43
- "@pandacss/shared": "0.0.0-dev-20240315222821",
44
- "@pandacss/token-dictionary": "0.0.0-dev-20240315222821",
45
- "@pandacss/types": "0.0.0-dev-20240315222821"
40
+ "@pandacss/core": "0.0.0-dev-20240319203029",
41
+ "@pandacss/is-valid-prop": "^0.0.0-dev-20240319203029",
42
+ "@pandacss/logger": "0.0.0-dev-20240319203029",
43
+ "@pandacss/shared": "0.0.0-dev-20240319203029",
44
+ "@pandacss/token-dictionary": "0.0.0-dev-20240319203029",
45
+ "@pandacss/types": "0.0.0-dev-20240319203029"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/pluralize": "0.0.33"