@energy8platform/shell 0.4.1 → 0.6.0

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
@@ -18,7 +18,14 @@ declare class EventEmitter<TEvents extends {}> {
18
18
  removeAllListeners(event?: keyof TEvents): this;
19
19
  }
20
20
 
21
- type ShellMode = 'base' | 'freeSpins' | 'replay';
21
+ /** `freeSpins` and `bonus` are the SAME bar layout (host-driven hero + Total Win); `freeSpins` is
22
+ * kept as a back-compat alias for the common case (its readout is derived current/total), while
23
+ * `bonus` pairs with `setBonus()` to show a game-supplied label + value (adventure, hold-and-spin,
24
+ * respins — anything that isn't a plain free-spins counter). */
25
+ type ShellMode = 'base' | 'bonus' | 'freeSpins' | 'replay';
26
+ /** The three independent volume sliders shown in the Settings overlay. */
27
+ type VolumeKey = 'master' | 'music' | 'sfx';
28
+ type VolumeLevels = Record<VolumeKey, number>;
22
29
  interface CurrencyConfig {
23
30
  symbol: string;
24
31
  position: 'left' | 'right';
@@ -207,6 +214,19 @@ interface FreeSpinsState {
207
214
  total: number;
208
215
  totalWin: number;
209
216
  }
217
+ /** A game-supplied bonus readout for the bar hero, set via `setBonus()`. Generalizes the
218
+ * free-spins counter: the shell renders `label` (localized via the shell translator, so a game
219
+ * i18n entry for it is honoured) + `value` (a pre-formatted string, shown verbatim — "2 / 10",
220
+ * "3", "×5", "7 coins") + the Total Win accumulator. The shell stays free of any per-game bonus
221
+ * concept — the label/value semantics live in the game/host. */
222
+ interface BonusReadout {
223
+ /** Bar label, e.g. 'Free spins' | 'Adventure' | 'Hold & Spin'. Run through the shell translator. */
224
+ label: string;
225
+ /** Pre-formatted counter value shown verbatim (NOT translated). */
226
+ value: string;
227
+ /** Cumulative bonus win for the Total Win readout. */
228
+ totalWin: number;
229
+ }
210
230
  /** One footer button of a generic modal. Clicking it runs `on` (if any), then closes the modal. */
211
231
  interface ModalAction {
212
232
  title: string;
@@ -267,9 +287,13 @@ interface ShellConfig {
267
287
  * opening the built-in buy-bonus overlay (e.g. the game shows its own bonus UI). The button
268
288
  * is shown whenever this OR `features.buyBonus` is set. */
269
289
  onBonusBuy?: () => void;
290
+ /** Initial Settings-overlay volume slider positions (each 0..1, defaults to 1 = 100%). The shell
291
+ * keeps them stateful across opens; read/update at runtime via `shell.getVolume()` /
292
+ * `shell.setVolume()`, and listen to `settingChange` ({ key: 'master'|'music'|'sfx' }) to apply. */
293
+ volumes?: Partial<VolumeLevels>;
270
294
  }
271
295
  /** ShellConfig after the controller applies defaults (version, isSocial, replay, theme). No mount. */
272
- type ResolvedShellConfig = Required<Pick<ShellConfig, 'language' | 'currency' | 'availableBets' | 'defaultBet' | 'balance' | 'win' | 'mode' | 'features' | 'gameInfo' | 'version' | 'isSocial' | 'replay'>> & Pick<ShellConfig, 'currentBet' | 'theme' | 'onBonusBuy'>;
296
+ type ResolvedShellConfig = Required<Pick<ShellConfig, 'language' | 'currency' | 'availableBets' | 'defaultBet' | 'balance' | 'win' | 'mode' | 'features' | 'gameInfo' | 'version' | 'isSocial' | 'replay'>> & Pick<ShellConfig, 'currentBet' | 'theme' | 'onBonusBuy' | 'volumes'>;
273
297
  interface ShellState {
274
298
  mode: ShellMode;
275
299
  /** Sticky replay marker — true for a historical-round replay, regardless of the current
@@ -285,9 +309,18 @@ interface ShellState {
285
309
  turbo: number;
286
310
  buyBonusEnabled: boolean;
287
311
  freeSpins: FreeSpinsState;
312
+ /** Game-supplied bonus label + value override (from `setBonus()`). When null the bar derives the
313
+ * readout from `freeSpins` (label 'Free spins', value current/total) — the back-compat default. */
314
+ bonus: {
315
+ label: string;
316
+ value: string;
317
+ } | null;
288
318
  /** The currently activated `feature` option (e.g. Ante), or null. Drives the
289
319
  * effective-bet readout tint and the BUY BONUS → DISABLE toggle on the bar. */
290
320
  activeFeature: BonusOption$1 | null;
321
+ /** Volume slider positions (0..1) surfaced in the Settings overlay. Stateful across opens so a
322
+ * reopened overlay reflects the last-set positions instead of resetting to 100%. */
323
+ volumes: VolumeLevels;
291
324
  }
292
325
  interface ShellEvents {
293
326
  spin: void;
@@ -410,6 +443,13 @@ interface ShellHost {
410
443
  setSound(on: boolean): void;
411
444
  /** An open Settings overlay registers an icon updater here (null clears it on close). */
412
445
  setSoundRefresh(fn: ((on: boolean) => void) | null): void;
446
+ /** Current volume slider position (0..1) for master/music/sfx. */
447
+ getVolume(key: VolumeKey): number;
448
+ /** Set a volume slider (0..1): clamps, stores, emits `settingChange`, and live-updates an open
449
+ * Settings overlay. Called by the slider control on drag AND by game code as the public API. */
450
+ setVolume(key: VolumeKey, value: number): void;
451
+ /** An open Settings overlay registers a slider updater here (null clears it on close). */
452
+ setVolumeRefresh(fn: ((key: VolumeKey, value: number) => void) | null): void;
413
453
  /** Logic-bearing actions invoked by renderer controls. */
414
454
  readonly actions: ShellActions;
415
455
  }
@@ -473,13 +513,14 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
473
513
  tokens: ShellTokens;
474
514
  layout: ShellLayoutMode;
475
515
  soundOn: boolean;
476
- readonly engineVersion = "0.4.1";
516
+ readonly engineVersion = "0.6.0";
477
517
  readonly actions: ShellActions;
478
518
  private renderer;
479
519
  private i18n;
480
520
  private kbd?;
481
521
  private overlay;
482
522
  private soundRefresh;
523
+ private volumeRefresh;
483
524
  private prevBalance;
484
525
  private prevWin;
485
526
  private destroyed;
@@ -504,6 +545,12 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
504
545
  closeModal(): void;
505
546
  setSound(on: boolean): void;
506
547
  setSoundRefresh(fn: ((on: boolean) => void) | null): void;
548
+ getVolume(key: VolumeKey): number;
549
+ /** Set a volume slider (0..1). Shared by the slider control (drag) and game code (public API):
550
+ * clamps, stores so a reopened Settings overlay reflects it, emits `settingChange`, and
551
+ * live-updates the slider if the overlay is currently open. */
552
+ setVolume(key: VolumeKey, value: number): void;
553
+ setVolumeRefresh(fn: ((key: VolumeKey, value: number) => void) | null): void;
507
554
  activateFeature(bonus: BonusOption$1): void;
508
555
  deactivateFeature(): void;
509
556
  private money;
@@ -516,6 +563,10 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
516
563
  setTurbo(level: number): void;
517
564
  setBuyBonusEnabled(enabled: boolean): void;
518
565
  setFreeSpins(fs: FreeSpinsState): void;
566
+ /** Generic bonus readout (adventure / hold-and-spin / respins). Sets a game-supplied label+value
567
+ * override for the bar hero and folds `totalWin` into the shared accumulator. Pairs with
568
+ * `setMode('bonus')`. `setFreeSpins()` clears the override back to the derived current/total. */
569
+ setBonus(b: BonusReadout): void;
519
570
  setTheme(theme: ThemeConfig): void;
520
571
  setLanguage(lang: string): void;
521
572
  setSocial(isSocial: boolean): void;
@@ -539,7 +590,7 @@ interface I18n {
539
590
  declare function createI18n(opts: I18nOptions): I18n;
540
591
 
541
592
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
542
- declare const PACKAGE_VERSION = "0.4.1";
593
+ declare const PACKAGE_VERSION = "0.6.0";
543
594
 
544
595
  /** A shell: the renderer-agnostic controller plus the surface facade (safeArea/barHeight/setVisible)
545
596
  * an embedding host reads. `createShell`, `createGameShell` and `createPixiShell` all return this. */
@@ -679,4 +730,4 @@ declare function createPixiShell(config: PixiShellConfig): PixiGameShell;
679
730
  declare function removePixiShell(): Promise<void>;
680
731
 
681
732
  export { DEFAULT_ACCENT, PACKAGE_VERSION, PixiRenderer, SCHEMES, ShellController, createI18n, createPixiShell, createShell, normalizeLang, removePixiShell, resolveConfig, resolveTheme, socialize };
682
- export type { AutoplayConfig, AutoplayOptions, BonusCardContext, BonusOption, CellRef, CreateShellOptions, CurrencyConfig, FreeSpinsState, GameInfoContent, GameInfoSection, GameMode, I18n, I18nOptions, Lang, ModalAction, ModalOptions, OverlayHandle, OverlayRequest, PaylineDef, PaytableRow, PixiGameShell, PixiShellConfig, PixiShellSurface, ReplayModalOptions, ResolvedShellConfig, SafeArea, ShapeDef, Shell, ShellActions, ShellConfig, ShellEvents, ShellFeatures, ShellHost, ShellLayoutMode, ShellMode, ShellRenderer, ShellState, ShellSurface, ShellTokens, ThemeConfig, WinSection };
733
+ export type { AutoplayConfig, AutoplayOptions, BonusCardContext, BonusOption, BonusReadout, CellRef, CreateShellOptions, CurrencyConfig, FreeSpinsState, GameInfoContent, GameInfoSection, GameMode, I18n, I18nOptions, Lang, ModalAction, ModalOptions, OverlayHandle, OverlayRequest, PaylineDef, PaytableRow, PixiGameShell, PixiShellConfig, PixiShellSurface, ReplayModalOptions, ResolvedShellConfig, SafeArea, ShapeDef, Shell, ShellActions, ShellConfig, ShellEvents, ShellFeatures, ShellHost, ShellLayoutMode, ShellMode, ShellRenderer, ShellState, ShellSurface, ShellTokens, ThemeConfig, VolumeKey, VolumeLevels, WinSection };