@energy8platform/shell 0.3.0 → 0.4.1

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.d.ts CHANGED
@@ -471,7 +471,7 @@ declare class ShellController extends EventEmitter<ShellEvents> implements Shell
471
471
  tokens: ShellTokens;
472
472
  layout: ShellLayoutMode;
473
473
  soundOn: boolean;
474
- readonly engineVersion = "0.3.0";
474
+ readonly engineVersion = "0.4.1";
475
475
  readonly actions: ShellActions;
476
476
  private renderer;
477
477
  private i18n;
@@ -537,7 +537,7 @@ interface I18n {
537
537
  declare function createI18n(opts: I18nOptions): I18n;
538
538
 
539
539
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
540
- declare const PACKAGE_VERSION = "0.3.0";
540
+ declare const PACKAGE_VERSION = "0.4.1";
541
541
 
542
542
  /** A shell: the renderer-agnostic controller plus the surface facade (safeArea/barHeight/setVisible)
543
543
  * an embedding host reads. `createShell`, `createGameShell` and `createPixiShell` all return this. */
package/dist/html.esm.js CHANGED
@@ -1165,8 +1165,31 @@ const DISCLAIMER_LOCALES = {
1165
1165
  [D.L5]: '奖金根据从 Remote Game Server 收到的金额结算,而非依据网页浏览器内的事件。',
1166
1166
  },
1167
1167
  };
1168
- /** Merge the base UI catalog with the separately-authored disclaimer lines, per language. */
1169
- const LOCALES = Object.fromEntries(Object.keys(BASE_LOCALES).map((l) => [l, { ...BASE_LOCALES[l], ...DISCLAIMER_LOCALES[l] }]));
1168
+ // ── Replay summary labels ──────────────────────────────────────────────────────────────────────
1169
+ // The replay modal (html + pixi) renders these row labels via host.t(); grouped here (merged into
1170
+ // LOCALES below) so the whole replay screen localizes. Terminology matches the base Bet/Win keys.
1171
+ const REPLAY_LOCALES = {
1172
+ da: { Mode: 'Tilstand', 'Base bet': 'Grundindsats', 'Cost multiplier': 'Omkostningsmultiplikator', 'Total cost': 'Samlede omkostninger', 'Win multiplier': 'Gevinstmultiplikator' },
1173
+ de: { Mode: 'Modus', 'Base bet': 'Grundeinsatz', 'Cost multiplier': 'Kostenmultiplikator', 'Total cost': 'Gesamtkosten', 'Win multiplier': 'Gewinnmultiplikator' },
1174
+ es: { Mode: 'Modo', 'Base bet': 'Apuesta base', 'Cost multiplier': 'Multiplicador de coste', 'Total cost': 'Coste total', 'Win multiplier': 'Multiplicador de premio' },
1175
+ fi: { Mode: 'Tila', 'Base bet': 'Peruspanos', 'Cost multiplier': 'Kustannuskerroin', 'Total cost': 'Kokonaiskustannus', 'Win multiplier': 'Voittokerroin' },
1176
+ fr: { Mode: 'Mode', 'Base bet': 'Mise de base', 'Cost multiplier': 'Multiplicateur de coût', 'Total cost': 'Coût total', 'Win multiplier': 'Multiplicateur de gain' },
1177
+ hi: { Mode: 'मोड', 'Base bet': 'आधार दांव', 'Cost multiplier': 'लागत गुणक', 'Total cost': 'कुल लागत', 'Win multiplier': 'जीत गुणक' },
1178
+ id: { Mode: 'Mode', 'Base bet': 'Taruhan dasar', 'Cost multiplier': 'Pengganda biaya', 'Total cost': 'Total biaya', 'Win multiplier': 'Pengganda kemenangan' },
1179
+ ja: { Mode: 'モード', 'Base bet': '基本ベット', 'Cost multiplier': 'コスト倍率', 'Total cost': '合計コスト', 'Win multiplier': '当選倍率' },
1180
+ ko: { Mode: '모드', 'Base bet': '기본 베팅', 'Cost multiplier': '비용 배수', 'Total cost': '총 비용', 'Win multiplier': '당첨 배수' },
1181
+ pl: { Mode: 'Tryb', 'Base bet': 'Zakład podstawowy', 'Cost multiplier': 'Mnożnik kosztu', 'Total cost': 'Całkowity koszt', 'Win multiplier': 'Mnożnik wygranej' },
1182
+ pt: { Mode: 'Modo', 'Base bet': 'Aposta base', 'Cost multiplier': 'Multiplicador de custo', 'Total cost': 'Custo total', 'Win multiplier': 'Multiplicador de ganho' },
1183
+ ru: { Mode: 'Режим', 'Base bet': 'Базовая ставка', 'Cost multiplier': 'Множитель стоимости', 'Total cost': 'Общая стоимость', 'Win multiplier': 'Множитель выигрыша' },
1184
+ tr: { Mode: 'Mod', 'Base bet': 'Temel bahis', 'Cost multiplier': 'Maliyet çarpanı', 'Total cost': 'Toplam maliyet', 'Win multiplier': 'Kazanç çarpanı' },
1185
+ vi: { Mode: 'Chế độ', 'Base bet': 'Cược cơ bản', 'Cost multiplier': 'Hệ số chi phí', 'Total cost': 'Tổng chi phí', 'Win multiplier': 'Hệ số thắng' },
1186
+ zh: { Mode: '模式', 'Base bet': '基础投注', 'Cost multiplier': '成本倍数', 'Total cost': '总成本', 'Win multiplier': '奖金倍数' },
1187
+ };
1188
+ /** Merge the base UI catalog with the separately-authored disclaimer + replay lines, per language. */
1189
+ const LOCALES = Object.fromEntries(Object.keys(BASE_LOCALES).map((l) => [
1190
+ l,
1191
+ { ...BASE_LOCALES[l], ...DISCLAIMER_LOCALES[l], ...REPLAY_LOCALES[l] },
1192
+ ]));
1170
1193
 
