@pandacss/shared
Advanced tools
+3
-0
@@ -26,2 +26,4 @@ import { W as WalkObjectStopFn, C as CreateCssContext, M as MappedObject } from './shared-DHsOF1Vt.mjs'; | ||
| entries(): MapIterator<[K, V]>; | ||
| getOrInsert(key: K, defaultValue: V): V; | ||
| getOrInsertComputed(key: K, callback: (key: K) => V): V; | ||
| [Symbol.iterator](): MapIterator<[K, V]>; | ||
@@ -77,2 +79,3 @@ [Symbol.toStringTag]: string; | ||
| hint?: string; | ||
| cause?: unknown; | ||
| }); | ||
@@ -79,0 +82,0 @@ } |
+3
-0
@@ -26,2 +26,4 @@ import { W as WalkObjectStopFn, C as CreateCssContext, M as MappedObject } from './shared-DHsOF1Vt.js'; | ||
| entries(): MapIterator<[K, V]>; | ||
| getOrInsert(key: K, defaultValue: V): V; | ||
| getOrInsertComputed(key: K, callback: (key: K) => V): V; | ||
| [Symbol.iterator](): MapIterator<[K, V]>; | ||
@@ -77,2 +79,3 @@ [Symbol.toStringTag]: string; | ||
| hint?: string; | ||
| cause?: unknown; | ||
| }); | ||
@@ -79,0 +82,0 @@ } |
+18
-1
@@ -231,2 +231,19 @@ "use strict"; | ||
| } | ||
| getOrInsert(key, defaultValue) { | ||
| if (this.cache.has(key)) { | ||
| this.updateKeyUsage(key); | ||
| return this.cache.get(key); | ||
| } | ||
| this.set(key, defaultValue); | ||
| return defaultValue; | ||
| } | ||
| getOrInsertComputed(key, callback2) { | ||
| if (this.cache.has(key)) { | ||
| this.updateKeyUsage(key); | ||
| return this.cache.get(key); | ||
| } | ||
| const value = callback2(key); | ||
| this.set(key, value); | ||
| return value; | ||
| } | ||
| [Symbol.iterator]() { | ||
@@ -560,3 +577,3 @@ return this.cache[Symbol.iterator](); | ||
| constructor(code, message, opts) { | ||
| super(message); | ||
| super(message, { cause: opts?.cause }); | ||
| this.code = `ERR_PANDA_${code}`; | ||
@@ -563,0 +580,0 @@ this.hint = opts?.hint; |
+18
-1
@@ -136,2 +136,19 @@ // src/arbitrary-value.ts | ||
| } | ||
| getOrInsert(key, defaultValue) { | ||
| if (this.cache.has(key)) { | ||
| this.updateKeyUsage(key); | ||
| return this.cache.get(key); | ||
| } | ||
| this.set(key, defaultValue); | ||
| return defaultValue; | ||
| } | ||
| getOrInsertComputed(key, callback2) { | ||
| if (this.cache.has(key)) { | ||
| this.updateKeyUsage(key); | ||
| return this.cache.get(key); | ||
| } | ||
| const value = callback2(key); | ||
| this.set(key, value); | ||
| return value; | ||
| } | ||
| [Symbol.iterator]() { | ||
@@ -465,3 +482,3 @@ return this.cache[Symbol.iterator](); | ||
| constructor(code, message, opts) { | ||
| super(message); | ||
| super(message, { cause: opts?.cause }); | ||
| this.code = `ERR_PANDA_${code}`; | ||
@@ -468,0 +485,0 @@ this.hint = opts?.hint; |
+1
-1
| { | ||
| "name": "@pandacss/shared", | ||
| "version": "1.9.1", | ||
| "version": "1.10.0", | ||
| "description": "Shared utilities for css panda", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
144318
0.81%3833
0.97%