website_next: snapshot

This commit is contained in:
nym21
2026-07-03 21:06:32 +02:00
parent e0a618837e
commit 10ef95497f
73 changed files with 2241 additions and 733 deletions
+21
View File
@@ -0,0 +1,21 @@
const lifecycleByElement = new WeakMap();
const observer = new IntersectionObserver(
(entries) => {
for (const entry of entries) {
const lifecycle = lifecycleByElement.get(entry.target);
lifecycle?.[entry.isIntersecting ? "show" : "hide"]();
}
},
{
rootMargin: "400px 0px",
},
);
/**
* @param {Element} element
* @param {{ show: () => void, hide: () => void }} lifecycle
*/
export function onChartVisibility(element, lifecycle) {
lifecycleByElement.set(element, lifecycle);
observer.observe(element);
}