@energy8platform/shell 0.6.5 → 0.6.6

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
@@ -1455,7 +1455,7 @@ class KeyboardController {
1455
1455
 
1456
1456
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
1457
1457
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
1458
- const PACKAGE_VERSION = '0.6.5';
1458
+ const PACKAGE_VERSION = '0.6.6';
1459
1459
 
1460
1460
  /** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
1461
1461
  function resolveConfig(config) {
@@ -1722,10 +1722,10 @@ class ShellController extends EventEmitter {
1722
1722
  this.renderer.renderBar();
1723
1723
  }
1724
1724
  // ── game-facing public API (mirrors GameShell/PixiGameShell) ───────────────────
1725
- money(field, from, to) {
1725
+ money(field, from, to, durationMs) {
1726
1726
  this.renderer.renderBar();
1727
1727
  if (to !== from)
1728
- this.renderer.animateMoney(field, from, to);
1728
+ this.renderer.animateMoney(field, from, to, durationMs);
1729
1729
  }
1730
1730
  setBalance(n) {
1731
1731
  const from = this.prevBalance;
@@ -1735,7 +1735,9 @@ class ShellController extends EventEmitter {
1735
1735
  }
1736
1736
  /** Set the WIN readout. Counts up/down from the previous value by default. Pass
1737
1737
  * `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
1738
- * host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong. */
1738
+ * host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
1739
+ * `{ durationMs }` shortens/lengthens the count-up (default 450ms) — a scene reporting a win per
1740
+ * cascade step passes its step length so each count-up finishes before the next step lands. */
1739
1741
  setWin(n, opts) {
1740
1742
  const from = this.prevWin;
1741
1743
  this.state.win = n;
@@ -1744,7 +1746,7 @@ class ShellController extends EventEmitter {
1744
1746
  this.renderer.renderBar(); // instant repaint from state; cancels running money anims
1745
1747
  return;
1746
1748
  }
1747
- this.money('win', from, n);
1749
+ this.money('win', from, n, opts?.durationMs);
1748
1750
  }
1749
1751
  setBet(n) {
1750
1752
  this.state.bet = n;
@@ -3890,13 +3892,13 @@ function buildReplayModal(host, opts, reopen) {
3890
3892
  const REMOVE_FADE_MS = 300;
3891
3893
  /** Count-up the value span (.ge-rd-val) of a readout, leaving its label untouched.
3892
3894
  * Returns the count-up canceler so the renderer can stop it before the node is replaced. */
3893
- function animateReadout(el, from, to, fmt) {
3895
+ function animateReadout(el, from, to, fmt, durationMs) {
3894
3896
  const val = el.querySelector('.ge-rd-val');
3895
3897
  if (!val) {
3896
3898
  el.textContent = fmt(to);
3897
3899
  return () => { };
3898
3900
  }
3899
- return countUp(val, from, to, fmt);
3901
+ return durationMs == null ? countUp(val, from, to, fmt) : countUp(val, from, to, fmt, durationMs);
3900
3902
  }
3901
3903
  class HtmlRenderer {
3902
3904
  host;
@@ -3955,11 +3957,11 @@ class HtmlRenderer {
3955
3957
  setLayout() {
3956
3958
  this.renderBar();
3957
3959
  }
3958
- animateMoney(field, from, to) {
3960
+ animateMoney(field, from, to, durationMs) {
3959
3961
  const fmt = (n) => this.host.formatCurrency(n, field === 'win');
3960
3962
  const el = this.barHost.querySelector(`[data-ge="${field}"]`);
3961
3963
  if (el)
3962
- this.moneyAnims.push(animateReadout(el, from, to, fmt));
3964
+ this.moneyAnims.push(animateReadout(el, from, to, fmt, durationMs));
3963
3965
  }
3964
3966
  openOverlay(req) {
3965
3967
  const built = this.buildOverlay(req);