@pandacss/config 0.35.0 → 0.36.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/{chunk-XG53JPBE.mjs → chunk-D3CL3VYD.mjs} +2 -1
- package/dist/{chunk-TMHVUUQX.mjs → chunk-IMFODN4N.mjs} +22 -47
- package/dist/diff-config.js +2 -1
- package/dist/diff-config.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -52
- package/dist/index.mjs +9 -6
- package/dist/merge-config.d.mts +2 -2
- package/dist/merge-config.d.ts +2 -2
- package/dist/merge-config.js +26 -37
- package/dist/merge-config.mjs +1 -1
- package/package.json +15 -6
|
@@ -86,7 +86,8 @@ var artifactConfigDeps = {
|
|
|
86
86
|
"types-jsx": jsx,
|
|
87
87
|
"types-entry": [],
|
|
88
88
|
"types-gen": [],
|
|
89
|
-
"types-gen-system": []
|
|
89
|
+
"types-gen-system": [],
|
|
90
|
+
themes: ["themes"].concat(tokens)
|
|
90
91
|
};
|
|
91
92
|
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
92
93
|
if (!paths.length)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/merge-config.ts
|
|
2
|
+
import { assign, isObject, mergeWith, traverse } from "@pandacss/shared";
|
|
2
3
|
import { mergeAndConcat } from "merge-anything";
|
|
3
4
|
|
|
4
5
|
// src/merge-hooks.ts
|
|
@@ -96,51 +97,6 @@ var tryCatch = (name, fn) => {
|
|
|
96
97
|
};
|
|
97
98
|
};
|
|
98
99
|
|
|
99
|
-
// src/utils.ts
|
|
100
|
-
import { traverse } from "@pandacss/shared";
|
|
101
|
-
var isObject = (v) => Object.prototype.toString.call(v) === "[object Object]";
|
|
102
|
-
function mergeWith(target, ...sources) {
|
|
103
|
-
const customizer = sources.pop();
|
|
104
|
-
for (const source of sources) {
|
|
105
|
-
for (const key in source) {
|
|
106
|
-
const merged = customizer(target[key], source[key]);
|
|
107
|
-
if (merged === void 0) {
|
|
108
|
-
if (isObject(target[key]) && isObject(source[key])) {
|
|
109
|
-
target[key] = mergeWith({}, target[key], source[key], customizer);
|
|
110
|
-
} else {
|
|
111
|
-
target[key] = source[key];
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
target[key] = merged;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return target;
|
|
119
|
-
}
|
|
120
|
-
function assign(target, ...sources) {
|
|
121
|
-
for (const source of sources) {
|
|
122
|
-
for (const key in source) {
|
|
123
|
-
if (!target?.hasOwnProperty?.(key)) {
|
|
124
|
-
target[key] = source[key];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return target;
|
|
129
|
-
}
|
|
130
|
-
var omit = (obj, paths) => {
|
|
131
|
-
const result = { ...obj };
|
|
132
|
-
traverse(obj, ({ path, parent, key }) => {
|
|
133
|
-
if (paths.includes(path)) {
|
|
134
|
-
delete parent[key];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
return result;
|
|
138
|
-
};
|
|
139
|
-
var utils = {
|
|
140
|
-
omit,
|
|
141
|
-
traverse
|
|
142
|
-
};
|
|
143
|
-
|
|
144
100
|
// src/merge-config.ts
|
|
145
101
|
function getExtends(items) {
|
|
146
102
|
return items.reduce((merged, { extend }) => {
|
|
@@ -181,6 +137,7 @@ var compact = (obj) => {
|
|
|
181
137
|
return acc;
|
|
182
138
|
}, {});
|
|
183
139
|
};
|
|
140
|
+
var tokenKeys = ["description", "extensions", "type", "value"];
|
|
184
141
|
function mergeConfigs(configs) {
|
|
185
142
|
const [userConfig] = configs;
|
|
186
143
|
const pluginHooks = userConfig.plugins ?? [];
|
|
@@ -194,15 +151,33 @@ function mergeConfigs(configs) {
|
|
|
194
151
|
patterns: mergeExtensions(configs.map((config) => config.patterns ?? {})),
|
|
195
152
|
utilities: mergeExtensions(configs.map((config) => config.utilities ?? {})),
|
|
196
153
|
globalCss: mergeExtensions(configs.map((config) => config.globalCss ?? {})),
|
|
154
|
+
globalVars: mergeExtensions(configs.map((config) => config.globalVars ?? {})),
|
|
197
155
|
staticCss: mergeExtensions(configs.map((config) => config.staticCss ?? {})),
|
|
156
|
+
themes: mergeExtensions(configs.map((config) => config.themes ?? {})),
|
|
198
157
|
hooks: mergeHooks(pluginHooks)
|
|
199
158
|
},
|
|
200
159
|
...configs
|
|
201
160
|
);
|
|
202
|
-
|
|
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;
|
|
203
179
|
}
|
|
204
180
|
|
|
205
181
|
export {
|
|
206
|
-
utils,
|
|
207
182
|
mergeConfigs
|
|
208
183
|
};
|
package/dist/diff-config.js
CHANGED
|
@@ -120,7 +120,8 @@ var artifactConfigDeps = {
|
|
|
120
120
|
"types-jsx": jsx,
|
|
121
121
|
"types-entry": [],
|
|
122
122
|
"types-gen": [],
|
|
123
|
-
"types-gen-system": []
|
|
123
|
+
"types-gen-system": [],
|
|
124
|
+
themes: ["themes"].concat(tokens)
|
|
124
125
|
};
|
|
125
126
|
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
126
127
|
if (!paths.length)
|
package/dist/diff-config.mjs
CHANGED
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<
|
|
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<
|
|
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
|
@@ -190,7 +190,8 @@ var artifactConfigDeps = {
|
|
|
190
190
|
"types-jsx": jsx,
|
|
191
191
|
"types-entry": [],
|
|
192
192
|
"types-gen": [],
|
|
193
|
-
"types-gen-system": []
|
|
193
|
+
"types-gen-system": [],
|
|
194
|
+
themes: ["themes"].concat(tokens)
|
|
194
195
|
};
|
|
195
196
|
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
196
197
|
if (!paths.length)
|
|
@@ -381,6 +382,7 @@ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compi
|
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
// src/merge-config.ts
|
|
385
|
+
var import_shared4 = require("@pandacss/shared");
|
|
384
386
|
var import_merge_anything = require("merge-anything");
|
|
385
387
|
|
|
386
388
|
// src/merge-hooks.ts
|
|
@@ -478,57 +480,12 @@ var tryCatch = (name, fn) => {
|
|
|
478
480
|
};
|
|
479
481
|
};
|
|
480
482
|
|
|
481
|
-
// src/utils.ts
|
|
482
|
-
var import_shared4 = require("@pandacss/shared");
|
|
483
|
-
var isObject = (v) => Object.prototype.toString.call(v) === "[object Object]";
|
|
484
|
-
function mergeWith(target, ...sources) {
|
|
485
|
-
const customizer = sources.pop();
|
|
486
|
-
for (const source of sources) {
|
|
487
|
-
for (const key in source) {
|
|
488
|
-
const merged = customizer(target[key], source[key]);
|
|
489
|
-
if (merged === void 0) {
|
|
490
|
-
if (isObject(target[key]) && isObject(source[key])) {
|
|
491
|
-
target[key] = mergeWith({}, target[key], source[key], customizer);
|
|
492
|
-
} else {
|
|
493
|
-
target[key] = source[key];
|
|
494
|
-
}
|
|
495
|
-
} else {
|
|
496
|
-
target[key] = merged;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
return target;
|
|
501
|
-
}
|
|
502
|
-
function assign(target, ...sources) {
|
|
503
|
-
for (const source of sources) {
|
|
504
|
-
for (const key in source) {
|
|
505
|
-
if (!target?.hasOwnProperty?.(key)) {
|
|
506
|
-
target[key] = source[key];
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
return target;
|
|
511
|
-
}
|
|
512
|
-
var omit = (obj, paths) => {
|
|
513
|
-
const result = { ...obj };
|
|
514
|
-
(0, import_shared4.traverse)(obj, ({ path: path2, parent, key }) => {
|
|
515
|
-
if (paths.includes(path2)) {
|
|
516
|
-
delete parent[key];
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
return result;
|
|
520
|
-
};
|
|
521
|
-
var utils = {
|
|
522
|
-
omit,
|
|
523
|
-
traverse: import_shared4.traverse
|
|
524
|
-
};
|
|
525
|
-
|
|
526
483
|
// src/merge-config.ts
|
|
527
484
|
function getExtends(items) {
|
|
528
485
|
return items.reduce((merged, { extend }) => {
|
|
529
486
|
if (!extend)
|
|
530
487
|
return merged;
|
|
531
|
-
return mergeWith(merged, extend, (originalValue, newValue) => {
|
|
488
|
+
return (0, import_shared4.mergeWith)(merged, extend, (originalValue, newValue) => {
|
|
532
489
|
if (newValue === void 0) {
|
|
533
490
|
return originalValue ?? [];
|
|
534
491
|
}
|
|
@@ -544,13 +501,13 @@ function getExtends(items) {
|
|
|
544
501
|
}
|
|
545
502
|
function mergeRecords(records) {
|
|
546
503
|
return {
|
|
547
|
-
...records.reduce((acc, record) => assign(acc, record), {}),
|
|
504
|
+
...records.reduce((acc, record) => (0, import_shared4.assign)(acc, record), {}),
|
|
548
505
|
extend: getExtends(records)
|
|
549
506
|
};
|
|
550
507
|
}
|
|
551
508
|
function mergeExtensions(records) {
|
|
552
509
|
const { extend = [], ...restProps } = mergeRecords(records);
|
|
553
|
-
return mergeWith(restProps, extend, (obj, extensions) => {
|
|
510
|
+
return (0, import_shared4.mergeWith)(restProps, extend, (obj, extensions) => {
|
|
554
511
|
return (0, import_merge_anything.mergeAndConcat)({}, obj, ...extensions);
|
|
555
512
|
});
|
|
556
513
|
}
|
|
@@ -563,25 +520,45 @@ var compact = (obj) => {
|
|
|
563
520
|
return acc;
|
|
564
521
|
}, {});
|
|
565
522
|
};
|
|
523
|
+
var tokenKeys = ["description", "extensions", "type", "value"];
|
|
566
524
|
function mergeConfigs(configs2) {
|
|
567
525
|
const [userConfig] = configs2;
|
|
568
526
|
const pluginHooks = userConfig.plugins ?? [];
|
|
569
527
|
if (userConfig.hooks) {
|
|
570
528
|
pluginHooks.push({ name: "__panda.config__", hooks: userConfig.hooks });
|
|
571
529
|
}
|
|
572
|
-
const mergedResult = assign(
|
|
530
|
+
const mergedResult = (0, import_shared4.assign)(
|
|
573
531
|
{
|
|
574
532
|
conditions: mergeExtensions(configs2.map((config) => config.conditions ?? {})),
|
|
575
533
|
theme: mergeExtensions(configs2.map((config) => config.theme ?? {})),
|
|
576
534
|
patterns: mergeExtensions(configs2.map((config) => config.patterns ?? {})),
|
|
577
535
|
utilities: mergeExtensions(configs2.map((config) => config.utilities ?? {})),
|
|
578
536
|
globalCss: mergeExtensions(configs2.map((config) => config.globalCss ?? {})),
|
|
537
|
+
globalVars: mergeExtensions(configs2.map((config) => config.globalVars ?? {})),
|
|
579
538
|
staticCss: mergeExtensions(configs2.map((config) => config.staticCss ?? {})),
|
|
539
|
+
themes: mergeExtensions(configs2.map((config) => config.themes ?? {})),
|
|
580
540
|
hooks: mergeHooks(pluginHooks)
|
|
581
541
|
},
|
|
582
542
|
...configs2
|
|
583
543
|
);
|
|
584
|
-
|
|
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;
|
|
585
562
|
}
|
|
586
563
|
|
|
587
564
|
// src/get-resolved-config.ts
|
|
@@ -889,6 +866,10 @@ ${Array.from(warnings).map((err) => "- " + err).join("\n")}
|
|
|
889
866
|
};
|
|
890
867
|
|
|
891
868
|
// src/resolve-config.ts
|
|
869
|
+
var hookUtils = {
|
|
870
|
+
omit: import_shared9.omit,
|
|
871
|
+
traverse: import_shared9.traverse
|
|
872
|
+
};
|
|
892
873
|
async function resolveConfig(result, cwd) {
|
|
893
874
|
const presets = /* @__PURE__ */ new Set();
|
|
894
875
|
if (!result.config.eject) {
|
|
@@ -917,7 +898,7 @@ async function resolveConfig(result, cwd) {
|
|
|
917
898
|
config: loadConfigResult.config,
|
|
918
899
|
path: loadConfigResult.path,
|
|
919
900
|
dependencies: loadConfigResult.dependencies,
|
|
920
|
-
utils
|
|
901
|
+
utils: hookUtils
|
|
921
902
|
});
|
|
922
903
|
if (result2) {
|
|
923
904
|
loadConfigResult.config = result2;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
mergeConfigs
|
|
3
|
-
|
|
4
|
-
} from "./chunk-TMHVUUQX.mjs";
|
|
2
|
+
mergeConfigs
|
|
3
|
+
} from "./chunk-IMFODN4N.mjs";
|
|
5
4
|
import {
|
|
6
5
|
diffConfigs
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-D3CL3VYD.mjs";
|
|
8
7
|
import {
|
|
9
8
|
resolveTsPathPattern
|
|
10
9
|
} from "./chunk-RPIVZP2I.mjs";
|
|
@@ -215,7 +214,7 @@ async function getResolvedConfig(config, cwd) {
|
|
|
215
214
|
|
|
216
215
|
// src/resolve-config.ts
|
|
217
216
|
import { logger as logger3 } from "@pandacss/logger";
|
|
218
|
-
import { parseJson, stringifyJson } from "@pandacss/shared";
|
|
217
|
+
import { omit, parseJson, stringifyJson, traverse } from "@pandacss/shared";
|
|
219
218
|
|
|
220
219
|
// src/bundled-preset.ts
|
|
221
220
|
import { preset as presetBase } from "@pandacss/preset-base";
|
|
@@ -499,6 +498,10 @@ ${Array.from(warnings).map((err) => "- " + err).join("\n")}
|
|
|
499
498
|
};
|
|
500
499
|
|
|
501
500
|
// src/resolve-config.ts
|
|
501
|
+
var hookUtils = {
|
|
502
|
+
omit,
|
|
503
|
+
traverse
|
|
504
|
+
};
|
|
502
505
|
async function resolveConfig(result, cwd) {
|
|
503
506
|
const presets = /* @__PURE__ */ new Set();
|
|
504
507
|
if (!result.config.eject) {
|
|
@@ -527,7 +530,7 @@ async function resolveConfig(result, cwd) {
|
|
|
527
530
|
config: loadConfigResult.config,
|
|
528
531
|
path: loadConfigResult.path,
|
|
529
532
|
dependencies: loadConfigResult.dependencies,
|
|
530
|
-
utils
|
|
533
|
+
utils: hookUtils
|
|
531
534
|
});
|
|
532
535
|
if (result2) {
|
|
533
536
|
loadConfigResult.config = result2;
|
package/dist/merge-config.d.mts
CHANGED
|
@@ -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[]):
|
|
10
|
+
declare function mergeConfigs(configs: ExtendableConfig[]): UserConfig;
|
|
11
11
|
|
|
12
12
|
export { mergeConfigs };
|
package/dist/merge-config.d.ts
CHANGED
|
@@ -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[]):
|
|
10
|
+
declare function mergeConfigs(configs: ExtendableConfig[]): UserConfig;
|
|
11
11
|
|
|
12
12
|
export { mergeConfigs };
|
package/dist/merge-config.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(merge_config_exports, {
|
|
|
23
23
|
mergeConfigs: () => mergeConfigs
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(merge_config_exports);
|
|
26
|
+
var import_shared = require("@pandacss/shared");
|
|
26
27
|
var import_merge_anything = require("merge-anything");
|
|
27
28
|
|
|
28
29
|
// src/merge-hooks.ts
|
|
@@ -120,44 +121,12 @@ var tryCatch = (name, fn) => {
|
|
|
120
121
|
};
|
|
121
122
|
};
|
|
122
123
|
|
|
123
|
-
// src/utils.ts
|
|
124
|
-
var import_shared = require("@pandacss/shared");
|
|
125
|
-
var isObject = (v) => Object.prototype.toString.call(v) === "[object Object]";
|
|
126
|
-
function mergeWith(target, ...sources) {
|
|
127
|
-
const customizer = sources.pop();
|
|
128
|
-
for (const source of sources) {
|
|
129
|
-
for (const key in source) {
|
|
130
|
-
const merged = customizer(target[key], source[key]);
|
|
131
|
-
if (merged === void 0) {
|
|
132
|
-
if (isObject(target[key]) && isObject(source[key])) {
|
|
133
|
-
target[key] = mergeWith({}, target[key], source[key], customizer);
|
|
134
|
-
} else {
|
|
135
|
-
target[key] = source[key];
|
|
136
|
-
}
|
|
137
|
-
} else {
|
|
138
|
-
target[key] = merged;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return target;
|
|
143
|
-
}
|
|
144
|
-
function assign(target, ...sources) {
|
|
145
|
-
for (const source of sources) {
|
|
146
|
-
for (const key in source) {
|
|
147
|
-
if (!target?.hasOwnProperty?.(key)) {
|
|
148
|
-
target[key] = source[key];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return target;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
124
|
// src/merge-config.ts
|
|
156
125
|
function getExtends(items) {
|
|
157
126
|
return items.reduce((merged, { extend }) => {
|
|
158
127
|
if (!extend)
|
|
159
128
|
return merged;
|
|
160
|
-
return mergeWith(merged, extend, (originalValue, newValue) => {
|
|
129
|
+
return (0, import_shared.mergeWith)(merged, extend, (originalValue, newValue) => {
|
|
161
130
|
if (newValue === void 0) {
|
|
162
131
|
return originalValue ?? [];
|
|
163
132
|
}
|
|
@@ -173,13 +142,13 @@ function getExtends(items) {
|
|
|
173
142
|
}
|
|
174
143
|
function mergeRecords(records) {
|
|
175
144
|
return {
|
|
176
|
-
...records.reduce((acc, record) => assign(acc, record), {}),
|
|
145
|
+
...records.reduce((acc, record) => (0, import_shared.assign)(acc, record), {}),
|
|
177
146
|
extend: getExtends(records)
|
|
178
147
|
};
|
|
179
148
|
}
|
|
180
149
|
function mergeExtensions(records) {
|
|
181
150
|
const { extend = [], ...restProps } = mergeRecords(records);
|
|
182
|
-
return mergeWith(restProps, extend, (obj, extensions) => {
|
|
151
|
+
return (0, import_shared.mergeWith)(restProps, extend, (obj, extensions) => {
|
|
183
152
|
return (0, import_merge_anything.mergeAndConcat)({}, obj, ...extensions);
|
|
184
153
|
});
|
|
185
154
|
}
|
|
@@ -192,25 +161,45 @@ var compact = (obj) => {
|
|
|
192
161
|
return acc;
|
|
193
162
|
}, {});
|
|
194
163
|
};
|
|
164
|
+
var tokenKeys = ["description", "extensions", "type", "value"];
|
|
195
165
|
function mergeConfigs(configs) {
|
|
196
166
|
const [userConfig] = configs;
|
|
197
167
|
const pluginHooks = userConfig.plugins ?? [];
|
|
198
168
|
if (userConfig.hooks) {
|
|
199
169
|
pluginHooks.push({ name: "__panda.config__", hooks: userConfig.hooks });
|
|
200
170
|
}
|
|
201
|
-
const mergedResult = assign(
|
|
171
|
+
const mergedResult = (0, import_shared.assign)(
|
|
202
172
|
{
|
|
203
173
|
conditions: mergeExtensions(configs.map((config) => config.conditions ?? {})),
|
|
204
174
|
theme: mergeExtensions(configs.map((config) => config.theme ?? {})),
|
|
205
175
|
patterns: mergeExtensions(configs.map((config) => config.patterns ?? {})),
|
|
206
176
|
utilities: mergeExtensions(configs.map((config) => config.utilities ?? {})),
|
|
207
177
|
globalCss: mergeExtensions(configs.map((config) => config.globalCss ?? {})),
|
|
178
|
+
globalVars: mergeExtensions(configs.map((config) => config.globalVars ?? {})),
|
|
208
179
|
staticCss: mergeExtensions(configs.map((config) => config.staticCss ?? {})),
|
|
180
|
+
themes: mergeExtensions(configs.map((config) => config.themes ?? {})),
|
|
209
181
|
hooks: mergeHooks(pluginHooks)
|
|
210
182
|
},
|
|
211
183
|
...configs
|
|
212
184
|
);
|
|
213
|
-
|
|
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;
|
|
214
203
|
}
|
|
215
204
|
// Annotate the CommonJS export names for ESM import in node:
|
|
216
205
|
0 && (module.exports = {
|
package/dist/merge-config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Find and load panda config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -53,6 +53,15 @@
|
|
|
53
53
|
"default": "./dist/resolve-ts-path-pattern.mjs"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
+
"./utils": {
|
|
57
|
+
"source": "./src/utils.ts",
|
|
58
|
+
"types": "./dist/utils.d.ts",
|
|
59
|
+
"require": "./dist/utils.js",
|
|
60
|
+
"import": {
|
|
61
|
+
"types": "./dist/utils.d.mts",
|
|
62
|
+
"default": "./dist/utils.mjs"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
56
65
|
"./package.json": "./package.json"
|
|
57
66
|
},
|
|
58
67
|
"files": [
|
|
@@ -64,11 +73,11 @@
|
|
|
64
73
|
"merge-anything": "5.1.7",
|
|
65
74
|
"microdiff": "1.3.2",
|
|
66
75
|
"typescript": "5.3.3",
|
|
67
|
-
"@pandacss/logger": "0.
|
|
68
|
-
"@pandacss/preset-base": "0.
|
|
69
|
-
"@pandacss/preset-panda": "0.
|
|
70
|
-
"@pandacss/shared": "0.
|
|
71
|
-
"@pandacss/types": "0.
|
|
76
|
+
"@pandacss/logger": "0.36.0",
|
|
77
|
+
"@pandacss/preset-base": "0.36.0",
|
|
78
|
+
"@pandacss/preset-panda": "0.36.0",
|
|
79
|
+
"@pandacss/shared": "0.36.0",
|
|
80
|
+
"@pandacss/types": "0.36.0"
|
|
72
81
|
},
|
|
73
82
|
"devDependencies": {
|
|
74
83
|
"pkg-types": "1.0.3"
|