@pandacss/studio 0.0.0-dev-20230911135518 → 0.0.0-dev-20230911215041

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/studio",
3
- "version": "0.0.0-dev-20230911135518",
3
+ "version": "0.0.0-dev-20230911215041",
4
4
  "description": "The automated token documentation for Panda CSS",
5
5
  "main": "dist/studio.js",
6
6
  "module": "dist/studio.mjs",
@@ -33,19 +33,19 @@
33
33
  "react": "18.2.0",
34
34
  "react-dom": "18.2.0",
35
35
  "vite": "4.4.9",
36
- "@pandacss/types": "0.0.0-dev-20230911135518",
37
- "@pandacss/config": "0.0.0-dev-20230911135518",
38
- "@pandacss/shared": "0.0.0-dev-20230911135518",
39
- "@pandacss/token-dictionary": "0.0.0-dev-20230911135518",
40
- "@pandacss/logger": "0.0.0-dev-20230911135518",
41
- "@pandacss/node": "0.0.0-dev-20230911135518"
36
+ "@pandacss/types": "0.0.0-dev-20230911215041",
37
+ "@pandacss/config": "0.0.0-dev-20230911215041",
38
+ "@pandacss/shared": "0.0.0-dev-20230911215041",
39
+ "@pandacss/token-dictionary": "0.0.0-dev-20230911215041",
40
+ "@pandacss/logger": "0.0.0-dev-20230911215041",
41
+ "@pandacss/node": "0.0.0-dev-20230911215041"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/react": "18.2.18",
45
45
  "@types/react-dom": "18.2.7",
46
46
  "@vitejs/plugin-react": "4.0.4",
47
47
  "execa": "7.2.0",
48
- "@pandacss/dev": "0.0.0-dev-20230911135518"
48
+ "@pandacss/dev": "0.0.0-dev-20230911215041"
49
49
  },
50
50
  "scripts": {
51
51
  "codegen": "panda",
@@ -210,49 +210,24 @@ var hypenateProperty = memo((property) => {
210
210
  });
211
211
 
212
212
  // src/slot.ts
213
- var assign = (obj, path, value) => {
214
- const last = path.pop();
215
- const target = path.reduce((acc, key) => {
216
- if (acc[key] == null)
217
- acc[key] = {};
218
- return acc[key];
219
- }, obj);
220
- if (last != null)
221
- target[last] = value;
222
- };
223
213
  var getSlotRecipes = (recipe) => {
224
- const parts = recipe.slots.map((slot) => [
225
- slot,
226
- // setup base recipe
227
- {
228
- // create class-base on BEM
229
- className: [recipe.className ?? "", slot].join("__"),
230
- base: {},
231
- variants: {},
232
- defaultVariants: recipe.defaultVariants ?? {},
233
- compoundVariants: []
234
- }
235
- ]).map(([slot, cva]) => {
236
- const base = recipe.base[slot];
237
- if (base)
238
- cva.base = base;
239
- walkObject(
240
- recipe.variants ?? {},
241
- (variant, path) => {
242
- if (!variant[slot])
243
- return;
244
- assign(cva, ["variants", ...path], variant[slot]);
245
- },
246
- {
247
- stop: (_value, path) => path.includes(slot)
248
- }
249
- );
250
- if (recipe.compoundVariants) {
251
- cva.compoundVariants = getSlotCompoundVariant(recipe.compoundVariants, slot);
252
- }
253
- return [slot, cva];
214
+ const init = (slot) => ({
215
+ className: [recipe.className, slot].filter(Boolean).join("__"),
216
+ base: recipe.base?.[slot] ?? {},
217
+ variants: {},
218
+ defaultVariants: recipe.defaultVariants ?? {},
219
+ compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []
254
220
  });
255
- return Object.fromEntries(parts);
221
+ const recipeParts = recipe.slots.map((slot) => [slot, init(slot)]);
222
+ for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {
223
+ for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {
224
+ recipeParts.forEach(([slot, slotRecipe]) => {
225
+ slotRecipe.variants[variantsKey] ??= {};
226
+ slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};
227
+ });
228
+ }
229
+ }
230
+ return Object.fromEntries(recipeParts);
256
231
  };
257
232
  var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));
258
233