@pandacss/shared 0.53.7 → 1.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/astish.js +4 -8
- package/dist/astish.mjs +4 -8
- package/dist/index.d.mts +7 -23
- package/dist/index.d.ts +7 -23
- package/dist/index.js +496 -179
- package/dist/index.mjs +493 -176
- package/dist/shared.js +11 -22
- package/dist/shared.mjs +11 -22
- package/package.json +1 -1
package/dist/shared.js
CHANGED
|
@@ -66,14 +66,12 @@ function toChar(code) {
|
|
|
66
66
|
function toName(code) {
|
|
67
67
|
let name = "";
|
|
68
68
|
let x;
|
|
69
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
70
|
-
name = toChar(x % 52) + name;
|
|
69
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
|
|
71
70
|
return toChar(x % 52) + name;
|
|
72
71
|
}
|
|
73
72
|
function toPhash(h, x) {
|
|
74
73
|
let i = x.length;
|
|
75
|
-
while (i)
|
|
76
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
74
|
+
while (i) h = h * 33 ^ x.charCodeAt(--i);
|
|
77
75
|
return h;
|
|
78
76
|
}
|
|
79
77
|
function toHash(value) {
|
|
@@ -111,11 +109,9 @@ var memo = (fn) => {
|
|
|
111
109
|
var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
112
110
|
function mergeProps(...sources) {
|
|
113
111
|
return sources.reduce((prev, obj) => {
|
|
114
|
-
if (!obj)
|
|
115
|
-
return prev;
|
|
112
|
+
if (!obj) return prev;
|
|
116
113
|
Object.keys(obj).forEach((key) => {
|
|
117
|
-
if (MERGE_OMIT.has(key))
|
|
118
|
-
return;
|
|
114
|
+
if (MERGE_OMIT.has(key)) return;
|
|
119
115
|
const prevValue = prev[key];
|
|
120
116
|
const value = obj[key];
|
|
121
117
|
if (isObject(prevValue) && isObject(value)) {
|
|
@@ -153,10 +149,8 @@ function walkObject(target, predicate, options = {}) {
|
|
|
153
149
|
return inner(target);
|
|
154
150
|
}
|
|
155
151
|
function mapObject(obj, fn) {
|
|
156
|
-
if (Array.isArray(obj))
|
|
157
|
-
|
|
158
|
-
if (!isObject(obj))
|
|
159
|
-
return fn(obj);
|
|
152
|
+
if (Array.isArray(obj)) return obj.map((value) => fn(value));
|
|
153
|
+
if (!isObject(obj)) return fn(obj);
|
|
160
154
|
return walkObject(obj, (value) => fn(value));
|
|
161
155
|
}
|
|
162
156
|
|
|
@@ -214,15 +208,13 @@ function createCss(context) {
|
|
|
214
208
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
215
209
|
const classNames = /* @__PURE__ */ new Set();
|
|
216
210
|
walkObject(normalizedObject, (value, paths) => {
|
|
217
|
-
if (value == null)
|
|
218
|
-
return;
|
|
211
|
+
if (value == null) return;
|
|
219
212
|
const important = isImportant(value);
|
|
220
213
|
const [prop, ...allConditions] = conds.shift(paths);
|
|
221
214
|
const conditions = filterBaseConditions(allConditions);
|
|
222
215
|
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
223
216
|
let className = hashFn(conditions, transformed.className);
|
|
224
|
-
if (important)
|
|
225
|
-
className = `${className}!`;
|
|
217
|
+
if (important) className = `${className}!`;
|
|
226
218
|
classNames.add(className);
|
|
227
219
|
});
|
|
228
220
|
return Array.from(classNames).join(" ");
|
|
@@ -234,8 +226,7 @@ function compactStyles(...styles) {
|
|
|
234
226
|
function createMergeCss(context) {
|
|
235
227
|
function resolve(styles) {
|
|
236
228
|
const allStyles = compactStyles(...styles);
|
|
237
|
-
if (allStyles.length === 1)
|
|
238
|
-
return allStyles;
|
|
229
|
+
if (allStyles.length === 1) return allStyles;
|
|
239
230
|
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
240
231
|
}
|
|
241
232
|
function mergeCss(...styles) {
|
|
@@ -251,8 +242,7 @@ function createMergeCss(context) {
|
|
|
251
242
|
var wordRegex = /([A-Z])/g;
|
|
252
243
|
var msRegex = /^ms-/;
|
|
253
244
|
var hypenateProperty = memo((property) => {
|
|
254
|
-
if (property.startsWith("--"))
|
|
255
|
-
return property;
|
|
245
|
+
if (property.startsWith("--")) return property;
|
|
256
246
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
257
247
|
});
|
|
258
248
|
|
|
@@ -278,8 +268,7 @@ var patternFns = {
|
|
|
278
268
|
isCssUnit
|
|
279
269
|
};
|
|
280
270
|
var getPatternStyles = (pattern, styles) => {
|
|
281
|
-
if (!pattern?.defaultValues)
|
|
282
|
-
return styles;
|
|
271
|
+
if (!pattern?.defaultValues) return styles;
|
|
283
272
|
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
284
273
|
return Object.assign({}, defaults, compact(styles));
|
|
285
274
|
};
|
package/dist/shared.mjs
CHANGED
|
@@ -22,14 +22,12 @@ function toChar(code) {
|
|
|
22
22
|
function toName(code) {
|
|
23
23
|
let name = "";
|
|
24
24
|
let x;
|
|
25
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
26
|
-
name = toChar(x % 52) + name;
|
|
25
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
|
|
27
26
|
return toChar(x % 52) + name;
|
|
28
27
|
}
|
|
29
28
|
function toPhash(h, x) {
|
|
30
29
|
let i = x.length;
|
|
31
|
-
while (i)
|
|
32
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
30
|
+
while (i) h = h * 33 ^ x.charCodeAt(--i);
|
|
33
31
|
return h;
|
|
34
32
|
}
|
|
35
33
|
function toHash(value) {
|
|
@@ -67,11 +65,9 @@ var memo = (fn) => {
|
|
|
67
65
|
var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
68
66
|
function mergeProps(...sources) {
|
|
69
67
|
return sources.reduce((prev, obj) => {
|
|
70
|
-
if (!obj)
|
|
71
|
-
return prev;
|
|
68
|
+
if (!obj) return prev;
|
|
72
69
|
Object.keys(obj).forEach((key) => {
|
|
73
|
-
if (MERGE_OMIT.has(key))
|
|
74
|
-
return;
|
|
70
|
+
if (MERGE_OMIT.has(key)) return;
|
|
75
71
|
const prevValue = prev[key];
|
|
76
72
|
const value = obj[key];
|
|
77
73
|
if (isObject(prevValue) && isObject(value)) {
|
|
@@ -109,10 +105,8 @@ function walkObject(target, predicate, options = {}) {
|
|
|
109
105
|
return inner(target);
|
|
110
106
|
}
|
|
111
107
|
function mapObject(obj, fn) {
|
|
112
|
-
if (Array.isArray(obj))
|
|
113
|
-
|
|
114
|
-
if (!isObject(obj))
|
|
115
|
-
return fn(obj);
|
|
108
|
+
if (Array.isArray(obj)) return obj.map((value) => fn(value));
|
|
109
|
+
if (!isObject(obj)) return fn(obj);
|
|
116
110
|
return walkObject(obj, (value) => fn(value));
|
|
117
111
|
}
|
|
118
112
|
|
|
@@ -170,15 +164,13 @@ function createCss(context) {
|
|
|
170
164
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
171
165
|
const classNames = /* @__PURE__ */ new Set();
|
|
172
166
|
walkObject(normalizedObject, (value, paths) => {
|
|
173
|
-
if (value == null)
|
|
174
|
-
return;
|
|
167
|
+
if (value == null) return;
|
|
175
168
|
const important = isImportant(value);
|
|
176
169
|
const [prop, ...allConditions] = conds.shift(paths);
|
|
177
170
|
const conditions = filterBaseConditions(allConditions);
|
|
178
171
|
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
179
172
|
let className = hashFn(conditions, transformed.className);
|
|
180
|
-
if (important)
|
|
181
|
-
className = `${className}!`;
|
|
173
|
+
if (important) className = `${className}!`;
|
|
182
174
|
classNames.add(className);
|
|
183
175
|
});
|
|
184
176
|
return Array.from(classNames).join(" ");
|
|
@@ -190,8 +182,7 @@ function compactStyles(...styles) {
|
|
|
190
182
|
function createMergeCss(context) {
|
|
191
183
|
function resolve(styles) {
|
|
192
184
|
const allStyles = compactStyles(...styles);
|
|
193
|
-
if (allStyles.length === 1)
|
|
194
|
-
return allStyles;
|
|
185
|
+
if (allStyles.length === 1) return allStyles;
|
|
195
186
|
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
196
187
|
}
|
|
197
188
|
function mergeCss(...styles) {
|
|
@@ -207,8 +198,7 @@ function createMergeCss(context) {
|
|
|
207
198
|
var wordRegex = /([A-Z])/g;
|
|
208
199
|
var msRegex = /^ms-/;
|
|
209
200
|
var hypenateProperty = memo((property) => {
|
|
210
|
-
if (property.startsWith("--"))
|
|
211
|
-
return property;
|
|
201
|
+
if (property.startsWith("--")) return property;
|
|
212
202
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
213
203
|
});
|
|
214
204
|
|
|
@@ -234,8 +224,7 @@ var patternFns = {
|
|
|
234
224
|
isCssUnit
|
|
235
225
|
};
|
|
236
226
|
var getPatternStyles = (pattern, styles) => {
|
|
237
|
-
if (!pattern?.defaultValues)
|
|
238
|
-
return styles;
|
|
227
|
+
if (!pattern?.defaultValues) return styles;
|
|
239
228
|
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
240
229
|
return Object.assign({}, defaults, compact(styles));
|
|
241
230
|
};
|