@pandacss/shared
Advanced tools
Comparing version
@@ -31,15 +31,11 @@ "use strict"; | ||
var astish = (val, tree = [{}]) => { | ||
if (!val) | ||
return tree[0]; | ||
if (!val) return tree[0]; | ||
let block, left; | ||
while (block = newRule.exec(val.replace(ruleClean, ""))) { | ||
if (block[4]) | ||
tree.shift(); | ||
if (block[4]) tree.shift(); | ||
else if (block[3]) { | ||
left = block[3].replace(ruleNewline, empty).trim(); | ||
if (!left.includes("&") && !left.startsWith("@")) | ||
left = "& " + left; | ||
if (!left.includes("&") && !left.startsWith("@")) left = "& " + left; | ||
tree.unshift(tree[0][left] = tree[0][left] || {}); | ||
} else | ||
tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim(); | ||
} else tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim(); | ||
} | ||
@@ -46,0 +42,0 @@ return tree[0]; |
@@ -1,2 +0,2 @@ | ||
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-DTGzt6ot.js'; | ||
import { W as WalkObjectStopFn, C as CreateCssContext, M as MappedObject } from './shared-DTGzt6ot.js'; | ||
export { y as WalkObjectOptions, g as compact, e as createCss, f as createMergeCss, j as filterBaseConditions, r as getPatternStyles, u as getSlotCompoundVariant, s as getSlotRecipes, k as hypenateProperty, h as isBaseCondition, a as isBoolean, b as isFunction, l as isImportant, c as isObject, d as isObjectOrArray, i as isString, A as mapObject, n as markImportant, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, w as withoutImportant, m as withoutSpace } from './shared-DTGzt6ot.js'; | ||
@@ -3,0 +3,0 @@ export { astish } from './astish.js'; |
@@ -21,4 +21,4 @@ "use strict"; | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
var index_exports = {}; | ||
__export(index_exports, { | ||
CacheMap: () => CacheMap, | ||
@@ -92,8 +92,7 @@ PANDA_CONFIG_NAME: () => PANDA_CONFIG_NAME, | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
module.exports = __toCommonJS(index_exports); | ||
// src/arbitrary-value.ts | ||
var getArbitraryValue = (_value) => { | ||
if (!_value || typeof _value !== "string") | ||
return _value; | ||
if (!_value || typeof _value !== "string") return _value; | ||
const value = _value.trim(); | ||
@@ -147,15 +146,11 @@ if (value[0] === "[" && value[value.length - 1] === "]") { | ||
var astish = (val, tree = [{}]) => { | ||
if (!val) | ||
return tree[0]; | ||
if (!val) return tree[0]; | ||
let block, left; | ||
while (block = newRule.exec(val.replace(ruleClean, ""))) { | ||
if (block[4]) | ||
tree.shift(); | ||
if (block[4]) tree.shift(); | ||
else if (block[3]) { | ||
left = block[3].replace(ruleNewline, empty).trim(); | ||
if (!left.includes("&") && !left.startsWith("@")) | ||
left = "& " + left; | ||
if (!left.includes("&") && !left.startsWith("@")) left = "& " + left; | ||
tree.unshift(tree[0][left] = tree[0][left] || {}); | ||
} else | ||
tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim(); | ||
} else tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim(); | ||
} | ||
@@ -283,4 +278,3 @@ return tree[0]; | ||
var camelCaseProperty = memo((property) => { | ||
if (property.startsWith("--")) | ||
return property; | ||
if (property.startsWith("--")) return property; | ||
let str = property.toLowerCase(); | ||
@@ -315,4 +309,3 @@ str = str.startsWith("-ms-") ? str.substring(1) : str; | ||
let x; | ||
for (x = Math.abs(code); x > 52; x = x / 52 | 0) | ||
name = toChar(x % 52) + name; | ||
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name; | ||
return toChar(x % 52) + name; | ||
@@ -322,4 +315,3 @@ } | ||
let i = x.length; | ||
while (i) | ||
h = h * 33 ^ x.charCodeAt(--i); | ||
while (i) h = h * 33 ^ x.charCodeAt(--i); | ||
return h; | ||
@@ -369,7 +361,5 @@ } | ||
return sources.reduce((prev, obj) => { | ||
if (!obj) | ||
return prev; | ||
if (!obj) return prev; | ||
Object.keys(obj).forEach((key) => { | ||
if (MERGE_OMIT.has(key)) | ||
return; | ||
if (MERGE_OMIT.has(key)) return; | ||
const prevValue = prev[key]; | ||
@@ -412,6 +402,4 @@ const value = obj[key]; | ||
function mapObject(obj, fn) { | ||
if (Array.isArray(obj)) | ||
return obj.map((value) => fn(value)); | ||
if (!isObject(obj)) | ||
return fn(obj); | ||
if (Array.isArray(obj)) return obj.map((value) => fn(value)); | ||
if (!isObject(obj)) return fn(obj); | ||
return walkObject(obj, (value) => fn(value)); | ||
@@ -474,4 +462,3 @@ } | ||
walkObject(normalizedObject, (value, paths) => { | ||
if (value == null) | ||
return; | ||
if (value == null) return; | ||
const important = isImportant(value); | ||
@@ -482,4 +469,3 @@ const [prop, ...allConditions] = conds.shift(paths); | ||
let className = hashFn(conditions, transformed.className); | ||
if (important) | ||
className = `${className}!`; | ||
if (important) className = `${className}!`; | ||
classNames.add(className); | ||
@@ -496,4 +482,3 @@ }); | ||
const allStyles = compactStyles(...styles); | ||
if (allStyles.length === 1) | ||
return allStyles; | ||
if (allStyles.length === 1) return allStyles; | ||
return allStyles.map((style) => normalizeStyleObject(style, context)); | ||
@@ -590,8 +575,5 @@ } | ||
var fcssescape = function(ch, asCodePoint) { | ||
if (!asCodePoint) | ||
return "\\" + ch; | ||
if (ch === "\0") | ||
return "\uFFFD"; | ||
if (ch === "-" && ch.length === 1) | ||
return "\\-"; | ||
if (!asCodePoint) return "\\" + ch; | ||
if (ch === "\0") return "\uFFFD"; | ||
if (ch === "-" && ch.length === 1) return "\\-"; | ||
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16); | ||
@@ -605,4 +587,3 @@ }; | ||
function filterDefault(path) { | ||
if (path[0] === "DEFAULT") | ||
return path; | ||
if (path[0] === "DEFAULT") return path; | ||
return path.filter((item) => item !== "DEFAULT"); | ||
@@ -643,4 +624,3 @@ } | ||
var hypenateProperty = memo((property) => { | ||
if (property.startsWith("--")) | ||
return property; | ||
if (property.startsWith("--")) return property; | ||
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase(); | ||
@@ -742,4 +722,3 @@ }); | ||
var getPatternStyles = (pattern, styles) => { | ||
if (!pattern?.defaultValues) | ||
return styles; | ||
if (!pattern?.defaultValues) return styles; | ||
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues; | ||
@@ -884,2 +863,3 @@ return Object.assign({}, defaults, compact(styles)); | ||
longHandLogical.add("boxSizing"); | ||
longHandLogical.add("fieldSizing"); | ||
longHandLogical.add("blockSize"); | ||
@@ -1202,14 +1182,8 @@ longHandPhysical.add("height"); | ||
function getPropertyPriority(key) { | ||
if (key === "all") | ||
return 0; | ||
if (key.startsWith("--")) | ||
return 1; | ||
if (longHandPhysical.has(key)) | ||
return 4e3; | ||
if (longHandLogical.has(key)) | ||
return 3e3; | ||
if (shorthandsOfLonghands.has(key)) | ||
return 2e3; | ||
if (shorthandsOfShorthands.has(key)) | ||
return 1e3; | ||
if (key === "all") return 0; | ||
if (key.startsWith("--")) return 1; | ||
if (longHandPhysical.has(key)) return 4e3; | ||
if (longHandLogical.has(key)) return 3e3; | ||
if (shorthandsOfLonghands.has(key)) return 2e3; | ||
if (shorthandsOfShorthands.has(key)) return 1e3; | ||
return 3e3; | ||
@@ -1227,4 +1201,3 @@ } | ||
return JSON.stringify(config, (_key, value) => { | ||
if (typeof value === "function") | ||
return value.toString(); | ||
if (typeof value === "function") return value.toString(); | ||
return value; | ||
@@ -1296,4 +1269,3 @@ }); | ||
function getDotPath(obj, path, fallback) { | ||
if (typeof path !== "string") | ||
return fallback; | ||
if (typeof path !== "string") return fallback; | ||
const idx = path.indexOf("."); | ||
@@ -1348,4 +1320,3 @@ if (idx === -1) { | ||
const arr = Array.from(values); | ||
if (fallback != null && !arr.length) | ||
return fallback; | ||
if (fallback != null && !arr.length) return fallback; | ||
return arr.map((v) => stringify(v)).join(" | "); | ||
@@ -1382,4 +1353,3 @@ } | ||
const unit = getUnit(value); | ||
if (!unit) | ||
return value; | ||
if (!unit) return value; | ||
if (unit === UNIT_PX) { | ||
@@ -1394,4 +1364,3 @@ return value; | ||
const unit = getUnit(value); | ||
if (!unit) | ||
return value; | ||
if (!unit) return value; | ||
if (unit === UNIT_EM) { | ||
@@ -1409,4 +1378,3 @@ return value; | ||
const unit = getUnit(value); | ||
if (!unit) | ||
return value; | ||
if (!unit) return value; | ||
if (unit === UNIT_REM) { | ||
@@ -1413,0 +1381,0 @@ return value; |
@@ -69,4 +69,3 @@ "use strict"; | ||
let x; | ||
for (x = Math.abs(code); x > 52; x = x / 52 | 0) | ||
name = toChar(x % 52) + name; | ||
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name; | ||
return toChar(x % 52) + name; | ||
@@ -76,4 +75,3 @@ } | ||
let i = x.length; | ||
while (i) | ||
h = h * 33 ^ x.charCodeAt(--i); | ||
while (i) h = h * 33 ^ x.charCodeAt(--i); | ||
return h; | ||
@@ -116,7 +114,5 @@ } | ||
return sources.reduce((prev, obj) => { | ||
if (!obj) | ||
return prev; | ||
if (!obj) return prev; | ||
Object.keys(obj).forEach((key) => { | ||
if (MERGE_OMIT.has(key)) | ||
return; | ||
if (MERGE_OMIT.has(key)) return; | ||
const prevValue = prev[key]; | ||
@@ -159,6 +155,4 @@ const value = obj[key]; | ||
function mapObject(obj, fn) { | ||
if (Array.isArray(obj)) | ||
return obj.map((value) => fn(value)); | ||
if (!isObject(obj)) | ||
return fn(obj); | ||
if (Array.isArray(obj)) return obj.map((value) => fn(value)); | ||
if (!isObject(obj)) return fn(obj); | ||
return walkObject(obj, (value) => fn(value)); | ||
@@ -221,4 +215,3 @@ } | ||
walkObject(normalizedObject, (value, paths) => { | ||
if (value == null) | ||
return; | ||
if (value == null) return; | ||
const important = isImportant(value); | ||
@@ -229,4 +222,3 @@ const [prop, ...allConditions] = conds.shift(paths); | ||
let className = hashFn(conditions, transformed.className); | ||
if (important) | ||
className = `${className}!`; | ||
if (important) className = `${className}!`; | ||
classNames.add(className); | ||
@@ -243,4 +235,3 @@ }); | ||
const allStyles = compactStyles(...styles); | ||
if (allStyles.length === 1) | ||
return allStyles; | ||
if (allStyles.length === 1) return allStyles; | ||
return allStyles.map((style) => normalizeStyleObject(style, context)); | ||
@@ -261,4 +252,3 @@ } | ||
var hypenateProperty = memo((property) => { | ||
if (property.startsWith("--")) | ||
return property; | ||
if (property.startsWith("--")) return property; | ||
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase(); | ||
@@ -289,4 +279,3 @@ }); | ||
var getPatternStyles = (pattern, styles) => { | ||
if (!pattern?.defaultValues) | ||
return styles; | ||
if (!pattern?.defaultValues) return styles; | ||
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues; | ||
@@ -293,0 +282,0 @@ return Object.assign({}, defaults, compact(styles)); |
{ | ||
"name": "@pandacss/shared", | ||
"version": "0.54.0", | ||
"version": "1.0.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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
-100%136805
-0.3%3635
-2.52%