refactor: centralize styling system usage

This commit is contained in:
thePR0M3TH3AN committed 2025-10-12 16:31:13 -04:00
1 parent 0df93ba204
commit 92794d47dc
15 files changed
+395 -80

No files matched your search

+12 -1
View File
@@ -1,5 +1,12 @@
// js/utils/mediaLoader.js
import { applyDynamicStyles } from "../ui/styleSystem.js";
function createBackgroundImageValue(src) {
const safe = String(src).replace(/["\\)\n\r]/g, (match) => `\\${match}`);
return `url("${safe}")`;
}
/**
* Simple IntersectionObserver-based lazy loader for images (or videos).
*
@@ -46,7 +53,11 @@ export class MediaLoader {
el.poster = fallbackSrc;
}
} else {
el.style.backgroundImage = `url('${lazySrc}')`;
applyDynamicStyles(
el,
{ backgroundImage: createBackgroundImageValue(lazySrc) },
{ slot: "lazy-background" },
);
}
delete el.dataset.lazy;