@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.cjs.js CHANGED
@@ -1352,7 +1352,7 @@ class KeyboardController {
1352
1352
 
1353
1353
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
1354
1354
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
1355
- const PACKAGE_VERSION = '0.2.0';
1355
+ const PACKAGE_VERSION = '0.2.1';
1356
1356
 
1357
1357
  /** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
1358
1358
  function resolveConfig(config) {
@@ -2571,7 +2571,7 @@ function createOverlay(opts) {
2571
2571
  }
2572
2572
 
2573
2573
  function openSettingsModal(host) {
2574
- const { root, body } = createOverlay({ title: host.t('Settings'), onClose: () => root.remove() });
2574
+ const { root, body } = createOverlay({ title: host.t('Settings'), onClose: () => host.actions.closeOverlay() });
2575
2575
  root.dataset.ge = 'settings-modal';
2576
2576
  // Sound on/off — backed by the shell's shared `soundOn` state so this toggle and the Shift+M
2577
2577
  // hotkey stay in sync; `setSound` emits `settingChange({ key: 'sound' })` and refreshes the icon.
@@ -2642,7 +2642,7 @@ const SVG_NS = 'http://www.w3.org/2000/svg';
2642
2642
  function openGameInfoModal(host) {
2643
2643
  const { root, body, scroll } = createOverlay({
2644
2644
  title: host.t('Game info'),
2645
- onClose: () => root.remove(),
2645
+ onClose: () => host.actions.closeOverlay(),
2646
2646
  onBack: () => { root.remove(); host.actions.openSettings(); },
2647
2647
  });
2648
2648
  root.dataset.ge = 'info-modal';
@@ -3488,14 +3488,17 @@ function openAutoplayModal(host) {
3488
3488
 
3489
3489
  /** Build a generic, externally-triggered modal (title + body text + optional action buttons),
3490
3490
  * on the shared card-modal chrome. Each action runs its `on` then closes; the ✕ (if
3491
- * `availableClose`) and the actions are the only ways to dismiss. See GameShell.openModal. */
3492
- function buildModal(opts) {
3491
+ * `availableClose`) and the actions are the only ways to dismiss. See GameShell.openModal.
3492
+ * Dismissals route through host.actions.closeOverlay() so the controller clears its overlay handle
3493
+ * (a bare root.remove() leaves the handle stale → keydowns keep routing to a torn-down layer). */
3494
+ function buildModal(host, opts) {
3495
+ const close = () => host.actions.closeOverlay();
3493
3496
  const ui = createCardModal({
3494
3497
  ge: 'modal',
3495
3498
  title: opts.title,
3496
3499
  closable: opts.availableClose,
3497
3500
  blur: opts.blurLevel,
3498
- onClose: () => ui.root.remove(),
3501
+ onClose: close,
3499
3502
  });
3500
3503
  const text = document.createElement('p');
3501
3504
  text.className = 'ge-modal-text';
@@ -3516,7 +3519,7 @@ function buildModal(opts) {
3516
3519
  }
3517
3520
  else
3518
3521
  btn.classList.add('ge-modal-btn--ghost');
3519
- btn.addEventListener('click', () => { a.on?.(); ui.root.remove(); });
3522
+ btn.addEventListener('click', () => { a.on?.(); close(); });
3520
3523
  actions.appendChild(btn);
3521
3524
  }
3522
3525
  ui.card.appendChild(actions);
@@ -3727,7 +3730,7 @@ class HtmlRenderer {
3727
3730
  return { root };
3728
3731
  }
3729
3732
  case 'modal': {
3730
- const root = buildModal(req.opts);
3733
+ const root = buildModal(this.host, req.opts);
3731
3734
  return { root, onKey: req.opts.onKey };
3732
3735
  }
3733
3736
  }