@pandacss/shared
Advanced tools
Comparing version 0.0.0-dev-20240130182551 to 0.0.0-dev-20240201185610
@@ -1,3 +0,3 @@ | ||
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-bFj3Wgxk.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, 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'; | ||
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-F25j1lrb.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, 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-F25j1lrb.js'; | ||
export { astish } from './astish.js'; | ||
@@ -108,2 +108,2 @@ | ||
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 }; | ||
export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, 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 }; |
@@ -205,2 +205,23 @@ "use strict"; | ||
// src/hash.ts | ||
function toChar(code) { | ||
return String.fromCharCode(code + (code > 25 ? 39 : 97)); | ||
} | ||
function toName(code) { | ||
let name = ""; | ||
let x; | ||
for (x = Math.abs(code); x > 52; x = x / 52 | 0) | ||
name = toChar(x % 52) + name; | ||
return toChar(x % 52) + name; | ||
} | ||
function toPhash(h, x) { | ||
let i = x.length; | ||
while (i) | ||
h = h * 33 ^ x.charCodeAt(--i); | ||
return h; | ||
} | ||
function toHash(value) { | ||
return toName(toPhash(5381, value) >>> 0); | ||
} | ||
// src/important.ts | ||
@@ -240,23 +261,2 @@ var importantRegex = /\s*!(important)?/i; | ||
// src/hash.ts | ||
function toChar(code) { | ||
return String.fromCharCode(code + (code > 25 ? 39 : 97)); | ||
} | ||
function toName(code) { | ||
let name = ""; | ||
let x; | ||
for (x = Math.abs(code); x > 52; x = x / 52 | 0) | ||
name = toChar(x % 52) + name; | ||
return toChar(x % 52) + name; | ||
} | ||
function toPhash(h, x) { | ||
let i = x.length; | ||
while (i) | ||
h = h * 33 ^ x.charCodeAt(--i); | ||
return h; | ||
} | ||
function toHash(value) { | ||
return toName(toPhash(5381, value) >>> 0); | ||
} | ||
// src/merge-props.ts | ||
@@ -358,3 +358,3 @@ function mergeProps(...sources) { | ||
const baseArray = [...conds.finalize(conditions), className]; | ||
result = formatClassName(toHash(baseArray.join(":"))); | ||
result = formatClassName(utility.toHash(baseArray, toHash)); | ||
} else { | ||
@@ -361,0 +361,0 @@ const baseArray = [...conds.finalize(conditions), formatClassName(className)]; |
@@ -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, 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'; | ||
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-F25j1lrb.js'; |
@@ -61,14 +61,2 @@ "use strict"; | ||
// src/important.ts | ||
var importantRegex = /\s*!(important)?/i; | ||
function isImportant(value) { | ||
return typeof value === "string" ? importantRegex.test(value) : false; | ||
} | ||
function withoutImportant(value) { | ||
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value; | ||
} | ||
function withoutSpace(str) { | ||
return typeof str === "string" ? str.replaceAll(" ", "_") : str; | ||
} | ||
// src/hash.ts | ||
@@ -95,2 +83,29 @@ function toChar(code) { | ||
// src/important.ts | ||
var importantRegex = /\s*!(important)?/i; | ||
function isImportant(value) { | ||
return typeof value === "string" ? importantRegex.test(value) : false; | ||
} | ||
function withoutImportant(value) { | ||
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value; | ||
} | ||
function withoutSpace(str) { | ||
return typeof str === "string" ? str.replaceAll(" ", "_") : str; | ||
} | ||
// src/memo.ts | ||
var memo = (fn) => { | ||
const cache = /* @__PURE__ */ new Map(); | ||
const get = (...args) => { | ||
const key = JSON.stringify(args); | ||
if (cache.has(key)) { | ||
return cache.get(key); | ||
} | ||
const result = fn(...args); | ||
cache.set(key, result); | ||
return result; | ||
}; | ||
return get; | ||
}; | ||
// src/merge-props.ts | ||
@@ -113,17 +128,2 @@ function mergeProps(...sources) { | ||
// src/memo.ts | ||
var memo = (fn) => { | ||
const cache = /* @__PURE__ */ new Map(); | ||
const get = (...args) => { | ||
const key = JSON.stringify(args); | ||
if (cache.has(key)) { | ||
return cache.get(key); | ||
} | ||
const result = fn(...args); | ||
cache.set(key, result); | ||
return result; | ||
}; | ||
return get; | ||
}; | ||
// src/walk-object.ts | ||
@@ -208,3 +208,3 @@ var isNotNullish = (element) => element != null; | ||
const baseArray = [...conds.finalize(conditions), className]; | ||
result = formatClassName(toHash(baseArray.join(":"))); | ||
result = formatClassName(utility.toHash(baseArray, toHash)); | ||
} else { | ||
@@ -211,0 +211,0 @@ const baseArray = [...conds.finalize(conditions), formatClassName(className)]; |
{ | ||
"name": "@pandacss/shared", | ||
"version": "0.0.0-dev-20240130182551", | ||
"version": "0.0.0-dev-20240201185610", | ||
"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
Sorry, the diff of this file is not supported yet
90884
2423