@pandacss/shared 0.0.0-dev-20230116230229 → 0.0.0-dev-20230118102146
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/index.d.ts +3 -8
- package/dist/index.js +22 -1
- package/dist/index.mjs +21 -1
- package/dist/{hash-95bc50e7.d.ts → merge-e05e5f23.d.ts} +8 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +28 -5
- package/dist/shared.mjs +26 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './
|
|
2
|
-
export { C as CreateCssContext, M as MappedObject,
|
|
3
|
-
|
|
4
|
-
declare const isString: (v: any) => v is string;
|
|
5
|
-
type AnyFunction = (...args: any[]) => any;
|
|
6
|
-
declare const isFunction: (v: any) => v is AnyFunction;
|
|
7
|
-
declare function isObject(value: any): value is Record<string, any>;
|
|
1
|
+
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './merge-e05e5f23.js';
|
|
2
|
+
export { C as CreateCssContext, M as MappedObject, k as WalkObjectOptions, W as WalkObjectStopFn, d as compact, c as createCss, j as deepMerge, f as filterBaseConditions, e as isBaseCondition, a as isFunction, g as isImportant, b as isObject, i as isString, m as mapObject, t as toHash, l as walkObject, w as withoutImportant, h as withoutSpace } from './merge-e05e5f23.js';
|
|
8
3
|
|
|
9
4
|
type Operand = string | number | {
|
|
10
5
|
ref: string;
|
|
@@ -57,4 +52,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
|
|
|
57
52
|
|
|
58
53
|
declare function unionType(values: IterableIterator<string> | string[] | Set<string>): string;
|
|
59
54
|
|
|
60
|
-
export { CssVar, CssVarOptions, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit,
|
|
55
|
+
export { CssVar, CssVarOptions, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, memo, normalizeStyleObject, splitBy, splitDotPath, splitObject, toEm, toPx, toRem, uncapitalize, unionType };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(src_exports, {
|
|
|
26
26
|
createCss: () => createCss,
|
|
27
27
|
cssVar: () => cssVar,
|
|
28
28
|
dashCase: () => dashCase,
|
|
29
|
+
deepMerge: () => deepMerge,
|
|
29
30
|
esc: () => esc2,
|
|
30
31
|
filterBaseConditions: () => filterBaseConditions,
|
|
31
32
|
flatten: () => flatten,
|
|
@@ -60,7 +61,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
60
61
|
var isString = (v) => typeof v === "string";
|
|
61
62
|
var isFunction = (v) => typeof v === "function";
|
|
62
63
|
function isObject(value) {
|
|
63
|
-
return typeof value === "object" && value
|
|
64
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
// src/calc.ts
|
|
@@ -322,6 +323,25 @@ var memo = (fn) => {
|
|
|
322
323
|
return get;
|
|
323
324
|
};
|
|
324
325
|
|
|
326
|
+
// src/merge.ts
|
|
327
|
+
function deepMerge(...sources) {
|
|
328
|
+
const allSources = sources.filter(isObject);
|
|
329
|
+
if (allSources.length === 1) {
|
|
330
|
+
return allSources[0];
|
|
331
|
+
}
|
|
332
|
+
const result = {};
|
|
333
|
+
for (const source of allSources) {
|
|
334
|
+
for (const [key, value] of Object.entries(source)) {
|
|
335
|
+
if (isObject(value)) {
|
|
336
|
+
result[key] = deepMerge(result[key] || {}, value);
|
|
337
|
+
} else {
|
|
338
|
+
result[key] = value;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
|
|
325
345
|
// src/split.ts
|
|
326
346
|
function splitBy(value, separator = ",") {
|
|
327
347
|
const result = [];
|
|
@@ -410,6 +430,7 @@ function unionType(values) {
|
|
|
410
430
|
createCss,
|
|
411
431
|
cssVar,
|
|
412
432
|
dashCase,
|
|
433
|
+
deepMerge,
|
|
413
434
|
esc,
|
|
414
435
|
filterBaseConditions,
|
|
415
436
|
flatten,
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var isString = (v) => typeof v === "string";
|
|
3
3
|
var isFunction = (v) => typeof v === "function";
|
|
4
4
|
function isObject(value) {
|
|
5
|
-
return typeof value === "object" && value
|
|
5
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
// src/calc.ts
|
|
@@ -264,6 +264,25 @@ var memo = (fn) => {
|
|
|
264
264
|
return get;
|
|
265
265
|
};
|
|
266
266
|
|
|
267
|
+
// src/merge.ts
|
|
268
|
+
function deepMerge(...sources) {
|
|
269
|
+
const allSources = sources.filter(isObject);
|
|
270
|
+
if (allSources.length === 1) {
|
|
271
|
+
return allSources[0];
|
|
272
|
+
}
|
|
273
|
+
const result = {};
|
|
274
|
+
for (const source of allSources) {
|
|
275
|
+
for (const [key, value] of Object.entries(source)) {
|
|
276
|
+
if (isObject(value)) {
|
|
277
|
+
result[key] = deepMerge(result[key] || {}, value);
|
|
278
|
+
} else {
|
|
279
|
+
result[key] = value;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return result;
|
|
284
|
+
}
|
|
285
|
+
|
|
267
286
|
// src/split.ts
|
|
268
287
|
function splitBy(value, separator = ",") {
|
|
269
288
|
const result = [];
|
|
@@ -351,6 +370,7 @@ export {
|
|
|
351
370
|
createCss,
|
|
352
371
|
cssVar,
|
|
353
372
|
dashCase,
|
|
373
|
+
deepMerge,
|
|
354
374
|
esc2 as esc,
|
|
355
375
|
filterBaseConditions,
|
|
356
376
|
flatten,
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
declare const isString: (v: any) => v is string;
|
|
2
|
+
type AnyFunction = (...args: any[]) => any;
|
|
3
|
+
declare const isFunction: (v: any) => v is AnyFunction;
|
|
4
|
+
declare function isObject(value: any): value is Record<string, any>;
|
|
5
|
+
|
|
1
6
|
type CreateCssContext = {
|
|
2
7
|
hash?: boolean;
|
|
3
8
|
/**
|
|
@@ -46,4 +51,6 @@ declare function mapObject(obj: any, fn: (value: any) => any): any;
|
|
|
46
51
|
|
|
47
52
|
declare function toHash(value: string): string;
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
declare function deepMerge<T extends Record<string, unknown>>(...sources: T[]): T;
|
|
55
|
+
|
|
56
|
+
export { CreateCssContext as C, MappedObject as M, WalkObjectStopFn as W, isFunction as a, isObject as b, createCss as c, compact as d, isBaseCondition as e, filterBaseConditions as f, isImportant as g, withoutSpace as h, isString as i, deepMerge as j, WalkObjectOptions as k, walkObject as l, mapObject as m, toHash as t, withoutImportant as w };
|
package/dist/shared.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as compact, c as createCss, j as deepMerge, f as filterBaseConditions, e as isBaseCondition, b as isObject, m as mapObject, t as toHash, l as walkObject, h as withoutSpace } from './merge-e05e5f23.js';
|
package/dist/shared.js
CHANGED
|
@@ -22,8 +22,10 @@ var shared_exports = {};
|
|
|
22
22
|
__export(shared_exports, {
|
|
23
23
|
compact: () => compact,
|
|
24
24
|
createCss: () => createCss,
|
|
25
|
+
deepMerge: () => deepMerge,
|
|
25
26
|
filterBaseConditions: () => filterBaseConditions,
|
|
26
27
|
isBaseCondition: () => isBaseCondition,
|
|
28
|
+
isObject: () => isObject,
|
|
27
29
|
mapObject: () => mapObject,
|
|
28
30
|
toHash: () => toHash,
|
|
29
31
|
walkObject: () => walkObject,
|
|
@@ -31,6 +33,11 @@ __export(shared_exports, {
|
|
|
31
33
|
});
|
|
32
34
|
module.exports = __toCommonJS(shared_exports);
|
|
33
35
|
|
|
36
|
+
// src/assert.ts
|
|
37
|
+
function isObject(value) {
|
|
38
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
// src/condition.ts
|
|
35
42
|
var isBaseCondition = (v) => v === "base";
|
|
36
43
|
function filterBaseConditions(c) {
|
|
@@ -69,11 +76,6 @@ function toHash(value) {
|
|
|
69
76
|
return toName(toPhash(5381, value) >>> 0);
|
|
70
77
|
}
|
|
71
78
|
|
|
72
|
-
// src/assert.ts
|
|
73
|
-
function isObject(value) {
|
|
74
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
79
|
// src/walk-object.ts
|
|
78
80
|
function walkObject(target, predicate, options = {}) {
|
|
79
81
|
const { stop, getKey } = options;
|
|
@@ -162,12 +164,33 @@ function createCss(context) {
|
|
|
162
164
|
function compact(value) {
|
|
163
165
|
return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
|
|
164
166
|
}
|
|
167
|
+
|
|
168
|
+
// src/merge.ts
|
|
169
|
+
function deepMerge(...sources) {
|
|
170
|
+
const allSources = sources.filter(isObject);
|
|
171
|
+
if (allSources.length === 1) {
|
|
172
|
+
return allSources[0];
|
|
173
|
+
}
|
|
174
|
+
const result = {};
|
|
175
|
+
for (const source of allSources) {
|
|
176
|
+
for (const [key, value] of Object.entries(source)) {
|
|
177
|
+
if (isObject(value)) {
|
|
178
|
+
result[key] = deepMerge(result[key] || {}, value);
|
|
179
|
+
} else {
|
|
180
|
+
result[key] = value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
165
186
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
187
|
0 && (module.exports = {
|
|
167
188
|
compact,
|
|
168
189
|
createCss,
|
|
190
|
+
deepMerge,
|
|
169
191
|
filterBaseConditions,
|
|
170
192
|
isBaseCondition,
|
|
193
|
+
isObject,
|
|
171
194
|
mapObject,
|
|
172
195
|
toHash,
|
|
173
196
|
walkObject,
|
package/dist/shared.mjs
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// src/assert.ts
|
|
2
|
+
function isObject(value) {
|
|
3
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
// src/condition.ts
|
|
2
7
|
var isBaseCondition = (v) => v === "base";
|
|
3
8
|
function filterBaseConditions(c) {
|
|
@@ -36,11 +41,6 @@ function toHash(value) {
|
|
|
36
41
|
return toName(toPhash(5381, value) >>> 0);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
// src/assert.ts
|
|
40
|
-
function isObject(value) {
|
|
41
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
44
|
// src/walk-object.ts
|
|
45
45
|
function walkObject(target, predicate, options = {}) {
|
|
46
46
|
const { stop, getKey } = options;
|
|
@@ -129,11 +129,32 @@ function createCss(context) {
|
|
|
129
129
|
function compact(value) {
|
|
130
130
|
return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
// src/merge.ts
|
|
134
|
+
function deepMerge(...sources) {
|
|
135
|
+
const allSources = sources.filter(isObject);
|
|
136
|
+
if (allSources.length === 1) {
|
|
137
|
+
return allSources[0];
|
|
138
|
+
}
|
|
139
|
+
const result = {};
|
|
140
|
+
for (const source of allSources) {
|
|
141
|
+
for (const [key, value] of Object.entries(source)) {
|
|
142
|
+
if (isObject(value)) {
|
|
143
|
+
result[key] = deepMerge(result[key] || {}, value);
|
|
144
|
+
} else {
|
|
145
|
+
result[key] = value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
132
151
|
export {
|
|
133
152
|
compact,
|
|
134
153
|
createCss,
|
|
154
|
+
deepMerge,
|
|
135
155
|
filterBaseConditions,
|
|
136
156
|
isBaseCondition,
|
|
157
|
+
isObject,
|
|
137
158
|
mapObject,
|
|
138
159
|
toHash,
|
|
139
160
|
walkObject,
|