@energy8platform/platform-core 0.30.9 → 0.30.10

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.
Files changed (2) hide show
  1. package/README.md +61 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -587,7 +587,7 @@ Nothing in this code is Pixi-specific. The same pattern fits Three.js, Babylon,
587
587
 
588
588
  `@energy8platform/platform-core/shell` is a **vanilla-DOM UI overlay** you layer over the game
589
589
  canvas — no Pixi, no React, no framework. It owns the control bar (3 modes: base / freeSpins /
590
- replay), the menu, settings, the game-info panel, and a buy-bonus selection overlay, plus generic
590
+ replay), the bar menu, the game-info panel, and a buy-bonus selection overlay, plus generic
591
591
  modals and a replay summary. Branded Energy8 chrome, fully renderer-agnostic — pair it with Pixi,
592
592
  Phaser, Three.js, or a custom engine.
593
593
 
@@ -665,6 +665,7 @@ await removeGameShell();
665
665
  | `balance` / `win` | `number` | Initial readouts. |
666
666
  | `mode` | `'base' \| 'freeSpins' \| 'replay'` | Drives which bottom-bar variant renders. |
667
667
  | `gameInfo` | `GameInfoContent` | Sections for the game-info overlay (see below). |
668
+ | `menu` | `MenuItem[]?` | Bar-menu popover items, in order (see below). Omit for the default list. |
668
669
  | `features` | `ShellFeatures` | `{ turbo: 0–3, spacebar?, autoplay, buyBonus }`. `spacebar?: boolean` (default `true`) — `false` disables the Spacebar → spin shortcut. `autoplay: AutoplayConfig \| null` — `null`/omitted disables it; `{}` enables it; `{ maxCount }` caps the picker (drops ∞). `buyBonus: BonusOption[] \| false`. |
