@pandacss/shared 0.27.3 → 0.29.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 +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +58 -6
- package/dist/index.mjs +52 -6
- 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,8 +1,8 @@
|
|
|
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
|
-
declare const getArbitraryValue: (
|
|
5
|
+
declare const getArbitraryValue: (_value: string) => string;
|
|
6
6
|
|
|
7
7
|
type Operand = string | number | {
|
|
8
8
|
ref: string;
|
|
@@ -48,12 +48,27 @@ declare function mapEntries<A, B, K extends string | number | symbol>(obj: {
|
|
|
48
48
|
[key in K]: B;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
type PandaErrorCode = 'CONFIG_NOT_FOUND' | 'CONFIG_ERROR' | 'NOT_FOUND' | 'CONDITION' | 'MISSING_STUDIO' | 'INVALID_LAYER' | 'UNKNOWN_RECIPE' | 'INVALID_RECIPE' | 'UNKNOWN_TYPE' | 'MISSING_PARAMS' | 'NO_CONTEXT' | 'INVALID_TOKEN';
|
|
52
|
+
declare class PandaError extends Error {
|
|
53
|
+
readonly code: string;
|
|
54
|
+
readonly hint?: string;
|
|
55
|
+
constructor(code: PandaErrorCode, message: string, opts?: {
|
|
56
|
+
hint?: string;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
declare const esc: (sel: string) => string;
|
|
52
61
|
|
|
53
62
|
declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
|
|
54
63
|
|
|
55
64
|
declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
|
|
56
65
|
|
|
66
|
+
declare const isCssFunction: (v: unknown) => boolean;
|
|
67
|
+
|
|
68
|
+
declare const isCssUnit: (v: unknown) => boolean;
|
|
69
|
+
|
|
70
|
+
declare const isCssVar: (v: unknown) => boolean;
|
|
71
|
+
|
|
57
72
|
type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
|
|
58
73
|
declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
|
|
59
74
|
declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
|
|
@@ -90,4 +105,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
90
105
|
|
|
91
106
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
92
107
|
|
|
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 };
|
|
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, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
declare const getArbitraryValue: (
|
|
5
|
+
declare const getArbitraryValue: (_value: string) => string;
|
|
6
6
|
|
|
7
7
|
type Operand = string | number | {
|
|
8
8
|
ref: string;
|
|
@@ -48,12 +48,27 @@ declare function mapEntries<A, B, K extends string | number | symbol>(obj: {
|
|
|
48
48
|
[key in K]: B;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
type PandaErrorCode = 'CONFIG_NOT_FOUND' | 'CONFIG_ERROR' | 'NOT_FOUND' | 'CONDITION' | 'MISSING_STUDIO' | 'INVALID_LAYER' | 'UNKNOWN_RECIPE' | 'INVALID_RECIPE' | 'UNKNOWN_TYPE' | 'MISSING_PARAMS' | 'NO_CONTEXT' | 'INVALID_TOKEN';
|
|
52
|
+
declare class PandaError extends Error {
|
|
53
|
+
readonly code: string;
|
|
54
|
+
readonly hint?: string;
|
|
55
|
+
constructor(code: PandaErrorCode, message: string, opts?: {
|
|
56
|
+
hint?: string;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
declare const esc: (sel: string) => string;
|
|
52
61
|
|
|
53
62
|
declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
|
|
54
63
|
|
|
55
64
|
declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
|
|
56
65
|
|
|
66
|
+
declare const isCssFunction: (v: unknown) => boolean;
|
|
67
|
+
|
|
68
|
+
declare const isCssUnit: (v: unknown) => boolean;
|
|
69
|
+
|
|
70
|
+
declare const isCssVar: (v: unknown) => boolean;
|
|
71
|
+
|
|
57
72
|
type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
|
|
58
73
|
declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
|
|
59
74
|
declare function normalizeShorthand(styles: Record<string, any>, context: NormalizeContext): MappedObject<Record<string, any>, any>;
|
|
@@ -90,4 +105,4 @@ declare function traverse(obj: any, callback: CallbackFn, options?: {
|
|
|
90
105
|
|
|
91
106
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
92
107
|
|
|
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 };
|
|
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, normalizeShorthand, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
PandaError: () => PandaError,
|
|
23
24
|
astish: () => astish,
|
|
24
25
|
calc: () => calc,
|
|
25
26
|
camelCaseProperty: () => camelCaseProperty,
|
|
@@ -40,12 +41,16 @@ __export(src_exports, {
|
|
|
40
41
|
getDotPath: () => getDotPath,
|
|
41
42
|
getNegativePath: () => getNegativePath,
|
|
42
43
|
getOrCreateSet: () => getOrCreateSet,
|
|
44
|
+
getPatternStyles: () => getPatternStyles,
|
|
43
45
|
getSlotCompoundVariant: () => getSlotCompoundVariant,
|
|
44
46
|
getSlotRecipes: () => getSlotRecipes,
|
|
45
47
|
getUnit: () => getUnit,
|
|
46
48
|
hypenateProperty: () => hypenateProperty,
|
|
47
49
|
isBaseCondition: () => isBaseCondition,
|
|
48
50
|
isBoolean: () => isBoolean,
|
|
51
|
+
isCssFunction: () => isCssFunction,
|
|
52
|
+
isCssUnit: () => isCssUnit,
|
|
53
|
+
isCssVar: () => isCssVar2,
|
|
49
54
|
isFunction: () => isFunction,
|
|
50
55
|
isImportant: () => isImportant,
|
|
51
56
|
isObject: () => isObject,
|
|
@@ -60,6 +65,7 @@ __export(src_exports, {
|
|
|
60
65
|
normalizeShorthand: () => normalizeShorthand,
|
|
61
66
|
normalizeStyleObject: () => normalizeStyleObject,
|
|
62
67
|
parseJson: () => parseJson,
|
|
68
|
+
patternFns: () => patternFns,
|
|
63
69
|
splitBy: () => splitBy,
|
|
64
70
|
splitDotPath: () => splitDotPath,
|
|
65
71
|
splitProps: () => splitProps,
|
|
@@ -80,9 +86,10 @@ __export(src_exports, {
|
|
|
80
86
|
module.exports = __toCommonJS(src_exports);
|
|
81
87
|
|
|
82
88
|
// src/arbitrary-value.ts
|
|
83
|
-
var getArbitraryValue = (
|
|
84
|
-
if (!
|
|
85
|
-
return
|
|
89
|
+
var getArbitraryValue = (_value) => {
|
|
90
|
+
if (!_value || typeof _value !== "string")
|
|
91
|
+
return _value;
|
|
92
|
+
const value = _value.trim();
|
|
86
93
|
if (value[0] === "[" && value[value.length - 1] === "]") {
|
|
87
94
|
const innerValue = value.slice(1, -1);
|
|
88
95
|
let bracketCount = 0;
|
|
@@ -97,7 +104,7 @@ var getArbitraryValue = (value) => {
|
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
106
|
if (bracketCount === 0) {
|
|
100
|
-
return innerValue;
|
|
107
|
+
return innerValue.trim();
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
return value;
|
|
@@ -195,7 +202,7 @@ function filterBaseConditions(c) {
|
|
|
195
202
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
196
203
|
}
|
|
197
204
|
|
|
198
|
-
// src/
|
|
205
|
+
// src/important.ts
|
|
199
206
|
var importantRegex = /\s*!(important)?/i;
|
|
200
207
|
function isImportant(value) {
|
|
201
208
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
@@ -390,7 +397,7 @@ function createMergeCss(context) {
|
|
|
390
397
|
return { mergeCss: memo(mergeCss), assignCss };
|
|
391
398
|
}
|
|
392
399
|
|
|
393
|
-
// src/
|
|
400
|
+
// src/unit-conversion.ts
|
|
394
401
|
var BASE_FONT_SIZE = 16;
|
|
395
402
|
var UNIT_PX = "px";
|
|
396
403
|
var UNIT_EM = "em";
|
|
@@ -512,6 +519,17 @@ function mapEntries(obj, f) {
|
|
|
512
519
|
return result;
|
|
513
520
|
}
|
|
514
521
|
|
|
522
|
+
// src/error.ts
|
|
523
|
+
var PandaError = class extends Error {
|
|
524
|
+
code;
|
|
525
|
+
hint;
|
|
526
|
+
constructor(code, message, opts) {
|
|
527
|
+
super(message);
|
|
528
|
+
this.code = `ERR_PANDA_${code}`;
|
|
529
|
+
this.hint = opts?.hint;
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
|
|
515
533
|
// src/esc.ts
|
|
516
534
|
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
|
|
517
535
|
var fcssescape = function(ch, asCodePoint) {
|
|
@@ -565,6 +583,34 @@ var hypenateProperty = memo((property) => {
|
|
|
565
583
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
566
584
|
});
|
|
567
585
|
|
|
586
|
+
// src/is-css-function.ts
|
|
587
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
588
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
589
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
590
|
+
|
|
591
|
+
// src/is-css-unit.ts
|
|
592
|
+
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,%";
|
|
593
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
594
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
595
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
596
|
+
|
|
597
|
+
// src/is-css-var.ts
|
|
598
|
+
var isCssVar2 = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
599
|
+
|
|
600
|
+
// src/pattern-fns.ts
|
|
601
|
+
var patternFns = {
|
|
602
|
+
map: mapObject,
|
|
603
|
+
isCssFunction,
|
|
604
|
+
isCssVar: isCssVar2,
|
|
605
|
+
isCssUnit
|
|
606
|
+
};
|
|
607
|
+
var getPatternStyles = (pattern, styles) => {
|
|
608
|
+
if (!pattern.defaultValues)
|
|
609
|
+
return styles;
|
|
610
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
611
|
+
return Object.assign({}, defaults, compact(styles));
|
|
612
|
+
};
|
|
613
|
+
|
|
568
614
|
// src/regex.ts
|
|
569
615
|
var createRegex = (item) => {
|
|
570
616
|
const regex2 = item.map((item2) => typeof item2 === "string" ? `^${item2}$` : item2.source).join("|");
|
|
@@ -722,6 +768,7 @@ function unionType(values) {
|
|
|
722
768
|
var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
|
|
723
769
|
// Annotate the CommonJS export names for ESM import in node:
|
|
724
770
|
0 && (module.exports = {
|
|
771
|
+
PandaError,
|
|
725
772
|
astish,
|
|
726
773
|
calc,
|
|
727
774
|
camelCaseProperty,
|
|
@@ -742,12 +789,16 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
742
789
|
getDotPath,
|
|
743
790
|
getNegativePath,
|
|
744
791
|
getOrCreateSet,
|
|
792
|
+
getPatternStyles,
|
|
745
793
|
getSlotCompoundVariant,
|
|
746
794
|
getSlotRecipes,
|
|
747
795
|
getUnit,
|
|
748
796
|
hypenateProperty,
|
|
749
797
|
isBaseCondition,
|
|
750
798
|
isBoolean,
|
|
799
|
+
isCssFunction,
|
|
800
|
+
isCssUnit,
|
|
801
|
+
isCssVar,
|
|
751
802
|
isFunction,
|
|
752
803
|
isImportant,
|
|
753
804
|
isObject,
|
|
@@ -762,6 +813,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
762
813
|
normalizeShorthand,
|
|
763
814
|
normalizeStyleObject,
|
|
764
815
|
parseJson,
|
|
816
|
+
patternFns,
|
|
765
817
|
splitBy,
|
|
766
818
|
splitDotPath,
|
|
767
819
|
splitProps,
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/arbitrary-value.ts
|
|
2
|
-
var getArbitraryValue = (
|
|
3
|
-
if (!
|
|
4
|
-
return
|
|
2
|
+
var getArbitraryValue = (_value) => {
|
|
3
|
+
if (!_value || typeof _value !== "string")
|
|
4
|
+
return _value;
|
|
5
|
+
const value = _value.trim();
|
|
5
6
|
if (value[0] === "[" && value[value.length - 1] === "]") {
|
|
6
7
|
const innerValue = value.slice(1, -1);
|
|
7
8
|
let bracketCount = 0;
|
|
@@ -16,7 +17,7 @@ var getArbitraryValue = (value) => {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
if (bracketCount === 0) {
|
|
19
|
-
return innerValue;
|
|
20
|
+
return innerValue.trim();
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
return value;
|
|
@@ -114,7 +115,7 @@ function filterBaseConditions(c) {
|
|
|
114
115
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
// src/
|
|
118
|
+
// src/important.ts
|
|
118
119
|
var importantRegex = /\s*!(important)?/i;
|
|
119
120
|
function isImportant(value) {
|
|
120
121
|
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
@@ -309,7 +310,7 @@ function createMergeCss(context) {
|
|
|
309
310
|
return { mergeCss: memo(mergeCss), assignCss };
|
|
310
311
|
}
|
|
311
312
|
|
|
312
|
-
// src/
|
|
313
|
+
// src/unit-conversion.ts
|
|
313
314
|
var BASE_FONT_SIZE = 16;
|
|
314
315
|
var UNIT_PX = "px";
|
|
315
316
|
var UNIT_EM = "em";
|
|
@@ -431,6 +432,17 @@ function mapEntries(obj, f) {
|
|
|
431
432
|
return result;
|
|
432
433
|
}
|
|
433
434
|
|
|
435
|
+
// src/error.ts
|
|
436
|
+
var PandaError = class extends Error {
|
|
437
|
+
code;
|
|
438
|
+
hint;
|
|
439
|
+
constructor(code, message, opts) {
|
|
440
|
+
super(message);
|
|
441
|
+
this.code = `ERR_PANDA_${code}`;
|
|
442
|
+
this.hint = opts?.hint;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
|
|
434
446
|
// src/esc.ts
|
|
435
447
|
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
|
|
436
448
|
var fcssescape = function(ch, asCodePoint) {
|
|
@@ -484,6 +496,34 @@ var hypenateProperty = memo((property) => {
|
|
|
484
496
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
485
497
|
});
|
|
486
498
|
|
|
499
|
+
// src/is-css-function.ts
|
|
500
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
501
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
502
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
503
|
+
|
|
504
|
+
// src/is-css-unit.ts
|
|
505
|
+
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,%";
|
|
506
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
507
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
508
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
509
|
+
|
|
510
|
+
// src/is-css-var.ts
|
|
511
|
+
var isCssVar2 = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
512
|
+
|
|
513
|
+
// src/pattern-fns.ts
|
|
514
|
+
var patternFns = {
|
|
515
|
+
map: mapObject,
|
|
516
|
+
isCssFunction,
|
|
517
|
+
isCssVar: isCssVar2,
|
|
518
|
+
isCssUnit
|
|
519
|
+
};
|
|
520
|
+
var getPatternStyles = (pattern, styles) => {
|
|
521
|
+
if (!pattern.defaultValues)
|
|
522
|
+
return styles;
|
|
523
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
524
|
+
return Object.assign({}, defaults, compact(styles));
|
|
525
|
+
};
|
|
526
|
+
|
|
487
527
|
// src/regex.ts
|
|
488
528
|
var createRegex = (item) => {
|
|
489
529
|
const regex2 = item.map((item2) => typeof item2 === "string" ? `^${item2}$` : item2.source).join("|");
|
|
@@ -640,6 +680,7 @@ function unionType(values) {
|
|
|
640
680
|
// src/uniq.ts
|
|
641
681
|
var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
|
|
642
682
|
export {
|
|
683
|
+
PandaError,
|
|
643
684
|
astish,
|
|
644
685
|
calc,
|
|
645
686
|
camelCaseProperty,
|
|
@@ -660,12 +701,16 @@ export {
|
|
|
660
701
|
getDotPath,
|
|
661
702
|
getNegativePath,
|
|
662
703
|
getOrCreateSet,
|
|
704
|
+
getPatternStyles,
|
|
663
705
|
getSlotCompoundVariant,
|
|
664
706
|
getSlotRecipes,
|
|
665
707
|
getUnit,
|
|
666
708
|
hypenateProperty,
|
|
667
709
|
isBaseCondition,
|
|
668
710
|
isBoolean,
|
|
711
|
+
isCssFunction,
|
|
712
|
+
isCssUnit,
|
|
713
|
+
isCssVar2 as isCssVar,
|
|
669
714
|
isFunction,
|
|
670
715
|
isImportant,
|
|
671
716
|
isObject,
|
|
@@ -680,6 +725,7 @@ export {
|
|
|
680
725
|
normalizeShorthand,
|
|
681
726
|
normalizeStyleObject,
|
|
682
727
|
parseJson,
|
|
728
|
+
patternFns,
|
|
683
729
|
splitBy,
|
|
684
730
|
splitDotPath,
|
|
685
731
|
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,
|