UNPKG

@crossed/styled

Version:

A universal & performant styling library for React Native, Next.js & React

52 lines (51 loc) 1.1 kB
const convertToPx = [ "lineHeight", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight", "marginHorizontal", "marginVertical", "fontSize", "borderWidth", "borderBottomWidth", "borderTopWidth", "borderLeftWidth", "borderRightWidth", "borderRadius", "borderTopRightRadius", "borderTopLeftRadius", "borderBottomRightRadius", "borderBottomLeftRadius", "padding", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "paddingHorizontal", "paddingVertical", "gap", "width", "maxWidth", "minWidth", "height", "maxHeight", "minHeight" ]; const normalizeUnitPixel = (key, value, isWeb) => isWeb && convertToPx.includes(key) && typeof value === "number" ? `${value}px` : value; const cache = /* @__PURE__ */ new Map(); const convertKeyToCss = (key) => { const old = cache.get(key); if (old) return old; const result = key.split(/(?=[A-Z])/).join("-").toLowerCase(); cache.set(key, result); return result; }; export { convertKeyToCss, convertToPx, normalizeUnitPixel }; //# sourceMappingURL=utils.js.map