669
670
  | `onBonusBuy` | `(() => void)?` | Override the BUY BONUS button action — opens your own UI instead of the built-in overlay (also shows the button without a `buyBonus` array). See [Buy bonus](#buy-bonus--features). |
670
671
 
@@ -678,8 +679,10 @@ await removeGameShell();
678
679
  | `turboChange` | `number` | Turbo level cycled. |
679
680
  | `buyBonusSelect` | `{ id }` | A `type: 'bonus'` card was bought. |
680
681
  | `featureActivate` / `featureDeactivate` | `{ id }` | A `type: 'feature'` option (e.g. Ante) toggled. |
681
- | `menuOpen` / `settingsOpen` / `infoOpen` | — | Overlay opened. |
682
- | `settingChange` | `{ key, value }` | Settings control changed. Keys: `sound` (bool), `master` / `music` / `sfx` (0–100). |
682
+ | `menuOpen` | — | The bar-menu popover opened. A second burger tap closes it and emits nothing. |
683
+ | `settingsOpen` | | **Deprecated** only emitted by the deprecated `openSettings()` alias (which still opens the menu). New code should call `openMenu()` and listen for `menuOpen`. |
684
+ | `infoOpen` | — | Game-info overlay opened. |
685
+ | `settingChange` | `{ key, value }` | A bar-menu item's value changed (preset or custom). `key` is the item's id. Built-in: `sound` (bool), `music` / `sfx` (0–1). A custom item reports its own id and value type. |
683
686
 
684
687
  ### State setters (`game → shell`)
685
688
 
@@ -763,10 +766,62 @@ gameInfo: {
763
766
  }
764
767
  ```
765
768
 
769
+ ### Bar menu (`ShellConfig.menu`)
770
+
771
+ The burger button opens a compact popover anchored to itself — not a full-screen overlay. Its
772
+ content is declared as a list: a built-in `id` selects a preset, otherwise `type` says how to draw
773
+ a custom row.
774
+
775
+ - `{ id: 'sound' }` — sound on/off toggle.
776
+ - `{ id: 'music' }` / `{ id: 'sfx' }` — volume sliders (0–1, percent readout).
777
+ - `{ id: 'gameInfo' }` — opens the game-info overlay.
778
+ - `{ type: 'toggle', value?, onChange? }` — a custom on/off row; `onChange` fires when it's toggled.
779
+ - `{ type: 'range', min?, max?, step?, value?, format?, onChange? }` — a custom slider. Omitted
780
+ bounds default to `min: 0, max: 1, step: (max-min)/20` (exactly a volume slider); `format`
781
+ defaults to a percent readout for a 0..1 range, else the raw number.
782
+ - `{ type: 'button', chevron?, onSelect? }` — a row that runs a callback (e.g. opens your own UI).
783
+ - `{ type: 'separator' }` — a divider line.
784
+
785
+ Every kind (preset or custom) also takes `label?` (translated override), `icon?` (a name from the
786
+ shell's built-in glyph set) and `disabled?` (dims the row and blocks interaction).
787
+
788
+ ```typescript
789
+ createGameShell({
790
+ // …
791
+ menu: [
792
+ { id: 'sound' }, { id: 'music' }, { id: 'sfx' },
793
+ { type: 'separator' },
794
+ { id: 'gameInfo' },
795
+ { id: 'lefty', type: 'toggle', label: 'Left-hand mode',
796
+ value: false, onChange: (v) => layout.mirror(v) },
797
+ { id: 'speed', type: 'range', label: 'Reel speed', min: 1, max: 5, step: 1,
798
+ value: 2, format: (v) => `×${v}`, onChange: (v) => reels.setSpeed(v) },
799
+ { id: 'paytable', type: 'button', label: 'Paytable', icon: 'ticket',
800
+ chevron: true, onSelect: () => openPaytable() },
801
+ ],
802
+ });
803
+ ```
804
+
805
+ Omit `menu` for the default list: `sound`, `music`, `sfx`, a separator, `gameInfo`.
806
+
807
+ | Method | Behaviour |
808
+ | --- | --- |
809
+ | `shell.setMenu(items)` | Replaces the list; an open popover rebuilds. Values already in state are kept; new ids are seeded from their `value`. |
810
+ | `shell.getMenuValue(id)` | Reads a preset or custom item's current value (`boolean \| number \| undefined`; `undefined` for unknown ids and for `button` / `separator`). |
811
+ | `shell.setMenuValue(id, v)` | Writes a value — clamps a range to its declared bounds, stores it, emits `settingChange`, and live-updates an open popover. |
812
+ | `shell.openMenu()` | Opens the popover; called again while it's open, closes it (the burger toggles). |
813
+
814
+ `shell.setSound(on)` / `shell.getVolume(key)` / `shell.setVolume(key, v)` stay as thin aliases over
815
+ the same state for the `sound` / `music` / `sfx` presets — existing code keeps working.
816
+
817
+ `shell.openSettings()` is a **deprecated** alias for `openMenu()`, kept for compatibility; it also
818
+ still emits the deprecated `settingsOpen` event (see Events above). New code should call
819
+ `openMenu()` and listen for `menuOpen`.
820
+
766
821
  ### Opening overlays & modals programmatically
767
822
 
768
823
  ```typescript
769
- shell.openSettings(); shell.openInfo(); shell.openBuyBonus();
824
+ shell.openMenu(); shell.openInfo(); shell.openBuyBonus();
770
825
  shell.openBetPicker(); shell.openAutoplayPicker();
771
826
 
772
827
  // generic card modal
@@ -794,7 +849,8 @@ shell.openReplay({ bonusId: 'fs', bet: shell.state.bet, payoutMultiplier: 87.5,
794
849
  Transparent neutral chrome that doesn't compete with the game — brand colour appears only on the
795
850
  BUY BONUS control and a duotone icon set. The bottom bar **adapts by viewport** automatically (a
796
851
  `ResizeObserver` on the mount): landscape → one row scaled to fit, portrait → stacked mobile
797
- layout; Settings / Game info / Buy bonus open as full-screen overlays. Motion is minimal (press
852
+ layout; Game info / Buy bonus open as full-screen overlays, while the bar menu opens as a compact,
853
+ light-dismiss popover anchored to the burger button. Motion is minimal (press
798
854
  feedback, money count-up, overlay fades) and respects `prefers-reduced-motion`. Spacebar triggers
799
855
  a spin in base mode (ignored while busy, in autoplay, when a modal/input is focused, or when
800
856
  `features.spacebar` is `false`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energy8platform/platform-core",
3
- "version": "0.30.9",
3
+ "version": "0.30.10",
4
4
  "description": "Energy8 platform core: Lua engine, DevBridge, RTP simulation, and SDK session orchestration. Renderer-agnostic — pair with any game framework (Pixi, Phaser, Three.js, custom).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",