UNPKG

@anoki/fse-ui

Version:

FSE UI components library

60 lines (59 loc) 1.97 kB
import { breakpoints as l } from "./index.es794.js"; import { hasOwnProperty as p } from "./index.es795.js"; import { isResponsiveObject as m } from "./index.es785.js"; function h({ className: r, customProperties: e, ...i }) { const a = v({ allowArbitraryValues: !0, className: r, ...i }), t = g({ customProperties: e, ...i }); return [a, t]; } function v({ allowArbitraryValues: r, value: e, className: i, propValues: a, parseValue: t = (s) => s }) { const s = []; if (e) { if (typeof e == "string" && a.includes(e)) return f(i, e, t); if (m(e)) { const o = e; for (const n in o) { if (!p(o, n) || !l.has(n)) continue; const u = o[n]; if (u !== void 0) { if (a.includes(u)) { const c = f(i, u, t), $ = n === "initial" ? c : `${n}:${c}`; s.push($); } else if (r) { const c = n === "initial" ? i : `${n}:${i}`; s.push(c); } } } return s.join(" "); } if (r) return i; } } function f(r, e, i) { const a = r ? "-" : "", t = i(e), s = t == null ? void 0 : t.startsWith("-"), o = s ? "-" : "", n = s ? t == null ? void 0 : t.substring(1) : t; return `${o}${r}${a}${n}`; } function g({ customProperties: r, value: e, propValues: i, parseValue: a = (t) => t }) { let t = {}; if (!(!e || typeof e == "string" && i.includes(e))) { if (typeof e == "string" && (t = Object.fromEntries(r.map((s) => [s, e]))), m(e)) { const s = e; for (const o in s) { if (!p(s, o) || !l.has(o)) continue; const n = s[o]; if (!i.includes(n)) for (const u of r) t = { [o === "initial" ? u : `${u}-${o}`]: n, ...t }; } } for (const s in t) { const o = t[s]; o !== void 0 && (t[s] = a(o)); } return t; } } export { v as getResponsiveClassNames, g as getResponsiveCustomProperties, h as getResponsiveStyles }; //# sourceMappingURL=index.es750.js.map