@minicode-dev/chat 0.1.4 → 0.1.6
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/README.md +6 -2
- package/assets/sounds/effects/confetti.mp3 +0 -0
- package/assets/sounds/effects/nudge.mp3 +0 -0
- package/dist/chunks/{BattleshipGameCard-CW_A8Nim.js → BattleshipGameCard-S-UdM6rn.js} +100 -100
- package/dist/chunks/{BattleshipGameCard-CW_A8Nim.js.map → BattleshipGameCard-S-UdM6rn.js.map} +1 -1
- package/dist/chunks/{BattleshipPrototype-Duz-S1JE.js → BattleshipPrototype-Dm6U_mCr.js} +52 -52
- package/dist/chunks/{BattleshipPrototype-Duz-S1JE.js.map → BattleshipPrototype-Dm6U_mCr.js.map} +1 -1
- package/dist/chunks/confettiScene3d-WooGwo25.js +367 -0
- package/dist/chunks/confettiScene3d-WooGwo25.js.map +1 -0
- package/dist/chunks/{connect4Sounds-Do3nvVFx.js → connect4Sounds-9u0p-dAf.js} +7 -7
- package/dist/chunks/{connect4Sounds-Do3nvVFx.js.map → connect4Sounds-9u0p-dAf.js.map} +1 -1
- package/dist/chunks/thunderScene3d-FMMuwJRP.js +218 -0
- package/dist/chunks/thunderScene3d-FMMuwJRP.js.map +1 -0
- package/dist/chunks/timeline-BLBedCYj.js +45 -0
- package/dist/chunks/timeline-BLBedCYj.js.map +1 -0
- package/dist/index.js +3468 -3104
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -230,6 +230,7 @@ const config = {
|
|
|
230
230
|
enabled: true,
|
|
231
231
|
autoPlay: true,
|
|
232
232
|
sound: true,
|
|
233
|
+
backgroundSound: true,
|
|
233
234
|
volume: 0.35,
|
|
234
235
|
cooldownMs: 5000,
|
|
235
236
|
maxAgeMs: 10000,
|
|
@@ -247,7 +248,10 @@ alongside the versioned payload. Set `effects: false` to disable the feature.
|
|
|
247
248
|
Audio requires browser permission to play after a user gesture and respects the chat's
|
|
248
249
|
mute control. Effects stop when closed or when leaving the conversation; motion reduction
|
|
249
250
|
uses a static alternative. History, duplicates and reconnection baselines do not trigger
|
|
250
|
-
automatic playback. Automatic
|
|
251
|
+
automatic playback. Automatic animations require a visible conversation in a visible tab.
|
|
252
|
+
With `backgroundSound` (default `true`), an effect nobody is watching — hidden tab, closed
|
|
253
|
+
chat window or another conversation — still plays its sound, like new-message sounds; returning
|
|
254
|
+
to that conversation within `maxAgeMs` replays it with its animation. Same-origin
|
|
251
255
|
tab deduplication is best effort. Receiving clients use a cooldown and ignore stale events.
|
|
252
256
|
The server should enforce its own authorization and rate limits; browser controls alone
|
|
253
257
|
cannot prevent abusive clients.
|
|
@@ -286,7 +290,7 @@ excluded from npm. Source generators are in `demo/audio-lab/`; see
|
|
|
286
290
|
|
|
287
291
|
New incoming effects automatically animate in the visible conversation by default;
|
|
288
292
|
manual replay is still available. The default cooldown is 5 seconds. Window focus is
|
|
289
|
-
not required
|
|
293
|
+
not required; hidden tabs only play the sound (see `backgroundSound`) and old messages do not replay effects. A new permitted
|
|
290
294
|
effect can replace the animation currently playing. Confetti fills the panel with
|
|
291
295
|
220 colored particles and scales to its height. Reduced-motion preferences remain respected.
|
|
292
296
|
Browsers can still block sound before the recipient interacts with the site; the visual
|
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { S as e, _ as t, a as n, m as r, o as i, p as a, s as o, t as s, u as c, v as l } from "./connect4Sounds-
|
|
1
|
+
import { S as e, _ as t, a as n, m as r, o as i, p as a, s as o, t as s, u as c, v as l } from "./connect4Sounds-9u0p-dAf.js";
|
|
2
2
|
import { l as u, n as d, s as f, t as p } from "./battleship-DXKuIZ1I.js";
|
|
3
3
|
import { t as ee } from "./webglSupport-2WjPEPZ_.js";
|
|
4
4
|
import { memo as m, useCallback as h, useEffect as g, useId as te, useMemo as _, useRef as v, useState as y } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Anchor as ne, Check as re, ChevronDown as ie, Crosshair as ae, LocateFixed as oe, Maximize2 as se, Minimize2 as ce, Radar as le, RotateCw as ue, ShieldCheck as b, Shuffle as de, TriangleAlert as fe, Waves as pe, X as me } from "lucide-react";
|
|
6
|
+
import { Fragment as he, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
7
7
|
// src/games/battleship/sound/battleshipSounds.js
|
|
8
8
|
var C = "ocean_ambient_loop", w = n({
|
|
9
9
|
id: "battleship",
|
|
@@ -157,23 +157,23 @@ function Ie(e) {
|
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
function Le({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
160
|
-
return e?.status === "requesting" ? /* @__PURE__ */
|
|
160
|
+
return e?.status === "requesting" ? /* @__PURE__ */ x("div", {
|
|
161
161
|
className: "chat-game-sync",
|
|
162
162
|
role: "status",
|
|
163
163
|
children: "Sincronizando partida…"
|
|
164
|
-
}) : /* @__PURE__ */
|
|
164
|
+
}) : /* @__PURE__ */ S("div", {
|
|
165
165
|
className: "chat-game-sync",
|
|
166
166
|
role: "alert",
|
|
167
167
|
children: [
|
|
168
|
-
e?.message && /* @__PURE__ */
|
|
169
|
-
e?.status === "incompatible" && e.offer && /* @__PURE__ */
|
|
168
|
+
e?.message && /* @__PURE__ */ x("span", { children: e.message }),
|
|
169
|
+
e?.status === "incompatible" && e.offer && /* @__PURE__ */ x("button", {
|
|
170
170
|
type: "button",
|
|
171
171
|
className: "chat-game-action chat-game-action--primary",
|
|
172
172
|
disabled: !t,
|
|
173
173
|
onClick: r,
|
|
174
174
|
children: "Usar estado del anfitrión"
|
|
175
175
|
}),
|
|
176
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ x("button", {
|
|
177
177
|
type: "button",
|
|
178
178
|
className: "chat-game-action",
|
|
179
179
|
disabled: !t,
|
|
@@ -185,14 +185,14 @@ function Le({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
|
185
185
|
}
|
|
186
186
|
function Re({ game: e }) {
|
|
187
187
|
let t = c(e);
|
|
188
|
-
return t ? /* @__PURE__ */
|
|
188
|
+
return t ? /* @__PURE__ */ S("span", {
|
|
189
189
|
className: `bs-badge bs-badge--${e.verification}`,
|
|
190
190
|
children: [
|
|
191
|
-
e.verification === "ok" && /* @__PURE__ */ b
|
|
191
|
+
e.verification === "ok" && /* @__PURE__ */ x(b, {
|
|
192
192
|
size: 12,
|
|
193
193
|
"aria-hidden": "true"
|
|
194
194
|
}),
|
|
195
|
-
e.verification === "mismatch" && /* @__PURE__ */
|
|
195
|
+
e.verification === "mismatch" && /* @__PURE__ */ x(fe, {
|
|
196
196
|
size: 12,
|
|
197
197
|
"aria-hidden": "true"
|
|
198
198
|
}),
|
|
@@ -204,12 +204,12 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
204
204
|
let a = /* @__PURE__ */ new Map();
|
|
205
205
|
e.ships.forEach((e) => e.cells.forEach((t) => a.set(`${t.row}-${t.col}`, e)));
|
|
206
206
|
let o = new Set((e.preview?.cells || []).map((e) => `${e.row}-${e.col}`));
|
|
207
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ x("div", {
|
|
208
208
|
className: "bs-grid",
|
|
209
209
|
role: "grid",
|
|
210
210
|
"aria-label": e.mode === "target" ? "Tablero objetivo" : "Mi flota",
|
|
211
211
|
onMouseLeave: () => i(null),
|
|
212
|
-
children: Array.from({ length: 10 }, (s, c) => /* @__PURE__ */
|
|
212
|
+
children: Array.from({ length: 10 }, (s, c) => /* @__PURE__ */ x("div", {
|
|
213
213
|
role: "row",
|
|
214
214
|
className: "bs-grid__row",
|
|
215
215
|
children: Array.from({ length: 10 }, (s, l) => {
|
|
@@ -228,7 +228,7 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
228
228
|
col: l
|
|
229
229
|
}) && "is-cursor"
|
|
230
230
|
].filter(Boolean).join(" ");
|
|
231
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ x("button", {
|
|
232
232
|
type: "button",
|
|
233
233
|
role: "gridcell",
|
|
234
234
|
tabIndex: -1,
|
|
@@ -255,29 +255,29 @@ function N({ game: e, currentUserId: t, status: n }) {
|
|
|
255
255
|
"closed",
|
|
256
256
|
"conflict"
|
|
257
257
|
].includes(e.status) && i > 0, c = e.status === "won" && r(t, e.winnerId);
|
|
258
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ S("section", {
|
|
259
259
|
className: "chat-game-card chat-game-card--history bs-card bs-card--history",
|
|
260
260
|
"aria-label": "Partida de Batalla Naval",
|
|
261
261
|
children: [
|
|
262
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ x("header", {
|
|
263
263
|
className: "chat-game-header",
|
|
264
|
-
children: /* @__PURE__ */
|
|
264
|
+
children: /* @__PURE__ */ S("div", {
|
|
265
265
|
className: "chat-game-heading",
|
|
266
|
-
children: [/* @__PURE__ */
|
|
266
|
+
children: [/* @__PURE__ */ x("span", {
|
|
267
267
|
className: "chat-game-eyebrow",
|
|
268
268
|
children: "MINIJUEGOS · 2 JUGADORES"
|
|
269
|
-
}), /* @__PURE__ */
|
|
269
|
+
}), /* @__PURE__ */ S("h3", { children: ["Batalla Naval ", /* @__PURE__ */ x(ne, {
|
|
270
270
|
size: 13,
|
|
271
271
|
"aria-hidden": "true",
|
|
272
272
|
className: "bs-title-icon"
|
|
273
273
|
})] })]
|
|
274
274
|
})
|
|
275
275
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ x("p", {
|
|
277
277
|
className: `chat-game-status${c ? " bs-status--win" : ""}`,
|
|
278
278
|
children: n
|
|
279
279
|
}),
|
|
280
|
-
s && /* @__PURE__ */
|
|
280
|
+
s && /* @__PURE__ */ S("p", {
|
|
281
281
|
className: "bs-history-stats",
|
|
282
282
|
children: [
|
|
283
283
|
"Disparos ",
|
|
@@ -290,7 +290,7 @@ function N({ game: e, currentUserId: t, status: n }) {
|
|
|
290
290
|
p.length
|
|
291
291
|
]
|
|
292
292
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ x(Re, { game: e })
|
|
294
294
|
]
|
|
295
295
|
});
|
|
296
296
|
}
|
|
@@ -298,11 +298,11 @@ function P({ gameKey: n, currentUserId: r, variant: i = "panel", onMinimize: a,
|
|
|
298
298
|
let c = e((e) => e.games[n]), l = t() === "connected";
|
|
299
299
|
if (!c) return null;
|
|
300
300
|
let u = o(c, r);
|
|
301
|
-
return i === "history" ? /* @__PURE__ */
|
|
301
|
+
return i === "history" ? /* @__PURE__ */ x(N, {
|
|
302
302
|
game: c,
|
|
303
303
|
currentUserId: r,
|
|
304
304
|
status: u
|
|
305
|
-
}) : /* @__PURE__ */
|
|
305
|
+
}) : /* @__PURE__ */ x(Be, {
|
|
306
306
|
game: c,
|
|
307
307
|
gameKey: n,
|
|
308
308
|
currentUserId: r,
|
|
@@ -314,7 +314,7 @@ function P({ gameKey: n, currentUserId: r, variant: i = "panel", onMinimize: a,
|
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, variant: c, onMinimize: l, onDismiss: d }) {
|
|
317
|
-
let f = v(null), m = v(null),
|
|
317
|
+
let f = v(null), m = v(null), b = v(!1), C = v(void 0), ge = v({
|
|
318
318
|
cell: null,
|
|
319
319
|
time: 0
|
|
320
320
|
}), E = v({}), D = v(/* @__PURE__ */ new Set()), ye = v(e.status), be = te(), [O, k] = y("idle"), [we, N] = y("own"), [P, Be] = y(null), [F, Ve] = y(null), [I, He] = y(null), [L, Ue] = y("horizontal"), [We, Ge] = y(null), [Ke, qe] = y(!1), [R, Je] = y(!1), [Ye, Xe] = y(!1), [Ze, Qe] = y(null), $e = r(n, e.hostId), et = r(n, e.guestId), tt = $e || et, nt = a(e), z = e.status === "placement", rt = e.status === "active" || e.status === "won", it = e.status === "active" && r(n, e.turnId), at = !o || !!e.pending || !!e.pendingEvent, B = it && !e.pendingShot && !at && !e.error && !Ye, V = z && !e.myReady && !at, H = Te.includes(e.status) && (e.status !== "closed" || (e.myFleet?.length ?? 0) > 0), U = O === "ready", W = _(() => e.myFleet || [], [e.myFleet]), G = e.incomingShots || De, K = e.targetShots || De, ot = _(() => Pe(W), [W]), q = _(() => new Set(W.map((e) => e.id)), [W]), st = p.every((e) => q.has(e.id)), J = p.find((e) => e.id === We && !q.has(e.id)) || p.find((e) => !q.has(e.id)) || null, ct = _(() => W.map((e) => ({
|
|
@@ -527,7 +527,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
527
527
|
_e(f, p, ee), Z(c, l);
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
|
-
_e(Se({ incoming: i }), p, ee),
|
|
530
|
+
_e(Se({ incoming: i }), p, ee), b.current = !0, Xe(!0);
|
|
531
531
|
let g = !1;
|
|
532
532
|
try {
|
|
533
533
|
h.setView(mt(u, a));
|
|
@@ -540,9 +540,9 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
540
540
|
sunk: !!Q.sunk,
|
|
541
541
|
incoming: i
|
|
542
542
|
})).catch(() => {}).then(() => (_e(f, p, ee), g || Z(c, l), new Promise((e) => setTimeout(e, te)))).then(() => {
|
|
543
|
-
g || (
|
|
543
|
+
g || (b.current = !1, Xe(!1));
|
|
544
544
|
}), () => {
|
|
545
|
-
g = !0,
|
|
545
|
+
g = !0, b.current = !1, Xe(!1);
|
|
546
546
|
};
|
|
547
547
|
}, [
|
|
548
548
|
U,
|
|
@@ -557,7 +557,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
557
557
|
]), g(() => {
|
|
558
558
|
B || He(null);
|
|
559
559
|
}, [B]), g(() => {
|
|
560
|
-
if (U && !
|
|
560
|
+
if (U && !b.current) try {
|
|
561
561
|
m.current?.setView(ht);
|
|
562
562
|
} catch (e) {
|
|
563
563
|
console.error("[battleship] setView", e);
|
|
@@ -611,40 +611,40 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
611
611
|
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z ? _t(F || P) : gt(I || F));
|
|
612
612
|
}, wt = (e) => {
|
|
613
613
|
e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || /^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName) || e.target.isContentEditable || (e.key === "r" || e.key === "R" ? (e.preventDefault(), z ? bt() : m.current?.resetCamera?.()) : e.key === "Escape" && R && (e.preventDefault(), e.stopPropagation(), Je(!1)));
|
|
614
|
-
}, Tt = /* @__PURE__ */
|
|
615
|
-
return /* @__PURE__ */
|
|
614
|
+
}, Tt = /* @__PURE__ */ x(Re, { game: e }), Et = e.status === "won" && r(n, e.winnerId), Dt = !o && !nt ? "Sin conexión · esperando reconexión" : e.pending ? "Sincronizando…" : s, Ot = lt.length;
|
|
615
|
+
return /* @__PURE__ */ S("section", {
|
|
616
616
|
className: `chat-game-card bs-card${it ? " chat-game-card--my-turn" : ""}${c ? ` chat-game-card--${c}` : ""}${R ? " bs-card--expanded" : ""}`,
|
|
617
617
|
"aria-label": "Partida de Batalla Naval",
|
|
618
618
|
onKeyDown: wt,
|
|
619
619
|
children: [
|
|
620
|
-
/* @__PURE__ */
|
|
620
|
+
/* @__PURE__ */ S("header", {
|
|
621
621
|
className: "chat-game-header",
|
|
622
622
|
children: [
|
|
623
|
-
/* @__PURE__ */
|
|
623
|
+
/* @__PURE__ */ S("div", {
|
|
624
624
|
className: "chat-game-heading",
|
|
625
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ x("span", {
|
|
626
626
|
className: "chat-game-eyebrow",
|
|
627
627
|
children: "MINIJUEGOS · 2 JUGADORES"
|
|
628
|
-
}), /* @__PURE__ */
|
|
628
|
+
}), /* @__PURE__ */ S("h3", { children: ["Batalla Naval ", /* @__PURE__ */ x(ne, {
|
|
629
629
|
size: 13,
|
|
630
630
|
"aria-hidden": "true",
|
|
631
631
|
className: "bs-title-icon"
|
|
632
632
|
})] })]
|
|
633
633
|
}),
|
|
634
|
-
c === "panel" && /* @__PURE__ */
|
|
635
|
-
H && /* @__PURE__ */
|
|
634
|
+
c === "panel" && /* @__PURE__ */ x(i, { manager: w }),
|
|
635
|
+
H && /* @__PURE__ */ x("button", {
|
|
636
636
|
className: "chat-game-close bs-expand",
|
|
637
637
|
type: "button",
|
|
638
638
|
"aria-pressed": R,
|
|
639
639
|
"aria-label": R ? "Reducir tablero" : "Ampliar tablero",
|
|
640
640
|
title: R ? "Reducir (Esc)" : "Ampliar",
|
|
641
641
|
onClick: $(() => Je((e) => !e)),
|
|
642
|
-
children:
|
|
642
|
+
children: x(R ? ce : se, {
|
|
643
643
|
size: 15,
|
|
644
644
|
"aria-hidden": "true"
|
|
645
645
|
})
|
|
646
646
|
}),
|
|
647
|
-
l && /* @__PURE__ */
|
|
647
|
+
l && /* @__PURE__ */ x("button", {
|
|
648
648
|
className: "chat-game-close",
|
|
649
649
|
type: "button",
|
|
650
650
|
"aria-label": "Minimizar tablero",
|
|
@@ -652,55 +652,55 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
652
652
|
onClick: () => {
|
|
653
653
|
Je(!1), l();
|
|
654
654
|
},
|
|
655
|
-
children: /* @__PURE__ */
|
|
655
|
+
children: /* @__PURE__ */ x(ie, {
|
|
656
656
|
size: 16,
|
|
657
657
|
"aria-hidden": "true"
|
|
658
658
|
})
|
|
659
659
|
}),
|
|
660
|
-
tt && !nt && /* @__PURE__ */
|
|
660
|
+
tt && !nt && /* @__PURE__ */ x("button", {
|
|
661
661
|
className: "chat-game-close",
|
|
662
662
|
type: "button",
|
|
663
663
|
"aria-label": "Finalizar partida para ambos jugadores",
|
|
664
664
|
title: "Finalizar partida para ambos",
|
|
665
665
|
onClick: () => void M("act", t, "game_end"),
|
|
666
666
|
disabled: !o,
|
|
667
|
-
children: /* @__PURE__ */
|
|
667
|
+
children: /* @__PURE__ */ x(me, {
|
|
668
668
|
size: 16,
|
|
669
669
|
"aria-hidden": "true"
|
|
670
670
|
})
|
|
671
671
|
}),
|
|
672
|
-
d && /* @__PURE__ */
|
|
672
|
+
d && /* @__PURE__ */ x("button", {
|
|
673
673
|
className: "chat-game-close",
|
|
674
674
|
type: "button",
|
|
675
675
|
"aria-label": "Cerrar tablero y volver al chat",
|
|
676
676
|
title: "Cerrar tablero",
|
|
677
677
|
onClick: d,
|
|
678
|
-
children: /* @__PURE__ */
|
|
678
|
+
children: /* @__PURE__ */ x(me, {
|
|
679
679
|
size: 16,
|
|
680
680
|
"aria-hidden": "true"
|
|
681
681
|
})
|
|
682
682
|
})
|
|
683
683
|
]
|
|
684
684
|
}),
|
|
685
|
-
/* @__PURE__ */
|
|
685
|
+
/* @__PURE__ */ S("div", {
|
|
686
686
|
className: "bs-statusline",
|
|
687
|
-
children: [/* @__PURE__ */
|
|
687
|
+
children: [/* @__PURE__ */ x("p", {
|
|
688
688
|
className: `chat-game-status${Et ? " bs-status--win" : ""}`,
|
|
689
689
|
role: "status",
|
|
690
690
|
children: Dt
|
|
691
691
|
}), Tt]
|
|
692
692
|
}),
|
|
693
|
-
e.status === "invited" && /* @__PURE__ */
|
|
693
|
+
e.status === "invited" && /* @__PURE__ */ S("div", {
|
|
694
694
|
className: "bs-invite",
|
|
695
|
-
children: [/* @__PURE__ */
|
|
695
|
+
children: [/* @__PURE__ */ x("p", { children: "Coloca 5 barcos en un tablero de 10×10 y hunde la flota rival por turnos." }), et && /* @__PURE__ */ S("div", {
|
|
696
696
|
className: "chat-game-actions",
|
|
697
|
-
children: [/* @__PURE__ */
|
|
697
|
+
children: [/* @__PURE__ */ x("button", {
|
|
698
698
|
type: "button",
|
|
699
699
|
className: "chat-game-action chat-game-action--primary",
|
|
700
700
|
disabled: at,
|
|
701
701
|
onClick: $(() => void M("act", t, "game_accept")),
|
|
702
702
|
children: "Aceptar partida"
|
|
703
|
-
}), /* @__PURE__ */
|
|
703
|
+
}), /* @__PURE__ */ x("button", {
|
|
704
704
|
type: "button",
|
|
705
705
|
className: "chat-game-action",
|
|
706
706
|
disabled: at,
|
|
@@ -709,36 +709,36 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
709
709
|
})]
|
|
710
710
|
})]
|
|
711
711
|
}),
|
|
712
|
-
H && /* @__PURE__ */
|
|
713
|
-
rt && /* @__PURE__ */
|
|
712
|
+
H && /* @__PURE__ */ S(he, { children: [
|
|
713
|
+
rt && /* @__PURE__ */ S("div", {
|
|
714
714
|
className: "bs-hud",
|
|
715
715
|
role: "toolbar",
|
|
716
716
|
"aria-label": "Vista del tablero",
|
|
717
|
-
children: [/* @__PURE__ */
|
|
717
|
+
children: [/* @__PURE__ */ S("div", {
|
|
718
718
|
className: "bs-segment",
|
|
719
|
-
children: [/* @__PURE__ */
|
|
719
|
+
children: [/* @__PURE__ */ S("button", {
|
|
720
720
|
type: "button",
|
|
721
721
|
"aria-pressed": we === "target",
|
|
722
722
|
onClick: $(() => N("target")),
|
|
723
|
-
children: [/* @__PURE__ */
|
|
723
|
+
children: [/* @__PURE__ */ x(ae, {
|
|
724
724
|
size: 14,
|
|
725
725
|
"aria-hidden": "true"
|
|
726
726
|
}), "Objetivo"]
|
|
727
|
-
}), /* @__PURE__ */
|
|
727
|
+
}), /* @__PURE__ */ S("button", {
|
|
728
728
|
type: "button",
|
|
729
729
|
"aria-pressed": we === "own",
|
|
730
730
|
onClick: $(() => N("own")),
|
|
731
|
-
children: [/* @__PURE__ */
|
|
731
|
+
children: [/* @__PURE__ */ x(ne, {
|
|
732
732
|
size: 14,
|
|
733
733
|
"aria-hidden": "true"
|
|
734
734
|
}), "Mi flota"]
|
|
735
735
|
})]
|
|
736
|
-
}), /* @__PURE__ */
|
|
736
|
+
}), /* @__PURE__ */ S("dl", {
|
|
737
737
|
className: "bs-stats",
|
|
738
738
|
children: [
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("dt", { children: "Disparos" }), /* @__PURE__ */ x("dd", { children: ut })] }),
|
|
740
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("dt", { children: "Impactos" }), /* @__PURE__ */ x("dd", { children: dt })] }),
|
|
741
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("dt", { children: "Hundidos" }), /* @__PURE__ */ S("dd", { children: [
|
|
742
742
|
Ot,
|
|
743
743
|
"/",
|
|
744
744
|
p.length
|
|
@@ -746,10 +746,10 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
746
746
|
]
|
|
747
747
|
})]
|
|
748
748
|
}),
|
|
749
|
-
/* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ S("div", {
|
|
750
750
|
className: "bs-stage-wrap",
|
|
751
751
|
children: [
|
|
752
|
-
/* @__PURE__ */
|
|
752
|
+
/* @__PURE__ */ x("div", {
|
|
753
753
|
ref: f,
|
|
754
754
|
className: `bs-stage${O === "fallback" ? " bs-stage--fallback" : ""}`,
|
|
755
755
|
tabIndex: 0,
|
|
@@ -758,7 +758,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
758
758
|
"aria-describedby": be,
|
|
759
759
|
"aria-busy": O === "loading",
|
|
760
760
|
onKeyDown: Ct,
|
|
761
|
-
children: O === "fallback" && /* @__PURE__ */
|
|
761
|
+
children: O === "fallback" && /* @__PURE__ */ x(ze, {
|
|
762
762
|
view: ht,
|
|
763
763
|
selected: Y === "target" ? I : null,
|
|
764
764
|
cursor: F,
|
|
@@ -766,51 +766,51 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
766
766
|
onHover: Be
|
|
767
767
|
})
|
|
768
768
|
}),
|
|
769
|
-
O === "loading" && /* @__PURE__ */
|
|
769
|
+
O === "loading" && /* @__PURE__ */ S("div", {
|
|
770
770
|
className: "bs-stage-state",
|
|
771
771
|
role: "status",
|
|
772
|
-
children: [/* @__PURE__ */
|
|
772
|
+
children: [/* @__PURE__ */ x(pe, {
|
|
773
773
|
size: 16,
|
|
774
774
|
"aria-hidden": "true"
|
|
775
775
|
}), " Preparando el océano…"]
|
|
776
776
|
}),
|
|
777
|
-
O === "fallback" && /* @__PURE__ */
|
|
777
|
+
O === "fallback" && /* @__PURE__ */ S("p", {
|
|
778
778
|
className: "bs-fallback-note",
|
|
779
|
-
children: [/* @__PURE__ */
|
|
779
|
+
children: [/* @__PURE__ */ x(fe, {
|
|
780
780
|
size: 12,
|
|
781
781
|
"aria-hidden": "true"
|
|
782
782
|
}), " Vista 3D no disponible · modo 2D"]
|
|
783
783
|
}),
|
|
784
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ x("div", {
|
|
785
785
|
className: "bs-cell-chip",
|
|
786
786
|
"aria-hidden": "true",
|
|
787
787
|
children: A(z ? X : Y === "target" && I || P)
|
|
788
788
|
}),
|
|
789
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ x("div", {
|
|
790
790
|
className: "bs-live",
|
|
791
791
|
"aria-live": "polite",
|
|
792
792
|
"aria-atomic": "true",
|
|
793
|
-
children: Ze && /* @__PURE__ */
|
|
793
|
+
children: Ze && /* @__PURE__ */ x("span", {
|
|
794
794
|
className: `bs-toast bs-toast--${Ze.kind}`,
|
|
795
795
|
children: Ze.text
|
|
796
796
|
}, Ze.id)
|
|
797
797
|
})
|
|
798
798
|
]
|
|
799
799
|
}),
|
|
800
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ x("p", {
|
|
801
801
|
id: be,
|
|
802
802
|
className: "bs-hint",
|
|
803
803
|
children: z ? "Clic para colocar · clic en un barco para quitarlo · R para rotar" : "Arrastra para rotar · doble clic o Enter para disparar"
|
|
804
804
|
}),
|
|
805
|
-
z && /* @__PURE__ */
|
|
805
|
+
z && /* @__PURE__ */ S("div", {
|
|
806
806
|
className: "bs-placement",
|
|
807
807
|
children: [
|
|
808
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ x("ul", {
|
|
809
809
|
className: "bs-fleet",
|
|
810
810
|
"aria-label": "Tu flota",
|
|
811
811
|
children: p.map((e) => {
|
|
812
812
|
let n = q.has(e.id), r = J?.id === e.id;
|
|
813
|
-
return /* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S("button", {
|
|
814
814
|
type: "button",
|
|
815
815
|
className: `bs-ship${n ? " is-placed" : ""}${r ? " is-active" : ""}`,
|
|
816
816
|
"aria-pressed": r,
|
|
@@ -820,16 +820,16 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
820
820
|
n && M("bsRemoveShip", t, e.id), Ge(e.id);
|
|
821
821
|
}),
|
|
822
822
|
children: [
|
|
823
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ x("span", {
|
|
824
824
|
className: "bs-ship__name",
|
|
825
825
|
children: Me(ke(e.id))
|
|
826
826
|
}),
|
|
827
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ x("span", {
|
|
828
828
|
className: "bs-ship__pips",
|
|
829
829
|
"aria-label": `${e.size} casillas`,
|
|
830
|
-
children: Array.from({ length: e.size }, (e, t) => /* @__PURE__ */
|
|
830
|
+
children: Array.from({ length: e.size }, (e, t) => /* @__PURE__ */ x("i", {}, t))
|
|
831
831
|
}),
|
|
832
|
-
n && /* @__PURE__ */
|
|
832
|
+
n && /* @__PURE__ */ x(re, {
|
|
833
833
|
size: 13,
|
|
834
834
|
"aria-label": "colocado"
|
|
835
835
|
})
|
|
@@ -837,61 +837,61 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
837
837
|
}) }, e.id);
|
|
838
838
|
})
|
|
839
839
|
}),
|
|
840
|
-
/* @__PURE__ */
|
|
840
|
+
/* @__PURE__ */ S("div", {
|
|
841
841
|
className: "chat-game-actions bs-actions",
|
|
842
842
|
children: [
|
|
843
|
-
/* @__PURE__ */
|
|
843
|
+
/* @__PURE__ */ S("button", {
|
|
844
844
|
type: "button",
|
|
845
845
|
className: "chat-game-action bs-btn",
|
|
846
846
|
disabled: !V,
|
|
847
847
|
onClick: bt,
|
|
848
848
|
title: "Rotar (R)",
|
|
849
|
-
children: [/* @__PURE__ */
|
|
849
|
+
children: [/* @__PURE__ */ x(ue, {
|
|
850
850
|
size: 15,
|
|
851
851
|
"aria-hidden": "true"
|
|
852
852
|
}), L === "horizontal" ? "Horizontal" : "Vertical"]
|
|
853
853
|
}),
|
|
854
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ S("button", {
|
|
855
855
|
type: "button",
|
|
856
856
|
className: "chat-game-action bs-btn",
|
|
857
857
|
disabled: !V,
|
|
858
858
|
onClick: () => {
|
|
859
859
|
T("ship_place"), M("bsRandomFleet", t);
|
|
860
860
|
},
|
|
861
|
-
children: [/* @__PURE__ */
|
|
861
|
+
children: [/* @__PURE__ */ x(de, {
|
|
862
862
|
size: 15,
|
|
863
863
|
"aria-hidden": "true"
|
|
864
864
|
}), "Aleatorio"]
|
|
865
865
|
}),
|
|
866
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ S("button", {
|
|
867
867
|
type: "button",
|
|
868
868
|
className: "chat-game-action chat-game-action--primary bs-btn",
|
|
869
869
|
disabled: !V || !st,
|
|
870
870
|
onClick: xt,
|
|
871
|
-
children: [/* @__PURE__ */
|
|
871
|
+
children: [/* @__PURE__ */ x(re, {
|
|
872
872
|
size: 15,
|
|
873
873
|
"aria-hidden": "true"
|
|
874
874
|
}), e.myReady ? "Flota lista" : `Listo (${q.size}/${p.length})`]
|
|
875
875
|
})
|
|
876
876
|
]
|
|
877
877
|
}),
|
|
878
|
-
e.myReady && /* @__PURE__ */
|
|
878
|
+
e.myReady && /* @__PURE__ */ x("p", {
|
|
879
879
|
className: "bs-waiting",
|
|
880
880
|
children: e.opponentReady ? "Ambas flotas listas · iniciando…" : "Flota lista. Esperando a que el rival coloque su flota…"
|
|
881
881
|
})
|
|
882
882
|
]
|
|
883
883
|
}),
|
|
884
|
-
rt && /* @__PURE__ */
|
|
884
|
+
rt && /* @__PURE__ */ S("div", {
|
|
885
885
|
className: "chat-game-actions bs-actions",
|
|
886
886
|
children: [
|
|
887
|
-
/* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ S("button", {
|
|
888
888
|
type: "button",
|
|
889
889
|
className: "chat-game-action chat-game-action--primary bs-btn bs-btn--fire",
|
|
890
890
|
disabled: !B || !I || Y !== "target",
|
|
891
891
|
onClick: () => gt(),
|
|
892
892
|
title: I ? `Disparar en ${A(I)} (Enter)` : "Selecciona una casilla",
|
|
893
893
|
children: [
|
|
894
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ x(ae, {
|
|
895
895
|
size: 15,
|
|
896
896
|
"aria-hidden": "true"
|
|
897
897
|
}),
|
|
@@ -899,28 +899,28 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
899
899
|
I ? ` · ${A(I)}` : ""
|
|
900
900
|
]
|
|
901
901
|
}),
|
|
902
|
-
/* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ S("button", {
|
|
903
903
|
type: "button",
|
|
904
904
|
className: "chat-game-action bs-btn",
|
|
905
905
|
"aria-pressed": Ke,
|
|
906
906
|
disabled: Y !== "target" || !U,
|
|
907
907
|
onClick: St,
|
|
908
908
|
title: "Radar de impactos",
|
|
909
|
-
children: [/* @__PURE__ */
|
|
909
|
+
children: [/* @__PURE__ */ x(le, {
|
|
910
910
|
size: 15,
|
|
911
911
|
"aria-hidden": "true"
|
|
912
912
|
}), "Radar"]
|
|
913
913
|
}),
|
|
914
|
-
/* @__PURE__ */
|
|
914
|
+
/* @__PURE__ */ S("button", {
|
|
915
915
|
type: "button",
|
|
916
916
|
className: "chat-game-action bs-btn",
|
|
917
917
|
disabled: !U,
|
|
918
918
|
onClick: $(() => m.current?.resetCamera?.()),
|
|
919
919
|
title: "Centrar cámara (R)",
|
|
920
|
-
children: [/* @__PURE__ */
|
|
920
|
+
children: [/* @__PURE__ */ x(oe, {
|
|
921
921
|
size: 15,
|
|
922
922
|
"aria-hidden": "true"
|
|
923
|
-
}), /* @__PURE__ */
|
|
923
|
+
}), /* @__PURE__ */ x("span", {
|
|
924
924
|
className: "bs-btn-label",
|
|
925
925
|
children: "Centrar"
|
|
926
926
|
})]
|
|
@@ -928,16 +928,16 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
928
928
|
]
|
|
929
929
|
})
|
|
930
930
|
] }),
|
|
931
|
-
e.status === "conflict" && tt && /* @__PURE__ */
|
|
931
|
+
e.status === "conflict" && tt && /* @__PURE__ */ x(Le, {
|
|
932
932
|
sync: e.sync,
|
|
933
933
|
connected: o,
|
|
934
934
|
onResync: () => void M("requestResync", t),
|
|
935
935
|
onAdoptOffer: () => void M("adoptResyncOffer", t)
|
|
936
936
|
}),
|
|
937
|
-
e.error && /* @__PURE__ */
|
|
937
|
+
e.error && /* @__PURE__ */ S("div", {
|
|
938
938
|
className: "chat-game-error",
|
|
939
939
|
role: "alert",
|
|
940
|
-
children: [/* @__PURE__ */
|
|
940
|
+
children: [/* @__PURE__ */ x("span", { children: e.error }), e.pendingEvent && /* @__PURE__ */ x("button", {
|
|
941
941
|
type: "button",
|
|
942
942
|
className: "chat-game-action",
|
|
943
943
|
disabled: !o || e.pending,
|
|
@@ -945,7 +945,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
945
945
|
children: "Reintentar"
|
|
946
946
|
})]
|
|
947
947
|
}),
|
|
948
|
-
/* @__PURE__ */
|
|
948
|
+
/* @__PURE__ */ x("footer", {
|
|
949
949
|
className: "chat-game-footer",
|
|
950
950
|
children: nt ? "Puedes seguir conversando o invitar a otra partida." : "Hunde los 5 barcos rivales. El chat sigue disponible."
|
|
951
951
|
})
|
|
@@ -955,4 +955,4 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
955
955
|
var F = m(P);
|
|
956
956
|
export { F as default };
|
|
957
957
|
|
|
958
|
-
//# sourceMappingURL=BattleshipGameCard-
|
|
958
|
+
//# sourceMappingURL=BattleshipGameCard-S-UdM6rn.js.map
|