@pandacss/shared
Advanced tools
Comparing version 0.37.2 to 0.38.0
@@ -1,3 +0,3 @@ | ||
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-5yRolXii.js'; | ||
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'; | ||
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-eaCmCttJ.js'; | ||
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'; | ||
export { astish } from './astish.js'; | ||
@@ -9,2 +9,24 @@ | ||
declare class CacheMap<K, V> implements Map<K, V> { | ||
private cache; | ||
private keysInUse; | ||
private maxCacheSize; | ||
constructor(maxCacheSize?: number); | ||
get(key: K): V | undefined; | ||
set(key: K, value: V): this; | ||
delete(key: K): boolean; | ||
private updateKeyUsage; | ||
private evictLeastRecentlyUsed; | ||
clear(): void; | ||
has(key: K): boolean; | ||
get size(): number; | ||
forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void; | ||
keys(): IterableIterator<K>; | ||
values(): IterableIterator<V>; | ||
entries(): IterableIterator<[K, V]>; | ||
[Symbol.iterator](): IterableIterator<[K, V]>; | ||
[Symbol.toStringTag]: string; | ||
toJSON: () => Map<K, V>; | ||
} | ||
type Operand = string | number | { | ||
@@ -138,2 +160,2 @@ ref: string; | ||
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 }; | ||
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 }; |
@@ -23,2 +23,3 @@ "use strict"; | ||
__export(src_exports, { | ||
CacheMap: () => CacheMap, | ||
PandaError: () => PandaError, | ||
@@ -158,2 +159,81 @@ assign: () => assign, | ||
// src/cache-map.ts | ||
var CacheMap = class { | ||
cache; | ||
keysInUse; | ||
maxCacheSize; | ||
constructor(maxCacheSize = 1e3) { | ||
this.maxCacheSize = maxCacheSize; | ||
this.cache = /* @__PURE__ */ new Map(); | ||
this.keysInUse = []; | ||
} | ||
get(key) { | ||
if (!this.cache.has(key)) { | ||
return void 0; | ||
} | ||
this.updateKeyUsage(key); | ||
return this.cache.get(key); | ||
} | ||
set(key, value) { | ||
if (!this.cache.has(key) && this.cache.size === this.maxCacheSize) { | ||
this.evictLeastRecentlyUsed(); | ||
} | ||
this.cache.set(key, value); | ||
this.updateKeyUsage(key); | ||
return this; | ||
} | ||
delete(key) { | ||
const result = this.cache.delete(key); | ||
if (result) { | ||
const index = this.keysInUse.indexOf(key); | ||
if (index !== -1) { | ||
this.keysInUse.splice(index, 1); | ||
} | ||
} | ||
return result; | ||
} | ||
updateKeyUsage(key) { | ||
const index = this.keysInUse.indexOf(key); | ||
if (index !== -1) { | ||
this.keysInUse.splice(index, 1); | ||
} | ||
this.keysInUse.push(key); | ||
} | ||
evictLeastRecentlyUsed() { | ||
const keyToEvict = this.keysInUse.shift(); | ||
if (keyToEvict !== void 0) { | ||
this.cache.delete(keyToEvict); | ||
} | ||
} | ||
clear() { | ||
this.cache.clear(); | ||
this.keysInUse = []; | ||
} | ||
has(key) { | ||
return this.cache.has(key); | ||
} | ||
get size() { | ||
return this.cache.size; | ||
} | ||
forEach(callback2, thisArg) { | ||
this.cache.forEach(callback2, thisArg); | ||
} | ||
keys() { | ||
return this.cache.keys(); | ||
} | ||
values() { | ||
return this.cache.values(); | ||
} | ||
entries() { | ||
return this.cache.entries(); | ||
} | ||
[Symbol.iterator]() { | ||
return this.cache[Symbol.iterator](); | ||
} | ||
[Symbol.toStringTag] = "CacheMap"; | ||
toJSON = () => { | ||
return this.cache; | ||
}; | ||
}; | ||
// src/calc.ts | ||
@@ -948,2 +1028,3 @@ function isCssVar(value) { | ||
0 && (module.exports = { | ||
CacheMap, | ||
PandaError, | ||
@@ -950,0 +1031,0 @@ assign, |
@@ -1,1 +0,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'; | ||
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'; |
{ | ||
"name": "@pandacss/shared", | ||
"version": "0.37.2", | ||
"version": "0.38.0", | ||
"description": "Shared utilities for css panda", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109954
2965