@pandacss/shared
Advanced tools
Comparing version 0.0.0-dev-20240825102751 to 0.0.0-dev-20240908184814
@@ -39,2 +39,4 @@ "use strict"; | ||
left = block[3].replace(ruleNewline, empty).trim(); | ||
if (!left.includes("&") && !left.startsWith("@")) | ||
left = "& " + left; | ||
tree.unshift(tree[0][left] = tree[0][left] || {}); | ||
@@ -41,0 +43,0 @@ } else |
@@ -1,3 +0,3 @@ | ||
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'; | ||
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-BKiOijOQ.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-BKiOijOQ.js'; | ||
export { astish } from './astish.js'; | ||
@@ -146,3 +146,2 @@ | ||
} | ||
declare const isObjectOrArray: (obj: unknown) => boolean; | ||
interface TraverseOptions { | ||
@@ -162,2 +161,2 @@ separator?: string; | ||
export { CacheMap, CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PANDA_CONFIG_NAME, 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, PANDA_CONFIG_NAME, 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, mapEntries, mapToJson, mergeWith, normalizeStyleObject, omit, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType }; |
@@ -125,2 +125,3 @@ "use strict"; | ||
} | ||
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null; | ||
@@ -153,2 +154,4 @@ // src/assign.ts | ||
left = block[3].replace(ruleNewline, empty).trim(); | ||
if (!left.includes("&") && !left.startsWith("@")) | ||
left = "& " + left; | ||
tree.unshift(tree[0][left] = tree[0][left] || {}); | ||
@@ -360,4 +363,5 @@ } else | ||
function mergeProps(...sources) { | ||
const objects = sources.filter(Boolean); | ||
return objects.reduce((prev, obj) => { | ||
return sources.reduce((prev, obj) => { | ||
if (!obj) | ||
return prev; | ||
Object.keys(obj).forEach((key) => { | ||
@@ -381,3 +385,3 @@ const prevValue = prev[key]; | ||
function inner(value, path = []) { | ||
if (isObject(value) || Array.isArray(value)) { | ||
if (isObjectOrArray(value)) { | ||
const result = {}; | ||
@@ -463,5 +467,5 @@ for (const [prop, child] of Object.entries(value)) { | ||
walkObject(normalizedObject, (value, paths) => { | ||
const important = isImportant(value); | ||
if (value == null) | ||
return; | ||
const important = isImportant(value); | ||
const [prop, ...allConditions] = conds.shift(paths); | ||
@@ -668,3 +672,2 @@ const conditions = filterBaseConditions(allConditions); | ||
// src/traverse.ts | ||
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null; | ||
var defaultOptions = { | ||
@@ -864,7 +867,10 @@ separator: ".", | ||
}; | ||
var longhands = Object.values(shorthandProperties).reduce((a, b) => [...a, ...b], []); | ||
var longhands = Object.values(shorthandProperties).reduce((a, b) => { | ||
b.forEach((val) => a.add(val)); | ||
return a; | ||
}, /* @__PURE__ */ new Set([])); | ||
function getPropertyPriority(property) { | ||
if (property === "all") | ||
return 0; | ||
return longhands.includes(property) ? 2 : 1; | ||
return longhands.has(property) ? 2 : 1; | ||
} | ||
@@ -984,3 +990,11 @@ | ||
// src/uniq.ts | ||
var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []); | ||
var uniq = (...items) => { | ||
const set = items.reduce((acc, currItems) => { | ||
if (currItems) { | ||
currItems.forEach((item) => acc.add(item)); | ||
} | ||
return acc; | ||
}, /* @__PURE__ */ new Set([])); | ||
return Array.from(set); | ||
}; | ||
@@ -992,6 +1006,7 @@ // src/unit-conversion.ts | ||
var UNIT_REM = "rem"; | ||
var DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`); | ||
var UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`); | ||
var VALUE_REGEX = new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`); | ||
function getUnit(value = "") { | ||
const DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`); | ||
const UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`); | ||
const unit = value.match(new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`)); | ||
const unit = value.match(VALUE_REGEX); | ||
return unit?.[1]; | ||
@@ -998,0 +1013,0 @@ } |
@@ -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-eaCmCttJ.js'; | ||
export { 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, c as isObject, A as mapObject, o as memo, p as mergeProps, q as patternFns, v as splitProps, t as toHash, x as uniq, z as walkObject, m as withoutSpace } from './shared-BKiOijOQ.js'; |
@@ -49,2 +49,3 @@ "use strict"; | ||
} | ||
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null; | ||
@@ -112,4 +113,5 @@ // src/compact.ts | ||
function mergeProps(...sources) { | ||
const objects = sources.filter(Boolean); | ||
return objects.reduce((prev, obj) => { | ||
return sources.reduce((prev, obj) => { | ||
if (!obj) | ||
return prev; | ||
Object.keys(obj).forEach((key) => { | ||
@@ -133,3 +135,3 @@ const prevValue = prev[key]; | ||
function inner(value, path = []) { | ||
if (isObject(value) || Array.isArray(value)) { | ||
if (isObjectOrArray(value)) { | ||
const result = {}; | ||
@@ -215,5 +217,5 @@ for (const [prop, child] of Object.entries(value)) { | ||
walkObject(normalizedObject, (value, paths) => { | ||
const important = isImportant(value); | ||
if (value == null) | ||
return; | ||
const important = isImportant(value); | ||
const [prop, ...allConditions] = conds.shift(paths); | ||
@@ -329,3 +331,11 @@ const conditions = filterBaseConditions(allConditions); | ||
// src/uniq.ts | ||
var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []); | ||
var uniq = (...items) => { | ||
const set = items.reduce((acc, currItems) => { | ||
if (currItems) { | ||
currItems.forEach((item) => acc.add(item)); | ||
} | ||
return acc; | ||
}, /* @__PURE__ */ new Set([])); | ||
return Array.from(set); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -332,0 +342,0 @@ 0 && (module.exports = { |
{ | ||
"name": "@pandacss/shared", | ||
"version": "0.0.0-dev-20240825102751", | ||
"version": "0.0.0-dev-20240908184814", | ||
"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
Sorry, the diff of this file is not supported yet
111624
3035