@pandacss/config 1.10.0 → 1.11.0

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
@@ -755,6 +755,30 @@ var validateBreakpoints = (breakpoints, addError) => {
755
755
 
756
756
  // src/validation/validate-condition.ts
757
757
  var import_shared8 = require("@pandacss/shared");
758
+ var validateObjectCondition = (obj, addError) => {
759
+ let hasSlot = false;
760
+ for (const [key, value] of Object.entries(obj)) {
761
+ if (!key.startsWith("@") && !key.includes("&")) {
762
+ addError("conditions", `Selectors should contain the \`&\` character: \`${key}\``);
763
+ }
764
+ if (value === "@slot") {
765
+ hasSlot = true;
766
+ continue;
767
+ }
768
+ if (typeof value === "string") {
769
+ addError(
770
+ "conditions",
771
+ `Object condition leaves must be the literal string \`'@slot'\`, got \`${JSON.stringify(value)}\` at \`${key}\``
772
+ );
773
+ continue;
774
+ }
775
+ if (typeof value === "object" && value !== null) {
776
+ const nested = validateObjectCondition(value, addError);
777
+ if (nested.hasSlot) hasSlot = true;
778
+ }
779
+ }
780
+ return { hasSlot };
781
+ };
758
782
  var validateConditions = (conditions, addError) => {
759
783
  if (!conditions) return;
760
784
  Object.values(conditions).forEach((condition) => {
@@ -764,11 +788,18 @@ var validateConditions = (conditions, addError) => {
764
788
  }
765
789
  return;
766
790
  }
767
- condition.forEach((c) => {
768
- if (!c.startsWith("@") && !c.includes("&")) {
769
- addError("conditions", `Selectors should contain the \`&\` character: \`${c}\``);
770
- }
771
- });
791
+ if (Array.isArray(condition)) {
792
+ condition.forEach((c) => {
793
+ if (!c.startsWith("@") && !c.includes("&")) {
794
+ addError("conditions", `Selectors should contain the \`&\` character: \`${c}\``);
795
+ }
796
+ });
797
+ return;
798
+ }
799
+ const { hasSlot } = validateObjectCondition(condition, addError);
800
+ if (!hasSlot) {
801
+ addError("conditions", `Object conditions must contain at least one \`'@slot'\` marker`);
802
+ }
772
803
  });
773
804
  };
774
805
 
package/dist/index.mjs CHANGED
@@ -300,6 +300,30 @@ var validateBreakpoints = (breakpoints, addError) => {
300
300
 
301
301
  // src/validation/validate-condition.ts
302
302
  import { isString } from "@pandacss/shared";
303
+ var validateObjectCondition = (obj, addError) => {
304
+ let hasSlot = false;
305
+ for (const [key, value] of Object.entries(obj)) {
306
+ if (!key.startsWith("@") && !key.includes("&")) {
307
+ addError("conditions", `Selectors should contain the \`&\` character: \`${key}\``);
308
+ }
309
+ if (value === "@slot") {
310
+ hasSlot = true;
311
+ continue;
312
+ }
313
+ if (typeof value === "string") {
314
+ addError(
315
+ "conditions",
316
+ `Object condition leaves must be the literal string \`'@slot'\`, got \`${JSON.stringify(value)}\` at \`${key}\``
317
+ );
318
+ continue;
319
+ }
320
+ if (typeof value === "object" && value !== null) {
321
+ const nested = validateObjectCondition(value, addError);
322
+ if (nested.hasSlot) hasSlot = true;
323
+ }
324
+ }
325
+ return { hasSlot };
326
+ };
303
327
  var validateConditions = (conditions, addError) => {
304
328
  if (!conditions) return;
305
329
  Object.values(conditions).forEach((condition) => {
@@ -309,11 +333,18 @@ var validateConditions = (conditions, addError) => {
309
333
  }
310
334
  return;
311
335
  }
312
- condition.forEach((c) => {
313
- if (!c.startsWith("@") && !c.includes("&")) {
314
- addError("conditions", `Selectors should contain the \`&\` character: \`${c}\``);
315
- }
316
- });
336
+ if (Array.isArray(condition)) {
337
+ condition.forEach((c) => {
338
+ if (!c.startsWith("@") && !c.includes("&")) {
339
+ addError("conditions", `Selectors should contain the \`&\` character: \`${c}\``);
340
+ }
341
+ });
342
+ return;
343
+ }
344
+ const { hasSlot } = validateObjectCondition(condition, addError);
345
+ if (!hasSlot) {
346
+ addError("conditions", `Object conditions must contain at least one \`'@slot'\` marker`);
347
+ }
317
348
  });
318
349
  };
319
350
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Find and load panda config",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -73,11 +73,11 @@
73
73
  "escalade": "3.2.0",
74
74
  "microdiff": "1.5.0",
75
75
  "typescript": "6.0.2",
76
- "@pandacss/logger": "1.10.0",
77
- "@pandacss/preset-base": "1.10.0",
78
- "@pandacss/preset-panda": "1.10.0",
79
- "@pandacss/shared": "1.10.0",
80
- "@pandacss/types": "1.10.0"
76
+ "@pandacss/logger": "1.11.0",
77
+ "@pandacss/preset-base": "1.11.0",
78
+ "@pandacss/preset-panda": "1.11.0",
79
+ "@pandacss/shared": "1.11.0",
80
+ "@pandacss/types": "1.11.0"
81
81
  },
82
82
  "devDependencies": {
83
83
  "pkg-types": "2.3.0"