@pandacss/config 0.0.0-dev-20240315210222 → 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.
@@ -1,5 +1,5 @@
1
1
  // src/merge-config.ts
2
- import { assign, mergeWith } from "@pandacss/shared";
2
+ import { assign, isObject, mergeWith, traverse } from "@pandacss/shared";
3
3
  import { mergeAndConcat } from "merge-anything";
4
4
 
5
5
  // src/merge-hooks.ts
@@ -137,6 +137,7 @@ var compact = (obj) => {
137
137
  return acc;
138
138
  }, {});
139
139
  };
140
+ var tokenKeys = ["description", "extensions", "type", "value"];
140
141
  function mergeConfigs(configs) {
141
142
  const [userConfig] = configs;
142
143
  const pluginHooks = userConfig.plugins ?? [];
@@ -157,7 +158,24 @@ function mergeConfigs(configs) {
157
158
  },
158
159
  ...configs
159
160
  );
160
- return compact(mergedResult);
161
+ const withoutEmpty = compact(mergedResult);
162
+ if (withoutEmpty.theme?.tokens) {
163
+ traverse(withoutEmpty.theme.tokens, (args) => args, {
164
+ stop(args) {
165
+ if (isObject(args.value) && "value" in args.value) {
166
+ const keys = Object.keys(args.value);
167
+ if (keys.filter((k) => !tokenKeys.includes(k)).length) {
168
+ const { type: _type, description: _description, extensions: _extensions, value, DEFAULT } = args.value;
169
+ args.value.DEFAULT = { value: DEFAULT?.value ?? value };
170
+ delete args.value.value;
171
+ }
172
+ return true;
173
+ }
174
+ return false;
175
+ }
176
+ });
177
+ }
178
+ return withoutEmpty;
161
179
  }
162
180
 
163
181
  export {
package/dist/index.d.mts CHANGED
@@ -42,7 +42,7 @@ type ExtendableConfig = Extendable<Config>;
42
42
  /**
43
43
  * Recursively merge all presets into a single config
44
44
  */
45
- declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promise<Config>;
45
+ declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promise<_pandacss_types.UserConfig>;
46
46
 
47
47
  /**
48
48
  * Find, load and resolve the final config (including presets)
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ type ExtendableConfig = Extendable<Config>;
42
42
  /**
43
43
  * Recursively merge all presets into a single config
44
44
  */
45
- declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promise<Config>;
45
+ declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promise<_pandacss_types.UserConfig>;
46
46
 
47
47
  /**
48
48
  * Find, load and resolve the final config (including presets)
package/dist/index.js CHANGED
@@ -520,6 +520,7 @@ var compact = (obj) => {
520
520
  return acc;
521
521
  }, {});
522
522
  };
523
+ var tokenKeys = ["description", "extensions", "type", "value"];
523
524
  function mergeConfigs(configs2) {
524
525
  const [userConfig] = configs2;
525
526
  const pluginHooks = userConfig.plugins ?? [];
@@ -540,7 +541,24 @@ function mergeConfigs(configs2) {
540
541
  },
541
542
  ...configs2
542
543
  );
543
- return compact(mergedResult);
544
+ const withoutEmpty = compact(mergedResult);
545
+ if (withoutEmpty.theme?.tokens) {
546
+ (0, import_shared4.traverse)(withoutEmpty.theme.tokens, (args) => args, {
547
+ stop(args) {
548
+ if ((0, import_shared4.isObject)(args.value) && "value" in args.value) {
549
+ const keys = Object.keys(args.value);
550
+ if (keys.filter((k) => !tokenKeys.includes(k)).length) {
551
+ const { type: _type, description: _description, extensions: _extensions, value, DEFAULT } = args.value;
552
+ args.value.DEFAULT = { value: DEFAULT?.value ?? value };
553
+ delete args.value.value;
554
+ }
555
+ return true;
556
+ }
557
+ return false;
558
+ }
559
+ });
560
+ }
561
+ return withoutEmpty;
544
562
  }
545
563
 
546
564
  // src/get-resolved-config.ts
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mergeConfigs
3
- } from "./chunk-2IJ2YCV2.mjs";
3
+ } from "./chunk-IMFODN4N.mjs";
4
4
  import {
5
5
  diffConfigs
6
6
  } from "./chunk-D3CL3VYD.mjs";
@@ -1,4 +1,4 @@
1
- import { Config } from '@pandacss/types';
1
+ import { UserConfig, Config } from '@pandacss/types';
2
2
 
3
3
  type Extendable<T> = T & {
4
4
  extend?: T;
@@ -7,6 +7,6 @@ type ExtendableConfig = Extendable<Config>;
7
7
  /**
8
8
  * Merge all configs into a single config
9
9
  */
10
- declare function mergeConfigs(configs: ExtendableConfig[]): any;
10
+ declare function mergeConfigs(configs: ExtendableConfig[]): UserConfig;
11
11
 
12
12
  export { mergeConfigs };
@@ -1,4 +1,4 @@
1
- import { Config } from '@pandacss/types';
1
+ import { UserConfig, Config } from '@pandacss/types';
2
2
 
3
3
  type Extendable<T> = T & {
4
4
  extend?: T;
@@ -7,6 +7,6 @@ type ExtendableConfig = Extendable<Config>;
7
7
  /**
8
8
  * Merge all configs into a single config
9
9
  */
10
- declare function mergeConfigs(configs: ExtendableConfig[]): any;
10
+ declare function mergeConfigs(configs: ExtendableConfig[]): UserConfig;
11
11
 
12
12
  export { mergeConfigs };
@@ -161,6 +161,7 @@ var compact = (obj) => {
161
161
  return acc;
162
162
  }, {});
163
163
  };
