@energy8platform/shell 0.7.0 → 0.7.2

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/pixi.d.ts CHANGED
@@ -140,6 +140,9 @@ interface CurrencyConfig {
140
140
  * trimmed down to this many places so small wins keep their significant digits (e.g. 0.0673)
141
141
  * while round amounts stay compact (e.g. 0.30). Everything else is shown at exactly this many. */
142
142
  minDecimals?: number;
143
+ /** Defaults to the platform convention: `{ thousands: ',', decimal: '.' }` → `€1,234.50`.
144
+ * Override only for a jurisdiction that requires another convention — a comma decimal reads
145
+ * as a thousands group to most players and inflates the perceived payout. */
143
146
  separator?: {
144
147
  thousands?: string;
145
148
  decimal?: string;
@@ -630,7 +633,7 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
630
633
  tokens: ShellTokens;
631
634
  layout: ShellLayoutMode;
632
635
  soundOn: boolean;
633
- readonly engineVersion = "0.7.0";
636
+ readonly engineVersion = "0.7.2";
634
637
  readonly actions: ShellActions;
635
638
  private renderer;
636
639
  private i18n;
@@ -775,7 +778,7 @@ interface I18n {
775
778
  declare function createI18n(opts: I18nOptions): I18n;
776
779
 
777
780
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
778
- declare const PACKAGE_VERSION = "0.7.0";
781
+ declare const PACKAGE_VERSION = "0.7.2";
779
782
 
780
783
  /** A shell: the renderer-agnostic controller plus the surface facade (safeArea/barHeight/setVisible)
781
784
  * an embedding host reads. `createShell`, `createGameShell` and `createPixiShell` all return this. */
package/dist/pixi.esm.js CHANGED
@@ -402,15 +402,19 @@ function resolveTheme(theme = {}) {
402
402
  * trailing zeros are trimmed down to (but never past) `minDecimals`, so small wins keep their
403
403
  * significant digits. Balance / bet / prices stay fixed at `minDecimals`.
404
404
  *
405
+ * Separators default to the platform convention — `.` decimal, `,` thousands (`€1,234.50`).
406
+ * A comma decimal is NOT safe as a default: players read "2,50" as 250 and believe they were
407
+ * paid far more than they were. Games that need another convention pass `currency.separator`.
408
+ *
405
409
  * Example with `maxDecimals: 4, minDecimals: 2`:
406
- * fixed → 0.0673 → 0,07 0.3 → 0,30
407
- * variable → 0.0673 → 0,0673 0.067 → 0,067 0.3 → 0,30 0 → 0,00
410
+ * fixed → 0.0673 → 0.07 0.3 → 0.30
411
+ * variable → 0.0673 → 0.0673 0.067 → 0.067 0.3 → 0.30 0 → 0.00
408
412
  */
409
413
  function formatCurrency(value, currency, variableDecimals = false) {
410
414
  const maxDecimals = currency.maxDecimals ?? 2;
411
415
  const minDecimals = Math.max(0, Math.min(maxDecimals, currency.minDecimals ?? maxDecimals));
412
- const thousands = currency.separator?.thousands ?? '.';
413
- const decimal = currency.separator?.decimal ?? ',';
416
+ const thousands = currency.separator?.thousands ?? ',';
417
+ const decimal = currency.separator?.decimal ?? '.';
414
418
  const safe = Number.isFinite(value) ? value : 0;
415
419
  // fixed callers round at minDecimals; variable callers round at maxDecimals then trim back down.
416
420
  const places = variableDecimals ? maxDecimals : minDecimals;
@@ -1688,7 +1692,7 @@ class KeyboardController {
1688
1692
 
1689
1693
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
1690
1694
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
1691
- const PACKAGE_VERSION = '0.7.0';
1695
+ const PACKAGE_VERSION = '0.7.2';
1692
1696
 
1693
1697
  /** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
1694
1698
  function resolveConfig(config) {
@@ -2320,7 +2324,22 @@ function prefersReducedMotion() {
2320
2324
  }
2321
2325
  const easeOutCubic = (p) => 1 - Math.pow(1 - p, 3);
2322
2326
 
2323
- /** Tween 0→1 on the Pixi ticker. Returns a canceler. Skips to the end when motion is reduced. */
2327
+ /**
2328
+ * Tween 0→1 on the Pixi ticker. Returns a canceler. Skips to the end when motion is reduced.
2329
+ *
2330
+ * CONTRACT — when motion is reduced (or `duration <= 0`) this tween does NOT animate: it applies
2331
+ * the final value and calls `onComplete` SYNCHRONOUSLY, before returning. Callers depend on that
2332
+ * (`PixiRenderer.destroy` resolves its teardown promise from `onComplete`, and must not wait on a
2333
+ * ticker that may already be stopped), so it must stay synchronous.
2334
+ *
2335
+ * The consequence for callers: `onComplete` is NOT an async boundary. An `onComplete` that starts
2336
+ * another tween is then direct recursion with no unwind — tween → onComplete → tween → … until
2337
+ * `RangeError: Maximum call stack size exceeded`. That shipped once: the CTA pulse loop
2338
+ * (`widgets.ts` startPulse) restarted itself from `onComplete`, so every player running the OS
2339
+ * "reduce motion" setting crashed the instant the buy-bonus panel painted its hovered CTA. Any
2340
+ * looping animation must therefore check `prefersReducedMotion()` and not loop — which is also
2341
+ * what reduced motion is asking for.
2342
+ */
2324
2343
  function tween(ticker, opts) {
2325
2344
  const ease = opts.ease ?? easeOutCubic;
2326
2345
  if (prefersReducedMotion() || opts.duration <= 0) {
@@ -3292,6 +3311,15 @@ class BuyBonusBadge extends Container {
3292
3311
  startPulse() {
3293
3312
  if (this.pulseCancel)
3294
3313
  return;
3314
+ // A pulse is exactly the kind of looping decoration "reduce motion" asks us to drop — and
3315
+ // under it `tween` has nothing to animate anyway: it snaps to the end and calls `onComplete`
3316
+ // SYNCHRONOUSLY (see its contract), which this loop would answer by starting another one, and
3317
+ // another, with no unwind — `RangeError: Maximum call stack size exceeded`. That was a live
3318
+ // Stake crash: with the OS "reduce motion" setting on, opening the buy-bonus panel painted its
3319
+ // hovered CTA and killed the game, so the player could never buy. Now the button simply sits
3320
+ // still at scale 1.
3321
+ if (prefersReducedMotion())
3322
+ return;
3295
3323
  // both the label (anchor 0.5) and the icon (pivot centred) scale around their centre
3296
3324
  const loop = () => {
3297
3325
  this.pulseCancel = tween(this.ticker, {