LokaScript is a complete hyperscript ecosystem with smart element detection, making web interactions natural and concise.
How does smart toggle work?
Smart toggle automatically detects interactive elements like dialog, details, and select, and toggles their state appropriately without needing explicit method calls.
Is it compatible with _hyperscript?
Yes! LokaScript maintains compatibility with official _hyperscript syntax while adding enhanced features and smart detection.
Summary Element Toggle (Automatic Parent Detection)
<!-- Toggle by targeting summary element directly -->
<button _="on click toggle #summary1">Toggle via Summary</button>
<details>
<summary id="summary1">Click me or the button</summary>
<p>Content expands when you toggle the summary!</p>
</details>
When you toggle a <summary> element, it automatically finds and toggles the parent <details>.
β¨ Advanced Summary Toggle
This demonstrates that you can target the summary element directly!
The toggle command automatically detects the parent details and toggles it.