@energy8platform/shell 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/html.esm.js CHANGED
@@ -1350,7 +1350,7 @@ class KeyboardController {
1350
1350
 
1351
1351
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
1352
1352
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
1353
- const PACKAGE_VERSION = '0.2.0';
1353
+ const PACKAGE_VERSION = '0.2.1';
1354
1354
 
1355
1355
  /** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
1356
1356
  function resolveConfig(config) {
@@ -2569,7 +2569,7 @@ function createOverlay(opts) {
2569
2569
  }
2570
2570
 
2571
2571
  function openSettingsModal(host) {
2572
- const { root, body } = createOverlay({ title: host.t('Settings'), onClose: () => root.remove() });
2572
+ const { root, body } = createOverlay({ title: host.t('Settings'), onClose: () => host.actions.closeOverlay() });
2573
2573
  root.dataset.ge = 'settings-modal';
2574
2574
  // Sound on/off — backed by the shell's shared `soundOn` state so this toggle and the Shift+M
2575
2575
  // hotkey stay in sync; `setSound` emits `settingChange({ key: 'sound' })` and refreshes the icon.
@@ -2640,7 +2640,7 @@ const SVG_NS = 'http://www.w3.org/2000/svg';
2640
2640
  function openGameInfoModal(host) {
2641
2641
  const { root, body, scroll } = createOverlay({
2642
2642
  title: host.t('Game info'),
2643
- onClose: () => root.remove(),
2643
+ onClose: () => host.actions.closeOverlay(),
2644
2644
  onBack: () => { root.remove(); host.actions.openSettings(); },
2645
2645
  });
2646
2646
  root.dataset.ge = 'info-modal';
@@ -3486,14 +3486,17 @@ function openAutoplayModal(host) {
3486
3486
 
3487
3487
  /** Build a generic, externally-triggered modal (title + body text + optional action buttons),
3488
3488
  * on the shared card-modal chrome. Each action runs its `on` then closes; the ✕ (if
3489
- * `availableClose`) and the actions are the only ways to dismiss. See GameShell.openModal. */
3490
- function buildModal(opts) {
3489
+ * `availableClose`) and the actions are the only ways to dismiss. See GameShell.openModal.
3490
+ * Dismissals route through host.actions.closeOverlay() so the controller clears its overlay handle
3491
+ * (a bare root.remove() leaves the handle stale → keydowns keep routing to a torn-down layer). */
3492
+ function buildModal(host, opts) {
3493
+ const close = () => host.actions.closeOverlay();
3491
3494
  const ui = createCardModal({
3492
3495
  ge: 'modal',
3493
3496
  title: opts.title,
3494
3497
  closable: opts.availableClose,
3495
3498
  blur: opts.blurLevel,
3496
- onClose: () => ui.root.remove(),
3499
+ onClose: close,
3497
3500
  });
3498
3501
  const text = document.createElement('p');
3499
3502
  text.className = 'ge-modal-text';
@@ -3514,7 +3517,7 @@ function buildModal(opts) {
3514
3517
  }
3515
3518
  else
3516
3519
  btn.classList.add('ge-modal-btn--ghost');
3517
- btn.addEventListener('click', () => { a.on?.(); ui.root.remove(); });
3520
+ btn.addEventListener('click', () => { a.on?.(); close(); });
3518
3521
  actions.appendChild(btn);
3519
3522
  }
3520
3523
  ui.card.appendChild(actions);
@@ -3725,7 +3728,7 @@ class HtmlRenderer {
3725
3728
  return { root };
3726
3729
  }
3727
3730
  case 'modal': {
3728
- const root = buildModal(req.opts);
3731
+ const root = buildModal(this.host, req.opts);
3729
3732
  return { root, onKey: req.opts.onKey };
3730
3733
  }
3731
3734
  }