@pandacss/shared 0.37.2 → 0.38.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,11 +1,33 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-5yRolXii.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, j as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, k 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, l as withoutSpace } from './shared-5yRolXii.mjs';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-eaCmCttJ.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, j as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, k 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, l as withoutSpace } from './shared-eaCmCttJ.mjs';
3
3
  export { astish } from './astish.mjs';
4
4
 
5
5
  declare const getArbitraryValue: (_value: string) => string;
6
6
 
7
7
  declare function assign(target: any, ...sources: any[]): any;
8
8
 
9
+ declare class CacheMap<K, V> implements Map<K, V> {
10
+ private cache;
11
+ private keysInUse;
12
+ private maxCacheSize;
13
+ constructor(maxCacheSize?: number);
14
+ get(key: K): V | undefined;
15
+ set(key: K, value: V): this;
16
+ delete(key: K): boolean;
17
+ private updateKeyUsage;
18
+ private evictLeastRecentlyUsed;
19
+ clear(): void;
20
+ has(key: K): boolean;
21
+ get size(): number;
22
+ forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
23
+ keys(): IterableIterator<K>;
24
+ values(): IterableIterator<V>;
25
+ entries(): IterableIterator<[K, V]>;
26
+ [Symbol.iterator](): IterableIterator<[K, V]>;
27
+ [Symbol.toStringTag]: string;
28
+ toJSON: () => Map<K, V>;
29
+ }
30
+
9
31
  type Operand = string | number | {
10
32
  ref: string;
11
33
  };
@@ -134,4 +156,4 @@ declare function toPx(value?: string | number): string | undefined;
134
156
  declare function toEm(value?: string, fontSize?: number): string | undefined;
135
157
  declare function toRem(value?: string): string | undefined;
136
158
 
137
- export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
159
+ export { CacheMap, CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,33 @@
1
- import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-5yRolXii.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, j as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, k 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, l as withoutSpace } from './shared-5yRolXii.js';
1
+ import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-eaCmCttJ.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, j as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, k 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, l as withoutSpace } from './shared-eaCmCttJ.js';
3
3
  export { astish } from './astish.js';
4
4
 
5
5
  declare const getArbitraryValue: (_value: string) => string;
6
6
 
7
7
  declare function assign(target: any, ...sources: any[]): any;
8
8
 
9
+ declare class CacheMap<K, V> implements Map<K, V> {
10
+ private cache;
11
+ private keysInUse;
12
+ private maxCacheSize;
13
+ constructor(maxCacheSize?: number);
14
+ get(key: K): V | undefined;
15
+ set(key: K, value: V): this;
16
+ delete(key: K): boolean;
17
+ private updateKeyUsage;
18
+ private evictLeastRecentlyUsed;
19
+ clear(): void;
20
+ has(key: K): boolean;
21
+ get size(): number;
22
+ forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
23
+ keys(): IterableIterator<K>;
24
+ values(): IterableIterator<V>;
25
+ entries(): IterableIterator<[K, V]>;
26
+ [Symbol.iterator](): IterableIterator<[K, V]>;
27
+ [Symbol.toStringTag]: string;
28
+ toJSON: () => Map<K, V>;
29
+ }
30
+
9
31
  type Operand = string | number | {
10
32
  ref: string;
11
33
  };
@@ -134,4 +156,4 @@ declare function toPx(value?: string | number): string | undefined;
134
156
  declare function toEm(value?: string, fontSize?: number): string | undefined;
135
157
  declare function toRem(value?: string): string | undefined;
136
158
 
