@css-panda/shared
Advanced tools
Comparing version 0.0.0-dev-20221027133350 to 0.0.0-dev-20221028092835
@@ -47,6 +47,11 @@ export { M as MappedObject, c as createCss, f as filterBaseConditions, i as isBaseCondition, m as mapObject, t as toHash, w as walkObject, a as walkStyles } from './walk-styles-ebefd287.js'; | ||
declare function getNegativePath(path: string[]): string[]; | ||
declare function getDotPath(obj: any, path: string, fallback: any): any; | ||
declare function getDotPath(obj: any, path: string, fallback?: any): any; | ||
declare type MapToRecord<K extends Map<string, any>> = { | ||
[P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never; | ||
}; | ||
declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>; | ||
declare function unionType(values: IterableIterator<string> | string[]): string; | ||
export { CssVar, CssVarOptions, calc, capitalize, compact, cssVar, dashCase, esc, getDotPath, getNegativePath, getUnit, isFunction, isImportant, isObject, isString, memo, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType, withoutImportant, withoutSpace }; | ||
export { CssVar, CssVarOptions, calc, capitalize, compact, cssVar, dashCase, esc, getDotPath, getNegativePath, getUnit, isFunction, isImportant, isObject, isString, mapToJson, memo, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType, withoutImportant, withoutSpace }; |
@@ -40,2 +40,3 @@ "use strict"; | ||
mapObject: () => mapObject, | ||
mapToJson: () => mapToJson, | ||
memo: () => memo, | ||
@@ -66,6 +67,6 @@ splitBy: () => splitBy, | ||
function isCssVar(value) { | ||
return typeof value === "object" && value !== null && "ref" in value; | ||
return isObject(value) && "ref" in value; | ||
} | ||
function getRef(operand) { | ||
return isCssVar(operand) ? operand.reference : operand.toString(); | ||
return isCssVar(operand) ? operand.ref : operand.toString(); | ||
} | ||
@@ -339,2 +340,15 @@ var toExpression = (operator, ...operands) => operands.map(getRef).join(` ${operator} `).replace(/calc/g, ""); | ||
// src/to-json.ts | ||
function mapToJson(map) { | ||
const obj = {}; | ||
map.forEach((value, key) => { | ||
if (value instanceof Map) { | ||
obj[key] = Object.fromEntries(value); | ||
} else { | ||
obj[key] = value; | ||
} | ||
}); | ||
return obj; | ||
} | ||
// src/typegen.ts | ||
@@ -363,2 +377,3 @@ function unionType(values) { | ||
mapObject, | ||
mapToJson, | ||
memo, | ||
@@ -365,0 +380,0 @@ splitBy, |
{ | ||
"name": "@css-panda/shared", | ||
"version": "0.0.0-dev-20221027133350", | ||
"version": "0.0.0-dev-20221028092835", | ||
"description": "Shared utilities for css panda", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
33990
998