@open-slot-ui/pixi 0.6.1 → 0.7.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 CHANGED
@@ -4048,6 +4048,33 @@ function mountHud(app, spec = {}, opts = {}) {
4048
4048
  setSocial: (on2, coin) => ui.setSocial(on2, coin),
4049
4049
  setFreeSpins: (n) => ui.spin.setFreeSpins(n),
4050
4050
  setReplay: (on2) => ui.setReplay(on2),
4051
+ replayStart: (info, onPlay) => {
4052
+ ui.setReplay(true);
4053
+ const cur = info.currency ?? ui.balance.currency.get();
4054
+ const money = (n) => core.formatAmount(n, cur);
4055
+ ui.showNotice(
4056
+ [
4057
+ { kind: "heading", id: "openui-replay-h", text: "openui.replay.title" },
4058
+ {
4059
+ kind: "stat-grid",
4060
+ id: "openui-replay-g",
4061
+ items: [
4062
+ { label: "openui.replay.baseBet", value: money(info.baseBet) },
4063
+ { label: "openui.replay.costMultiplier", value: `${info.costMultiplier}\xD7` },
4064
+ { label: "openui.replay.payoutMultiplier", value: `${info.payoutMultiplier}\xD7` },
4065
+ { label: "openui.replay.amount", value: money(info.amount) }
4066
+ ]
4067
+ }
4068
+ ],
4069
+ [{ label: "openui.replay.play", variant: "primary", onSelect: onPlay }]
4070
+ );
4071
+ },
4072
+ replayEnd: (onReplay) => {
4073
+ ui.showNotice(
4074
+ [{ kind: "heading", id: "openui-replay-end", text: "openui.replay.title" }],
4075
+ [{ label: "openui.replay.again", variant: "primary", onSelect: onReplay }]
4076
+ );
4077
+ },
4051
4078
  confirmBuy: (o) => {
4052
4079
  if (ui.isDisabled("buyFeature")) return;
4053
4080
  ui.showNotice(
@@ -4092,6 +4119,53 @@ function mountHud(app, spec = {}, opts = {}) {
4092
4119
  dispose: teardown
4093
4120
  };
4094
4121
  }
4122
+
4123
+ // src/bootError.ts
4124
+ var host = null;
4125
+ var esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4126
+ function showBootError(opts = {}) {
4127
+ const title = opts.title ?? "Connection lost";
4128
+ const message = opts.message ?? "The game could not reach the game server. Please reload to reconnect and continue.";
4129
+ const showReload = opts.onReload !== null;
4130
+ host ??= document.createElement("div");
4131
+ host.className = "openui-boot-error";
4132
+ host.setAttribute("role", "alertdialog");
4133
+ host.setAttribute("aria-modal", "true");
4134
+ host.innerHTML = `
4135
+ <div class="openui-be-card">
4136
+ <div class="openui-be-icon" aria-hidden="true">
4137
+ <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>
4138
+ </div>
4139
+ <h1 class="openui-be-title">${esc(title)}</h1>
4140
+ <p class="openui-be-msg">${esc(message)}</p>
4141
+ ${opts.detail ? `<p class="openui-be-detail">${esc(opts.detail)}</p>` : ""}
4142
+ ${showReload ? `<button class="openui-be-reload" type="button">${esc(opts.reloadLabel ?? "Reload")}</button>` : ""}
4143
+ </div>
4144
+ <style>
4145
+ .openui-boot-error { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center;
4146
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #e9edf2;
4147
+ background: rgba(6,8,11,.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
4148
+ .openui-be-card { width: min(90%, 440px); text-align: center; padding: 38px 32px 34px;
4149
+ background: #161b22; border: 1.5px solid #ffc935; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
4150
+ .openui-be-icon { margin-bottom: 14px; line-height: 0; }
4151
+ .openui-be-title { margin: 0 0 12px; font-size: 24px; font-weight: 800; color: #ffc935; letter-spacing: .3px; }
4152
+ .openui-be-msg { margin: 0 0 20px; font-size: 15px; line-height: 1.55; color: #c4ccd6; }
4153
+ .openui-be-detail { margin: 0 0 20px; font-size: 12px; line-height: 1.4; color: #78828f; word-break: break-word; }
4154
+ .openui-be-reload { appearance: none; border: 0; cursor: pointer; padding: 13px 42px; border-radius: 999px;
4155
+ background: #ffc935; color: #161b22; font-weight: 800; font-size: 15px; letter-spacing: .3px;
4156
+ box-shadow: 0 8px 22px rgba(255,201,53,.32); transition: transform .12s, filter .12s; }
4157
+ .openui-be-reload:hover { filter: brightness(1.06); }
4158
+ .openui-be-reload:active { transform: scale(.96); }
4159
+ </style>`;
4160
+ if (showReload) {
4161
+ host.querySelector(".openui-be-reload")?.addEventListener("click", () => (opts.onReload ?? (() => window.location.reload()))());
4162
+ }
4163
+ if (!host.isConnected) document.body.appendChild(host);
4164
+ }
4165
+ function hideBootError() {
4166
+ host?.remove();
4167
+ host = null;
4168
+ }
4095
4169
  var ANCHOR_X = 100 / 203;
4096
4170
  var ANCHOR_Y = 100 / 213;
4097
4171
  var TARGET_DIAMETER = 220;
@@ -4143,8 +4217,10 @@ exports.ValueDisplayView = ValueDisplayView;
4143
4217
  exports.buildBlockColumn = buildBlockColumn;
4144
4218
  exports.defaultSpinSkin = defaultSpinSkin;
4145
4219
  exports.drawSpin = drawSpin;
4220
+ exports.hideBootError = hideBootError;
4146
4221
  exports.isDesktop = isDesktop;
4147
4222
  exports.mountHud = mountHud;
4223
+ exports.showBootError = showBootError;
4148
4224
  exports.svgSpinSkin = svgSpinSkin;
4149
4225
  //# sourceMappingURL=index.cjs.map
4150
4226
  //# sourceMappingURL=index.cjs.map