@yoot/yoot
Version:
The core library for yoot, providing a CDN-agnostic, chainable API for image URL transformations and adapter integration.
47 lines (46 loc) • 1.17 kB
JavaScript
import { getImgAttrs as i, getSourceAttrs as c } from "./helpers.js";
import { buildSrcSet as w, defineSrcSetBuilder as I } from "./helpers.js";
import { isNullish as u, isEmpty as f } from "./utils.js";
function A(e, t) {
return s(i(e, t));
}
function m(e) {
return (t, r) => s(i(t, { ...e, ...r }));
}
function p(e, t) {
return s(c(e, t));
}
function S(e) {
return (t, r) => s(c(t, { ...e, ...r }));
}
function s(e) {
const t = {};
for (const r of Object.keys(e)) {
let o = e[r];
if (u(o)) continue;
let n;
r.startsWith("aria") ? n = r.replace(/([A-Z])/, "-$1").toLowerCase() : n = r.replace(/([A-Z])/g, "-$1").toLowerCase(), !(r === "style" && (o = l(o), f(o))) && (t[n] = o);
}
return t;
}
function l(e) {
let t = "";
if (u(e)) return t;
for (const [r, o] of Object.entries(e)) {
if (f(o)) continue;
const n = r.replace(/([A-Z])/g, "-$1").toLowerCase();
t += `${n}:${o};`;
}
return t;
}
export {
w as buildSrcSet,
I as defineSrcSetBuilder,
A as getImgAttrs,
p as getSourceAttrs,
s as propsToHtmlAttrs,
l as toInlineStyle,
m as withImgAttrs,
S as withSourceAttrs
};
//# sourceMappingURL=html.js.map