@pandacss/config 2.0.0-beta.8 → 2.0.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-YKIDLZNO.js → chunk-LDC4ZCDS.js} +56 -75
- package/dist/chunk-R4R5RHIS.js +73 -0
- package/dist/{chunk-VYX3JX5J.js → chunk-Y642H6DU.js} +54 -4
- package/dist/index.d.ts +82 -14
- package/dist/index.js +799 -231
- package/dist/{merge-DiBpncUC.d.ts → merge-EXcM0jFd.d.ts} +2 -3
- package/dist/merge.d.ts +1 -1
- package/dist/merge.js +2 -1
- package/dist/serialize.d.ts +1 -1
- package/dist/serialize.js +2 -1
- package/package.json +4 -4
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
super(message, { cause: opts?.cause });
|
|
8
|
-
this.code = `ERR_PANDA_${code}`;
|
|
9
|
-
this.hint = opts?.hint;
|
|
10
|
-
this.diagnostics = opts?.diagnostics;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
function createConfigError(message, diagnostics) {
|
|
14
|
-
return new PandaError("CONFIG_ERROR", `\u{1F4A5} ${message}`, { diagnostics });
|
|
15
|
-
}
|
|
16
|
-
function createConfigDiagnostic(code, message, help) {
|
|
17
|
-
return {
|
|
18
|
-
code,
|
|
19
|
-
message,
|
|
20
|
-
severity: "error",
|
|
21
|
-
category: "config",
|
|
22
|
-
...help ? { help } : {}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
PandaError,
|
|
3
|
+
clone,
|
|
4
|
+
isPlainObject,
|
|
5
|
+
omitKeys
|
|
6
|
+
} from "./chunk-R4R5RHIS.js";
|
|
25
7
|
|
|
26
8
|
// src/sources.ts
|
|
27
9
|
var sectionKeySet = /* @__PURE__ */ new Set([
|
|
@@ -32,11 +14,9 @@ var sectionKeySet = /* @__PURE__ */ new Set([
|
|
|
32
14
|
"globalCss",
|
|
33
15
|
"globalVars",
|
|
34
16
|
"globalFontface",
|
|
35
|
-
"globalPositionTry",
|
|
36
17
|
"staticCss",
|
|
37
18
|
"themes"
|
|
38
19
|
]);
|
|
39
|
-
var omitKeys = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
40
20
|
var tokenKeys = /* @__PURE__ */ new Set(["description", "extensions", "type", "value", "deprecated"]);
|
|
41
21
|
var directFieldSections = /* @__PURE__ */ new Set(["patterns", "utilities"]);
|
|
42
22
|
var themeEntryKeys = /* @__PURE__ */ new Set([
|
|
@@ -47,7 +27,8 @@ var themeEntryKeys = /* @__PURE__ */ new Set([
|
|
|
47
27
|
"layerStyles",
|
|
48
28
|
"recipes",
|
|
49
29
|
"slotRecipes",
|
|
50
|
-
"textStyles"
|
|
30
|
+
"textStyles",
|
|
31
|
+
"viewTransitions"
|
|
51
32
|
]);
|
|
52
33
|
var SourceTracker = class {
|
|
53
34
|
sources;
|
|
@@ -115,37 +96,6 @@ function shouldTrackThemePath(rest, value, current) {
|
|
|
115
96
|
if (key === "containerNames" || key === "colorPalette") return rest.length <= 2;
|
|
116
97
|
return rest.length <= 2;
|
|
117
98
|
}
|
|
118
|
-
function isPlainObject(value) {
|
|
119
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
120
|
-
const proto = Object.getPrototypeOf(value);
|
|
121
|
-
return proto === Object.prototype || proto === null;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// src/shared.ts
|
|
125
|
-
var omitKeys2 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
126
|
-
function isPlainObject2(value) {
|
|
127
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
128
|
-
const proto = Object.getPrototypeOf(value);
|
|
129
|
-
return proto === Object.prototype || proto === null;
|
|
130
|
-
}
|
|
131
|
-
function clone(value) {
|
|
132
|
-
if (Array.isArray(value)) return value.map((item) => clone(item));
|
|
133
|
-
if (isPlainObject2(value)) {
|
|
134
|
-
const result = {};
|
|
135
|
-
for (const [key, item] of Object.entries(value)) {
|
|
136
|
-
if (item !== void 0 && !omitKeys2.has(key)) result[key] = clone(item);
|
|
137
|
-
}
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
return value;
|
|
141
|
-
}
|
|
142
|
-
function ensureConfigObject(config, name) {
|
|
143
|
-
if (isPlainObject2(config)) return config;
|
|
144
|
-
throw new PandaError("CONFIG_ERROR", `\u{1F4A5} Preset ${JSON.stringify(name)} must resolve to an object.`);
|
|
145
|
-
}
|
|
146
|
-
function errorMessage(error) {
|
|
147
|
-
return error instanceof Error ? error.message : String(error);
|
|
148
|
-
}
|
|
149
99
|
|
|
150
100
|
// src/merge.ts
|
|
151
101
|
var sectionKeys = [
|
|
@@ -156,13 +106,24 @@ var sectionKeys = [
|
|
|
156
106
|
"globalCss",
|
|
157
107
|
"globalVars",
|
|
158
108
|
"globalFontface",
|
|
159
|
-
"globalPositionTry",
|
|
160
109
|
"staticCss",
|
|
161
110
|
"themes"
|
|
162
111
|
];
|
|
163
112
|
var sectionKeySet2 = new Set(sectionKeys);
|
|
164
113
|
var runtimeOnlyKeys = /* @__PURE__ */ new Set(["presets", "plugins", "hooks", "name", "extend"]);
|
|
165
114
|
var tokenKeys2 = /* @__PURE__ */ new Set(["description", "extensions", "type", "value", "deprecated"]);
|
|
115
|
+
var themeRegistryKeys = /* @__PURE__ */ new Set([
|
|
116
|
+
"tokens",
|
|
117
|
+
"semanticTokens",
|
|
118
|
+
"keyframes",
|
|
119
|
+
"recipes",
|
|
120
|
+
"slotRecipes",
|
|
121
|
+
"textStyles",
|
|
122
|
+
"layerStyles",
|
|
123
|
+
"animationStyles",
|
|
124
|
+
"viewTransitions",
|
|
125
|
+
"positionTry"
|
|
126
|
+
]);
|
|
166
127
|
function mergeConfigsWithSources(configs) {
|
|
167
128
|
const tracker = new SourceTracker(configs.map((item) => item.source));
|
|
168
129
|
const config = mergeConfigs(configs, tracker);
|
|
@@ -175,13 +136,15 @@ function mergeConfigs(configs, tracker) {
|
|
|
175
136
|
const config = tracker ? configs[index].config : configs[index];
|
|
176
137
|
const context = tracker ? { tracker, sourceId: index, path: [] } : void 0;
|
|
177
138
|
for (const [key, value] of Object.entries(config)) {
|
|
178
|
-
if (value === void 0 || sectionKeySet2.has(key) || runtimeOnlyKeys.has(key) ||
|
|
139
|
+
if (value === void 0 || sectionKeySet2.has(key) || runtimeOnlyKeys.has(key) || omitKeys.has(key)) continue;
|
|
179
140
|
result[key] = clone(value);
|
|
180
141
|
context?.tracker.record([key], context.sourceId, "replace");
|
|
181
142
|
}
|
|
182
143
|
for (const key of sectionKeys) {
|
|
183
144
|
const section = config[key];
|
|
184
|
-
if (
|
|
145
|
+
if (!isPlainObject(section)) continue;
|
|
146
|
+
applySectionBase(key, sections[key], section, context);
|
|
147
|
+
applySectionExtend(key, sections[key], section, context);
|
|
185
148
|
}
|
|
186
149
|
}
|
|
187
150
|
for (const key of sectionKeys) {
|
|
@@ -190,21 +153,45 @@ function mergeConfigs(configs, tracker) {
|
|
|
190
153
|
if (result.theme?.tokens) normalizeNestedTokens(result.theme.tokens, tracker);
|
|
191
154
|
return result;
|
|
192
155
|
}
|
|
193
|
-
function
|
|
156
|
+
function applySectionBase(sectionName, target, section, context) {
|
|
194
157
|
const childContext = context && { ...context, path: [sectionName] };
|
|
195
158
|
for (const [key, value] of Object.entries(section)) {
|
|
196
|
-
if (key === "extend" || value === void 0 ||
|
|
197
|
-
|
|
159
|
+
if (key === "extend" || value === void 0 || omitKeys.has(key)) continue;
|
|
160
|
+
if (isRegistry(sectionName, key, value)) {
|
|
161
|
+
replaceRegistryEntries(target, key, value, childContext);
|
|
162
|
+
} else {
|
|
163
|
+
replaceValue(target, key, value, childContext);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function isRegistry(sectionName, key, value) {
|
|
168
|
+
return sectionName === "theme" && themeRegistryKeys.has(key) && isPlainObject(value);
|
|
169
|
+
}
|
|
170
|
+
function replaceRegistryEntries(target, key, registry, context) {
|
|
171
|
+
const entries = isPlainObject(target[key]) ? target[key] : target[key] = {};
|
|
172
|
+
const entryContext = context && { ...context, path: context.path.concat(key) };
|
|
173
|
+
for (const [name, value] of Object.entries(registry)) {
|
|
174
|
+
if (value === void 0 || omitKeys.has(name)) continue;
|
|
175
|
+
replaceValue(entries, name, value, entryContext);
|
|
198
176
|
}
|
|
177
|
+
}
|
|
178
|
+
function applySectionExtend(sectionName, target, section, context) {
|
|
199
179
|
if (section.extend === void 0) return;
|
|
200
|
-
if (!
|
|
180
|
+
if (!isPlainObject(section.extend)) {
|
|
201
181
|
throw new PandaError("CONFIG_ERROR", `\u{1F4A5} Config section \`${sectionName}.extend\` must be an object.`);
|
|
202
182
|
}
|
|
183
|
+
const childContext = context && { ...context, path: [sectionName] };
|
|
203
184
|
for (const [key, value] of Object.entries(section.extend)) {
|
|
204
|
-
if (value === void 0 ||
|
|
185
|
+
if (value === void 0 || omitKeys.has(key)) continue;
|
|
205
186
|
mergeValue(target, key, value, "concat", childContext);
|
|
206
187
|
}
|
|
207
188
|
}
|
|
189
|
+
function replaceValue(target, key, value, context) {
|
|
190
|
+
const path = context?.path.concat(key);
|
|
191
|
+
recordSource(context, path, value, target[key], "replace");
|
|
192
|
+
target[key] = clone(value);
|
|
193
|
+
recordNestedSources(context, path, value);
|
|
194
|
+
}
|
|
208
195
|
function mergeValue(target, key, value, arrayMode, context) {
|
|
209
196
|
const current = target[key];
|
|
210
197
|
const path = context?.path.concat(key);
|
|
@@ -213,11 +200,11 @@ function mergeValue(target, key, value, arrayMode, context) {
|
|
|
213
200
|
recordSource(context, path, value, current, arrayMode === "concat" ? "append" : "replace");
|
|
214
201
|
return;
|
|
215
202
|
}
|
|
216
|
-
if (
|
|
203
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
217
204
|
recordSource(context, path, value, current, "append");
|
|
218
205
|
const childContext = context && path ? { ...context, path } : void 0;
|
|
219
206
|
for (const [childKey, childValue] of Object.entries(value)) {
|
|
220
|
-
if (childValue !== void 0 && !
|
|
207
|
+
if (childValue !== void 0 && !omitKeys.has(childKey))
|
|
221
208
|
mergeValue(current, childKey, childValue, arrayMode, childContext);
|
|
222
209
|
}
|
|
223
210
|
return;
|
|
@@ -231,7 +218,7 @@ function normalizeNestedTokens(tokens, tracker) {
|
|
|
231
218
|
while (stack.length > 0) {
|
|
232
219
|
const current = stack.pop();
|
|
233
220
|
for (const [key, value] of Object.entries(current.value)) {
|
|
234
|
-
if (!
|
|
221
|
+
if (!isPlainObject(value)) continue;
|
|
235
222
|
if (isValidToken(value)) {
|
|
236
223
|
normalizeToken(value, tracker, current.path.concat(key));
|
|
237
224
|
} else {
|
|
@@ -264,12 +251,6 @@ function isValidToken(token) {
|
|
|
264
251
|
}
|
|
265
252
|
|
|
266
253
|
export {
|
|
267
|
-
PandaError,
|
|
268
|
-
createConfigError,
|
|
269
|
-
createConfigDiagnostic,
|
|
270
|
-
isPlainObject2 as isPlainObject,
|
|
271
|
-
ensureConfigObject,
|
|
272
|
-
errorMessage,
|
|
273
254
|
mergeConfigsWithSources,
|
|
274
255
|
mergeConfigs
|
|
275
256
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// src/error.ts
|
|
2
|
+
var PandaError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
hint;
|
|
5
|
+
diagnostics;
|
|
6
|
+
constructor(code, message, opts) {
|
|
7
|
+
super(message, { cause: opts?.cause });
|
|
8
|
+
this.code = `ERR_PANDA_${code}`;
|
|
9
|
+
this.hint = opts?.hint;
|
|
10
|
+
this.diagnostics = opts?.diagnostics;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function createConfigError(message, diagnostics) {
|
|
14
|
+
return new PandaError("CONFIG_ERROR", `\u{1F4A5} ${message}`, { diagnostics });
|
|
15
|
+
}
|
|
16
|
+
function createConfigDiagnostic(code, message, help) {
|
|
17
|
+
return {
|
|
18
|
+
code,
|
|
19
|
+
message,
|
|
20
|
+
severity: "error",
|
|
21
|
+
category: "config",
|
|
22
|
+
...help ? { help } : {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/shared.ts
|
|
27
|
+
var omitKeys = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
28
|
+
function isPlainObject(value) {
|
|
29
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
30
|
+
const proto = Object.getPrototypeOf(value);
|
|
31
|
+
return proto === Object.prototype || proto === null;
|
|
32
|
+
}
|
|
33
|
+
function clone(value) {
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
const len = value.length;
|
|
36
|
+
const out2 = new Array(len);
|
|
37
|
+
for (let i = 0; i < len; i++) out2[i] = clone(value[i]);
|
|
38
|
+
return out2;
|
|
39
|
+
}
|
|
40
|
+
if (!isPlainObject(value)) return value;
|
|
41
|
+
const source = value;
|
|
42
|
+
const out = {};
|
|
43
|
+
const keys = Object.keys(source);
|
|
44
|
+
for (let i = 0; i < keys.length; i++) {
|
|
45
|
+
const key = keys[i];
|
|
46
|
+
if (omitKeys.has(key)) continue;
|
|
47
|
+
const item = source[key];
|
|
48
|
+
if (item !== void 0) out[key] = clone(item);
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
function ensureConfigObject(config, name) {
|
|
53
|
+
if (isPlainObject(config)) return config;
|
|
54
|
+
throw new PandaError("CONFIG_ERROR", `\u{1F4A5} Preset ${JSON.stringify(name)} must resolve to an object.`);
|
|
55
|
+
}
|
|
56
|
+
function errorMessage(error) {
|
|
57
|
+
return error instanceof Error ? error.message : String(error);
|
|
58
|
+
}
|
|
59
|
+
function compact(value) {
|
|
60
|
+
return Object.fromEntries(Object.entries(value ?? {}).filter(([, item]) => item !== void 0));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
PandaError,
|
|
65
|
+
createConfigError,
|
|
66
|
+
createConfigDiagnostic,
|
|
67
|
+
omitKeys,
|
|
68
|
+
isPlainObject,
|
|
69
|
+
clone,
|
|
70
|
+
ensureConfigObject,
|
|
71
|
+
errorMessage,
|
|
72
|
+
compact
|
|
73
|
+
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compact,
|
|
3
|
+
createConfigError,
|
|
4
|
+
isPlainObject
|
|
5
|
+
} from "./chunk-R4R5RHIS.js";
|
|
6
|
+
|
|
1
7
|
// src/serialize.ts
|
|
2
8
|
import {
|
|
3
9
|
normalizeImportMap
|
|
@@ -5,7 +11,6 @@ import {
|
|
|
5
11
|
import { stringify } from "javascript-stringify";
|
|
6
12
|
|
|
7
13
|
// src/hooks.ts
|
|
8
|
-
var compact = (value) => Object.fromEntries(Object.entries(value ?? {}).filter(([, item]) => item !== void 0));
|
|
9
14
|
function serializeHooks(config, callbacks, sanitize2, hashCallbackSource2) {
|
|
10
15
|
const parserBefore = collectPluginHookHandlers(config, "parser:before").map((entry, index) => {
|
|
11
16
|
const hook = normalizeHook(entry.value, "parser:before");
|
|
@@ -46,10 +51,55 @@ function normalizeHook(value, name) {
|
|
|
46
51
|
return { filter: record.filter, handler: record.handler };
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
// src/utility-global-vars.ts
|
|
55
|
+
function mergeUtilityGlobalVars(config) {
|
|
56
|
+
const utilities = config.utilities;
|
|
57
|
+
if (!isPlainObject(utilities)) return config;
|
|
58
|
+
const merged = {};
|
|
59
|
+
const owners = /* @__PURE__ */ new Map();
|
|
60
|
+
let found = false;
|
|
61
|
+
const nextUtilities = {};
|
|
62
|
+
for (const [name, utility] of Object.entries(utilities)) {
|
|
63
|
+
if (!isPlainObject(utility) || !isPlainObject(utility.globalVars)) {
|
|
64
|
+
nextUtilities[name] = utility;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
found = true;
|
|
68
|
+
const { globalVars, ...rest } = utility;
|
|
69
|
+
nextUtilities[name] = rest;
|
|
70
|
+
for (const [key, definition] of Object.entries(globalVars)) {
|
|
71
|
+
const previous = merged[key];
|
|
72
|
+
if (previous !== void 0 && !isSameDefinition(previous, definition)) {
|
|
73
|
+
throw createConfigError(
|
|
74
|
+
`The \`${owners.get(key)}\` and \`${name}\` utilities both register \`${key}\`, with different definitions.
|
|
75
|
+
A CSS variable has one registration for the whole document, so share one definition between them.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
merged[key] = definition;
|
|
79
|
+
owners.set(key, name);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!found) return config;
|
|
83
|
+
const configVars = isPlainObject(config.globalVars) ? config.globalVars : {};
|
|
84
|
+
return {
|
|
85
|
+
...config,
|
|
86
|
+
utilities: nextUtilities,
|
|
87
|
+
globalVars: { ...merged, ...configVars },
|
|
88
|
+
utilityGlobalVars: Object.fromEntries(owners)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function isSameDefinition(a, b) {
|
|
92
|
+
if (a === b) return true;
|
|
93
|
+
if (!isPlainObject(a) || !isPlainObject(b)) return false;
|
|
94
|
+
const keys = Object.keys(a);
|
|
95
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
96
|
+
return keys.every((key) => a[key] === b[key]);
|
|
97
|
+
}
|
|
98
|
+
|
|
49
99
|
// src/serialize.ts
|
|
50
|
-
var compact2 = (value) => Object.fromEntries(Object.entries(value ?? {}).filter(([, item]) => item !== void 0));
|
|
51
100
|
var runtimeOnlyKeys = /* @__PURE__ */ new Set(["hooks", "plugins", "presets", "name"]);
|
|
52
|
-
function createConfigSnapshot(
|
|
101
|
+
function createConfigSnapshot(input) {
|
|
102
|
+
const config = mergeUtilityGlobalVars(input);
|
|
53
103
|
const callbacks = {};
|
|
54
104
|
const hooks = serializeHooks(config, callbacks, sanitize, hashCallbackSource);
|
|
55
105
|
const serialized = {
|
|
@@ -94,7 +144,7 @@ function attachPatternCodegenSource(serialized, config) {
|
|
|
94
144
|
if (!patterns || !serializedPatterns) return;
|
|
95
145
|
for (const [name, pattern] of Object.entries(patterns)) {
|
|
96
146
|
if (typeof pattern?.transform !== "function") continue;
|
|
97
|
-
const source = stringify(
|
|
147
|
+
const source = stringify(compact({ transform: pattern.transform, defaultValues: pattern.defaultValues })) ?? "";
|
|
98
148
|
if (serializedPatterns[name]) serializedPatterns[name].codegenSource = source;
|
|
99
149
|
}
|
|
100
150
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DesignSystemManifest, SerializedConfig, ProjectCallbacks, ProjectHooks, ConfigSnapshot, DiffConfigResult, DesignSystemManifestImportMap } from '@pandacss/compiler-shared';
|
|
1
|
+
import { DesignSystemManifest, CodegenOverlay, Diagnostic, SerializedConfig, ProjectCallbacks, ProjectHooks, ConfigSnapshot, DiffConfigResult, DesignSystemManifestImportMap } from '@pandacss/compiler-shared';
|
|
2
2
|
export { DiffConfigResult } from '@pandacss/compiler-shared';
|
|
3
3
|
import { HookRegistry, Config, UserConfig } from '@pandacss/types';
|
|
4
|
-
import { C as ConfigSources } from './merge-
|
|
5
|
-
export { a as ConfigSourceEntry, m as mergeConfigs } from './merge-
|
|
4
|
+
import { C as ConfigSources } from './merge-EXcM0jFd.js';
|
|
5
|
+
export { a as ConfigSourceEntry, m as mergeConfigs } from './merge-EXcM0jFd.js';
|
|
6
6
|
export { ConfigSnapshot, createConfigSnapshot } from './serialize.js';
|
|
7
7
|
|
|
8
8
|
interface PluginHookEntry<Name extends keyof HookRegistry> {
|
|
@@ -13,8 +13,19 @@ interface PluginHookEntry<Name extends keyof HookRegistry> {
|
|
|
13
13
|
type HostHooks = {
|
|
14
14
|
'codegen:prepare'?: Array<PluginHookEntry<'codegen:prepare'>>;
|
|
15
15
|
'codegen:done'?: Array<PluginHookEntry<'codegen:done'>>;
|
|
16
|
+
'cssgen:done'?: Array<PluginHookEntry<'cssgen:done'>>;
|
|
16
17
|
};
|
|
17
18
|
|
|
19
|
+
interface DesignSystemOverlayInput {
|
|
20
|
+
authored: {
|
|
21
|
+
conditions: boolean;
|
|
22
|
+
breakpoints: boolean;
|
|
23
|
+
utilities: boolean;
|
|
24
|
+
tokens: boolean;
|
|
25
|
+
};
|
|
26
|
+
compatible: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
18
29
|
interface ResolvedDesignSystem {
|
|
19
30
|
name: string;
|
|
20
31
|
specifier: string;
|
|
@@ -23,8 +34,27 @@ interface ResolvedDesignSystem {
|
|
|
23
34
|
buildInfoPath: string;
|
|
24
35
|
files: string[];
|
|
25
36
|
tokenPaths: string[];
|
|
37
|
+
recipeNames: string[];
|
|
38
|
+
patternNames: string[];
|
|
26
39
|
importMap?: DesignSystemManifest['importMap'];
|
|
40
|
+
packageExports?: Record<string, unknown>;
|
|
41
|
+
optionMismatch?: string[];
|
|
27
42
|
}
|
|
43
|
+
interface DesignSystemMetadata {
|
|
44
|
+
designSystem?: ResolvedDesignSystem[];
|
|
45
|
+
userRecipeNames?: string[];
|
|
46
|
+
userPatternNames?: string[];
|
|
47
|
+
overlayInput?: DesignSystemOverlayInput;
|
|
48
|
+
}
|
|
49
|
+
declare function buildCodegenOverlay(metadata: DesignSystemMetadata | undefined): CodegenOverlay | undefined;
|
|
50
|
+
interface DesignSystemArtifactConflict {
|
|
51
|
+
name: string;
|
|
52
|
+
recipes: string[];
|
|
53
|
+
patterns: string[];
|
|
54
|
+
}
|
|
55
|
+
declare function collectArtifactConflicts(metadata: DesignSystemMetadata | undefined): DesignSystemArtifactConflict[];
|
|
56
|
+
declare function collectExportMissingDiagnostics(metadata: DesignSystemMetadata | undefined): Diagnostic[];
|
|
57
|
+
declare function collectNameCollisionDiagnostics(metadata: DesignSystemMetadata | undefined): Diagnostic[];
|
|
28
58
|
|
|
29
59
|
interface LoadConfigOptions {
|
|
30
60
|
cwd: string;
|
|
@@ -50,6 +80,9 @@ interface LoadConfigResult {
|
|
|
50
80
|
sources?: ConfigSources;
|
|
51
81
|
designSystem?: ResolvedDesignSystem[];
|
|
52
82
|
userTokenPaths?: string[];
|
|
83
|
+
userRecipeNames?: string[];
|
|
84
|
+
userPatternNames?: string[];
|
|
85
|
+
overlayInput?: DesignSystemOverlayInput;
|
|
53
86
|
};
|
|
54
87
|
}
|
|
55
88
|
|
|
@@ -94,15 +127,9 @@ interface BundleConfigResult<T = Config> {
|
|
|
94
127
|
*/
|
|
95
128
|
declare function bundleConfig<T extends Config = Config>(filepath: string, cwd: string): Promise<BundleConfigResult<T>>;
|
|
96
129
|
|
|
97
|
-
interface SmartIncludeResult {
|
|
98
|
-
include: string[];
|
|
99
|
-
excludes: string[];
|
|
100
|
-
changed: boolean;
|
|
101
|
-
}
|
|
102
|
-
declare function resolveSmartInclude(include: string[], cwd: string, deps: Set<string>): SmartIncludeResult;
|
|
103
|
-
declare function mergeExcludes(existing: string[] | undefined, additions: string[]): string[];
|
|
104
|
-
|
|
105
130
|
declare function readPandaVersion(): string | undefined;
|
|
131
|
+
declare function getPandaMajorRange(): string | undefined;
|
|
132
|
+
declare function isStampablePandaRange(range: string | undefined): range is string;
|
|
106
133
|
|
|
107
134
|
interface CompilePresetResult {
|
|
108
135
|
code: string;
|
|
@@ -119,22 +146,63 @@ interface PackageIdentity {
|
|
|
119
146
|
version?: string;
|
|
120
147
|
pandaPeer?: string;
|
|
121
148
|
packagePath: string;
|
|
149
|
+
/** package.json `"files"` when it's a string array; used for lib fallback publish checks. */
|
|
150
|
+
publishFiles?: string[];
|
|
122
151
|
}
|
|
152
|
+
declare function resolvePublishedPandaRange(range: string | undefined, currentVersion: string | undefined): string;
|
|
123
153
|
declare function readPackageIdentity(cwd: string): PackageIdentity;
|
|
124
154
|
declare function defaultImportMap(name: string): DesignSystemManifestImportMap;
|
|
125
155
|
interface SyncExportsResult {
|
|
126
156
|
changed: boolean;
|
|
127
157
|
json: string;
|
|
158
|
+
/** Existing subpaths whose value differed from the one Panda wrote (overwritten). */
|
|
159
|
+
conflicts: string[];
|
|
128
160
|
}
|
|
129
161
|
interface SyncExportsOptions {
|
|
130
162
|
packageJson: string;
|
|
131
|
-
entries: Record<string,
|
|
163
|
+
entries: Record<string, unknown>;
|
|
132
164
|
}
|
|
133
165
|
declare function syncExports(options: SyncExportsOptions): SyncExportsResult;
|
|
166
|
+
|
|
167
|
+
interface FilterPublishableLibFilesOptions {
|
|
168
|
+
/** Fallback paths relative to the lib outdir (same form as manifest `files`). */
|
|
169
|
+
files: string[];
|
|
170
|
+
packageRoot: string;
|
|
171
|
+
/** Lib outdir — resolve `files` entries from here. */
|
|
172
|
+
outRoot: string;
|
|
173
|
+
/** package.json `"files"`; omit when the whole package is packed. */
|
|
174
|
+
publishFiles?: string[];
|
|
175
|
+
}
|
|
176
|
+
interface FilterPublishableLibFilesResult {
|
|
177
|
+
files: string[];
|
|
178
|
+
unpublished: string[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Drop inferred lib fallback paths that would not ship in the npm tarball when
|
|
182
|
+
* package.json `"files"` is set. Explicit `--files` should skip this filter.
|
|
183
|
+
*
|
|
184
|
+
* Runs once at `panda lib` time (not on consume/cssgen). Patterns are compiled
|
|
185
|
+
* once per call; the common `"files": ["dist"]` case is prefix-only.
|
|
186
|
+
*/
|
|
187
|
+
declare function filterPublishableLibFiles(options: FilterPublishableLibFilesOptions): FilterPublishableLibFilesResult;
|
|
188
|
+
/** Read package.json `"files"` when it is a non-empty string array. */
|
|
189
|
+
declare function readPublishFilesField(value: unknown): string[] | undefined;
|
|
190
|
+
|
|
191
|
+
interface SmartIncludeResult {
|
|
192
|
+
include: string[];
|
|
193
|
+
excludes: string[];
|
|
194
|
+
changed: boolean;
|
|
195
|
+
}
|
|
196
|
+
declare function resolveSmartInclude(include: string[], cwd: string, deps: Set<string>): SmartIncludeResult;
|
|
197
|
+
declare function mergeExcludes(existing: string[] | undefined, additions: string[]): string[];
|
|
198
|
+
|
|
199
|
+
declare function collectTokenPaths(config: Pick<UserConfig, 'theme'> | undefined): string[];
|
|
200
|
+
|
|
134
201
|
declare function toPosixPath(path: string): string;
|
|
135
202
|
declare function toPosixRelative(from: string, to: string): string;
|
|
136
203
|
declare function toRelativeKey(key: string, cwd: string): string;
|
|
137
204
|
|
|
138
|
-
declare function
|
|
205
|
+
declare function collectRecipeNames(config: Pick<UserConfig, 'theme'> | undefined): string[];
|
|
206
|
+
declare function collectPatternNames(config: Pick<UserConfig, 'patterns'> | undefined): string[];
|
|
139
207
|
|
|
140
|
-
export { type BundleConfigResult, type CompilePresetOptions, type CompilePresetResult, ConfigSources, type HostHooks, type LoadConfigOptions, type LoadConfigResult, type PackageIdentity, type SyncExportsOptions, type SyncExportsResult, bundleConfig, collectTokenPaths, compilePreset, defaultImportMap, diffConfig, findConfig, loadConfig, mergeExcludes, readPackageIdentity, readPandaVersion, resolveSmartInclude, syncExports, toPosixPath, toPosixRelative, toRelativeKey };
|
|
208
|
+
export { type BundleConfigResult, type CompilePresetOptions, type CompilePresetResult, ConfigSources, type DesignSystemArtifactConflict, type DesignSystemMetadata, type DesignSystemOverlayInput, type FilterPublishableLibFilesOptions, type FilterPublishableLibFilesResult, type HostHooks, type LoadConfigOptions, type LoadConfigResult, type PackageIdentity, type ResolvedDesignSystem, type SyncExportsOptions, type SyncExportsResult, buildCodegenOverlay, bundleConfig, collectArtifactConflicts, collectExportMissingDiagnostics, collectNameCollisionDiagnostics, collectPatternNames, collectRecipeNames, collectTokenPaths, compilePreset, defaultImportMap, diffConfig, filterPublishableLibFiles, findConfig, getPandaMajorRange, isStampablePandaRange, loadConfig, mergeExcludes, readPackageIdentity, readPandaVersion, readPublishFilesField, resolvePublishedPandaRange, resolveSmartInclude, syncExports, toPosixPath, toPosixRelative, toRelativeKey };
|