{% comment %} Wrap your nav in this component, mark each page section with `data-spy-section id="..."`, then bind link styling to `isActive('id')`. An IntersectionObserver tracks which section is in view and exposes `active` (the current id) on the Alpine component. By default it watches the viewport (page scroll). If you nest the sections inside an element marked `data-spy-root` (a fixed-height, overflow-scrolling container), that container is used as the observer root instead, for a self-contained scroll area. The data factory is registered once and guarded so multiple includes never double-register. {% endcomment %}
{{ slot }}