speakid-build-a-sentence 1.0.19 → 1.0.20
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/Game.d.ts.map +1 -1
- package/dist/Game.styles.d.ts.map +1 -1
- package/dist/speakid-build-a-sentence.cjs.js +10 -10
- package/dist/speakid-build-a-sentence.cjs.js.map +1 -1
- package/dist/speakid-build-a-sentence.es.js +421 -392
- package/dist/speakid-build-a-sentence.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
@keyframes
|
|
1
|
+
import { jsx as l, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useCallback as we, useRef as Z, useEffect as J, Component as sn } from "react";
|
|
3
|
+
const dn = `
|
|
4
|
+
@keyframes spin {
|
|
5
5
|
from { transform: rotate(0deg); }
|
|
6
6
|
to { transform: rotate(360deg); }
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
@keyframes
|
|
9
|
+
@keyframes pulse {
|
|
10
10
|
0%, 100% { transform: scale(1); }
|
|
11
11
|
50% { transform: scale(1.05); }
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
@keyframes
|
|
14
|
+
@keyframes shake {
|
|
15
15
|
0%, 100% { transform: translateX(0); }
|
|
16
16
|
25% { transform: translateX(-5px); }
|
|
17
17
|
75% { transform: translateX(5px); }
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
@keyframes
|
|
20
|
+
@keyframes slideIn {
|
|
21
21
|
from { transform: translateY(-20px); opacity: 0; }
|
|
22
22
|
to { transform: translateY(0); opacity: 1; }
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
@keyframes
|
|
25
|
+
@keyframes bounce {
|
|
26
26
|
0%, 20%, 53%, 80%, 100% { transform: translate3d(0,0,0); }
|
|
27
27
|
40%, 43% { transform: translate3d(0, -8px, 0); }
|
|
28
28
|
70% { transform: translate3d(0, -4px, 0); }
|
|
29
29
|
90% { transform: translate3d(0, -2px, 0); }
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
@keyframes
|
|
32
|
+
@keyframes glow {
|
|
33
33
|
0%, 100% { box-shadow: 0 0 5px rgba(76, 175, 80, 0.5); }
|
|
34
34
|
50% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.8), 0 0 30px rgba(76, 175, 80, 0.6); }
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
|
-
if (typeof document < "u" && !document.getElementById("
|
|
38
|
-
const
|
|
39
|
-
|
|
37
|
+
if (typeof document < "u" && !document.getElementById("game-keyframes")) {
|
|
38
|
+
const w = document.createElement("style");
|
|
39
|
+
w.id = "game-keyframes", w.innerHTML = dn, document.head.appendChild(w);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const Te = {
|
|
42
42
|
spin: {
|
|
43
|
-
animation: "
|
|
43
|
+
animation: "spin 1.4s linear infinite"
|
|
44
44
|
},
|
|
45
45
|
pulse: {
|
|
46
|
-
animation: "
|
|
46
|
+
animation: "pulse 0.6s ease-in-out"
|
|
47
47
|
},
|
|
48
48
|
shake: {
|
|
49
|
-
animation: "
|
|
49
|
+
animation: "shake 0.4s ease-in-out"
|
|
50
50
|
},
|
|
51
51
|
slideIn: {
|
|
52
|
-
animation: "
|
|
52
|
+
animation: "slideIn 0.3s ease-out"
|
|
53
53
|
},
|
|
54
54
|
bounce: {
|
|
55
|
-
animation: "
|
|
55
|
+
animation: "bounce 0.6s ease-in-out"
|
|
56
56
|
},
|
|
57
57
|
glow: {
|
|
58
|
-
animation: "
|
|
58
|
+
animation: "glow 1s ease-in-out infinite"
|
|
59
59
|
}
|
|
60
|
-
},
|
|
60
|
+
}, g = {
|
|
61
61
|
gmCenterScreen: {
|
|
62
62
|
position: "relative",
|
|
63
63
|
zIndex: 1,
|
|
@@ -134,20 +134,20 @@ const Se = {
|
|
|
134
134
|
fontFamily: '"Geist", system-ui',
|
|
135
135
|
width: "160px"
|
|
136
136
|
},
|
|
137
|
-
// ✅ Обновлено
|
|
137
|
+
// ✅ Обновлено только для качества логотипа (размер как в whats-missing)
|
|
138
138
|
gmLogoFixed: {
|
|
139
139
|
position: "absolute",
|
|
140
140
|
top: "16px",
|
|
141
141
|
left: "16px",
|
|
142
|
-
width: "
|
|
143
|
-
zIndex:
|
|
142
|
+
width: "auto",
|
|
143
|
+
zIndex: 10,
|
|
144
144
|
pointerEvents: "none",
|
|
145
145
|
background: "transparent",
|
|
146
146
|
transform: "none",
|
|
147
147
|
willChange: "auto"
|
|
148
148
|
},
|
|
149
149
|
gmLogoImg: {
|
|
150
|
-
height: "
|
|
150
|
+
height: "28px",
|
|
151
151
|
width: "auto",
|
|
152
152
|
background: "transparent",
|
|
153
153
|
objectFit: "contain",
|
|
@@ -157,19 +157,6 @@ const Se = {
|
|
|
157
157
|
WebkitFontSmoothing: "antialiased",
|
|
158
158
|
display: "block"
|
|
159
159
|
},
|
|
160
|
-
gmLogoFallback: {
|
|
161
|
-
height: "clamp(28px, 5vw, 40px)",
|
|
162
|
-
width: "auto",
|
|
163
|
-
background: "transparent",
|
|
164
|
-
backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMTAwIDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8dGV4dCB4PSI1MCIgeT0iMjUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyMCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiNlYzRjNDQiIHRleHQtYW5jaG9yPSJtaWRkbGUiPlNQRUFLSUQ8L3RleHQ+Cjwvc3ZnPgo=')",
|
|
165
|
-
backgroundSize: "contain",
|
|
166
|
-
backgroundRepeat: "no-repeat",
|
|
167
|
-
backgroundPosition: "center",
|
|
168
|
-
transform: "translateZ(0)",
|
|
169
|
-
backfaceVisibility: "hidden",
|
|
170
|
-
WebkitFontSmoothing: "antialiased",
|
|
171
|
-
display: "block"
|
|
172
|
-
},
|
|
173
160
|
gmReadyWrapper: {
|
|
174
161
|
display: "flex",
|
|
175
162
|
flexDirection: "column",
|
|
@@ -181,64 +168,62 @@ const Se = {
|
|
|
181
168
|
},
|
|
182
169
|
gmHourglass: {
|
|
183
170
|
fontSize: "42px",
|
|
184
|
-
...
|
|
171
|
+
...Te.spin
|
|
185
172
|
},
|
|
186
173
|
// ===== Анимационные стили =====
|
|
187
|
-
...
|
|
188
|
-
},
|
|
189
|
-
const [
|
|
190
|
-
const
|
|
191
|
-
|
|
174
|
+
...Te
|
|
175
|
+
}, an = () => {
|
|
176
|
+
const [w, s] = p([]), v = we((D, R, f) => {
|
|
177
|
+
const b = [];
|
|
178
|
+
D.trim() || b.push({
|
|
192
179
|
type: "empty",
|
|
193
180
|
message: "Sentence cannot be empty"
|
|
194
|
-
}),
|
|
181
|
+
}), D.length > 41 && b.push({
|
|
195
182
|
type: "length",
|
|
196
|
-
message: `Sentence is too long (${
|
|
197
|
-
}),
|
|
183
|
+
message: `Sentence is too long (${D.length}/41 characters)`
|
|
184
|
+
}), D && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(D) && b.push({
|
|
198
185
|
type: "characters",
|
|
199
186
|
message: "Only Latin characters, numbers, spaces and punctuation are allowed"
|
|
200
187
|
});
|
|
201
|
-
const
|
|
202
|
-
return
|
|
188
|
+
const k = f.findIndex((z, _) => _ !== R && z.toLowerCase().trim() === D.toLowerCase().trim());
|
|
189
|
+
return k !== -1 && b.push({
|
|
203
190
|
type: "duplicate",
|
|
204
|
-
message: `Duplicate sentence (same as sentence ${
|
|
205
|
-
}),
|
|
206
|
-
isValid:
|
|
207
|
-
errors:
|
|
191
|
+
message: `Duplicate sentence (same as sentence ${k + 1})`
|
|
192
|
+
}), s(b), {
|
|
193
|
+
isValid: b.length === 0,
|
|
194
|
+
errors: b
|
|
208
195
|
};
|
|
209
|
-
}, []),
|
|
210
|
-
const
|
|
211
|
-
return
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
...
|
|
215
|
-
message: `Sentence ${
|
|
196
|
+
}, []), de = we((D) => {
|
|
197
|
+
const R = [];
|
|
198
|
+
return D.forEach((f, b) => {
|
|
199
|
+
const x = v(f, b, D);
|
|
200
|
+
R.push(...x.errors.map((k) => ({
|
|
201
|
+
...k,
|
|
202
|
+
message: `Sentence ${b + 1}: ${k.message}`
|
|
216
203
|
})));
|
|
217
204
|
}), {
|
|
218
|
-
isValid:
|
|
219
|
-
errors:
|
|
205
|
+
isValid: R.length === 0,
|
|
206
|
+
errors: R
|
|
220
207
|
};
|
|
221
|
-
}, [
|
|
222
|
-
|
|
208
|
+
}, [v]), ae = we(() => {
|
|
209
|
+
s([]);
|
|
223
210
|
}, []);
|
|
224
211
|
return {
|
|
225
|
-
errors:
|
|
226
|
-
validateSentence:
|
|
227
|
-
validateAllSentences:
|
|
228
|
-
clearErrors:
|
|
212
|
+
errors: w,
|
|
213
|
+
validateSentence: v,
|
|
214
|
+
validateAllSentences: de,
|
|
215
|
+
clearErrors: ae
|
|
229
216
|
};
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
},
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
document.body.removeChild(
|
|
217
|
+
}, ln = (w, s, v) => s && v ? `${w} word "${s}" ${v}` : s ? `${w} word "${s}"` : w, cn = (w, s, v = ["Enter", " "]) => {
|
|
218
|
+
v.includes(w.key) && (w.preventDefault(), s());
|
|
219
|
+
}, L = (w) => {
|
|
220
|
+
const s = document.createElement("div");
|
|
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 = w, setTimeout(() => {
|
|
222
|
+
document.body.removeChild(s);
|
|
236
223
|
}, 1e3);
|
|
237
|
-
},
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const r = document.getElementById("magic-sentence-reset");
|
|
241
|
-
r && r.remove(), g.textContent = `
|
|
224
|
+
}, hn = () => {
|
|
225
|
+
const w = document.createElement("style");
|
|
226
|
+
w.id = "magic-sentence-reset", w.textContent = `
|
|
242
227
|
#magic-sentence-root, #magic-sentence-root * {
|
|
243
228
|
box-sizing: border-box;
|
|
244
229
|
font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
|
@@ -255,7 +240,7 @@ const Se = {
|
|
|
255
240
|
width: 100% !important;
|
|
256
241
|
height: 100% !important;
|
|
257
242
|
overflow: hidden !important;
|
|
258
|
-
zoom: 1 !important;
|
|
243
|
+
zoom: 1 !important; /* ✅ защита от подзума */
|
|
259
244
|
}
|
|
260
245
|
#root {
|
|
261
246
|
margin: 0 !important;
|
|
@@ -264,11 +249,13 @@ const Se = {
|
|
|
264
249
|
height: 100% !important;
|
|
265
250
|
overflow: hidden !important;
|
|
266
251
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
252
|
+
`;
|
|
253
|
+
const s = document.getElementById("magic-sentence-reset");
|
|
254
|
+
s && s.remove(), document.head.appendChild(w);
|
|
255
|
+
}, pn = (w) => [...w].sort(() => Math.random() - 0.5);
|
|
256
|
+
function xn(w = {}) {
|
|
257
|
+
const { logoUrl: s, showLogo: v = !0 } = w, de = Z(null), { validateAllSentences: ae, errors: D } = an(), R = () => c || window.innerWidth < 768, f = () => c || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, b = (e = "medium") => {
|
|
258
|
+
if (!f())
|
|
272
259
|
return {
|
|
273
260
|
padding: "12px 24px",
|
|
274
261
|
fontSize: "16px",
|
|
@@ -295,114 +282,146 @@ function dn(g = {}) {
|
|
|
295
282
|
};
|
|
296
283
|
}
|
|
297
284
|
};
|
|
298
|
-
J(() => (
|
|
285
|
+
J(() => (hn(), () => {
|
|
299
286
|
document.documentElement.style.overflow = "", document.body.style.overflow = "";
|
|
300
287
|
const e = document.getElementById("magic-sentence-reset");
|
|
301
288
|
e && e.remove();
|
|
302
289
|
}), []);
|
|
303
|
-
const [
|
|
290
|
+
const [x, k] = p("select"), [z, _] = p(null), [fe, me] = p(null), [I, Q] = p([]), [E, xe] = p(0), [le, ye] = p([]), [W, ce] = p([]), [$, be] = p(20), [U, M] = p(0), [gn, We] = p(null), [A, C] = p(null), [a, ee] = p(!1), [ne, te] = p(!1), [he, De] = p(
|
|
304
291
|
Number(localStorage.getItem("magicSentenceBest")) || 0
|
|
305
|
-
),
|
|
292
|
+
), Y = Z(null), Re = Z(null), Se = Z(0), [m, B] = p({ list: null, id: null, side: null }), [c, ze] = p(!1), [Ee, ie] = p(1), [ke, re] = p(null), [Pe, Be] = p(!1), [O, Le] = p(!1), [N, Me] = p(!1), [G, Ae] = p(!1), [X, $e] = p(!1), [j, Oe] = p(!1), [F, Ne] = p(!1), [q, Ge] = p(!1), [V, Xe] = p(!1), [un, je] = p(!1), [wn, Fe] = p(!1);
|
|
306
293
|
J(() => {
|
|
307
294
|
const e = () => {
|
|
308
|
-
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
295
|
+
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, r = n < 700, h = t / n > 1.8, u = t === 768 && n === 1024, o = t === 1024 && n === 768, d = t === 820 && n === 1180, T = t === 1180 && n === 820, H = t === 540 && n === 720, se = t === 720 && n === 540, He = t === 1024 && n === 1366, Ie = t === 1366 && n === 1024, Ce = t >= 1200 && n >= 600 && !i;
|
|
296
|
+
Be(Ce), Le(u), Me(o), Ae(d), $e(T), Oe(H), Ne(se), Ge(He), Xe(Ie), Fe(h);
|
|
297
|
+
const on = i && t > n || i || // ✅ ВСЕ мобильные устройства (включая portrait)
|
|
298
|
+
n < 700 || h || // ✅ Широкие экраны
|
|
299
|
+
t === 1366 && n === 766 || t === 1366 && n === 768 || t === 1280 && n === 720 || t === 1440 && n === 900 || u || o || d || T || H || se || He || Ie || Ce;
|
|
300
|
+
if (je(on), ze(i), i)
|
|
301
|
+
re(null), ie(1);
|
|
302
|
+
else if (r)
|
|
303
|
+
re(null), ie(1);
|
|
304
|
+
else if (h) {
|
|
305
|
+
const ue = Math.min(1e3, Math.min(t, n) * 0.9);
|
|
306
|
+
re(ue), ie(0.85);
|
|
307
|
+
} else {
|
|
308
|
+
const ue = Math.min(1e3, Math.min(t, n) * 0.9);
|
|
309
|
+
re(ue), ie(1);
|
|
316
310
|
}
|
|
317
311
|
};
|
|
318
312
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
319
313
|
}, []);
|
|
320
|
-
const
|
|
321
|
-
if (
|
|
322
|
-
let
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
const [
|
|
326
|
-
let
|
|
327
|
-
e === t &&
|
|
328
|
-
},
|
|
329
|
-
if (e.preventDefault(),
|
|
330
|
-
|
|
314
|
+
const oe = (e, t, n, i) => {
|
|
315
|
+
if (a) return;
|
|
316
|
+
let r = [...le], h = [...W];
|
|
317
|
+
const u = e === "bank" ? r : h, o = t === "bank" ? r : h, d = u.findIndex((se) => se.id === n);
|
|
318
|
+
if (d === -1) return;
|
|
319
|
+
const [T] = u.splice(d, 1);
|
|
320
|
+
let H = i;
|
|
321
|
+
e === t && H !== null && H !== void 0 && H > d && (H = H - 1), H == null || H < 0 || H > o.length ? o.push(T) : o.splice(H, 0, T), e === "bank" ? r = u : h = u, t === "bank" ? r = o : h = o, ye(r), ce(h);
|
|
322
|
+
}, K = (e, t, n) => {
|
|
323
|
+
if (e.preventDefault(), a) {
|
|
324
|
+
B({ list: null, id: null, side: null });
|
|
331
325
|
return;
|
|
332
326
|
}
|
|
333
327
|
const i = e.dataTransfer.getData("application/x-token") || (() => {
|
|
334
|
-
const
|
|
335
|
-
if (!
|
|
336
|
-
const
|
|
337
|
-
return
|
|
328
|
+
const r = e.dataTransfer.getData("text/plain");
|
|
329
|
+
if (!r) return "";
|
|
330
|
+
const h = le.some((d) => d.id === r), u = W.some((d) => d.id === r), o = h ? "bank" : u ? "selected" : null;
|
|
331
|
+
return o ? JSON.stringify({ from: o, id: r }) : "";
|
|
338
332
|
})();
|
|
339
333
|
if (i) {
|
|
340
334
|
try {
|
|
341
|
-
const
|
|
342
|
-
if (!
|
|
343
|
-
|
|
335
|
+
const r = JSON.parse(i);
|
|
336
|
+
if (!r || !r.id || !r.from) return;
|
|
337
|
+
oe(r.from, t, r.id, n);
|
|
344
338
|
} catch {
|
|
345
339
|
}
|
|
346
|
-
|
|
340
|
+
B({ list: null, id: null, side: null });
|
|
347
341
|
}
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
},
|
|
342
|
+
}, qe = (e) => {
|
|
343
|
+
_(e), Re.current = e, Q(Array(e).fill("")), k("time");
|
|
344
|
+
}, Ve = (e) => {
|
|
345
|
+
me(e), k("type");
|
|
346
|
+
}, Je = (e, t) => {
|
|
353
347
|
if (t.length > 41 || t && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(t))
|
|
354
348
|
return;
|
|
355
|
-
const i = [...
|
|
356
|
-
i[e] = t,
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
},
|
|
360
|
-
|
|
349
|
+
const i = [...I];
|
|
350
|
+
i[e] = t, Q(i);
|
|
351
|
+
const r = ae(i);
|
|
352
|
+
r.isValid || console.warn("Validation errors:", r.errors);
|
|
353
|
+
}, Ue = (e) => e.trim().replace(/\s+/g, " "), ve = (e) => e <= 3 ? 20 : e <= 5 ? 18 : e <= 7 ? 16 : e <= 9 ? 14 : 12, Ye = () => {
|
|
354
|
+
I.some((t) => t.trim().length === 0) || (Q((t) => t.map((n) => Ue(n))), M(0), xe(0), Se.current = 0, We(null), k("getready"));
|
|
361
355
|
};
|
|
362
356
|
J(() => {
|
|
363
|
-
if (
|
|
364
|
-
const e = setTimeout(() =>
|
|
357
|
+
if (x === "getready") {
|
|
358
|
+
const e = setTimeout(() => pe(0), 3e3);
|
|
365
359
|
return () => clearTimeout(e);
|
|
366
360
|
}
|
|
367
|
-
}, [
|
|
368
|
-
const
|
|
369
|
-
const t =
|
|
361
|
+
}, [x]);
|
|
362
|
+
const pe = (e) => {
|
|
363
|
+
const t = I[e];
|
|
370
364
|
if (!t) return;
|
|
371
|
-
const i =
|
|
365
|
+
const i = pn(
|
|
372
366
|
t.trim().split(/\s+/).filter(Boolean)
|
|
373
|
-
).map((
|
|
374
|
-
id: `${Date.now()}-${e}-${
|
|
375
|
-
text:
|
|
367
|
+
).map((r, h) => ({
|
|
368
|
+
id: `${Date.now()}-${e}-${h}-${Math.random().toString(36).slice(2)}`,
|
|
369
|
+
text: r
|
|
376
370
|
}));
|
|
377
|
-
|
|
378
|
-
};
|
|
371
|
+
ye(i), ce([]), xe(e), Se.current = e, be(fe || 20), C(null), ee(!1), te(!1), k("play");
|
|
372
|
+
}, S = Z(null);
|
|
379
373
|
J(() => {
|
|
380
|
-
if (
|
|
381
|
-
|
|
382
|
-
|
|
374
|
+
if (x !== "play" || a) {
|
|
375
|
+
S.current !== null && (window.clearTimeout(S.current), S.current = null);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const e = I[E];
|
|
379
|
+
if (!e) {
|
|
380
|
+
C(null), S.current !== null && (window.clearTimeout(S.current), S.current = null);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (W.length === 0) {
|
|
384
|
+
C(null), S.current !== null && (window.clearTimeout(S.current), S.current = null);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const t = e.trim().split(/\s+/), n = W.map((r) => r.text);
|
|
388
|
+
if (n.length === t.length && n.every((r, h) => r === t[h]))
|
|
389
|
+
C("correct"), ne || (te(!0), M((r) => r + 1), P("correct"), L("Correct! Well done!"));
|
|
390
|
+
else {
|
|
391
|
+
S.current !== null && (window.clearTimeout(S.current), S.current = null);
|
|
392
|
+
const r = t.filter((d) => !n.includes(d)).length, h = n.filter((d) => !t.includes(d)).length, u = t.filter((d, T) => d !== n[T]).length, o = r + h + u;
|
|
393
|
+
C(o === 1 ? "almost" : "wrong"), ne && (te(!1), M((d) => Math.max(0, d - 1)));
|
|
394
|
+
}
|
|
395
|
+
return () => {
|
|
396
|
+
S.current !== null && (window.clearTimeout(S.current), S.current = null);
|
|
397
|
+
};
|
|
398
|
+
}, [x, W, I, E, a, A, ne, z]), J(() => {
|
|
399
|
+
if (x === "play" && !a)
|
|
400
|
+
if (Y.current !== null && window.clearTimeout(Y.current), $ > 0)
|
|
401
|
+
Y.current = window.setTimeout(() => be((e) => e - 1), 1e3);
|
|
383
402
|
else {
|
|
384
|
-
|
|
385
|
-
const t =
|
|
386
|
-
|
|
403
|
+
ee(!0);
|
|
404
|
+
const t = I[E].trim().split(/\s+/), n = W.map((o) => o.text), i = t.filter((o) => !n.includes(o)).length, r = n.filter((o) => !t.includes(o)).length, h = t.filter((o, d) => o !== n[d]).length, u = i + r + h;
|
|
405
|
+
u === 0 ? (C("correct"), ne || (te(!0), M((o) => o + 1)), P("correct"), L("Correct! Well done!")) : u === 1 ? (C("almost"), P("half"), L("Almost correct! Just one mistake.")) : (C("wrong"), P("wrong"), L("Not quite right. Keep trying!"));
|
|
387
406
|
}
|
|
388
407
|
return () => {
|
|
389
|
-
|
|
408
|
+
Y.current !== null && window.clearTimeout(Y.current);
|
|
390
409
|
};
|
|
391
|
-
}, [
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
394
|
-
|
|
410
|
+
}, [x, $, a, I, E, W]);
|
|
411
|
+
const Ke = (e = !0) => {
|
|
412
|
+
if (a && e) {
|
|
413
|
+
E + 1 < (z || 0) ? pe(E + 1) : (k("results"), setTimeout(() => ge(), 600));
|
|
395
414
|
return;
|
|
396
415
|
}
|
|
397
|
-
if (e && !
|
|
398
|
-
const n =
|
|
399
|
-
|
|
416
|
+
if (e && !a) {
|
|
417
|
+
const n = I[E].trim().split(/\s+/), i = W.map((d) => d.text), r = n.filter((d) => !i.includes(d)).length, h = i.filter((d) => !n.includes(d)).length, u = n.filter((d, T) => d !== i[T]).length, o = r + h + u;
|
|
418
|
+
o === 0 && $ > 0 ? (M((d) => d + 1), C("correct"), P("correct"), L("Correct! Well done!")) : o === 1 ? (M((d) => d + 0.5), C("almost"), P("half"), L("Almost correct! Just one mistake.")) : (C("wrong"), P("wrong"), L("Not quite right. Keep trying!")), E + 1 < (z || 0) ? setTimeout(() => pe(E + 1), 800) : (k("results"), setTimeout(() => ge(), 600));
|
|
400
419
|
}
|
|
401
420
|
};
|
|
402
421
|
J(() => {
|
|
403
|
-
|
|
404
|
-
}, [
|
|
405
|
-
const
|
|
422
|
+
x === "results" && U > he && (De(U), localStorage.setItem("magicSentenceBest", String(U)));
|
|
423
|
+
}, [x, U, he]);
|
|
424
|
+
const P = (e) => {
|
|
406
425
|
const t = new (window.AudioContext || window.webkitAudioContext)(), n = t.createOscillator(), i = t.createGain();
|
|
407
426
|
switch (n.connect(i), i.connect(t.destination), e) {
|
|
408
427
|
case "start":
|
|
@@ -422,36 +441,36 @@ function dn(g = {}) {
|
|
|
422
441
|
break;
|
|
423
442
|
}
|
|
424
443
|
i.gain.setValueAtTime(0.1, t.currentTime), n.start(), n.stop(t.currentTime + 0.2);
|
|
425
|
-
},
|
|
426
|
-
const t = Date.now() + 2500, n = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], i = document.createElement("canvas"),
|
|
444
|
+
}, ge = () => {
|
|
445
|
+
const t = Date.now() + 2500, n = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], i = document.createElement("canvas"), r = i.getContext("2d");
|
|
427
446
|
i.width = window.innerWidth, i.height = window.innerHeight, i.style.position = "fixed", i.style.top = "0", i.style.left = "0", i.style.pointerEvents = "none", document.body.appendChild(i);
|
|
428
|
-
const
|
|
447
|
+
const h = Array.from({ length: 100 }).map(() => ({
|
|
429
448
|
x: Math.random() * i.width,
|
|
430
449
|
y: Math.random() * i.height - i.height,
|
|
431
450
|
size: 6 + Math.random() * 6,
|
|
432
451
|
color: n[Math.floor(Math.random() * n.length)],
|
|
433
452
|
speed: 2 + Math.random() * 4,
|
|
434
453
|
tilt: Math.random() * 2 * Math.PI
|
|
435
|
-
})),
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}), Date.now() < t ? requestAnimationFrame(
|
|
454
|
+
})), u = () => {
|
|
455
|
+
r.clearRect(0, 0, i.width, i.height), h.forEach((o) => {
|
|
456
|
+
r.fillStyle = o.color, r.beginPath(), r.ellipse(o.x, o.y, o.size, o.size / 2, o.tilt, 0, 2 * Math.PI), r.fill(), o.y += o.speed, o.x += Math.sin(o.tilt);
|
|
457
|
+
}), Date.now() < t ? requestAnimationFrame(u) : document.body.removeChild(i);
|
|
439
458
|
};
|
|
440
|
-
|
|
441
|
-
},
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
459
|
+
u();
|
|
460
|
+
}, Ze = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
461
|
+
/* @__PURE__ */ l("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
462
|
+
/* @__PURE__ */ l("p", { style: g.gmBodyM, children: "Select number of rounds" }),
|
|
463
|
+
/* @__PURE__ */ l("div", { style: {
|
|
445
464
|
display: "flex",
|
|
446
|
-
gap:
|
|
465
|
+
gap: f() ? "8px" : "16px",
|
|
447
466
|
justifyContent: "center"
|
|
448
|
-
}, children: [3, 4, 5].map((e) => /* @__PURE__ */
|
|
467
|
+
}, children: [3, 4, 5].map((e) => /* @__PURE__ */ y(
|
|
449
468
|
"button",
|
|
450
469
|
{
|
|
451
|
-
onClick: () =>
|
|
470
|
+
onClick: () => qe(e),
|
|
452
471
|
style: {
|
|
453
|
-
...
|
|
454
|
-
...
|
|
472
|
+
...g.gmButton,
|
|
473
|
+
...b("medium")
|
|
455
474
|
},
|
|
456
475
|
children: [
|
|
457
476
|
e,
|
|
@@ -460,20 +479,20 @@ function dn(g = {}) {
|
|
|
460
479
|
},
|
|
461
480
|
e
|
|
462
481
|
)) })
|
|
463
|
-
] }),
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
-
/* @__PURE__ */
|
|
466
|
-
/* @__PURE__ */
|
|
482
|
+
] }), _e = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
483
|
+
/* @__PURE__ */ l("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
484
|
+
/* @__PURE__ */ l("p", { style: g.gmBodyM, children: "Select time per round" }),
|
|
485
|
+
/* @__PURE__ */ l("div", { style: {
|
|
467
486
|
display: "flex",
|
|
468
|
-
gap:
|
|
487
|
+
gap: f() ? "8px" : "16px",
|
|
469
488
|
justifyContent: "center"
|
|
470
|
-
}, children: [15, 20, 30].map((e) => /* @__PURE__ */
|
|
489
|
+
}, children: [15, 20, 30].map((e) => /* @__PURE__ */ y(
|
|
471
490
|
"button",
|
|
472
491
|
{
|
|
473
|
-
onClick: () =>
|
|
492
|
+
onClick: () => Ve(e),
|
|
474
493
|
style: {
|
|
475
|
-
...
|
|
476
|
-
...
|
|
494
|
+
...g.gmButton,
|
|
495
|
+
...b("medium")
|
|
477
496
|
},
|
|
478
497
|
children: [
|
|
479
498
|
e,
|
|
@@ -482,16 +501,16 @@ function dn(g = {}) {
|
|
|
482
501
|
},
|
|
483
502
|
e
|
|
484
503
|
)) })
|
|
485
|
-
] }),
|
|
486
|
-
/* @__PURE__ */
|
|
504
|
+
] }), Qe = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
505
|
+
/* @__PURE__ */ y("h2", { style: { ...g.gmBodyM, marginBottom: "0px" }, children: [
|
|
487
506
|
"Type down ",
|
|
488
|
-
|
|
507
|
+
z,
|
|
489
508
|
" sentence",
|
|
490
|
-
|
|
509
|
+
z && z > 1 ? "s" : "",
|
|
491
510
|
" for your student"
|
|
492
511
|
] }),
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ l("p", { style: { ...g.gmBodyS, marginBottom: "16px", marginTop: "0px", color: "#6b7280" }, children: "Maximum 41 characters per sentence" }),
|
|
513
|
+
/* @__PURE__ */ l("div", { style: {
|
|
495
514
|
display: "flex",
|
|
496
515
|
flexDirection: "column",
|
|
497
516
|
gap: 12,
|
|
@@ -501,16 +520,16 @@ function dn(g = {}) {
|
|
|
501
520
|
// Минимальная ширина по содержимому
|
|
502
521
|
maxWidth: "600px"
|
|
503
522
|
// Ограничиваем максимальную ширину
|
|
504
|
-
}, children:
|
|
523
|
+
}, children: I.map((e, t) => /* @__PURE__ */ l(
|
|
505
524
|
"input",
|
|
506
525
|
{
|
|
507
526
|
value: e,
|
|
508
527
|
placeholder: `Sentence ${t + 1}`,
|
|
509
|
-
onChange: (n) =>
|
|
528
|
+
onChange: (n) => Je(t, n.target.value),
|
|
510
529
|
style: {
|
|
511
|
-
...
|
|
512
|
-
padding:
|
|
513
|
-
fontSize:
|
|
530
|
+
...g.gmInput,
|
|
531
|
+
padding: f() ? "8px 12px" : "12px 16px",
|
|
532
|
+
fontSize: f() ? "14px" : "16px",
|
|
514
533
|
width: "100%",
|
|
515
534
|
// Поля теперь будут шире благодаря увеличенной ширине контейнера
|
|
516
535
|
textAlign: "center"
|
|
@@ -519,125 +538,129 @@ function dn(g = {}) {
|
|
|
519
538
|
},
|
|
520
539
|
t
|
|
521
540
|
)) }),
|
|
522
|
-
/* @__PURE__ */
|
|
541
|
+
/* @__PURE__ */ l(
|
|
523
542
|
"button",
|
|
524
543
|
{
|
|
525
|
-
onClick:
|
|
526
|
-
disabled:
|
|
544
|
+
onClick: Ye,
|
|
545
|
+
disabled: I.some((e) => e.trim().length === 0),
|
|
527
546
|
style: {
|
|
528
|
-
...
|
|
547
|
+
...g.gmButton,
|
|
529
548
|
marginTop: 30,
|
|
530
|
-
background:
|
|
531
|
-
cursor:
|
|
532
|
-
...
|
|
549
|
+
background: I.some((e) => e.trim().length === 0) ? "#ccc" : "#ec4c44",
|
|
550
|
+
cursor: I.some((e) => e.trim().length === 0) ? "not-allowed" : "pointer",
|
|
551
|
+
...b("large")
|
|
533
552
|
},
|
|
534
553
|
children: "PLAY"
|
|
535
554
|
}
|
|
536
555
|
)
|
|
537
|
-
] }),
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
...
|
|
556
|
+
] }), en = () => /* @__PURE__ */ y("div", { style: g.gmReadyWrapper, children: [
|
|
557
|
+
/* @__PURE__ */ l("h1", { style: {
|
|
558
|
+
...g.gmHeadline1,
|
|
540
559
|
color: "#ec4c44"
|
|
541
560
|
}, children: "GET READY" }),
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
] }),
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
marginBottom:
|
|
546
|
-
fontSize:
|
|
561
|
+
/* @__PURE__ */ l("div", { style: g.gmHourglass, children: "⏳" })
|
|
562
|
+
] }), nn = () => /* @__PURE__ */ y("div", { style: g.gmGameLayout, children: [
|
|
563
|
+
/* @__PURE__ */ y("h2", { style: {
|
|
564
|
+
marginBottom: f() ? "5px" : "10px",
|
|
565
|
+
fontSize: f() ? "16px" : "20px"
|
|
547
566
|
}, children: [
|
|
548
567
|
"Round ",
|
|
549
|
-
|
|
568
|
+
E + 1,
|
|
550
569
|
"/",
|
|
551
|
-
|
|
570
|
+
z,
|
|
552
571
|
" — ",
|
|
553
|
-
|
|
572
|
+
a ? "TIME'S UP!" : `Time: ${$}s`
|
|
554
573
|
] }),
|
|
555
|
-
/* @__PURE__ */
|
|
574
|
+
/* @__PURE__ */ l(
|
|
556
575
|
"div",
|
|
557
576
|
{
|
|
558
577
|
style: {
|
|
559
578
|
width: "60%",
|
|
560
|
-
height:
|
|
579
|
+
height: f() ? "8px" : "14px",
|
|
561
580
|
borderRadius: 8,
|
|
562
581
|
background: "#eee",
|
|
563
582
|
overflow: "hidden",
|
|
564
|
-
marginBottom:
|
|
583
|
+
marginBottom: f() ? "10px" : "20px"
|
|
565
584
|
},
|
|
566
|
-
children: /* @__PURE__ */
|
|
585
|
+
children: /* @__PURE__ */ l(
|
|
567
586
|
"div",
|
|
568
587
|
{
|
|
569
588
|
style: {
|
|
570
589
|
height: "100%",
|
|
571
|
-
width: `${
|
|
572
|
-
background:
|
|
590
|
+
width: `${$ / (fe || 20) * 100}%`,
|
|
591
|
+
background: $ <= 5 ? "#ec4c44" : "#4caf50",
|
|
573
592
|
transition: "width 1s linear"
|
|
574
593
|
}
|
|
575
594
|
}
|
|
576
595
|
)
|
|
577
596
|
}
|
|
578
597
|
),
|
|
579
|
-
/* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ l(
|
|
580
599
|
"div",
|
|
581
600
|
{
|
|
582
601
|
onDragOver: (e) => e.preventDefault(),
|
|
583
|
-
onDrop: (e) =>
|
|
602
|
+
onDrop: (e) => K(e, "bank", null),
|
|
584
603
|
style: {
|
|
585
604
|
display: "flex",
|
|
586
|
-
flexWrap:
|
|
587
|
-
gap:
|
|
605
|
+
flexWrap: R() ? "wrap" : "nowrap",
|
|
606
|
+
gap: c || window.innerWidth < 768 ? "6px" : "10px",
|
|
588
607
|
justifyContent: "center",
|
|
589
|
-
marginBottom:
|
|
590
|
-
padding:
|
|
608
|
+
marginBottom: c || window.innerWidth < 768 ? "15px" : "30px",
|
|
609
|
+
padding: c || window.innerWidth < 768 ? "5px" : "10px",
|
|
591
610
|
width: "100%",
|
|
592
611
|
boxSizing: "border-box"
|
|
593
612
|
},
|
|
594
|
-
children:
|
|
613
|
+
children: le.map((e, t) => /* @__PURE__ */ l(
|
|
595
614
|
"div",
|
|
596
615
|
{
|
|
597
|
-
draggable: !
|
|
616
|
+
draggable: !a,
|
|
598
617
|
role: "button",
|
|
599
|
-
tabIndex:
|
|
600
|
-
"aria-label":
|
|
618
|
+
tabIndex: a ? -1 : 0,
|
|
619
|
+
"aria-label": a ? `Word: ${e.text} (time expired)` : ln("Drag word", e.text, "to build sentence"),
|
|
601
620
|
onDragStart: (n) => {
|
|
602
|
-
if (
|
|
621
|
+
if (a) {
|
|
603
622
|
n.preventDefault();
|
|
604
623
|
return;
|
|
605
624
|
}
|
|
606
625
|
n.dataTransfer.setData(
|
|
607
626
|
"application/x-token",
|
|
608
627
|
JSON.stringify({ from: "bank", id: e.id })
|
|
609
|
-
), n.dataTransfer.setData("text/plain", e.id),
|
|
628
|
+
), n.dataTransfer.setData("text/plain", e.id), L(`Dragging word: ${e.text}`);
|
|
610
629
|
},
|
|
611
630
|
onKeyDown: (n) => {
|
|
612
|
-
|
|
631
|
+
a || cn(n, () => oe("bank", "selected", e.id, null));
|
|
613
632
|
},
|
|
614
633
|
onDragOver: (n) => n.preventDefault(),
|
|
615
634
|
onDrop: (n) => {
|
|
616
|
-
const i = n.currentTarget.getBoundingClientRect(),
|
|
617
|
-
|
|
635
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, h = n.clientX > r ? t + 1 : t;
|
|
636
|
+
B({ list: null, id: null, side: null }), n.stopPropagation(), K(n, "bank", h);
|
|
618
637
|
},
|
|
619
638
|
onDragEnter: (n) => {
|
|
620
|
-
if (
|
|
621
|
-
const i = n.currentTarget.getBoundingClientRect(),
|
|
622
|
-
|
|
639
|
+
if (a) return;
|
|
640
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
641
|
+
B({ list: "bank", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
623
642
|
},
|
|
624
|
-
onDragLeave: () =>
|
|
643
|
+
onDragLeave: () => B({ list: null, id: null, side: null }),
|
|
625
644
|
onClick: () => {
|
|
626
|
-
|
|
645
|
+
a || oe("bank", "selected", e.id, null);
|
|
627
646
|
},
|
|
628
647
|
style: {
|
|
629
|
-
padding:
|
|
630
|
-
borderRadius:
|
|
648
|
+
padding: c || window.innerWidth < 768 ? "6px 10px" : "10px 16px",
|
|
649
|
+
borderRadius: c || window.innerWidth < 768 ? "6px" : "10px",
|
|
631
650
|
border: "1px solid #ccc",
|
|
632
|
-
background:
|
|
633
|
-
cursor:
|
|
634
|
-
fontSize:
|
|
635
|
-
|
|
636
|
-
|
|
651
|
+
background: a ? "#f0f0f0" : "#f9f9f9",
|
|
652
|
+
cursor: a ? "not-allowed" : m.list === "bank" && m.id === e.id ? "grabbing" : "grab",
|
|
653
|
+
fontSize: c || window.innerWidth < 768 ? "12px" : "18px",
|
|
654
|
+
...m.list === "bank" && m.id === e.id && m.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
655
|
+
...m.list === "bank" && m.id === e.id && m.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
637
656
|
flexShrink: 0,
|
|
638
657
|
flexBasis: "auto",
|
|
639
|
-
opacity:
|
|
640
|
-
transition: "opacity 0.3s ease"
|
|
658
|
+
opacity: a ? 0.6 : 1,
|
|
659
|
+
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
660
|
+
...m.list === "bank" && m.id === e.id ? {
|
|
661
|
+
transform: "scale(1.05)",
|
|
662
|
+
boxShadow: "0 2px 8px rgba(59, 130, 246, 0.3)"
|
|
663
|
+
} : {}
|
|
641
664
|
},
|
|
642
665
|
children: e.text
|
|
643
666
|
},
|
|
@@ -645,37 +668,48 @@ function dn(g = {}) {
|
|
|
645
668
|
))
|
|
646
669
|
}
|
|
647
670
|
),
|
|
648
|
-
/* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ l(
|
|
649
672
|
"div",
|
|
650
673
|
{
|
|
651
674
|
onDragOver: (e) => e.preventDefault(),
|
|
652
|
-
onDrop: (e) =>
|
|
675
|
+
onDrop: (e) => {
|
|
676
|
+
const t = e.currentTarget.getBoundingClientRect(), n = Array.from(e.currentTarget.children);
|
|
677
|
+
if (n.length === 0) {
|
|
678
|
+
K(e, "selected", 0);
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
let i = W.length, r = 1 / 0;
|
|
682
|
+
n.forEach((h, u) => {
|
|
683
|
+
const o = h.getBoundingClientRect(), d = o.left + o.width / 2, T = Math.abs(e.clientX - d);
|
|
684
|
+
T < r && (r = T, i = e.clientX < d ? u : u + 1);
|
|
685
|
+
}), e.clientX > t.right - 30 && (i = W.length), e.clientX < t.left + 30 && (i = 0), K(e, "selected", i);
|
|
686
|
+
},
|
|
653
687
|
style: {
|
|
654
|
-
minHeight:
|
|
688
|
+
minHeight: c || window.innerWidth < 768 ? "50px" : "70px",
|
|
655
689
|
width: "auto",
|
|
656
690
|
// Автоматическая ширина в зависимости от содержимого
|
|
657
691
|
maxWidth: "none",
|
|
658
692
|
// Убираем ограничение максимальной ширины
|
|
659
693
|
minWidth: "245px",
|
|
660
694
|
// Минимальная ширина для растягивания
|
|
661
|
-
border:
|
|
662
|
-
borderRadius:
|
|
663
|
-
padding:
|
|
695
|
+
border: A === "correct" ? "2px dashed #4caf50" : A === "almost" ? "2px dashed #ff9800" : A === "wrong" ? "2px dashed #f44336" : "2px dashed #ccc",
|
|
696
|
+
borderRadius: c || window.innerWidth < 768 ? "8px" : "12px",
|
|
697
|
+
padding: c || window.innerWidth < 768 ? "8px" : "12px",
|
|
664
698
|
display: "flex",
|
|
665
|
-
flexWrap:
|
|
699
|
+
flexWrap: R() ? "wrap" : "nowrap",
|
|
666
700
|
alignItems: "center",
|
|
667
701
|
justifyContent: "center",
|
|
668
|
-
fontSize: `${
|
|
669
|
-
background:
|
|
670
|
-
overflowX:
|
|
671
|
-
whiteSpace:
|
|
702
|
+
fontSize: `${ve(W.length)}px`,
|
|
703
|
+
background: A === "correct" ? "#e8f5e8" : A === "almost" ? "#fff3e0" : A === "wrong" ? "#ffebee" : "#fafafa",
|
|
704
|
+
overflowX: R() ? "hidden" : "auto",
|
|
705
|
+
whiteSpace: R() ? "normal" : "nowrap"
|
|
672
706
|
},
|
|
673
|
-
children:
|
|
707
|
+
children: W.map((e, t) => /* @__PURE__ */ l(
|
|
674
708
|
"span",
|
|
675
709
|
{
|
|
676
|
-
draggable: !
|
|
710
|
+
draggable: !a,
|
|
677
711
|
onDragStart: (n) => {
|
|
678
|
-
if (
|
|
712
|
+
if (a) {
|
|
679
713
|
n.preventDefault();
|
|
680
714
|
return;
|
|
681
715
|
}
|
|
@@ -686,37 +720,41 @@ function dn(g = {}) {
|
|
|
686
720
|
},
|
|
687
721
|
onDragOver: (n) => n.preventDefault(),
|
|
688
722
|
onDrop: (n) => {
|
|
689
|
-
const i = n.currentTarget.getBoundingClientRect(),
|
|
690
|
-
|
|
723
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, h = i.width * 0.25, u = n.clientX < r - h ? t : n.clientX > r + h || n.clientX > r ? t + 1 : t;
|
|
724
|
+
B({ list: null, id: null, side: null }), n.stopPropagation(), K(n, "selected", u);
|
|
691
725
|
},
|
|
692
726
|
onDragEnter: (n) => {
|
|
693
|
-
if (
|
|
694
|
-
const i = n.currentTarget.getBoundingClientRect(),
|
|
695
|
-
|
|
727
|
+
if (a) return;
|
|
728
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
729
|
+
B({ list: "selected", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
696
730
|
},
|
|
697
|
-
onDragLeave: () =>
|
|
731
|
+
onDragLeave: () => B({ list: null, id: null, side: null }),
|
|
698
732
|
onClick: () => {
|
|
699
|
-
|
|
733
|
+
a || oe("selected", "bank", e.id, null);
|
|
700
734
|
},
|
|
701
|
-
title:
|
|
735
|
+
title: a ? "Time expired" : "Click to remove back to bank",
|
|
702
736
|
style: {
|
|
703
|
-
padding:
|
|
704
|
-
margin:
|
|
705
|
-
borderRadius:
|
|
706
|
-
background:
|
|
707
|
-
border:
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
cursor:
|
|
737
|
+
padding: f() ? "4px 6px" : "6px 10px",
|
|
738
|
+
margin: f() ? "2px" : "4px",
|
|
739
|
+
borderRadius: f() ? "4px" : "8px",
|
|
740
|
+
background: a ? "#f0f0f0" : "#ffe9e7",
|
|
741
|
+
border: a ? "1px solid #ccc" : "1px solid #ec4c44",
|
|
742
|
+
...m.list === "selected" && m.id === e.id && m.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
743
|
+
...m.list === "selected" && m.id === e.id && m.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
744
|
+
cursor: a ? "not-allowed" : m.list === "selected" && m.id === e.id ? "grabbing" : "grab",
|
|
711
745
|
userSelect: "none",
|
|
712
|
-
fontSize: `${
|
|
746
|
+
fontSize: `${ve(W.length)}px`,
|
|
713
747
|
// Адаптивный размер шрифта для слов
|
|
714
748
|
fontFamily: '"Roboto", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',
|
|
715
749
|
// Более плотный шрифт
|
|
716
750
|
whiteSpace: "nowrap",
|
|
717
751
|
// Запрещаем перенос слов
|
|
718
|
-
opacity:
|
|
719
|
-
transition: "opacity 0.3s ease"
|
|
752
|
+
opacity: a ? 0.6 : 1,
|
|
753
|
+
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
754
|
+
...m.list === "selected" && m.id === e.id ? {
|
|
755
|
+
transform: "scale(1.05)",
|
|
756
|
+
boxShadow: "0 2px 8px rgba(59, 130, 246, 0.3)"
|
|
757
|
+
} : {}
|
|
720
758
|
},
|
|
721
759
|
children: e.text
|
|
722
760
|
},
|
|
@@ -724,91 +762,91 @@ function dn(g = {}) {
|
|
|
724
762
|
))
|
|
725
763
|
}
|
|
726
764
|
),
|
|
727
|
-
/* @__PURE__ */
|
|
765
|
+
/* @__PURE__ */ l(
|
|
728
766
|
"button",
|
|
729
767
|
{
|
|
730
|
-
onClick: () =>
|
|
731
|
-
disabled: !
|
|
768
|
+
onClick: () => Ke(!0),
|
|
769
|
+
disabled: !a && W.length === 0,
|
|
732
770
|
style: {
|
|
733
|
-
marginTop:
|
|
734
|
-
fontSize:
|
|
735
|
-
padding:
|
|
736
|
-
borderRadius:
|
|
737
|
-
background:
|
|
771
|
+
marginTop: f() ? "15px" : "30px",
|
|
772
|
+
fontSize: f() ? "14px" : "20px",
|
|
773
|
+
padding: f() ? "6px 12px" : "10px 24px",
|
|
774
|
+
borderRadius: f() ? "8px" : "12px",
|
|
775
|
+
background: a || W.length > 0 ? "#ec4c44" : "#ccc",
|
|
738
776
|
color: "white",
|
|
739
777
|
border: "none",
|
|
740
|
-
cursor:
|
|
778
|
+
cursor: a || W.length > 0 ? "pointer" : "not-allowed"
|
|
741
779
|
},
|
|
742
780
|
children: "NEXT"
|
|
743
781
|
}
|
|
744
782
|
)
|
|
745
|
-
] }),
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
...
|
|
748
|
-
marginTop: (
|
|
749
|
-
marginBottom:
|
|
750
|
-
fontSize:
|
|
783
|
+
] }), tn = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
784
|
+
/* @__PURE__ */ l("h1", { style: {
|
|
785
|
+
...g.gmHeadline1,
|
|
786
|
+
marginTop: (c && 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 || V, "0px"),
|
|
787
|
+
marginBottom: c && 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 || V ? "2px" : "10px",
|
|
788
|
+
fontSize: c && 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)"
|
|
751
789
|
}, children: "Game Over 🎯" }),
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
...
|
|
754
|
-
marginTop: (
|
|
755
|
-
marginBottom:
|
|
756
|
-
fontSize:
|
|
790
|
+
/* @__PURE__ */ y("h2", { style: {
|
|
791
|
+
...g.gmHeadline2,
|
|
792
|
+
marginTop: (c && 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 || V, "0px"),
|
|
793
|
+
marginBottom: c && 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 || V ? "2px" : "16px",
|
|
794
|
+
fontSize: c && 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"
|
|
757
795
|
}, children: [
|
|
758
796
|
"Your score: ",
|
|
759
|
-
|
|
797
|
+
U,
|
|
760
798
|
" out of ",
|
|
761
|
-
|
|
799
|
+
z
|
|
762
800
|
] }),
|
|
763
|
-
/* @__PURE__ */
|
|
764
|
-
...
|
|
801
|
+
/* @__PURE__ */ y("p", { style: {
|
|
802
|
+
...g.gmBodyM,
|
|
765
803
|
color: "#10b981",
|
|
766
|
-
marginTop:
|
|
767
|
-
marginBottom:
|
|
768
|
-
fontSize:
|
|
804
|
+
marginTop: c && 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 || V ? "0px" : "12px",
|
|
805
|
+
marginBottom: c && 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 || V ? "2px" : "16px",
|
|
806
|
+
fontSize: c && 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"
|
|
769
807
|
}, children: [
|
|
770
808
|
"Best score: ",
|
|
771
|
-
|
|
809
|
+
he
|
|
772
810
|
] }),
|
|
773
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ y("div", { style: {
|
|
774
812
|
display: "flex",
|
|
775
|
-
gap:
|
|
776
|
-
marginTop:
|
|
813
|
+
gap: c && window.innerWidth > window.innerHeight || c && 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 ? "6px" : "12px",
|
|
814
|
+
marginTop: c && window.innerWidth > window.innerHeight || c && 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 ? "2px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || Pe ? "12px" : "24px"
|
|
777
815
|
}, children: [
|
|
778
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ l(
|
|
779
817
|
"button",
|
|
780
818
|
{
|
|
781
819
|
onClick: () => {
|
|
782
|
-
|
|
783
|
-
|
|
820
|
+
ge(), P("start"), setTimeout(() => {
|
|
821
|
+
k("getready"), We(null), ee(!1);
|
|
784
822
|
}, 800);
|
|
785
823
|
},
|
|
786
824
|
style: {
|
|
787
|
-
...
|
|
788
|
-
...
|
|
825
|
+
...g.gmButton,
|
|
826
|
+
...b("medium")
|
|
789
827
|
},
|
|
790
828
|
children: "🔁 Play again"
|
|
791
829
|
}
|
|
792
830
|
),
|
|
793
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ l(
|
|
794
832
|
"button",
|
|
795
833
|
{
|
|
796
834
|
onClick: () => {
|
|
797
|
-
|
|
835
|
+
P("click"), k("select"), _(null), me(null), Q([]), M(0), ce([]), ee(!1);
|
|
798
836
|
},
|
|
799
837
|
style: {
|
|
800
|
-
...
|
|
801
|
-
...
|
|
838
|
+
...g.gmButton,
|
|
839
|
+
...b("medium")
|
|
802
840
|
},
|
|
803
841
|
children: "⬅️ Exit"
|
|
804
842
|
}
|
|
805
843
|
)
|
|
806
844
|
] })
|
|
807
|
-
] }),
|
|
808
|
-
return /* @__PURE__ */
|
|
845
|
+
] }), rn = !c && v;
|
|
846
|
+
return /* @__PURE__ */ l(
|
|
809
847
|
"div",
|
|
810
848
|
{
|
|
811
|
-
ref:
|
|
849
|
+
ref: de,
|
|
812
850
|
style: {
|
|
813
851
|
width: "100%",
|
|
814
852
|
height: "100%",
|
|
@@ -824,90 +862,81 @@ function dn(g = {}) {
|
|
|
824
862
|
right: 0,
|
|
825
863
|
bottom: 0
|
|
826
864
|
},
|
|
827
|
-
children: /* @__PURE__ */
|
|
865
|
+
children: /* @__PURE__ */ l(
|
|
828
866
|
"div",
|
|
829
867
|
{
|
|
830
868
|
style: {
|
|
831
|
-
width:
|
|
832
|
-
height:
|
|
869
|
+
width: c ? "100%" : ke || 1e3,
|
|
870
|
+
height: c ? "100%" : ke || 1e3,
|
|
833
871
|
display: "flex",
|
|
834
872
|
justifyContent: "center",
|
|
835
873
|
alignItems: "center",
|
|
836
874
|
overflow: "hidden",
|
|
837
|
-
borderRadius:
|
|
875
|
+
borderRadius: c ? 0 : "20px",
|
|
838
876
|
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
839
|
-
boxShadow:
|
|
840
|
-
margin:
|
|
841
|
-
position: "relative"
|
|
877
|
+
boxShadow: c ? "none" : "0 0 40px rgba(0,0,0,0.1)",
|
|
878
|
+
margin: c ? "0 auto" : "unset",
|
|
879
|
+
position: "relative",
|
|
842
880
|
// needed so absolute logo is inside the square
|
|
881
|
+
transform: `scale(${Ee})`
|
|
882
|
+
// ✅ Применяем масштаб для широких экранов
|
|
843
883
|
},
|
|
844
|
-
children:
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
children: /* @__PURE__ */ m("div", { id: "magic-sentence-root", children: [
|
|
875
|
-
y === "select" ? Ne() : null,
|
|
876
|
-
y === "time" ? je() : null,
|
|
877
|
-
y === "type" ? Oe() : null,
|
|
878
|
-
y === "getready" ? Fe() : null,
|
|
879
|
-
y === "play" ? Ze() : null,
|
|
880
|
-
y === "results" ? Qe() : null
|
|
881
|
-
] })
|
|
882
|
-
}
|
|
883
|
-
)
|
|
884
|
-
]
|
|
884
|
+
children: /* @__PURE__ */ l(
|
|
885
|
+
"div",
|
|
886
|
+
{
|
|
887
|
+
style: {
|
|
888
|
+
transform: "translateZ(0)",
|
|
889
|
+
width: "100%",
|
|
890
|
+
height: "100%",
|
|
891
|
+
display: "flex",
|
|
892
|
+
justifyContent: "center",
|
|
893
|
+
alignItems: "center"
|
|
894
|
+
},
|
|
895
|
+
children: /* @__PURE__ */ y("div", { id: "magic-sentence-root", children: [
|
|
896
|
+
rn ? /* @__PURE__ */ l("div", { style: g.gmLogoFixed, children: /* @__PURE__ */ l(
|
|
897
|
+
"img",
|
|
898
|
+
{
|
|
899
|
+
src: s || (typeof window < "u" && window.origin ? `${window.origin}/cloud/speakid/games/magic%20sentence/logo.png` : "/logo.png"),
|
|
900
|
+
alt: "SPEAKID Logo",
|
|
901
|
+
style: g.gmLogoImg,
|
|
902
|
+
loading: "lazy"
|
|
903
|
+
}
|
|
904
|
+
) }) : null,
|
|
905
|
+
x === "select" ? Ze() : null,
|
|
906
|
+
x === "time" ? _e() : null,
|
|
907
|
+
x === "type" ? Qe() : null,
|
|
908
|
+
x === "getready" ? en() : null,
|
|
909
|
+
x === "play" ? nn() : null,
|
|
910
|
+
x === "results" ? tn() : null
|
|
911
|
+
] })
|
|
912
|
+
}
|
|
913
|
+
)
|
|
885
914
|
}
|
|
886
915
|
)
|
|
887
916
|
}
|
|
888
917
|
);
|
|
889
918
|
}
|
|
890
|
-
class
|
|
891
|
-
constructor(
|
|
892
|
-
super(
|
|
919
|
+
class yn extends sn {
|
|
920
|
+
constructor(s) {
|
|
921
|
+
super(s), this.state = { hasError: !1 };
|
|
893
922
|
}
|
|
894
|
-
static getDerivedStateFromError(
|
|
923
|
+
static getDerivedStateFromError(s) {
|
|
895
924
|
return {
|
|
896
925
|
hasError: !0,
|
|
897
|
-
error:
|
|
926
|
+
error: s
|
|
898
927
|
};
|
|
899
928
|
}
|
|
900
|
-
componentDidCatch(
|
|
901
|
-
console.error("Game Error:",
|
|
902
|
-
error:
|
|
903
|
-
errorInfo:
|
|
929
|
+
componentDidCatch(s, v) {
|
|
930
|
+
console.error("Game Error:", s, v), this.setState({
|
|
931
|
+
error: s,
|
|
932
|
+
errorInfo: v
|
|
904
933
|
});
|
|
905
934
|
}
|
|
906
935
|
handleReset = () => {
|
|
907
936
|
this.setState({ hasError: !1, error: void 0, errorInfo: void 0 });
|
|
908
937
|
};
|
|
909
938
|
render() {
|
|
910
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
939
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ y("div", { style: {
|
|
911
940
|
display: "flex",
|
|
912
941
|
flexDirection: "column",
|
|
913
942
|
alignItems: "center",
|
|
@@ -919,9 +948,9 @@ class ln extends Ue {
|
|
|
919
948
|
color: "#dc2626",
|
|
920
949
|
fontFamily: "system-ui, sans-serif"
|
|
921
950
|
}, children: [
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
/* @__PURE__ */
|
|
924
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ l("h1", { style: { fontSize: "24px", marginBottom: "16px" }, children: "🚨 Oops! Something went wrong" }),
|
|
952
|
+
/* @__PURE__ */ l("p", { style: { fontSize: "16px", marginBottom: "24px", maxWidth: "500px" }, children: "The game encountered an unexpected error. Don't worry, your progress is saved!" }),
|
|
953
|
+
/* @__PURE__ */ l(
|
|
925
954
|
"button",
|
|
926
955
|
{
|
|
927
956
|
onClick: this.handleReset,
|
|
@@ -935,14 +964,14 @@ class ln extends Ue {
|
|
|
935
964
|
cursor: "pointer",
|
|
936
965
|
transition: "background-color 0.2s"
|
|
937
966
|
},
|
|
938
|
-
onMouseOver: (
|
|
939
|
-
onMouseOut: (
|
|
967
|
+
onMouseOver: (s) => s.currentTarget.style.backgroundColor = "#b91c1c",
|
|
968
|
+
onMouseOut: (s) => s.currentTarget.style.backgroundColor = "#dc2626",
|
|
940
969
|
children: "🔄 Restart Game"
|
|
941
970
|
}
|
|
942
971
|
),
|
|
943
|
-
typeof process < "u" && process.env.NODE_ENV === "development" && this.state.error && /* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
/* @__PURE__ */
|
|
972
|
+
typeof process < "u" && process.env.NODE_ENV === "development" && this.state.error && /* @__PURE__ */ y("details", { style: { marginTop: "20px", textAlign: "left", maxWidth: "600px" }, children: [
|
|
973
|
+
/* @__PURE__ */ l("summary", { style: { cursor: "pointer", fontSize: "14px" }, children: "Technical Details (Development Only)" }),
|
|
974
|
+
/* @__PURE__ */ y("pre", { style: {
|
|
946
975
|
backgroundColor: "#f3f4f6",
|
|
947
976
|
padding: "12px",
|
|
948
977
|
borderRadius: "4px",
|
|
@@ -958,12 +987,12 @@ class ln extends Ue {
|
|
|
958
987
|
}
|
|
959
988
|
}
|
|
960
989
|
export {
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
990
|
+
yn as ErrorBoundary,
|
|
991
|
+
xn as Game,
|
|
992
|
+
L as announceToScreenReader,
|
|
993
|
+
ln as createAriaLabel,
|
|
994
|
+
xn as default,
|
|
995
|
+
cn as handleKeyDown,
|
|
996
|
+
an as useValidation
|
|
968
997
|
};
|
|
969
998
|
//# sourceMappingURL=speakid-build-a-sentence.es.js.map
|