@open-slot-ui/pixi 0.6.1 → 0.7.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/index.cjs CHANGED
@@ -3985,6 +3985,30 @@ var PanelBodyView = class extends ControlView {
3985
3985
  super.dispose();
3986
3986
  }
3987
3987
  };
3988
+ function showReplayModal(ui, info, buttonKey, onSelect) {
3989
+ const cur = info.currency ?? ui.balance.currency.get();
3990
+ const money = (n) => core.formatAmount(n, cur);
3991
+ ui.showNotice(
3992
+ [
3993
+ { kind: "heading", id: "openui-replay-h", text: "openui.replay.title" },
3994
+ {
3995
+ kind: "stat-grid",
3996
+ id: "openui-replay-g",
3997
+ items: [
3998
+ { label: "openui.replay.baseBet", value: money(info.baseBet) },
3999
+ { label: "openui.replay.costMultiplier", value: `${info.costMultiplier}\xD7` },
4000
+ { label: "openui.replay.payoutMultiplier", value: `${info.payoutMultiplier}\xD7` },
4001
+ { label: "openui.replay.amount", value: money(info.amount) }
4002
+ ]
4003
+ }
4004
+ ],
4005
+ [{ label: buttonKey, variant: "primary", onSelect: () => {
4006
+ ui.hideNotice();
4007
+ onSelect();
4008
+ } }],
4009
+ { blocking: true }
4010
+ );
4011
+ }
3988
4012
  function mountHud(app, spec = {}, opts = {}) {
3989
4013
  const { hooks, ...pixiOpts } = opts;
3990
4014
  const ui = core.createUI(spec, hooks);
@@ -4048,6 +4072,13 @@ function mountHud(app, spec = {}, opts = {}) {
4048
4072
  setSocial: (on2, coin) => ui.setSocial(on2, coin),
4049
4073
  setFreeSpins: (n) => ui.spin.setFreeSpins(n),
4050
4074
  setReplay: (on2) => ui.setReplay(on2),
4075
+ replayStart: (info, onPlay) => {
4076
+ ui.setReplay(true);
4077
+ showReplayModal(ui, info, "openui.replay.play", () => onPlay?.());
4078
+ },
4079
+ replayEnd: (info, onReplay) => {
4080
+ showReplayModal(ui, info, "openui.replay.again", onReplay);
4081
+ },
4051
4082
  confirmBuy: (o) => {
4052
4083
  if (ui.isDisabled("buyFeature")) return;
4053
4084
  ui.showNotice(
@@ -4092,6 +4123,53 @@ function mountHud(app, spec = {}, opts = {}) {
4092
4123
  dispose: teardown
4093
4124
  };
4094
4125
  }
4126
+
4127
+ // src/bootError.ts
4128
+ var host = null;
4129
+ var esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4130
+ function showBootError(opts = {}) {
4131
+ const title = opts.title ?? "Connection lost";
4132
+ const message = opts.message ?? "The game could not reach the game server. Please reload to reconnect and continue.";
4133
+ const showReload = opts.onReload !== null;
4134
+ host ??= document.createElement("div");
4135
+ host.className = "openui-boot-error";
4136
+ host.setAttribute("role", "alertdialog");
4137
+ host.setAttribute("aria-modal", "true");
4138
+ host.innerHTML = `
4139
+ <div class="openui-be-card">
4140
+ <div class="openui-be-icon" aria-hidden="true">
4141
+ <svg viewBox="0 0 48 48" width="48" height="48"><path d="M24 4 3 42h42L24 4Z" fill="none" stroke="#ffc935" stroke-width="3" stroke-linejoin="round"/><rect x="22" y="18" width="4" height="12" rx="2" fill="#ffc935"/><circle cx="24" cy="35" r="2.4" fill="#ffc935"/></svg>
4142
+ </div>
4143
+ <h1 class="openui-be-title">${esc(title)}</h1>
4144
+ <p class="openui-be-msg">${esc(message)}</p>
4145
+ ${opts.detail ? `<p class="openui-be-detail">${esc(opts.detail)}</p>` : ""}
4146
+ ${showReload ? `<button class="openui-be-reload" type="button">${esc(opts.reloadLabel ?? "Reload")}</button>` : ""}
4147
+ </div>
4148
+ <style>
4149
+ .openui-boot-error { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center;
4150
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #e9edf2;
4151
+ background: rgba(6,8,11,.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
4152
+ .openui-be-card { width: min(90%, 440px); text-align: center; padding: 38px 32px 34px;
4153
+ background: #161b22; border: 1.5px solid #ffc935; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
4154
+ .openui-be-icon { margin-bottom: 14px; line-height: 0; }
4155
+ .openui-be-title { margin: 0 0 12px; font-size: 24px; font-weight: 800; color: #ffc935; letter-spacing: .3px; }
4156
+ .openui-be-msg { margin: 0 0 20px; font-size: 15px; line-height: 1.55; color: #c4ccd6; }
4157
+ .openui-be-detail { margin: 0 0 20px; font-size: 12px; line-height: 1.4; color: #78828f; word-break: break-word; }
4158
+ .openui-be-reload { appearance: none; border: 0; cursor: pointer; padding: 13px 42px; border-radius: 999px;
4159
+ background: #ffc935; color: #161b22; font-weight: 800; font-size: 15px; letter-spacing: .3px;
4160
+ box-shadow: 0 8px 22px rgba(255,201,53,.32); transition: transform .12s, filter .12s; }
4161
+ .openui-be-reload:hover { filter: brightness(1.06); }
4162
+ .openui-be-reload:active { transform: scale(.96); }
4163
+ </style>`;
4164
+ if (showReload) {
4165
+ host.querySelector(".openui-be-reload")?.addEventListener("click", () => (opts.onReload ?? (() => window.location.reload()))());
4166
+ }
4167
+ if (!host.isConnected) document.body.appendChild(host);
4168
+ }
4169
+ function hideBootError() {
4170
+ host?.remove();
4171
+ host = null;
4172
+ }
4095
4173
  var ANCHOR_X = 100 / 203;
4096
4174
  var ANCHOR_Y = 100 / 213;
4097
4175
  var TARGET_DIAMETER = 220;
@@ -4143,8 +4221,10 @@ exports.ValueDisplayView = ValueDisplayView;
4143
4221
  exports.buildBlockColumn = buildBlockColumn;
4144
4222
  exports.defaultSpinSkin = defaultSpinSkin;
4145
4223
  exports.drawSpin = drawSpin;
4224
+ exports.hideBootError = hideBootError;
4146
4225
  exports.isDesktop = isDesktop;
4147
4226
  exports.mountHud = mountHud;
4227
+ exports.showBootError = showBootError;
4148
4228
  exports.svgSpinSkin = svgSpinSkin;
4149
4229
  //# sourceMappingURL=index.cjs.map
4150
4230
  //# sourceMappingURL=index.cjs.map