@energy8platform/platform-core 0.25.3 → 0.26.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/index.d.ts CHANGED
@@ -439,6 +439,48 @@ declare class PlatformSession extends EventEmitter<PlatformSessionEvents> {
439
439
  */
440
440
  declare function createPlatformSession(config?: PlatformSessionConfig): Promise<PlatformSession>;
441
441
 
442
+ /**
443
+ * A live binding between the CSS preloader's lifecycle API
444
+ * (`setCSSPreloaderProgress` / `waitCSSPreloaderTap`) and the variant's own
445
+ * DOM. Returned by {@link PreloaderVariant.mount}; `null` when the variant has
446
+ * no progress target (e.g. a custom-HTML override), which makes the lifecycle
447
+ * inert.
448
+ */
449
+ interface PreloaderVariantHandle {
450
+ /** Drive the progress indicator. `p` is already clamped to [0, 1]. */
451
+ setProgress(p: number, showPercentage: boolean): void;
452
+ /** Swap the waiting indicator to the tap-to-start cue. */
453
+ showTapText(text: string): void;
454
+ }
455
+ /**
456
+ * A selectable visual identity for the CSS preloader. Encapsulates the markup,
457
+ * its scoped CSS (animations + logo styling), and how progress/tap are driven —
458
+ * everything `CSSPreloader.ts` does NOT own (it keeps overlay/background/fade
459
+ * infrastructure and the shared tap-listener machinery).
460
+ */
461
+ interface PreloaderVariant {
462
+ /** Inner HTML for the overlay (including the variant's own content wrapper). */
463
+ buildContentHTML(config?: LoadingScreenConfig): string;
464
+ /** Variant-specific CSS appended after the shared base styles. */
465
+ css: string;
466
+ /**
467
+ * Bind to the freshly-mounted overlay and return a handle, or `null` if the
468
+ * variant's progress target is absent (lifecycle then becomes inert).
469
+ */
470
+ mount(overlay: HTMLElement, config?: LoadingScreenConfig): PreloaderVariantHandle | null;
471
+ }
472
+
473
+ /**
474
+ * Registry of selectable preloader variants. Add a new variant by writing a
475
+ * file in this folder and adding one entry here — `PreloaderVariantName` and
476
+ * `LoadingScreenConfig.preloaderVariant` widen automatically.
477
+ */
478
+ declare const VARIANTS: {
479
+ readonly energy8: PreloaderVariant;
480
+ readonly voidmoon: PreloaderVariant;
481
+ };
482
+ type PreloaderVariantName = keyof typeof VARIANTS;
483
+
442
484
  interface AssetEntry {
443
485
  alias: string;
444
486
  src: string | string[];
@@ -453,6 +495,12 @@ interface AssetManifest {
453
495
  bundles: AssetBundle[];
454
496
  }
455
497
  interface LoadingScreenConfig {
498
+ /**
499
+ * Which visual identity the CSS preloader renders. Defaults to `'energy8'`;
500
+ * an unknown value falls back to the default. Ignored when `cssPreloaderHTML`
501
+ * is set (custom HTML bypasses the variant).
502
+ */
503
+ preloaderVariant?: PreloaderVariantName;
456
504
  /** Background color (hex number or CSS string) */
457
505
  backgroundColor?: number | string;
458
506
  /** Background gradient (CSS string applied to the CSS preloader) */
@@ -660,6 +708,10 @@ type GameInfoSection = {
660
708
  type: 'controls';
661
709
  title?: string;
662
710
  order?: number;
711
+ } | {
712
+ type: 'hotkeys';
713
+ title?: string;
714
+ order?: number;
663
715
  } | {
664
716
  type: 'paytable';
665
717
  title?: string;
@@ -684,6 +736,9 @@ interface AutoplayConfig {
684
736
  }
685
737
  interface ShellFeatures {
686
738
  turbo: 0 | 1 | 2 | 3;
739
+ /** Master keyboard-shortcut switch. Defaults to `true`; set `false` to disable ALL hotkeys
740
+ * (overrides `spacebar` and any future hotkey). */
741
+ hotkeys?: boolean;
687
742
  /** Spacebar starts a spin in base mode. Defaults to `true`; set `false` to disable the
688
743
  * keyboard shortcut (e.g. jurisdictions that forbid quick-spin keys). */
689
744
  spacebar?: boolean;
@@ -731,6 +786,10 @@ interface ModalOptions {
731
786
  actions?: ModalAction[];
732
787
  /** Backdrop blur in px (defaults to the shell's standard blur). */
733
788
  blurLevel?: number;
789
+ /** Optional keyboard handler — called by the shell keyboard controller while this modal is
790
+ * open. Return true to consume the key (prevents bar actions + Escape close); false to let
791
+ * the controller handle it (Escape → closeModal). */
792
+ onKey?: (e: KeyboardEvent) => boolean;
734
793
  }
735
794
  interface ShellConfig {
736
795
  mount: HTMLElement;
@@ -816,7 +875,15 @@ declare class GameShell extends EventEmitter<ShellEvents> {
816
875
  private prevBalance;
817
876
  private prevWin;
818
877
  private moneyAnims;
819
- private keysBound;
878
+ private kbd;
879
+ private i18n;
880
+ /** onKey handler of the currently open modal/overlay, if any (set in showModal, cleared in closeModal). */
881
+ private modalOnKey;
882
+ /** Shared sound on/off state — Settings speaker toggle and the Shift+M hotkey stay in sync. The
883
+ * game listens to `settingChange({ key: 'sound' })` to (un)mute audio. */
884
+ soundOn: boolean;
885
+ /** Set by the open Settings modal so Shift+M live-updates its speaker icon; cleared on close. */
886
+ private soundRefresh;
820
887
  constructor(config: ShellConfig);
821
888
  render(): void;
822
889
  private cancelMoneyAnims;
@@ -827,20 +894,16 @@ declare class GameShell extends EventEmitter<ShellEvents> {
827
894
  * centred and scaled down to fit — keeping the controls as large as possible.
828
895
  */
829
896
  private applyFitScale;
830
- /** Spacebar starts a spin — same path as the spin disc. Ignored when `features.spacebar` is
831
- * false, while a spin is running, while autoplay is active, outside base mode, when an
832
- * overlay/modal is open, or when an editable element is focused. `repeat` (held key) is
833
- * ignored so it can't spam. */
834
897
  /** Pull window focus into the iframe on first pointer interaction so `document` keydown (the
835
898
  * spacebar shortcut) fires. No-op / harmless when already focused or full-page. */
836
899
  private pullFocus;
837
- private handleKeyDown;
838
900
  setLayout(layout: 'wide' | 'mobile'): void;
839
- /** Resolve a built-in shell string. English is the source; with `isSocial` it is run through
840
- * the social-casino word-swap. Game-supplied strings should NOT be passed through this. */
901
+ /** Resolve a built-in shell string through the i18n resolver (translation + optional socialize). */
841
902
  t(text: string): string;
842
- /** Toggle the social vocabulary at runtime (re-renders the bar; reopen overlays to refresh them). */
903
+ /** Toggle the social vocabulary at runtime (rebuilds resolver, re-renders bar). */
843
904
  setSocial(isSocial: boolean): void;
905
+ /** Swap the active language at runtime (rebuilds resolver, re-renders bar). */
906
+ setLanguage(lang: string): void;
844
907
  /** Recolour the shell at runtime (e.g. switch dark/light scheme). */
845
908
  setTheme(theme: ThemeConfig): void;
846
909
  private observeLayout;
@@ -866,9 +929,12 @@ declare class GameShell extends EventEmitter<ShellEvents> {
866
929
  /** Fraction of the frame a card modal may occupy; the rest is breathing-room margin. Keeps
867
930
  * modals from filling a small popout edge-to-edge (so even short pickers scale down there). */
868
931
  private static readonly MODAL_FIT;
869
- /** Max fraction of the frame HEIGHT the bottom bar may occupy before it fit-scales down. Keeps the
870
- * bar a consistent, small slice on short popouts in EVERY mode (base this already via width). */
871
- private static readonly BAR_MAX_FRACTION;
932
+ /** The bar's design width (px). When the frame is narrower, the bar fit-scales DOWN with the
933
+ * screen the SAME factor in every mode, so replay/free-spins shrink like base instead of
934
+ * staying full-size on a popout. */
935
+ private static readonly BAR_REF_WIDTH;
936
+ /** Lower bound on the bar fit-scale (guards a degenerate near-zero frame). */
937
+ private static readonly BAR_MIN_SCALE;
872
938
  private fitSheet;
873
939
  /** Activate a `feature` option (e.g. Ante): the bar shows the effective bet, tinted with
874
940
  * the feature accent, and BUY BONUS becomes DISABLE. */
@@ -885,6 +951,11 @@ declare class GameShell extends EventEmitter<ShellEvents> {
885
951
  /** Programmatically dismiss whatever modal/overlay is currently shown (e.g. auto-close the
886
952
  * reconnect overlay once the link is restored). No-op when nothing is open. */
887
953
  closeModal(): void;
954
+ /** Flip the shared sound state, notify the game (`settingChange({ key: 'sound' })`), and live-update
955
+ * the Settings speaker icon if that modal is open. Used by both the Settings toggle and Shift+M. */
956
+ setSound(on: boolean): void;
957
+ /** The Settings modal registers an icon-updater while open (cleared on close). */
958
+ setSoundRefresh(fn: ((on: boolean) => void) | null): void;
888
959
  /** Open the non-dismissable replay summary modal (START REPLAY → onReplay → reopen). */
889
960
  openReplay(opts: ReplayModalOptions): void;
890
961
  /** Bet picker — list of available bets with an accent Confirm. */