164
+ var tokenKeys = ["description", "extensions", "type", "value"];
164
165
  function mergeConfigs(configs) {
165
166
  const [userConfig] = configs;
166
167
  const pluginHooks = userConfig.plugins ?? [];
@@ -181,7 +182,24 @@ function mergeConfigs(configs) {
181
182
  },
182
183
  ...configs
183
184
  );
184
- return compact(mergedResult);
185
+ const withoutEmpty = compact(mergedResult);
186
+ if (withoutEmpty.theme?.tokens) {
187
+ (0, import_shared.traverse)(withoutEmpty.theme.tokens, (args) => args, {
188
+ stop(args) {
189
+ if ((0, import_shared.isObject)(args.value) && "value" in args.value) {
190
+ const keys = Object.keys(args.value);
191
+ if (keys.filter((k) => !tokenKeys.includes(k)).length) {
192
+ const { type: _type, description: _description, extensions: _extensions, value, DEFAULT } = args.value;
193
+ args.value.DEFAULT = { value: DEFAULT?.value ?? value };
194
+ delete args.value.value;
195
+ }
196
+ return true;
197
+ }
198
+ return false;
199
+ }
200
+ });
201
+ }
202
+ return withoutEmpty;
185
203
  }
186
204
  // Annotate the CommonJS export names for ESM import in node:
187
205
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mergeConfigs
3
- } from "./chunk-2IJ2YCV2.mjs";
3
+ } from "./chunk-IMFODN4N.mjs";
4
4
  export {
5
5
  mergeConfigs
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "0.0.0-dev-20240315210222",
3
+ "version": "0.0.0-dev-20240319203029",
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
  "merge-anything": "5.1.7",
74
74
  "microdiff": "1.3.2",
75
75
  "typescript": "5.3.3",
76
- "@pandacss/logger": "0.0.0-dev-20240315210222",
77
- "@pandacss/preset-base": "0.0.0-dev-20240315210222",
78
- "@pandacss/preset-panda": "0.0.0-dev-20240315210222",
79
- "@pandacss/shared": "0.0.0-dev-20240315210222",
80
- "@pandacss/types": "0.0.0-dev-20240315210222"
76
+ "@pandacss/logger": "0.0.0-dev-20240319203029",
77
+ "@pandacss/preset-base": "0.0.0-dev-20240319203029",
78
+ "@pandacss/preset-panda": "0.0.0-dev-20240319203029",
79
+ "@pandacss/shared": "0.0.0-dev-20240319203029",
80
+ "@pandacss/types": "0.0.0-dev-20240319203029"
81
81
  },
82
82
  "devDependencies": {
83
83
  "pkg-types": "1.0.3"