Alpine.js
Declarative events and component cleanup.
Install
Use your existing Alpine instance; with Livewire do not start a second Alpine instance.
npm install subtlyInitialize
resources/js/app.js
import Alpine from "alpinejs";import { createInteractions } from "subtly";const ix = createInteractions();Alpine.start(); // only if Alpine is not already started by your hostix.start();if (import.meta.hot) import.meta.hot.dispose(() => ix.stop());Use a behavior
<div data-ix="hover-intent" data-ix-hover-delay="150"> <button type="button">Preview</button></div>Use the shared HTML attributes, or import programmatic helpers inside your framework lifecycle. State and visual rendering stay in your component.
Lifecycle and accessibility
For individual programmatic utilities, initialize in init() and clean up in destroy(). Use $nextTick for newly rendered panels.
Use a single runtime per root; do not overlap roots. Keep native button semantics, focus and click support. For cleanup, call each utility’s returned callback or destroy method.
Try the same behavior
A clearer home for your next release.
In progressPreview closed. Hover, focus or click to open.
The live example uses native JavaScript; the framework snippets are integration recipes, not separately compiled framework applications.
Listen to an intent event
<div x-data="{ active: false }" data-ix="hover-intent" @ix:hover-enter="active = true" @ix:hover-leave="active = false"> <button @click="active = !active">Preview</button> <span x-text="active ? 'Active' : 'Idle'"></span></div>