@pandacss/shared 0.29.0 → 0.30.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/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +24 -34
- package/dist/index.mjs +24 -33
- package/dist/{shared-bFj3Wgxk.d.mts → shared-z3agWt4M.d.mts} +2 -1
- package/dist/{shared-bFj3Wgxk.d.ts → shared-z3agWt4M.d.ts} +2 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +30 -38
- package/dist/shared.mjs +30 -38
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-
|
|
2
|
-
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-
|
|
1
|
+
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-z3agWt4M.mjs';
|
|
2
|
+
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-z3agWt4M.mjs';
|
|
3
3
|
export { astish } from './astish.mjs';
|
|
4
4
|
|
|
5
5
|
declare const getArbitraryValue: (_value: string) => string;
|
|
@@ -71,7 +71,6 @@ declare const isCssVar: (v: unknown) => boolean;
|
|
|
71
71
|
|
|
72
72
|
type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
|
|
73
73
|
declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
|
|
74
|
-
declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
|
|
75
74
|
declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
|
|
76
75
|
|
|
77
76
|
declare const createRegex: (item: Array<string | RegExp>) => RegExp;
|
|
@@ -105,4 +104,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
105
104
|
|
|
106
105
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
107
106
|
|
|
108
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson,
|
|
107
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-
|
|
2
|
-
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-
|
|
1
|
+
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-z3agWt4M.js';
|
|
2
|
+
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-z3agWt4M.js';
|
|
3
3
|
export { astish } from './astish.js';
|
|
4
4
|
|
|
5
5
|
declare const getArbitraryValue: (_value: string) => string;
|
|
@@ -71,7 +71,6 @@ declare const isCssVar: (v: unknown) => boolean;
|
|
|
71
71
|
|
|
72
72
|
type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
|
|
73
73
|
declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
|
|
74
|
-
declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
|
|
75
74
|
declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
|
|
76
75
|
|
|
77
76
|
declare const createRegex: (item: Array<string | RegExp>) => RegExp;
|
|
@@ -105,4 +104,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
105
104
|
|
|
106
105
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
107
106
|
|
|
108
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson,
|
|
107
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,6 @@ __export(src_exports, {
|
|
|
62
62
|
markImportant: () => markImportant,
|
|
63
63
|
memo: () => memo,
|
|
64
64
|
mergeProps: () => mergeProps,
|
|
65
|
-
normalizeShorthand: () => normalizeShorthand,
|
|
66
65
|
normalizeStyleObject: () => normalizeStyleObject,
|
|
67
66
|
parseJson: () => parseJson,
|
|
68
67
|
patternFns: () => patternFns,
|
|
@@ -202,6 +201,27 @@ function filterBaseConditions(c) {
|
|
|
202
201
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
203
202
|
}
|
|
204
203
|
|
|
204
|
+
// src/hash.ts
|
|
205
|
+
function toChar(code) {
|
|
206
|
+
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
207
|
+
}
|
|
208
|
+
function toName(code) {
|
|
209
|
+
let name = "";
|
|
210
|
+
let x;
|
|
211
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
212
|
+
name = toChar(x % 52) + name;
|
|
213
|
+
return toChar(x % 52) + name;
|
|
214
|
+
}
|
|
215
|
+
function toPhash(h, x) {
|
|
216
|
+
let i = x.length;
|
|
217
|
+
while (i)
|
|
218
|
+
h = h * 33 ^ x.charCodeAt(--i);
|
|
219
|
+
return h;
|
|
220
|
+
}
|
|
221
|
+
function toHash(value) {
|
|
222
|
+
return toName(toPhash(5381, value) >>> 0);
|
|
223
|
+
}
|
|
224
|
+
|
|
205
225
|
// src/important.ts
|
|
206
226
|
var importantRegex = /\s*!(important)?/i;
|
|
207
227
|
function isImportant(value) {
|
|
@@ -236,27 +256,6 @@ function markImportant(obj) {
|
|
|
236
256
|
return result;
|
|
237
257
|
}
|
|
238
258
|
|
|
239
|
-
// src/hash.ts
|
|
240
|
-
function toChar(code) {
|
|
241
|
-
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
242
|
-
}
|
|
243
|
-
function toName(code) {
|
|
244
|
-
let name = "";
|
|
245
|
-
let x;
|
|
246
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
247
|
-
name = toChar(x % 52) + name;
|
|
248
|
-
return toChar(x % 52) + name;
|
|
249
|
-
}
|
|
250
|
-
function toPhash(h, x) {
|
|
251
|
-
let i = x.length;
|
|
252
|
-
while (i)
|
|
253
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
254
|
-
return h;
|
|
255
|
-
}
|
|
256
|
-
function toHash(value) {
|
|
257
|
-
return toName(toPhash(5381, value) >>> 0);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
259
|
// src/merge-props.ts
|
|
261
260
|
function mergeProps(...sources) {
|
|
262
261
|
const objects = sources.filter(Boolean);
|
|
@@ -282,7 +281,7 @@ function walkObject(target, predicate, options = {}) {
|
|
|
282
281
|
if (isObject(value) || Array.isArray(value)) {
|
|
283
282
|
const result = {};
|
|
284
283
|
for (const [prop, child] of Object.entries(value)) {
|
|
285
|
-
const key = getKey?.(prop) ?? prop;
|
|
284
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
286
285
|
const childPath = [...path, key];
|
|
287
286
|
if (stop?.(value, childPath)) {
|
|
288
287
|
return predicate(value, path);
|
|
@@ -316,14 +315,6 @@ function toResponsiveObject(values, breakpoints) {
|
|
|
316
315
|
return acc;
|
|
317
316
|
}, {});
|
|
318
317
|
}
|
|
319
|
-
function normalizeShorthand(styles, context) {
|
|
320
|
-
const { hasShorthand, resolveShorthand } = context.utility;
|
|
321
|
-
return walkObject(styles, (v) => v, {
|
|
322
|
-
getKey: (prop) => {
|
|
323
|
-
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
318
|
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
328
319
|
const { utility, conditions } = context;
|
|
329
320
|
const { hasShorthand, resolveShorthand } = utility;
|
|
@@ -353,7 +344,7 @@ function createCss(context) {
|
|
|
353
344
|
let result;
|
|
354
345
|
if (hash) {
|
|
355
346
|
const baseArray = [...conds.finalize(conditions), className];
|
|
356
|
-
result = formatClassName(toHash(baseArray
|
|
347
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
357
348
|
} else {
|
|
358
349
|
const baseArray = [...conds.finalize(conditions), formatClassName(className)];
|
|
359
350
|
result = baseArray.join(":");
|
|
@@ -386,7 +377,7 @@ function createMergeCss(context) {
|
|
|
386
377
|
const allStyles = compactStyles(...styles);
|
|
387
378
|
if (allStyles.length === 1)
|
|
388
379
|
return allStyles;
|
|
389
|
-
return allStyles.map((style) =>
|
|
380
|
+
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
390
381
|
}
|
|
391
382
|
function mergeCss(...styles) {
|
|
392
383
|
return mergeProps(...resolve(styles));
|
|
@@ -810,7 +801,6 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
810
801
|
markImportant,
|
|
811
802
|
memo,
|
|
812
803
|
mergeProps,
|
|
813
|
-
normalizeShorthand,
|
|
814
804
|
normalizeStyleObject,
|
|
815
805
|
parseJson,
|
|
816
806
|
patternFns,
|
package/dist/index.mjs
CHANGED
|
@@ -115,6 +115,27 @@ function filterBaseConditions(c) {
|
|
|
115
115
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
// src/hash.ts
|
|
119
|
+
function toChar(code) {
|
|
120
|
+
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
121
|
+
}
|
|
122
|
+
function toName(code) {
|
|
123
|
+
let name = "";
|
|
124
|
+
let x;
|
|
125
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
126
|
+
name = toChar(x % 52) + name;
|
|
127
|
+
return toChar(x % 52) + name;
|
|
128
|
+
}
|
|
129
|
+
function toPhash(h, x) {
|
|
130
|
+
let i = x.length;
|
|
131
|
+
while (i)
|
|
132
|
+
h = h * 33 ^ x.charCodeAt(--i);
|
|
133
|
+
return h;
|
|
134
|
+
}
|
|
135
|
+
function toHash(value) {
|
|
136
|
+
return toName(toPhash(5381, value) >>> 0);
|
|
137
|
+
}
|
|
138
|
+
|
|
118
139
|
// src/important.ts
|
|
119
140
|
var importantRegex = /\s*!(important)?/i;
|
|
120
141
|
function isImportant(value) {
|
|
@@ -149,27 +170,6 @@ function markImportant(obj) {
|
|
|
149
170
|
return result;
|
|
150
171
|
}
|
|
151
172
|
|
|
152
|
-
// src/hash.ts
|
|
153
|
-
function toChar(code) {
|
|
154
|
-
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
155
|
-
}
|
|
156
|
-
function toName(code) {
|
|
157
|
-
let name = "";
|
|
158
|
-
let x;
|
|
159
|
-
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
160
|
-
name = toChar(x % 52) + name;
|
|
161
|
-
return toChar(x % 52) + name;
|
|
162
|
-
}
|
|
163
|
-
function toPhash(h, x) {
|
|
164
|
-
let i = x.length;
|
|
165
|
-
while (i)
|
|
166
|
-
h = h * 33 ^ x.charCodeAt(--i);
|
|
167
|
-
return h;
|
|
168
|
-
}
|
|
169
|
-
function toHash(value) {
|
|
170
|
-
return toName(toPhash(5381, value) >>> 0);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
173
|
// src/merge-props.ts
|
|
174
174
|
function mergeProps(...sources) {
|
|
175
175
|
const objects = sources.filter(Boolean);
|
|
@@ -195,7 +195,7 @@ function walkObject(target, predicate, options = {}) {
|
|
|
195
195
|
if (isObject(value) || Array.isArray(value)) {
|
|
196
196
|
const result = {};
|
|
197
197
|
for (const [prop, child] of Object.entries(value)) {
|
|
198
|
-
const key = getKey?.(prop) ?? prop;
|
|
198
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
199
199
|
const childPath = [...path, key];
|
|
200
200
|
if (stop?.(value, childPath)) {
|
|
201
201
|
return predicate(value, path);
|
|
@@ -229,14 +229,6 @@ function toResponsiveObject(values, breakpoints) {
|
|
|
229
229
|
return acc;
|
|
230
230
|
}, {});
|
|
231
231
|
}
|
|
232
|
-
function normalizeShorthand(styles, context) {
|
|
233
|
-
const { hasShorthand, resolveShorthand } = context.utility;
|
|
234
|
-
return walkObject(styles, (v) => v, {
|
|
235
|
-
getKey: (prop) => {
|
|
236
|
-
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
232
|
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
241
233
|
const { utility, conditions } = context;
|
|
242
234
|
const { hasShorthand, resolveShorthand } = utility;
|
|
@@ -266,7 +258,7 @@ function createCss(context) {
|
|
|
266
258
|
let result;
|
|
267
259
|
if (hash) {
|
|
268
260
|
const baseArray = [...conds.finalize(conditions), className];
|
|
269
|
-
result = formatClassName(toHash(baseArray
|
|
261
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
270
262
|
} else {
|
|
271
263
|
const baseArray = [...conds.finalize(conditions), formatClassName(className)];
|
|
272
264
|
result = baseArray.join(":");
|
|
@@ -299,7 +291,7 @@ function createMergeCss(context) {
|
|
|
299
291
|
const allStyles = compactStyles(...styles);
|
|
300
292
|
if (allStyles.length === 1)
|
|
301
293
|
return allStyles;
|
|
302
|
-
return allStyles.map((style) =>
|
|
294
|
+
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
303
295
|
}
|
|
304
296
|
function mergeCss(...styles) {
|
|
305
297
|
return mergeProps(...resolve(styles));
|
|
@@ -722,7 +714,6 @@ export {
|
|
|
722
714
|
markImportant,
|
|
723
715
|
memo,
|
|
724
716
|
mergeProps,
|
|
725
|
-
normalizeShorthand,
|
|
726
717
|
normalizeStyleObject,
|
|
727
718
|
parseJson,
|
|
728
719
|
patternFns,
|
|
@@ -16,6 +16,7 @@ interface CreateCssContext {
|
|
|
16
16
|
transform: (prop: string, value: any) => {
|
|
17
17
|
className: string;
|
|
18
18
|
};
|
|
19
|
+
toHash: (path: string[], toHash: (str: string) => string) => string;
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
22
|
* Partial properties from the Condition class
|
|
@@ -55,7 +56,7 @@ type MappedObject<T, K> = {
|
|
|
55
56
|
type WalkObjectStopFn = (value: any, path: string[]) => boolean;
|
|
56
57
|
interface WalkObjectOptions {
|
|
57
58
|
stop?: WalkObjectStopFn;
|
|
58
|
-
getKey?(prop: string): string;
|
|
59
|
+
getKey?(prop: string, value: any): string;
|
|
59
60
|
}
|
|
60
61
|
declare function walkObject<T, K>(target: T, predicate: Predicate<K>, options?: WalkObjectOptions): MappedObject<T, ReturnType<Predicate<K>>>;
|
|
61
62
|
declare function mapObject(obj: any, fn: (value: any) => any): any;
|
|
@@ -16,6 +16,7 @@ interface CreateCssContext {
|
|
|
16
16
|
transform: (prop: string, value: any) => {
|
|
17
17
|
className: string;
|
|
18
18
|
};
|
|
19
|
+
toHash: (path: string[], toHash: (str: string) => string) => string;
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
22
|
* Partial properties from the Condition class
|
|
@@ -55,7 +56,7 @@ type MappedObject<T, K> = {
|
|
|
55
56
|
type WalkObjectStopFn = (value: any, path: string[]) => boolean;
|
|
56
57
|
interface WalkObjectOptions {
|
|
57
58
|
stop?: WalkObjectStopFn;
|
|
58
|
-
getKey?(prop: string): string;
|
|
59
|
+
getKey?(prop: string, value: any): string;
|
|
59
60
|
}
|
|
60
61
|
declare function walkObject<T, K>(target: T, predicate: Predicate<K>, options?: WalkObjectOptions): MappedObject<T, ReturnType<Predicate<K>>>;
|
|
61
62
|
declare function mapObject(obj: any, fn: (value: any) => any): any;
|
package/dist/shared.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-
|
|
1
|
+
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-z3agWt4M.mjs';
|
package/dist/shared.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-
|
|
1
|
+
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-z3agWt4M.js';
|
package/dist/shared.js
CHANGED
|
@@ -58,18 +58,6 @@ function filterBaseConditions(c) {
|
|
|
58
58
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// src/important.ts
|
|
62
|
-
var importantRegex = /\s*!(important)?/i;
|
|
63
|
-
function isImportant(value) {
|
|
64
|
-
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
65
|
-
}
|
|
66
|
-
function withoutImportant(value) {
|
|
67
|
-
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
68
|
-
}
|
|
69
|
-
function withoutSpace(str) {
|
|
70
|
-
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
61
|
// src/hash.ts
|
|
74
62
|
function toChar(code) {
|
|
75
63
|
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
@@ -91,21 +79,16 @@ function toHash(value) {
|
|
|
91
79
|
return toName(toPhash(5381, value) >>> 0);
|
|
92
80
|
}
|
|
93
81
|
|
|
94
|
-
// src/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
prev[key] = value;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
return prev;
|
|
108
|
-
}, {});
|
|
82
|
+
// src/important.ts
|
|
83
|
+
var importantRegex = /\s*!(important)?/i;
|
|
84
|
+
function isImportant(value) {
|
|
85
|
+
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
86
|
+
}
|
|
87
|
+
function withoutImportant(value) {
|
|
88
|
+
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
89
|
+
}
|
|
90
|
+
function withoutSpace(str) {
|
|
91
|
+
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
109
92
|
}
|
|
110
93
|
|
|
111
94
|
// src/memo.ts
|
|
@@ -123,6 +106,23 @@ var memo = (fn) => {
|
|
|
123
106
|
return get;
|
|
124
107
|
};
|
|
125
108
|
|
|
109
|
+
// src/merge-props.ts
|
|
110
|
+
function mergeProps(...sources) {
|
|
111
|
+
const objects = sources.filter(Boolean);
|
|
112
|
+
return objects.reduce((prev, obj) => {
|
|
113
|
+
Object.keys(obj).forEach((key) => {
|
|
114
|
+
const prevValue = prev[key];
|
|
115
|
+
const value = obj[key];
|
|
116
|
+
if (isObject(prevValue) && isObject(value)) {
|
|
117
|
+
prev[key] = mergeProps(prevValue, value);
|
|
118
|
+
} else {
|
|
119
|
+
prev[key] = value;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return prev;
|
|
123
|
+
}, {});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
126
|
// src/walk-object.ts
|
|
127
127
|
var isNotNullish = (element) => element != null;
|
|
128
128
|
function walkObject(target, predicate, options = {}) {
|
|
@@ -131,7 +131,7 @@ function walkObject(target, predicate, options = {}) {
|
|
|
131
131
|
if (isObject(value) || Array.isArray(value)) {
|
|
132
132
|
const result = {};
|
|
133
133
|
for (const [prop, child] of Object.entries(value)) {
|
|
134
|
-
const key = getKey?.(prop) ?? prop;
|
|
134
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
135
135
|
const childPath = [...path, key];
|
|
136
136
|
if (stop?.(value, childPath)) {
|
|
137
137
|
return predicate(value, path);
|
|
@@ -165,14 +165,6 @@ function toResponsiveObject(values, breakpoints) {
|
|
|
165
165
|
return acc;
|
|
166
166
|
}, {});
|
|
167
167
|
}
|
|
168
|
-
function normalizeShorthand(styles, context) {
|
|
169
|
-
const { hasShorthand, resolveShorthand } = context.utility;
|
|
170
|
-
return walkObject(styles, (v) => v, {
|
|
171
|
-
getKey: (prop) => {
|
|
172
|
-
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
168
|
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
177
169
|
const { utility, conditions } = context;
|
|
178
170
|
const { hasShorthand, resolveShorthand } = utility;
|
|
@@ -202,7 +194,7 @@ function createCss(context) {
|
|
|
202
194
|
let result;
|
|
203
195
|
if (hash) {
|
|
204
196
|
const baseArray = [...conds.finalize(conditions), className];
|
|
205
|
-
result = formatClassName(toHash(baseArray
|
|
197
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
206
198
|
} else {
|
|
207
199
|
const baseArray = [...conds.finalize(conditions), formatClassName(className)];
|
|
208
200
|
result = baseArray.join(":");
|
|
@@ -235,7 +227,7 @@ function createMergeCss(context) {
|
|
|
235
227
|
const allStyles = compactStyles(...styles);
|
|
236
228
|
if (allStyles.length === 1)
|
|
237
229
|
return allStyles;
|
|
238
|
-
return allStyles.map((style) =>
|
|
230
|
+
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
239
231
|
}
|
|
240
232
|
function mergeCss(...styles) {
|
|
241
233
|
return mergeProps(...resolve(styles));
|
package/dist/shared.mjs
CHANGED
|
@@ -14,18 +14,6 @@ function filterBaseConditions(c) {
|
|
|
14
14
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// src/important.ts
|
|
18
|
-
var importantRegex = /\s*!(important)?/i;
|
|
19
|
-
function isImportant(value) {
|
|
20
|
-
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
21
|
-
}
|
|
22
|
-
function withoutImportant(value) {
|
|
23
|
-
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
24
|
-
}
|
|
25
|
-
function withoutSpace(str) {
|
|
26
|
-
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
17
|
// src/hash.ts
|
|
30
18
|
function toChar(code) {
|
|
31
19
|
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
@@ -47,21 +35,16 @@ function toHash(value) {
|
|
|
47
35
|
return toName(toPhash(5381, value) >>> 0);
|
|
48
36
|
}
|
|
49
37
|
|
|
50
|
-
// src/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
prev[key] = value;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return prev;
|
|
64
|
-
}, {});
|
|
38
|
+
// src/important.ts
|
|
39
|
+
var importantRegex = /\s*!(important)?/i;
|
|
40
|
+
function isImportant(value) {
|
|
41
|
+
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
42
|
+
}
|
|
43
|
+
function withoutImportant(value) {
|
|
44
|
+
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
45
|
+
}
|
|
46
|
+
function withoutSpace(str) {
|
|
47
|
+
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
65
48
|
}
|
|
66
49
|
|
|
67
50
|
// src/memo.ts
|
|
@@ -79,6 +62,23 @@ var memo = (fn) => {
|
|
|
79
62
|
return get;
|
|
80
63
|
};
|
|
81
64
|
|
|
65
|
+
// src/merge-props.ts
|
|
66
|
+
function mergeProps(...sources) {
|
|
67
|
+
const objects = sources.filter(Boolean);
|
|
68
|
+
return objects.reduce((prev, obj) => {
|
|
69
|
+
Object.keys(obj).forEach((key) => {
|
|
70
|
+
const prevValue = prev[key];
|
|
71
|
+
const value = obj[key];
|
|
72
|
+
if (isObject(prevValue) && isObject(value)) {
|
|
73
|
+
prev[key] = mergeProps(prevValue, value);
|
|
74
|
+
} else {
|
|
75
|
+
prev[key] = value;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return prev;
|
|
79
|
+
}, {});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
82
|
// src/walk-object.ts
|
|
83
83
|
var isNotNullish = (element) => element != null;
|
|
84
84
|
function walkObject(target, predicate, options = {}) {
|
|
@@ -87,7 +87,7 @@ function walkObject(target, predicate, options = {}) {
|
|
|
87
87
|
if (isObject(value) || Array.isArray(value)) {
|
|
88
88
|
const result = {};
|
|
89
89
|
for (const [prop, child] of Object.entries(value)) {
|
|
90
|
-
const key = getKey?.(prop) ?? prop;
|
|
90
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
91
91
|
const childPath = [...path, key];
|
|
92
92
|
if (stop?.(value, childPath)) {
|
|
93
93
|
return predicate(value, path);
|
|
@@ -121,14 +121,6 @@ function toResponsiveObject(values, breakpoints) {
|
|
|
121
121
|
return acc;
|
|
122
122
|
}, {});
|
|
123
123
|
}
|
|
124
|
-
function normalizeShorthand(styles, context) {
|
|
125
|
-
const { hasShorthand, resolveShorthand } = context.utility;
|
|
126
|
-
return walkObject(styles, (v) => v, {
|
|
127
|
-
getKey: (prop) => {
|
|
128
|
-
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
124
|
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
133
125
|
const { utility, conditions } = context;
|
|
134
126
|
const { hasShorthand, resolveShorthand } = utility;
|
|
@@ -158,7 +150,7 @@ function createCss(context) {
|
|
|
158
150
|
let result;
|
|
159
151
|
if (hash) {
|
|
160
152
|
const baseArray = [...conds.finalize(conditions), className];
|
|
161
|
-
result = formatClassName(toHash(baseArray
|
|
153
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
162
154
|
} else {
|
|
163
155
|
const baseArray = [...conds.finalize(conditions), formatClassName(className)];
|
|
164
156
|
result = baseArray.join(":");
|
|
@@ -191,7 +183,7 @@ function createMergeCss(context) {
|
|
|
191
183
|
const allStyles = compactStyles(...styles);
|
|
192
184
|
if (allStyles.length === 1)
|
|
193
185
|
return allStyles;
|
|
194
|
-
return allStyles.map((style) =>
|
|
186
|
+
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
195
187
|
}
|
|
196
188
|
function mergeCss(...styles) {
|
|
197
189
|
return mergeProps(...resolve(styles));
|