@pandacss/shared 0.0.0-dev-20240126173019 → 0.0.0-dev-20240128131310
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 +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +40 -2
- package/dist/index.mjs +35 -2
- package/dist/{shared-MIujjRlg.d.mts → shared-bFj3Wgxk.d.mts} +9 -1
- package/dist/{shared-MIujjRlg.d.ts → shared-bFj3Wgxk.d.ts} +9 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +33 -1
- package/dist/shared.mjs +31 -1
- 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 {
|
|
1
|
+
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-bFj3Wgxk.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-bFj3Wgxk.mjs';
|
|
3
3
|
export { astish } from './astish.mjs';
|
|
4
4
|
|
|
5
5
|
declare const getArbitraryValue: (_value: string) => string;
|
|
@@ -54,6 +54,12 @@ declare function flatten(values: Record<string, Record<string, any>>, stop?: Wal
|
|
|
54
54
|
|
|
55
55
|
declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
|
|
56
56
|
|
|
57
|
+
declare const isCssFunction: (v: unknown) => boolean;
|
|
58
|
+
|
|
59
|
+
declare const isCssUnit: (v: unknown) => boolean;
|
|
60
|
+
|
|
61
|
+
declare const isCssVar: (v: unknown) => boolean;
|
|
62
|
+
|
|
57
63
|
type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
|
|
58
64
|
declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
|
|
59
65
|
declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
|
|
@@ -90,4 +96,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
90
96
|
|
|
91
97
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
92
98
|
|
|
93
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
|
99
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, 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 {
|
|
1
|
+
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-bFj3Wgxk.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-bFj3Wgxk.js';
|
|
3
3
|
export { astish } from './astish.js';
|
|
4
4
|
|
|
5
5
|
declare const getArbitraryValue: (_value: string) => string;
|
|
@@ -54,6 +54,12 @@ declare function flatten(values: Record<string, Record<string, any>>, stop?: Wal
|
|
|
54
54
|
|
|
55
55
|
declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
|
|
56
56
|
|
|
57
|
+
declare const isCssFunction: (v: unknown) => boolean;
|
|
58
|
+
|
|
59
|
+
declare const isCssUnit: (v: unknown) => boolean;
|
|
60
|
+
|
|
61
|
+
declare const isCssVar: (v: unknown) => boolean;
|
|
62
|
+
|
|
57
63
|
type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
|
|
58
64
|
declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
|
|
59
65
|
declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
|
|
@@ -90,4 +96,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
90
96
|
|
|
91
97
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
92
98
|
|
|
93
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
|
99
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.js
CHANGED
|
@@ -40,12 +40,16 @@ __export(src_exports, {
|
|
|
40
40
|
getDotPath: () => getDotPath,
|
|
41
41
|
getNegativePath: () => getNegativePath,
|
|
42
42
|
getOrCreateSet: () => getOrCreateSet,
|
|
43
|
+
getPatternStyles: () => getPatternStyles,
|
|
43
44
|
getSlotCompoundVariant: () => getSlotCompoundVariant,
|
|
44
45
|
getSlotRecipes: () => getSlotRecipes,
|
|
45
46
|
getUnit: () => getUnit,
|
|
46
47
|
hypenateProperty: () => hypenateProperty,
|
|
47
48
|
isBaseCondition: () => isBaseCondition,
|
|
48
49
|
isBoolean: () => isBoolean,
|
|
50
|
+
isCssFunction: () => isCssFunction,
|
|
51
|
+
isCssUnit: () => isCssUnit,
|
|
52
|
+
isCssVar: () => isCssVar2,
|
|
49
53
|
isFunction: () => isFunction,
|
|
50
54
|
isImportant: () => isImportant,
|
|
51
55
|
isObject: () => isObject,
|
|
@@ -60,6 +64,7 @@ __export(src_exports, {
|
|
|
60
64
|
normalizeShorthand: () => normalizeShorthand,
|
|
61
65
|
normalizeStyleObject: () => normalizeStyleObject,
|
|
62
66
|
parseJson: () => parseJson,
|
|
67
|
+
patternFns: () => patternFns,
|
|
63
68
|
splitBy: () => splitBy,
|
|
64
69
|
splitDotPath: () => splitDotPath,
|
|
65
70
|
splitProps: () => splitProps,
|
|
@@ -196,7 +201,7 @@ function filterBaseConditions(c) {
|
|
|
196
201
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
197
202
|
}
|
|
198
203
|
|
|
199
|
-
// src/
|
|
204
|
+
// src/important.ts
|
|
200
205
|
var importantRegex = /\s*!(important)?/i;
|
|
201
206
|
function isImportant(value) {
|
|
202
207
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
@@ -391,7 +396,7 @@ function createMergeCss(context) {
|
|
|
391
396
|
return { mergeCss: memo(mergeCss), assignCss };
|
|
392
397
|
}
|
|
393
398
|
|
|
394
|
-
// src/
|
|
399
|
+
// src/unit-conversion.ts
|
|
395
400
|
var BASE_FONT_SIZE = 16;
|
|
396
401
|
var UNIT_PX = "px";
|
|
397
402
|
var UNIT_EM = "em";
|
|
@@ -566,6 +571,34 @@ var hypenateProperty = memo((property) => {
|
|
|
566
571
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
567
572
|
});
|
|
568
573
|
|
|
574
|
+
// src/is-css-function.ts
|
|
575
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
576
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
577
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
578
|
+
|
|
579
|
+
// src/is-css-unit.ts
|
|
580
|
+
var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
|
|
581
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
582
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
583
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
584
|
+
|
|
585
|
+
// src/is-css-var.ts
|
|
586
|
+
var isCssVar2 = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
587
|
+
|
|
588
|
+
// src/pattern-fns.ts
|
|
589
|
+
var patternFns = {
|
|
590
|
+
map: mapObject,
|
|
591
|
+
isCssFunction,
|
|
592
|
+
isCssVar: isCssVar2,
|
|
593
|
+
isCssUnit
|
|
594
|
+
};
|
|
595
|
+
var getPatternStyles = (pattern, styles) => {
|
|
596
|
+
if (!pattern.defaultValues)
|
|
597
|
+
return styles;
|
|
598
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
599
|
+
return Object.assign({}, defaults, compact(styles));
|
|
600
|
+
};
|
|
601
|
+
|
|
569
602
|
// src/regex.ts
|
|
570
603
|
var createRegex = (item) => {
|
|
571
604
|
const regex2 = item.map((item2) => typeof item2 === "string" ? `^${item2}$` : item2.source).join("|");
|
|
@@ -743,12 +776,16 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
743
776
|
getDotPath,
|
|
744
777
|
getNegativePath,
|
|
745
778
|
getOrCreateSet,
|
|
779
|
+
getPatternStyles,
|
|
746
780
|
getSlotCompoundVariant,
|
|
747
781
|
getSlotRecipes,
|
|
748
782
|
getUnit,
|
|
749
783
|
hypenateProperty,
|
|
750
784
|
isBaseCondition,
|
|
751
785
|
isBoolean,
|
|
786
|
+
isCssFunction,
|
|
787
|
+
isCssUnit,
|
|
788
|
+
isCssVar,
|
|
752
789
|
isFunction,
|
|
753
790
|
isImportant,
|
|
754
791
|
isObject,
|
|
@@ -763,6 +800,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
763
800
|
normalizeShorthand,
|
|
764
801
|
normalizeStyleObject,
|
|
765
802
|
parseJson,
|
|
803
|
+
patternFns,
|
|
766
804
|
splitBy,
|
|
767
805
|
splitDotPath,
|
|
768
806
|
splitProps,
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ function filterBaseConditions(c) {
|
|
|
115
115
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
// src/
|
|
118
|
+
// src/important.ts
|
|
119
119
|
var importantRegex = /\s*!(important)?/i;
|
|
120
120
|
function isImportant(value) {
|
|
121
121
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
@@ -310,7 +310,7 @@ function createMergeCss(context) {
|
|
|
310
310
|
return { mergeCss: memo(mergeCss), assignCss };
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
// src/
|
|
313
|
+
// src/unit-conversion.ts
|
|
314
314
|
var BASE_FONT_SIZE = 16;
|
|
315
315
|
var UNIT_PX = "px";
|
|
316
316
|
var UNIT_EM = "em";
|
|
@@ -485,6 +485,34 @@ var hypenateProperty = memo((property) => {
|
|
|
485
485
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
486
486
|
});
|
|
487
487
|
|
|
488
|
+
// src/is-css-function.ts
|
|
489
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
490
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
491
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
492
|
+
|
|
493
|
+
// src/is-css-unit.ts
|
|
494
|
+
var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
|
|
495
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
496
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
497
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
498
|
+
|
|
499
|
+
// src/is-css-var.ts
|
|
500
|
+
var isCssVar2 = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
501
|
+
|
|
502
|
+
// src/pattern-fns.ts
|
|
503
|
+
var patternFns = {
|
|
504
|
+
map: mapObject,
|
|
505
|
+
isCssFunction,
|
|
506
|
+
isCssVar: isCssVar2,
|
|
507
|
+
isCssUnit
|
|
508
|
+
};
|
|
509
|
+
var getPatternStyles = (pattern, styles) => {
|
|
510
|
+
if (!pattern.defaultValues)
|
|
511
|
+
return styles;
|
|
512
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
513
|
+
return Object.assign({}, defaults, compact(styles));
|
|
514
|
+
};
|
|
515
|
+
|
|
488
516
|
// src/regex.ts
|
|
489
517
|
var createRegex = (item) => {
|
|
490
518
|
const regex2 = item.map((item2) => typeof item2 === "string" ? `^${item2}$` : item2.source).join("|");
|
|
@@ -661,12 +689,16 @@ export {
|
|
|
661
689
|
getDotPath,
|
|
662
690
|
getNegativePath,
|
|
663
691
|
getOrCreateSet,
|
|
692
|
+
getPatternStyles,
|
|
664
693
|
getSlotCompoundVariant,
|
|
665
694
|
getSlotRecipes,
|
|
666
695
|
getUnit,
|
|
667
696
|
hypenateProperty,
|
|
668
697
|
isBaseCondition,
|
|
669
698
|
isBoolean,
|
|
699
|
+
isCssFunction,
|
|
700
|
+
isCssUnit,
|
|
701
|
+
isCssVar2 as isCssVar,
|
|
670
702
|
isFunction,
|
|
671
703
|
isImportant,
|
|
672
704
|
isObject,
|
|
@@ -681,6 +713,7 @@ export {
|
|
|
681
713
|
normalizeShorthand,
|
|
682
714
|
normalizeStyleObject,
|
|
683
715
|
parseJson,
|
|
716
|
+
patternFns,
|
|
684
717
|
splitBy,
|
|
685
718
|
splitDotPath,
|
|
686
719
|
splitProps,
|
|
@@ -68,6 +68,14 @@ declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
|
|
|
68
68
|
|
|
69
69
|
declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
|
|
70
70
|
|
|
71
|
+
declare const patternFns: {
|
|
72
|
+
map: typeof mapObject;
|
|
73
|
+
isCssFunction: (v: unknown) => boolean;
|
|
74
|
+
isCssVar: (v: unknown) => boolean;
|
|
75
|
+
isCssUnit: (v: unknown) => boolean;
|
|
76
|
+
};
|
|
77
|
+
declare const getPatternStyles: (pattern: any, styles: Record<string, any>) => any;
|
|
78
|
+
|
|
71
79
|
declare const getSlotRecipes: (recipe?: Record<string, any>) => Record<string, any>;
|
|
72
80
|
declare const getSlotCompoundVariant: <T extends {
|
|
73
81
|
css: any;
|
|
@@ -82,4 +90,4 @@ declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
|
|
|
82
90
|
|
|
83
91
|
declare const uniq: <T>(...items: T[][]) => T[];
|
|
84
92
|
|
|
85
|
-
export { type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, createCss as d, createMergeCss as e, compact as f, isBaseCondition as g, filterBaseConditions as h, isString as i, isImportant as j, withoutSpace as k, hypenateProperty as l, markImportant as m, memo as n, mergeProps as o,
|
|
93
|
+
export { type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, createCss as d, createMergeCss as e, compact as f, isBaseCondition as g, filterBaseConditions as h, isString as i, isImportant as j, withoutSpace as k, hypenateProperty as l, markImportant as m, memo as n, mergeProps as o, patternFns as p, getPatternStyles as q, getSlotRecipes as r, getSlotCompoundVariant as s, toHash as t, splitProps as u, uniq as v, withoutImportant as w, type WalkObjectOptions as x, walkObject as y, mapObject as z };
|
|
@@ -68,6 +68,14 @@ declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
|
|
|
68
68
|
|
|
69
69
|
declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
|
|
70
70
|
|
|
71
|
+
declare const patternFns: {
|
|
72
|
+
map: typeof mapObject;
|
|
73
|
+
isCssFunction: (v: unknown) => boolean;
|
|
74
|
+
isCssVar: (v: unknown) => boolean;
|
|
75
|
+
isCssUnit: (v: unknown) => boolean;
|
|
76
|
+
};
|
|
77
|
+
declare const getPatternStyles: (pattern: any, styles: Record<string, any>) => any;
|
|
78
|
+
|
|
71
79
|
declare const getSlotRecipes: (recipe?: Record<string, any>) => Record<string, any>;
|
|
72
80
|
declare const getSlotCompoundVariant: <T extends {
|
|
73
81
|
css: any;
|
|
@@ -82,4 +90,4 @@ declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
|
|
|
82
90
|
|
|
83
91
|
declare const uniq: <T>(...items: T[][]) => T[];
|
|
84
92
|
|
|
85
|
-
export { type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, createCss as d, createMergeCss as e, compact as f, isBaseCondition as g, filterBaseConditions as h, isString as i, isImportant as j, withoutSpace as k, hypenateProperty as l, markImportant as m, memo as n, mergeProps as o,
|
|
93
|
+
export { type CreateCssContext as C, type MappedObject as M, type WalkObjectStopFn as W, isBoolean as a, isFunction as b, isObject as c, createCss as d, createMergeCss as e, compact as f, isBaseCondition as g, filterBaseConditions as h, isString as i, isImportant as j, withoutSpace as k, hypenateProperty as l, markImportant as m, memo as n, mergeProps as o, patternFns as p, getPatternStyles as q, getSlotRecipes as r, getSlotCompoundVariant as s, toHash as t, splitProps as u, uniq as v, withoutImportant as w, type WalkObjectOptions as x, walkObject as y, mapObject as z };
|
package/dist/shared.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getSlotCompoundVariant,
|
|
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-bFj3Wgxk.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 getSlotCompoundVariant,
|
|
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-bFj3Wgxk.js';
|
package/dist/shared.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(shared_exports, {
|
|
|
24
24
|
createCss: () => createCss,
|
|
25
25
|
createMergeCss: () => createMergeCss,
|
|
26
26
|
filterBaseConditions: () => filterBaseConditions,
|
|
27
|
+
getPatternStyles: () => getPatternStyles,
|
|
27
28
|
getSlotCompoundVariant: () => getSlotCompoundVariant,
|
|
28
29
|
getSlotRecipes: () => getSlotRecipes,
|
|
29
30
|
hypenateProperty: () => hypenateProperty,
|
|
@@ -32,6 +33,7 @@ __export(shared_exports, {
|
|
|
32
33
|
mapObject: () => mapObject,
|
|
33
34
|
memo: () => memo,
|
|
34
35
|
mergeProps: () => mergeProps,
|
|
36
|
+
patternFns: () => patternFns,
|
|
35
37
|
splitProps: () => splitProps,
|
|
36
38
|
toHash: () => toHash,
|
|
37
39
|
uniq: () => uniq,
|
|
@@ -56,7 +58,7 @@ function filterBaseConditions(c) {
|
|
|
56
58
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
// src/
|
|
61
|
+
// src/important.ts
|
|
60
62
|
var importantRegex = /\s*!(important)?/i;
|
|
61
63
|
function isImportant(value) {
|
|
62
64
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
@@ -253,6 +255,34 @@ var hypenateProperty = memo((property) => {
|
|
|
253
255
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
254
256
|
});
|
|
255
257
|
|
|
258
|
+
// src/is-css-function.ts
|
|
259
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
260
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
261
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
262
|
+
|
|
263
|
+
// src/is-css-unit.ts
|
|
264
|
+
var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
|
|
265
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
266
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
267
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
268
|
+
|
|
269
|
+
// src/is-css-var.ts
|
|
270
|
+
var isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
271
|
+
|
|
272
|
+
// src/pattern-fns.ts
|
|
273
|
+
var patternFns = {
|
|
274
|
+
map: mapObject,
|
|
275
|
+
isCssFunction,
|
|
276
|
+
isCssVar,
|
|
277
|
+
isCssUnit
|
|
278
|
+
};
|
|
279
|
+
var getPatternStyles = (pattern, styles) => {
|
|
280
|
+
if (!pattern.defaultValues)
|
|
281
|
+
return styles;
|
|
282
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
283
|
+
return Object.assign({}, defaults, compact(styles));
|
|
284
|
+
};
|
|
285
|
+
|
|
256
286
|
// src/slot.ts
|
|
257
287
|
var getSlotRecipes = (recipe = {}) => {
|
|
258
288
|
const init = (slot) => ({
|
|
@@ -303,6 +333,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
303
333
|
createCss,
|
|
304
334
|
createMergeCss,
|
|
305
335
|
filterBaseConditions,
|
|
336
|
+
getPatternStyles,
|
|
306
337
|
getSlotCompoundVariant,
|
|
307
338
|
getSlotRecipes,
|
|
308
339
|
hypenateProperty,
|
|
@@ -311,6 +342,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
311
342
|
mapObject,
|
|
312
343
|
memo,
|
|
313
344
|
mergeProps,
|
|
345
|
+
patternFns,
|
|
314
346
|
splitProps,
|
|
315
347
|
toHash,
|
|
316
348
|
uniq,
|
package/dist/shared.mjs
CHANGED
|
@@ -14,7 +14,7 @@ function filterBaseConditions(c) {
|
|
|
14
14
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// src/
|
|
17
|
+
// src/important.ts
|
|
18
18
|
var importantRegex = /\s*!(important)?/i;
|
|
19
19
|
function isImportant(value) {
|
|
20
20
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
@@ -211,6 +211,34 @@ var hypenateProperty = memo((property) => {
|
|
|
211
211
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
+
// src/is-css-function.ts
|
|
215
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
216
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
217
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
218
|
+
|
|
219
|
+
// src/is-css-unit.ts
|
|
220
|
+
var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
|
|
221
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
222
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
223
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
224
|
+
|
|
225
|
+
// src/is-css-var.ts
|
|
226
|
+
var isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
227
|
+
|
|
228
|
+
// src/pattern-fns.ts
|
|
229
|
+
var patternFns = {
|
|
230
|
+
map: mapObject,
|
|
231
|
+
isCssFunction,
|
|
232
|
+
isCssVar,
|
|
233
|
+
isCssUnit
|
|
234
|
+
};
|
|
235
|
+
var getPatternStyles = (pattern, styles) => {
|
|
236
|
+
if (!pattern.defaultValues)
|
|
237
|
+
return styles;
|
|
238
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
239
|
+
return Object.assign({}, defaults, compact(styles));
|
|
240
|
+
};
|
|
241
|
+
|
|
214
242
|
// src/slot.ts
|
|
215
243
|
var getSlotRecipes = (recipe = {}) => {
|
|
216
244
|
const init = (slot) => ({
|
|
@@ -260,6 +288,7 @@ export {
|
|
|
260
288
|
createCss,
|
|
261
289
|
createMergeCss,
|
|
262
290
|
filterBaseConditions,
|
|
291
|
+
getPatternStyles,
|
|
263
292
|
getSlotCompoundVariant,
|
|
264
293
|
getSlotRecipes,
|
|
265
294
|
hypenateProperty,
|
|
@@ -268,6 +297,7 @@ export {
|
|
|
268
297
|
mapObject,
|
|
269
298
|
memo,
|
|
270
299
|
mergeProps,
|
|
300
|
+
patternFns,
|
|
271
301
|
splitProps,
|
|
272
302
|
toHash,
|
|
273
303
|
uniq,
|