137
- export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
159
+ export { CacheMap, CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, assign, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, 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
+ CacheMap: () => CacheMap,
23
24
  PandaError: () => PandaError,
24
25
  assign: () => assign,
25
26
  astish: () => astish,
@@ -154,6 +155,85 @@ var astish = (val, tree = [{}]) => {
154
155
  return tree[0];
155
156
  };
156
157
 
158
+ // src/cache-map.ts
159
+ var CacheMap = class {
160
+ cache;
161
+ keysInUse;
162
+ maxCacheSize;
163
+ constructor(maxCacheSize = 1e3) {
164
+ this.maxCacheSize = maxCacheSize;
165
+ this.cache = /* @__PURE__ */ new Map();
166
+ this.keysInUse = [];
167
+ }
168
+ get(key) {
169
+ if (!this.cache.has(key)) {
170
+ return void 0;
171
+ }
172
+ this.updateKeyUsage(key);
173
+ return this.cache.get(key);
174
+ }
175
+ set(key, value) {
176
+ if (!this.cache.has(key) && this.cache.size === this.maxCacheSize) {
177
+ this.evictLeastRecentlyUsed();
178
+ }
179
+ this.cache.set(key, value);
180
+ this.updateKeyUsage(key);
181
+ return this;
182
+ }
183
+ delete(key) {
184
+ const result = this.cache.delete(key);
185
+ if (result) {
186
+ const index = this.keysInUse.indexOf(key);
187
+ if (index !== -1) {
188
+ this.keysInUse.splice(index, 1);
189
+ }
190
+ }
191
+ return result;
192
+ }
193
+ updateKeyUsage(key) {
194
+ const index = this.keysInUse.indexOf(key);
195
+ if (index !== -1) {
196
+ this.keysInUse.splice(index, 1);
197
+ }
198
+ this.keysInUse.push(key);
199
+ }
200
+ evictLeastRecentlyUsed() {
201
+ const keyToEvict = this.keysInUse.shift();
202
+ if (keyToEvict !== void 0) {
203
+ this.cache.delete(keyToEvict);
204
+ }
205
+ }
206
+ clear() {
207
+ this.cache.clear();
208
+ this.keysInUse = [];
209
+ }
210
+ has(key) {
211
+ return this.cache.has(key);
212
+ }
213
+ get size() {
214
+ return this.cache.size;
215
+ }
216
+ forEach(callback2, thisArg) {
217
+ this.cache.forEach(callback2, thisArg);
218
+ }
219
+ keys() {
220
+ return this.cache.keys();
221
+ }
222
+ values() {
223
+ return this.cache.values();
224
+ }
225
+ entries() {
226
+ return this.cache.entries();
227
+ }
228
+ [Symbol.iterator]() {
229
+ return this.cache[Symbol.iterator]();
230
+ }
231
+ [Symbol.toStringTag] = "CacheMap";
232
+ toJSON = () => {
233
+ return this.cache;
234
+ };
235
+ };
236
+
157
237
  // src/calc.ts
158
238
  function isCssVar(value) {
159
239
  return isObject(value) && "ref" in value;
@@ -943,6 +1023,7 @@ function toRem(value = "") {
943
1023
  }
944
1024
  // Annotate the CommonJS export names for ESM import in node:
945
1025
  0 && (module.exports = {
1026
+ CacheMap,
946
1027
  PandaError,
947
1028
  assign,
948
1029
  astish,
package/dist/index.mjs CHANGED
@@ -64,6 +64,85 @@ var astish = (val, tree = [{}]) => {
64
64
  return tree[0];
65
65
  };
66
66
 
67
+ // src/cache-map.ts
68
+ var CacheMap = class {
69
+ cache;
70
+ keysInUse;
71
+ maxCacheSize;
72
+ constructor(maxCacheSize = 1e3) {
73
+ this.maxCacheSize = maxCacheSize;
74
+ this.cache = /* @__PURE__ */ new Map();
75
+ this.keysInUse = [];
76
+ }
77
+ get(key) {
78
+ if (!this.cache.has(key)) {
79
+ return void 0;
80
+ }
81
+ this.updateKeyUsage(key);
82
+ return this.cache.get(key);
83
+ }
84
+ set(key, value) {
85
+ if (!this.cache.has(key) && this.cache.size === this.maxCacheSize) {
86
+ this.evictLeastRecentlyUsed();
87
+ }
88
+ this.cache.set(key, value);
89
+ this.updateKeyUsage(key);
90
+ return this;
91
+ }
92
+ delete(key) {
93
+ const result = this.cache.delete(key);
94
+ if (result) {
95
+ const index = this.keysInUse.indexOf(key);
96
+ if (index !== -1) {
97
+ this.keysInUse.splice(index, 1);
98
+ }
99
+ }
100
+ return result;
101
+ }
102
+ updateKeyUsage(key) {
103
+ const index = this.keysInUse.indexOf(key);
104
+ if (index !== -1) {
105
+ this.keysInUse.splice(index, 1);
106
+ }
107
+ this.keysInUse.push(key);
108
+ }
109
+ evictLeastRecentlyUsed() {
110
+ const keyToEvict = this.keysInUse.shift();
111
+ if (keyToEvict !== void 0) {
112
+ this.cache.delete(keyToEvict);
113
+ }
114
+ }
115
+ clear() {
116
+ this.cache.clear();
117
+ this.keysInUse = [];
118
+ }
119
+ has(key) {
120
+ return this.cache.has(key);
121
+ }
122
+ get size() {
123
+ return this.cache.size;
124
+ }
125
+ forEach(callback2, thisArg) {
126
+ this.cache.forEach(callback2, thisArg);
127
+ }
128
+ keys() {
129
+ return this.cache.keys();
130
+ }
131
+ values() {
132
+ return this.cache.values();
133
+ }
134
+ entries() {
135
+ return this.cache.entries();
136
+ }
137
+ [Symbol.iterator]() {
138
+ return this.cache[Symbol.iterator]();
139
+ }
140
+ [Symbol.toStringTag] = "CacheMap";
141
+ toJSON = () => {
142
+ return this.cache;
143
+ };
144
+ };
145
+
67
146
  // src/calc.ts
68
147
  function isCssVar(value) {
69
148
  return isObject(value) && "ref" in value;
@@ -852,6 +931,7 @@ function toRem(value = "") {
852
931
  }
853
932
  }
854
933
  export {
934
+ CacheMap,
855
935
  PandaError,
856
936
  assign,
857
937
  astish,
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, j 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, l as withoutSpace } from './shared-5yRolXii.mjs';
1
+ export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, j 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, l as withoutSpace } from './shared-eaCmCttJ.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, j 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, l as withoutSpace } from './shared-5yRolXii.js';
1
+ export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, j 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, l as withoutSpace } from './shared-eaCmCttJ.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.37.2",
3
+ "version": "0.38.0",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",