subject = {
const div = html`<div style="
background: black;
font: 64px var(--sans-serif);
height: 800px;
display: flex;
align-items: center;
justify-content: center;
">`;
const observer = new IntersectionObserver(entries => {
const entry = entries.pop();
div.style.color = `hsl(0, 100%, ${entry.intersectionRatio * 100}%)`;
div.textContent = `${(entry.intersectionRatio * 100).toFixed(0)}% visible`;
}, {
threshold: Array.from({length: 101}, (_, i) => i / 100)
});
observer.observe(div);
invalidation.then(() => observer.disconnect());
return div;
}