1171
1194
  // Social-casino language. English is the source (and, for now, the only) language; `socialize`
1172
1195
  // rewrites the restricted gambling vocabulary into social-safe phrasing while preserving case.
@@ -1413,7 +1436,7 @@ class KeyboardController {
1413
1436
 
1414
1437
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
1415
1438
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
1416
- const PACKAGE_VERSION = '0.3.0';
1439
+ const PACKAGE_VERSION = '0.4.1';
1417
1440
 
1418
1441
  /** Apply defaults to the raw config (the mount target lives on the renderer, not here). */
1419
1442
  function resolveConfig(config) {
@@ -1887,7 +1910,12 @@ const SHELL_CSS = SHELL_FONT_CSS + SHELL_DIGIT_FONT_CSS + `
1887
1910
  #${SHELL_ROOT_ID} .ge-gi-hk-block { display:flex; flex-direction:column; }
1888
1911
  #${SHELL_ROOT_ID} .ge-gi-hk { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 0; }
1889
1912
  #${SHELL_ROOT_ID} .ge-gi-hk + .ge-gi-hk { border-top:1px solid var(--shell-plaque-line); }
1890
- #${SHELL_ROOT_ID} .ge-gi-hk-chips { display:flex; align-items:center; flex-wrap:wrap; gap:4px; flex:0 0 auto; }
1913
+ /* Let the keycaps SHRINK instead of hogging the row: flex:0 1 auto lets the chips block give up
1914
+ width down to its widest single combo, and flex-wrap reflows the extra combos onto another line.
1915
+ On narrow/mobile widths the many-chip rows (Raise/Lower bet) otherwise squeeze the label off the
1916
+ right edge and clip it. (No min-width:0 here — the min-content floor is what keeps a combo intact
1917
+ and wrapping rather than overflowing.) */
1918
+ #${SHELL_ROOT_ID} .ge-gi-hk-chips { display:flex; align-items:center; flex-wrap:wrap; gap:4px; flex:0 1 auto; }
1891
1919
  #${SHELL_ROOT_ID} .ge-gi-hk-combo { display:inline-flex; align-items:center; gap:4px; }
1892
1920
  #${SHELL_ROOT_ID} .ge-gi-hk-chip { display:inline-flex; align-items:center; justify-content:center;
1893
1921
  padding:2px 7px; border-radius:6px; border:1px solid var(--shell-plaque-line);
@@ -1896,7 +1924,10 @@ const SHELL_CSS = SHELL_FONT_CSS + SHELL_DIGIT_FONT_CSS + `
1896
1924
  font-weight:600; line-height:1.5; white-space:nowrap; min-width:1.6em; text-align:center; }
1897
1925
  #${SHELL_ROOT_ID} .ge-gi-hk-sep { color:var(--shell-plaque-label); font-size:11px; padding:0 1px; }
1898
1926
  #${SHELL_ROOT_ID} .ge-gi-hk-sep2 { color:var(--shell-plaque-label); font-size:11px; padding:0 4px; }
1899
- #${SHELL_ROOT_ID} .ge-gi-hk-tx { color:rgba(255,255,255,.88); font-size:14px; font-weight:600; text-align:right; flex:1; }
1927
+ /* flex:1 1 auto (content-based basis, NOT flex:1's 0 basis) so the label keeps demanding its word
1928
+ width and shrinks in PROPORTION to the chips — both give ground and wrap, instead of the label
1929
+ collapsing to nothing. No min-width:0: the min-content floor stops a word being clipped. */
1930
+ #${SHELL_ROOT_ID} .ge-gi-hk-tx { color:rgba(255,255,255,.88); font-size:14px; font-weight:600; text-align:right; flex:1 1 auto; }
1900
1931
 
1901
1932
  /* controls — two blocks (gameplay / menu & info), icon/name/description per control */
1902
1933
  #${SHELL_ROOT_ID} .ge-gi-ctl-block + .ge-gi-ctl-block { margin-top:16px; padding-top:4px; border-top:1px solid var(--shell-plaque-line); }
@@ -1910,7 +1941,7 @@ const SHELL_CSS = SHELL_FONT_CSS + SHELL_DIGIT_FONT_CSS + `
1910
1941
  #${SHELL_ROOT_ID} .ge-gi-ctl-ic--bet { flex-direction:column; font-size:18px; gap:0; }
1911
1942
  /* buy bonus draws the real control-bar badge, scaled down & non-interactive */
1912
1943
  #${SHELL_ROOT_ID} .ge-gi-ctl-ic .ge-shell-buybonus { width:46px; height:46px; font-size:8px; border-width:2px; pointer-events:none; }
1913
- #${SHELL_ROOT_ID} .ge-gi-ctl-tx { display:flex; flex-direction:column; gap:2px; }
1944
+ #${SHELL_ROOT_ID} .ge-gi-ctl-tx { display:flex; flex-direction:column; gap:2px; min-width:0; }
1914
1945
  #${SHELL_ROOT_ID} .ge-gi-ctl-tx b { color:#fff; font-size:15px; font-weight:700; }
1915
1946
  #${SHELL_ROOT_ID} .ge-gi-ctl-tx span { color:rgba(255,255,255,.7); font-size:13px; line-height:1.4; }
1916
1947
 
@@ -2197,6 +2228,14 @@ const SHELL_CSS = SHELL_FONT_CSS + SHELL_DIGIT_FONT_CSS + `
2197
2228
  #${SHELL_ROOT_ID}.ge-mobile .ge-sheet-grid { grid-template-columns:repeat(var(--cols-m,var(--cols,3)),1fr); }
2198
2229
  /* the bet picker packs 6 chips/row → give its card room (autoplay & co. stay at the 28em default) */
2199
2230
  #${SHELL_ROOT_ID} .ge-sheet[data-ge="bet-modal"] .ge-modal-card { max-width:44em; }
2231
+ /* Bet chips carry variable-width currency (a wide currency makes labels grow). Reflow the columns
2232
+ to the widest label (--chip-min, computed in JS) so no chip is ever clipped, and cap the grid
2233
+ height so a long bet ladder scrolls instead of overflowing the card's clipped edge. */
2234
+ #${SHELL_ROOT_ID} .ge-sheet[data-ge="bet-modal"] .ge-sheet-grid,
2235
+ #${SHELL_ROOT_ID}.ge-mobile .ge-sheet[data-ge="bet-modal"] .ge-sheet-grid {
2236
+ grid-template-columns:repeat(auto-fill, minmax(min(100%, var(--chip-min, 6em)), 1fr));
2237
+ max-height:min(50vh, 28em); overflow-y:auto; overflow-x:hidden; }
2238
+ #${SHELL_ROOT_ID} .ge-sheet[data-ge="bet-modal"] .ge-chip { min-width:0; }
2200
2239
  #${SHELL_ROOT_ID} .ge-chip { pointer-events:auto; cursor:pointer; border:1px solid var(--shell-plaque-line);
