refactor: Migrate zoom control and expand/collapse to hyperscript

- Move initZoomControlButtons() from main.js to hyperscript handlers
  - zoom-toggle-button: on click call toggleZoomControl()
  - zoom-close: on click call hideZoomControl()
  - show-zoom-menu-btn: on click call showZoomControl()
- Move expandAllSections/collapseAllSections from JS to utils._hs
- Add zoom visibility functions to zoom._hs:
  - showZoomControl(), hideZoomControl(), toggleZoomControl()
- Update hamburger menu links to use hyperscript calls

Eliminates ~75 more lines of JavaScript in favor of declarative
hyperscript, continuing the pattern of moving behavior to ._hs files.
This commit is contained in:
juanatsap
2025-11-30 06:03:45 +00:00
parent ba44b435e7
commit 7ab150a48e
6 changed files with 63 additions and 91 deletions
@@ -65,15 +65,16 @@
<span>{{if eq .Lang "es"}}Acciones Rápidas{{else}}Quick Actions{{end}}</span>
</div>
<a href="#" class="menu-item menu-item-action" onclick="collapseAllSections(event)">
<a href="#" class="menu-item menu-item-action" _="on click call collapseAllSections(event)">
<iconify-icon icon="mdi:arrow-collapse-all" width="20" height="20"></iconify-icon>
<span>{{if eq .Lang "es"}}Colapsar Todo{{else}}Collapse All{{end}}</span>
</a>
<a href="#" class="menu-item menu-item-action" onclick="expandAllSections(event)">
<a href="#" class="menu-item menu-item-action" _="on click call expandAllSections(event)">
<iconify-icon icon="mdi:arrow-expand-all" width="20" height="20"></iconify-icon>
<span>{{if eq .Lang "es"}}Expandir Todo{{else}}Expand All{{end}}</span>
</a>
<a href="#" id="show-zoom-menu-btn" class="menu-item menu-item-action zoom-hidden">
<a href="#" id="show-zoom-menu-btn" class="menu-item menu-item-action zoom-hidden"
_="on click call showZoomControl()">
<iconify-icon icon="mdi:magnify" width="20" height="20"></iconify-icon>
<span>{{if eq .Lang "es"}}Zoom{{else}}Zoom{{end}}</span>
</a>
+2 -1
View File
@@ -40,7 +40,8 @@
id="zoom-close"
class="zoom-close-btn"
aria-label="{{if eq .Lang "es"}}Cerrar control de zoom{{else}}Close zoom control{{end}}"
title="{{if eq .Lang "es"}}Cerrar{{else}}Close{{end}}">
title="{{if eq .Lang "es"}}Cerrar{{else}}Close{{end}}"
_="on click call hideZoomControl()">
<iconify-icon icon="mdi:close" width="16" height="16" style="pointer-events: none;"></iconify-icon>
</button>
@@ -5,7 +5,8 @@
class="fixed-btn zoom-toggle-btn no-print has-tooltip"
aria-label="{{if eq .Lang "es"}}Alternar control de zoom{{else}}Toggle zoom control{{end}}"
data-tooltip="{{if eq .Lang "es"}}Control de zoom{{else}}Zoom control{{end}}"
_="on mouseenter call highlightZoomControl(true)
_="on click call toggleZoomControl()
on mouseenter call highlightZoomControl(true)
on mouseleave call highlightZoomControl(false)">
<iconify-icon icon="mdi:magnify" width="28" height="28"></iconify-icon>
</button>