fix(kami-deck): route host od:slide messages through local go()

The host bridge classifies kami-deck as class-driven because go() toggles
.slide.active, but the visible slide is moved by deck.style.transform
which the bridge cannot drive. Listen for od:slide messages and dispatch
them through the local go() so toolbar next/prev and initialSlideIndex
restore actually shift the deck.

Generated-By: looper 0.4.0 (runner=fixer, agent=claude-code)
This commit is contained in:
pftom
2026-05-04 16:52:38 +08:00
parent bad3231b7c
commit 96b255b223
+15
View File
@@ -1048,6 +1048,21 @@ strong { font-weight: 500; }
}
}, { passive: true });
/* Host-driven navigation: Open Design's host bridge classifies this deck
as class-driven (because go() toggles .slide.active) but the visible
slide is moved by deck.style.transform, which the bridge can't drive.
Route od:slide messages through the local go()/jump so toolbar
next/prev and initialSlideIndex restore actually shift the deck. */
addEventListener('message', function (e) {
var data = e && e.data;
if (!data || data.type !== 'od:slide') return;
if (data.action === 'go' && typeof data.index === 'number') go(data.index);
else if (data.action === 'next') go(idx + 1);
else if (data.action === 'prev') go(idx - 1);
else if (data.action === 'first') go(0);
else if (data.action === 'last') go(total - 1);
});
go(0);
})();
</script>