2201
2240
  border-radius:.8em; background:rgba(255,255,255,.04); color:#fff; font-size:1em; font-weight:700;
2202
2241
  font-variant-numeric:tabular-nums; padding:.8em .55em; transition:background .12s ease, border-color .12s ease; }
@@ -3447,6 +3486,15 @@ function buildSheet(opts) {
3447
3486
  const cols = typeof opts.columns === 'number' ? { wide: opts.columns, mobile: opts.columns } : opts.columns;
3448
3487
  grid.style.setProperty('--cols', String(cols.wide));
3449
3488
  grid.style.setProperty('--cols-m', String(cols.mobile));
3489
+ if (opts.autoFit) {
3490
+ // Widest label in ch (tabular digits ≈ 1ch each; symbols/separators are narrower, so this
3491
+ // slightly over-estimates → safe) + chip padding/border. Floored so normal-width currencies
3492
+ // keep the compact ~6-per-row look and only wide currencies drop to fewer columns.
3493
+ const maxLen = opts.choices.reduce((m, c) => Math.max(m, c.label.length), 0);
3494
+ // Floor at 6em ≈ the natural width of a chip in the 6-wide layout (44em card): short labels
3495
+ // clamp here so a normal currency keeps 6 columns; wider labels raise it and drop to fewer.
3496
+ grid.style.setProperty('--chip-min', `max(6em, calc(${maxLen}ch + 1.4em))`);
3497
+ }
3450
3498
  let selected = opts.selected;
3451
3499
  let focusIndex = opts.choices.findIndex((c) => c.id === selected);
3452
3500
  if (focusIndex < 0)
@@ -3518,7 +3566,7 @@ function buildSheet(opts) {
3518
3566
  /** Bet picker — all available bets as chips (6 per row, 3 on mobile), accent Confirm applies it. */
3519
3567
  function openBetModal(host) {
3520
3568
  return buildSheet({
3521
- ge: 'bet-modal', title: host.t('Bet'), columns: { wide: 6, mobile: 3 }, confirmLabel: host.t('Confirm'),
3569
+ ge: 'bet-modal', title: host.t('Bet'), columns: { wide: 6, mobile: 3 }, autoFit: true, confirmLabel: host.t('Confirm'),
3522
3570
  choices: host.state.availableBets.map((b) => ({ id: String(b), label: host.formatCurrency(b) })),
3523
3571
  selected: String(host.state.bet),
3524
3572
  onClose: () => host.actions.closeOverlay(),