@mblinkov/whats-missing 20.0.11 → 20.0.12

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,9 +1,9 @@
1
- import { jsx as o, jsxs as s, Fragment as ie } from "react/jsx-runtime";
2
- import { useEffect as L, useState as l, useMemo as se } from "react";
3
- const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r.map(([a, n]) => ({
4
- src: `${le}${m}/${n.replace(/\s/g, "%20")}.png`,
5
- name: n
6
- })), ae = [
1
+ import { jsx as n, jsxs as r, Fragment as se } from "react/jsx-runtime";
2
+ import { useRef as le, useEffect as j, useState as s, useMemo as ae } from "react";
3
+ const de = window.origin + "/cloud/speakid/games/whatsmissing/", W = (l, a) => l.map(([d, o]) => ({
4
+ src: `${de}${a}/${o.replace(/\s/g, "%20")}.png`,
5
+ name: o
6
+ })), ce = [
7
7
  ["apple", "apple"],
8
8
  ["banana", "banana"],
9
9
  ["bread", "bread"],
@@ -29,7 +29,7 @@ const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r
29
29
  ["strawberry", "strawberry"],
30
30
  ["tomato", "tomato"],
31
31
  ["watermelon", "watermelon"]
32
- ], de = [
32
+ ], me = [
33
33
  ["bear", "bear"],
34
34
  ["cat", "cat"],
35
35
  ["crocodile", "crocodile"],
@@ -49,7 +49,7 @@ const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r
49
49
  ["tortoise", "tortoise"],
50
50
  ["wolf", "wolf"],
51
51
  ["zebra", "zebra"]
52
- ], ce = [
52
+ ], ge = [
53
53
  ["ball", "ball"],
54
54
  ["balloon", "balloon"],
55
55
  ["blocks", "blocks"],
@@ -69,21 +69,21 @@ const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r
69
69
  ["teddy_bear", "teddy bear"],
70
70
  ["yo-yo", "yo-yo"],
71
71
  ["crayons", "crayons"]
72
- ], K = {
73
- food: W(ae, "food"),
74
- animals: W(de, "animals"),
75
- toys: W(ce, "toys")
76
- }, me = `
72
+ ], O = {
73
+ food: W(ce, "food"),
74
+ animals: W(me, "animals"),
75
+ toys: W(ge, "toys")
76
+ }, he = `
77
77
  @keyframes spin {
78
78
  from { transform: rotate(0deg); }
79
79
  to { transform: rotate(360deg); }
80
80
  }
81
81
  `;
82
82
  if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
83
- const r = document.createElement("style");
84
- r.id = "spin-keyframes", r.innerHTML = me, document.head.appendChild(r);
83
+ const l = document.createElement("style");
84
+ l.id = "spin-keyframes", l.innerHTML = he, document.head.appendChild(l);
85
85
  }
86
- const ge = {
86
+ const pe = {
87
87
  animation: "spin 1.4s linear infinite"
88
88
  }, t = {
89
89
  gmCenterScreen: {
@@ -233,111 +233,73 @@ const ge = {
233
233
  },
234
234
  gmHourglass: {
235
235
  fontSize: "42px",
236
- ...ge
236
+ ...pe
237
237
  }
238
- }, pe = () => {
239
- const r = document.createElement("style");
240
- r.textContent = `
241
- html, body {
242
- margin: 0;
243
- padding: 0;
244
- width: 100%;
245
- height: 100%;
246
- overflow-x: hidden;
247
- overflow-y: hidden;
248
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
249
- background-repeat: no-repeat;
250
- background-attachment: fixed;
251
- background-size: cover;
252
- }
253
-
254
- #whats-missing-root {
255
- all: unset;
256
- display: flex;
257
- flex-direction: column;
258
- justify-content: center;
259
- align-items: center;
260
- position: fixed;
261
- inset: 0;
262
- width: 100vw;
263
- height: 100vh;
264
- margin: 0;
265
- padding: 0;
266
- color: #1f2937;
267
- text-align: center;
268
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
269
- background-size: cover;
270
- }
271
-
238
+ }, ue = () => {
239
+ const l = document.createElement("style");
240
+ l.textContent = `
272
241
  #whats-missing-root, #whats-missing-root * {
273
242
  box-sizing: border-box;
274
243
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
275
244
  }
276
-
277
245
  #whats-missing-root img {
278
246
  max-width: 100%;
279
247
  height: auto;
280
248
  display: block;
281
249
  user-select: none;
282
250
  }
283
-
284
- @keyframes spin {
285
- from { transform: rotate(0deg); }
286
- to { transform: rotate(360deg); }
287
- }
288
- `, document.head.appendChild(r);
289
- }, he = (r, m) => {
290
- const a = Array.from({ length: r.length + 1 }, () => Array(m.length + 1).fill(0));
291
- for (let n = 0; n <= r.length; n++) a[n][0] = n;
292
- for (let n = 0; n <= m.length; n++) a[0][n] = n;
293
- for (let n = 1; n <= r.length; n++)
294
- for (let d = 1; d <= m.length; d++)
295
- a[n][d] = r[n - 1] === m[d - 1] ? a[n - 1][d - 1] : Math.min(a[n - 1][d - 1], a[n][d - 1], a[n - 1][d]) + 1;
296
- return a[r.length][m.length];
251
+ `, document.head.appendChild(l);
252
+ }, fe = (l, a) => {
253
+ const d = Array.from({ length: l.length + 1 }, () => Array(a.length + 1).fill(0));
254
+ for (let o = 0; o <= l.length; o++) d[o][0] = o;
255
+ for (let o = 0; o <= a.length; o++) d[0][o] = o;
256
+ for (let o = 1; o <= l.length; o++)
257
+ for (let c = 1; c <= a.length; c++)
258
+ d[o][c] = l[o - 1] === a[c - 1] ? d[o - 1][c - 1] : Math.min(d[o - 1][c - 1], d[o][c - 1], d[o - 1][c]) + 1;
259
+ return d[l.length][a.length];
297
260
  };
298
- function ye() {
299
- L(() => {
300
- pe();
301
- }, []);
302
- const [r, m] = l(null), [a, n] = l([]), [d, O] = l(4), [f, j] = l(!1), [x, E] = l(1), [h, Z] = l(null), [g, b] = l("ready"), [G, F] = l(3), [T, S] = l(10), [z, Y] = l(20), [J, R] = l(0), [w, I] = l(!1), [k, D] = l(""), [u, A] = l(!1), [H, U] = l(!1), [N, y] = l(null), [Q, M] = l([]), [X, P] = l([]), [v, ee] = l(!1);
303
- L(() => {
304
- const e = () => ee(window.innerWidth < 768);
261
+ function be() {
262
+ const l = le(null);
263
+ j(() => (ue(), () => {
264
+ document.body.style.overflow = "";
265
+ }), []);
266
+ const [a, d] = s(null), [o, c] = s([]), [x, Z] = s(4), [f, E] = s(!1), [b, G] = s(1), [p, J] = s(null), [g, w] = s("ready"), [F, D] = s(3), [S, z] = s(10), [R, Y] = s(20), [Q, I] = s(0), [k, H] = s(!1), [v, U] = s(""), [u, M] = s(!1), [A, N] = s(!1), [P, y] = s(null), [X, B] = s([]), [ee, V] = s([]), [C, te] = s(!1);
267
+ j(() => {
268
+ const e = () => te(window.innerWidth < 768);
305
269
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
306
270
  }, []);
307
- const V = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), _ = () => {
308
- if (!r) return;
309
- const e = V(K[r]);
310
- n(e), j(!0), I(!1), E(1), R(0), M([]), P([]), $(e, [], !0);
311
- }, $ = (e = a, i = X, p = !1) => {
312
- const c = V(e.length ? e : K[r]);
313
- let C = Math.floor(Math.random() * c.length), B = c[C].name, q = 0;
314
- for (; i.includes(B) && q < 20; )
315
- C = Math.floor(Math.random() * c.length), B = c[C].name, q++;
316
- n(c), Z(C), P([...i, B]), A(!1), D(""), Y(20), y(null), p ? (b("ready"), F(3), S(10)) : (b("memorize"), S(10));
271
+ const _ = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), $ = () => {
272
+ if (!a) return;
273
+ const e = _(O[a]);
274
+ c(e), E(!0), H(!1), G(1), I(0), B([]), V([]), q(e, [], !0);
275
+ }, q = (e = o, i = ee, h = !1) => {
276
+ const m = _(e.length ? e : O[a]);
277
+ let T = Math.floor(Math.random() * m.length), L = m[T].name, K = 0;
278
+ for (; i.includes(L) && K < 20; )
279
+ T = Math.floor(Math.random() * m.length), L = m[T].name, K++;
280
+ c(m), J(T), V([...i, L]), M(!1), U(""), Y(20), y(null), h ? (w("ready"), D(3), z(10)) : (w("memorize"), z(10));
317
281
  };
318
- L(() => {
319
- if (!(!f || w || u)) {
282
+ j(() => {
283
+ if (!(!f || k || u)) {
320
284
  if (g === "ready")
321
- if (G <= 0)
322
- b("memorize");
285
+ if (F <= 0) w("memorize");
323
286
  else {
324
- const e = setTimeout(() => F((i) => i - 1), 1e3);
287
+ const e = setTimeout(() => D((i) => i - 1), 1e3);
325
288
  return () => clearTimeout(e);
326
289
  }
327
290
  if (g === "memorize")
328
- if (T <= 0)
329
- b("guess");
291
+ if (S <= 0) w("guess");
330
292
  else {
331
- const e = setTimeout(() => S((i) => i - 1), 1e3);
293
+ const e = setTimeout(() => z((i) => i - 1), 1e3);
332
294
  return () => clearTimeout(e);
333
295
  }
334
296
  if (g === "guess") {
335
- if (z <= 0) {
336
- A(!0), y("wrong");
337
- const i = a[h].name;
338
- M((p) => [
339
- ...p,
340
- { round: x, answer: k, correct: i, result: "wrong" }
297
+ if (R <= 0) {
298
+ M(!0), y("wrong");
299
+ const i = o[p].name;
300
+ B((h) => [
301
+ ...h,
302
+ { round: b, answer: v, correct: i, result: "wrong" }
341
303
  ]);
342
304
  return;
343
305
  }
@@ -345,218 +307,208 @@ function ye() {
345
307
  return () => clearTimeout(e);
346
308
  }
347
309
  }
348
- }, [
349
- g,
350
- G,
351
- T,
352
- z,
353
- f,
354
- w,
355
- u,
356
- a,
357
- h,
358
- x,
359
- k
360
- ]);
361
- const te = () => {
362
- if (h === null || H) return;
363
- const e = a[h].name, i = k.toLowerCase().trim();
364
- let p = "wrong";
365
- i === e ? (R((c) => c + 1), y("correct"), p = "correct") : he(i, e) === 1 ? (R((c) => c + 0.5), y("almost"), p = "almost") : (y("wrong"), p = "wrong"), M((c) => [
366
- ...c,
367
- { round: x, answer: i, correct: e, result: p }
368
- ]), U(!0), setTimeout(() => {
369
- U(!1), A(!0);
310
+ }, [g, F, S, R, f, k, u, o, p, b, v]);
311
+ const ne = () => {
312
+ if (p === null || A) return;
313
+ const e = o[p].name, i = v.toLowerCase().trim();
314
+ let h = "wrong";
315
+ i === e ? (I((m) => m + 1), y("correct"), h = "correct") : fe(i, e) === 1 ? (I((m) => m + 0.5), y("almost"), h = "almost") : (y("wrong"), h = "wrong"), B((m) => [...m, { round: b, answer: i, correct: e, result: h }]), N(!0), setTimeout(() => {
316
+ N(!1), M(!0);
370
317
  }, 600);
371
- }, oe = () => x < d ? (E((e) => e + 1), $()) : I(!0), ne = () => {
372
- j(!1), I(!1), m(null);
373
- }, re = se(
374
- () => /* @__PURE__ */ o("div", { style: t.gmLogoFixed, children: /* @__PURE__ */ s("picture", { children: [
375
- /* @__PURE__ */ o(
376
- "source",
377
- {
378
- srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg",
379
- type: "image/svg+xml"
380
- }
381
- ),
382
- /* @__PURE__ */ o(
383
- "img",
384
- {
385
- src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png",
386
- alt: "SPEAKID Logo",
387
- style: t.gmLogoImg,
388
- loading: "lazy"
389
- }
390
- )
318
+ }, oe = () => b < x ? (G((e) => e + 1), q()) : H(!0), ie = () => {
319
+ E(!1), H(!1), d(null);
320
+ }, re = ae(
321
+ () => /* @__PURE__ */ n("div", { style: t.gmLogoFixed, children: /* @__PURE__ */ r("picture", { children: [
322
+ /* @__PURE__ */ n("source", { srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg", type: "image/svg+xml" }),
323
+ /* @__PURE__ */ n("img", { src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png", alt: "SPEAKID Logo", style: t.gmLogoImg, loading: "lazy" })
391
324
  ] }) }),
392
325
  []
393
326
  );
394
- return /* @__PURE__ */ s("div", { id: "whats-missing-root", children: [
395
- !v && re,
396
- !r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
397
- /* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
398
- /* @__PURE__ */ o("p", { style: t.gmBodyM, children: "Select a theme:" }),
399
- /* @__PURE__ */ o("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ o("button", { style: t.gmButton, onClick: () => m(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
400
- /* @__PURE__ */ s("div", { style: { marginTop: 24 }, children: [
401
- /* @__PURE__ */ o("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
402
- /* @__PURE__ */ o("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ o(
403
- "button",
404
- {
405
- style: {
406
- ...t.gmButton,
407
- ...d === e ? t.gmButtonActive : {}
408
- },
409
- onClick: () => O(e),
410
- children: e
411
- },
412
- e
413
- )) })
414
- ] })
415
- ] }),
416
- r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
417
- /* @__PURE__ */ s("h1", { style: t.gmHeadline1, children: [
418
- "Theme selected: ",
419
- r
420
- ] }),
421
- /* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
422
- "Rounds: ",
423
- d
424
- ] }),
425
- /* @__PURE__ */ o("button", { style: t.gmButton, onClick: _, children: "▶ Start game" })
426
- ] }),
427
- w && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
428
- /* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "Results" }),
429
- /* @__PURE__ */ s("h2", { style: t.gmHeadline3, children: [
430
- "Your score: ",
431
- J,
432
- " / ",
433
- d
434
- ] }),
435
- /* @__PURE__ */ o("p", { style: { ...t.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
436
- /* @__PURE__ */ s("table", { style: t.gmTable, children: [
437
- /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [
438
- /* @__PURE__ */ o("th", { children: "Round" }),
439
- /* @__PURE__ */ o("th", { children: "Your Answer" }),
440
- /* @__PURE__ */ o("th", { children: "Correct" }),
441
- /* @__PURE__ */ o("th", { children: "Result" })
442
- ] }) }),
443
- /* @__PURE__ */ o("tbody", { children: Q.map((e, i) => /* @__PURE__ */ s("tr", { children: [
444
- /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.round }),
445
- /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.answer || "—" }),
446
- /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.correct }),
447
- /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
448
- ] }, i)) })
449
- ] }),
450
- /* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
451
- /* @__PURE__ */ o("button", { style: t.gmButton, onClick: _, children: "🔁 Play again" }),
452
- /* @__PURE__ */ o("button", { style: t.gmButton, onClick: ne, children: "⬅️ Choose theme" })
453
- ] })
454
- ] }),
455
- f && !w && /* @__PURE__ */ s("div", { style: t.gmGameLayout, children: [
456
- /* @__PURE__ */ s(
327
+ return /* @__PURE__ */ n(
328
+ "div",
329
+ {
330
+ ref: l,
331
+ style: {
332
+ display: "flex",
333
+ justifyContent: "center",
334
+ alignItems: "center",
335
+ width: "100%",
336
+ height: "100%",
337
+ overflow: "hidden"
338
+ },
339
+ children: /* @__PURE__ */ n(
457
340
  "div",
458
341
  {
459
342
  style: {
460
- minHeight: 160,
343
+ width: window.innerWidth > window.innerHeight ? "90vh" : "90vw",
344
+ height: window.innerWidth > window.innerHeight ? "90vh" : "90vw",
461
345
  display: "flex",
462
- flexDirection: "column",
463
346
  justifyContent: "center",
464
- alignItems: "center"
465
- },
466
- children: [
467
- g === "ready" && /* @__PURE__ */ s(ie, { children: [
468
- /* @__PURE__ */ o("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
469
- /* @__PURE__ */ o("div", { style: t.gmHourglass, children: "⏳" })
470
- ] }),
471
- g === "memorize" && /* @__PURE__ */ s("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
472
- "MEMORIZE (",
473
- T,
474
- ")"
475
- ] }),
476
- g === "guess" && !u && /* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
477
- "⏳ Time left: ",
478
- z,
479
- "s"
480
- ] })
481
- ]
482
- }
483
- ),
484
- g !== "ready" && /* @__PURE__ */ o(
485
- "div",
486
- {
487
- style: {
488
- ...t.gmGrid,
489
- gridTemplateColumns: v ? "repeat(2, 1fr)" : "repeat(3, 210px)",
490
- gridAutoRows: v ? "150px" : "210px",
491
- gap: v ? "12px" : "20px",
492
- justifyItems: "center",
493
- ...window.innerWidth > 2e3 ? {
494
- gridTemplateColumns: "repeat(3, 260px)",
495
- gridAutoRows: "260px",
496
- gap: "28px"
497
- } : {},
498
- ...window.innerWidth > 2560 ? {
499
- gridTemplateColumns: "repeat(3, 300px)",
500
- gridAutoRows: "300px",
501
- gap: "32px"
502
- } : {}
347
+ alignItems: "center",
348
+ flexDirection: "column",
349
+ borderRadius: "20px",
350
+ background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)"
503
351
  },
504
- children: a.map((e, i) => {
505
- const p = h === i && g === "guess" && !u;
506
- return /* @__PURE__ */ o(
507
- "div",
508
- {
509
- style: {
510
- ...t.gmCard,
511
- ...N === "correct" && h === i ? t.gmCorrect : {},
512
- ...N === "wrong" && h === i ? t.gmWrong : {}
513
- },
514
- children: !p && /* @__PURE__ */ o(
515
- "img",
352
+ children: /* @__PURE__ */ r("div", { id: "whats-missing-root", children: [
353
+ !C && re,
354
+ !a && !f && /* @__PURE__ */ r("div", { style: t.gmCenterScreen, children: [
355
+ /* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
356
+ /* @__PURE__ */ n("p", { style: t.gmBodyM, children: "Select a theme:" }),
357
+ /* @__PURE__ */ n("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ n("button", { style: t.gmButton, onClick: () => d(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
358
+ /* @__PURE__ */ r("div", { style: { marginTop: 24 }, children: [
359
+ /* @__PURE__ */ n("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
360
+ /* @__PURE__ */ n("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ n(
361
+ "button",
516
362
  {
517
- src: e.src,
518
- alt: e.name,
519
363
  style: {
520
- width: "100%",
521
- height: "100%",
522
- objectFit: "cover"
364
+ ...t.gmButton,
365
+ ...x === e ? t.gmButtonActive : {}
366
+ },
367
+ onClick: () => Z(e),
368
+ children: e
369
+ },
370
+ e
371
+ )) })
372
+ ] })
373
+ ] }),
374
+ a && !f && /* @__PURE__ */ r("div", { style: t.gmCenterScreen, children: [
375
+ /* @__PURE__ */ r("h1", { style: t.gmHeadline1, children: [
376
+ "Theme selected: ",
377
+ a
378
+ ] }),
379
+ /* @__PURE__ */ r("p", { style: t.gmBodyM, children: [
380
+ "Rounds: ",
381
+ x
382
+ ] }),
383
+ /* @__PURE__ */ n("button", { style: t.gmButton, onClick: $, children: "▶ Start game" })
384
+ ] }),
385
+ k && /* @__PURE__ */ r("div", { style: t.gmCenterScreen, children: [
386
+ /* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "Results" }),
387
+ /* @__PURE__ */ r("h2", { style: t.gmHeadline3, children: [
388
+ "Your score: ",
389
+ Q,
390
+ " / ",
391
+ x
392
+ ] }),
393
+ /* @__PURE__ */ n("p", { style: { ...t.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
394
+ /* @__PURE__ */ r("table", { style: t.gmTable, children: [
395
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ r("tr", { children: [
396
+ /* @__PURE__ */ n("th", { children: "Round" }),
397
+ /* @__PURE__ */ n("th", { children: "Your Answer" }),
398
+ /* @__PURE__ */ n("th", { children: "Correct" }),
399
+ /* @__PURE__ */ n("th", { children: "Result" })
400
+ ] }) }),
401
+ /* @__PURE__ */ n("tbody", { children: X.map((e, i) => /* @__PURE__ */ r("tr", { children: [
402
+ /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.round }),
403
+ /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.answer || "—" }),
404
+ /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.correct }),
405
+ /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
406
+ ] }, i)) })
407
+ ] }),
408
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
409
+ /* @__PURE__ */ n("button", { style: t.gmButton, onClick: $, children: "🔁 Play again" }),
410
+ /* @__PURE__ */ n("button", { style: t.gmButton, onClick: ie, children: "⬅️ Choose theme" })
411
+ ] })
412
+ ] }),
413
+ f && !k && /* @__PURE__ */ r("div", { style: t.gmGameLayout, children: [
414
+ /* @__PURE__ */ r(
415
+ "div",
416
+ {
417
+ style: {
418
+ minHeight: 160,
419
+ display: "flex",
420
+ flexDirection: "column",
421
+ justifyContent: "center",
422
+ alignItems: "center"
423
+ },
424
+ children: [
425
+ g === "ready" && /* @__PURE__ */ r(se, { children: [
426
+ /* @__PURE__ */ n("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
427
+ /* @__PURE__ */ n("div", { style: t.gmHourglass, children: "⏳" })
428
+ ] }),
429
+ g === "memorize" && /* @__PURE__ */ r("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
430
+ "MEMORIZE (",
431
+ S,
432
+ ")"
433
+ ] }),
434
+ g === "guess" && !u && /* @__PURE__ */ r("p", { style: t.gmBodyM, children: [
435
+ "⏳ Time left: ",
436
+ R,
437
+ "s"
438
+ ] })
439
+ ]
440
+ }
441
+ ),
442
+ g !== "ready" && /* @__PURE__ */ n(
443
+ "div",
444
+ {
445
+ style: {
446
+ ...t.gmGrid,
447
+ gridTemplateColumns: C ? "repeat(2, 1fr)" : "repeat(3, 210px)",
448
+ gridAutoRows: C ? "150px" : "210px",
449
+ gap: C ? "12px" : "20px",
450
+ justifyItems: "center"
451
+ },
452
+ children: o.map((e, i) => {
453
+ const h = p === i && g === "guess" && !u;
454
+ return /* @__PURE__ */ n(
455
+ "div",
456
+ {
457
+ style: {
458
+ ...t.gmCard,
459
+ ...P === "correct" && p === i ? t.gmCorrect : {},
460
+ ...P === "wrong" && p === i ? t.gmWrong : {}
461
+ },
462
+ children: !h && /* @__PURE__ */ n(
463
+ "img",
464
+ {
465
+ src: e.src,
466
+ alt: e.name,
467
+ style: {
468
+ width: "100%",
469
+ height: "100%",
470
+ objectFit: "cover"
471
+ }
472
+ }
473
+ )
474
+ },
475
+ i
476
+ );
477
+ })
478
+ }
479
+ ),
480
+ /* @__PURE__ */ r("div", { style: { marginTop: 16, height: 80 }, children: [
481
+ g === "guess" && !u && /* @__PURE__ */ r("div", { children: [
482
+ /* @__PURE__ */ n(
483
+ "input",
484
+ {
485
+ type: "text",
486
+ placeholder: "Type the missing word",
487
+ value: v,
488
+ onChange: (e) => U(e.target.value),
489
+ style: t.gmInput
523
490
  }
524
- }
525
- )
526
- },
527
- i
528
- );
529
- })
491
+ ),
492
+ /* @__PURE__ */ n(
493
+ "button",
494
+ {
495
+ style: { ...t.gmButton, marginLeft: 8 },
496
+ onClick: ne,
497
+ disabled: A,
498
+ children: A ? "..." : "Check"
499
+ }
500
+ )
501
+ ] }),
502
+ u && /* @__PURE__ */ n("button", { style: t.gmButton, onClick: oe, children: "Next round" })
503
+ ] })
504
+ ] })
505
+ ] })
530
506
  }
531
- ),
532
- /* @__PURE__ */ s("div", { style: { marginTop: 16, height: 80 }, children: [
533
- g === "guess" && !u && /* @__PURE__ */ s("div", { children: [
534
- /* @__PURE__ */ o(
535
- "input",
536
- {
537
- type: "text",
538
- placeholder: "Type the missing word",
539
- value: k,
540
- onChange: (e) => D(e.target.value),
541
- style: t.gmInput
542
- }
543
- ),
544
- /* @__PURE__ */ o(
545
- "button",
546
- {
547
- style: { ...t.gmButton, marginLeft: 8 },
548
- onClick: te,
549
- disabled: H,
550
- children: H ? "..." : "Check"
551
- }
552
- )
553
- ] }),
554
- u && /* @__PURE__ */ o("button", { style: t.gmButton, onClick: oe, children: "Next round" })
555
- ] })
556
- ] })
557
- ] });
507
+ )
508
+ }
509
+ );
558
510
  }
559
511
  export {
560
- ye as Game,
561
- K as themes
512
+ be as Game,
513
+ O as themes
562
514
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mblinkov/whats-missing",
3
- "version": "20.0.11",
3
+ "version": "20.0.12",
4
4
  "main": "dist/whats-missing.umd.js",
5
5
  "module": "dist/whats-missing.es.js",
6
6
  "types": "dist/index.d.ts",