gabriel / musehub public
mist-list.ts typescript
44 lines 1.7 KB
Raw
sha256:8e05daa29ba6702b4a2380a16d690ba31cc099d69c5c859bc6e6f16a0e945f99 Merge 'fix/deploy-memory-limits-and-log-group' into 'dev' —… Human 5 days ago
1 /**
2 * mist-list.ts — Mist list and explore page module.
3 *
4 * Responsibilities:
5 * 1. Row hover entrance animations (staggered IntersectionObserver).
6 * 2. Re-animate rows after HTMX fragment swap (type-filter navigation).
7 */
8
9 // ── Row entrance animations ───────────────────────────────────────────────────
10
11 function animateRows(root: Element | Document = document): void {
12 const rows = root.querySelectorAll<HTMLElement>('.ms-row');
13 if (!rows.length) return;
14
15 const io = new IntersectionObserver((entries) => {
16 entries.forEach((entry, i) => {
17 if (!entry.isIntersecting) return;
18 const el = entry.target as HTMLElement;
19 el.style.animationDelay = `${i * 20}ms`;
20 io.unobserve(el);
21 });
22 }, { threshold: 0.02 });
23
24 rows.forEach(el => io.observe(el));
25 }
26
27 // ── HTMX: re-animate after fragment swap ─────────────────────────────────────
28
29 function bindHtmxSwap(): void {
30 document.body.addEventListener('htmx:afterSwap', (e: Event) => {
31 const target = (e as CustomEvent).detail?.target as HTMLElement | undefined;
32 if (!target) return;
33 if (target.id === 'mist-rows' || target.closest('#mist-rows')) {
34 animateRows(target);
35 }
36 });
37 }
38
39 // ── Entry point ───────────────────────────────────────────────────────────────
40
41 export function initMistList(_data?: Record<string, unknown>): void {
42 animateRows();
43 bindHtmxSwap();
44 }
File History 3 commits
sha256:8e05daa29ba6702b4a2380a16d690ba31cc099d69c5c859bc6e6f16a0e945f99 Merge 'fix/deploy-memory-limits-and-log-group' into 'dev' —… Human 5 days ago
sha256:3fadb0439bba9451b89229676971c0d4a40900dec7810e9d5f8791b8d950d505 fix: install.sh version from latest published tarball, not … Sonnet 4.6 minor 96 days ago
sha256:763eb2cb8675073b84c19345b27586d2ed939a9aee97c5479b69f502f1a70eff fix(tests): update test suite to match current implementation Sonnet 4.6 patch 118 days ago