@energy8platform/shell 0.6.4 → 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 +14 -18
- package/dist/html.cjs.js.map +1 -1
- package/dist/html.d.ts +16 -8
- package/dist/html.esm.js +14 -18
- package/dist/html.esm.js.map +1 -1
- package/dist/index.cjs.js +7 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.esm.js +7 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/pixi.cjs.js +21 -18
- package/dist/pixi.cjs.js.map +1 -1
- package/dist/pixi.d.ts +16 -10
- package/dist/pixi.esm.js +21 -18
- package/dist/pixi.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/core/ShellController.ts +7 -5
- package/src/core/renderer.ts +9 -2
- package/src/core/version.ts +1 -1
- package/src/ui/html/HtmlRenderer.ts +7 -13
- package/src/ui/pixi/PixiRenderer.ts +11 -18
- package/src/ui/pixi/text.ts +5 -0
package/dist/pixi.d.ts
CHANGED
|
@@ -392,8 +392,10 @@ interface ShellRenderer {
|
|
|
392
392
|
setLayout(layout: ShellLayoutMode): void;
|
|
393
393
|
/** Apply colour tokens (CSS vars in DOM / repaint in Pixi). */
|
|
394
394
|
applyTheme(tokens: ShellTokens): void;
|
|
395
|
-
/** Count a money readout from→to on the freshly-rendered bar (DOM rAF / Pixi ticker).
|
|
396
|
-
|
|
395
|
+
/** Count a money readout from→to on the freshly-rendered bar (DOM rAF / Pixi ticker).
|
|
396
|
+
* `durationMs` overrides the renderer's default count-up length — a cascade/tumble scene
|
|
397
|
+
* reporting a win per step needs each count-up to fit inside its step. */
|
|
398
|
+
animateMoney(field: 'balance' | 'win', from: number, to: number, durationMs?: number): void;
|
|
397
399
|
/** Build + show an overlay from a controller-supplied model; return a handle for key routing
|
|
398
400
|
* and programmatic close. Returns void when nothing was shown. */
|
|
399
401
|
openOverlay(req: OverlayRequest): OverlayHandle | void;
|
|
@@ -452,6 +454,11 @@ interface ShellHost {
|
|
|
452
454
|
setVolumeRefresh(fn: ((key: VolumeKey, value: number) => void) | null): void;
|
|
453
455
|
/** Logic-bearing actions invoked by renderer controls. */
|
|
454
456
|
readonly actions: ShellActions;
|
|
457
|
+
/** Re-show the replay summary modal through the controller (keeps its OverlayHandle in sync).
|
|
458
|
+
* Used as the modal's own reopen callback after START REPLAY, so a renderer never re-pushes a
|
|
459
|
+
* replay modal behind the controller's back (which would strand `overlay` and dead-end the
|
|
460
|
+
* next close). */
|
|
461
|
+
openReplay(opts: ReplayModalOptions): void;
|
|
455
462
|
}
|
|
456
463
|
/** Every state-changing thing a control can do. Each runs logic in the controller, emits the
|
|
457
464
|
* matching event, and triggers a re-render. Renderers MUST route input through these. */
|
|
@@ -513,7 +520,7 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
|
|
|
513
520
|
tokens: ShellTokens;
|
|
514
521
|
layout: ShellLayoutMode;
|
|
515
522
|
soundOn: boolean;
|
|
516
|
-
readonly engineVersion = "0.6.
|
|
523
|
+
readonly engineVersion = "0.6.6";
|
|
517
524
|
readonly actions: ShellActions;
|
|
518
525
|
private renderer;
|
|
519
526
|
private i18n;
|
|
@@ -557,9 +564,12 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
|
|
|
557
564
|
setBalance(n: number): void;
|
|
558
565
|
/** Set the WIN readout. Counts up/down from the previous value by default. Pass
|
|
559
566
|
* `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
|
|
560
|
-
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
567
|
+
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
568
|
+
* `{ durationMs }` shortens/lengthens the count-up (default 450ms) — a scene reporting a win per
|
|
569
|
+
* cascade step passes its step length so each count-up finishes before the next step lands. */
|
|
561
570
|
setWin(n: number, opts?: {
|
|
562
571
|
animate?: boolean;
|
|
572
|
+
durationMs?: number;
|
|
563
573
|
}): void;
|
|
564
574
|
setBet(n: number): void;
|
|
565
575
|
setMode(mode: ShellMode): void;
|
|
@@ -595,7 +605,7 @@ interface I18n {
|
|
|
595
605
|
declare function createI18n(opts: I18nOptions): I18n;
|
|
596
606
|
|
|
597
607
|
/** The @energy8platform/shell package version, stamped into the game-info footer. */
|
|
598
|
-
declare const PACKAGE_VERSION = "0.6.
|
|
608
|
+
declare const PACKAGE_VERSION = "0.6.6";
|
|
599
609
|
|
|
600
610
|
/** A shell: the renderer-agnostic controller plus the surface facade (safeArea/barHeight/setVisible)
|
|
601
611
|
* an embedding host reads. `createShell`, `createGameShell` and `createPixiShell` all return this. */
|
|
@@ -661,7 +671,7 @@ declare class PixiRenderer implements ShellRenderer {
|
|
|
661
671
|
applyTheme(_tokens: ShellTokens): void;
|
|
662
672
|
/** Count a money readout from→to on the freshly-rendered bar's value Text node. Mirrors
|
|
663
673
|
* PixiGameShell.animateMoney (which counted on the just-built bar's value Texts). */
|
|
664
|
-
animateMoney(field: 'balance' | 'win', from: number, to: number): void;
|
|
674
|
+
animateMoney(field: 'balance' | 'win', from: number, to: number, durationMs?: number): void;
|
|
665
675
|
private cancelMoneyAnims;
|
|
666
676
|
openOverlay(req: OverlayRequest): OverlayHandle | void;
|
|
667
677
|
closeOverlay(): void;
|
|
@@ -672,10 +682,6 @@ declare class PixiRenderer implements ShellRenderer {
|
|
|
672
682
|
closeLayer(): void;
|
|
673
683
|
private clearLayer;
|
|
674
684
|
fitModals(): void;
|
|
675
|
-
/** Replay's reopen path: a replay modal can rebuild itself (e.g. after a replay completes). It is
|
|
676
|
-
* routed back through the controller-equivalent open flow so the layer stack + backdrop stay in
|
|
677
|
-
* sync — mirrors PixiGameShell.openReplay (push a fresh replay modal). */
|
|
678
|
-
private openReplayInternal;
|
|
679
685
|
/** Snapshot the scene behind the modal layer and blur it — the Pixi analogue of the overlay's
|
|
680
686
|
* `backdrop-filter: blur(20px) saturate(120%)`. Static (captured at open time): the game is paused
|
|
681
687
|
* under a modal, so a live re-blur each frame isn't worth the cost. */
|
package/dist/pixi.esm.js
CHANGED
|
@@ -1454,7 +1454,7 @@ class KeyboardController {
|
|
|
1454
1454
|
|
|
1455
1455
|
// AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
|
|
1456
1456
|
/** The @energy8platform/shell package version, stamped into the game-info footer. */
|
|
1457
|
-
const PACKAGE_VERSION = '0.6.
|
|
1457
|
+
const PACKAGE_VERSION = '0.6.6';
|
|
1458
1458
|
|
|
1459
1459
|
/** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
|
|
1460
1460
|
function resolveConfig(config) {
|
|
@@ -1721,10 +1721,10 @@ class ShellController extends EventEmitter {
|
|
|
1721
1721
|
this.renderer.renderBar();
|
|
1722
1722
|
}
|
|
1723
1723
|
// ── game-facing public API (mirrors GameShell/PixiGameShell) ───────────────────
|
|
1724
|
-
money(field, from, to) {
|
|
1724
|
+
money(field, from, to, durationMs) {
|
|
1725
1725
|
this.renderer.renderBar();
|
|
1726
1726
|
if (to !== from)
|
|
1727
|
-
this.renderer.animateMoney(field, from, to);
|
|
1727
|
+
this.renderer.animateMoney(field, from, to, durationMs);
|
|
1728
1728
|
}
|
|
1729
1729
|
setBalance(n) {
|
|
1730
1730
|
const from = this.prevBalance;
|
|
@@ -1734,7 +1734,9 @@ class ShellController extends EventEmitter {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
/** Set the WIN readout. Counts up/down from the previous value by default. Pass
|
|
1736
1736
|
* `{ animate: false }` to SNAP instantly (renderBar cancels any in-flight count-up) — used by the
|
|
1737
|
-
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
1737
|
+
* host to clear WIN to 0 at spin start, where an animated count-DOWN would look wrong.
|
|
1738
|
+
* `{ durationMs }` shortens/lengthens the count-up (default 450ms) — a scene reporting a win per
|
|
1739
|
+
* cascade step passes its step length so each count-up finishes before the next step lands. */
|
|
1738
1740
|
setWin(n, opts) {
|
|
1739
1741
|
const from = this.prevWin;
|
|
1740
1742
|
this.state.win = n;
|
|
@@ -1743,7 +1745,7 @@ class ShellController extends EventEmitter {
|
|
|
1743
1745
|
this.renderer.renderBar(); // instant repaint from state; cancels running money anims
|
|
1744
1746
|
return;
|
|
1745
1747
|
}
|
|
1746
|
-
this.money('win', from, n);
|
|
1748
|
+
this.money('win', from, n, opts?.durationMs);
|
|
1747
1749
|
}
|
|
1748
1750
|
setBet(n) {
|
|
1749
1751
|
this.state.bet = n;
|
|
@@ -1932,6 +1934,11 @@ function makeText(str, opts) {
|
|
|
1932
1934
|
if (opts.wrapWidth != null) {
|
|
1933
1935
|
style.wordWrap = true;
|
|
1934
1936
|
style.wordWrapWidth = opts.wrapWidth;
|
|
1937
|
+
// CJK (and any long unbroken run) has no spaces to wrap on — without breakWords the line
|
|
1938
|
+
// overflows the wrap width instead of wrapping. This is the single shell text helper (How to
|
|
1939
|
+
// Play, disclaimer, Game Info section titles, mode table, win messages, buy-bonus cards), so
|
|
1940
|
+
// one flag fixes wrapping everywhere.
|
|
1941
|
+
style.breakWords = true;
|
|
1935
1942
|
}
|
|
1936
1943
|
if (opts.lineHeight != null)
|
|
1937
1944
|
style.lineHeight = opts.lineHeight;
|
|
@@ -5957,14 +5964,18 @@ class PixiRenderer {
|
|
|
5957
5964
|
}
|
|
5958
5965
|
/** Count a money readout from→to on the freshly-rendered bar's value Text node. Mirrors
|
|
5959
5966
|
* PixiGameShell.animateMoney (which counted on the just-built bar's value Texts). */
|
|
5960
|
-
animateMoney(field, from, to) {
|
|
5967
|
+
animateMoney(field, from, to, durationMs) {
|
|
5961
5968
|
if (!this.bar)
|
|
5962
5969
|
return;
|
|
5970
|
+
// countUpText defaults durationMs to 450 — pass it only when the caller overrode it.
|
|
5971
|
+
const count = (text, fmt) => durationMs == null
|
|
5972
|
+
? countUpText(this.ticker, text, from, to, fmt)
|
|
5973
|
+
: countUpText(this.ticker, text, from, to, fmt, durationMs);
|
|
5963
5974
|
if (field === 'balance' && this.bar.balanceValue) {
|
|
5964
|
-
this.moneyAnims.push(
|
|
5975
|
+
this.moneyAnims.push(count(this.bar.balanceValue, (n) => this.ctx.fmt(n)));
|
|
5965
5976
|
}
|
|
5966
5977
|
else if (field === 'win' && this.bar.winValue) {
|
|
5967
|
-
this.moneyAnims.push(
|
|
5978
|
+
this.moneyAnims.push(count(this.bar.winValue, (n) => this.ctx.fmtWin(n)));
|
|
5968
5979
|
}
|
|
5969
5980
|
}
|
|
5970
5981
|
cancelMoneyAnims() {
|
|
@@ -5991,7 +6002,7 @@ class PixiRenderer {
|
|
|
5991
6002
|
layer = openAutoplayPicker(this.ctx);
|
|
5992
6003
|
break;
|
|
5993
6004
|
case 'replay':
|
|
5994
|
-
layer = buildReplayModal(this.ctx, req.opts, () => this.
|
|
6005
|
+
layer = buildReplayModal(this.ctx, req.opts, () => this.host.openReplay(req.opts));
|
|
5995
6006
|
break;
|
|
5996
6007
|
case 'modal':
|
|
5997
6008
|
layer = buildModal(this.ctx, req.opts);
|
|
@@ -6065,15 +6076,6 @@ class PixiRenderer {
|
|
|
6065
6076
|
fitModals() {
|
|
6066
6077
|
this.currentLayer?.fit?.();
|
|
6067
6078
|
}
|
|
6068
|
-
/** Replay's reopen path: a replay modal can rebuild itself (e.g. after a replay completes). It is
|
|
6069
|
-
* routed back through the controller-equivalent open flow so the layer stack + backdrop stay in
|
|
6070
|
-
* sync — mirrors PixiGameShell.openReplay (push a fresh replay modal). */
|
|
6071
|
-
openReplayInternal(opts) {
|
|
6072
|
-
if (this.destroyed)
|
|
6073
|
-
return;
|
|
6074
|
-
const layer = buildReplayModal(this.ctx, opts, () => this.openReplayInternal(opts));
|
|
6075
|
-
this.pushLayer(layer);
|
|
6076
|
-
}
|
|
6077
6079
|
// ── frosted backdrop ─────────────────────────────────────────────────────────
|
|
6078
6080
|
/** Snapshot the scene behind the modal layer and blur it — the Pixi analogue of the overlay's
|
|
6079
6081
|
* `backdrop-filter: blur(20px) saturate(120%)`. Static (captured at open time): the game is paused
|
|
@@ -6170,6 +6172,7 @@ class PixiRenderer {
|
|
|
6170
6172
|
get layout() { return host.layout; },
|
|
6171
6173
|
get soundOn() { return host.soundOn; },
|
|
6172
6174
|
get actions() { return host.actions; },
|
|
6175
|
+
openReplay: (opts) => host.openReplay(opts),
|
|
6173
6176
|
t: (s) => host.t(s),
|
|
6174
6177
|
formatCurrency: (n, win) => host.formatCurrency(n, win),
|
|
6175
6178
|
emit: host.emit.bind(host),
|