@pandacss/shared 0.28.0 → 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 CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-MIujjRlg.mjs';
2
- export { r as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getSlotCompoundVariant, p as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, x as mapObject, m as markImportant, n as memo, o as mergeProps, s as splitProps, t as toHash, u as uniq, v as walkObject, w as withoutImportant, k as withoutSpace } from './shared-MIujjRlg.mjs';
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;
@@ -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,5 +1,5 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-MIujjRlg.js';
2
- export { r as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getSlotCompoundVariant, p as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, x as mapObject, m as markImportant, n as memo, o as mergeProps, s as splitProps, t as toHash, u as uniq, v as walkObject, w as withoutImportant, k as withoutSpace } from './shared-MIujjRlg.js';
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;
@@ -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,
@@ -196,7 +202,7 @@ function filterBaseConditions(c) {
196
202
  return c.slice().filter((v) => !isBaseCondition(v));
197
203
  }
198
204
 
199
- // src/css-important.ts
205
+ // src/important.ts
200
206
  var importantRegex = /\s*!(important)?/i;
201
207
  function isImportant(value) {
202
208
  return typeof value === "string" ? importantRegex.test(value) : false;
@@ -391,7 +397,7 @@ function createMergeCss(context) {
391
397
  return { mergeCss: memo(mergeCss), assignCss };
392
398
  }
393
399
 
394
- // src/css-unit.ts
400
+ // src/unit-conversion.ts
395
401
  var BASE_FONT_SIZE = 16;
396
402
  var UNIT_PX = "px";
397
403
  var UNIT_EM = "em";
@@ -513,6 +519,17 @@ function mapEntries(obj, f) {
513
519
  return result;
514
520
  }
515
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
+
516
533
  // src/esc.ts
517
534
  var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
518
535
  var fcssescape = function(ch, asCodePoint) {
@@ -566,6 +583,34 @@ var hypenateProperty = memo((property) => {
566
583
  return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
567
584
  });
568
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
+
569
614
  // src/regex.ts
570
615
  var createRegex = (item) => {
571
616
  const regex2 = item.map((item2) => typeof item2 === "string" ? `^${item2}$` : item2.source).join("|");
@@ -723,6 +768,7 @@ function unionType(values) {
723
768
  var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
724
769
  // Annotate the CommonJS export names for ESM import in node:
725
770
  0 && (module.exports = {
771
+ PandaError,
726
772
  astish,
727
773
  calc,
728
774
  camelCaseProperty,
@@ -743,12 +789,16 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
743
789
  getDotPath,
744
790
  getNegativePath,
745
791
  getOrCreateSet,
792
+ getPatternStyles,
746
793
  getSlotCompoundVariant,
747
794
  getSlotRecipes,
748
795
  getUnit,
749
796
  hypenateProperty,
750
797
  isBaseCondition,
751
798
  isBoolean,
799
+ isCssFunction,
800
+ isCssUnit,
801
+ isCssVar,
752
802
  isFunction,
753
803
  isImportant,
754
804
  isObject,
@@ -763,6 +813,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
763
813
  normalizeShorthand,
764
814
  normalizeStyleObject,
765
815
  parseJson,
816
+ patternFns,
766
817
  splitBy,
767
818
  splitDotPath,
768
819
  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/css-important.ts
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/css-unit.ts
313
+ // src/unit-conversion.ts
314
314
  var BASE_FONT_SIZE = 16;
315
315
  var UNIT_PX = "px";
316
316
  var UNIT_EM = "em";
@@ -432,6 +432,17 @@ function mapEntries(obj, f) {
432
432
  return result;
433
433
  }
434
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
+
435
446
  // src/esc.ts
436
447
  var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
437
448
  var fcssescape = function(ch, asCodePoint) {
@@ -485,6 +496,34 @@ var hypenateProperty = memo((property) => {
485
496
  return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
486
497
  });
487
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
+
488
527
  // src/regex.ts
489
528
  var createRegex = (item) => {
490
529
  const regex2 = item.map((item2) => typeof item2 === "string" ? `^${item2}$` : item2.source).join("|");
@@ -641,6 +680,7 @@ function unionType(values) {
641
680
  // src/uniq.ts
642
681
  var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
643
682
  export {
683
+ PandaError,
644
684
  astish,
645
685
  calc,
646
686
  camelCaseProperty,
@@ -661,12 +701,16 @@ export {
661
701
  getDotPath,
662
702
  getNegativePath,
663
703
  getOrCreateSet,
704
+ getPatternStyles,
664
705
  getSlotCompoundVariant,
665
706
  getSlotRecipes,
666
707
  getUnit,
667
708
  hypenateProperty,
668
709
  isBaseCondition,
669
710
  isBoolean,
711
+ isCssFunction,
712
+ isCssUnit,
713
+ isCssVar2 as isCssVar,
670
714
  isFunction,
671
715
  isImportant,
672
716
  isObject,
@@ -681,6 +725,7 @@ export {
681
725
  normalizeShorthand,
682
726
  normalizeStyleObject,
683
727
  parseJson,
728
+ patternFns,
684
729
  splitBy,
685
730
  splitDotPath,
686
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, getSlotRecipes as p, getSlotCompoundVariant as q, type WalkObjectOptions as r, splitProps as s, toHash as t, uniq as u, walkObject as v, withoutImportant as w, mapObject as x };
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, getSlotRecipes as p, getSlotCompoundVariant as q, type WalkObjectOptions as r, splitProps as s, toHash as t, uniq as u, walkObject as v, withoutImportant as w, mapObject as x };
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, p as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, x as mapObject, n as memo, o as mergeProps, s as splitProps, t as toHash, u as uniq, v as walkObject, k as withoutSpace } from './shared-MIujjRlg.mjs';
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, p as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, x as mapObject, n as memo, o as mergeProps, s as splitProps, t as toHash, u as uniq, v as walkObject, k as withoutSpace } from './shared-MIujjRlg.js';
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/css-important.ts
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/css-important.ts
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",