Renders an X glyph in the top-right of every panel's title bar; left-
click on it calls M.close(). Hit-test in _dispatch_event runs before
the widget-forward path so the click is consumed by the panel-frame
even when a widget would otherwise handle it. Pairs with the existing
ESC-close-pattern that lives at module level.
Previously trigger_action_name + trigger_widget_id were module-local
scalars, so the second bind_default_trigger call overwrote the first
(and reused the action name 'panel_toggle' so lib-core.input's binding
was also clobbered). Switched to a triggers array; each binding gets
a unique input action 'panel_toggle_<widget_id>' so multiple widgets
can be toggled by their own keys independently.
_dispatch_event captures M at closure-definition time; with M declared
further down the file, the capture resolved to global M (nil), causing
'attempt to index a nil value (global M)' every frame the panel was open
and a mouse event was dispatched. Hoisting the table declaration above
the dispatch helpers fixes the resolution at compile time.