UNPKG

@crossed/styled

Version:

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

77 lines (76 loc) 2.19 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var utils_exports = {}; __export(utils_exports, { convertKeyToCss: () => convertKeyToCss, convertToPx: () => convertToPx, normalizeUnitPixel: () => normalizeUnitPixel }); module.exports = __toCommonJS(utils_exports); 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; }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { convertKeyToCss, convertToPx, normalizeUnitPixel }); //# sourceMappingURL=utils.js.map