@energy8platform/platform-core 0.26.1 → 0.28.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.cjs.js +0 -3615
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -400
- package/dist/index.esm.js +1 -3613
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -9
- package/scripts/build-digit-font.mjs +72 -0
- package/src/index.ts +2 -17
- package/dist/shell.cjs.js +0 -3671
- package/dist/shell.cjs.js.map +0 -1
- package/dist/shell.d.ts +0 -433
- package/dist/shell.esm.js +0 -3664
- package/dist/shell.esm.js.map +0 -1
- package/scripts/gen-version.mjs +0 -21
- package/src/shell/GameShell.ts +0 -412
- package/src/shell/INTER-LICENSE.txt +0 -93
- package/src/shell/colors.ts +0 -32
- package/src/shell/components/BottomBar.ts +0 -237
- package/src/shell/components/BuyBonus.ts +0 -329
- package/src/shell/components/GameInfo.ts +0 -384
- package/src/shell/components/Modal.ts +0 -36
- package/src/shell/components/ReplayModal.ts +0 -57
- package/src/shell/components/Settings.ts +0 -59
- package/src/shell/components/icons.ts +0 -40
- package/src/shell/components/pickers.ts +0 -150
- package/src/shell/components/primitives.ts +0 -85
- package/src/shell/fonts.ts +0 -13
- package/src/shell/format.ts +0 -39
- package/src/shell/i18n.ts +0 -96
- package/src/shell/index.ts +0 -22
- package/src/shell/keyboard.ts +0 -229
- package/src/shell/locales.ts +0 -864
- package/src/shell/motion.ts +0 -43
- package/src/shell/shell.css.ts +0 -449
- package/src/shell/state.ts +0 -31
- package/src/shell/theme.ts +0 -54
- package/src/shell/types.ts +0 -262
- package/src/shell/version.ts +0 -3
package/src/shell/types.ts
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
export type ShellMode = 'base' | 'freeSpins' | 'replay';
|
|
2
|
-
|
|
3
|
-
export interface CurrencyConfig {
|
|
4
|
-
symbol: string;
|
|
5
|
-
position: 'left' | 'right';
|
|
6
|
-
/** Maximum fraction digits (default 2). Win / total-win readouts are rounded to this precision;
|
|
7
|
-
* balance / bet / prices stay fixed at `minDecimals`. */
|
|
8
|
-
maxDecimals?: number;
|
|
9
|
-
/** Minimum fraction digits (defaults to `maxDecimals`). For win / total-win, trailing zeros are
|
|
10
|
-
* trimmed down to this many places so small wins keep their significant digits (e.g. 0.0673)
|
|
11
|
-
* while round amounts stay compact (e.g. 0.30). Everything else is shown at exactly this many. */
|
|
12
|
-
minDecimals?: number;
|
|
13
|
-
separator?: { thousands?: string; decimal?: string };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface BonusOption {
|
|
17
|
-
id: string;
|
|
18
|
-
/** 'bonus' buys into a bonus round, 'feature' toggles a base-game modifier (e.g. Ante).
|
|
19
|
-
* Drives the card/button label and accent. Defaults to 'bonus'. */
|
|
20
|
-
type?: 'feature' | 'bonus';
|
|
21
|
-
title: string;
|
|
22
|
-
description: string;
|
|
23
|
-
/** Transparent art image shown at the top of the card (no background plate). */
|
|
24
|
-
thumbnail?: string;
|
|
25
|
-
volatility?: 1 | 2 | 3 | 4 | 5;
|
|
26
|
-
/** Card price = priceMultiplier × current bet, rendered in the shell currency. */
|
|
27
|
-
priceMultiplier: number;
|
|
28
|
-
/** Per-option accent override. Falls back to the type default (bonus → purple, feature → gold). */
|
|
29
|
-
accentColor?: string;
|
|
30
|
-
/** Override the card UI. Return the card's inner content; the shell keeps the grid wrapper,
|
|
31
|
-
* accent vars and live re-pricing, and runs the normal buy flow when you call `ctx.select()`. */
|
|
32
|
-
custom?: (ctx: BonusCardContext) => HTMLElement;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** Context passed to a `BonusOption.custom` renderer. Render the card however you like and wire
|
|
36
|
-
* your own control to `select()` — the buy/confirm flow stays internal to the shell. */
|
|
37
|
-
export interface BonusCardContext {
|
|
38
|
-
bonus: BonusOption;
|
|
39
|
-
/** Current bet. */
|
|
40
|
-
bet: number;
|
|
41
|
-
/** Card price = `bonus.priceMultiplier × bet`. */
|
|
42
|
-
price: number;
|
|
43
|
-
/** `price` formatted in the shell currency. */
|
|
44
|
-
priceText: string;
|
|
45
|
-
/** True when the option can't be bought right now (unaffordable / busy / buy-bonus disabled);
|
|
46
|
-
* reflect it in your UI. `select()` is a no-op while disabled. */
|
|
47
|
-
disabled: boolean;
|
|
48
|
-
/** Card accent (per-option override or the type default); also set as the `--card-acc` CSS var. */
|
|
49
|
-
accent: string;
|
|
50
|
-
/** Proceed through the shell's normal flow: opens the confirm modal, then emits `buyBonusSelect`
|
|
51
|
-
* / activates the feature. No-op while `disabled`. */
|
|
52
|
-
select: () => void;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ThemeConfig {
|
|
56
|
-
/** Palette scheme: 'dark' (default) for dark games, 'light' for light backgrounds. */
|
|
57
|
-
scheme?: 'dark' | 'light';
|
|
58
|
-
/** Brand accent — active states, the SPIN hover glow, and the BUY BONUS button.
|
|
59
|
-
* (Per-bonus card accents are set on each `BonusOption.accentColor`.) */
|
|
60
|
-
accent?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** One paytable entry: a symbol (text/image) and its win tiers, rendered "<count> x<multiplier>". */
|
|
64
|
-
export interface PaytableRow {
|
|
65
|
-
symbol: { text?: string; image?: string };
|
|
66
|
-
wins: Array<{ count?: string; multiplier: number }>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** One payline over a cols×rows grid: the row index (0 = top) the line takes in each column. */
|
|
70
|
-
export interface PaylineDef {
|
|
71
|
-
/** length must equal grid.cols; each value in 0..rows-1 */
|
|
72
|
-
pattern: number[];
|
|
73
|
-
label?: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** A single grid cell, 0-based, row 0 = top. */
|
|
77
|
-
export type CellRef = [col: number, row: number];
|
|
78
|
-
|
|
79
|
-
/** A named winning shape: an arbitrary set of grid cells (not one-per-column like a payline),
|
|
80
|
-
* shown as a grid illustration with its name and optional description. */
|
|
81
|
-
export interface ShapeDef {
|
|
82
|
-
/** The lit cells, in any pattern. */
|
|
83
|
-
cells: CellRef[];
|
|
84
|
-
name: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** How a game pays — drives the GameInfo win-section illustration. One section = one kind.
|
|
89
|
-
* `example`/`winExample`/`loseExample` are optional; omit them for an auto-drawn illustration
|
|
90
|
-
* sized to `grid`. */
|
|
91
|
-
export type WinSection = {
|
|
92
|
-
type: 'wins';
|
|
93
|
-
title?: string;
|
|
94
|
-
order?: number;
|
|
95
|
-
grid: { cols: number; rows: number };
|
|
96
|
-
/** Optional prose shown alongside the illustration. */
|
|
97
|
-
description?: string;
|
|
98
|
-
} & (
|
|
99
|
-
| { kind: 'classic'; lines: Array<number[] | PaylineDef> }
|
|
100
|
-
| { kind: 'cluster'; minCount: number; example?: CellRef[] }
|
|
101
|
-
| { kind: 'anywhere'; minCount: number; example?: CellRef[] }
|
|
102
|
-
| { kind: 'ways'; winExample?: CellRef[]; loseExample?: CellRef[] }
|
|
103
|
-
| { kind: 'shapes'; shapes: ShapeDef[] }
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
/** A playable mode / bonus-buy option, shown for comparison (informational only). */
|
|
107
|
-
export interface GameMode {
|
|
108
|
-
title: string;
|
|
109
|
-
price?: string;
|
|
110
|
-
rtp?: number;
|
|
111
|
-
maxWin?: string;
|
|
112
|
-
description?: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/** A preset game-info section. `order` overrides placement; by default `modes` comes
|
|
116
|
-
* first, `controls` second, and the rest follow in declaration order. */
|
|
117
|
-
export type GameInfoSection =
|
|
118
|
-
| { type: 'modes'; title?: string; order?: number; modes: GameMode[] }
|
|
119
|
-
| { type: 'controls'; title?: string; order?: number }
|
|
120
|
-
| { type: 'hotkeys'; title?: string; order?: number }
|
|
121
|
-
| { type: 'paytable'; title?: string; order?: number; rows: PaytableRow[] }
|
|
122
|
-
| WinSection
|
|
123
|
-
| { type: 'custom'; title?: string; order?: number; node?: HTMLElement; html?: string };
|
|
124
|
-
|
|
125
|
-
export interface GameInfoContent {
|
|
126
|
-
sections?: GameInfoSection[];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** Autoplay limits. Presence of this object (vs `null`) is what enables autoplay. */
|
|
130
|
-
export interface AutoplayConfig {
|
|
131
|
-
/** Maximum selectable spin count in the autoplay picker. Caps the built-in presets and
|
|
132
|
-
* drops the unlimited (∞) choice; if it isn't already a preset it becomes the top choice.
|
|
133
|
-
* Omit for the default presets (including ∞). */
|
|
134
|
-
maxCount?: number;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface ShellFeatures {
|
|
138
|
-
turbo: 0 | 1 | 2 | 3;
|
|
139
|
-
/** Master keyboard-shortcut switch. Defaults to `true`; set `false` to disable ALL hotkeys
|
|
140
|
-
* (overrides `spacebar` and any future hotkey). */
|
|
141
|
-
hotkeys?: boolean;
|
|
142
|
-
/** Spacebar starts a spin in base mode. Defaults to `true`; set `false` to disable the
|
|
143
|
-
* keyboard shortcut (e.g. jurisdictions that forbid quick-spin keys). */
|
|
144
|
-
spacebar?: boolean;
|
|
145
|
-
/** Autoplay: `null` (or omitted) disables it; an object enables it (optionally with limits). */
|
|
146
|
-
autoplay?: AutoplayConfig | null;
|
|
147
|
-
buyBonus: BonusOption[] | false;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface AutoplayOptions {
|
|
151
|
-
active: boolean;
|
|
152
|
-
remaining: number;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface FreeSpinsState {
|
|
156
|
-
/** Spin index for the `current / total` counter. Set to `null` (or omit) to instead show just
|
|
157
|
-
* `total` as a single number — drive a countdown by decrementing `total` each spin. */
|
|
158
|
-
current?: number | null;
|
|
159
|
-
total: number;
|
|
160
|
-
totalWin: number;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** One footer button of a generic modal. Clicking it runs `on` (if any), then closes the modal. */
|
|
164
|
-
export interface ModalAction {
|
|
165
|
-
title: string;
|
|
166
|
-
/** Button fill colour (any CSS colour). Omit for a neutral/secondary button. */
|
|
167
|
-
color?: string;
|
|
168
|
-
on?: () => void;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/** Options for `shell.openReplay()` — a non-dismissable replay summary modal.
|
|
172
|
-
* `bonusId` is matched against `features.buyBonus` to label the mode and read the cost
|
|
173
|
-
* multiplier. There is no ✕ and the backdrop never closes it; the only action is START
|
|
174
|
-
* REPLAY, which closes the modal, runs `onReplay`, then reopens it. */
|
|
175
|
-
export interface ReplayModalOptions {
|
|
176
|
-
bonusId: string;
|
|
177
|
-
/** Base bet the replay was recorded at. */
|
|
178
|
-
bet: number;
|
|
179
|
-
payoutMultiplier: number;
|
|
180
|
-
/** Runs after the modal closes; the modal reopens once it resolves (immediately for sync). */
|
|
181
|
-
onReplay: () => void | Promise<void>;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/** Options for `shell.openModal()` — a generic, externally-triggered card modal. */
|
|
185
|
-
export interface ModalOptions {
|
|
186
|
-
/** Show the ✕ in the overlay's top-right corner. */
|
|
187
|
-
availableClose: boolean;
|
|
188
|
-
title: string;
|
|
189
|
-
body: string;
|
|
190
|
-
/** Footer buttons; each closes the modal (after running its `on`). */
|
|
191
|
-
actions?: ModalAction[];
|
|
192
|
-
/** Backdrop blur in px (defaults to the shell's standard blur). */
|
|
193
|
-
blurLevel?: number;
|
|
194
|
-
/** Optional keyboard handler — called by the shell keyboard controller while this modal is
|
|
195
|
-
* open. Return true to consume the key (prevents bar actions + Escape close); false to let
|
|
196
|
-
* the controller handle it (Escape → closeModal). */
|
|
197
|
-
onKey?: (e: KeyboardEvent) => boolean;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export interface ShellConfig {
|
|
201
|
-
mount: HTMLElement;
|
|
202
|
-
theme?: ThemeConfig;
|
|
203
|
-
gameInfo: GameInfoContent;
|
|
204
|
-
language: string;
|
|
205
|
-
/** Game version shown in the game-info footer (e.g. '1.2.0'). Defaults to '1.0.0'. The footer
|
|
206
|
-
* stamp is `${version}.${engineVersionWithoutDots}` — e.g. game 1.0.0 on engine 0.24.6 → '1.0.0.0246'. */
|
|
207
|
-
version?: string;
|
|
208
|
-
/** When true, all built-in shell text is shown in the social-casino vocabulary (derived from
|
|
209
|
-
* English via word-swap rules), regardless of `language`. Game-supplied content is untouched. */
|
|
210
|
-
isSocial?: boolean;
|
|
211
|
-
currency: CurrencyConfig;
|
|
212
|
-
availableBets: number[];
|
|
213
|
-
defaultBet: number;
|
|
214
|
-
currentBet: number | null;
|
|
215
|
-
balance: number;
|
|
216
|
-
win: number;
|
|
217
|
-
mode: ShellMode;
|
|
218
|
-
/** Mark this shell as a read-only historical-round replay. A replay never shows the player's
|
|
219
|
-
* balance (there's no live wallet), even while its free-spins phase runs in `freeSpins` mode.
|
|
220
|
-
* Defaults to `mode === 'replay'`; set explicitly when a replay starts in another mode. */
|
|
221
|
-
replay?: boolean;
|
|
222
|
-
features: ShellFeatures;
|
|
223
|
-
/** Override the BUY BONUS bar button's action: when set, tapping it calls this instead of
|
|
224
|
-
* opening the built-in buy-bonus overlay (e.g. the game shows its own bonus UI). The button
|
|
225
|
-
* is shown whenever this OR `features.buyBonus` is set. */
|
|
226
|
-
onBonusBuy?: () => void;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export interface ShellState {
|
|
230
|
-
mode: ShellMode;
|
|
231
|
-
/** Sticky replay marker — true for a historical-round replay, regardless of the current
|
|
232
|
-
* `mode`. Set once (from config or when `mode` becomes 'replay') and never cleared, since a
|
|
233
|
-
* shell instance is either a live game or a replay viewer for its whole lifetime. */
|
|
234
|
-
replay: boolean;
|
|
235
|
-
balance: number;
|
|
236
|
-
win: number;
|
|
237
|
-
bet: number;
|
|
238
|
-
availableBets: number[];
|
|
239
|
-
busy: boolean;
|
|
240
|
-
autoplay: AutoplayOptions;
|
|
241
|
-
turbo: number;
|
|
242
|
-
buyBonusEnabled: boolean;
|
|
243
|
-
freeSpins: FreeSpinsState;
|
|
244
|
-
/** The currently activated `feature` option (e.g. Ante), or null. Drives the
|
|
245
|
-
* effective-bet readout tint and the BUY BONUS → DISABLE toggle on the bar. */
|
|
246
|
-
activeFeature: BonusOption | null;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export interface ShellEvents {
|
|
250
|
-
spin: void;
|
|
251
|
-
betChange: number;
|
|
252
|
-
autoplayStart: AutoplayOptions;
|
|
253
|
-
autoplayStop: void;
|
|
254
|
-
turboChange: number;
|
|
255
|
-
buyBonusSelect: { id: string };
|
|
256
|
-
featureActivate: { id: string };
|
|
257
|
-
featureDeactivate: { id: string };
|
|
258
|
-
menuOpen: void;
|
|
259
|
-
settingsOpen: void;
|
|
260
|
-
infoOpen: void;
|
|
261
|
-
settingChange: { key: string; value: unknown };
|
|
262
|
-
}
|
package/src/shell/version.ts
DELETED