speakid-build-a-sentence 1.0.24 → 1.0.25
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as a, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as c, useCallback as ge, useRef as oe, useEffect as V, useMemo as sn, Component as dn } from "react";
|
|
3
3
|
const an = `
|
|
4
4
|
@keyframes spin {
|
|
5
5
|
from { transform: rotate(0deg); }
|
|
@@ -173,33 +173,33 @@ const Te = {
|
|
|
173
173
|
// ===== Анимационные стили =====
|
|
174
174
|
...Te
|
|
175
175
|
}, ln = () => {
|
|
176
|
-
const [u, s] =
|
|
177
|
-
const
|
|
178
|
-
H.trim() ||
|
|
176
|
+
const [u, s] = c([]), W = ge((H, I, f) => {
|
|
177
|
+
const b = [];
|
|
178
|
+
H.trim() || b.push({
|
|
179
179
|
type: "empty",
|
|
180
180
|
message: "Sentence cannot be empty"
|
|
181
|
-
}), H.length > 41 &&
|
|
181
|
+
}), H.length > 41 && b.push({
|
|
182
182
|
type: "length",
|
|
183
183
|
message: `Sentence is too long (${H.length}/41 characters)`
|
|
184
|
-
}), H && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(H) &&
|
|
184
|
+
}), H && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(H) && b.push({
|
|
185
185
|
type: "characters",
|
|
186
186
|
message: "Only Latin characters, numbers, spaces and punctuation are allowed"
|
|
187
187
|
});
|
|
188
188
|
const S = f.findIndex((C, K) => K !== I && C.toLowerCase().trim() === H.toLowerCase().trim());
|
|
189
|
-
return S !== -1 &&
|
|
189
|
+
return S !== -1 && b.push({
|
|
190
190
|
type: "duplicate",
|
|
191
191
|
message: `Duplicate sentence (same as sentence ${S + 1})`
|
|
192
|
-
}), s(
|
|
193
|
-
isValid:
|
|
194
|
-
errors:
|
|
192
|
+
}), s(b), {
|
|
193
|
+
isValid: b.length === 0,
|
|
194
|
+
errors: b
|
|
195
195
|
};
|
|
196
196
|
}, []), se = ge((H) => {
|
|
197
197
|
const I = [];
|
|
198
|
-
return H.forEach((f,
|
|
199
|
-
const
|
|
200
|
-
I.push(...
|
|
198
|
+
return H.forEach((f, b) => {
|
|
199
|
+
const y = W(f, b, H);
|
|
200
|
+
I.push(...y.errors.map((S) => ({
|
|
201
201
|
...S,
|
|
202
|
-
message: `Sentence ${
|
|
202
|
+
message: `Sentence ${b + 1}: ${S.message}`
|
|
203
203
|
})));
|
|
204
204
|
}), {
|
|
205
205
|
isValid: I.length === 0,
|
|
@@ -216,7 +216,7 @@ const Te = {
|
|
|
216
216
|
};
|
|
217
217
|
}, cn = (u, s, W) => s && W ? `${u} word "${s}" ${W}` : s ? `${u} word "${s}"` : u, hn = (u, s, W = ["Enter", " "]) => {
|
|
218
218
|
W.includes(u.key) && (u.preventDefault(), s());
|
|
219
|
-
},
|
|
219
|
+
}, L = (u) => {
|
|
220
220
|
const s = document.createElement("div");
|
|
221
221
|
s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.left = "-10000px", s.style.width = "1px", s.style.height = "1px", s.style.overflow = "hidden", document.body.appendChild(s), s.textContent = u, setTimeout(() => {
|
|
222
222
|
document.body.removeChild(s);
|
|
@@ -254,7 +254,7 @@ const Te = {
|
|
|
254
254
|
s && s.remove(), document.head.appendChild(u);
|
|
255
255
|
}, gn = (u) => [...u].sort(() => Math.random() - 0.5);
|
|
256
256
|
function yn(u = {}) {
|
|
257
|
-
const { logoUrl: s, showLogo: W = !0 } = u, se = oe(null), { validateAllSentences: de, errors: H } = ln(), I = () => d || window.innerWidth < 768, f = () => d || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932,
|
|
257
|
+
const { logoUrl: s, showLogo: W = !0 } = u, se = oe(null), { validateAllSentences: de, errors: H } = ln(), I = () => d || window.innerWidth < 768, f = () => d || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, b = (e = "medium") => {
|
|
258
258
|
if (!f())
|
|
259
259
|
return {
|
|
260
260
|
padding: "12px 24px",
|
|
@@ -282,15 +282,15 @@ function yn(u = {}) {
|
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
|
|
285
|
+
V(() => (pn(), () => {
|
|
286
286
|
document.documentElement.style.overflow = "", document.body.style.overflow = "";
|
|
287
287
|
const e = document.getElementById("magic-sentence-reset");
|
|
288
288
|
e && e.remove();
|
|
289
289
|
}), []);
|
|
290
|
-
const [
|
|
290
|
+
const [y, S] = c("select"), [C, K] = c(null), [ue, we] = c(null), [T, Z] = c([]), [D, fe] = c(0), [ae, me] = c([]), [k, le] = c([]), [B, xe] = c(20), [U, M] = c(0), [un, ye] = c(null), [A, z] = c(null), [l, _] = c(!1), [be, ce] = c(!1), [he, De] = c(
|
|
291
291
|
Number(localStorage.getItem("magicSentenceBest")) || 0
|
|
292
|
-
),
|
|
293
|
-
|
|
292
|
+
), J = oe(null), Re = oe(null), Se = oe(0), [m, E] = c({ list: null, id: null, side: null }), [d, ze] = c(!1), [Ee, Q] = c(1), [We, ee] = c(null), [Pe, Be] = c(!1), [$, Le] = c(!1), [O, Me] = c(!1), [N, Ae] = c(!1), [G, $e] = c(!1), [X, Oe] = c(!1), [j, Ne] = c(!1), [F, Ge] = c(!1), [q, Xe] = c(!1), [wn, je] = c(!1), [fn, Fe] = c(!1);
|
|
293
|
+
V(() => {
|
|
294
294
|
const e = () => {
|
|
295
295
|
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, r = n < 700, p = t / n > 1.8, w = t === 768 && n === 1024, o = t === 1024 && n === 768, h = t === 820 && n === 1180, R = t === 1180 && n === 820, v = t === 540 && n === 720, re = t === 720 && n === 540, He = t === 1024 && n === 1366, Ie = t === 1366 && n === 1024, Ce = t >= 1200 && n >= 600 && !i;
|
|
296
296
|
Be(Ce), Le(w), Me(o), Ae(h), $e(R), Oe(v), Ne(re), Ge(He), Xe(Ie), Fe(p);
|
|
@@ -312,15 +312,15 @@ function yn(u = {}) {
|
|
|
312
312
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
313
313
|
}, []);
|
|
314
314
|
const ne = (e, t, n, i) => {
|
|
315
|
-
if (
|
|
315
|
+
if (l) return;
|
|
316
316
|
let r = [...ae], p = [...k];
|
|
317
317
|
const w = e === "bank" ? r : p, o = t === "bank" ? r : p, h = w.findIndex((re) => re.id === n);
|
|
318
318
|
if (h === -1) return;
|
|
319
319
|
const [R] = w.splice(h, 1);
|
|
320
320
|
let v = i;
|
|
321
321
|
e === t && v !== null && v !== void 0 && v > h && (v = v - 1), v == null || v < 0 || v > o.length ? o.push(R) : o.splice(v, 0, R), e === "bank" ? r = w : p = w, t === "bank" ? r = o : p = o, me(r), le(p);
|
|
322
|
-
},
|
|
323
|
-
if (e.preventDefault(),
|
|
322
|
+
}, Y = (e, t, n) => {
|
|
323
|
+
if (e.preventDefault(), l) {
|
|
324
324
|
E({ list: null, id: null, side: null });
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
@@ -351,14 +351,14 @@ function yn(u = {}) {
|
|
|
351
351
|
const r = de(i);
|
|
352
352
|
r.isValid || console.warn("Validation errors:", r.errors);
|
|
353
353
|
}, Je = (e) => e.trim().replace(/\s+/g, " "), ke = (e) => e <= 3 ? 20 : e <= 5 ? 18 : e <= 7 ? 16 : e <= 9 ? 14 : 12, Ye = () => {
|
|
354
|
-
T.some((t) => t.trim().length === 0) || (Z((t) => t.map((n) => Je(n))),
|
|
354
|
+
T.some((t) => t.trim().length === 0) || (Z((t) => t.map((n) => Je(n))), M(0), fe(0), Se.current = 0, ye(null), S("getready"));
|
|
355
355
|
};
|
|
356
|
-
|
|
357
|
-
if (
|
|
356
|
+
V(() => {
|
|
357
|
+
if (y === "getready") {
|
|
358
358
|
const e = setTimeout(() => te(0), 3e3);
|
|
359
359
|
return () => clearTimeout(e);
|
|
360
360
|
}
|
|
361
|
-
}, [
|
|
361
|
+
}, [y]);
|
|
362
362
|
const te = (e) => {
|
|
363
363
|
const t = T[e];
|
|
364
364
|
if (!t) return;
|
|
@@ -370,27 +370,22 @@ function yn(u = {}) {
|
|
|
370
370
|
}));
|
|
371
371
|
me(i), le([]), fe(e), Se.current = e, xe(ue || 20), z(null), _(!1), ce(!1), S("play");
|
|
372
372
|
};
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
z(null);
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
const t = e.trim().split(/\s+/), n = k.map((o) => o.text), i = t.filter((o) => !n.includes(o)).length, r = n.filter((o) => !t.includes(o)).length, p = t.filter((o, h) => n.includes(o) ? n[h] !== o : !1).length, w = i + r + p;
|
|
385
|
-
w === 0 ? (z("correct"), be || (ce(!0), L((o) => o + 1)), P("correct"), B("Correct! Well done!")) : w === 1 ? (z("almost"), L((o) => o + 0.5), P("half"), B("Almost correct! Just one mistake.")) : (z("wrong"), P("wrong"), B("Not quite right. Keep trying!"));
|
|
373
|
+
V(() => (y === "play" && !l && (J.current !== null && window.clearTimeout(J.current), B > 0 ? J.current = window.setTimeout(() => xe((e) => e - 1), 1e3) : _(!0)), () => {
|
|
374
|
+
J.current !== null && window.clearTimeout(J.current);
|
|
375
|
+
}), [y, B, l]), V(() => {
|
|
376
|
+
if (y === "play" && l && B === 0) {
|
|
377
|
+
const e = T[D];
|
|
378
|
+
if (!e) {
|
|
379
|
+
z(null);
|
|
380
|
+
return;
|
|
386
381
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
}, [
|
|
382
|
+
const t = e.trim().split(/\s+/), n = k.map((o) => o.text), i = t.filter((o) => !n.includes(o)).length, r = n.filter((o) => !t.includes(o)).length, p = t.filter((o, h) => n.includes(o) ? n[h] !== o : !1).length, w = i + r + p;
|
|
383
|
+
w === 0 ? (z("correct"), be || (ce(!0), M((o) => o + 1)), P("correct"), L("Correct! Well done!")) : w === 1 ? (z("almost"), M((o) => o + 0.5), P("half"), L("Almost correct! Just one mistake.")) : (z("wrong"), P("wrong"), L("Not quite right. Keep trying!"));
|
|
384
|
+
}
|
|
385
|
+
}, [y, l, B, T, D, k, be]);
|
|
391
386
|
const Ke = (e = !0) => {
|
|
392
387
|
if (e) {
|
|
393
|
-
if (
|
|
388
|
+
if (l) {
|
|
394
389
|
D + 1 < (C || 0) ? te(D + 1) : (S("results"), setTimeout(() => ie(), 600));
|
|
395
390
|
return;
|
|
396
391
|
}
|
|
@@ -400,14 +395,14 @@ function yn(u = {}) {
|
|
|
400
395
|
return;
|
|
401
396
|
}
|
|
402
397
|
const n = t.trim().split(/\s+/), i = k.map((h) => h.text), r = n.filter((h) => !i.includes(h)).length, p = i.filter((h) => !n.includes(h)).length, w = n.filter((h, R) => i.includes(h) ? i[R] !== h : !1).length, o = r + p + w;
|
|
403
|
-
o === 0 ? (
|
|
398
|
+
o === 0 ? (M((h) => h + 1), z("correct"), ce(!0), P("correct"), L("Correct! Well done!")) : o === 1 ? (M((h) => h + 0.5), z("almost"), P("half"), L("Almost correct! Just one mistake.")) : (z("wrong"), P("wrong"), L("Not quite right. Keep trying!")), D + 1 < (C || 0) ? setTimeout(() => te(D + 1), 800) : setTimeout(() => {
|
|
404
399
|
S("results"), setTimeout(() => ie(), 600);
|
|
405
400
|
}, 800);
|
|
406
401
|
}
|
|
407
402
|
};
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}, [
|
|
403
|
+
V(() => {
|
|
404
|
+
y === "results" && U > he && (De(U), localStorage.setItem("magicSentenceBest", String(U)));
|
|
405
|
+
}, [y, U, he]);
|
|
411
406
|
const P = (e) => {
|
|
412
407
|
const t = new (window.AudioContext || window.webkitAudioContext)(), n = t.createOscillator(), i = t.createGain();
|
|
413
408
|
switch (n.connect(i), i.connect(t.destination), e) {
|
|
@@ -457,7 +452,7 @@ function yn(u = {}) {
|
|
|
457
452
|
onClick: () => qe(e),
|
|
458
453
|
style: {
|
|
459
454
|
...g.gmButton,
|
|
460
|
-
...
|
|
455
|
+
...b("medium")
|
|
461
456
|
},
|
|
462
457
|
children: [
|
|
463
458
|
e,
|
|
@@ -479,7 +474,7 @@ function yn(u = {}) {
|
|
|
479
474
|
onClick: () => Ve(e),
|
|
480
475
|
style: {
|
|
481
476
|
...g.gmButton,
|
|
482
|
-
...
|
|
477
|
+
...b("medium")
|
|
483
478
|
},
|
|
484
479
|
children: [
|
|
485
480
|
e,
|
|
@@ -535,7 +530,7 @@ function yn(u = {}) {
|
|
|
535
530
|
marginTop: 30,
|
|
536
531
|
background: T.some((e) => e.trim().length === 0) ? "#ccc" : "#ec4c44",
|
|
537
532
|
cursor: T.some((e) => e.trim().length === 0) ? "not-allowed" : "pointer",
|
|
538
|
-
...
|
|
533
|
+
...b("large")
|
|
539
534
|
},
|
|
540
535
|
children: "PLAY"
|
|
541
536
|
}
|
|
@@ -556,7 +551,7 @@ function yn(u = {}) {
|
|
|
556
551
|
"/",
|
|
557
552
|
C,
|
|
558
553
|
" — ",
|
|
559
|
-
|
|
554
|
+
l ? "TIME'S UP!" : `Time: ${B}s`
|
|
560
555
|
] }),
|
|
561
556
|
/* @__PURE__ */ a(
|
|
562
557
|
"div",
|
|
@@ -574,8 +569,8 @@ function yn(u = {}) {
|
|
|
574
569
|
{
|
|
575
570
|
style: {
|
|
576
571
|
height: "100%",
|
|
577
|
-
width: `${
|
|
578
|
-
background:
|
|
572
|
+
width: `${B / (ue || 20) * 100}%`,
|
|
573
|
+
background: B <= 5 ? "#ec4c44" : "#4caf50",
|
|
579
574
|
transition: "width 1s linear"
|
|
580
575
|
}
|
|
581
576
|
}
|
|
@@ -586,7 +581,7 @@ function yn(u = {}) {
|
|
|
586
581
|
"div",
|
|
587
582
|
{
|
|
588
583
|
onDragOver: (e) => e.preventDefault(),
|
|
589
|
-
onDrop: (e) =>
|
|
584
|
+
onDrop: (e) => Y(e, "bank", null),
|
|
590
585
|
style: {
|
|
591
586
|
display: "flex",
|
|
592
587
|
flexWrap: I() ? "wrap" : "nowrap",
|
|
@@ -600,49 +595,49 @@ function yn(u = {}) {
|
|
|
600
595
|
children: ae.map((e, t) => /* @__PURE__ */ a(
|
|
601
596
|
"div",
|
|
602
597
|
{
|
|
603
|
-
draggable: !
|
|
598
|
+
draggable: !l,
|
|
604
599
|
role: "button",
|
|
605
|
-
tabIndex:
|
|
606
|
-
"aria-label":
|
|
600
|
+
tabIndex: l ? -1 : 0,
|
|
601
|
+
"aria-label": l ? `Word: ${e.text} (time expired)` : cn("Drag word", e.text, "to build sentence"),
|
|
607
602
|
onDragStart: (n) => {
|
|
608
|
-
if (
|
|
603
|
+
if (l) {
|
|
609
604
|
n.preventDefault();
|
|
610
605
|
return;
|
|
611
606
|
}
|
|
612
607
|
n.dataTransfer.setData(
|
|
613
608
|
"application/x-token",
|
|
614
609
|
JSON.stringify({ from: "bank", id: e.id })
|
|
615
|
-
), n.dataTransfer.setData("text/plain", e.id),
|
|
610
|
+
), n.dataTransfer.setData("text/plain", e.id), L(`Dragging word: ${e.text}`);
|
|
616
611
|
},
|
|
617
612
|
onKeyDown: (n) => {
|
|
618
|
-
|
|
613
|
+
l || hn(n, () => ne("bank", "selected", e.id, null));
|
|
619
614
|
},
|
|
620
615
|
onDragOver: (n) => n.preventDefault(),
|
|
621
616
|
onDrop: (n) => {
|
|
622
617
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, p = n.clientX > r ? t + 1 : t;
|
|
623
|
-
E({ list: null, id: null, side: null }), n.stopPropagation(),
|
|
618
|
+
E({ list: null, id: null, side: null }), n.stopPropagation(), Y(n, "bank", p);
|
|
624
619
|
},
|
|
625
620
|
onDragEnter: (n) => {
|
|
626
|
-
if (
|
|
621
|
+
if (l) return;
|
|
627
622
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
628
623
|
E({ list: "bank", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
629
624
|
},
|
|
630
625
|
onDragLeave: () => E({ list: null, id: null, side: null }),
|
|
631
626
|
onClick: () => {
|
|
632
|
-
|
|
627
|
+
l || ne("bank", "selected", e.id, null);
|
|
633
628
|
},
|
|
634
629
|
style: {
|
|
635
630
|
padding: d || window.innerWidth < 768 ? "6px 10px" : "10px 16px",
|
|
636
631
|
borderRadius: d || window.innerWidth < 768 ? "6px" : "10px",
|
|
637
632
|
border: "1px solid #ccc",
|
|
638
|
-
background:
|
|
639
|
-
cursor:
|
|
633
|
+
background: l ? "#f0f0f0" : "#f9f9f9",
|
|
634
|
+
cursor: l ? "not-allowed" : m.list === "bank" && m.id === e.id ? "grabbing" : "grab",
|
|
640
635
|
fontSize: d || window.innerWidth < 768 ? "12px" : "18px",
|
|
641
636
|
...m.list === "bank" && m.id === e.id && m.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
642
637
|
...m.list === "bank" && m.id === e.id && m.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
643
638
|
flexShrink: 0,
|
|
644
639
|
flexBasis: "auto",
|
|
645
|
-
opacity:
|
|
640
|
+
opacity: l ? 0.6 : 1,
|
|
646
641
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
647
642
|
...m.list === "bank" && m.id === e.id ? {
|
|
648
643
|
transform: "scale(1.05)",
|
|
@@ -662,14 +657,14 @@ function yn(u = {}) {
|
|
|
662
657
|
onDrop: (e) => {
|
|
663
658
|
const t = e.currentTarget.getBoundingClientRect(), n = Array.from(e.currentTarget.children);
|
|
664
659
|
if (n.length === 0) {
|
|
665
|
-
|
|
660
|
+
Y(e, "selected", 0);
|
|
666
661
|
return;
|
|
667
662
|
}
|
|
668
663
|
let i = k.length, r = 1 / 0;
|
|
669
664
|
n.forEach((p, w) => {
|
|
670
665
|
const o = p.getBoundingClientRect(), h = o.left + o.width / 2, R = Math.abs(e.clientX - h);
|
|
671
666
|
R < r && (r = R, i = e.clientX < h ? w : w + 1);
|
|
672
|
-
}), e.clientX > t.right - 30 && (i = k.length), e.clientX < t.left + 30 && (i = 0),
|
|
667
|
+
}), e.clientX > t.right - 30 && (i = k.length), e.clientX < t.left + 30 && (i = 0), Y(e, "selected", i);
|
|
673
668
|
},
|
|
674
669
|
style: {
|
|
675
670
|
minHeight: d || window.innerWidth < 768 ? "50px" : "70px",
|
|
@@ -679,7 +674,7 @@ function yn(u = {}) {
|
|
|
679
674
|
// Убираем ограничение максимальной ширины
|
|
680
675
|
minWidth: "245px",
|
|
681
676
|
// Минимальная ширина для растягивания
|
|
682
|
-
border:
|
|
677
|
+
border: A === "correct" ? "2px dashed #4caf50" : A === "almost" ? "2px dashed #ff9800" : A === "wrong" ? "2px dashed #f44336" : "2px dashed #ccc",
|
|
683
678
|
borderRadius: d || window.innerWidth < 768 ? "8px" : "12px",
|
|
684
679
|
padding: d || window.innerWidth < 768 ? "8px" : "12px",
|
|
685
680
|
display: "flex",
|
|
@@ -687,16 +682,16 @@ function yn(u = {}) {
|
|
|
687
682
|
alignItems: "center",
|
|
688
683
|
justifyContent: "center",
|
|
689
684
|
fontSize: `${ke(k.length)}px`,
|
|
690
|
-
background:
|
|
685
|
+
background: A === "correct" ? "#e8f5e8" : A === "almost" ? "#fff3e0" : A === "wrong" ? "#ffebee" : "#fafafa",
|
|
691
686
|
overflowX: I() ? "hidden" : "auto",
|
|
692
687
|
whiteSpace: I() ? "normal" : "nowrap"
|
|
693
688
|
},
|
|
694
689
|
children: k.map((e, t) => /* @__PURE__ */ a(
|
|
695
690
|
"span",
|
|
696
691
|
{
|
|
697
|
-
draggable: !
|
|
692
|
+
draggable: !l,
|
|
698
693
|
onDragStart: (n) => {
|
|
699
|
-
if (
|
|
694
|
+
if (l) {
|
|
700
695
|
n.preventDefault();
|
|
701
696
|
return;
|
|
702
697
|
}
|
|
@@ -708,27 +703,27 @@ function yn(u = {}) {
|
|
|
708
703
|
onDragOver: (n) => n.preventDefault(),
|
|
709
704
|
onDrop: (n) => {
|
|
710
705
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, p = i.width * 0.25, w = n.clientX < r - p ? t : n.clientX > r + p || n.clientX > r ? t + 1 : t;
|
|
711
|
-
E({ list: null, id: null, side: null }), n.stopPropagation(),
|
|
706
|
+
E({ list: null, id: null, side: null }), n.stopPropagation(), Y(n, "selected", w);
|
|
712
707
|
},
|
|
713
708
|
onDragEnter: (n) => {
|
|
714
|
-
if (
|
|
709
|
+
if (l) return;
|
|
715
710
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
716
711
|
E({ list: "selected", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
717
712
|
},
|
|
718
713
|
onDragLeave: () => E({ list: null, id: null, side: null }),
|
|
719
714
|
onClick: () => {
|
|
720
|
-
|
|
715
|
+
l || ne("selected", "bank", e.id, null);
|
|
721
716
|
},
|
|
722
|
-
title:
|
|
717
|
+
title: l ? "Time expired" : "Click to remove back to bank",
|
|
723
718
|
style: {
|
|
724
719
|
padding: f() ? "4px 6px" : "6px 10px",
|
|
725
720
|
margin: f() ? "2px" : "4px",
|
|
726
721
|
borderRadius: f() ? "4px" : "8px",
|
|
727
|
-
background:
|
|
728
|
-
border:
|
|
722
|
+
background: l ? "#f0f0f0" : "#ffe9e7",
|
|
723
|
+
border: l ? "1px solid #ccc" : "1px solid #ec4c44",
|
|
729
724
|
...m.list === "selected" && m.id === e.id && m.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
730
725
|
...m.list === "selected" && m.id === e.id && m.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
731
|
-
cursor:
|
|
726
|
+
cursor: l ? "not-allowed" : m.list === "selected" && m.id === e.id ? "grabbing" : "grab",
|
|
732
727
|
userSelect: "none",
|
|
733
728
|
fontSize: `${ke(k.length)}px`,
|
|
734
729
|
// Адаптивный размер шрифта для слов
|
|
@@ -736,7 +731,7 @@ function yn(u = {}) {
|
|
|
736
731
|
// Более плотный шрифт
|
|
737
732
|
whiteSpace: "nowrap",
|
|
738
733
|
// Запрещаем перенос слов
|
|
739
|
-
opacity:
|
|
734
|
+
opacity: l ? 0.6 : 1,
|
|
740
735
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
741
736
|
...m.list === "selected" && m.id === e.id ? {
|
|
742
737
|
transform: "scale(1.05)",
|
|
@@ -753,16 +748,16 @@ function yn(u = {}) {
|
|
|
753
748
|
"button",
|
|
754
749
|
{
|
|
755
750
|
onClick: () => Ke(!0),
|
|
756
|
-
disabled: !
|
|
751
|
+
disabled: !l && k.length === 0,
|
|
757
752
|
style: {
|
|
758
753
|
marginTop: f() ? "15px" : "30px",
|
|
759
754
|
fontSize: f() ? "14px" : "20px",
|
|
760
755
|
padding: f() ? "6px 12px" : "10px 24px",
|
|
761
756
|
borderRadius: f() ? "8px" : "12px",
|
|
762
|
-
background:
|
|
757
|
+
background: l || k.length > 0 ? "#ec4c44" : "#ccc",
|
|
763
758
|
color: "white",
|
|
764
759
|
border: "none",
|
|
765
|
-
cursor:
|
|
760
|
+
cursor: l || k.length > 0 ? "pointer" : "not-allowed"
|
|
766
761
|
},
|
|
767
762
|
children: "NEXT"
|
|
768
763
|
}
|
|
@@ -770,26 +765,26 @@ function yn(u = {}) {
|
|
|
770
765
|
] }), tn = () => /* @__PURE__ */ x("div", { style: g.gmCenterScreen, children: [
|
|
771
766
|
/* @__PURE__ */ a("h1", { style: {
|
|
772
767
|
...g.gmHeadline1,
|
|
773
|
-
marginTop: (d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
774
|
-
marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
768
|
+
marginTop: (d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q, "0px"),
|
|
769
|
+
marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "10px",
|
|
775
770
|
fontSize: d && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "32px" : "clamp(28px, 4vw, 40px)"
|
|
776
771
|
}, children: "Game Over 🎯" }),
|
|
777
772
|
/* @__PURE__ */ x("h2", { style: {
|
|
778
773
|
...g.gmHeadline2,
|
|
779
|
-
marginTop: (d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
780
|
-
marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
774
|
+
marginTop: (d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q, "0px"),
|
|
775
|
+
marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "16px",
|
|
781
776
|
fontSize: d && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "18px" : "24px"
|
|
782
777
|
}, children: [
|
|
783
778
|
"Your score: ",
|
|
784
|
-
|
|
779
|
+
U,
|
|
785
780
|
" out of ",
|
|
786
781
|
C
|
|
787
782
|
] }),
|
|
788
783
|
/* @__PURE__ */ x("p", { style: {
|
|
789
784
|
...g.gmBodyM,
|
|
790
785
|
color: "#10b981",
|
|
791
|
-
marginTop: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
792
|
-
marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
786
|
+
marginTop: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "0px" : "12px",
|
|
787
|
+
marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "16px",
|
|
793
788
|
fontSize: d && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "14px" : "16px"
|
|
794
789
|
}, children: [
|
|
795
790
|
"Best score: ",
|
|
@@ -810,7 +805,7 @@ function yn(u = {}) {
|
|
|
810
805
|
},
|
|
811
806
|
style: {
|
|
812
807
|
...g.gmButton,
|
|
813
|
-
...
|
|
808
|
+
...b("medium")
|
|
814
809
|
},
|
|
815
810
|
children: "🔁 Play again"
|
|
816
811
|
}
|
|
@@ -819,11 +814,11 @@ function yn(u = {}) {
|
|
|
819
814
|
"button",
|
|
820
815
|
{
|
|
821
816
|
onClick: () => {
|
|
822
|
-
P("click"), S("select"), K(null), we(null), Z([]),
|
|
817
|
+
P("click"), S("select"), K(null), we(null), Z([]), M(0), le([]), _(!1);
|
|
823
818
|
},
|
|
824
819
|
style: {
|
|
825
820
|
...g.gmButton,
|
|
826
|
-
...
|
|
821
|
+
...b("medium")
|
|
827
822
|
},
|
|
828
823
|
children: "⬅️ Exit"
|
|
829
824
|
}
|
|
@@ -909,12 +904,12 @@ function yn(u = {}) {
|
|
|
909
904
|
},
|
|
910
905
|
children: /* @__PURE__ */ x("div", { id: "magic-sentence-root", children: [
|
|
911
906
|
rn,
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
907
|
+
y === "select" ? Ze() : null,
|
|
908
|
+
y === "time" ? _e() : null,
|
|
909
|
+
y === "type" ? Qe() : null,
|
|
910
|
+
y === "getready" ? en() : null,
|
|
911
|
+
y === "play" ? nn() : null,
|
|
912
|
+
y === "results" ? tn() : null
|
|
918
913
|
] })
|
|
919
914
|
}
|
|
920
915
|
)
|
|
@@ -996,7 +991,7 @@ class bn extends dn {
|
|
|
996
991
|
export {
|
|
997
992
|
bn as ErrorBoundary,
|
|
998
993
|
yn as Game,
|
|
999
|
-
|
|
994
|
+
L as announceToScreenReader,
|
|
1000
995
|
cn as createAriaLabel,
|
|
1001
996
|
yn as default,
|
|
1002
997
|
hn as handleKeyDown,
|