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