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