@jswork/react-questkit 1.0.3 → 1.0.5
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/index.cjs +1207 -919
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +67 -12
- package/dist/index.d.ts +67 -12
- package/dist/index.mjs +1200 -913
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -96,6 +96,7 @@ __export(index_exports, {
|
|
|
96
96
|
OptionItem: () => OptionItem,
|
|
97
97
|
PictureBox: () => PictureBox,
|
|
98
98
|
Progress: () => Progress,
|
|
99
|
+
QuestComplete: () => QuestComplete,
|
|
99
100
|
QuestConfigProvider: () => QuestConfigProvider,
|
|
100
101
|
QuestProvider: () => QuestConfigProvider,
|
|
101
102
|
QuestShell: () => QuestShell,
|
|
@@ -424,6 +425,7 @@ function QuestShell({
|
|
|
424
425
|
instructionVariant = "card",
|
|
425
426
|
footer,
|
|
426
427
|
feedback,
|
|
428
|
+
bare = false,
|
|
427
429
|
dataQuest,
|
|
428
430
|
className,
|
|
429
431
|
children
|
|
@@ -433,28 +435,269 @@ function QuestShell({
|
|
|
433
435
|
"div",
|
|
434
436
|
{
|
|
435
437
|
className: classNames(
|
|
436
|
-
"rqk-shell relative isolate flex
|
|
438
|
+
"rqk-shell relative isolate flex w-full min-h-0 flex-col",
|
|
439
|
+
bare && "rqk-bare h-auto overflow-visible",
|
|
440
|
+
!bare && "h-full overflow-hidden",
|
|
441
|
+
"bg-[var(--rqk-screen-bg)]",
|
|
437
442
|
className
|
|
438
443
|
),
|
|
439
444
|
"data-component": "react-questkit",
|
|
440
445
|
"data-mode": mode,
|
|
441
446
|
"data-quest": dataQuest,
|
|
442
447
|
children: [
|
|
443
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
449
|
+
"div",
|
|
450
|
+
{
|
|
451
|
+
className: classNames(
|
|
452
|
+
"rqk-body relative flex min-h-0 flex-col",
|
|
453
|
+
!bare && "flex-1"
|
|
454
|
+
),
|
|
455
|
+
children: [
|
|
456
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "rqk-page", children: [
|
|
457
|
+
!bare ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Progress, { value: index, total }) : null,
|
|
458
|
+
!bare ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Instruction, { variant: instructionVariant, children: instruction }) : null,
|
|
459
|
+
children
|
|
460
|
+
] }),
|
|
461
|
+
feedback ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "rqk-feedback-wrap pointer-events-none absolute inset-x-5 bottom-24 z-[4] [&>*]:pointer-events-auto", children: feedback }) : null,
|
|
462
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Toast, { align: toast == null ? void 0 : toast.align, children: toast == null ? void 0 : toast.message })
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
footer && !bare ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "rqk-footer absolute inset-x-0 bottom-0 z-[5] [background:linear-gradient(180deg,rgba(246,248,252,0)_0%,rgba(246,248,252,0.9)_32%,var(--rqk-screen-bg)_66%)]", children: footer }) : null
|
|
453
467
|
]
|
|
454
468
|
}
|
|
455
469
|
) });
|
|
456
470
|
}
|
|
457
471
|
|
|
472
|
+
// src/art/illustrations.tsx
|
|
473
|
+
var import_react3 = require("react");
|
|
474
|
+
|
|
475
|
+
// src/assets/svg/art-apple.svg
|
|
476
|
+
var art_apple_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#FF8A8A"></stop><stop offset="1" stop-color="#E5484D"></stop></linearGradient></defs><circle cx="57" cy="66" r="32" fill="url(#rqk-grad)"></circle><circle cx="72" cy="70" r="25" fill="url(#rqk-grad)" opacity="0.92"></circle><ellipse cx="47" cy="52" rx="7" ry="10" fill="#FFFFFF" opacity="0.4" transform="rotate(-24 47 52)"></ellipse><path d="M64 36c0-6 3-10 8-12" stroke="#8B5E34" stroke-width="3" stroke-linecap="round" fill="none"></path><path d="M68 34c2-8 12-11 20-7-2 8-12 11-20 7z" fill="#3ED598"></path></svg>\n';
|
|
477
|
+
|
|
478
|
+
// src/assets/svg/art-balloon.svg
|
|
479
|
+
var art_balloon_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0.2" y1="0" x2="0.8" y2="1"><stop offset="0" stop-color="#7FB0FF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient></defs><ellipse cx="60" cy="50" rx="28" ry="32" fill="url(#rqk-grad)"></ellipse><ellipse cx="50" cy="38" rx="7" ry="9" fill="#FFFFFF" opacity="0.45"></ellipse><path d="M60 82l3 6h-6z" fill="#0147CC"></path><path d="M60 88c8 6-8 10 0 16s-8 8 0 12" stroke="#0147CC" stroke-width="2.2" fill="none" stroke-linecap="round"></path><circle cx="94" cy="30" r="4" fill="#FFD166"></circle><circle cx="22" cy="86" r="3" fill="#7C5CFF" opacity="0.6"></circle></svg>\n';
|
|
480
|
+
|
|
481
|
+
// src/assets/svg/art-books.svg
|
|
482
|
+
var art_books_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><rect x="20" y="80" width="80" height="16" rx="5" fill="#0158FD"></rect><rect x="26" y="62" width="68" height="16" rx="5" fill="#3ED598"></rect><rect x="22" y="44" width="72" height="16" rx="5" fill="#FFB020"></rect><rect x="32" y="26" width="58" height="16" rx="5" fill="#7C5CFF"></rect><path d="M34 34h54M28 52h60M32 70h56M26 88h68" stroke="#FFFFFF" stroke-width="2.4" opacity="0.35" stroke-linecap="round"></path><circle cx="88" cy="22" r="5" fill="#9CBFFF" opacity="0.7"></circle></svg>\n';
|
|
483
|
+
|
|
484
|
+
// src/assets/svg/art-cat.svg
|
|
485
|
+
var art_cat_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFC48A"></stop><stop offset="1" stop-color="#F09A4F"></stop></linearGradient></defs><path d="M36 42l-6-20 18 8zM84 42l6-20-18 8z" fill="url(#rqk-grad)"></path><circle cx="60" cy="66" r="34" fill="url(#rqk-grad)"></circle><ellipse cx="60" cy="82" rx="18" ry="13" fill="#FFF3E4"></ellipse><circle cx="48" cy="62" r="3.4" fill="#5B3A22"></circle><circle cx="72" cy="62" r="3.4" fill="#5B3A22"></circle><path d="M55 74h10l-5 5z" fill="#F08A8A"></path><path d="M56 83c1.6 1.8 6.4 1.8 8 0" stroke="#5B3A22" stroke-width="1.8" fill="none"></path><path d="M22 68h14M24 76h12M98 68h-14M96 76h-12" stroke="#E7C39F" stroke-width="2" stroke-linecap="round"></path></svg>\n';
|
|
486
|
+
|
|
487
|
+
// src/assets/svg/art-coffee.svg
|
|
488
|
+
var art_coffee_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFFFFF"></stop><stop offset="1" stop-color="#E7EEFA"></stop></linearGradient></defs><ellipse cx="58" cy="90" rx="34" ry="6" fill="#DCE6F7"></ellipse><path d="M30 50h50l-5 34c-.6 4-4 7-8 7H43c-4 0-7.4-3-8-7z" fill="url(#rqk-grad)"></path><path d="M80 58h6a9 9 0 010 18h-3" stroke="#C3D2E8" stroke-width="4" fill="none"></path><rect x="34" y="58" width="42" height="14" rx="4" fill="#D6E2F5"></rect><path d="M48 42c-4-7 4-9 0-16M62 42c-4-7 4-9 0-16" stroke="#9CBFFF" stroke-width="3" fill="none" stroke-linecap="round" opacity="0.8"></path><circle cx="88" cy="34" r="4" fill="#FFB020" opacity="0.7"></circle></svg>\n';
|
|
489
|
+
|
|
490
|
+
// src/assets/svg/art-headphones.svg
|
|
491
|
+
var art_headphones_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 186" fill="none" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad-a" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5C96FF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient><linearGradient id="rqk-grad-b" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3D7BFF"></stop><stop offset="1" stop-color="#013AA6"></stop></linearGradient></defs><ellipse cx="120" cy="162" rx="48" ry="8" fill="#0B1220" opacity="0.07"></ellipse><path d="M62 112V94c0-32 26-56 58-56s58 24 58 56v18" stroke="url(#rqk-grad-a)" stroke-width="15" stroke-linecap="round"></path><path d="M62 112V94c0-32 26-56 58-56s58 24 58 56v18" stroke="#fff" stroke-width="4" stroke-linecap="round" opacity="0.35"></path><rect x="46" y="102" width="34" height="52" rx="17" fill="url(#rqk-grad-b)"></rect><rect x="160" y="102" width="34" height="52" rx="17" fill="url(#rqk-grad-b)"></rect><rect x="54" y="112" width="18" height="32" rx="9" fill="#fff" opacity="0.25"></rect><rect x="168" y="112" width="18" height="32" rx="9" fill="#fff" opacity="0.25"></rect><g stroke="#0158FD" stroke-width="3" stroke-linecap="round" opacity="0.5"><path d="M198 74c8 6 12 14 12 22M206 62c12 9 18 21 18 34"></path></g></svg>\n';
|
|
492
|
+
|
|
493
|
+
// src/assets/svg/art-kid.svg
|
|
494
|
+
var art_kid_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#4F8BFF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient></defs><circle cx="60" cy="58" r="46" fill="#EAF1FF"></circle><path d="M22 104c0-15 17-24 38-24s38 9 38 24z" fill="url(#rqk-grad)"></path><circle cx="60" cy="52" r="25" fill="#FFD3B6"></circle><path d="M36 47c0-13 10-21 24-21s24 8 24 21c-6-4-13-6-24-6s-18 2-24 6z" fill="#1F2A44"></path><circle cx="51" cy="53" r="2.6" fill="#1F2A44"></circle><circle cx="69" cy="53" r="2.6" fill="#1F2A44"></circle><path d="M54 62c2.6 3 9.4 3 12 0" stroke="#C96A5A" stroke-width="2.4" stroke-linecap="round" fill="none"></path><circle cx="43" cy="60" r="3.4" fill="#FFB4A8" opacity="0.6"></circle><circle cx="77" cy="60" r="3.4" fill="#FFB4A8" opacity="0.6"></circle></svg>\n';
|
|
495
|
+
|
|
496
|
+
// src/assets/svg/art-screen.svg
|
|
497
|
+
var art_screen_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 186" fill="none" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad-play" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#5C96FF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient><linearGradient id="rqk-grad-screen" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#EAF2FF"></stop><stop offset="1" stop-color="#C6DBFF"></stop></linearGradient></defs><ellipse cx="120" cy="166" rx="52" ry="8" fill="#0B1220" opacity="0.07"></ellipse><rect x="42" y="32" width="156" height="104" rx="16" fill="url(#rqk-grad-screen)" stroke="#B9D0FF" stroke-width="2"></rect><rect x="52" y="42" width="136" height="84" rx="10" fill="#0B1220" opacity="0.06"></rect><circle cx="120" cy="84" r="26" fill="url(#rqk-grad-play)"></circle><path d="M113 73l20 11-20 11V73z" fill="#fff"></path><rect x="106" y="136" width="28" height="16" fill="#C6DBFF"></rect><rect x="84" y="150" width="72" height="8" rx="4" fill="#B9D0FF"></rect><g fill="#0158FD" opacity="0.5"><circle cx="62" cy="52" r="2.6"></circle><circle cx="70" cy="52" r="2.6"></circle><circle cx="78" cy="52" r="2.6"></circle></g></svg>\n';
|
|
498
|
+
|
|
499
|
+
// src/assets/svg/art-speech.svg
|
|
500
|
+
var art_speech_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#EAF1FF"></stop><stop offset="1" stop-color="#C6DBFF"></stop></linearGradient></defs><path d="M24 34h72a8 8 0 018 8v34a8 8 0 01-8 8H60l-16 14v-14H24a8 8 0 01-8-8V42a8 8 0 018-8z" fill="url(#rqk-grad)"></path><rect x="38" y="52" width="7" height="18" rx="3.5" fill="#0158FD"></rect><rect x="51" y="44" width="7" height="34" rx="3.5" fill="#4F8BFF"></rect><rect x="64" y="48" width="7" height="26" rx="3.5" fill="#4F8BFF"></rect><rect x="77" y="58" width="7" height="10" rx="3.5" fill="#9CBFFF"></rect></svg>\n';
|
|
501
|
+
|
|
502
|
+
// src/assets/svg/art-trophy.svg
|
|
503
|
+
var art_trophy_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#FFE29A"></stop><stop offset="0.55" stop-color="#FFC24B"></stop><stop offset="1" stop-color="#E08A00"></stop></linearGradient></defs><circle cx="60" cy="54" r="42" fill="#FFF7E6"></circle><path d="M38 34h44v18c0 14-9 22-22 22s-22-8-22-22z" fill="url(#rqk-grad)"></path><path d="M38 40H28v4c0 9 6 15 14 15M82 40h10v4c0 9-6 15-14 15" stroke="#E08A00" stroke-width="3.4" fill="none"></path><rect x="52" y="72" width="16" height="10" fill="#F0A600"></rect><rect x="44" y="82" width="32" height="9" rx="3" fill="#E08A00"></rect><path d="M60 44l3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1z" fill="#FFF7E6" opacity="0.9"></path><circle cx="90" cy="30" r="3.4" fill="#FFB020" opacity="0.8"></circle><circle cx="26" cy="76" r="2.6" fill="#7C5CFF" opacity="0.6"></circle></svg>\n';
|
|
504
|
+
|
|
505
|
+
// src/art/illustrations.tsx
|
|
506
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
507
|
+
var ART_SOURCES = {
|
|
508
|
+
kid: art_kid_default,
|
|
509
|
+
balloon: art_balloon_default,
|
|
510
|
+
apple: art_apple_default,
|
|
511
|
+
coffee: art_coffee_default,
|
|
512
|
+
cat: art_cat_default,
|
|
513
|
+
books: art_books_default,
|
|
514
|
+
headphones: art_headphones_default,
|
|
515
|
+
screen: art_screen_default,
|
|
516
|
+
trophy: art_trophy_default,
|
|
517
|
+
speech: art_speech_default
|
|
518
|
+
};
|
|
519
|
+
function Art({ name, className, size }) {
|
|
520
|
+
var _a;
|
|
521
|
+
const unique = (0, import_react3.useId)().replace(/[^a-zA-Z0-9]/g, "");
|
|
522
|
+
const source = ((_a = ART_SOURCES[name]) != null ? _a : art_speech_default).replace(
|
|
523
|
+
/rqk-grad/g,
|
|
524
|
+
`rqk-grad-${unique}`
|
|
525
|
+
);
|
|
526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
527
|
+
"span",
|
|
528
|
+
{
|
|
529
|
+
className: ["rqk-art", className].filter(Boolean).join(" "),
|
|
530
|
+
style: size ? { width: size, height: size } : void 0,
|
|
531
|
+
"aria-hidden": true,
|
|
532
|
+
dangerouslySetInnerHTML: { __html: source }
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// src/core/quest-config.tsx
|
|
538
|
+
var import_react4 = require("react");
|
|
539
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
540
|
+
var defaultQuestLabels = {
|
|
541
|
+
submit: "\u63D0\u4EA4\u7B54\u6848",
|
|
542
|
+
submitCount: "\u63D0\u4EA4\u7B54\u6848",
|
|
543
|
+
retry: "\u91CD\u8BD5\u4E00\u6B21",
|
|
544
|
+
next: "\u5207\u9898",
|
|
545
|
+
prev: "\u4E0A\u4E00\u9898",
|
|
546
|
+
back: "\u8FD4\u56DE",
|
|
547
|
+
answer: "\u6B63\u786E\u7B54\u6848",
|
|
548
|
+
analysis: "\u89E3\u6790",
|
|
549
|
+
correctAll: "\u5168\u90E8\u7B54\u5BF9",
|
|
550
|
+
wrongAnswer: "\u7B54\u6848\u8FD8\u4E0D\u6B63\u786E",
|
|
551
|
+
tapToRead: "\u70B9\u51FB\u6717\u8BFB",
|
|
552
|
+
readAloud: "\u8303\u8BFB",
|
|
553
|
+
recording: "\u5F55\u97F3\u4E2D",
|
|
554
|
+
scoring: "\u8BC4\u5206\u4E2D",
|
|
555
|
+
releaseToSend: "\u677E\u624B\u5373\u63D0\u4EA4",
|
|
556
|
+
holdToRecord: "\u70B9\u51FB\u5F00\u59CB\u5F55\u97F3",
|
|
557
|
+
tapToFollow: "\u70B9\u51FB\u8DDF\u8BFB",
|
|
558
|
+
recordingHint: "\u6B63\u5728\u5F55\u97F3 \xB7 \u70B9\u51FB\u7ED3\u675F",
|
|
559
|
+
rescore: "\u91CD\u65B0\u5F55\u97F3",
|
|
560
|
+
submitted: "\u5DF2\u63D0\u4EA4 \xB7 \u53EF\u91CD\u5F55",
|
|
561
|
+
noiseHint: "\u97F3\u8D28\u4E0D\u5408\u683C\uFF1A\u4E0D\u51FA\u5206\uFF0C\u8BF7\u6362\u5B89\u9759\u73AF\u5883\u91CD\u8BD5",
|
|
562
|
+
againHint: "\u672A\u83B7\u53D6\u5206\u6570\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21",
|
|
563
|
+
attemptsLeft: "\u8FD8\u6709 {n} \u6B21\u5F55\u97F3\u673A\u4F1A",
|
|
564
|
+
attemptsUsedUp: "\u673A\u4F1A\u5DF2\u7528\u5B8C",
|
|
565
|
+
play: "\u64AD\u653E",
|
|
566
|
+
pause: "\u6682\u505C",
|
|
567
|
+
replay: "\u518D\u542C\u4E00\u904D",
|
|
568
|
+
loop: "\u5FAA\u73AF",
|
|
569
|
+
speed: "\u500D\u901F",
|
|
570
|
+
finish: "\u5B8C\u6210\u5E76\u8FD4\u56DE",
|
|
571
|
+
submitAndStats: "\u63D0\u4EA4\u5E76\u67E5\u770B\u7EDF\u8BA1",
|
|
572
|
+
effectivePlay: "\u6709\u6548\u64AD\u653E",
|
|
573
|
+
totalTime: "\u603B\u65F6\u957F",
|
|
574
|
+
reading: "\u9605\u8BFB",
|
|
575
|
+
expand: "\u5C55\u5F00\u5168\u6587",
|
|
576
|
+
collapse: "\u6536\u8D77",
|
|
577
|
+
notAnswered: "\u672A\u4F5C\u7B54",
|
|
578
|
+
fullscreen: "\u5168\u5C4F"
|
|
579
|
+
};
|
|
580
|
+
var QuestConfigContext = (0, import_react4.createContext)({});
|
|
581
|
+
function QuestConfigProvider({
|
|
582
|
+
config,
|
|
583
|
+
children
|
|
584
|
+
}) {
|
|
585
|
+
const parent = (0, import_react4.useContext)(QuestConfigContext);
|
|
586
|
+
const value = (0, import_react4.useMemo)(
|
|
587
|
+
() => {
|
|
588
|
+
var _a, _b;
|
|
589
|
+
return {
|
|
590
|
+
sound: (_a = config == null ? void 0 : config.sound) != null ? _a : parent.sound,
|
|
591
|
+
speakText: (_b = config == null ? void 0 : config.speakText) != null ? _b : parent.speakText,
|
|
592
|
+
labels: __spreadValues(__spreadValues({}, parent.labels), config == null ? void 0 : config.labels)
|
|
593
|
+
};
|
|
594
|
+
},
|
|
595
|
+
[config, parent]
|
|
596
|
+
);
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(QuestConfigContext.Provider, { value, children });
|
|
598
|
+
}
|
|
599
|
+
function useQuestConfig() {
|
|
600
|
+
return (0, import_react4.useContext)(QuestConfigContext);
|
|
601
|
+
}
|
|
602
|
+
function useQuestLabels(override) {
|
|
603
|
+
const config = useQuestConfig();
|
|
604
|
+
return (0, import_react4.useMemo)(
|
|
605
|
+
() => __spreadValues(__spreadValues(__spreadValues({}, defaultQuestLabels), config.labels), override),
|
|
606
|
+
[config.labels, override]
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/primitives/action-bar.tsx
|
|
611
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
612
|
+
function ActionBar({ actions, index = 1, total, onPrev, className }) {
|
|
613
|
+
const labels = useQuestLabels();
|
|
614
|
+
const autoPrev = Boolean(onPrev) && index > 1;
|
|
615
|
+
const isLast = total !== void 0 && total > 0 && index >= total;
|
|
616
|
+
const resolved = isLast ? actions.map(
|
|
617
|
+
(action) => action.key === "next" ? __spreadProps(__spreadValues({}, action), { label: labels.finish }) : action
|
|
618
|
+
) : actions;
|
|
619
|
+
const body = autoPrev ? resolved.filter((action) => action.key !== "prev") : resolved;
|
|
620
|
+
const visibleActions = autoPrev ? [
|
|
621
|
+
{
|
|
622
|
+
key: "prev",
|
|
623
|
+
label: labels.prev,
|
|
624
|
+
variant: "ghost",
|
|
625
|
+
onClick: onPrev,
|
|
626
|
+
ariaLabel: labels.prev
|
|
627
|
+
},
|
|
628
|
+
...body
|
|
629
|
+
] : body;
|
|
630
|
+
if (!visibleActions.length) return null;
|
|
631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: classNames("rqk-action-bar flex gap-2.5", className), children: visibleActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
632
|
+
"button",
|
|
633
|
+
{
|
|
634
|
+
type: "button",
|
|
635
|
+
className: classNames(
|
|
636
|
+
"rqk-action ease-rqk-spring inline-flex h-[52px] min-w-0 items-center justify-center gap-1.5 rounded-[16px] px-[18px] text-[17px] font-semibold transition-[transform,opacity,background] duration-200 active:scale-[0.98] disabled:opacity-45 disabled:active:scale-100",
|
|
637
|
+
action.variant === "ghost" ? "rqk-action-ghost text-rqk-ink-2 flex-none bg-white" : "rqk-action-primary disabled:bg-rqk-blue-300 flex-1 bg-[linear-gradient(180deg,#2c74ff,var(--rqk-blue-500)_70%)] text-white"
|
|
638
|
+
),
|
|
639
|
+
onClick: action.onClick,
|
|
640
|
+
disabled: action.disabled,
|
|
641
|
+
"aria-label": action.ariaLabel,
|
|
642
|
+
children: [
|
|
643
|
+
action.icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "rqk-action-icon inline-flex items-center justify-center", children: action.icon }) : null,
|
|
644
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "rqk-action-label", children: action.label })
|
|
645
|
+
]
|
|
646
|
+
},
|
|
647
|
+
action.key
|
|
648
|
+
)) });
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// src/primitives/quest-complete.tsx
|
|
652
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
653
|
+
function QuestComplete({
|
|
654
|
+
total = 1,
|
|
655
|
+
index,
|
|
656
|
+
title,
|
|
657
|
+
subtitle,
|
|
658
|
+
art = "trophy",
|
|
659
|
+
stats,
|
|
660
|
+
onFinish,
|
|
661
|
+
finishLabel,
|
|
662
|
+
className
|
|
663
|
+
}) {
|
|
664
|
+
const labels = useQuestLabels();
|
|
665
|
+
const current = index != null ? index : total;
|
|
666
|
+
const statItems = stats != null ? stats : [
|
|
667
|
+
{ value: total, unit: "\u9898", label: "\u5B8C\u6210\u9898\u76EE" },
|
|
668
|
+
{ value: 100, unit: "%", label: "\u5B8C\u6210\u5EA6" }
|
|
669
|
+
];
|
|
670
|
+
const actions = [];
|
|
671
|
+
if (onFinish) {
|
|
672
|
+
actions.push({
|
|
673
|
+
key: "finish",
|
|
674
|
+
label: finishLabel != null ? finishLabel : labels.finish,
|
|
675
|
+
onClick: onFinish
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
679
|
+
QuestShell,
|
|
680
|
+
{
|
|
681
|
+
index: current,
|
|
682
|
+
total,
|
|
683
|
+
className: classNames("rqk-complete", className),
|
|
684
|
+
footer: actions.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ActionBar, { actions }) : void 0,
|
|
685
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "rqk-complete-body", children: [
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rqk-complete-art", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Art, { name: art }) }),
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rqk-complete-title", role: "heading", "aria-level": 1, children: title != null ? title : "\u9898\u5305\u5B8C\u6210\u5566" }),
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rqk-complete-subtitle", children: subtitle != null ? subtitle : `\u5171 ${total} \u9053\u9898\u5DF2\u5168\u90E8\u5B8C\u6210` }),
|
|
689
|
+
statItems.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rqk-complete-stats", "aria-label": "\u9898\u5305\u7EDF\u8BA1", children: statItems.map((stat, statIndex) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "rqk-complete-stat", children: [
|
|
690
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "rqk-complete-stat-value", children: [
|
|
691
|
+
stat.value,
|
|
692
|
+
stat.unit ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { children: stat.unit }) : null
|
|
693
|
+
] }),
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rqk-complete-stat-label", children: stat.label })
|
|
695
|
+
] }, statIndex)) }) : null
|
|
696
|
+
] })
|
|
697
|
+
}
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
|
|
458
701
|
// src/core/icons.tsx
|
|
459
702
|
var import_classnames2 = __toESM(require("classnames"));
|
|
460
703
|
|
|
@@ -489,7 +732,7 @@ var icon_play_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="n
|
|
|
489
732
|
var icon_speaker_default = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M4 9.6h3.2L12 5.4v13.2L7.2 14.4H4z" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"></path><path d="M15.6 9.2a4 4 0 010 5.6M18.2 6.8a7.4 7.4 0 010 10.4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path></svg>\n';
|
|
490
733
|
|
|
491
734
|
// src/core/icons.tsx
|
|
492
|
-
var
|
|
735
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
493
736
|
function SvgIcon(_a) {
|
|
494
737
|
var _b = _a, {
|
|
495
738
|
source,
|
|
@@ -503,7 +746,7 @@ function SvgIcon(_a) {
|
|
|
503
746
|
"style"
|
|
504
747
|
]);
|
|
505
748
|
const html = size ? source.replace("<svg", '<svg style="width:100%;height:100%"') : source;
|
|
506
|
-
return /* @__PURE__ */ (0,
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
507
750
|
"span",
|
|
508
751
|
__spreadProps(__spreadValues({
|
|
509
752
|
className: (0, import_classnames2.default)("rqk-icon", className),
|
|
@@ -515,38 +758,38 @@ function SvgIcon(_a) {
|
|
|
515
758
|
);
|
|
516
759
|
}
|
|
517
760
|
function CheckIcon(props) {
|
|
518
|
-
return /* @__PURE__ */ (0,
|
|
761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_check_default }, props));
|
|
519
762
|
}
|
|
520
763
|
function CrossIcon(props) {
|
|
521
|
-
return /* @__PURE__ */ (0,
|
|
764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_cross_default }, props));
|
|
522
765
|
}
|
|
523
766
|
function AlertIcon(props) {
|
|
524
|
-
return /* @__PURE__ */ (0,
|
|
767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_alert_default }, props));
|
|
525
768
|
}
|
|
526
769
|
function PlayIcon(props) {
|
|
527
|
-
return /* @__PURE__ */ (0,
|
|
770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_play_default }, props));
|
|
528
771
|
}
|
|
529
772
|
function PauseIcon(props) {
|
|
530
|
-
return /* @__PURE__ */ (0,
|
|
773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_pause_default }, props));
|
|
531
774
|
}
|
|
532
775
|
function MicIcon(props) {
|
|
533
|
-
return /* @__PURE__ */ (0,
|
|
776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_mic_default }, props));
|
|
534
777
|
}
|
|
535
778
|
function SpeakerIcon(props) {
|
|
536
|
-
return /* @__PURE__ */ (0,
|
|
779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_speaker_default }, props));
|
|
537
780
|
}
|
|
538
781
|
function LoopIcon(props) {
|
|
539
|
-
return /* @__PURE__ */ (0,
|
|
782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_loop_default }, props));
|
|
540
783
|
}
|
|
541
784
|
function FullscreenIcon(props) {
|
|
542
|
-
return /* @__PURE__ */ (0,
|
|
785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_fullscreen_default }, props));
|
|
543
786
|
}
|
|
544
787
|
function KeyboardIcon(props) {
|
|
545
|
-
return /* @__PURE__ */ (0,
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SvgIcon, __spreadValues({ source: icon_keyboard_default }, props));
|
|
546
789
|
}
|
|
547
790
|
|
|
548
791
|
// src/primitives/option-item.tsx
|
|
549
|
-
var
|
|
792
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
550
793
|
function OptionItem({
|
|
551
794
|
label,
|
|
552
795
|
children,
|
|
@@ -560,7 +803,7 @@ function OptionItem({
|
|
|
560
803
|
className
|
|
561
804
|
}) {
|
|
562
805
|
const marked = state === "correct" || state === "wrong";
|
|
563
|
-
return /* @__PURE__ */ (0,
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
564
807
|
"button",
|
|
565
808
|
{
|
|
566
809
|
type: "button",
|
|
@@ -574,21 +817,21 @@ function OptionItem({
|
|
|
574
817
|
disabled: disabled || state === "disabled",
|
|
575
818
|
"aria-pressed": state === "selected",
|
|
576
819
|
children: [
|
|
577
|
-
/* @__PURE__ */ (0,
|
|
578
|
-
media ? /* @__PURE__ */ (0,
|
|
579
|
-
/* @__PURE__ */ (0,
|
|
580
|
-
/* @__PURE__ */ (0,
|
|
581
|
-
sub ? /* @__PURE__ */ (0,
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "rqk-option-marker", children: label }),
|
|
821
|
+
media ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "rqk-option-media", children: media }) : null,
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "rqk-option-content", children: [
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "rqk-option-text", children }),
|
|
824
|
+
sub ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "rqk-option-sub", children: sub }) : null
|
|
582
825
|
] }),
|
|
583
|
-
audioIndicator ? /* @__PURE__ */ (0,
|
|
584
|
-
marked ? /* @__PURE__ */ (0,
|
|
826
|
+
audioIndicator ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "rqk-option-audio", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpeakerIcon, { size: 16 }) }) : null,
|
|
827
|
+
marked ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "rqk-option-status", "aria-hidden": true, children: state === "correct" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CrossIcon, { size: 18 }) }) : null
|
|
585
828
|
]
|
|
586
829
|
}
|
|
587
830
|
);
|
|
588
831
|
}
|
|
589
832
|
|
|
590
833
|
// src/primitives/star-rating.tsx
|
|
591
|
-
var
|
|
834
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
592
835
|
function StarRating({
|
|
593
836
|
value,
|
|
594
837
|
size = 18,
|
|
@@ -597,13 +840,13 @@ function StarRating({
|
|
|
597
840
|
label
|
|
598
841
|
}) {
|
|
599
842
|
const count = Math.max(0, Math.min(3, value));
|
|
600
|
-
return /* @__PURE__ */ (0,
|
|
843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
601
844
|
"span",
|
|
602
845
|
{
|
|
603
846
|
className: classNames("rqk-stars", className),
|
|
604
847
|
role: "img",
|
|
605
848
|
"aria-label": label != null ? label : `${count} / 3`,
|
|
606
|
-
children: [0, 1, 2].map((index) => /* @__PURE__ */ (0,
|
|
849
|
+
children: [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
607
850
|
"span",
|
|
608
851
|
{
|
|
609
852
|
className: classNames(
|
|
@@ -612,7 +855,7 @@ function StarRating({
|
|
|
612
855
|
animate && index < count && "rqk-star-animate"
|
|
613
856
|
),
|
|
614
857
|
style: { animationDelay: `${index * 0.08}s`, fontSize: `${size}px` },
|
|
615
|
-
children: /* @__PURE__ */ (0,
|
|
858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rqk-star-glyph", "aria-hidden": "true", children: "\u2605" })
|
|
616
859
|
},
|
|
617
860
|
index
|
|
618
861
|
))
|
|
@@ -621,11 +864,11 @@ function StarRating({
|
|
|
621
864
|
}
|
|
622
865
|
|
|
623
866
|
// src/primitives/feedback-sheet.tsx
|
|
624
|
-
var
|
|
867
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
625
868
|
var TONE_ICONS = {
|
|
626
|
-
ok: /* @__PURE__ */ (0,
|
|
627
|
-
bad: /* @__PURE__ */ (0,
|
|
628
|
-
warn: /* @__PURE__ */ (0,
|
|
869
|
+
ok: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CheckIcon, { size: 18 }),
|
|
870
|
+
bad: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CrossIcon, { size: 16 }),
|
|
871
|
+
warn: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AlertIcon, { size: 18 })
|
|
629
872
|
};
|
|
630
873
|
function FeedbackSheet({
|
|
631
874
|
tone = "ok",
|
|
@@ -638,28 +881,28 @@ function FeedbackSheet({
|
|
|
638
881
|
analysisLabel = "\u89E3\u6790",
|
|
639
882
|
className
|
|
640
883
|
}) {
|
|
641
|
-
return /* @__PURE__ */ (0,
|
|
884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
642
885
|
"div",
|
|
643
886
|
{
|
|
644
887
|
className: classNames("rqk-feedback", `rqk-feedback-${tone}`, className),
|
|
645
888
|
role: "status",
|
|
646
889
|
"aria-live": "polite",
|
|
647
890
|
children: [
|
|
648
|
-
/* @__PURE__ */ (0,
|
|
649
|
-
/* @__PURE__ */ (0,
|
|
650
|
-
/* @__PURE__ */ (0,
|
|
651
|
-
/* @__PURE__ */ (0,
|
|
652
|
-
detail ? /* @__PURE__ */ (0,
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "rqk-feedback-head", children: [
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "rqk-feedback-icon", "aria-hidden": true, children: TONE_ICONS[tone] }),
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "rqk-feedback-copy", children: [
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rqk-feedback-title", children: title }),
|
|
895
|
+
detail ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rqk-feedback-detail", children: detail }) : null
|
|
653
896
|
] }),
|
|
654
|
-
typeof stars === "number" ? /* @__PURE__ */ (0,
|
|
897
|
+
typeof stars === "number" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StarRating, { value: stars, size: 16, animate: true }) : null
|
|
655
898
|
] }),
|
|
656
|
-
answer ? /* @__PURE__ */ (0,
|
|
657
|
-
/* @__PURE__ */ (0,
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
899
|
+
answer ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "rqk-feedback-answer", children: [
|
|
900
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "rqk-feedback-answer-label", children: answerLabel }),
|
|
901
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "rqk-feedback-answer-value", children: answer })
|
|
659
902
|
] }) : null,
|
|
660
|
-
analysis ? /* @__PURE__ */ (0,
|
|
661
|
-
/* @__PURE__ */ (0,
|
|
662
|
-
/* @__PURE__ */ (0,
|
|
903
|
+
analysis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "rqk-feedback-analysis", children: [
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "rqk-feedback-analysis-label", children: analysisLabel }),
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: analysis })
|
|
663
906
|
] }) : null
|
|
664
907
|
]
|
|
665
908
|
}
|
|
@@ -667,8 +910,8 @@ function FeedbackSheet({
|
|
|
667
910
|
}
|
|
668
911
|
|
|
669
912
|
// src/primitives/segmented-control.tsx
|
|
670
|
-
var
|
|
671
|
-
var
|
|
913
|
+
var import_react5 = require("react");
|
|
914
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
672
915
|
function SegmentedControl({
|
|
673
916
|
options,
|
|
674
917
|
value,
|
|
@@ -677,10 +920,10 @@ function SegmentedControl({
|
|
|
677
920
|
disabled,
|
|
678
921
|
className
|
|
679
922
|
}) {
|
|
680
|
-
const rootRef = (0,
|
|
681
|
-
const mountedRef = (0,
|
|
682
|
-
const [thumb, setThumb] = (0,
|
|
683
|
-
(0,
|
|
923
|
+
const rootRef = (0, import_react5.useRef)(null);
|
|
924
|
+
const mountedRef = (0, import_react5.useRef)(false);
|
|
925
|
+
const [thumb, setThumb] = (0, import_react5.useState)({ x: 0, width: 0, ready: false });
|
|
926
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
684
927
|
const root = rootRef.current;
|
|
685
928
|
if (!root) return;
|
|
686
929
|
const active = root.querySelector('[data-active="true"]');
|
|
@@ -695,13 +938,11 @@ function SegmentedControl({
|
|
|
695
938
|
return current.x === next.x && current.width === next.width && current.ready ? current : next;
|
|
696
939
|
});
|
|
697
940
|
};
|
|
698
|
-
let timer;
|
|
699
941
|
if (!mountedRef.current) {
|
|
700
942
|
mountedRef.current = true;
|
|
701
943
|
sync();
|
|
702
|
-
} else {
|
|
703
|
-
timer = setTimeout(sync, 0);
|
|
704
944
|
}
|
|
945
|
+
const timer = setTimeout(sync, 0);
|
|
705
946
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(sync);
|
|
706
947
|
observer == null ? void 0 : observer.observe(root);
|
|
707
948
|
if (active) observer == null ? void 0 : observer.observe(active);
|
|
@@ -714,9 +955,10 @@ function SegmentedControl({
|
|
|
714
955
|
}, [value, options.length]);
|
|
715
956
|
const thumbStyle = {
|
|
716
957
|
"--rqk-seg-x": `${thumb.x}px`,
|
|
717
|
-
"--rqk-seg-w": `${thumb.width}px
|
|
958
|
+
"--rqk-seg-w": `${thumb.width}px`,
|
|
959
|
+
opacity: thumb.ready ? 1 : 0
|
|
718
960
|
};
|
|
719
|
-
return /* @__PURE__ */ (0,
|
|
961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
720
962
|
"div",
|
|
721
963
|
{
|
|
722
964
|
ref: rootRef,
|
|
@@ -725,10 +967,10 @@ function SegmentedControl({
|
|
|
725
967
|
"aria-label": ariaLabel,
|
|
726
968
|
"data-ready": thumb.ready,
|
|
727
969
|
children: [
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "rqk-segmented-thumb", style: thumbStyle, "aria-hidden": "true" }),
|
|
729
971
|
options.map((option) => {
|
|
730
972
|
const active = option.value === value;
|
|
731
|
-
return /* @__PURE__ */ (0,
|
|
973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
732
974
|
"button",
|
|
733
975
|
{
|
|
734
976
|
type: "button",
|
|
@@ -748,116 +990,6 @@ function SegmentedControl({
|
|
|
748
990
|
);
|
|
749
991
|
}
|
|
750
992
|
|
|
751
|
-
// src/core/quest-config.tsx
|
|
752
|
-
var import_react4 = require("react");
|
|
753
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
754
|
-
var defaultQuestLabels = {
|
|
755
|
-
submit: "\u63D0\u4EA4\u7B54\u6848",
|
|
756
|
-
submitCount: "\u63D0\u4EA4\u7B54\u6848",
|
|
757
|
-
retry: "\u91CD\u8BD5\u4E00\u6B21",
|
|
758
|
-
next: "\u5207\u9898",
|
|
759
|
-
prev: "\u4E0A\u4E00\u9898",
|
|
760
|
-
back: "\u8FD4\u56DE",
|
|
761
|
-
answer: "\u6B63\u786E\u7B54\u6848",
|
|
762
|
-
analysis: "\u89E3\u6790",
|
|
763
|
-
correctAll: "\u5168\u90E8\u7B54\u5BF9",
|
|
764
|
-
wrongAnswer: "\u7B54\u6848\u8FD8\u4E0D\u6B63\u786E",
|
|
765
|
-
tapToRead: "\u70B9\u51FB\u6717\u8BFB",
|
|
766
|
-
readAloud: "\u8303\u8BFB",
|
|
767
|
-
recording: "\u5F55\u97F3\u4E2D",
|
|
768
|
-
scoring: "\u8BC4\u5206\u4E2D",
|
|
769
|
-
releaseToSend: "\u677E\u624B\u5373\u63D0\u4EA4",
|
|
770
|
-
holdToRecord: "\u70B9\u51FB\u5F00\u59CB\u5F55\u97F3",
|
|
771
|
-
tapToFollow: "\u70B9\u51FB\u8DDF\u8BFB",
|
|
772
|
-
recordingHint: "\u6B63\u5728\u5F55\u97F3 \xB7 \u70B9\u51FB\u7ED3\u675F",
|
|
773
|
-
rescore: "\u91CD\u65B0\u5F55\u97F3",
|
|
774
|
-
submitted: "\u5DF2\u63D0\u4EA4 \xB7 \u53EF\u91CD\u5F55",
|
|
775
|
-
noiseHint: "\u97F3\u8D28\u4E0D\u5408\u683C\uFF1A\u4E0D\u51FA\u5206\uFF0C\u8BF7\u6362\u5B89\u9759\u73AF\u5883\u91CD\u8BD5",
|
|
776
|
-
againHint: "\u672A\u83B7\u53D6\u5206\u6570\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21",
|
|
777
|
-
attemptsLeft: "\u8FD8\u6709 {n} \u6B21\u5F55\u97F3\u673A\u4F1A",
|
|
778
|
-
attemptsUsedUp: "\u673A\u4F1A\u5DF2\u7528\u5B8C",
|
|
779
|
-
play: "\u64AD\u653E",
|
|
780
|
-
pause: "\u6682\u505C",
|
|
781
|
-
replay: "\u518D\u542C\u4E00\u904D",
|
|
782
|
-
loop: "\u5FAA\u73AF",
|
|
783
|
-
speed: "\u500D\u901F",
|
|
784
|
-
finish: "\u5B8C\u6210\u5E76\u8FD4\u56DE",
|
|
785
|
-
submitAndStats: "\u63D0\u4EA4\u5E76\u67E5\u770B\u7EDF\u8BA1",
|
|
786
|
-
effectivePlay: "\u6709\u6548\u64AD\u653E",
|
|
787
|
-
totalTime: "\u603B\u65F6\u957F",
|
|
788
|
-
reading: "\u9605\u8BFB",
|
|
789
|
-
expand: "\u5C55\u5F00\u5168\u6587",
|
|
790
|
-
collapse: "\u6536\u8D77",
|
|
791
|
-
notAnswered: "\u672A\u4F5C\u7B54",
|
|
792
|
-
fullscreen: "\u5168\u5C4F"
|
|
793
|
-
};
|
|
794
|
-
var QuestConfigContext = (0, import_react4.createContext)({});
|
|
795
|
-
function QuestConfigProvider({
|
|
796
|
-
config,
|
|
797
|
-
children
|
|
798
|
-
}) {
|
|
799
|
-
const parent = (0, import_react4.useContext)(QuestConfigContext);
|
|
800
|
-
const value = (0, import_react4.useMemo)(
|
|
801
|
-
() => {
|
|
802
|
-
var _a, _b;
|
|
803
|
-
return {
|
|
804
|
-
sound: (_a = config == null ? void 0 : config.sound) != null ? _a : parent.sound,
|
|
805
|
-
speakText: (_b = config == null ? void 0 : config.speakText) != null ? _b : parent.speakText,
|
|
806
|
-
labels: __spreadValues(__spreadValues({}, parent.labels), config == null ? void 0 : config.labels)
|
|
807
|
-
};
|
|
808
|
-
},
|
|
809
|
-
[config, parent]
|
|
810
|
-
);
|
|
811
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(QuestConfigContext.Provider, { value, children });
|
|
812
|
-
}
|
|
813
|
-
function useQuestConfig() {
|
|
814
|
-
return (0, import_react4.useContext)(QuestConfigContext);
|
|
815
|
-
}
|
|
816
|
-
function useQuestLabels(override) {
|
|
817
|
-
const config = useQuestConfig();
|
|
818
|
-
return (0, import_react4.useMemo)(
|
|
819
|
-
() => __spreadValues(__spreadValues(__spreadValues({}, defaultQuestLabels), config.labels), override),
|
|
820
|
-
[config.labels, override]
|
|
821
|
-
);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
// src/primitives/action-bar.tsx
|
|
825
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
826
|
-
function ActionBar({ actions, index = 1, onPrev, className }) {
|
|
827
|
-
const labels = useQuestLabels();
|
|
828
|
-
const autoPrev = Boolean(onPrev) && index > 1;
|
|
829
|
-
const body = autoPrev ? actions.filter((action) => action.key !== "prev") : actions;
|
|
830
|
-
const visibleActions = autoPrev ? [
|
|
831
|
-
{
|
|
832
|
-
key: "prev",
|
|
833
|
-
label: labels.prev,
|
|
834
|
-
variant: "ghost",
|
|
835
|
-
onClick: onPrev,
|
|
836
|
-
ariaLabel: labels.prev
|
|
837
|
-
},
|
|
838
|
-
...body
|
|
839
|
-
] : body;
|
|
840
|
-
if (!visibleActions.length) return null;
|
|
841
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: classNames("rqk-action-bar flex gap-2.5", className), children: visibleActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
842
|
-
"button",
|
|
843
|
-
{
|
|
844
|
-
type: "button",
|
|
845
|
-
className: classNames(
|
|
846
|
-
"rqk-action ease-rqk-spring inline-flex h-[52px] min-w-0 items-center justify-center gap-1.5 rounded-[16px] px-[18px] text-[17px] font-semibold transition-[transform,opacity,background] duration-200 active:scale-[0.98] disabled:opacity-45 disabled:active:scale-100",
|
|
847
|
-
action.variant === "ghost" ? "rqk-action-ghost text-rqk-ink-2 flex-none bg-white" : "rqk-action-primary disabled:bg-rqk-blue-300 flex-1 bg-[linear-gradient(180deg,#2c74ff,var(--rqk-blue-500)_70%)] text-white"
|
|
848
|
-
),
|
|
849
|
-
onClick: action.onClick,
|
|
850
|
-
disabled: action.disabled,
|
|
851
|
-
"aria-label": action.ariaLabel,
|
|
852
|
-
children: [
|
|
853
|
-
action.icon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rqk-action-icon inline-flex items-center justify-center", children: action.icon }) : null,
|
|
854
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rqk-action-label", children: action.label })
|
|
855
|
-
]
|
|
856
|
-
},
|
|
857
|
-
action.key
|
|
858
|
-
)) });
|
|
859
|
-
}
|
|
860
|
-
|
|
861
993
|
// src/questions/single-choice/actions.ts
|
|
862
994
|
function singleChoiceActions({
|
|
863
995
|
readonly,
|
|
@@ -887,7 +1019,7 @@ function singleChoiceActions({
|
|
|
887
1019
|
}
|
|
888
1020
|
|
|
889
1021
|
// src/questions/single-choice/feedback.tsx
|
|
890
|
-
var
|
|
1022
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
891
1023
|
function SingleChoiceFeedback({
|
|
892
1024
|
readonly,
|
|
893
1025
|
phase,
|
|
@@ -896,7 +1028,7 @@ function SingleChoiceFeedback({
|
|
|
896
1028
|
answerLabel
|
|
897
1029
|
}) {
|
|
898
1030
|
if (readonly) {
|
|
899
|
-
return /* @__PURE__ */ (0,
|
|
1031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
900
1032
|
FeedbackSheet,
|
|
901
1033
|
{
|
|
902
1034
|
tone: "ok",
|
|
@@ -908,10 +1040,10 @@ function SingleChoiceFeedback({
|
|
|
908
1040
|
);
|
|
909
1041
|
}
|
|
910
1042
|
if (phase === "retry") {
|
|
911
|
-
return /* @__PURE__ */ (0,
|
|
1043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FeedbackSheet, { tone: "bad", title: labels.wrongAnswer, detail: "\u518D\u68C0\u67E5\u4E00\u6B21\uFF0C\u8FD8\u6709\u4E00\u6B21\u673A\u4F1A" });
|
|
912
1044
|
}
|
|
913
1045
|
if (phase === "correct") {
|
|
914
|
-
return /* @__PURE__ */ (0,
|
|
1046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
915
1047
|
FeedbackSheet,
|
|
916
1048
|
{
|
|
917
1049
|
tone: "ok",
|
|
@@ -922,7 +1054,7 @@ function SingleChoiceFeedback({
|
|
|
922
1054
|
);
|
|
923
1055
|
}
|
|
924
1056
|
if (phase === "locked") {
|
|
925
|
-
return /* @__PURE__ */ (0,
|
|
1057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
926
1058
|
FeedbackSheet,
|
|
927
1059
|
{
|
|
928
1060
|
tone: "bad",
|
|
@@ -954,7 +1086,7 @@ function matchesAny(value, answers) {
|
|
|
954
1086
|
}
|
|
955
1087
|
|
|
956
1088
|
// src/questions/single-choice/option-list.tsx
|
|
957
|
-
var
|
|
1089
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
958
1090
|
function SingleChoiceOptions({
|
|
959
1091
|
data,
|
|
960
1092
|
canPick,
|
|
@@ -962,7 +1094,7 @@ function SingleChoiceOptions({
|
|
|
962
1094
|
onPick
|
|
963
1095
|
}) {
|
|
964
1096
|
const hasImages = data.options.some((option) => option.image);
|
|
965
|
-
return /* @__PURE__ */ (0,
|
|
1097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: classNames("rqk-option-list", hasImages && "rqk-option-list-grid"), children: data.options.map((option, optionIndex) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
966
1098
|
OptionItem,
|
|
967
1099
|
{
|
|
968
1100
|
label: optionLetter(optionIndex),
|
|
@@ -970,7 +1102,7 @@ function SingleChoiceOptions({
|
|
|
970
1102
|
state: stateOf(optionIndex),
|
|
971
1103
|
layout: hasImages ? "grid" : "row",
|
|
972
1104
|
disabled: !canPick,
|
|
973
|
-
media: option.image ? /* @__PURE__ */ (0,
|
|
1105
|
+
media: option.image ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { className: "rqk-option-image", src: option.image, alt: "" }) : void 0,
|
|
974
1106
|
audioIndicator: Boolean(option.audio || option.speak),
|
|
975
1107
|
onClick: () => onPick(optionIndex),
|
|
976
1108
|
children: option.text
|
|
@@ -980,9 +1112,9 @@ function SingleChoiceOptions({
|
|
|
980
1112
|
}
|
|
981
1113
|
|
|
982
1114
|
// src/primitives/card.tsx
|
|
983
|
-
var
|
|
1115
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
984
1116
|
function Card({ children, flush, tint, className }) {
|
|
985
|
-
return /* @__PURE__ */ (0,
|
|
1117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
986
1118
|
"div",
|
|
987
1119
|
{
|
|
988
1120
|
className: classNames(
|
|
@@ -997,10 +1129,10 @@ function Card({ children, flush, tint, className }) {
|
|
|
997
1129
|
}
|
|
998
1130
|
|
|
999
1131
|
// src/primitives/audio-bar.tsx
|
|
1000
|
-
var
|
|
1132
|
+
var import_react7 = require("react");
|
|
1001
1133
|
|
|
1002
1134
|
// src/core/use-media-progress.ts
|
|
1003
|
-
var
|
|
1135
|
+
var import_react6 = require("react");
|
|
1004
1136
|
var TICK_MS = 100;
|
|
1005
1137
|
function clamp(value, min, max) {
|
|
1006
1138
|
return Math.min(max, Math.max(min, value));
|
|
@@ -1017,21 +1149,21 @@ function useMediaProgress({
|
|
|
1017
1149
|
threshold = 0.9,
|
|
1018
1150
|
speed: initialSpeed = 1
|
|
1019
1151
|
}) {
|
|
1020
|
-
const [position, setPosition] = (0,
|
|
1021
|
-
const [credited, setCredited] = (0,
|
|
1022
|
-
const [playing, setPlaying] = (0,
|
|
1023
|
-
const [finished, setFinished] = (0,
|
|
1024
|
-
const [speed, setSpeedState] = (0,
|
|
1025
|
-
const [loop, setLoopState] = (0,
|
|
1026
|
-
const [timeOnTask, setTimeOnTask] = (0,
|
|
1027
|
-
const mediaRef = (0,
|
|
1028
|
-
const positionRef = (0,
|
|
1029
|
-
const creditedRef = (0,
|
|
1030
|
-
const lastTimeRef = (0,
|
|
1031
|
-
const playingRef = (0,
|
|
1032
|
-
const loopRef = (0,
|
|
1033
|
-
const speedRef = (0,
|
|
1034
|
-
const applyCredited = (0,
|
|
1152
|
+
const [position, setPosition] = (0, import_react6.useState)(0);
|
|
1153
|
+
const [credited, setCredited] = (0, import_react6.useState)(0);
|
|
1154
|
+
const [playing, setPlaying] = (0, import_react6.useState)(false);
|
|
1155
|
+
const [finished, setFinished] = (0, import_react6.useState)(false);
|
|
1156
|
+
const [speed, setSpeedState] = (0, import_react6.useState)(initialSpeed);
|
|
1157
|
+
const [loop, setLoopState] = (0, import_react6.useState)(false);
|
|
1158
|
+
const [timeOnTask, setTimeOnTask] = (0, import_react6.useState)(0);
|
|
1159
|
+
const mediaRef = (0, import_react6.useRef)(null);
|
|
1160
|
+
const positionRef = (0, import_react6.useRef)(0);
|
|
1161
|
+
const creditedRef = (0, import_react6.useRef)(0);
|
|
1162
|
+
const lastTimeRef = (0, import_react6.useRef)(0);
|
|
1163
|
+
const playingRef = (0, import_react6.useRef)(false);
|
|
1164
|
+
const loopRef = (0, import_react6.useRef)(false);
|
|
1165
|
+
const speedRef = (0, import_react6.useRef)(initialSpeed);
|
|
1166
|
+
const applyCredited = (0, import_react6.useCallback)(
|
|
1035
1167
|
(next) => {
|
|
1036
1168
|
const capped = clamp(next, 0, Math.max(duration, 0));
|
|
1037
1169
|
creditedRef.current = capped;
|
|
@@ -1039,7 +1171,7 @@ function useMediaProgress({
|
|
|
1039
1171
|
},
|
|
1040
1172
|
[duration]
|
|
1041
1173
|
);
|
|
1042
|
-
const applyPosition = (0,
|
|
1174
|
+
const applyPosition = (0, import_react6.useCallback)(
|
|
1043
1175
|
(next) => {
|
|
1044
1176
|
const capped = clamp(next, 0, Math.max(duration, 0));
|
|
1045
1177
|
positionRef.current = capped;
|
|
@@ -1048,7 +1180,7 @@ function useMediaProgress({
|
|
|
1048
1180
|
},
|
|
1049
1181
|
[duration]
|
|
1050
1182
|
);
|
|
1051
|
-
const play = (0,
|
|
1183
|
+
const play = (0, import_react6.useCallback)(() => {
|
|
1052
1184
|
if (playingRef.current) return;
|
|
1053
1185
|
if (positionRef.current >= duration) {
|
|
1054
1186
|
applyPosition(0);
|
|
@@ -1060,17 +1192,17 @@ function useMediaProgress({
|
|
|
1060
1192
|
void mediaRef.current.play().catch(() => void 0);
|
|
1061
1193
|
}
|
|
1062
1194
|
}, [applyPosition, duration]);
|
|
1063
|
-
const pause = (0,
|
|
1195
|
+
const pause = (0, import_react6.useCallback)(() => {
|
|
1064
1196
|
if (!playingRef.current) return;
|
|
1065
1197
|
playingRef.current = false;
|
|
1066
1198
|
setPlaying(false);
|
|
1067
1199
|
if (mediaRef.current) mediaRef.current.pause();
|
|
1068
1200
|
}, []);
|
|
1069
|
-
const toggle = (0,
|
|
1201
|
+
const toggle = (0, import_react6.useCallback)(() => {
|
|
1070
1202
|
if (playingRef.current) pause();
|
|
1071
1203
|
else play();
|
|
1072
1204
|
}, [pause, play]);
|
|
1073
|
-
const seek = (0,
|
|
1205
|
+
const seek = (0, import_react6.useCallback)(
|
|
1074
1206
|
(seconds) => {
|
|
1075
1207
|
applyPosition(seconds);
|
|
1076
1208
|
if (seconds < duration) setFinished(false);
|
|
@@ -1078,17 +1210,17 @@ function useMediaProgress({
|
|
|
1078
1210
|
},
|
|
1079
1211
|
[applyPosition, duration]
|
|
1080
1212
|
);
|
|
1081
|
-
const setSpeed = (0,
|
|
1213
|
+
const setSpeed = (0, import_react6.useCallback)((next) => {
|
|
1082
1214
|
speedRef.current = next;
|
|
1083
1215
|
setSpeedState(next);
|
|
1084
1216
|
if (mediaRef.current) mediaRef.current.playbackRate = next;
|
|
1085
1217
|
}, []);
|
|
1086
|
-
const setLoop = (0,
|
|
1218
|
+
const setLoop = (0, import_react6.useCallback)((next) => {
|
|
1087
1219
|
loopRef.current = next;
|
|
1088
1220
|
setLoopState(next);
|
|
1089
1221
|
if (mediaRef.current) mediaRef.current.loop = next;
|
|
1090
1222
|
}, []);
|
|
1091
|
-
const reset = (0,
|
|
1223
|
+
const reset = (0, import_react6.useCallback)(() => {
|
|
1092
1224
|
playingRef.current = false;
|
|
1093
1225
|
setPlaying(false);
|
|
1094
1226
|
applyPosition(0);
|
|
@@ -1100,7 +1232,7 @@ function useMediaProgress({
|
|
|
1100
1232
|
mediaRef.current.currentTime = 0;
|
|
1101
1233
|
}
|
|
1102
1234
|
}, [applyCredited, applyPosition]);
|
|
1103
|
-
(0,
|
|
1235
|
+
(0, import_react6.useEffect)(() => {
|
|
1104
1236
|
if (src || !playing) return void 0;
|
|
1105
1237
|
const timer = window.setInterval(() => {
|
|
1106
1238
|
if (!playingRef.current) return;
|
|
@@ -1126,7 +1258,7 @@ function useMediaProgress({
|
|
|
1126
1258
|
}, TICK_MS);
|
|
1127
1259
|
return () => window.clearInterval(timer);
|
|
1128
1260
|
}, [applyCredited, applyPosition, duration, playing, src]);
|
|
1129
|
-
(0,
|
|
1261
|
+
(0, import_react6.useEffect)(() => {
|
|
1130
1262
|
const media = mediaRef.current;
|
|
1131
1263
|
if (!media || !src) return void 0;
|
|
1132
1264
|
media.playbackRate = speedRef.current;
|
|
@@ -1191,7 +1323,7 @@ function useMediaProgress({
|
|
|
1191
1323
|
}
|
|
1192
1324
|
|
|
1193
1325
|
// src/primitives/audio-bar.tsx
|
|
1194
|
-
var
|
|
1326
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1195
1327
|
var WAVE_BARS = [
|
|
1196
1328
|
10,
|
|
1197
1329
|
16,
|
|
@@ -1238,30 +1370,30 @@ function AudioBar({
|
|
|
1238
1370
|
compact,
|
|
1239
1371
|
className
|
|
1240
1372
|
}) {
|
|
1241
|
-
const audioRef = (0,
|
|
1242
|
-
const [internalPlaying, setInternalPlaying] = (0,
|
|
1243
|
-
const [position, setPosition] = (0,
|
|
1244
|
-
const [sourceDuration, setSourceDuration] = (0,
|
|
1373
|
+
const audioRef = (0, import_react7.useRef)(null);
|
|
1374
|
+
const [internalPlaying, setInternalPlaying] = (0, import_react7.useState)(false);
|
|
1375
|
+
const [position, setPosition] = (0, import_react7.useState)(0);
|
|
1376
|
+
const [sourceDuration, setSourceDuration] = (0, import_react7.useState)(null);
|
|
1245
1377
|
const isPlaying = playing != null ? playing : internalPlaying;
|
|
1246
1378
|
const setPlaying = (next) => {
|
|
1247
1379
|
if (playing === void 0) setInternalPlaying(next);
|
|
1248
1380
|
onPlayingChange == null ? void 0 : onPlayingChange(next);
|
|
1249
1381
|
};
|
|
1250
|
-
(0,
|
|
1382
|
+
(0, import_react7.useEffect)(() => {
|
|
1251
1383
|
if (src || !isPlaying) return void 0;
|
|
1252
1384
|
const timer = window.setInterval(() => {
|
|
1253
1385
|
setPosition((value) => value + 0.1);
|
|
1254
1386
|
}, 100);
|
|
1255
1387
|
return () => window.clearInterval(timer);
|
|
1256
1388
|
}, [isPlaying, src]);
|
|
1257
|
-
(0,
|
|
1389
|
+
(0, import_react7.useEffect)(() => {
|
|
1258
1390
|
if (src || !isPlaying) return;
|
|
1259
1391
|
if (position >= duration) {
|
|
1260
1392
|
setPlaying(false);
|
|
1261
1393
|
setPosition(0);
|
|
1262
1394
|
}
|
|
1263
1395
|
}, [duration, isPlaying, position, src]);
|
|
1264
|
-
(0,
|
|
1396
|
+
(0, import_react7.useEffect)(() => {
|
|
1265
1397
|
const audio = audioRef.current;
|
|
1266
1398
|
if (!audio || !src) return void 0;
|
|
1267
1399
|
const onTime = () => setPosition(audio.currentTime);
|
|
@@ -1307,7 +1439,7 @@ function AudioBar({
|
|
|
1307
1439
|
}
|
|
1308
1440
|
};
|
|
1309
1441
|
const total = src ? sourceDuration != null ? sourceDuration : duration : duration;
|
|
1310
|
-
return /* @__PURE__ */ (0,
|
|
1442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1311
1443
|
"div",
|
|
1312
1444
|
{
|
|
1313
1445
|
className: classNames(
|
|
@@ -1317,22 +1449,22 @@ function AudioBar({
|
|
|
1317
1449
|
className
|
|
1318
1450
|
),
|
|
1319
1451
|
children: [
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1321
1453
|
"button",
|
|
1322
1454
|
{
|
|
1323
1455
|
type: "button",
|
|
1324
1456
|
className: "rqk-audio-bar-play",
|
|
1325
1457
|
onClick: handleToggle,
|
|
1326
1458
|
"aria-label": isPlaying ? "\u6682\u505C" : "\u64AD\u653E",
|
|
1327
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
1459
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PauseIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PlayIcon, { size: 18 })
|
|
1328
1460
|
}
|
|
1329
1461
|
),
|
|
1330
|
-
/* @__PURE__ */ (0,
|
|
1331
|
-
label ? /* @__PURE__ */ (0,
|
|
1332
|
-
/* @__PURE__ */ (0,
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rqk-audio-bar-main", children: [
|
|
1463
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rqk-audio-bar-label", children: label }) : null,
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rqk-audio-bar-wave", "aria-hidden": true, children: WAVE_BARS.map((height, barIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { height: `${height}px` } }, barIndex)) })
|
|
1333
1465
|
] }),
|
|
1334
|
-
/* @__PURE__ */ (0,
|
|
1335
|
-
src ? /* @__PURE__ */ (0,
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rqk-audio-bar-time", children: formatTime(isPlaying ? position : total) }),
|
|
1467
|
+
src ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("audio", { ref: audioRef, src, preload: "metadata" }) : null
|
|
1336
1468
|
]
|
|
1337
1469
|
}
|
|
1338
1470
|
);
|
|
@@ -1340,74 +1472,7 @@ function AudioBar({
|
|
|
1340
1472
|
|
|
1341
1473
|
// src/primitives/picture-box.tsx
|
|
1342
1474
|
var import_react8 = require("react");
|
|
1343
|
-
|
|
1344
|
-
// src/art/illustrations.tsx
|
|
1345
|
-
var import_react7 = require("react");
|
|
1346
|
-
|
|
1347
|
-
// src/assets/svg/art-apple.svg
|
|
1348
|
-
var art_apple_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#FF8A8A"></stop><stop offset="1" stop-color="#E5484D"></stop></linearGradient></defs><circle cx="57" cy="66" r="32" fill="url(#rqk-grad)"></circle><circle cx="72" cy="70" r="25" fill="url(#rqk-grad)" opacity="0.92"></circle><ellipse cx="47" cy="52" rx="7" ry="10" fill="#FFFFFF" opacity="0.4" transform="rotate(-24 47 52)"></ellipse><path d="M64 36c0-6 3-10 8-12" stroke="#8B5E34" stroke-width="3" stroke-linecap="round" fill="none"></path><path d="M68 34c2-8 12-11 20-7-2 8-12 11-20 7z" fill="#3ED598"></path></svg>\n';
|
|
1349
|
-
|
|
1350
|
-
// src/assets/svg/art-balloon.svg
|
|
1351
|
-
var art_balloon_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0.2" y1="0" x2="0.8" y2="1"><stop offset="0" stop-color="#7FB0FF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient></defs><ellipse cx="60" cy="50" rx="28" ry="32" fill="url(#rqk-grad)"></ellipse><ellipse cx="50" cy="38" rx="7" ry="9" fill="#FFFFFF" opacity="0.45"></ellipse><path d="M60 82l3 6h-6z" fill="#0147CC"></path><path d="M60 88c8 6-8 10 0 16s-8 8 0 12" stroke="#0147CC" stroke-width="2.2" fill="none" stroke-linecap="round"></path><circle cx="94" cy="30" r="4" fill="#FFD166"></circle><circle cx="22" cy="86" r="3" fill="#7C5CFF" opacity="0.6"></circle></svg>\n';
|
|
1352
|
-
|
|
1353
|
-
// src/assets/svg/art-books.svg
|
|
1354
|
-
var art_books_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><rect x="20" y="80" width="80" height="16" rx="5" fill="#0158FD"></rect><rect x="26" y="62" width="68" height="16" rx="5" fill="#3ED598"></rect><rect x="22" y="44" width="72" height="16" rx="5" fill="#FFB020"></rect><rect x="32" y="26" width="58" height="16" rx="5" fill="#7C5CFF"></rect><path d="M34 34h54M28 52h60M32 70h56M26 88h68" stroke="#FFFFFF" stroke-width="2.4" opacity="0.35" stroke-linecap="round"></path><circle cx="88" cy="22" r="5" fill="#9CBFFF" opacity="0.7"></circle></svg>\n';
|
|
1355
|
-
|
|
1356
|
-
// src/assets/svg/art-cat.svg
|
|
1357
|
-
var art_cat_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFC48A"></stop><stop offset="1" stop-color="#F09A4F"></stop></linearGradient></defs><path d="M36 42l-6-20 18 8zM84 42l6-20-18 8z" fill="url(#rqk-grad)"></path><circle cx="60" cy="66" r="34" fill="url(#rqk-grad)"></circle><ellipse cx="60" cy="82" rx="18" ry="13" fill="#FFF3E4"></ellipse><circle cx="48" cy="62" r="3.4" fill="#5B3A22"></circle><circle cx="72" cy="62" r="3.4" fill="#5B3A22"></circle><path d="M55 74h10l-5 5z" fill="#F08A8A"></path><path d="M56 83c1.6 1.8 6.4 1.8 8 0" stroke="#5B3A22" stroke-width="1.8" fill="none"></path><path d="M22 68h14M24 76h12M98 68h-14M96 76h-12" stroke="#E7C39F" stroke-width="2" stroke-linecap="round"></path></svg>\n';
|
|
1358
|
-
|
|
1359
|
-
// src/assets/svg/art-coffee.svg
|
|
1360
|
-
var art_coffee_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFFFFF"></stop><stop offset="1" stop-color="#E7EEFA"></stop></linearGradient></defs><ellipse cx="58" cy="90" rx="34" ry="6" fill="#DCE6F7"></ellipse><path d="M30 50h50l-5 34c-.6 4-4 7-8 7H43c-4 0-7.4-3-8-7z" fill="url(#rqk-grad)"></path><path d="M80 58h6a9 9 0 010 18h-3" stroke="#C3D2E8" stroke-width="4" fill="none"></path><rect x="34" y="58" width="42" height="14" rx="4" fill="#D6E2F5"></rect><path d="M48 42c-4-7 4-9 0-16M62 42c-4-7 4-9 0-16" stroke="#9CBFFF" stroke-width="3" fill="none" stroke-linecap="round" opacity="0.8"></path><circle cx="88" cy="34" r="4" fill="#FFB020" opacity="0.7"></circle></svg>\n';
|
|
1361
|
-
|
|
1362
|
-
// src/assets/svg/art-headphones.svg
|
|
1363
|
-
var art_headphones_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 186" fill="none" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad-a" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5C96FF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient><linearGradient id="rqk-grad-b" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3D7BFF"></stop><stop offset="1" stop-color="#013AA6"></stop></linearGradient></defs><ellipse cx="120" cy="162" rx="48" ry="8" fill="#0B1220" opacity="0.07"></ellipse><path d="M62 112V94c0-32 26-56 58-56s58 24 58 56v18" stroke="url(#rqk-grad-a)" stroke-width="15" stroke-linecap="round"></path><path d="M62 112V94c0-32 26-56 58-56s58 24 58 56v18" stroke="#fff" stroke-width="4" stroke-linecap="round" opacity="0.35"></path><rect x="46" y="102" width="34" height="52" rx="17" fill="url(#rqk-grad-b)"></rect><rect x="160" y="102" width="34" height="52" rx="17" fill="url(#rqk-grad-b)"></rect><rect x="54" y="112" width="18" height="32" rx="9" fill="#fff" opacity="0.25"></rect><rect x="168" y="112" width="18" height="32" rx="9" fill="#fff" opacity="0.25"></rect><g stroke="#0158FD" stroke-width="3" stroke-linecap="round" opacity="0.5"><path d="M198 74c8 6 12 14 12 22M206 62c12 9 18 21 18 34"></path></g></svg>\n';
|
|
1364
|
-
|
|
1365
|
-
// src/assets/svg/art-kid.svg
|
|
1366
|
-
var art_kid_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#4F8BFF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient></defs><circle cx="60" cy="58" r="46" fill="#EAF1FF"></circle><path d="M22 104c0-15 17-24 38-24s38 9 38 24z" fill="url(#rqk-grad)"></path><circle cx="60" cy="52" r="25" fill="#FFD3B6"></circle><path d="M36 47c0-13 10-21 24-21s24 8 24 21c-6-4-13-6-24-6s-18 2-24 6z" fill="#1F2A44"></path><circle cx="51" cy="53" r="2.6" fill="#1F2A44"></circle><circle cx="69" cy="53" r="2.6" fill="#1F2A44"></circle><path d="M54 62c2.6 3 9.4 3 12 0" stroke="#C96A5A" stroke-width="2.4" stroke-linecap="round" fill="none"></path><circle cx="43" cy="60" r="3.4" fill="#FFB4A8" opacity="0.6"></circle><circle cx="77" cy="60" r="3.4" fill="#FFB4A8" opacity="0.6"></circle></svg>\n';
|
|
1367
|
-
|
|
1368
|
-
// src/assets/svg/art-screen.svg
|
|
1369
|
-
var art_screen_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 186" fill="none" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad-play" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#5C96FF"></stop><stop offset="1" stop-color="#0158FD"></stop></linearGradient><linearGradient id="rqk-grad-screen" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#EAF2FF"></stop><stop offset="1" stop-color="#C6DBFF"></stop></linearGradient></defs><ellipse cx="120" cy="166" rx="52" ry="8" fill="#0B1220" opacity="0.07"></ellipse><rect x="42" y="32" width="156" height="104" rx="16" fill="url(#rqk-grad-screen)" stroke="#B9D0FF" stroke-width="2"></rect><rect x="52" y="42" width="136" height="84" rx="10" fill="#0B1220" opacity="0.06"></rect><circle cx="120" cy="84" r="26" fill="url(#rqk-grad-play)"></circle><path d="M113 73l20 11-20 11V73z" fill="#fff"></path><rect x="106" y="136" width="28" height="16" fill="#C6DBFF"></rect><rect x="84" y="150" width="72" height="8" rx="4" fill="#B9D0FF"></rect><g fill="#0158FD" opacity="0.5"><circle cx="62" cy="52" r="2.6"></circle><circle cx="70" cy="52" r="2.6"></circle><circle cx="78" cy="52" r="2.6"></circle></g></svg>\n';
|
|
1370
|
-
|
|
1371
|
-
// src/assets/svg/art-speech.svg
|
|
1372
|
-
var art_speech_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#EAF1FF"></stop><stop offset="1" stop-color="#C6DBFF"></stop></linearGradient></defs><path d="M24 34h72a8 8 0 018 8v34a8 8 0 01-8 8H60l-16 14v-14H24a8 8 0 01-8-8V42a8 8 0 018-8z" fill="url(#rqk-grad)"></path><rect x="38" y="52" width="7" height="18" rx="3.5" fill="#0158FD"></rect><rect x="51" y="44" width="7" height="34" rx="3.5" fill="#4F8BFF"></rect><rect x="64" y="48" width="7" height="26" rx="3.5" fill="#4F8BFF"></rect><rect x="77" y="58" width="7" height="10" rx="3.5" fill="#9CBFFF"></rect></svg>\n';
|
|
1373
|
-
|
|
1374
|
-
// src/assets/svg/art-trophy.svg
|
|
1375
|
-
var art_trophy_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" class="rqk-art-svg" aria-hidden="true" focusable="false"><defs><linearGradient id="rqk-grad" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#FFE29A"></stop><stop offset="0.55" stop-color="#FFC24B"></stop><stop offset="1" stop-color="#E08A00"></stop></linearGradient></defs><circle cx="60" cy="54" r="42" fill="#FFF7E6"></circle><path d="M38 34h44v18c0 14-9 22-22 22s-22-8-22-22z" fill="url(#rqk-grad)"></path><path d="M38 40H28v4c0 9 6 15 14 15M82 40h10v4c0 9-6 15-14 15" stroke="#E08A00" stroke-width="3.4" fill="none"></path><rect x="52" y="72" width="16" height="10" fill="#F0A600"></rect><rect x="44" y="82" width="32" height="9" rx="3" fill="#E08A00"></rect><path d="M60 44l3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1z" fill="#FFF7E6" opacity="0.9"></path><circle cx="90" cy="30" r="3.4" fill="#FFB020" opacity="0.8"></circle><circle cx="26" cy="76" r="2.6" fill="#7C5CFF" opacity="0.6"></circle></svg>\n';
|
|
1376
|
-
|
|
1377
|
-
// src/art/illustrations.tsx
|
|
1378
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1379
|
-
var ART_SOURCES = {
|
|
1380
|
-
kid: art_kid_default,
|
|
1381
|
-
balloon: art_balloon_default,
|
|
1382
|
-
apple: art_apple_default,
|
|
1383
|
-
coffee: art_coffee_default,
|
|
1384
|
-
cat: art_cat_default,
|
|
1385
|
-
books: art_books_default,
|
|
1386
|
-
headphones: art_headphones_default,
|
|
1387
|
-
screen: art_screen_default,
|
|
1388
|
-
trophy: art_trophy_default,
|
|
1389
|
-
speech: art_speech_default
|
|
1390
|
-
};
|
|
1391
|
-
function Art({ name, className, size }) {
|
|
1392
|
-
var _a;
|
|
1393
|
-
const unique = (0, import_react7.useId)().replace(/[^a-zA-Z0-9]/g, "");
|
|
1394
|
-
const source = ((_a = ART_SOURCES[name]) != null ? _a : art_speech_default).replace(
|
|
1395
|
-
/rqk-grad/g,
|
|
1396
|
-
`rqk-grad-${unique}`
|
|
1397
|
-
);
|
|
1398
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1399
|
-
"span",
|
|
1400
|
-
{
|
|
1401
|
-
className: ["rqk-art", className].filter(Boolean).join(" "),
|
|
1402
|
-
style: size ? { width: size, height: size } : void 0,
|
|
1403
|
-
"aria-hidden": true,
|
|
1404
|
-
dangerouslySetInnerHTML: { __html: source }
|
|
1405
|
-
}
|
|
1406
|
-
);
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
// src/primitives/picture-box.tsx
|
|
1410
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1475
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1411
1476
|
function PictureBox({
|
|
1412
1477
|
src,
|
|
1413
1478
|
alt = "",
|
|
@@ -1425,7 +1490,7 @@ function PictureBox({
|
|
|
1425
1490
|
setLoaded(false);
|
|
1426
1491
|
}, [src]);
|
|
1427
1492
|
const resolved = state != null ? state : src ? failed ? "fail" : loaded ? "ok" : "loading" : "default";
|
|
1428
|
-
return /* @__PURE__ */ (0,
|
|
1493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1429
1494
|
"div",
|
|
1430
1495
|
{
|
|
1431
1496
|
className: classNames(
|
|
@@ -1436,7 +1501,7 @@ function PictureBox({
|
|
|
1436
1501
|
style: { aspectRatio: ratio },
|
|
1437
1502
|
"data-state": resolved,
|
|
1438
1503
|
children: [
|
|
1439
|
-
src && resolved !== "fail" ? /* @__PURE__ */ (0,
|
|
1504
|
+
src && resolved !== "fail" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1440
1505
|
"img",
|
|
1441
1506
|
{
|
|
1442
1507
|
src,
|
|
@@ -1445,9 +1510,9 @@ function PictureBox({
|
|
|
1445
1510
|
onError: () => setFailed(true)
|
|
1446
1511
|
}
|
|
1447
1512
|
) : null,
|
|
1448
|
-
resolved === "loading" ? /* @__PURE__ */ (0,
|
|
1449
|
-
resolved === "default" || resolved === "fail" ? /* @__PURE__ */ (0,
|
|
1450
|
-
resolved === "fail" ? /* @__PURE__ */ (0,
|
|
1513
|
+
resolved === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rqk-picture-skeleton", "aria-hidden": true }) : null,
|
|
1514
|
+
resolved === "default" || resolved === "fail" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rqk-picture-fallback", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Art, { name: art }) }) : null,
|
|
1515
|
+
resolved === "fail" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1451
1516
|
"button",
|
|
1452
1517
|
{
|
|
1453
1518
|
type: "button",
|
|
@@ -1456,19 +1521,19 @@ function PictureBox({
|
|
|
1456
1521
|
children: "\u91CD\u65B0\u52A0\u8F7D"
|
|
1457
1522
|
}
|
|
1458
1523
|
) : null,
|
|
1459
|
-
caption ? /* @__PURE__ */ (0,
|
|
1524
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rqk-picture-caption", children: caption }) : null
|
|
1460
1525
|
]
|
|
1461
1526
|
}
|
|
1462
1527
|
);
|
|
1463
1528
|
}
|
|
1464
1529
|
|
|
1465
1530
|
// src/questions/single-choice/stem-card.tsx
|
|
1466
|
-
var
|
|
1531
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1467
1532
|
function SingleChoiceStem({ data }) {
|
|
1468
|
-
return /* @__PURE__ */ (0,
|
|
1469
|
-
data.stemImage ? /* @__PURE__ */ (0,
|
|
1470
|
-
data.stemAudio ? /* @__PURE__ */ (0,
|
|
1471
|
-
/* @__PURE__ */ (0,
|
|
1533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Card, { className: "rqk-stem-card", children: [
|
|
1534
|
+
data.stemImage ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PictureBox, { src: data.stemImage, art: "books", ratio: "16 / 9", alt: "\u9898\u5E72\u914D\u56FE" }) : null,
|
|
1535
|
+
data.stemAudio ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AudioBar, { src: data.stemAudio }) : null,
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "rqk-stem", children: data.stem })
|
|
1472
1537
|
] });
|
|
1473
1538
|
}
|
|
1474
1539
|
|
|
@@ -1503,7 +1568,7 @@ var speakWithSynthesis = (text, opts) => {
|
|
|
1503
1568
|
};
|
|
1504
1569
|
|
|
1505
1570
|
// src/questions/single-choice/use-single-choice.tsx
|
|
1506
|
-
var
|
|
1571
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1507
1572
|
function useSingleChoice({
|
|
1508
1573
|
data,
|
|
1509
1574
|
mode,
|
|
@@ -1554,7 +1619,7 @@ function useSingleChoice({
|
|
|
1554
1619
|
answer: selected
|
|
1555
1620
|
});
|
|
1556
1621
|
}, [judge, onSubmit, selected]);
|
|
1557
|
-
const answerLabel = (_b = data.answerLabel) != null ? _b : /* @__PURE__ */ (0,
|
|
1622
|
+
const answerLabel = (_b = data.answerLabel) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
1558
1623
|
optionLetter(data.answer),
|
|
1559
1624
|
". ",
|
|
1560
1625
|
(_a = data.options[data.answer]) == null ? void 0 : _a.text
|
|
@@ -1590,7 +1655,7 @@ function useSingleChoice({
|
|
|
1590
1655
|
}
|
|
1591
1656
|
|
|
1592
1657
|
// src/questions/single-choice/index.tsx
|
|
1593
|
-
var
|
|
1658
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1594
1659
|
function SingleChoice({
|
|
1595
1660
|
data,
|
|
1596
1661
|
mode = "answer",
|
|
@@ -1616,7 +1681,7 @@ function SingleChoice({
|
|
|
1616
1681
|
onSubmit: model.handleSubmit,
|
|
1617
1682
|
onRetry: model.judge.retry
|
|
1618
1683
|
});
|
|
1619
|
-
return /* @__PURE__ */ (0,
|
|
1684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1620
1685
|
QuestShell,
|
|
1621
1686
|
{
|
|
1622
1687
|
mode,
|
|
@@ -1627,7 +1692,7 @@ function SingleChoice({
|
|
|
1627
1692
|
onBack,
|
|
1628
1693
|
className: classNames("rqk-quest", className),
|
|
1629
1694
|
dataQuest: "single-choice",
|
|
1630
|
-
feedback: /* @__PURE__ */ (0,
|
|
1695
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1631
1696
|
SingleChoiceFeedback,
|
|
1632
1697
|
{
|
|
1633
1698
|
readonly: model.readonly,
|
|
@@ -1637,10 +1702,10 @@ function SingleChoice({
|
|
|
1637
1702
|
answerLabel: model.answerLabel
|
|
1638
1703
|
}
|
|
1639
1704
|
),
|
|
1640
|
-
footer: /* @__PURE__ */ (0,
|
|
1641
|
-
children: /* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1643
|
-
/* @__PURE__ */ (0,
|
|
1705
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
1706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SingleChoiceStem, { data }),
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1644
1709
|
SingleChoiceOptions,
|
|
1645
1710
|
{
|
|
1646
1711
|
data,
|
|
@@ -1709,7 +1774,7 @@ function followArt(data) {
|
|
|
1709
1774
|
}
|
|
1710
1775
|
|
|
1711
1776
|
// src/questions/follow-read/follow-content.tsx
|
|
1712
|
-
var
|
|
1777
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1713
1778
|
function FollowContent({
|
|
1714
1779
|
data,
|
|
1715
1780
|
stage,
|
|
@@ -1719,10 +1784,10 @@ function FollowContent({
|
|
|
1719
1784
|
startBadgeVisible
|
|
1720
1785
|
}) {
|
|
1721
1786
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1722
|
-
return /* @__PURE__ */ (0,
|
|
1723
|
-
/* @__PURE__ */ (0,
|
|
1724
|
-
art ? /* @__PURE__ */ (0,
|
|
1725
|
-
/* @__PURE__ */ (0,
|
|
1787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rqk-follow-card flex flex-col gap-3", children: [
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rqk-follow-stage", children: [
|
|
1789
|
+
art ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Art, { name: art, className: "rqk-follow-art" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "rqk-follow-no-image", role: "img", "aria-label": "No image", children: [
|
|
1790
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1726
1791
|
"svg",
|
|
1727
1792
|
{
|
|
1728
1793
|
className: "rqk-follow-no-image-icon",
|
|
@@ -1730,7 +1795,7 @@ function FollowContent({
|
|
|
1730
1795
|
fill: "none",
|
|
1731
1796
|
"aria-hidden": true,
|
|
1732
1797
|
children: [
|
|
1733
|
-
/* @__PURE__ */ (0,
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1734
1799
|
"rect",
|
|
1735
1800
|
{
|
|
1736
1801
|
x: "7",
|
|
@@ -1742,8 +1807,8 @@ function FollowContent({
|
|
|
1742
1807
|
strokeWidth: "2"
|
|
1743
1808
|
}
|
|
1744
1809
|
),
|
|
1745
|
-
/* @__PURE__ */ (0,
|
|
1746
|
-
/* @__PURE__ */ (0,
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "17", cy: "19", r: "3", fill: "currentColor", opacity: "0.45" }),
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1747
1812
|
"path",
|
|
1748
1813
|
{
|
|
1749
1814
|
d: "M10 34l9-9 7 7 6-6 8 8",
|
|
@@ -1753,7 +1818,7 @@ function FollowContent({
|
|
|
1753
1818
|
strokeLinejoin: "round"
|
|
1754
1819
|
}
|
|
1755
1820
|
),
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1757
1822
|
"path",
|
|
1758
1823
|
{
|
|
1759
1824
|
d: "M11 8l27 32",
|
|
@@ -1765,24 +1830,24 @@ function FollowContent({
|
|
|
1765
1830
|
]
|
|
1766
1831
|
}
|
|
1767
1832
|
),
|
|
1768
|
-
/* @__PURE__ */ (0,
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "rqk-follow-no-image-text", children: "No image" })
|
|
1769
1834
|
] }),
|
|
1770
|
-
startBadgeVisible ? /* @__PURE__ */ (0,
|
|
1835
|
+
startBadgeVisible ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "rqk-follow-start", children: "\u51C6\u5907\u5F00\u59CB\u8DDF\u8BFB" }) : null
|
|
1771
1836
|
] }),
|
|
1772
|
-
data.kind === "word" ? /* @__PURE__ */ (0,
|
|
1773
|
-
/* @__PURE__ */ (0,
|
|
1774
|
-
/* @__PURE__ */ (0,
|
|
1775
|
-
((_b = data.word) == null ? void 0 : _b.phonetic) ? /* @__PURE__ */ (0,
|
|
1776
|
-
((_c = data.word) == null ? void 0 : _c.partOfSpeech) || ((_d = data.word) == null ? void 0 : _d.meaning) ? /* @__PURE__ */ (0,
|
|
1777
|
-
((_e = data.word) == null ? void 0 : _e.partOfSpeech) ? /* @__PURE__ */ (0,
|
|
1778
|
-
((_f = data.word) == null ? void 0 : _f.meaning) ? /* @__PURE__ */ (0,
|
|
1837
|
+
data.kind === "word" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Card, { className: "rqk-follow-word", children: [
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "rqk-follow-word-text", children: (_a = data.word) == null ? void 0 : _a.text }),
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rqk-follow-word-meta", children: [
|
|
1840
|
+
((_b = data.word) == null ? void 0 : _b.phonetic) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "rqk-follow-phonetic", children: data.word.phonetic }) : null,
|
|
1841
|
+
((_c = data.word) == null ? void 0 : _c.partOfSpeech) || ((_d = data.word) == null ? void 0 : _d.meaning) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rqk-follow-pos-line", children: [
|
|
1842
|
+
((_e = data.word) == null ? void 0 : _e.partOfSpeech) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "rqk-follow-pos", children: data.word.partOfSpeech }) : null,
|
|
1843
|
+
((_f = data.word) == null ? void 0 : _f.meaning) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "rqk-follow-meaning", children: data.word.meaning }) : null
|
|
1779
1844
|
] }) : null
|
|
1780
1845
|
] })
|
|
1781
|
-
] }) : /* @__PURE__ */ (0,
|
|
1782
|
-
/* @__PURE__ */ (0,
|
|
1846
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rqk-follow-word rqk-follow-sentence-box", children: [
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "rqk-follow-sentence", children: (_g = data.sentence) == null ? void 0 : _g.words.map((word, wordIndex) => {
|
|
1783
1848
|
var _a2;
|
|
1784
1849
|
const score = (_a2 = wordScores[wordIndex]) == null ? void 0 : _a2.score;
|
|
1785
|
-
return /* @__PURE__ */ (0,
|
|
1850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1786
1851
|
"span",
|
|
1787
1852
|
{
|
|
1788
1853
|
className: classNames(
|
|
@@ -1794,32 +1859,32 @@ function FollowContent({
|
|
|
1794
1859
|
`${word}-${wordIndex}`
|
|
1795
1860
|
);
|
|
1796
1861
|
}) }),
|
|
1797
|
-
/* @__PURE__ */ (0,
|
|
1798
|
-
/* @__PURE__ */ (0,
|
|
1799
|
-
/* @__PURE__ */ (0,
|
|
1862
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rqk-follow-legend", children: [
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
|
|
1864
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("i", { className: "rqk-follow-legend-ok", children: "\u7EFF" }),
|
|
1800
1865
|
" \u226580"
|
|
1801
1866
|
] }),
|
|
1802
|
-
/* @__PURE__ */ (0,
|
|
1803
|
-
/* @__PURE__ */ (0,
|
|
1867
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
|
|
1868
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("i", { className: "rqk-follow-legend-warn", children: "\u9EC4" }),
|
|
1804
1869
|
" 60\u201380"
|
|
1805
1870
|
] }),
|
|
1806
|
-
/* @__PURE__ */ (0,
|
|
1807
|
-
/* @__PURE__ */ (0,
|
|
1871
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("i", { className: "rqk-follow-legend-bad", children: "\u7EA2" }),
|
|
1808
1873
|
" <60"
|
|
1809
1874
|
] })
|
|
1810
1875
|
] }),
|
|
1811
|
-
((_h = data.sentence) == null ? void 0 : _h.translation) ? /* @__PURE__ */ (0,
|
|
1876
|
+
((_h = data.sentence) == null ? void 0 : _h.translation) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "rqk-follow-translation", children: data.sentence.translation }) : null
|
|
1812
1877
|
] }),
|
|
1813
|
-
stage === "scoring" && !readonly ? /* @__PURE__ */ (0,
|
|
1814
|
-
/* @__PURE__ */ (0,
|
|
1815
|
-
/* @__PURE__ */ (0,
|
|
1878
|
+
stage === "scoring" && !readonly ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rqk-follow-scoring", "aria-live": "polite", children: [
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "rqk-follow-spinner", "aria-hidden": true }),
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "\u8BC4\u5206\u4E2D\u2026" })
|
|
1816
1881
|
] }) : null
|
|
1817
1882
|
] });
|
|
1818
1883
|
}
|
|
1819
1884
|
|
|
1820
1885
|
// src/primitives/celebration.tsx
|
|
1821
1886
|
var import_react10 = require("react");
|
|
1822
|
-
var
|
|
1887
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1823
1888
|
var CONFETTI_COLORS = [
|
|
1824
1889
|
"var(--rqk-gold)",
|
|
1825
1890
|
"#ff6b6b",
|
|
@@ -1854,15 +1919,15 @@ function Celebration({
|
|
|
1854
1919
|
return () => window.clearTimeout(timer);
|
|
1855
1920
|
}, [autoHideMs, grade]);
|
|
1856
1921
|
if (hidden) return null;
|
|
1857
|
-
return /* @__PURE__ */ (0,
|
|
1858
|
-
withConfetti ? /* @__PURE__ */ (0,
|
|
1922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: classNames("rqk-celebrate", className), "data-grade": grade, role: "status", children: [
|
|
1923
|
+
withConfetti ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rqk-confetti", "aria-hidden": true, children: Array.from({ length: CONFETTI_COUNT }).map((_, index) => {
|
|
1859
1924
|
const x = 4 + index * 37 % 93;
|
|
1860
1925
|
const y = 8 + index * 11 % 26;
|
|
1861
1926
|
const delay = index * 7 % 6 * 0.07;
|
|
1862
1927
|
const duration = 1.1 + index * 5 % 7 * 0.1;
|
|
1863
1928
|
const spin = 180 + index * 41 % 180;
|
|
1864
1929
|
const drift = index * 13 % 48 - 24;
|
|
1865
|
-
return /* @__PURE__ */ (0,
|
|
1930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1866
1931
|
"span",
|
|
1867
1932
|
{
|
|
1868
1933
|
className: "rqk-confetti-piece",
|
|
@@ -1881,16 +1946,16 @@ function Celebration({
|
|
|
1881
1946
|
index
|
|
1882
1947
|
);
|
|
1883
1948
|
}) }) : null,
|
|
1884
|
-
/* @__PURE__ */ (0,
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
1886
|
-
/* @__PURE__ */ (0,
|
|
1887
|
-
note ? /* @__PURE__ */ (0,
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StarRating, { value: config.stars, size: 26, animate: true }),
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rqk-celebrate-title", children: title != null ? title : config.title }),
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rqk-celebrate-ribbon", children: ribbon != null ? ribbon : config.ribbon }),
|
|
1952
|
+
note ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rqk-celebrate-note", children: note }) : null
|
|
1888
1953
|
] });
|
|
1889
1954
|
}
|
|
1890
1955
|
|
|
1891
1956
|
// src/primitives/record-cluster.tsx
|
|
1892
1957
|
var import_react11 = require("react");
|
|
1893
|
-
var
|
|
1958
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1894
1959
|
function formatClock(value) {
|
|
1895
1960
|
const total = Math.max(0, Math.floor(value));
|
|
1896
1961
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
@@ -1953,9 +2018,9 @@ function RecordCluster({
|
|
|
1953
2018
|
else start();
|
|
1954
2019
|
};
|
|
1955
2020
|
const statusText = hint != null ? hint : recording ? "\u6B63\u5728\u5F55\u97F3 \xB7 \u70B9\u51FB\u7ED3\u675F" : scoring ? "\u8BC4\u5206\u4E2D\u2026" : state === "done" ? "\u91CD\u65B0\u5F55\u97F3" : "\u70B9\u51FB\u8DDF\u8BFB";
|
|
1956
|
-
return /* @__PURE__ */ (0,
|
|
1957
|
-
/* @__PURE__ */ (0,
|
|
1958
|
-
/* @__PURE__ */ (0,
|
|
2021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: classNames("rqk-record-cluster", className), children: [
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rqk-record-row", children: [
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1959
2024
|
"button",
|
|
1960
2025
|
{
|
|
1961
2026
|
type: "button",
|
|
@@ -1967,14 +2032,14 @@ function RecordCluster({
|
|
|
1967
2032
|
"aria-label": "\u64AD\u653E\u8303\u8BFB",
|
|
1968
2033
|
"aria-pressed": activeSide === "demo",
|
|
1969
2034
|
children: [
|
|
1970
|
-
/* @__PURE__ */ (0,
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "rqk-record-side-icon", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SpeakerIcon, { size: 22 }) }),
|
|
2036
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "rqk-record-side-label", children: "\u53D1\u97F3" })
|
|
1972
2037
|
]
|
|
1973
2038
|
}
|
|
1974
2039
|
),
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
1976
|
-
recording ? /* @__PURE__ */ (0,
|
|
1977
|
-
/* @__PURE__ */ (0,
|
|
2040
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rqk-record-main", children: [
|
|
2041
|
+
recording ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("svg", { className: "rqk-record-ring", viewBox: "0 0 100 100", "aria-hidden": true, children: [
|
|
2042
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1978
2043
|
"circle",
|
|
1979
2044
|
{
|
|
1980
2045
|
className: "rqk-record-ring-track",
|
|
@@ -1984,9 +2049,9 @@ function RecordCluster({
|
|
|
1984
2049
|
strokeDasharray: "283"
|
|
1985
2050
|
}
|
|
1986
2051
|
),
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
2052
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("circle", { cx: "50", cy: "50", r: "45", strokeDasharray: "283", strokeDashoffset: ringOffset })
|
|
1988
2053
|
] }) : null,
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
2054
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1990
2055
|
"button",
|
|
1991
2056
|
{
|
|
1992
2057
|
type: "button",
|
|
@@ -1995,11 +2060,11 @@ function RecordCluster({
|
|
|
1995
2060
|
disabled: disabled || scoring,
|
|
1996
2061
|
"aria-label": recording ? "\u7ED3\u675F\u5F55\u97F3" : "\u5F00\u59CB\u5F55\u97F3",
|
|
1997
2062
|
"aria-pressed": recording,
|
|
1998
|
-
children: recording ? /* @__PURE__ */ (0,
|
|
2063
|
+
children: recording ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "rqk-record-stop", "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MicIcon, { size: 30 })
|
|
1999
2064
|
}
|
|
2000
2065
|
)
|
|
2001
2066
|
] }),
|
|
2002
|
-
/* @__PURE__ */ (0,
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2003
2068
|
"button",
|
|
2004
2069
|
{
|
|
2005
2070
|
type: "button",
|
|
@@ -2011,35 +2076,35 @@ function RecordCluster({
|
|
|
2011
2076
|
"aria-label": "\u64AD\u653E\u6211\u7684\u5F55\u97F3",
|
|
2012
2077
|
"aria-pressed": activeSide === "mine",
|
|
2013
2078
|
children: [
|
|
2014
|
-
/* @__PURE__ */ (0,
|
|
2015
|
-
/* @__PURE__ */ (0,
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "rqk-record-side-icon", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PlayIcon, { size: 20 }) }),
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "rqk-record-side-label", children: "\u6211\u7684" })
|
|
2016
2081
|
]
|
|
2017
2082
|
}
|
|
2018
2083
|
)
|
|
2019
2084
|
] }),
|
|
2020
|
-
/* @__PURE__ */ (0,
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2021
2086
|
"div",
|
|
2022
2087
|
{
|
|
2023
2088
|
className: classNames("rqk-record-status", hintTone !== "default" && `rqk-is-${hintTone}`),
|
|
2024
2089
|
children: [
|
|
2025
|
-
recording ? /* @__PURE__ */ (0,
|
|
2026
|
-
/* @__PURE__ */ (0,
|
|
2090
|
+
recording ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2091
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "rqk-record-status-timer", children: [
|
|
2027
2092
|
formatClock(seconds),
|
|
2028
2093
|
" / ",
|
|
2029
2094
|
formatClock(maxSeconds)
|
|
2030
2095
|
] }),
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "rqk-record-status-sep", "aria-hidden": true, children: "\xB7" })
|
|
2032
2097
|
] }) : null,
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: statusText })
|
|
2034
2099
|
]
|
|
2035
2100
|
}
|
|
2036
2101
|
),
|
|
2037
|
-
detail ? /* @__PURE__ */ (0,
|
|
2102
|
+
detail ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: classNames("rqk-record-detail", detailTone === "bad" && "rqk-is-bad"), children: detail }) : null
|
|
2038
2103
|
] });
|
|
2039
2104
|
}
|
|
2040
2105
|
|
|
2041
2106
|
// src/questions/follow-read/follow-controls.tsx
|
|
2042
|
-
var
|
|
2107
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2043
2108
|
function FollowControls({
|
|
2044
2109
|
grade,
|
|
2045
2110
|
ribbon,
|
|
@@ -2059,9 +2124,9 @@ function FollowControls({
|
|
|
2059
2124
|
onPlayDemo
|
|
2060
2125
|
}) {
|
|
2061
2126
|
const gradeValue = grade && grade !== "noise" ? grade : "again";
|
|
2062
|
-
return /* @__PURE__ */ (0,
|
|
2063
|
-
grade && grade !== "noise" ? /* @__PURE__ */ (0,
|
|
2064
|
-
/* @__PURE__ */ (0,
|
|
2127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rqk-follow-bottom", children: [
|
|
2128
|
+
grade && grade !== "noise" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Celebration, { grade: gradeValue, ribbon, autoHideMs: 3200 }) : null,
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2065
2130
|
RecordCluster,
|
|
2066
2131
|
{
|
|
2067
2132
|
state: readonly ? "idle" : recordState2,
|
|
@@ -2357,7 +2422,7 @@ function useFollowRead({
|
|
|
2357
2422
|
}
|
|
2358
2423
|
|
|
2359
2424
|
// src/questions/follow-read/index.tsx
|
|
2360
|
-
var
|
|
2425
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2361
2426
|
function FollowRead({
|
|
2362
2427
|
data,
|
|
2363
2428
|
mode = "answer",
|
|
@@ -2392,13 +2457,13 @@ function FollowRead({
|
|
|
2392
2457
|
onNext
|
|
2393
2458
|
});
|
|
2394
2459
|
const displayTitle = title != null ? title : data.kind === "word" ? "\u5355\u8BCD\u8DDF\u8BFB" : "\u53E5\u5B50\u8DDF\u8BFB";
|
|
2395
|
-
const instructionText = instruction != null ? instruction : data.kind === "word" ? /* @__PURE__ */ (0,
|
|
2460
|
+
const instructionText = instruction != null ? instruction : data.kind === "word" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
2396
2461
|
"\u542C\u5355\u8BCD\u793A\u8303\uFF0C\u70B9\u51FB\u9EA6\u514B\u98CE",
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2462
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("b", { children: "\u5927\u58F0\u8DDF\u8BFB" }),
|
|
2398
2463
|
"\uFF0C\u81EA\u52A8\u8BC4\u5206"
|
|
2399
|
-
] }) : /* @__PURE__ */ (0,
|
|
2464
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
2400
2465
|
"\u542C\u53E5\u5B50\u793A\u8303\uFF0C\u70B9\u51FB\u9EA6\u514B\u98CE",
|
|
2401
|
-
/* @__PURE__ */ (0,
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("b", { children: "\u5927\u58F0\u8DDF\u8BFB" }),
|
|
2402
2467
|
"\uFF0C\u9010\u8BCD\u8BC4\u5206"
|
|
2403
2468
|
] });
|
|
2404
2469
|
const detail = detailHint({
|
|
@@ -2413,7 +2478,7 @@ function FollowRead({
|
|
|
2413
2478
|
});
|
|
2414
2479
|
const hasPrev = index > 1 && Boolean(onPrev);
|
|
2415
2480
|
const hasFooter = actions.length > 0 || hasPrev;
|
|
2416
|
-
return /* @__PURE__ */ (0,
|
|
2481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2417
2482
|
QuestShell,
|
|
2418
2483
|
{
|
|
2419
2484
|
mode,
|
|
@@ -2429,11 +2494,11 @@ function FollowRead({
|
|
|
2429
2494
|
className
|
|
2430
2495
|
),
|
|
2431
2496
|
dataQuest: "follow-read",
|
|
2432
|
-
footer: hasFooter ? /* @__PURE__ */ (0,
|
|
2497
|
+
footer: hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ActionBar, { actions, index, total, onPrev }) : void 0,
|
|
2433
2498
|
children: [
|
|
2434
|
-
/* @__PURE__ */ (0,
|
|
2435
|
-
/* @__PURE__ */ (0,
|
|
2436
|
-
/* @__PURE__ */ (0,
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
2500
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rqk-follow-instr", children: instructionText }),
|
|
2501
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2437
2502
|
FollowContent,
|
|
2438
2503
|
{
|
|
2439
2504
|
data,
|
|
@@ -2444,7 +2509,7 @@ function FollowRead({
|
|
|
2444
2509
|
startBadgeVisible: !model.readonly && model.stage === "ready"
|
|
2445
2510
|
}
|
|
2446
2511
|
),
|
|
2447
|
-
/* @__PURE__ */ (0,
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2448
2513
|
FollowControls,
|
|
2449
2514
|
{
|
|
2450
2515
|
grade: model.grade,
|
|
@@ -2466,7 +2531,7 @@ function FollowRead({
|
|
|
2466
2531
|
}
|
|
2467
2532
|
)
|
|
2468
2533
|
] }),
|
|
2469
|
-
model.demoFail ? /* @__PURE__ */ (0,
|
|
2534
|
+
model.demoFail ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FollowReadToast, { message: "\u8303\u8BFB\u52A0\u8F7D\u5931\u8D25 \xB7 \u53EF\u91CD\u8BD5 3 \u6B21" }) : null
|
|
2470
2535
|
]
|
|
2471
2536
|
}
|
|
2472
2537
|
);
|
|
@@ -2503,7 +2568,7 @@ function linkMatchActions({
|
|
|
2503
2568
|
}
|
|
2504
2569
|
|
|
2505
2570
|
// src/questions/link-match/feedback.tsx
|
|
2506
|
-
var
|
|
2571
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2507
2572
|
function LinkMatchFeedback({
|
|
2508
2573
|
readonly,
|
|
2509
2574
|
phase,
|
|
@@ -2512,7 +2577,7 @@ function LinkMatchFeedback({
|
|
|
2512
2577
|
answerText
|
|
2513
2578
|
}) {
|
|
2514
2579
|
if (readonly) {
|
|
2515
|
-
return /* @__PURE__ */ (0,
|
|
2580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2516
2581
|
FeedbackSheet,
|
|
2517
2582
|
{
|
|
2518
2583
|
tone: "ok",
|
|
@@ -2524,13 +2589,13 @@ function LinkMatchFeedback({
|
|
|
2524
2589
|
);
|
|
2525
2590
|
}
|
|
2526
2591
|
if (phase === "retry") {
|
|
2527
|
-
return /* @__PURE__ */ (0,
|
|
2592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FeedbackSheet, { tone: "warn", title: "\u6709\u8FDE\u9519\u7684\u7EBF\uFF0C\u518D\u8BD5\u4E00\u6B21", detail: "\u6B63\u786E\u7684\u8FDE\u7EBF\u5DF2\u4E3A\u4F60\u4FDD\u7559" });
|
|
2528
2593
|
}
|
|
2529
2594
|
if (phase === "correct") {
|
|
2530
|
-
return /* @__PURE__ */ (0,
|
|
2595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll });
|
|
2531
2596
|
}
|
|
2532
2597
|
if (phase === "locked") {
|
|
2533
|
-
return /* @__PURE__ */ (0,
|
|
2598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2534
2599
|
FeedbackSheet,
|
|
2535
2600
|
{
|
|
2536
2601
|
tone: "bad",
|
|
@@ -2549,11 +2614,12 @@ function LinkMatchFeedback({
|
|
|
2549
2614
|
function pairKey(left, right) {
|
|
2550
2615
|
return `${left}-${right}`;
|
|
2551
2616
|
}
|
|
2552
|
-
function
|
|
2553
|
-
|
|
2554
|
-
if (!
|
|
2555
|
-
if (
|
|
2556
|
-
if (
|
|
2617
|
+
function nodeKind(node, legacyKind) {
|
|
2618
|
+
if (legacyKind) return legacyKind;
|
|
2619
|
+
if (!node) return "text";
|
|
2620
|
+
if (node.image || node.art) return "image";
|
|
2621
|
+
if (node.text !== void 0) return "text";
|
|
2622
|
+
if (node.audio) return "audio";
|
|
2557
2623
|
return "text";
|
|
2558
2624
|
}
|
|
2559
2625
|
function nodeLabel(node, kind, nodeIndex) {
|
|
@@ -2564,9 +2630,9 @@ function nodeLabel(node, kind, nodeIndex) {
|
|
|
2564
2630
|
if (kind === "audio") return `\u64AD\u653E\u97F3\u9891 ${nodeIndex + 1}`;
|
|
2565
2631
|
return typeof node.text === "string" ? node.text : void 0;
|
|
2566
2632
|
}
|
|
2567
|
-
function
|
|
2568
|
-
if (
|
|
2569
|
-
if (
|
|
2633
|
+
function boardKindOf(kinds) {
|
|
2634
|
+
if (kinds.includes("image")) return "image";
|
|
2635
|
+
if (kinds.includes("audio")) return "audio";
|
|
2570
2636
|
return "text";
|
|
2571
2637
|
}
|
|
2572
2638
|
function nodeOk(data, side, nodeIndex) {
|
|
@@ -2576,7 +2642,7 @@ function nodeOk(data, side, nodeIndex) {
|
|
|
2576
2642
|
}
|
|
2577
2643
|
|
|
2578
2644
|
// src/questions/link-match/link-node.tsx
|
|
2579
|
-
var
|
|
2645
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2580
2646
|
var BARS = [8, 14, 20, 10, 24, 16, 9, 18, 12];
|
|
2581
2647
|
function LinkNode({
|
|
2582
2648
|
side,
|
|
@@ -2593,7 +2659,7 @@ function LinkNode({
|
|
|
2593
2659
|
}) {
|
|
2594
2660
|
var _a, _b;
|
|
2595
2661
|
const label = nodeLabel(node, kind, nodeIndex);
|
|
2596
|
-
return /* @__PURE__ */ (0,
|
|
2662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2597
2663
|
"button",
|
|
2598
2664
|
{
|
|
2599
2665
|
type: "button",
|
|
@@ -2614,10 +2680,10 @@ function LinkNode({
|
|
|
2614
2680
|
"aria-pressed": picked,
|
|
2615
2681
|
"aria-label": label,
|
|
2616
2682
|
children: [
|
|
2617
|
-
side === "right" ? /* @__PURE__ */ (0,
|
|
2618
|
-
kind === "image" ? /* @__PURE__ */ (0,
|
|
2619
|
-
/* @__PURE__ */ (0,
|
|
2620
|
-
node.image ? /* @__PURE__ */ (0,
|
|
2683
|
+
side === "right" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-marker", children: optionLetter(nodeIndex) }) : null,
|
|
2684
|
+
kind === "image" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "rqk-link-node-media", children: [
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-media-fallback", children: (_a = node.imageAlt) != null ? _a : typeof node.text === "string" ? node.text : "\u56FE\u7247" }),
|
|
2686
|
+
node.image ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2621
2687
|
"img",
|
|
2622
2688
|
{
|
|
2623
2689
|
className: "rqk-link-node-image-media",
|
|
@@ -2627,31 +2693,31 @@ function LinkNode({
|
|
|
2627
2693
|
event.currentTarget.style.opacity = "0";
|
|
2628
2694
|
}
|
|
2629
2695
|
}
|
|
2630
|
-
) : node.art ? /* @__PURE__ */ (0,
|
|
2631
|
-
] }) : kind === "audio" ? /* @__PURE__ */ (0,
|
|
2632
|
-
/* @__PURE__ */ (0,
|
|
2633
|
-
/* @__PURE__ */ (0,
|
|
2634
|
-
] }) : /* @__PURE__ */ (0,
|
|
2635
|
-
/* @__PURE__ */ (0,
|
|
2636
|
-
node.phonetic ? /* @__PURE__ */ (0,
|
|
2637
|
-
node.speak || node.audio ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "rqk-link-node-sound", "aria-hidden": true, children: [
|
|
2638
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", {}),
|
|
2639
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", {}),
|
|
2640
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", {})
|
|
2641
|
-
] }) : null
|
|
2696
|
+
) : node.art ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-art", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Art, { name: node.art }) }) : null
|
|
2697
|
+
] }) : kind === "audio" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "rqk-link-node-audio", children: [
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-audio-icon", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-audio-triangle" }) }),
|
|
2699
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-wave", "aria-hidden": true, children: BARS.map((height, barIndex) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { height } }, barIndex)) })
|
|
2700
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "rqk-link-node-text", children: [
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-word", children: node.text }),
|
|
2702
|
+
node.phonetic ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-node-sub", children: node.phonetic }) : null
|
|
2642
2703
|
] }),
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2704
|
+
kind !== "audio" && node.audio ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "rqk-link-node-sound", "aria-hidden": true, children: [
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", {}),
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", {}),
|
|
2707
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", {})
|
|
2708
|
+
] }) : null,
|
|
2709
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rqk-link-dot", "aria-hidden": true })
|
|
2644
2710
|
]
|
|
2645
2711
|
}
|
|
2646
2712
|
);
|
|
2647
2713
|
}
|
|
2648
2714
|
|
|
2649
2715
|
// src/questions/link-match/link-board.tsx
|
|
2650
|
-
var
|
|
2716
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2651
2717
|
function LinkBoard({
|
|
2652
2718
|
data,
|
|
2653
|
-
|
|
2654
|
-
|
|
2719
|
+
leftKinds,
|
|
2720
|
+
rightKinds,
|
|
2655
2721
|
boardHeightKind,
|
|
2656
2722
|
boardRef,
|
|
2657
2723
|
leftRefs,
|
|
@@ -2665,7 +2731,7 @@ function LinkBoard({
|
|
|
2665
2731
|
readonly,
|
|
2666
2732
|
onNode
|
|
2667
2733
|
}) {
|
|
2668
|
-
return /* @__PURE__ */ (0,
|
|
2734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2669
2735
|
"div",
|
|
2670
2736
|
{
|
|
2671
2737
|
className: classNames("rqk-link-board", `rqk-link-board-h-${boardHeightKind}`),
|
|
@@ -2673,7 +2739,7 @@ function LinkBoard({
|
|
|
2673
2739
|
boardRef.current = element;
|
|
2674
2740
|
},
|
|
2675
2741
|
children: [
|
|
2676
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("svg", { className: "rqk-link-lines", width: size.width, height: size.height, "aria-hidden": true, children: paths.map((path) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2677
2743
|
"path",
|
|
2678
2744
|
{
|
|
2679
2745
|
d: path.d,
|
|
@@ -2686,18 +2752,16 @@ function LinkBoard({
|
|
|
2686
2752
|
path.key
|
|
2687
2753
|
)) }),
|
|
2688
2754
|
["left", "right"].map((side) => {
|
|
2689
|
-
const
|
|
2755
|
+
const kinds = side === "left" ? leftKinds : rightKinds;
|
|
2690
2756
|
const nodes = side === "left" ? data.left : data.right;
|
|
2691
2757
|
const refs = side === "left" ? leftRefs : rightRefs;
|
|
2692
|
-
return /* @__PURE__ */ (0,
|
|
2758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2693
2759
|
"div",
|
|
2694
2760
|
{
|
|
2695
|
-
className: classNames(
|
|
2696
|
-
"rqk-link-column",
|
|
2697
|
-
`rqk-link-column-${side}`,
|
|
2698
|
-
`rqk-link-column-${kind}`
|
|
2699
|
-
),
|
|
2761
|
+
className: classNames("rqk-link-column", `rqk-link-column-${side}`),
|
|
2700
2762
|
children: nodes.map((node, nodeIndex) => {
|
|
2763
|
+
var _a;
|
|
2764
|
+
const kind = (_a = kinds[nodeIndex]) != null ? _a : "text";
|
|
2701
2765
|
const linked = shownPairs.some(
|
|
2702
2766
|
([left, right]) => side === "left" ? left === nodeIndex : right === nodeIndex
|
|
2703
2767
|
);
|
|
@@ -2705,7 +2769,7 @@ function LinkBoard({
|
|
|
2705
2769
|
const isPlaying = (playing == null ? void 0 : playing.side) === side && playing.index === nodeIndex;
|
|
2706
2770
|
const correct = phase === "locked" || readonly ? nodeOk(data, side, nodeIndex) : false;
|
|
2707
2771
|
const wrong = phase === "locked" && side === "left" && !nodeOk(data, side, nodeIndex);
|
|
2708
|
-
return /* @__PURE__ */ (0,
|
|
2772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2709
2773
|
LinkNode,
|
|
2710
2774
|
{
|
|
2711
2775
|
side,
|
|
@@ -2734,52 +2798,46 @@ function LinkBoard({
|
|
|
2734
2798
|
|
|
2735
2799
|
// src/questions/link-match/use-link-audio.ts
|
|
2736
2800
|
var import_react15 = require("react");
|
|
2801
|
+
var MIN_PLAYING_MS = 500;
|
|
2737
2802
|
function useLinkAudio(data) {
|
|
2738
|
-
const config = useQuestConfig();
|
|
2739
2803
|
const [playing, setPlaying] = (0, import_react15.useState)(null);
|
|
2740
2804
|
const audioRef = (0, import_react15.useRef)(null);
|
|
2805
|
+
const playToken = (0, import_react15.useRef)(0);
|
|
2741
2806
|
const speakNode = (side, nodeIndex) => {
|
|
2742
|
-
var _a
|
|
2807
|
+
var _a;
|
|
2743
2808
|
const node = (side === "left" ? data.left : data.right)[nodeIndex];
|
|
2744
|
-
if (!node) return;
|
|
2809
|
+
if (!(node == null ? void 0 : node.audio)) return;
|
|
2810
|
+
const token = ++playToken.current;
|
|
2745
2811
|
(_a = audioRef.current) == null ? void 0 : _a.pause();
|
|
2746
2812
|
audioRef.current = null;
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2813
|
+
try {
|
|
2814
|
+
const audio = new Audio(node.audio);
|
|
2815
|
+
audioRef.current = audio;
|
|
2816
|
+
const startedAt = Date.now();
|
|
2817
|
+
const clear = (immediate = false) => {
|
|
2818
|
+
if (playToken.current !== token) return;
|
|
2819
|
+
const remaining = immediate ? 0 : Math.max(0, MIN_PLAYING_MS - (Date.now() - startedAt));
|
|
2820
|
+
window.setTimeout(() => {
|
|
2821
|
+
if (playToken.current !== token) return;
|
|
2752
2822
|
if (audioRef.current === audio) audioRef.current = null;
|
|
2753
2823
|
setPlaying(
|
|
2754
2824
|
(current) => (current == null ? void 0 : current.side) === side && current.index === nodeIndex ? null : current
|
|
2755
2825
|
);
|
|
2756
|
-
};
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
const played = audio.play();
|
|
2761
|
-
if (played && typeof played.catch === "function") void played.catch(clear);
|
|
2762
|
-
} catch (e) {
|
|
2763
|
-
setPlaying(null);
|
|
2764
|
-
}
|
|
2765
|
-
return;
|
|
2766
|
-
}
|
|
2767
|
-
if (node.speak) {
|
|
2768
|
-
const text = (_b = node.spokenText) != null ? _b : typeof node.text === "string" ? node.text : "";
|
|
2769
|
-
if (!text) return;
|
|
2826
|
+
}, remaining);
|
|
2827
|
+
};
|
|
2828
|
+
audio.onended = () => clear();
|
|
2829
|
+
audio.onerror = () => clear(true);
|
|
2770
2830
|
setPlaying({ side, index: nodeIndex });
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
} catch (e) {
|
|
2776
|
-
setPlaying(null);
|
|
2777
|
-
}
|
|
2831
|
+
const played = audio.play();
|
|
2832
|
+
if (played && typeof played.catch === "function") void played.catch(() => clear(true));
|
|
2833
|
+
} catch (e) {
|
|
2834
|
+
if (playToken.current === token) setPlaying(null);
|
|
2778
2835
|
}
|
|
2779
2836
|
};
|
|
2780
2837
|
(0, import_react15.useEffect)(
|
|
2781
2838
|
() => () => {
|
|
2782
2839
|
var _a;
|
|
2840
|
+
playToken.current += 1;
|
|
2783
2841
|
(_a = audioRef.current) == null ? void 0 : _a.pause();
|
|
2784
2842
|
audioRef.current = null;
|
|
2785
2843
|
},
|
|
@@ -2863,12 +2921,12 @@ function useLinkPairs({
|
|
|
2863
2921
|
onSubmit,
|
|
2864
2922
|
sound,
|
|
2865
2923
|
demoAttempt,
|
|
2866
|
-
leftKind,
|
|
2867
|
-
rightKind,
|
|
2868
2924
|
speakNode
|
|
2869
2925
|
}) {
|
|
2870
2926
|
var _a;
|
|
2871
2927
|
const readonly = isReadonly(mode);
|
|
2928
|
+
const totalPairs = Math.min(data.left.length, data.right.length);
|
|
2929
|
+
const hasAnswer = data.pairs.length > 0;
|
|
2872
2930
|
const expected = (0, import_react17.useMemo)(
|
|
2873
2931
|
() => new Set(data.pairs.map(([left, right]) => pairKey(left, right))),
|
|
2874
2932
|
[data.pairs]
|
|
@@ -2876,19 +2934,17 @@ function useLinkPairs({
|
|
|
2876
2934
|
const [pairs, setPairs] = (0, import_react17.useState)([]);
|
|
2877
2935
|
const [selection, setSelection] = (0, import_react17.useState)(null);
|
|
2878
2936
|
const judge = useJudge({
|
|
2879
|
-
evaluate: () => pairs.length ===
|
|
2937
|
+
evaluate: () => pairs.length === totalPairs && (!hasAnswer || pairs.every(([left, right]) => expected.has(pairKey(left, right)))),
|
|
2880
2938
|
onFirstWrong: () => setPairs((current) => current.filter(([left, right]) => expected.has(pairKey(left, right)))),
|
|
2881
2939
|
sound,
|
|
2882
2940
|
demoAttempt
|
|
2883
2941
|
});
|
|
2884
2942
|
const frozen = readonly || judge.phase === "correct" || judge.phase === "locked";
|
|
2885
2943
|
const shownPairs = readonly ? data.pairs : pairs;
|
|
2886
|
-
const complete = pairs.length ===
|
|
2944
|
+
const complete = pairs.length === totalPairs;
|
|
2887
2945
|
const handleNode = (side, nodeIndex) => {
|
|
2888
2946
|
const node = (side === "left" ? data.left : data.right)[nodeIndex];
|
|
2889
|
-
if (
|
|
2890
|
-
speakNode(side, nodeIndex);
|
|
2891
|
-
}
|
|
2947
|
+
if (node == null ? void 0 : node.audio) speakNode(side, nodeIndex);
|
|
2892
2948
|
if (frozen) return;
|
|
2893
2949
|
if (sound !== false) questSfx.tick();
|
|
2894
2950
|
const existing = pairs.find(
|
|
@@ -2939,15 +2995,13 @@ function useLinkPairs({
|
|
|
2939
2995
|
readonly,
|
|
2940
2996
|
selection,
|
|
2941
2997
|
shownPairs,
|
|
2942
|
-
pairs
|
|
2998
|
+
pairs,
|
|
2999
|
+
totalPairs
|
|
2943
3000
|
};
|
|
2944
3001
|
}
|
|
2945
|
-
function projectKind(side, leftKind, rightKind) {
|
|
2946
|
-
return side === "left" ? leftKind : rightKind;
|
|
2947
|
-
}
|
|
2948
3002
|
|
|
2949
3003
|
// src/questions/link-match/index.tsx
|
|
2950
|
-
var
|
|
3004
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2951
3005
|
function LinkMatch({
|
|
2952
3006
|
data,
|
|
2953
3007
|
mode = "answer",
|
|
@@ -2963,11 +3017,10 @@ function LinkMatch({
|
|
|
2963
3017
|
demoAttempt,
|
|
2964
3018
|
className
|
|
2965
3019
|
}) {
|
|
2966
|
-
var _a, _b;
|
|
2967
3020
|
const labels = useQuestLabels();
|
|
2968
|
-
const
|
|
2969
|
-
const
|
|
2970
|
-
const boardHeightKind =
|
|
3021
|
+
const leftKinds = data.left.map((node) => nodeKind(node, data.leftKind));
|
|
3022
|
+
const rightKinds = data.right.map((node) => nodeKind(node, data.rightKind));
|
|
3023
|
+
const boardHeightKind = boardKindOf([...leftKinds, ...rightKinds]);
|
|
2971
3024
|
const audio = useLinkAudio(data);
|
|
2972
3025
|
const pairs = useLinkPairs({
|
|
2973
3026
|
data,
|
|
@@ -2975,8 +3028,6 @@ function LinkMatch({
|
|
|
2975
3028
|
onSubmit,
|
|
2976
3029
|
sound,
|
|
2977
3030
|
demoAttempt,
|
|
2978
|
-
leftKind,
|
|
2979
|
-
rightKind,
|
|
2980
3031
|
speakNode: audio.speakNode
|
|
2981
3032
|
});
|
|
2982
3033
|
const geometry = useLinkGeometry({
|
|
@@ -2991,12 +3042,12 @@ function LinkMatch({
|
|
|
2991
3042
|
labels,
|
|
2992
3043
|
complete: pairs.complete,
|
|
2993
3044
|
pairCount: pairs.pairs.length,
|
|
2994
|
-
totalPairs:
|
|
3045
|
+
totalPairs: pairs.totalPairs,
|
|
2995
3046
|
onNext,
|
|
2996
3047
|
onSubmit: pairs.handleSubmit,
|
|
2997
3048
|
onRetry: pairs.judge.retry
|
|
2998
3049
|
});
|
|
2999
|
-
return /* @__PURE__ */ (0,
|
|
3050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3000
3051
|
QuestShell,
|
|
3001
3052
|
{
|
|
3002
3053
|
mode,
|
|
@@ -3007,7 +3058,7 @@ function LinkMatch({
|
|
|
3007
3058
|
onBack,
|
|
3008
3059
|
className: classNames("rqk-quest", className),
|
|
3009
3060
|
dataQuest: "link-match",
|
|
3010
|
-
feedback: /* @__PURE__ */ (0,
|
|
3061
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3011
3062
|
LinkMatchFeedback,
|
|
3012
3063
|
{
|
|
3013
3064
|
readonly: pairs.readonly,
|
|
@@ -3017,15 +3068,15 @@ function LinkMatch({
|
|
|
3017
3068
|
answerText: pairs.answerText
|
|
3018
3069
|
}
|
|
3019
3070
|
),
|
|
3020
|
-
footer: /* @__PURE__ */ (0,
|
|
3021
|
-
children: /* @__PURE__ */ (0,
|
|
3022
|
-
data.hint ? /* @__PURE__ */ (0,
|
|
3023
|
-
/* @__PURE__ */ (0,
|
|
3071
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
3072
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3073
|
+
data.hint ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "rqk-link-hint", children: data.hint }) : null,
|
|
3074
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3024
3075
|
LinkBoard,
|
|
3025
3076
|
{
|
|
3026
3077
|
data,
|
|
3027
|
-
|
|
3028
|
-
|
|
3078
|
+
leftKinds,
|
|
3079
|
+
rightKinds,
|
|
3029
3080
|
boardHeightKind,
|
|
3030
3081
|
boardRef: geometry.boardRef,
|
|
3031
3082
|
leftRefs: geometry.leftRefs,
|
|
@@ -3069,7 +3120,7 @@ function rearrangeActions({
|
|
|
3069
3120
|
}
|
|
3070
3121
|
|
|
3071
3122
|
// src/questions/rearrange/feedback.tsx
|
|
3072
|
-
var
|
|
3123
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3073
3124
|
function RearrangeFeedback({
|
|
3074
3125
|
readonly,
|
|
3075
3126
|
phase,
|
|
@@ -3078,7 +3129,7 @@ function RearrangeFeedback({
|
|
|
3078
3129
|
answerText
|
|
3079
3130
|
}) {
|
|
3080
3131
|
if (readonly) {
|
|
3081
|
-
return /* @__PURE__ */ (0,
|
|
3132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3082
3133
|
FeedbackSheet,
|
|
3083
3134
|
{
|
|
3084
3135
|
tone: "ok",
|
|
@@ -3090,7 +3141,7 @@ function RearrangeFeedback({
|
|
|
3090
3141
|
);
|
|
3091
3142
|
}
|
|
3092
3143
|
if (phase === "retry") {
|
|
3093
|
-
return /* @__PURE__ */ (0,
|
|
3144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3094
3145
|
FeedbackSheet,
|
|
3095
3146
|
{
|
|
3096
3147
|
tone: "warn",
|
|
@@ -3100,10 +3151,10 @@ function RearrangeFeedback({
|
|
|
3100
3151
|
);
|
|
3101
3152
|
}
|
|
3102
3153
|
if (phase === "correct") {
|
|
3103
|
-
return /* @__PURE__ */ (0,
|
|
3154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll, answer: answerText });
|
|
3104
3155
|
}
|
|
3105
3156
|
if (phase === "locked") {
|
|
3106
|
-
return /* @__PURE__ */ (0,
|
|
3157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3107
3158
|
FeedbackSheet,
|
|
3108
3159
|
{
|
|
3109
3160
|
tone: "bad",
|
|
@@ -3119,7 +3170,7 @@ function RearrangeFeedback({
|
|
|
3119
3170
|
}
|
|
3120
3171
|
|
|
3121
3172
|
// src/primitives/word-chip.tsx
|
|
3122
|
-
var
|
|
3173
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3123
3174
|
function WordChip({
|
|
3124
3175
|
children,
|
|
3125
3176
|
onClick,
|
|
@@ -3130,7 +3181,7 @@ function WordChip({
|
|
|
3130
3181
|
className,
|
|
3131
3182
|
ariaLabel
|
|
3132
3183
|
}) {
|
|
3133
|
-
return /* @__PURE__ */ (0,
|
|
3184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3134
3185
|
"button",
|
|
3135
3186
|
{
|
|
3136
3187
|
type: "button",
|
|
@@ -3145,14 +3196,14 @@ function WordChip({
|
|
|
3145
3196
|
"aria-label": ariaLabel,
|
|
3146
3197
|
children: [
|
|
3147
3198
|
children,
|
|
3148
|
-
removable ? /* @__PURE__ */ (0,
|
|
3199
|
+
removable ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CrossIcon, { className: "rqk-chip-remove", size: 14 }) : null
|
|
3149
3200
|
]
|
|
3150
3201
|
}
|
|
3151
3202
|
);
|
|
3152
3203
|
}
|
|
3153
3204
|
|
|
3154
3205
|
// src/questions/rearrange/bank-card.tsx
|
|
3155
|
-
var
|
|
3206
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3156
3207
|
function RearrangeBank({
|
|
3157
3208
|
data,
|
|
3158
3209
|
bank,
|
|
@@ -3160,11 +3211,11 @@ function RearrangeBank({
|
|
|
3160
3211
|
tileUsed,
|
|
3161
3212
|
onPick
|
|
3162
3213
|
}) {
|
|
3163
|
-
return /* @__PURE__ */ (0,
|
|
3164
|
-
/* @__PURE__ */ (0,
|
|
3165
|
-
/* @__PURE__ */ (0,
|
|
3214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Card, { className: "rqk-rearrange-bank", children: [
|
|
3215
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "rqk-rearrange-bank-label", children: data.kind === "word" ? "\u53EF\u9009\u5B57\u6BCD" : "\u53EF\u9009\u5355\u8BCD" }),
|
|
3216
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "rqk-rearrange-tiles", children: bank.map((tile, tileIndex) => {
|
|
3166
3217
|
const used = tileUsed(tile);
|
|
3167
|
-
return /* @__PURE__ */ (0,
|
|
3218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3168
3219
|
WordChip,
|
|
3169
3220
|
{
|
|
3170
3221
|
variant: data.kind === "word" ? "letter" : "bank",
|
|
@@ -3180,7 +3231,7 @@ function RearrangeBank({
|
|
|
3180
3231
|
}
|
|
3181
3232
|
|
|
3182
3233
|
// src/questions/rearrange/slots-card.tsx
|
|
3183
|
-
var
|
|
3234
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3184
3235
|
function RearrangeSlots({
|
|
3185
3236
|
data,
|
|
3186
3237
|
slots,
|
|
@@ -3190,15 +3241,15 @@ function RearrangeSlots({
|
|
|
3190
3241
|
isSlotOk,
|
|
3191
3242
|
onSlot
|
|
3192
3243
|
}) {
|
|
3193
|
-
return /* @__PURE__ */ (0,
|
|
3194
|
-
data.hint ? /* @__PURE__ */ (0,
|
|
3244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Card, { className: "rqk-rearrange-slots", children: [
|
|
3245
|
+
data.hint ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "rqk-rearrange-hint", children: [
|
|
3195
3246
|
"\u63D0\u793A\uFF1A",
|
|
3196
3247
|
data.hint
|
|
3197
3248
|
] }) : null,
|
|
3198
3249
|
slots.map((slot, slotIndex) => {
|
|
3199
3250
|
const value = slot.holder ? slot.char : filled[slotIndex];
|
|
3200
3251
|
const current = !slot.holder && !value && cursor === slotIndex;
|
|
3201
|
-
return /* @__PURE__ */ (0,
|
|
3252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3202
3253
|
"button",
|
|
3203
3254
|
{
|
|
3204
3255
|
type: "button",
|
|
@@ -3214,7 +3265,7 @@ function RearrangeSlots({
|
|
|
3214
3265
|
disabled: slot.holder,
|
|
3215
3266
|
children: [
|
|
3216
3267
|
value,
|
|
3217
|
-
current ? /* @__PURE__ */ (0,
|
|
3268
|
+
current ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "rqk-rearrange-caret" }) : null
|
|
3218
3269
|
]
|
|
3219
3270
|
},
|
|
3220
3271
|
slotIndex
|
|
@@ -3224,7 +3275,7 @@ function RearrangeSlots({
|
|
|
3224
3275
|
}
|
|
3225
3276
|
|
|
3226
3277
|
// src/questions/rearrange/rearrange-page.tsx
|
|
3227
|
-
var
|
|
3278
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3228
3279
|
function RearrangePage({
|
|
3229
3280
|
data,
|
|
3230
3281
|
slots,
|
|
@@ -3238,8 +3289,8 @@ function RearrangePage({
|
|
|
3238
3289
|
onSlot,
|
|
3239
3290
|
onPick
|
|
3240
3291
|
}) {
|
|
3241
|
-
return /* @__PURE__ */ (0,
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3243
3294
|
RearrangeSlots,
|
|
3244
3295
|
{
|
|
3245
3296
|
data,
|
|
@@ -3251,7 +3302,7 @@ function RearrangePage({
|
|
|
3251
3302
|
onSlot
|
|
3252
3303
|
}
|
|
3253
3304
|
),
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3305
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RearrangeBank, { data, bank, frozen, tileUsed, onPick })
|
|
3255
3306
|
] });
|
|
3256
3307
|
}
|
|
3257
3308
|
|
|
@@ -3431,7 +3482,7 @@ function useRearrange({
|
|
|
3431
3482
|
}
|
|
3432
3483
|
|
|
3433
3484
|
// src/questions/rearrange/index.tsx
|
|
3434
|
-
var
|
|
3485
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3435
3486
|
function Rearrange({
|
|
3436
3487
|
data,
|
|
3437
3488
|
mode = "answer",
|
|
@@ -3457,26 +3508,26 @@ function Rearrange({
|
|
|
3457
3508
|
onSubmit: model.handleSubmit,
|
|
3458
3509
|
onRetry: model.judge.retry
|
|
3459
3510
|
});
|
|
3460
|
-
return /* @__PURE__ */ (0,
|
|
3511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3461
3512
|
QuestShell,
|
|
3462
3513
|
{
|
|
3463
3514
|
mode,
|
|
3464
3515
|
title: title != null ? title : data.kind === "word" ? "\u5355\u8BCD\u91CD\u7EC4" : "\u53E5\u5B50\u91CD\u7EC4",
|
|
3465
3516
|
index,
|
|
3466
3517
|
total,
|
|
3467
|
-
instruction: instruction != null ? instruction : data.kind === "word" ? /* @__PURE__ */ (0,
|
|
3518
|
+
instruction: instruction != null ? instruction : data.kind === "word" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
3468
3519
|
"\u6309\u5B57\u6BCD\u987A\u5E8F\u586B\u5165",
|
|
3469
|
-
/* @__PURE__ */ (0,
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("b", { children: "\u6A2A\u7EBF" }),
|
|
3470
3521
|
"\uFF0C\u62FC\u51FA\u5355\u8BCD"
|
|
3471
|
-
] }) : /* @__PURE__ */ (0,
|
|
3522
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
3472
3523
|
"\u6309\u6B63\u786E\u987A\u5E8F\u628A\u8BCD\u5757\u586B\u5165",
|
|
3473
|
-
/* @__PURE__ */ (0,
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("b", { children: "\u6A2A\u7EBF" }),
|
|
3474
3525
|
"\uFF0C\u62FC\u51FA\u53E5\u5B50"
|
|
3475
3526
|
] }),
|
|
3476
3527
|
onBack,
|
|
3477
3528
|
className: classNames("rqk-quest", "rqk-rearrange", className),
|
|
3478
3529
|
dataQuest: "rearrange",
|
|
3479
|
-
feedback: /* @__PURE__ */ (0,
|
|
3530
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3480
3531
|
RearrangeFeedback,
|
|
3481
3532
|
{
|
|
3482
3533
|
readonly: model.readonly,
|
|
@@ -3486,8 +3537,8 @@ function Rearrange({
|
|
|
3486
3537
|
answerText: targetAnswerText(data)
|
|
3487
3538
|
}
|
|
3488
3539
|
),
|
|
3489
|
-
footer: /* @__PURE__ */ (0,
|
|
3490
|
-
children: /* @__PURE__ */ (0,
|
|
3540
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
3541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3491
3542
|
RearrangePage,
|
|
3492
3543
|
{
|
|
3493
3544
|
data,
|
|
@@ -3531,20 +3582,20 @@ function classifyActions({
|
|
|
3531
3582
|
}
|
|
3532
3583
|
|
|
3533
3584
|
// src/questions/classify/bank-card.tsx
|
|
3534
|
-
var
|
|
3585
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3535
3586
|
function ClassifyBank({
|
|
3536
3587
|
data,
|
|
3537
3588
|
remaining,
|
|
3538
3589
|
frozen,
|
|
3539
3590
|
onPick
|
|
3540
3591
|
}) {
|
|
3541
|
-
return /* @__PURE__ */ (0,
|
|
3542
|
-
/* @__PURE__ */ (0,
|
|
3592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Card, { className: "rqk-classify-bank", children: [
|
|
3593
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "rqk-classify-bank-label", children: [
|
|
3543
3594
|
"\u5F85\u5206\u7C7B \xB7 \u5269\u4F59 ",
|
|
3544
3595
|
remaining.length,
|
|
3545
3596
|
" \u9879"
|
|
3546
3597
|
] }),
|
|
3547
|
-
/* @__PURE__ */ (0,
|
|
3598
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "rqk-classify-bank-items", children: remaining.length ? remaining.map((itemIndex) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3548
3599
|
WordChip,
|
|
3549
3600
|
{
|
|
3550
3601
|
variant: "bank",
|
|
@@ -3553,12 +3604,12 @@ function ClassifyBank({
|
|
|
3553
3604
|
children: data.items[itemIndex].text
|
|
3554
3605
|
},
|
|
3555
3606
|
itemIndex
|
|
3556
|
-
)) : /* @__PURE__ */ (0,
|
|
3607
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "rqk-classify-empty", children: "\u5DF2\u5168\u90E8\u5F52\u7C7B" }) })
|
|
3557
3608
|
] });
|
|
3558
3609
|
}
|
|
3559
3610
|
|
|
3560
3611
|
// src/questions/classify/category-card.tsx
|
|
3561
|
-
var
|
|
3612
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3562
3613
|
function ClassifyCategory({
|
|
3563
3614
|
categoryIndex,
|
|
3564
3615
|
category,
|
|
@@ -3572,7 +3623,7 @@ function ClassifyCategory({
|
|
|
3572
3623
|
}) {
|
|
3573
3624
|
const items = data.items.map((_item, itemIndex) => placed[itemIndex] === categoryIndex ? itemIndex : null).filter((itemIndex) => itemIndex !== null);
|
|
3574
3625
|
const focused = !frozen && current === categoryIndex;
|
|
3575
|
-
return /* @__PURE__ */ (0,
|
|
3626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3576
3627
|
"div",
|
|
3577
3628
|
{
|
|
3578
3629
|
className: classNames("rqk-card", "rqk-classify-cat", focused && "rqk-is-selected"),
|
|
@@ -3586,20 +3637,20 @@ function ClassifyCategory({
|
|
|
3586
3637
|
role: "button",
|
|
3587
3638
|
tabIndex: frozen ? -1 : 0,
|
|
3588
3639
|
children: [
|
|
3589
|
-
/* @__PURE__ */ (0,
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3640
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "rqk-classify-cat-head", children: [
|
|
3641
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "rqk-classify-cat-name", children: [
|
|
3591
3642
|
category.label,
|
|
3592
|
-
category.sub ? /* @__PURE__ */ (0,
|
|
3643
|
+
category.sub ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("em", { className: "rqk-classify-cat-sub", children: category.sub }) : null
|
|
3593
3644
|
] }),
|
|
3594
|
-
/* @__PURE__ */ (0,
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "rqk-classify-cat-count", children: [
|
|
3595
3646
|
items.length,
|
|
3596
3647
|
" \u9879"
|
|
3597
3648
|
] })
|
|
3598
3649
|
] }),
|
|
3599
|
-
/* @__PURE__ */ (0,
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "rqk-classify-cat-body", children: items.length ? items.map((itemIndex) => {
|
|
3600
3651
|
const item = data.items[itemIndex];
|
|
3601
3652
|
const slotOk = placed[itemIndex] === item.category;
|
|
3602
|
-
return /* @__PURE__ */ (0,
|
|
3653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3603
3654
|
WordChip,
|
|
3604
3655
|
{
|
|
3605
3656
|
variant: "placed",
|
|
@@ -3614,14 +3665,14 @@ function ClassifyCategory({
|
|
|
3614
3665
|
},
|
|
3615
3666
|
itemIndex
|
|
3616
3667
|
);
|
|
3617
|
-
}) : /* @__PURE__ */ (0,
|
|
3668
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "rqk-classify-empty", children: "\u70B9\u51FB\u9009\u9879\u653E\u5165\u8FD9\u4E00\u7C7B" }) })
|
|
3618
3669
|
]
|
|
3619
3670
|
}
|
|
3620
3671
|
);
|
|
3621
3672
|
}
|
|
3622
3673
|
|
|
3623
3674
|
// src/questions/classify/classify-page.tsx
|
|
3624
|
-
var
|
|
3675
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3625
3676
|
function ClassifyPage({
|
|
3626
3677
|
data,
|
|
3627
3678
|
placed,
|
|
@@ -3633,8 +3684,8 @@ function ClassifyPage({
|
|
|
3633
3684
|
onUnplace,
|
|
3634
3685
|
onPick
|
|
3635
3686
|
}) {
|
|
3636
|
-
return /* @__PURE__ */ (0,
|
|
3637
|
-
data.categories.map((category, categoryIndex) => /* @__PURE__ */ (0,
|
|
3687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
3688
|
+
data.categories.map((category, categoryIndex) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3638
3689
|
ClassifyCategory,
|
|
3639
3690
|
{
|
|
3640
3691
|
categoryIndex,
|
|
@@ -3649,12 +3700,12 @@ function ClassifyPage({
|
|
|
3649
3700
|
},
|
|
3650
3701
|
categoryIndex
|
|
3651
3702
|
)),
|
|
3652
|
-
/* @__PURE__ */ (0,
|
|
3703
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ClassifyBank, { data, remaining, frozen, onPick })
|
|
3653
3704
|
] });
|
|
3654
3705
|
}
|
|
3655
3706
|
|
|
3656
3707
|
// src/questions/classify/feedback.tsx
|
|
3657
|
-
var
|
|
3708
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3658
3709
|
function ClassifyFeedback({
|
|
3659
3710
|
readonly,
|
|
3660
3711
|
phase,
|
|
@@ -3663,7 +3714,7 @@ function ClassifyFeedback({
|
|
|
3663
3714
|
answerText
|
|
3664
3715
|
}) {
|
|
3665
3716
|
if (readonly) {
|
|
3666
|
-
return /* @__PURE__ */ (0,
|
|
3717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3667
3718
|
FeedbackSheet,
|
|
3668
3719
|
{
|
|
3669
3720
|
tone: "ok",
|
|
@@ -3675,13 +3726,13 @@ function ClassifyFeedback({
|
|
|
3675
3726
|
);
|
|
3676
3727
|
}
|
|
3677
3728
|
if (phase === "retry") {
|
|
3678
|
-
return /* @__PURE__ */ (0,
|
|
3729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FeedbackSheet, { tone: "warn", title: "\u6709\u653E\u9519\u7C7B\u522B\u7684\u5355\u8BCD", detail: "\u5206\u7C7B\u6B63\u786E\u7684\u5355\u8BCD\u5DF2\u4E3A\u4F60\u4FDD\u7559" });
|
|
3679
3730
|
}
|
|
3680
3731
|
if (phase === "correct") {
|
|
3681
|
-
return /* @__PURE__ */ (0,
|
|
3732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll, answer: answerText });
|
|
3682
3733
|
}
|
|
3683
3734
|
if (phase === "locked") {
|
|
3684
|
-
return /* @__PURE__ */ (0,
|
|
3735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3685
3736
|
FeedbackSheet,
|
|
3686
3737
|
{
|
|
3687
3738
|
tone: "bad",
|
|
@@ -3779,7 +3830,7 @@ function useClassify({
|
|
|
3779
3830
|
}
|
|
3780
3831
|
|
|
3781
3832
|
// src/questions/classify/index.tsx
|
|
3782
|
-
var
|
|
3833
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3783
3834
|
function Classify({
|
|
3784
3835
|
data,
|
|
3785
3836
|
mode = "answer",
|
|
@@ -3805,21 +3856,21 @@ function Classify({
|
|
|
3805
3856
|
onSubmit: model.handleSubmit,
|
|
3806
3857
|
onRetry: model.judge.retry
|
|
3807
3858
|
});
|
|
3808
|
-
return /* @__PURE__ */ (0,
|
|
3859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3809
3860
|
QuestShell,
|
|
3810
3861
|
{
|
|
3811
3862
|
mode,
|
|
3812
3863
|
title: title != null ? title : "\u5206\u7C7B\u9898",
|
|
3813
3864
|
index,
|
|
3814
3865
|
total,
|
|
3815
|
-
instruction: instruction != null ? instruction : /* @__PURE__ */ (0,
|
|
3866
|
+
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
3816
3867
|
"\u628A\u5355\u8BCD\u70B9\u9009\u5230",
|
|
3817
|
-
/* @__PURE__ */ (0,
|
|
3868
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("b", { children: "\u6B63\u786E\u7684\u7C7B\u522B" })
|
|
3818
3869
|
] }),
|
|
3819
3870
|
onBack,
|
|
3820
3871
|
className: classNames("rqk-quest", "rqk-classify", className),
|
|
3821
3872
|
dataQuest: "classify",
|
|
3822
|
-
feedback: /* @__PURE__ */ (0,
|
|
3873
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3823
3874
|
ClassifyFeedback,
|
|
3824
3875
|
{
|
|
3825
3876
|
readonly: model.readonly,
|
|
@@ -3829,8 +3880,8 @@ function Classify({
|
|
|
3829
3880
|
answerText: model.answerText
|
|
3830
3881
|
}
|
|
3831
3882
|
),
|
|
3832
|
-
footer: /* @__PURE__ */ (0,
|
|
3833
|
-
children: /* @__PURE__ */ (0,
|
|
3883
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
3884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3834
3885
|
ClassifyPage,
|
|
3835
3886
|
{
|
|
3836
3887
|
data,
|
|
@@ -3878,7 +3929,7 @@ function rewriteActions({
|
|
|
3878
3929
|
}
|
|
3879
3930
|
|
|
3880
3931
|
// src/questions/rewrite/answer-card.tsx
|
|
3881
|
-
var
|
|
3932
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3882
3933
|
function RewriteAnswerCard({
|
|
3883
3934
|
data,
|
|
3884
3935
|
value,
|
|
@@ -3890,12 +3941,12 @@ function RewriteAnswerCard({
|
|
|
3890
3941
|
showAnswers
|
|
3891
3942
|
}) {
|
|
3892
3943
|
var _a, _b;
|
|
3893
|
-
return /* @__PURE__ */ (0,
|
|
3894
|
-
/* @__PURE__ */ (0,
|
|
3895
|
-
/* @__PURE__ */ (0,
|
|
3944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Card, { className: "rqk-rewrite-card", children: [
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "rqk-rewrite-stem", children: [
|
|
3946
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "rqk-rewrite-badge", children: "\u539F\u53E5" }),
|
|
3896
3947
|
data.stem
|
|
3897
3948
|
] }),
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3949
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3899
3950
|
"textarea",
|
|
3900
3951
|
{
|
|
3901
3952
|
ref: (element) => {
|
|
@@ -3915,12 +3966,12 @@ function RewriteAnswerCard({
|
|
|
3915
3966
|
disabled: readonly || phase === "locked"
|
|
3916
3967
|
}
|
|
3917
3968
|
),
|
|
3918
|
-
showAnswers ? /* @__PURE__ */ (0,
|
|
3969
|
+
showAnswers ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "rqk-rewrite-answers", children: data.answers.map((answer, answerIndex2) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "rqk-rewrite-answer-chip", children: answer }, answerIndex2)) }) : null
|
|
3919
3970
|
] });
|
|
3920
3971
|
}
|
|
3921
3972
|
|
|
3922
3973
|
// src/questions/rewrite/feedback.tsx
|
|
3923
|
-
var
|
|
3974
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3924
3975
|
function RewriteFeedback({
|
|
3925
3976
|
readonly,
|
|
3926
3977
|
phase,
|
|
@@ -3928,7 +3979,7 @@ function RewriteFeedback({
|
|
|
3928
3979
|
labels
|
|
3929
3980
|
}) {
|
|
3930
3981
|
if (readonly) {
|
|
3931
|
-
return /* @__PURE__ */ (0,
|
|
3982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3932
3983
|
FeedbackSheet,
|
|
3933
3984
|
{
|
|
3934
3985
|
tone: "ok",
|
|
@@ -3940,13 +3991,13 @@ function RewriteFeedback({
|
|
|
3940
3991
|
);
|
|
3941
3992
|
}
|
|
3942
3993
|
if (phase === "retry") {
|
|
3943
|
-
return /* @__PURE__ */ (0,
|
|
3994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FeedbackSheet, { tone: "warn", title: "\u518D\u68C0\u67E5\u4E00\u4E0B\u8BED\u5E8F\u4E0E\u65F6\u6001", detail: "\u6CE8\u610F\u4FDD\u6301\u539F\u53E5\u7684\u4EBA\u79F0\u548C\u65F6\u6001" });
|
|
3944
3995
|
}
|
|
3945
3996
|
if (phase === "correct") {
|
|
3946
|
-
return /* @__PURE__ */ (0,
|
|
3997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll, answer: data.answers[0] });
|
|
3947
3998
|
}
|
|
3948
3999
|
if (phase === "locked") {
|
|
3949
|
-
return /* @__PURE__ */ (0,
|
|
4000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3950
4001
|
FeedbackSheet,
|
|
3951
4002
|
{
|
|
3952
4003
|
tone: "bad",
|
|
@@ -3962,10 +4013,10 @@ function RewriteFeedback({
|
|
|
3962
4013
|
}
|
|
3963
4014
|
|
|
3964
4015
|
// src/questions/rewrite/kb-hint.tsx
|
|
3965
|
-
var
|
|
4016
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3966
4017
|
function RewriteKbHint({ text }) {
|
|
3967
|
-
return /* @__PURE__ */ (0,
|
|
3968
|
-
/* @__PURE__ */ (0,
|
|
4018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "rqk-tx-kb-hint", children: [
|
|
4019
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KeyboardIcon, {}),
|
|
3969
4020
|
text
|
|
3970
4021
|
] });
|
|
3971
4022
|
}
|
|
@@ -4027,7 +4078,7 @@ function useRewrite({
|
|
|
4027
4078
|
}
|
|
4028
4079
|
|
|
4029
4080
|
// src/questions/rewrite/index.tsx
|
|
4030
|
-
var
|
|
4081
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4031
4082
|
function Rewrite({
|
|
4032
4083
|
data,
|
|
4033
4084
|
mode = "answer",
|
|
@@ -4054,7 +4105,7 @@ function Rewrite({
|
|
|
4054
4105
|
onSubmit: model.handleSubmit,
|
|
4055
4106
|
onRetry: model.judge.retry
|
|
4056
4107
|
});
|
|
4057
|
-
return /* @__PURE__ */ (0,
|
|
4108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4058
4109
|
QuestShell,
|
|
4059
4110
|
{
|
|
4060
4111
|
mode,
|
|
@@ -4065,7 +4116,7 @@ function Rewrite({
|
|
|
4065
4116
|
onBack,
|
|
4066
4117
|
className: classNames("rqk-quest", "rqk-rewrite", className),
|
|
4067
4118
|
dataQuest: "rewrite",
|
|
4068
|
-
feedback: /* @__PURE__ */ (0,
|
|
4119
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4069
4120
|
RewriteFeedback,
|
|
4070
4121
|
{
|
|
4071
4122
|
readonly: model.readonly,
|
|
@@ -4074,9 +4125,9 @@ function Rewrite({
|
|
|
4074
4125
|
labels: model.labels
|
|
4075
4126
|
}
|
|
4076
4127
|
),
|
|
4077
|
-
footer: /* @__PURE__ */ (0,
|
|
4078
|
-
children: /* @__PURE__ */ (0,
|
|
4079
|
-
/* @__PURE__ */ (0,
|
|
4128
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
4129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4080
4131
|
RewriteAnswerCard,
|
|
4081
4132
|
{
|
|
4082
4133
|
data,
|
|
@@ -4089,7 +4140,7 @@ function Rewrite({
|
|
|
4089
4140
|
showAnswers: model.showAnswers
|
|
4090
4141
|
}
|
|
4091
4142
|
),
|
|
4092
|
-
!model.readonly && !model.graded ? /* @__PURE__ */ (0,
|
|
4143
|
+
!model.readonly && !model.graded ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(RewriteKbHint, { text: "\u70B9\u51FB\u8F93\u5165\u6846\uFF0C\u7CFB\u7EDF\u952E\u76D8\u81EA\u52A8\u5F39\u51FA" }) : null
|
|
4093
4144
|
] })
|
|
4094
4145
|
}
|
|
4095
4146
|
);
|
|
@@ -4120,7 +4171,7 @@ function fillBlankActions({
|
|
|
4120
4171
|
}
|
|
4121
4172
|
|
|
4122
4173
|
// src/questions/fill-blank/feedback.tsx
|
|
4123
|
-
var
|
|
4174
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4124
4175
|
function FillBlankFeedback({
|
|
4125
4176
|
readonly,
|
|
4126
4177
|
phase,
|
|
@@ -4129,7 +4180,7 @@ function FillBlankFeedback({
|
|
|
4129
4180
|
answerText
|
|
4130
4181
|
}) {
|
|
4131
4182
|
if (readonly) {
|
|
4132
|
-
return /* @__PURE__ */ (0,
|
|
4183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4133
4184
|
FeedbackSheet,
|
|
4134
4185
|
{
|
|
4135
4186
|
tone: "ok",
|
|
@@ -4141,7 +4192,7 @@ function FillBlankFeedback({
|
|
|
4141
4192
|
);
|
|
4142
4193
|
}
|
|
4143
4194
|
if (phase === "retry") {
|
|
4144
|
-
return /* @__PURE__ */ (0,
|
|
4195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4145
4196
|
FeedbackSheet,
|
|
4146
4197
|
{
|
|
4147
4198
|
tone: "warn",
|
|
@@ -4151,10 +4202,10 @@ function FillBlankFeedback({
|
|
|
4151
4202
|
);
|
|
4152
4203
|
}
|
|
4153
4204
|
if (phase === "correct") {
|
|
4154
|
-
return /* @__PURE__ */ (0,
|
|
4205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll, answer: answerText });
|
|
4155
4206
|
}
|
|
4156
4207
|
if (phase === "locked") {
|
|
4157
|
-
return /* @__PURE__ */ (0,
|
|
4208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4158
4209
|
FeedbackSheet,
|
|
4159
4210
|
{
|
|
4160
4211
|
tone: "bad",
|
|
@@ -4170,7 +4221,7 @@ function FillBlankFeedback({
|
|
|
4170
4221
|
}
|
|
4171
4222
|
|
|
4172
4223
|
// src/questions/fill-blank/blank-input.tsx
|
|
4173
|
-
var
|
|
4224
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
4174
4225
|
function BlankInput({
|
|
4175
4226
|
blank,
|
|
4176
4227
|
blankIndex,
|
|
@@ -4185,7 +4236,7 @@ function BlankInput({
|
|
|
4185
4236
|
7,
|
|
4186
4237
|
Math.min(18, normalizeAnswer(value).length || normalizeAnswer((_a = blank.answers[0]) != null ? _a : "").length)
|
|
4187
4238
|
);
|
|
4188
|
-
return /* @__PURE__ */ (0,
|
|
4239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4189
4240
|
"input",
|
|
4190
4241
|
{
|
|
4191
4242
|
className: classNames("rqk-fill-input", graded && (ok ? "rqk-is-correct" : "rqk-is-wrong")),
|
|
@@ -4200,7 +4251,7 @@ function BlankInput({
|
|
|
4200
4251
|
}
|
|
4201
4252
|
|
|
4202
4253
|
// src/questions/fill-blank/passage-card.tsx
|
|
4203
|
-
var
|
|
4254
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4204
4255
|
function FillBlankPassage({
|
|
4205
4256
|
data,
|
|
4206
4257
|
values,
|
|
@@ -4209,16 +4260,16 @@ function FillBlankPassage({
|
|
|
4209
4260
|
readonly,
|
|
4210
4261
|
onChange
|
|
4211
4262
|
}) {
|
|
4212
|
-
return /* @__PURE__ */ (0,
|
|
4213
|
-
/* @__PURE__ */ (0,
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Card, { className: "rqk-fill-card", children: [
|
|
4264
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "rqk-fill-tip", children: [
|
|
4265
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "rqk-fill-badge", children: "\u77ED\u6587" }),
|
|
4215
4266
|
"\u6BCF\u7A7A\u586B\u4E00\u4E2A\u5355\u8BCD"
|
|
4216
4267
|
] }),
|
|
4217
|
-
/* @__PURE__ */ (0,
|
|
4268
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "rqk-fill-passage", children: data.segments.map((segment, segmentIndex) => {
|
|
4218
4269
|
var _a;
|
|
4219
|
-
return /* @__PURE__ */ (0,
|
|
4270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
4220
4271
|
segment,
|
|
4221
|
-
segmentIndex < data.blanks.length ? /* @__PURE__ */ (0,
|
|
4272
|
+
segmentIndex < data.blanks.length ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4222
4273
|
BlankInput,
|
|
4223
4274
|
{
|
|
4224
4275
|
blank: data.blanks[segmentIndex],
|
|
@@ -4232,7 +4283,7 @@ function FillBlankPassage({
|
|
|
4232
4283
|
) : null
|
|
4233
4284
|
] }, segmentIndex);
|
|
4234
4285
|
}) }),
|
|
4235
|
-
data.translation ? /* @__PURE__ */ (0,
|
|
4286
|
+
data.translation ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "rqk-fill-translation", children: [
|
|
4236
4287
|
"\u8BD1\uFF1A",
|
|
4237
4288
|
data.translation
|
|
4238
4289
|
] }) : null
|
|
@@ -4312,7 +4363,7 @@ function useFillBlank({
|
|
|
4312
4363
|
}
|
|
4313
4364
|
|
|
4314
4365
|
// src/questions/fill-blank/index.tsx
|
|
4315
|
-
var
|
|
4366
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4316
4367
|
function FillBlank({
|
|
4317
4368
|
data,
|
|
4318
4369
|
mode = "answer",
|
|
@@ -4338,22 +4389,22 @@ function FillBlank({
|
|
|
4338
4389
|
onSubmit: model.handleSubmit,
|
|
4339
4390
|
onRetry: model.judge.retry
|
|
4340
4391
|
});
|
|
4341
|
-
return /* @__PURE__ */ (0,
|
|
4392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4342
4393
|
QuestShell,
|
|
4343
4394
|
{
|
|
4344
4395
|
mode,
|
|
4345
4396
|
title: title != null ? title : "\u586B\u7A7A\u9898",
|
|
4346
4397
|
index,
|
|
4347
4398
|
total,
|
|
4348
|
-
instruction: instruction != null ? instruction : /* @__PURE__ */ (0,
|
|
4399
|
+
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
4349
4400
|
"\u8BFB\u77ED\u6587\uFF0C\u5728",
|
|
4350
|
-
/* @__PURE__ */ (0,
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("b", { children: "\u6A2A\u7EBF" }),
|
|
4351
4402
|
"\u5904\u8F93\u5165\u6B63\u786E\u7684\u8BCD"
|
|
4352
4403
|
] }),
|
|
4353
4404
|
onBack,
|
|
4354
4405
|
className: classNames("rqk-quest", "rqk-fill-blank", className),
|
|
4355
4406
|
dataQuest: "fill-blank",
|
|
4356
|
-
feedback: /* @__PURE__ */ (0,
|
|
4407
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4357
4408
|
FillBlankFeedback,
|
|
4358
4409
|
{
|
|
4359
4410
|
readonly: model.readonly,
|
|
@@ -4363,9 +4414,9 @@ function FillBlank({
|
|
|
4363
4414
|
answerText: model.answerText
|
|
4364
4415
|
}
|
|
4365
4416
|
),
|
|
4366
|
-
footer: /* @__PURE__ */ (0,
|
|
4367
|
-
children: /* @__PURE__ */ (0,
|
|
4368
|
-
/* @__PURE__ */ (0,
|
|
4417
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
4418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
4419
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4369
4420
|
FillBlankPassage,
|
|
4370
4421
|
{
|
|
4371
4422
|
data,
|
|
@@ -4376,8 +4427,8 @@ function FillBlank({
|
|
|
4376
4427
|
onChange: model.updateBlank
|
|
4377
4428
|
}
|
|
4378
4429
|
),
|
|
4379
|
-
!model.readonly && !model.graded ? /* @__PURE__ */ (0,
|
|
4380
|
-
/* @__PURE__ */ (0,
|
|
4430
|
+
!model.readonly && !model.graded ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "rqk-tx-kb-hint", children: [
|
|
4431
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KeyboardIcon, {}),
|
|
4381
4432
|
"\u70B9\u51FB\u6A2A\u7EBF\u8F93\u5165\uFF0C\u7CFB\u7EDF\u952E\u76D8\u81EA\u52A8\u5F39\u51FA"
|
|
4382
4433
|
] }) : null
|
|
4383
4434
|
] })
|
|
@@ -4409,7 +4460,7 @@ function wordSelectActions({
|
|
|
4409
4460
|
}
|
|
4410
4461
|
|
|
4411
4462
|
// src/questions/word-select/bank-card.tsx
|
|
4412
|
-
var
|
|
4463
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4413
4464
|
function WordSelectBank({
|
|
4414
4465
|
bank,
|
|
4415
4466
|
interaction,
|
|
@@ -4417,9 +4468,9 @@ function WordSelectBank({
|
|
|
4417
4468
|
tileUsed,
|
|
4418
4469
|
onPick
|
|
4419
4470
|
}) {
|
|
4420
|
-
return /* @__PURE__ */ (0,
|
|
4421
|
-
/* @__PURE__ */ (0,
|
|
4422
|
-
/* @__PURE__ */ (0,
|
|
4471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Card, { className: "rqk-word-select-bank", children: [
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "rqk-word-select-bank-label", children: interaction === "sequence" ? "\u70B9\u9009\u9879\u4F9D\u5E8F\u586B\u5165" : "\u5148\u9009\u6A2A\u7EBF\uFF0C\u518D\u70B9\u9009\u9879" }),
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "rqk-word-select-bank-items", children: bank.map((tile, tileIndex) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
4423
4474
|
WordChip,
|
|
4424
4475
|
{
|
|
4425
4476
|
variant: "word",
|
|
@@ -4434,7 +4485,7 @@ function WordSelectBank({
|
|
|
4434
4485
|
}
|
|
4435
4486
|
|
|
4436
4487
|
// src/questions/word-select/feedback.tsx
|
|
4437
|
-
var
|
|
4488
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4438
4489
|
function WordSelectFeedback({
|
|
4439
4490
|
readonly,
|
|
4440
4491
|
phase,
|
|
@@ -4443,7 +4494,7 @@ function WordSelectFeedback({
|
|
|
4443
4494
|
answerText
|
|
4444
4495
|
}) {
|
|
4445
4496
|
if (readonly) {
|
|
4446
|
-
return /* @__PURE__ */ (0,
|
|
4497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4447
4498
|
FeedbackSheet,
|
|
4448
4499
|
{
|
|
4449
4500
|
tone: "ok",
|
|
@@ -4455,13 +4506,13 @@ function WordSelectFeedback({
|
|
|
4455
4506
|
);
|
|
4456
4507
|
}
|
|
4457
4508
|
if (phase === "retry") {
|
|
4458
|
-
return /* @__PURE__ */ (0,
|
|
4509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FeedbackSheet, { tone: "warn", title: "\u6709\u7A7A\u653E\u9519\u4E86\u4F4D\u7F6E", detail: "\u6B63\u786E\u7684\u8BCD\u5DF2\u4E3A\u4F60\u4FDD\u7559" });
|
|
4459
4510
|
}
|
|
4460
4511
|
if (phase === "correct") {
|
|
4461
|
-
return /* @__PURE__ */ (0,
|
|
4512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll, answer: answerText });
|
|
4462
4513
|
}
|
|
4463
4514
|
if (phase === "locked") {
|
|
4464
|
-
return /* @__PURE__ */ (0,
|
|
4515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4465
4516
|
FeedbackSheet,
|
|
4466
4517
|
{
|
|
4467
4518
|
tone: "bad",
|
|
@@ -4477,7 +4528,7 @@ function WordSelectFeedback({
|
|
|
4477
4528
|
}
|
|
4478
4529
|
|
|
4479
4530
|
// src/questions/word-select/passage-card.tsx
|
|
4480
|
-
var
|
|
4531
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4481
4532
|
function WordSelectPassage({
|
|
4482
4533
|
data,
|
|
4483
4534
|
filled,
|
|
@@ -4486,18 +4537,18 @@ function WordSelectPassage({
|
|
|
4486
4537
|
phase,
|
|
4487
4538
|
onSlot
|
|
4488
4539
|
}) {
|
|
4489
|
-
return /* @__PURE__ */ (0,
|
|
4490
|
-
/* @__PURE__ */ (0,
|
|
4491
|
-
/* @__PURE__ */ (0,
|
|
4540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Card, { className: "rqk-word-select-card", children: [
|
|
4541
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "rqk-fill-tip", children: [
|
|
4542
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "rqk-fill-badge", children: "\u77ED\u6587" }),
|
|
4492
4543
|
"\u6BCF\u4E2A\u8BCD\u53EA\u80FD\u4F7F\u7528\u4E00\u6B21"
|
|
4493
4544
|
] }),
|
|
4494
|
-
/* @__PURE__ */ (0,
|
|
4545
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "rqk-fill-passage", children: data.segments.map((segment, segmentIndex) => {
|
|
4495
4546
|
const value = filled[segmentIndex];
|
|
4496
4547
|
const active = !frozen && !value && selected === segmentIndex;
|
|
4497
4548
|
const correct = value ? matchesAny(value, [data.blanks[segmentIndex].answer]) : false;
|
|
4498
|
-
return /* @__PURE__ */ (0,
|
|
4549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { children: [
|
|
4499
4550
|
segment,
|
|
4500
|
-
segmentIndex < data.blanks.length ? /* @__PURE__ */ (0,
|
|
4551
|
+
segmentIndex < data.blanks.length ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4501
4552
|
"button",
|
|
4502
4553
|
{
|
|
4503
4554
|
type: "button",
|
|
@@ -4515,7 +4566,7 @@ function WordSelectPassage({
|
|
|
4515
4566
|
) : null
|
|
4516
4567
|
] }, segmentIndex);
|
|
4517
4568
|
}) }),
|
|
4518
|
-
data.translation ? /* @__PURE__ */ (0,
|
|
4569
|
+
data.translation ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "rqk-fill-translation", children: [
|
|
4519
4570
|
"\u8BD1\uFF1A",
|
|
4520
4571
|
data.translation
|
|
4521
4572
|
] }) : null
|
|
@@ -4643,7 +4694,7 @@ function useWordSelect({
|
|
|
4643
4694
|
}
|
|
4644
4695
|
|
|
4645
4696
|
// src/questions/word-select/index.tsx
|
|
4646
|
-
var
|
|
4697
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4647
4698
|
function WordSelect({
|
|
4648
4699
|
data,
|
|
4649
4700
|
mode = "answer",
|
|
@@ -4669,22 +4720,22 @@ function WordSelect({
|
|
|
4669
4720
|
onSubmit: model.handleSubmit,
|
|
4670
4721
|
onRetry: model.judge.retry
|
|
4671
4722
|
});
|
|
4672
|
-
return /* @__PURE__ */ (0,
|
|
4723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4673
4724
|
QuestShell,
|
|
4674
4725
|
{
|
|
4675
4726
|
mode,
|
|
4676
4727
|
title: title != null ? title : "\u9009\u8BCD\u586B\u7A7A",
|
|
4677
4728
|
index,
|
|
4678
4729
|
total,
|
|
4679
|
-
instruction: instruction != null ? instruction : /* @__PURE__ */ (0,
|
|
4730
|
+
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
4680
4731
|
"\u4ECE\u9009\u9879\u5E93",
|
|
4681
|
-
/* @__PURE__ */ (0,
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("b", { children: "\u9009\u8BCD" }),
|
|
4682
4733
|
"\uFF0C\u8865\u5168\u77ED\u6587"
|
|
4683
4734
|
] }),
|
|
4684
4735
|
onBack,
|
|
4685
4736
|
className: classNames("rqk-quest", "rqk-word-select", className),
|
|
4686
4737
|
dataQuest: "word-select",
|
|
4687
|
-
feedback: /* @__PURE__ */ (0,
|
|
4738
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4688
4739
|
WordSelectFeedback,
|
|
4689
4740
|
{
|
|
4690
4741
|
readonly: model.readonly,
|
|
@@ -4694,9 +4745,9 @@ function WordSelect({
|
|
|
4694
4745
|
answerText: model.answerText
|
|
4695
4746
|
}
|
|
4696
4747
|
),
|
|
4697
|
-
footer: /* @__PURE__ */ (0,
|
|
4698
|
-
children: /* @__PURE__ */ (0,
|
|
4699
|
-
/* @__PURE__ */ (0,
|
|
4748
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
4749
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4700
4751
|
WordSelectPassage,
|
|
4701
4752
|
{
|
|
4702
4753
|
data,
|
|
@@ -4707,7 +4758,7 @@ function WordSelect({
|
|
|
4707
4758
|
onSlot: model.tapSlot
|
|
4708
4759
|
}
|
|
4709
4760
|
),
|
|
4710
|
-
/* @__PURE__ */ (0,
|
|
4761
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4711
4762
|
WordSelectBank,
|
|
4712
4763
|
{
|
|
4713
4764
|
bank: model.bank,
|
|
@@ -4717,7 +4768,7 @@ function WordSelect({
|
|
|
4717
4768
|
onPick: model.pickWord
|
|
4718
4769
|
}
|
|
4719
4770
|
),
|
|
4720
|
-
/* @__PURE__ */ (0,
|
|
4771
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Toast, { children: model.notice })
|
|
4721
4772
|
] })
|
|
4722
4773
|
}
|
|
4723
4774
|
);
|
|
@@ -4752,7 +4803,7 @@ function sortSentencesActions({
|
|
|
4752
4803
|
}
|
|
4753
4804
|
|
|
4754
4805
|
// src/questions/sort-sentences/feedback.tsx
|
|
4755
|
-
var
|
|
4806
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4756
4807
|
function SortSentencesFeedback({
|
|
4757
4808
|
readonly,
|
|
4758
4809
|
phase,
|
|
@@ -4760,7 +4811,7 @@ function SortSentencesFeedback({
|
|
|
4760
4811
|
labels
|
|
4761
4812
|
}) {
|
|
4762
4813
|
if (readonly) {
|
|
4763
|
-
return /* @__PURE__ */ (0,
|
|
4814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4764
4815
|
FeedbackSheet,
|
|
4765
4816
|
{
|
|
4766
4817
|
tone: "ok",
|
|
@@ -4772,13 +4823,13 @@ function SortSentencesFeedback({
|
|
|
4772
4823
|
);
|
|
4773
4824
|
}
|
|
4774
4825
|
if (phase === "retry") {
|
|
4775
|
-
return /* @__PURE__ */ (0,
|
|
4826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FeedbackSheet, { tone: "warn", title: "\u6709\u53E5\u5B50\u653E\u9519\u4E86\u4F4D\u7F6E", detail: "\u987A\u5E8F\u6B63\u786E\u7684\u884C\u5DF2\u4E3A\u4F60\u4FDD\u7559" });
|
|
4776
4827
|
}
|
|
4777
4828
|
if (phase === "correct") {
|
|
4778
|
-
return /* @__PURE__ */ (0,
|
|
4829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll });
|
|
4779
4830
|
}
|
|
4780
4831
|
if (phase === "locked") {
|
|
4781
|
-
return /* @__PURE__ */ (0,
|
|
4832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4782
4833
|
FeedbackSheet,
|
|
4783
4834
|
{
|
|
4784
4835
|
tone: "bad",
|
|
@@ -4794,7 +4845,7 @@ function SortSentencesFeedback({
|
|
|
4794
4845
|
}
|
|
4795
4846
|
|
|
4796
4847
|
// src/questions/sort-sentences/sort-bank.tsx
|
|
4797
|
-
var
|
|
4848
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4798
4849
|
function SortBank({
|
|
4799
4850
|
bank,
|
|
4800
4851
|
readonly,
|
|
@@ -4802,9 +4853,9 @@ function SortBank({
|
|
|
4802
4853
|
tileUsed,
|
|
4803
4854
|
onPick
|
|
4804
4855
|
}) {
|
|
4805
|
-
return /* @__PURE__ */ (0,
|
|
4806
|
-
/* @__PURE__ */ (0,
|
|
4807
|
-
/* @__PURE__ */ (0,
|
|
4856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Card, { className: "rqk-sort-bank", children: [
|
|
4857
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "rqk-sort-bank-label", children: readonly ? "\u6B63\u786E\u987A\u5E8F" : "\u5F85\u6392\u5E8F\u53E5\u5B50" }),
|
|
4858
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "rqk-sort-bank-items", children: bank.map((tile, tileIndex) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4808
4859
|
"button",
|
|
4809
4860
|
{
|
|
4810
4861
|
type: "button",
|
|
@@ -4819,7 +4870,7 @@ function SortBank({
|
|
|
4819
4870
|
}
|
|
4820
4871
|
|
|
4821
4872
|
// src/questions/sort-sentences/sort-rows.tsx
|
|
4822
|
-
var
|
|
4873
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4823
4874
|
function SortRows({
|
|
4824
4875
|
rows,
|
|
4825
4876
|
order,
|
|
@@ -4827,7 +4878,7 @@ function SortRows({
|
|
|
4827
4878
|
phase,
|
|
4828
4879
|
onRow
|
|
4829
4880
|
}) {
|
|
4830
|
-
return /* @__PURE__ */ (0,
|
|
4881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "rqk-sort-rows", children: rows.map((sentence, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4831
4882
|
"div",
|
|
4832
4883
|
{
|
|
4833
4884
|
className: classNames(
|
|
@@ -4845,8 +4896,8 @@ function SortRows({
|
|
|
4845
4896
|
}
|
|
4846
4897
|
},
|
|
4847
4898
|
children: [
|
|
4848
|
-
/* @__PURE__ */ (0,
|
|
4849
|
-
sentence ? /* @__PURE__ */ (0,
|
|
4899
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "rqk-sort-row-number", children: rowIndex + 1 }),
|
|
4900
|
+
sentence ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "rqk-sort-row-text", children: sentence }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "rqk-sort-row-placeholder", children: [
|
|
4850
4901
|
"\u70B9\u51FB\u4E0B\u65B9\u53E5\u5B50\u653E\u5165\u7B2C ",
|
|
4851
4902
|
rowIndex + 1,
|
|
4852
4903
|
" \u884C"
|
|
@@ -4953,7 +5004,7 @@ function useSortSentences({
|
|
|
4953
5004
|
}
|
|
4954
5005
|
|
|
4955
5006
|
// src/questions/sort-sentences/index.tsx
|
|
4956
|
-
var
|
|
5007
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4957
5008
|
function SortSentences({
|
|
4958
5009
|
data,
|
|
4959
5010
|
mode = "answer",
|
|
@@ -4979,22 +5030,22 @@ function SortSentences({
|
|
|
4979
5030
|
onSubmit: model.handleSubmit,
|
|
4980
5031
|
onRetry: model.judge.retry
|
|
4981
5032
|
});
|
|
4982
|
-
return /* @__PURE__ */ (0,
|
|
5033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4983
5034
|
QuestShell,
|
|
4984
5035
|
{
|
|
4985
5036
|
mode,
|
|
4986
5037
|
title: title != null ? title : "\u53E5\u5B50\u6392\u5E8F",
|
|
4987
5038
|
index,
|
|
4988
5039
|
total,
|
|
4989
|
-
instruction: instruction != null ? instruction : /* @__PURE__ */ (0,
|
|
5040
|
+
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
4990
5041
|
"\u6309\u6B63\u786E",
|
|
4991
|
-
/* @__PURE__ */ (0,
|
|
5042
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("b", { children: "\u987A\u5E8F" }),
|
|
4992
5043
|
"\u6392\u5217\u53E5\u5B50\uFF0C\u70B9\u51FB\u7A7A\u884C\u653E\u5165"
|
|
4993
5044
|
] }),
|
|
4994
5045
|
onBack,
|
|
4995
5046
|
className: classNames("rqk-quest", "rqk-sort", className),
|
|
4996
5047
|
dataQuest: "sort-sentences",
|
|
4997
|
-
feedback: /* @__PURE__ */ (0,
|
|
5048
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4998
5049
|
SortSentencesFeedback,
|
|
4999
5050
|
{
|
|
5000
5051
|
readonly: model.readonly,
|
|
@@ -5003,9 +5054,9 @@ function SortSentences({
|
|
|
5003
5054
|
labels: model.labels
|
|
5004
5055
|
}
|
|
5005
5056
|
),
|
|
5006
|
-
footer: actions.length > 0 || index > 1 && Boolean(onPrev) ? /* @__PURE__ */ (0,
|
|
5007
|
-
children: /* @__PURE__ */ (0,
|
|
5008
|
-
/* @__PURE__ */ (0,
|
|
5057
|
+
footer: actions.length > 0 || index > 1 && Boolean(onPrev) ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ActionBar, { actions, index, total, onPrev }) : void 0,
|
|
5058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
5059
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5009
5060
|
SortRows,
|
|
5010
5061
|
{
|
|
5011
5062
|
rows: model.rows,
|
|
@@ -5015,7 +5066,7 @@ function SortSentences({
|
|
|
5015
5066
|
onRow: model.tapRow
|
|
5016
5067
|
}
|
|
5017
5068
|
),
|
|
5018
|
-
/* @__PURE__ */ (0,
|
|
5069
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5019
5070
|
SortBank,
|
|
5020
5071
|
{
|
|
5021
5072
|
bank: model.bank,
|
|
@@ -5025,7 +5076,7 @@ function SortSentences({
|
|
|
5025
5076
|
onPick: model.tapBank
|
|
5026
5077
|
}
|
|
5027
5078
|
),
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5079
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Toast, { children: model.notice })
|
|
5029
5080
|
] })
|
|
5030
5081
|
}
|
|
5031
5082
|
);
|
|
@@ -5055,7 +5106,7 @@ function clozeActions({
|
|
|
5055
5106
|
}
|
|
5056
5107
|
|
|
5057
5108
|
// src/questions/cloze/feedback.tsx
|
|
5058
|
-
var
|
|
5109
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5059
5110
|
function ClozeFeedback({
|
|
5060
5111
|
readonly,
|
|
5061
5112
|
phase,
|
|
@@ -5064,7 +5115,7 @@ function ClozeFeedback({
|
|
|
5064
5115
|
answerText
|
|
5065
5116
|
}) {
|
|
5066
5117
|
if (readonly) {
|
|
5067
|
-
return /* @__PURE__ */ (0,
|
|
5118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5068
5119
|
FeedbackSheet,
|
|
5069
5120
|
{
|
|
5070
5121
|
tone: "ok",
|
|
@@ -5076,13 +5127,13 @@ function ClozeFeedback({
|
|
|
5076
5127
|
);
|
|
5077
5128
|
}
|
|
5078
5129
|
if (phase === "retry") {
|
|
5079
|
-
return /* @__PURE__ */ (0,
|
|
5130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FeedbackSheet, { tone: "warn", title: "\u6709\u7A7A\u9009\u9519\u4E86", detail: "\u9009\u62E9\u6B63\u786E\u7684\u7A7A\u5DF2\u4E3A\u4F60\u4FDD\u7559" });
|
|
5080
5131
|
}
|
|
5081
5132
|
if (phase === "correct") {
|
|
5082
|
-
return /* @__PURE__ */ (0,
|
|
5133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FeedbackSheet, { tone: "ok", title: labels.correctAll, answer: answerText });
|
|
5083
5134
|
}
|
|
5084
5135
|
if (phase === "locked") {
|
|
5085
|
-
return /* @__PURE__ */ (0,
|
|
5136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5086
5137
|
FeedbackSheet,
|
|
5087
5138
|
{
|
|
5088
5139
|
tone: "bad",
|
|
@@ -5098,7 +5149,7 @@ function ClozeFeedback({
|
|
|
5098
5149
|
}
|
|
5099
5150
|
|
|
5100
5151
|
// src/questions/cloze/option-grid.tsx
|
|
5101
|
-
var
|
|
5152
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5102
5153
|
function ClozeOptions({
|
|
5103
5154
|
data,
|
|
5104
5155
|
current,
|
|
@@ -5110,17 +5161,17 @@ function ClozeOptions({
|
|
|
5110
5161
|
var _a;
|
|
5111
5162
|
const options = (_a = data.options[current]) != null ? _a : [];
|
|
5112
5163
|
const currentChosen = selected[current];
|
|
5113
|
-
return /* @__PURE__ */ (0,
|
|
5114
|
-
/* @__PURE__ */ (0,
|
|
5164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Card, { className: "rqk-cloze-options", children: [
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "rqk-cloze-options-label", children: [
|
|
5115
5166
|
"\u7B2C ",
|
|
5116
5167
|
current + 1,
|
|
5117
5168
|
" \u7A7A \xB7 \u9009\u62E9\u7B54\u6848"
|
|
5118
5169
|
] }),
|
|
5119
|
-
/* @__PURE__ */ (0,
|
|
5170
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "rqk-cloze-options-grid", children: options.map((option, optionIndex) => {
|
|
5120
5171
|
var _a2;
|
|
5121
5172
|
const chosen = currentChosen === optionIndex;
|
|
5122
5173
|
const isAnswer = option === ((_a2 = data.gaps[current]) == null ? void 0 : _a2.answer);
|
|
5123
|
-
return /* @__PURE__ */ (0,
|
|
5174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
5124
5175
|
"button",
|
|
5125
5176
|
{
|
|
5126
5177
|
type: "button",
|
|
@@ -5133,7 +5184,7 @@ function ClozeOptions({
|
|
|
5133
5184
|
onClick: () => onPick(optionIndex),
|
|
5134
5185
|
disabled: frozen,
|
|
5135
5186
|
children: [
|
|
5136
|
-
/* @__PURE__ */ (0,
|
|
5187
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "rqk-cloze-option-key", children: String.fromCharCode(65 + optionIndex) }),
|
|
5137
5188
|
option
|
|
5138
5189
|
]
|
|
5139
5190
|
},
|
|
@@ -5144,7 +5195,7 @@ function ClozeOptions({
|
|
|
5144
5195
|
}
|
|
5145
5196
|
|
|
5146
5197
|
// src/questions/cloze/passage-card.tsx
|
|
5147
|
-
var
|
|
5198
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5148
5199
|
function ClozePassage({
|
|
5149
5200
|
data,
|
|
5150
5201
|
selected,
|
|
@@ -5153,15 +5204,15 @@ function ClozePassage({
|
|
|
5153
5204
|
phase,
|
|
5154
5205
|
onGap
|
|
5155
5206
|
}) {
|
|
5156
|
-
return /* @__PURE__ */ (0,
|
|
5157
|
-
/* @__PURE__ */ (0,
|
|
5207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Card, { className: "rqk-cloze-card", children: [
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "rqk-fill-passage", children: data.segments.map((segment, segmentIndex) => {
|
|
5158
5209
|
var _a, _b;
|
|
5159
5210
|
const optionIndex = selected[segmentIndex];
|
|
5160
5211
|
const gap = data.gaps[segmentIndex];
|
|
5161
5212
|
const value = optionIndex === null || segmentIndex >= data.gaps.length ? "\uFF3F\uFF3F" : (_b = (_a = data.options[segmentIndex]) == null ? void 0 : _a[optionIndex]) != null ? _b : "\uFF3F\uFF3F";
|
|
5162
|
-
return /* @__PURE__ */ (0,
|
|
5213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { children: [
|
|
5163
5214
|
segment,
|
|
5164
|
-
segmentIndex < data.gaps.length ? /* @__PURE__ */ (0,
|
|
5215
|
+
segmentIndex < data.gaps.length ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5165
5216
|
"button",
|
|
5166
5217
|
{
|
|
5167
5218
|
type: "button",
|
|
@@ -5179,7 +5230,7 @@ function ClozePassage({
|
|
|
5179
5230
|
) : null
|
|
5180
5231
|
] }, segmentIndex);
|
|
5181
5232
|
}) }),
|
|
5182
|
-
data.translation ? /* @__PURE__ */ (0,
|
|
5233
|
+
data.translation ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "rqk-fill-translation", children: [
|
|
5183
5234
|
"\u8BD1\uFF1A",
|
|
5184
5235
|
data.translation
|
|
5185
5236
|
] }) : null
|
|
@@ -5283,7 +5334,7 @@ function useCloze({
|
|
|
5283
5334
|
}
|
|
5284
5335
|
|
|
5285
5336
|
// src/questions/cloze/index.tsx
|
|
5286
|
-
var
|
|
5337
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5287
5338
|
function Cloze({
|
|
5288
5339
|
data,
|
|
5289
5340
|
mode = "answer",
|
|
@@ -5309,7 +5360,7 @@ function Cloze({
|
|
|
5309
5360
|
onSubmit: model.handleSubmit,
|
|
5310
5361
|
onRetry: model.judge.retry
|
|
5311
5362
|
});
|
|
5312
|
-
return /* @__PURE__ */ (0,
|
|
5363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5313
5364
|
QuestShell,
|
|
5314
5365
|
{
|
|
5315
5366
|
mode,
|
|
@@ -5320,7 +5371,7 @@ function Cloze({
|
|
|
5320
5371
|
onBack,
|
|
5321
5372
|
className: classNames("rqk-quest", "rqk-cloze", className),
|
|
5322
5373
|
dataQuest: "cloze",
|
|
5323
|
-
feedback: /* @__PURE__ */ (0,
|
|
5374
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5324
5375
|
ClozeFeedback,
|
|
5325
5376
|
{
|
|
5326
5377
|
readonly: model.readonly,
|
|
@@ -5330,9 +5381,9 @@ function Cloze({
|
|
|
5330
5381
|
answerText: model.answerText
|
|
5331
5382
|
}
|
|
5332
5383
|
),
|
|
5333
|
-
footer: /* @__PURE__ */ (0,
|
|
5334
|
-
children: /* @__PURE__ */ (0,
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
5384
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
5385
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5336
5387
|
ClozePassage,
|
|
5337
5388
|
{
|
|
5338
5389
|
data,
|
|
@@ -5343,7 +5394,7 @@ function Cloze({
|
|
|
5343
5394
|
onGap: model.tapGap
|
|
5344
5395
|
}
|
|
5345
5396
|
),
|
|
5346
|
-
/* @__PURE__ */ (0,
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5347
5398
|
ClozeOptions,
|
|
5348
5399
|
{
|
|
5349
5400
|
data,
|
|
@@ -5388,7 +5439,7 @@ function readingActions({
|
|
|
5388
5439
|
}
|
|
5389
5440
|
|
|
5390
5441
|
// src/questions/reading-comprehension/feedback.tsx
|
|
5391
|
-
var
|
|
5442
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5392
5443
|
function ReadingFeedback({
|
|
5393
5444
|
readonly,
|
|
5394
5445
|
phase,
|
|
@@ -5397,7 +5448,7 @@ function ReadingFeedback({
|
|
|
5397
5448
|
answerText
|
|
5398
5449
|
}) {
|
|
5399
5450
|
if (readonly) {
|
|
5400
|
-
return /* @__PURE__ */ (0,
|
|
5451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5401
5452
|
FeedbackSheet,
|
|
5402
5453
|
{
|
|
5403
5454
|
tone: "ok",
|
|
@@ -5409,10 +5460,10 @@ function ReadingFeedback({
|
|
|
5409
5460
|
);
|
|
5410
5461
|
}
|
|
5411
5462
|
if (phase === "retry") {
|
|
5412
|
-
return /* @__PURE__ */ (0,
|
|
5463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FeedbackSheet, { tone: "warn", title: "\u6709\u5C0F\u9898\u7B54\u9519\u4E86", detail: "\u7B54\u5BF9\u7684\u5C0F\u9898\u5DF2\u9501\u5B9A\uFF0C\u9519\u9898\u53EF\u91CD\u65B0\u9009\u62E9" });
|
|
5413
5464
|
}
|
|
5414
5465
|
if (phase === "correct") {
|
|
5415
|
-
return /* @__PURE__ */ (0,
|
|
5466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5416
5467
|
FeedbackSheet,
|
|
5417
5468
|
{
|
|
5418
5469
|
tone: "ok",
|
|
@@ -5423,7 +5474,7 @@ function ReadingFeedback({
|
|
|
5423
5474
|
);
|
|
5424
5475
|
}
|
|
5425
5476
|
if (phase === "locked") {
|
|
5426
|
-
return /* @__PURE__ */ (0,
|
|
5477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5427
5478
|
FeedbackSheet,
|
|
5428
5479
|
{
|
|
5429
5480
|
tone: "bad",
|
|
@@ -5439,7 +5490,7 @@ function ReadingFeedback({
|
|
|
5439
5490
|
}
|
|
5440
5491
|
|
|
5441
5492
|
// src/questions/reading-comprehension/passage-card.tsx
|
|
5442
|
-
var
|
|
5493
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
5443
5494
|
function ReadingPassage({
|
|
5444
5495
|
data,
|
|
5445
5496
|
collapsible,
|
|
@@ -5448,10 +5499,10 @@ function ReadingPassage({
|
|
|
5448
5499
|
textRef,
|
|
5449
5500
|
onToggle
|
|
5450
5501
|
}) {
|
|
5451
|
-
return /* @__PURE__ */ (0,
|
|
5452
|
-
/* @__PURE__ */ (0,
|
|
5453
|
-
/* @__PURE__ */ (0,
|
|
5454
|
-
collapsible ? /* @__PURE__ */ (0,
|
|
5502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Card, { className: "rqk-reading-card", children: [
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "rqk-reading-head", children: [
|
|
5504
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "rqk-reading-title", children: data.title }),
|
|
5505
|
+
collapsible ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5455
5506
|
"button",
|
|
5456
5507
|
{
|
|
5457
5508
|
type: "button",
|
|
@@ -5462,12 +5513,12 @@ function ReadingPassage({
|
|
|
5462
5513
|
}
|
|
5463
5514
|
) : null
|
|
5464
5515
|
] }),
|
|
5465
|
-
/* @__PURE__ */ (0,
|
|
5516
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5466
5517
|
"div",
|
|
5467
5518
|
{
|
|
5468
5519
|
className: classNames("rqk-reading-body", folded && "rqk-is-collapsed"),
|
|
5469
5520
|
style: { maxHeight: folded ? 80 : fullHeight || void 0 },
|
|
5470
|
-
children: /* @__PURE__ */ (0,
|
|
5521
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5471
5522
|
"div",
|
|
5472
5523
|
{
|
|
5473
5524
|
ref: (element) => {
|
|
@@ -5483,7 +5534,7 @@ function ReadingPassage({
|
|
|
5483
5534
|
}
|
|
5484
5535
|
|
|
5485
5536
|
// src/questions/reading-comprehension/question-chips.tsx
|
|
5486
|
-
var
|
|
5537
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
5487
5538
|
function ReadingChips({
|
|
5488
5539
|
data,
|
|
5489
5540
|
answers,
|
|
@@ -5493,12 +5544,12 @@ function ReadingChips({
|
|
|
5493
5544
|
readonly,
|
|
5494
5545
|
onPick
|
|
5495
5546
|
}) {
|
|
5496
|
-
return /* @__PURE__ */ (0,
|
|
5497
|
-
/* @__PURE__ */ (0,
|
|
5547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "rqk-reading-chips", children: [
|
|
5548
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "rqk-reading-chips-label", children: "\u5C0F\u9898" }),
|
|
5498
5549
|
data.questions.map((item, questionIndex) => {
|
|
5499
5550
|
const value = answers[questionIndex];
|
|
5500
5551
|
const ok = judged && value === item.answer;
|
|
5501
|
-
return /* @__PURE__ */ (0,
|
|
5552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5502
5553
|
"button",
|
|
5503
5554
|
{
|
|
5504
5555
|
type: "button",
|
|
@@ -5521,7 +5572,7 @@ function ReadingChips({
|
|
|
5521
5572
|
}
|
|
5522
5573
|
|
|
5523
5574
|
// src/questions/reading-comprehension/question-card.tsx
|
|
5524
|
-
var
|
|
5575
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
5525
5576
|
function ReadingQuestion({
|
|
5526
5577
|
data,
|
|
5527
5578
|
current,
|
|
@@ -5533,18 +5584,18 @@ function ReadingQuestion({
|
|
|
5533
5584
|
}) {
|
|
5534
5585
|
const question = data.questions[current];
|
|
5535
5586
|
if (!question) return null;
|
|
5536
|
-
return /* @__PURE__ */ (0,
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Card, { className: "rqk-reading-question", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "rqk-reading-qbody", children: [
|
|
5588
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "rqk-reading-stem", children: [
|
|
5589
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "rqk-reading-stem-index", children: [
|
|
5539
5590
|
current + 1,
|
|
5540
5591
|
"."
|
|
5541
5592
|
] }),
|
|
5542
5593
|
question.stem
|
|
5543
5594
|
] }),
|
|
5544
|
-
/* @__PURE__ */ (0,
|
|
5595
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "rqk-reading-options", children: question.options.map((option, optionIndex) => {
|
|
5545
5596
|
const chosen = answers[current] === optionIndex;
|
|
5546
5597
|
const isAnswer = optionIndex === question.answer;
|
|
5547
|
-
return /* @__PURE__ */ (0,
|
|
5598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
5548
5599
|
"button",
|
|
5549
5600
|
{
|
|
5550
5601
|
type: "button",
|
|
@@ -5558,7 +5609,7 @@ function ReadingQuestion({
|
|
|
5558
5609
|
onClick: () => onPick(optionIndex),
|
|
5559
5610
|
disabled: readonly || locked[current],
|
|
5560
5611
|
children: [
|
|
5561
|
-
/* @__PURE__ */ (0,
|
|
5612
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "rqk-reading-option-key", children: optionLetter(optionIndex) }),
|
|
5562
5613
|
option
|
|
5563
5614
|
]
|
|
5564
5615
|
},
|
|
@@ -5569,7 +5620,7 @@ function ReadingQuestion({
|
|
|
5569
5620
|
}
|
|
5570
5621
|
|
|
5571
5622
|
// src/questions/reading-comprehension/reading-page.tsx
|
|
5572
|
-
var
|
|
5623
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
5573
5624
|
function ReadingPage({
|
|
5574
5625
|
data,
|
|
5575
5626
|
collapsible,
|
|
@@ -5585,8 +5636,8 @@ function ReadingPage({
|
|
|
5585
5636
|
onChip,
|
|
5586
5637
|
onPick
|
|
5587
5638
|
}) {
|
|
5588
|
-
return /* @__PURE__ */ (0,
|
|
5589
|
-
/* @__PURE__ */ (0,
|
|
5639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
5640
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5590
5641
|
ReadingPassage,
|
|
5591
5642
|
{
|
|
5592
5643
|
data,
|
|
@@ -5597,7 +5648,7 @@ function ReadingPage({
|
|
|
5597
5648
|
onToggle
|
|
5598
5649
|
}
|
|
5599
5650
|
),
|
|
5600
|
-
/* @__PURE__ */ (0,
|
|
5651
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5601
5652
|
ReadingChips,
|
|
5602
5653
|
{
|
|
5603
5654
|
data,
|
|
@@ -5609,7 +5660,7 @@ function ReadingPage({
|
|
|
5609
5660
|
onPick: onChip
|
|
5610
5661
|
}
|
|
5611
5662
|
),
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5663
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5613
5664
|
ReadingQuestion,
|
|
5614
5665
|
{
|
|
5615
5666
|
data,
|
|
@@ -5776,7 +5827,7 @@ function useReadingComprehension({
|
|
|
5776
5827
|
}
|
|
5777
5828
|
|
|
5778
5829
|
// src/questions/reading-comprehension/index.tsx
|
|
5779
|
-
var
|
|
5830
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
5780
5831
|
function ReadingComprehension({
|
|
5781
5832
|
data,
|
|
5782
5833
|
mode = "answer",
|
|
@@ -5810,22 +5861,22 @@ function ReadingComprehension({
|
|
|
5810
5861
|
onSubmit: model.handleSubmit,
|
|
5811
5862
|
onRetry: model.judge.retry
|
|
5812
5863
|
});
|
|
5813
|
-
return /* @__PURE__ */ (0,
|
|
5864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
5814
5865
|
QuestShell,
|
|
5815
5866
|
{
|
|
5816
5867
|
mode,
|
|
5817
5868
|
title: title != null ? title : "\u9605\u8BFB\u7406\u89E3",
|
|
5818
5869
|
index,
|
|
5819
5870
|
total,
|
|
5820
|
-
instruction: instruction != null ? instruction : /* @__PURE__ */ (0,
|
|
5871
|
+
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
5821
5872
|
"\u9605\u8BFB\u77ED\u6587\uFF0C\u5B8C\u6210 ",
|
|
5822
|
-
/* @__PURE__ */ (0,
|
|
5873
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("b", { children: data.questions.length }),
|
|
5823
5874
|
" \u9053\u5C0F\u9898"
|
|
5824
5875
|
] }),
|
|
5825
5876
|
onBack,
|
|
5826
5877
|
className: classNames("rqk-quest", "rqk-reading", className),
|
|
5827
5878
|
dataQuest: "reading-comprehension",
|
|
5828
|
-
feedback: /* @__PURE__ */ (0,
|
|
5879
|
+
feedback: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
5829
5880
|
ReadingFeedback,
|
|
5830
5881
|
{
|
|
5831
5882
|
readonly: model.readonly,
|
|
@@ -5835,9 +5886,9 @@ function ReadingComprehension({
|
|
|
5835
5886
|
answerText: model.answerText
|
|
5836
5887
|
}
|
|
5837
5888
|
),
|
|
5838
|
-
footer: actions.length > 0 || index > 1 && Boolean(onPrev) ? /* @__PURE__ */ (0,
|
|
5889
|
+
footer: actions.length > 0 || index > 1 && Boolean(onPrev) ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ActionBar, { actions, index, total, onPrev }) : void 0,
|
|
5839
5890
|
children: [
|
|
5840
|
-
/* @__PURE__ */ (0,
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
5841
5892
|
ReadingPage,
|
|
5842
5893
|
{
|
|
5843
5894
|
data,
|
|
@@ -5855,7 +5906,7 @@ function ReadingComprehension({
|
|
|
5855
5906
|
onPick: model.pick
|
|
5856
5907
|
}
|
|
5857
5908
|
),
|
|
5858
|
-
/* @__PURE__ */ (0,
|
|
5909
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toast, { children: model.notice })
|
|
5859
5910
|
]
|
|
5860
5911
|
}
|
|
5861
5912
|
);
|
|
@@ -5865,67 +5916,69 @@ function ReadingComprehension({
|
|
|
5865
5916
|
function listenTaskActions({
|
|
5866
5917
|
feedback,
|
|
5867
5918
|
completed,
|
|
5868
|
-
|
|
5919
|
+
readonly,
|
|
5920
|
+
labels,
|
|
5869
5921
|
onSubmit,
|
|
5870
5922
|
onNext
|
|
5871
5923
|
}) {
|
|
5872
5924
|
const actions = [];
|
|
5873
5925
|
if (feedback) {
|
|
5874
|
-
actions.push({ key: "
|
|
5875
|
-
actions.push({ key: "next", label: "\u5B8C\u6210\u5E76\u8FD4\u56DE", onClick: onNext });
|
|
5926
|
+
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
5876
5927
|
} else {
|
|
5877
5928
|
actions.push({
|
|
5878
5929
|
key: "submit",
|
|
5879
5930
|
label: "\u63D0\u4EA4\u5E76\u67E5\u770B\u7EDF\u8BA1",
|
|
5880
5931
|
onClick: onSubmit,
|
|
5881
|
-
disabled: !completed
|
|
5932
|
+
disabled: !completed || readonly
|
|
5882
5933
|
});
|
|
5883
5934
|
}
|
|
5884
5935
|
return actions;
|
|
5885
5936
|
}
|
|
5886
5937
|
|
|
5887
5938
|
// src/questions/listen-task/feedback.tsx
|
|
5888
|
-
var
|
|
5939
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
5889
5940
|
function ListenFeedback({
|
|
5890
5941
|
data,
|
|
5891
|
-
|
|
5892
|
-
|
|
5942
|
+
tracks,
|
|
5943
|
+
overall,
|
|
5944
|
+
timeOnTask
|
|
5893
5945
|
}) {
|
|
5894
|
-
var _a;
|
|
5946
|
+
var _a, _b;
|
|
5895
5947
|
const stats = (_a = data.stats) != null ? _a : [
|
|
5896
5948
|
{
|
|
5897
5949
|
label: "\u542C\u97F3\u9891\u65F6\u957F",
|
|
5898
|
-
value: /* @__PURE__ */ (0,
|
|
5899
|
-
(
|
|
5900
|
-
/* @__PURE__ */ (0,
|
|
5950
|
+
value: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
5951
|
+
(timeOnTask / 60).toFixed(1),
|
|
5952
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("small", { children: "min" })
|
|
5901
5953
|
] })
|
|
5902
5954
|
},
|
|
5903
5955
|
{
|
|
5904
5956
|
label: "\u97F3\u9891\u6570\u91CF",
|
|
5905
|
-
value: /* @__PURE__ */ (0,
|
|
5906
|
-
|
|
5907
|
-
/* @__PURE__ */ (0,
|
|
5957
|
+
value: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
5958
|
+
tracks.length,
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("small", { children: "\u6BB5" })
|
|
5908
5960
|
] })
|
|
5909
5961
|
},
|
|
5910
5962
|
{
|
|
5911
5963
|
label: "\u5B8C\u6210\u5EA6",
|
|
5912
|
-
value: /* @__PURE__ */ (0,
|
|
5913
|
-
|
|
5914
|
-
/* @__PURE__ */ (0,
|
|
5964
|
+
value: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
5965
|
+
overall,
|
|
5966
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("small", { children: "%" })
|
|
5915
5967
|
] })
|
|
5916
5968
|
}
|
|
5917
5969
|
];
|
|
5918
|
-
return /* @__PURE__ */ (0,
|
|
5919
|
-
/* @__PURE__ */ (0,
|
|
5920
|
-
/* @__PURE__ */ (0,
|
|
5921
|
-
/* @__PURE__ */ (0,
|
|
5922
|
-
|
|
5923
|
-
|
|
5970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "rqk-listen-feedback", children: [
|
|
5971
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Art, { name: "trophy", className: "rqk-listen-feedback-art" }),
|
|
5972
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h2", { className: "rqk-listen-feedback-title", children: (_b = data.finishTitle) != null ? _b : "\u542C\u529B\u5B8C\u6210" }),
|
|
5973
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { className: "rqk-listen-feedback-sub", children: [
|
|
5974
|
+
tracks.length,
|
|
5975
|
+
" \u6BB5\u97F3\u9891\u5168\u90E8\u5B8C\u6210 \xB7 \u6709\u6548\u64AD\u653E ",
|
|
5976
|
+
overall,
|
|
5924
5977
|
"%"
|
|
5925
5978
|
] }),
|
|
5926
|
-
/* @__PURE__ */ (0,
|
|
5927
|
-
/* @__PURE__ */ (0,
|
|
5928
|
-
/* @__PURE__ */ (0,
|
|
5979
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "rqk-listen-stats", children: stats.map((stat, statIndex) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "rqk-listen-stat", children: [
|
|
5980
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "rqk-listen-stat-value", children: stat.value }),
|
|
5981
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "rqk-listen-stat-label", children: stat.label })
|
|
5929
5982
|
] }, statIndex)) })
|
|
5930
5983
|
] });
|
|
5931
5984
|
}
|
|
@@ -5939,27 +5992,56 @@ function isArtName(value) {
|
|
|
5939
5992
|
}
|
|
5940
5993
|
|
|
5941
5994
|
// src/questions/listen-task/listen-hero.tsx
|
|
5942
|
-
var
|
|
5943
|
-
function ListenHero({ data }) {
|
|
5944
|
-
return /* @__PURE__ */ (0,
|
|
5945
|
-
/* @__PURE__ */ (0,
|
|
5946
|
-
data.cover && isArtName(data.cover) ? /* @__PURE__ */ (0,
|
|
5947
|
-
data.badge ? /* @__PURE__ */ (0,
|
|
5995
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
5996
|
+
function ListenHero({ data, compact = false }) {
|
|
5997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Card, { className: classNames("rqk-listen-hero", compact && "rqk-is-compact"), children: [
|
|
5998
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "rqk-listen-art", children: [
|
|
5999
|
+
data.cover && isArtName(data.cover) ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Art, { name: data.cover, className: "rqk-listen-cover-art" }) : data.cover ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("img", { className: "rqk-listen-cover-img", src: data.cover, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Art, { name: "headphones", className: "rqk-listen-cover-art" }),
|
|
6000
|
+
data.badge ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "rqk-listen-badge", children: data.badge }) : null
|
|
5948
6001
|
] }),
|
|
5949
|
-
/* @__PURE__ */ (0,
|
|
5950
|
-
/* @__PURE__ */ (0,
|
|
5951
|
-
data.subtitle ? /* @__PURE__ */ (0,
|
|
6002
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "rqk-listen-meta", children: [
|
|
6003
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "rqk-listen-name", children: data.title }),
|
|
6004
|
+
data.subtitle ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "rqk-listen-subtitle", children: data.subtitle }) : null
|
|
5952
6005
|
] })
|
|
5953
6006
|
] });
|
|
5954
6007
|
}
|
|
5955
6008
|
|
|
6009
|
+
// src/questions/listen-task/listen-list.tsx
|
|
6010
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6011
|
+
function ListenList({
|
|
6012
|
+
tracks,
|
|
6013
|
+
current,
|
|
6014
|
+
done,
|
|
6015
|
+
readonly,
|
|
6016
|
+
onSelect
|
|
6017
|
+
}) {
|
|
6018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "rqk-listen-list", children: tracks.map((track, trackIndex) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6019
|
+
"button",
|
|
6020
|
+
{
|
|
6021
|
+
type: "button",
|
|
6022
|
+
className: classNames("rqk-listen-item", trackIndex === current && "rqk-is-current"),
|
|
6023
|
+
disabled: readonly,
|
|
6024
|
+
onClick: () => onSelect(trackIndex),
|
|
6025
|
+
children: [
|
|
6026
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "rqk-listen-item-no", children: trackIndex + 1 }),
|
|
6027
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "rqk-listen-item-text", children: [
|
|
6028
|
+
track.title,
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("small", { children: trackIndex === current ? "\u5F53\u524D\u97F3\u9891" : `\u65F6\u957F ${formatTime(track.duration)}` })
|
|
6030
|
+
] }),
|
|
6031
|
+
done(trackIndex) ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "rqk-listen-item-ok", children: "\u2713" }) : null
|
|
6032
|
+
]
|
|
6033
|
+
},
|
|
6034
|
+
trackIndex
|
|
6035
|
+
)) });
|
|
6036
|
+
}
|
|
6037
|
+
|
|
5956
6038
|
// src/questions/listen-task/listen-ring.tsx
|
|
5957
|
-
var
|
|
6039
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
5958
6040
|
function ListenRing({ percent }) {
|
|
5959
|
-
return /* @__PURE__ */ (0,
|
|
5960
|
-
/* @__PURE__ */ (0,
|
|
5961
|
-
/* @__PURE__ */ (0,
|
|
5962
|
-
/* @__PURE__ */ (0,
|
|
6041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "rqk-listen-ring", children: [
|
|
6042
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("svg", { width: "48", height: "48", viewBox: "0 0 48 48", "aria-hidden": true, children: [
|
|
6043
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("circle", { className: "rqk-listen-ring-bg", cx: "24", cy: "24", r: "20" }),
|
|
6044
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5963
6045
|
"circle",
|
|
5964
6046
|
{
|
|
5965
6047
|
className: "rqk-listen-ring-fg",
|
|
@@ -5971,7 +6053,7 @@ function ListenRing({ percent }) {
|
|
|
5971
6053
|
}
|
|
5972
6054
|
)
|
|
5973
6055
|
] }),
|
|
5974
|
-
/* @__PURE__ */ (0,
|
|
6056
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: classNames("rqk-listen-ring-text", percent >= 100 && "rqk-is-full"), children: [
|
|
5975
6057
|
percent,
|
|
5976
6058
|
"%"
|
|
5977
6059
|
] })
|
|
@@ -5979,107 +6061,111 @@ function ListenRing({ percent }) {
|
|
|
5979
6061
|
}
|
|
5980
6062
|
|
|
5981
6063
|
// src/questions/listen-task/listen-player.tsx
|
|
5982
|
-
var
|
|
5983
|
-
function ListenPlayer({
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
6064
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
6065
|
+
function ListenPlayer({ model }) {
|
|
6066
|
+
var _a;
|
|
6067
|
+
const track = model.track;
|
|
6068
|
+
if (!track) return null;
|
|
6069
|
+
const percent = model.percentFor(model.current);
|
|
6070
|
+
const credit = (_a = model.credits[model.current]) != null ? _a : 0;
|
|
6071
|
+
const duration = Math.max(track.duration, 0);
|
|
6072
|
+
const ratio = duration ? Math.min(1, model.position / duration) : 0;
|
|
6073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "rqk-listen-player", children: [
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "rqk-listen-top", children: [
|
|
6075
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5991
6076
|
"button",
|
|
5992
6077
|
{
|
|
5993
6078
|
type: "button",
|
|
5994
6079
|
className: "rqk-listen-play",
|
|
5995
|
-
onClick:
|
|
5996
|
-
"aria-label":
|
|
5997
|
-
children:
|
|
6080
|
+
onClick: model.toggle,
|
|
6081
|
+
"aria-label": model.playing ? "\u6682\u505C" : "\u64AD\u653E",
|
|
6082
|
+
children: model.playing ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(PauseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(PlayIcon, {})
|
|
5998
6083
|
}
|
|
5999
6084
|
),
|
|
6000
|
-
/* @__PURE__ */ (0,
|
|
6001
|
-
/* @__PURE__ */ (0,
|
|
6002
|
-
/* @__PURE__ */ (0,
|
|
6085
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "rqk-listen-info", children: [
|
|
6086
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "rqk-listen-state", children: model.playing ? "\u6B63\u5728\u64AD\u653E\u2026" : model.finished ? "\u64AD\u653E\u5B8C\u6BD5" : "\u5DF2\u6682\u505C" }),
|
|
6087
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "rqk-listen-hint", children: model.tracks.length > 1 ? `\u7B2C ${model.current + 1} \u6BB5 \xB7 \u5171 ${model.tracks.length} \u6BB5` : model.playing ? "\u64AD\u653E\u4E2D\u2026" : "\u70B9\u51FB\u64AD\u653E" })
|
|
6003
6088
|
] })
|
|
6004
6089
|
] }),
|
|
6005
|
-
/* @__PURE__ */ (0,
|
|
6090
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
6006
6091
|
"div",
|
|
6007
6092
|
{
|
|
6008
6093
|
className: "rqk-listen-track",
|
|
6009
6094
|
onPointerDown: (event) => {
|
|
6095
|
+
if (model.readonly) return;
|
|
6010
6096
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
6011
|
-
const
|
|
6012
|
-
|
|
6097
|
+
const next = Math.min(1, Math.max(0, (event.clientX - rect.left) / rect.width));
|
|
6098
|
+
model.seek(next * duration);
|
|
6013
6099
|
},
|
|
6014
6100
|
children: [
|
|
6015
|
-
/* @__PURE__ */ (0,
|
|
6016
|
-
/* @__PURE__ */ (0,
|
|
6017
|
-
|
|
6018
|
-
{
|
|
6019
|
-
className: "rqk-listen-fill",
|
|
6020
|
-
style: { width: `${progress.position / data.duration * 100}%` }
|
|
6021
|
-
}
|
|
6022
|
-
),
|
|
6023
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6024
|
-
"div",
|
|
6025
|
-
{
|
|
6026
|
-
className: "rqk-listen-knob",
|
|
6027
|
-
style: { left: `${progress.position / data.duration * 100}%` }
|
|
6028
|
-
}
|
|
6029
|
-
)
|
|
6101
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "rqk-listen-buffer" }),
|
|
6102
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "rqk-listen-fill", style: { width: `${ratio * 100}%` } }),
|
|
6103
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "rqk-listen-knob", style: { left: `${ratio * 100}%` } })
|
|
6030
6104
|
]
|
|
6031
6105
|
}
|
|
6032
6106
|
),
|
|
6033
|
-
/* @__PURE__ */ (0,
|
|
6034
|
-
/* @__PURE__ */ (0,
|
|
6035
|
-
/* @__PURE__ */ (0,
|
|
6107
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "rqk-listen-times", children: [
|
|
6108
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { children: formatTime(model.position) }),
|
|
6109
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { children: formatTime(duration) })
|
|
6036
6110
|
] }),
|
|
6037
|
-
/* @__PURE__ */ (0,
|
|
6038
|
-
/* @__PURE__ */ (0,
|
|
6111
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "rqk-listen-controls", children: [
|
|
6112
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
6039
6113
|
"button",
|
|
6040
6114
|
{
|
|
6041
6115
|
type: "button",
|
|
6042
|
-
className: classNames("rqk-listen-loop",
|
|
6043
|
-
|
|
6116
|
+
className: classNames("rqk-listen-loop", model.loop && "rqk-is-on"),
|
|
6117
|
+
disabled: model.readonly,
|
|
6118
|
+
onClick: () => model.setLoop(!model.loop),
|
|
6044
6119
|
children: [
|
|
6045
|
-
/* @__PURE__ */ (0,
|
|
6120
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoopIcon, {}),
|
|
6046
6121
|
"\u5FAA\u73AF"
|
|
6047
6122
|
]
|
|
6048
6123
|
}
|
|
6049
6124
|
),
|
|
6050
|
-
/* @__PURE__ */ (0,
|
|
6125
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
6051
6126
|
SegmentedControl,
|
|
6052
6127
|
{
|
|
6053
6128
|
ariaLabel: "\u64AD\u653E\u901F\u5EA6",
|
|
6054
6129
|
className: "rqk-listen-speeds",
|
|
6055
6130
|
options: SPEED_OPTIONS,
|
|
6056
|
-
value: `${
|
|
6057
|
-
|
|
6131
|
+
value: `${model.speed}`,
|
|
6132
|
+
disabled: model.readonly,
|
|
6133
|
+
onChange: (value) => model.setSpeed(Number(value))
|
|
6058
6134
|
}
|
|
6059
6135
|
)
|
|
6060
6136
|
] }),
|
|
6061
|
-
/* @__PURE__ */ (0,
|
|
6062
|
-
/* @__PURE__ */ (0,
|
|
6063
|
-
/* @__PURE__ */ (0,
|
|
6137
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "rqk-listen-progress", children: [
|
|
6138
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ListenRing, { percent }),
|
|
6139
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "rqk-listen-credit", children: Math.abs(model.position - credit) > 0.75 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
6064
6140
|
"\u64AD\u653E ",
|
|
6065
|
-
/* @__PURE__ */ (0,
|
|
6141
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("b", { children: formatTime(model.position) }),
|
|
6066
6142
|
" / ",
|
|
6067
|
-
formatTime(
|
|
6068
|
-
/* @__PURE__ */ (0,
|
|
6143
|
+
formatTime(duration),
|
|
6144
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "rqk-listen-credit-sep", children: "\xB7" }),
|
|
6069
6145
|
"\u6709\u6548 ",
|
|
6070
|
-
/* @__PURE__ */ (0,
|
|
6071
|
-
] }) : /* @__PURE__ */ (0,
|
|
6146
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("b", { children: formatTime(credit) })
|
|
6147
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
6072
6148
|
"\u6709\u6548\u64AD\u653E ",
|
|
6073
|
-
/* @__PURE__ */ (0,
|
|
6149
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("b", { children: formatTime(credit) }),
|
|
6074
6150
|
" / ",
|
|
6075
|
-
formatTime(
|
|
6151
|
+
formatTime(duration)
|
|
6076
6152
|
] }) })
|
|
6077
6153
|
] }),
|
|
6078
|
-
|
|
6154
|
+
model.tracks.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
6155
|
+
ListenList,
|
|
6156
|
+
{
|
|
6157
|
+
tracks: model.tracks,
|
|
6158
|
+
current: model.current,
|
|
6159
|
+
done: model.done,
|
|
6160
|
+
readonly: model.readonly,
|
|
6161
|
+
onSelect: model.selectTrack
|
|
6162
|
+
}
|
|
6163
|
+
) : null,
|
|
6164
|
+
track.audio ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
6079
6165
|
"audio",
|
|
6080
6166
|
{
|
|
6081
|
-
ref:
|
|
6082
|
-
src:
|
|
6167
|
+
ref: model.audioRef,
|
|
6168
|
+
src: track.audio,
|
|
6083
6169
|
preload: "metadata"
|
|
6084
6170
|
}
|
|
6085
6171
|
) : null
|
|
@@ -6088,32 +6174,222 @@ function ListenPlayer({
|
|
|
6088
6174
|
|
|
6089
6175
|
// src/questions/listen-task/use-listen-task.ts
|
|
6090
6176
|
var import_react27 = require("react");
|
|
6091
|
-
|
|
6177
|
+
var TICK_MS2 = 100;
|
|
6178
|
+
function useListenTask({
|
|
6179
|
+
data,
|
|
6180
|
+
onSubmit,
|
|
6181
|
+
mode = "answer",
|
|
6182
|
+
initialRatios
|
|
6183
|
+
}) {
|
|
6184
|
+
var _a, _b, _c, _d, _e;
|
|
6185
|
+
const tracks = (0, import_react27.useMemo)(() => {
|
|
6186
|
+
var _a2, _b2;
|
|
6187
|
+
if ((_a2 = data.audios) == null ? void 0 : _a2.length) return data.audios;
|
|
6188
|
+
return [{ title: data.title, audio: data.audio, duration: (_b2 = data.duration) != null ? _b2 : 0 }];
|
|
6189
|
+
}, [data]);
|
|
6190
|
+
const readonly = mode === "lookup" || mode === "preview";
|
|
6191
|
+
const ratios = tracks.map(
|
|
6192
|
+
(_, index) => {
|
|
6193
|
+
var _a2;
|
|
6194
|
+
return Math.min(1, Math.max(0, (_a2 = initialRatios == null ? void 0 : initialRatios[index]) != null ? _a2 : 0));
|
|
6195
|
+
}
|
|
6196
|
+
);
|
|
6197
|
+
const secondsFor = (ratio, track2) => Math.min(track2.duration, Math.max(0, ratio * track2.duration));
|
|
6198
|
+
const initial = tracks.map((track2, index) => secondsFor(ratios[index], track2));
|
|
6092
6199
|
const [view, setView] = (0, import_react27.useState)("task");
|
|
6093
|
-
const
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
const
|
|
6200
|
+
const [current, setCurrent] = (0, import_react27.useState)(0);
|
|
6201
|
+
const [position, setPosition] = (0, import_react27.useState)((_a = initial[0]) != null ? _a : 0);
|
|
6202
|
+
const [credits, setCredits] = (0, import_react27.useState)(initial);
|
|
6203
|
+
const [playing, setPlaying] = (0, import_react27.useState)(false);
|
|
6204
|
+
const [finished, setFinished] = (0, import_react27.useState)(false);
|
|
6205
|
+
const [speed, setSpeedState] = (0, import_react27.useState)(1);
|
|
6206
|
+
const [loop, setLoopState] = (0, import_react27.useState)(false);
|
|
6207
|
+
const [timeOnTask, setTimeOnTask] = (0, import_react27.useState)(0);
|
|
6208
|
+
const audioRef = (0, import_react27.useRef)(null);
|
|
6209
|
+
const positionRef = (0, import_react27.useRef)((_b = initial[0]) != null ? _b : 0);
|
|
6210
|
+
const creditRef = (0, import_react27.useRef)((_c = initial[0]) != null ? _c : 0);
|
|
6211
|
+
const playingRef = (0, import_react27.useRef)(false);
|
|
6212
|
+
const speedRef = (0, import_react27.useRef)(1);
|
|
6213
|
+
const loopRef = (0, import_react27.useRef)(false);
|
|
6214
|
+
const track = (_d = tracks[current]) != null ? _d : tracks[0];
|
|
6215
|
+
const duration = (_e = track == null ? void 0 : track.duration) != null ? _e : 0;
|
|
6216
|
+
(0, import_react27.useEffect)(() => {
|
|
6217
|
+
var _a2;
|
|
6218
|
+
const next = tracks.map((t, i) => secondsFor(ratios[i], t));
|
|
6219
|
+
setCredits(next);
|
|
6220
|
+
const credit = (_a2 = next[current]) != null ? _a2 : 0;
|
|
6221
|
+
creditRef.current = credit;
|
|
6222
|
+
positionRef.current = Math.min(track.duration, credit);
|
|
6223
|
+
setPosition(positionRef.current);
|
|
6224
|
+
}, [tracks]);
|
|
6225
|
+
const applyPosition = (value) => {
|
|
6226
|
+
const next = Math.min(duration, Math.max(0, value));
|
|
6227
|
+
positionRef.current = next;
|
|
6228
|
+
setPosition(next);
|
|
6229
|
+
};
|
|
6230
|
+
const applyCredit = (value) => {
|
|
6231
|
+
const next = Math.min(duration, Math.max(0, value));
|
|
6232
|
+
creditRef.current = next;
|
|
6233
|
+
setCredits((values) => values.map((item, itemIndex) => itemIndex === current ? next : item));
|
|
6234
|
+
};
|
|
6235
|
+
const pause = () => {
|
|
6236
|
+
var _a2;
|
|
6237
|
+
playingRef.current = false;
|
|
6238
|
+
setPlaying(false);
|
|
6239
|
+
(_a2 = audioRef.current) == null ? void 0 : _a2.pause();
|
|
6240
|
+
};
|
|
6241
|
+
const toggle = () => {
|
|
6242
|
+
var _a2;
|
|
6243
|
+
if (playingRef.current) {
|
|
6244
|
+
pause();
|
|
6245
|
+
return;
|
|
6246
|
+
}
|
|
6247
|
+
if (positionRef.current >= duration) {
|
|
6248
|
+
applyPosition(0);
|
|
6249
|
+
setFinished(false);
|
|
6250
|
+
}
|
|
6251
|
+
playingRef.current = true;
|
|
6252
|
+
setPlaying(true);
|
|
6253
|
+
if (track == null ? void 0 : track.audio) void ((_a2 = audioRef.current) == null ? void 0 : _a2.play().catch(() => void 0));
|
|
6254
|
+
};
|
|
6255
|
+
const seek = (seconds) => {
|
|
6256
|
+
if (readonly) return;
|
|
6257
|
+
applyPosition(seconds);
|
|
6258
|
+
if (seconds < duration) setFinished(false);
|
|
6259
|
+
if (audioRef.current) audioRef.current.currentTime = Math.max(0, Math.min(duration, seconds));
|
|
6260
|
+
};
|
|
6261
|
+
const setSpeed = (value) => {
|
|
6262
|
+
if (readonly) return;
|
|
6263
|
+
speedRef.current = value;
|
|
6264
|
+
setSpeedState(value);
|
|
6265
|
+
if (audioRef.current) audioRef.current.playbackRate = value;
|
|
6266
|
+
};
|
|
6267
|
+
const setLoop = (value) => {
|
|
6268
|
+
if (readonly) return;
|
|
6269
|
+
loopRef.current = value;
|
|
6270
|
+
setLoopState(value);
|
|
6271
|
+
if (audioRef.current) audioRef.current.loop = value;
|
|
6272
|
+
};
|
|
6273
|
+
const selectTrack = (trackIndex) => {
|
|
6274
|
+
var _a2, _b2;
|
|
6275
|
+
if (readonly || trackIndex === current) return;
|
|
6276
|
+
playingRef.current = false;
|
|
6277
|
+
setPlaying(false);
|
|
6278
|
+
setFinished(false);
|
|
6279
|
+
(_a2 = audioRef.current) == null ? void 0 : _a2.pause();
|
|
6280
|
+
setCurrent(trackIndex);
|
|
6281
|
+
positionRef.current = 0;
|
|
6282
|
+
creditRef.current = (_b2 = credits[trackIndex]) != null ? _b2 : 0;
|
|
6283
|
+
setPosition(0);
|
|
6284
|
+
};
|
|
6285
|
+
(0, import_react27.useEffect)(() => {
|
|
6286
|
+
if ((track == null ? void 0 : track.audio) || !playing) return void 0;
|
|
6287
|
+
const timer = window.setInterval(() => {
|
|
6288
|
+
if (!playingRef.current) return;
|
|
6289
|
+
const delta = TICK_MS2 / 1e3 * speedRef.current;
|
|
6290
|
+
let next = positionRef.current + delta;
|
|
6291
|
+
let stopped = false;
|
|
6292
|
+
if (next >= duration) {
|
|
6293
|
+
if (loopRef.current && duration > 0) {
|
|
6294
|
+
next -= duration;
|
|
6295
|
+
} else {
|
|
6296
|
+
next = duration;
|
|
6297
|
+
stopped = true;
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
applyPosition(next);
|
|
6301
|
+
applyCredit(creditRef.current + delta);
|
|
6302
|
+
setTimeOnTask((value) => value + TICK_MS2 / 1e3);
|
|
6303
|
+
if (stopped) {
|
|
6304
|
+
playingRef.current = false;
|
|
6305
|
+
setPlaying(false);
|
|
6306
|
+
setFinished(true);
|
|
6307
|
+
}
|
|
6308
|
+
}, TICK_MS2);
|
|
6309
|
+
return () => window.clearInterval(timer);
|
|
6310
|
+
}, [duration, playing, track == null ? void 0 : track.audio]);
|
|
6311
|
+
(0, import_react27.useEffect)(() => {
|
|
6312
|
+
const media = audioRef.current;
|
|
6313
|
+
if (!media || !(track == null ? void 0 : track.audio)) return void 0;
|
|
6314
|
+
media.playbackRate = speedRef.current;
|
|
6315
|
+
media.loop = loopRef.current;
|
|
6316
|
+
const handleTime = () => {
|
|
6317
|
+
const next = media.currentTime;
|
|
6318
|
+
const delta = next - positionRef.current;
|
|
6319
|
+
if (delta > 0 && delta < 1.2) {
|
|
6320
|
+
applyCredit(creditRef.current + delta);
|
|
6321
|
+
setTimeOnTask((value) => value + delta);
|
|
6322
|
+
}
|
|
6323
|
+
applyPosition(next);
|
|
6324
|
+
};
|
|
6325
|
+
const handleEnded = () => {
|
|
6326
|
+
setFinished(true);
|
|
6327
|
+
if (!loopRef.current) {
|
|
6328
|
+
playingRef.current = false;
|
|
6329
|
+
setPlaying(false);
|
|
6330
|
+
}
|
|
6331
|
+
};
|
|
6332
|
+
media.addEventListener("timeupdate", handleTime);
|
|
6333
|
+
media.addEventListener("ended", handleEnded);
|
|
6334
|
+
return () => {
|
|
6335
|
+
media.removeEventListener("timeupdate", handleTime);
|
|
6336
|
+
media.removeEventListener("ended", handleEnded);
|
|
6337
|
+
};
|
|
6338
|
+
}, [current, track == null ? void 0 : track.audio]);
|
|
6339
|
+
const percentFor = (trackIndex) => {
|
|
6340
|
+
var _a2;
|
|
6341
|
+
const item = tracks[trackIndex];
|
|
6342
|
+
if (!item || item.duration <= 0) return 0;
|
|
6343
|
+
return Math.min(100, Math.round(((_a2 = credits[trackIndex]) != null ? _a2 : 0) / item.duration * 100));
|
|
6344
|
+
};
|
|
6345
|
+
const done = (trackIndex) => percentFor(trackIndex) >= 90;
|
|
6346
|
+
const allDone = tracks.every((_item, trackIndex) => done(trackIndex));
|
|
6347
|
+
const overall = Math.round(
|
|
6348
|
+
tracks.reduce(
|
|
6349
|
+
(sum, item, trackIndex) => {
|
|
6350
|
+
var _a2;
|
|
6351
|
+
return sum + (item.duration > 0 ? Math.min(1, ((_a2 = credits[trackIndex]) != null ? _a2 : 0) / item.duration) : 0);
|
|
6352
|
+
},
|
|
6353
|
+
0
|
|
6354
|
+
) / tracks.length * 100
|
|
6355
|
+
);
|
|
6099
6356
|
const handleSubmit = () => {
|
|
6100
6357
|
setView("feedback");
|
|
6101
6358
|
onSubmit == null ? void 0 : onSubmit({
|
|
6102
6359
|
correct: true,
|
|
6103
6360
|
attempts: 1,
|
|
6104
|
-
answer: {
|
|
6361
|
+
answer: { credits }
|
|
6105
6362
|
});
|
|
6106
6363
|
};
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6364
|
+
return {
|
|
6365
|
+
allDone,
|
|
6366
|
+
audioRef,
|
|
6367
|
+
credits,
|
|
6368
|
+
current,
|
|
6369
|
+
done,
|
|
6370
|
+
finished,
|
|
6371
|
+
handleSubmit,
|
|
6372
|
+
loop,
|
|
6373
|
+
overall,
|
|
6374
|
+
percentFor,
|
|
6375
|
+
playing,
|
|
6376
|
+
position,
|
|
6377
|
+
readonly,
|
|
6378
|
+
selectTrack,
|
|
6379
|
+
setLoop,
|
|
6380
|
+
setSpeed,
|
|
6381
|
+
speed,
|
|
6382
|
+
timeOnTask,
|
|
6383
|
+
toggle,
|
|
6384
|
+
track,
|
|
6385
|
+
tracks,
|
|
6386
|
+
view,
|
|
6387
|
+
seek
|
|
6111
6388
|
};
|
|
6112
|
-
return { handleSubmit, percent, progress, replay, view };
|
|
6113
6389
|
}
|
|
6114
6390
|
|
|
6115
6391
|
// src/questions/listen-task/index.tsx
|
|
6116
|
-
var
|
|
6392
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
6117
6393
|
function ListenTask({
|
|
6118
6394
|
data,
|
|
6119
6395
|
mode = "answer",
|
|
@@ -6125,35 +6401,50 @@ function ListenTask({
|
|
|
6125
6401
|
onPrev,
|
|
6126
6402
|
onNext,
|
|
6127
6403
|
onSubmit,
|
|
6128
|
-
|
|
6404
|
+
bare,
|
|
6405
|
+
className,
|
|
6406
|
+
initialRatios
|
|
6129
6407
|
}) {
|
|
6130
|
-
const
|
|
6408
|
+
const labels = useQuestLabels();
|
|
6409
|
+
const model = useListenTask({ data, onSubmit, mode, initialRatios });
|
|
6131
6410
|
const actions = listenTaskActions({
|
|
6132
6411
|
feedback: model.view === "feedback",
|
|
6133
|
-
completed: model.
|
|
6134
|
-
|
|
6412
|
+
completed: model.allDone,
|
|
6413
|
+
readonly: model.readonly,
|
|
6414
|
+
labels,
|
|
6135
6415
|
onSubmit: model.handleSubmit,
|
|
6136
6416
|
onNext
|
|
6137
6417
|
});
|
|
6138
|
-
return /* @__PURE__ */ (0,
|
|
6418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
6139
6419
|
QuestShell,
|
|
6140
6420
|
{
|
|
6141
6421
|
mode,
|
|
6142
6422
|
title: title != null ? title : model.view === "feedback" ? "\u542C\u529B\u7EDF\u8BA1" : "\u542C\u529B\u4EFB\u52A1",
|
|
6143
6423
|
index,
|
|
6144
6424
|
total,
|
|
6145
|
-
instruction: instruction != null ? instruction : /* @__PURE__ */ (0,
|
|
6146
|
-
"\u542C\u5B8C\u97F3\u9891\
|
|
6147
|
-
|
|
6148
|
-
" \
|
|
6425
|
+
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
6426
|
+
model.tracks.length > 1 ? "\u542C\u5B8C\u6BCF\u6BB5\u97F3\u9891" : "\u542C\u5B8C\u97F3\u9891",
|
|
6427
|
+
"\uFF0C\u6709\u6548\u64AD\u653E ",
|
|
6428
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("b", { children: "\u226590%" }),
|
|
6429
|
+
" ",
|
|
6430
|
+
"\u89C6\u4E3A\u5B8C\u6210"
|
|
6149
6431
|
] }),
|
|
6150
6432
|
onBack,
|
|
6433
|
+
bare,
|
|
6151
6434
|
className: classNames("rqk-quest", "rqk-listen", className),
|
|
6152
6435
|
dataQuest: "listen-task",
|
|
6153
|
-
footer: /* @__PURE__ */ (0,
|
|
6154
|
-
children: model.view === "feedback" ? /* @__PURE__ */ (0,
|
|
6155
|
-
|
|
6156
|
-
|
|
6436
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
6437
|
+
children: model.view === "feedback" ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
6438
|
+
ListenFeedback,
|
|
6439
|
+
{
|
|
6440
|
+
data,
|
|
6441
|
+
tracks: model.tracks,
|
|
6442
|
+
overall: model.overall,
|
|
6443
|
+
timeOnTask: model.timeOnTask
|
|
6444
|
+
}
|
|
6445
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
6446
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ListenHero, { data, compact: model.tracks.length > 1 }),
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ListenPlayer, { model })
|
|
6157
6448
|
] })
|
|
6158
6449
|
}
|
|
6159
6450
|
);
|
|
@@ -6163,14 +6454,13 @@ function ListenTask({
|
|
|
6163
6454
|
function videoTaskActions({
|
|
6164
6455
|
feedback,
|
|
6165
6456
|
allDone,
|
|
6166
|
-
|
|
6457
|
+
labels,
|
|
6167
6458
|
onSubmit,
|
|
6168
6459
|
onNext
|
|
6169
6460
|
}) {
|
|
6170
6461
|
const actions = [];
|
|
6171
6462
|
if (feedback) {
|
|
6172
|
-
actions.push({ key: "
|
|
6173
|
-
actions.push({ key: "next", label: "\u5B8C\u6210\u5E76\u8FD4\u56DE", onClick: onNext });
|
|
6463
|
+
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
6174
6464
|
} else {
|
|
6175
6465
|
actions.push({
|
|
6176
6466
|
key: "submit",
|
|
@@ -6183,7 +6473,7 @@ function videoTaskActions({
|
|
|
6183
6473
|
}
|
|
6184
6474
|
|
|
6185
6475
|
// src/questions/video-task/feedback.tsx
|
|
6186
|
-
var
|
|
6476
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
6187
6477
|
function VideoFeedback({
|
|
6188
6478
|
data,
|
|
6189
6479
|
overall,
|
|
@@ -6193,63 +6483,63 @@ function VideoFeedback({
|
|
|
6193
6483
|
const stats = (_a = data.stats) != null ? _a : [
|
|
6194
6484
|
{
|
|
6195
6485
|
label: "\u89C2\u770B\u65F6\u957F",
|
|
6196
|
-
value: /* @__PURE__ */ (0,
|
|
6486
|
+
value: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
6197
6487
|
(timeOnTask / 60).toFixed(1),
|
|
6198
|
-
/* @__PURE__ */ (0,
|
|
6488
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("small", { children: "min" })
|
|
6199
6489
|
] })
|
|
6200
6490
|
},
|
|
6201
6491
|
{
|
|
6202
6492
|
label: "\u89C6\u9891\u6570\u91CF",
|
|
6203
|
-
value: /* @__PURE__ */ (0,
|
|
6493
|
+
value: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
6204
6494
|
data.videos.length,
|
|
6205
|
-
/* @__PURE__ */ (0,
|
|
6495
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("small", { children: "\u4E2A" })
|
|
6206
6496
|
] })
|
|
6207
6497
|
},
|
|
6208
6498
|
{
|
|
6209
6499
|
label: "\u5B8C\u6210\u5EA6",
|
|
6210
|
-
value: /* @__PURE__ */ (0,
|
|
6500
|
+
value: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
6211
6501
|
overall,
|
|
6212
|
-
/* @__PURE__ */ (0,
|
|
6502
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("small", { children: "%" })
|
|
6213
6503
|
] })
|
|
6214
6504
|
}
|
|
6215
6505
|
];
|
|
6216
|
-
return /* @__PURE__ */ (0,
|
|
6217
|
-
/* @__PURE__ */ (0,
|
|
6218
|
-
/* @__PURE__ */ (0,
|
|
6219
|
-
/* @__PURE__ */ (0,
|
|
6506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "rqk-video-feedback", children: [
|
|
6507
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Art, { name: "trophy", className: "rqk-video-feedback-art" }),
|
|
6508
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h2", { className: "rqk-video-feedback-title", children: (_b = data.finishTitle) != null ? _b : "\u89C6\u9891\u770B\u5B8C\u5566" }),
|
|
6509
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("p", { className: "rqk-video-feedback-sub", children: [
|
|
6220
6510
|
data.videos.length,
|
|
6221
6511
|
" \u4E2A\u89C6\u9891\u5168\u90E8\u5B8C\u6210 \xB7 \u6709\u6548\u89C2\u770B ",
|
|
6222
6512
|
overall,
|
|
6223
6513
|
"%"
|
|
6224
6514
|
] }),
|
|
6225
|
-
/* @__PURE__ */ (0,
|
|
6226
|
-
/* @__PURE__ */ (0,
|
|
6227
|
-
/* @__PURE__ */ (0,
|
|
6515
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "rqk-video-stats", children: stats.map((stat, statIndex) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "rqk-video-stat", children: [
|
|
6516
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "rqk-video-stat-value", children: stat.value }),
|
|
6517
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "rqk-video-stat-label", children: stat.label })
|
|
6228
6518
|
] }, statIndex)) })
|
|
6229
6519
|
] });
|
|
6230
6520
|
}
|
|
6231
6521
|
|
|
6232
6522
|
// src/questions/video-task/video-list.tsx
|
|
6233
|
-
var
|
|
6523
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
6234
6524
|
function VideoList({
|
|
6235
6525
|
data,
|
|
6236
6526
|
current,
|
|
6237
6527
|
done,
|
|
6238
6528
|
onSelect
|
|
6239
6529
|
}) {
|
|
6240
|
-
return /* @__PURE__ */ (0,
|
|
6530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "rqk-video-list", children: data.videos.map((item, videoIndex) => /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
6241
6531
|
"button",
|
|
6242
6532
|
{
|
|
6243
6533
|
type: "button",
|
|
6244
6534
|
className: classNames("rqk-video-item", videoIndex === current && "rqk-is-current"),
|
|
6245
6535
|
onClick: () => onSelect(videoIndex),
|
|
6246
6536
|
children: [
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6248
|
-
/* @__PURE__ */ (0,
|
|
6537
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "rqk-video-item-no", children: videoIndex + 1 }),
|
|
6538
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("span", { className: "rqk-video-item-text", children: [
|
|
6249
6539
|
item.title,
|
|
6250
|
-
/* @__PURE__ */ (0,
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("small", { children: videoIndex === current ? "\u6B63\u5728\u89C2\u770B" : `\u65F6\u957F ${formatTime(item.duration)}` })
|
|
6251
6541
|
] }),
|
|
6252
|
-
done(videoIndex) ? /* @__PURE__ */ (0,
|
|
6542
|
+
done(videoIndex) ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "rqk-video-item-ok", children: "\u2713" }) : null
|
|
6253
6543
|
]
|
|
6254
6544
|
},
|
|
6255
6545
|
videoIndex
|
|
@@ -6257,12 +6547,12 @@ function VideoList({
|
|
|
6257
6547
|
}
|
|
6258
6548
|
|
|
6259
6549
|
// src/questions/video-task/video-ring.tsx
|
|
6260
|
-
var
|
|
6550
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
6261
6551
|
function VideoRing({ percent }) {
|
|
6262
|
-
return /* @__PURE__ */ (0,
|
|
6263
|
-
/* @__PURE__ */ (0,
|
|
6264
|
-
/* @__PURE__ */ (0,
|
|
6265
|
-
/* @__PURE__ */ (0,
|
|
6552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "rqk-video-ring", children: [
|
|
6553
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("svg", { width: "48", height: "48", viewBox: "0 0 48 48", "aria-hidden": true, children: [
|
|
6554
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("circle", { className: "rqk-video-ring-bg", cx: "24", cy: "24", r: "20" }),
|
|
6555
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
6266
6556
|
"circle",
|
|
6267
6557
|
{
|
|
6268
6558
|
className: "rqk-video-ring-fg",
|
|
@@ -6275,7 +6565,7 @@ function VideoRing({ percent }) {
|
|
|
6275
6565
|
}
|
|
6276
6566
|
)
|
|
6277
6567
|
] }),
|
|
6278
|
-
/* @__PURE__ */ (0,
|
|
6568
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: classNames("rqk-video-ring-text", percent >= 100 && "rqk-is-full"), children: [
|
|
6279
6569
|
percent,
|
|
6280
6570
|
"%"
|
|
6281
6571
|
] })
|
|
@@ -6283,7 +6573,7 @@ function VideoRing({ percent }) {
|
|
|
6283
6573
|
}
|
|
6284
6574
|
|
|
6285
6575
|
// src/questions/video-task/video-controls.tsx
|
|
6286
|
-
var
|
|
6576
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
6287
6577
|
function VideoControls({
|
|
6288
6578
|
data,
|
|
6289
6579
|
video,
|
|
@@ -6300,24 +6590,24 @@ function VideoControls({
|
|
|
6300
6590
|
applyPosition
|
|
6301
6591
|
}) {
|
|
6302
6592
|
var _a, _b, _c;
|
|
6303
|
-
return /* @__PURE__ */ (0,
|
|
6304
|
-
/* @__PURE__ */ (0,
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card, { className: "rqk-video-controls", children: [
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "rqk-video-ctrl", children: [
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
6306
6596
|
"button",
|
|
6307
6597
|
{
|
|
6308
6598
|
type: "button",
|
|
6309
6599
|
className: "rqk-video-mini",
|
|
6310
6600
|
onClick: onToggle,
|
|
6311
6601
|
"aria-label": playing ? "\u6682\u505C" : "\u64AD\u653E",
|
|
6312
|
-
children: playing ? /* @__PURE__ */ (0,
|
|
6602
|
+
children: playing ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(PauseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(PlayIcon, {})
|
|
6313
6603
|
}
|
|
6314
6604
|
),
|
|
6315
|
-
/* @__PURE__ */ (0,
|
|
6316
|
-
/* @__PURE__ */ (0,
|
|
6317
|
-
/* @__PURE__ */ (0,
|
|
6318
|
-
/* @__PURE__ */ (0,
|
|
6605
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "rqk-video-scrub", children: [
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "rqk-video-times", children: [
|
|
6607
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: formatTime(position) }),
|
|
6608
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: formatTime(video.duration) })
|
|
6319
6609
|
] }),
|
|
6320
|
-
/* @__PURE__ */ (0,
|
|
6610
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
6321
6611
|
"div",
|
|
6322
6612
|
{
|
|
6323
6613
|
className: "rqk-video-track",
|
|
@@ -6327,14 +6617,14 @@ function VideoControls({
|
|
|
6327
6617
|
applyPosition(ratio * video.duration);
|
|
6328
6618
|
},
|
|
6329
6619
|
children: [
|
|
6330
|
-
/* @__PURE__ */ (0,
|
|
6620
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
6331
6621
|
"div",
|
|
6332
6622
|
{
|
|
6333
6623
|
className: "rqk-video-fill",
|
|
6334
6624
|
style: { width: `${position / video.duration * 100}%` }
|
|
6335
6625
|
}
|
|
6336
6626
|
),
|
|
6337
|
-
/* @__PURE__ */ (0,
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
6338
6628
|
"div",
|
|
6339
6629
|
{
|
|
6340
6630
|
className: "rqk-video-knob",
|
|
@@ -6345,40 +6635,40 @@ function VideoControls({
|
|
|
6345
6635
|
}
|
|
6346
6636
|
)
|
|
6347
6637
|
] }),
|
|
6348
|
-
/* @__PURE__ */ (0,
|
|
6638
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
6349
6639
|
"button",
|
|
6350
6640
|
{
|
|
6351
6641
|
type: "button",
|
|
6352
6642
|
className: classNames("rqk-video-mini", fullscreen && "rqk-is-on"),
|
|
6353
6643
|
onClick: onFullscreen,
|
|
6354
6644
|
"aria-label": "\u5207\u6362\u5168\u5C4F",
|
|
6355
|
-
children: /* @__PURE__ */ (0,
|
|
6645
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(FullscreenIcon, {})
|
|
6356
6646
|
}
|
|
6357
6647
|
)
|
|
6358
6648
|
] }),
|
|
6359
|
-
/* @__PURE__ */ (0,
|
|
6360
|
-
/* @__PURE__ */ (0,
|
|
6361
|
-
/* @__PURE__ */ (0,
|
|
6649
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "rqk-video-progress", children: [
|
|
6650
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(VideoRing, { percent: percentFor(current) }),
|
|
6651
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "rqk-video-credit", children: Math.abs(position - ((_a = credits[current]) != null ? _a : 0)) > 0.75 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
6362
6652
|
"\u64AD\u653E ",
|
|
6363
|
-
/* @__PURE__ */ (0,
|
|
6653
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("b", { children: formatTime(position) }),
|
|
6364
6654
|
" / ",
|
|
6365
6655
|
formatTime(video.duration),
|
|
6366
|
-
/* @__PURE__ */ (0,
|
|
6656
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "rqk-video-credit-sep", children: "\xB7" }),
|
|
6367
6657
|
"\u6709\u6548 ",
|
|
6368
|
-
/* @__PURE__ */ (0,
|
|
6369
|
-
] }) : /* @__PURE__ */ (0,
|
|
6658
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("b", { children: formatTime((_b = credits[current]) != null ? _b : 0) })
|
|
6659
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
6370
6660
|
"\u6709\u6548\u89C2\u770B ",
|
|
6371
|
-
/* @__PURE__ */ (0,
|
|
6661
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("b", { children: formatTime((_c = credits[current]) != null ? _c : 0) }),
|
|
6372
6662
|
" / ",
|
|
6373
6663
|
formatTime(video.duration)
|
|
6374
6664
|
] }) })
|
|
6375
6665
|
] }),
|
|
6376
|
-
/* @__PURE__ */ (0,
|
|
6666
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(VideoList, { data, current, done, onSelect })
|
|
6377
6667
|
] });
|
|
6378
6668
|
}
|
|
6379
6669
|
|
|
6380
6670
|
// src/questions/video-task/video-stage.tsx
|
|
6381
|
-
var
|
|
6671
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
6382
6672
|
function VideoStage({
|
|
6383
6673
|
video,
|
|
6384
6674
|
position,
|
|
@@ -6388,15 +6678,15 @@ function VideoStage({
|
|
|
6388
6678
|
onToggle,
|
|
6389
6679
|
onStageFullscreen
|
|
6390
6680
|
}) {
|
|
6391
|
-
const cover = video.poster ? /* @__PURE__ */ (0,
|
|
6392
|
-
return /* @__PURE__ */ (0,
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6394
|
-
/* @__PURE__ */ (0,
|
|
6395
|
-
playing ? null : /* @__PURE__ */ (0,
|
|
6396
|
-
/* @__PURE__ */ (0,
|
|
6397
|
-
/* @__PURE__ */ (0,
|
|
6398
|
-
/* @__PURE__ */ (0,
|
|
6399
|
-
video.src ? /* @__PURE__ */ (0,
|
|
6681
|
+
const cover = video.poster ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { className: "rqk-video-poster", src: video.poster, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Art, { name: "screen", className: "rqk-video-cover-art" });
|
|
6682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: classNames("rqk-video-stage", fullscreen && "rqk-is-fullscreen"), children: [
|
|
6683
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "rqk-video-cover", children: cover }),
|
|
6684
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "rqk-video-dim" }),
|
|
6685
|
+
playing ? null : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("button", { type: "button", className: "rqk-video-bigplay", onClick: onToggle, "aria-label": "\u64AD\u653E", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(PlayIcon, {}) }),
|
|
6686
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "rqk-video-duration", children: formatTime(video.duration) }),
|
|
6687
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("button", { type: "button", className: "rqk-video-fs", onClick: onStageFullscreen, "aria-label": "\u5168\u5C4F", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FullscreenIcon, {}) }),
|
|
6688
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "rqk-video-nowbar", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("i", { style: { width: `${position / video.duration * 100}%` } }) }),
|
|
6689
|
+
video.src ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
6400
6690
|
"video",
|
|
6401
6691
|
{
|
|
6402
6692
|
ref: (element) => {
|
|
@@ -6418,7 +6708,7 @@ var import_react29 = require("react");
|
|
|
6418
6708
|
var import_react28 = require("react");
|
|
6419
6709
|
|
|
6420
6710
|
// src/questions/video-task/constants.ts
|
|
6421
|
-
var
|
|
6711
|
+
var TICK_MS3 = 100;
|
|
6422
6712
|
|
|
6423
6713
|
// src/questions/video-task/use-video-clock.ts
|
|
6424
6714
|
function useVideoClock({
|
|
@@ -6445,7 +6735,7 @@ function useVideoClock({
|
|
|
6445
6735
|
if (video.src || !playing) return void 0;
|
|
6446
6736
|
const timer = window.setInterval(() => {
|
|
6447
6737
|
if (!playingRef.current) return;
|
|
6448
|
-
const delta =
|
|
6738
|
+
const delta = TICK_MS3 / 1e3;
|
|
6449
6739
|
const next = positionRef.current + delta;
|
|
6450
6740
|
applyPosition(next);
|
|
6451
6741
|
applyCredit(creditRef.current + delta);
|
|
@@ -6454,7 +6744,7 @@ function useVideoClock({
|
|
|
6454
6744
|
playingRef.current = false;
|
|
6455
6745
|
setPlaying(false);
|
|
6456
6746
|
}
|
|
6457
|
-
},
|
|
6747
|
+
}, TICK_MS3);
|
|
6458
6748
|
return () => window.clearInterval(timer);
|
|
6459
6749
|
}, [playing, video.duration, video.src]);
|
|
6460
6750
|
(0, import_react28.useEffect)(() => {
|
|
@@ -6570,10 +6860,6 @@ function useVideoTask({ data, onSubmit }) {
|
|
|
6570
6860
|
answer: { credits }
|
|
6571
6861
|
});
|
|
6572
6862
|
};
|
|
6573
|
-
const replay = () => {
|
|
6574
|
-
setView("task");
|
|
6575
|
-
applyPosition(0);
|
|
6576
|
-
};
|
|
6577
6863
|
const toggleStageFullscreen = () => {
|
|
6578
6864
|
var _a2, _b, _c, _d;
|
|
6579
6865
|
setFullscreen((value) => !value);
|
|
@@ -6595,7 +6881,6 @@ function useVideoTask({ data, onSubmit }) {
|
|
|
6595
6881
|
percentFor,
|
|
6596
6882
|
playing,
|
|
6597
6883
|
position,
|
|
6598
|
-
replay,
|
|
6599
6884
|
selectVideo,
|
|
6600
6885
|
setFullscreen,
|
|
6601
6886
|
timeOnTask,
|
|
@@ -6608,7 +6893,7 @@ function useVideoTask({ data, onSubmit }) {
|
|
|
6608
6893
|
}
|
|
6609
6894
|
|
|
6610
6895
|
// src/questions/video-task/index.tsx
|
|
6611
|
-
var
|
|
6896
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
6612
6897
|
function VideoTask({
|
|
6613
6898
|
data,
|
|
6614
6899
|
mode = "answer",
|
|
@@ -6622,32 +6907,33 @@ function VideoTask({
|
|
|
6622
6907
|
onSubmit,
|
|
6623
6908
|
className
|
|
6624
6909
|
}) {
|
|
6910
|
+
const labels = useQuestLabels();
|
|
6625
6911
|
const model = useVideoTask({ data, onSubmit });
|
|
6626
6912
|
const actions = videoTaskActions({
|
|
6627
6913
|
feedback: model.view === "feedback",
|
|
6628
6914
|
allDone: model.allDone,
|
|
6629
|
-
|
|
6915
|
+
labels,
|
|
6630
6916
|
onSubmit: model.handleSubmit,
|
|
6631
6917
|
onNext
|
|
6632
6918
|
});
|
|
6633
|
-
return /* @__PURE__ */ (0,
|
|
6919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6634
6920
|
QuestShell,
|
|
6635
6921
|
{
|
|
6636
6922
|
mode,
|
|
6637
6923
|
title: title != null ? title : model.view === "feedback" ? "\u89C6\u9891\u7EDF\u8BA1" : "\u89C6\u9891\u4EFB\u52A1",
|
|
6638
6924
|
index,
|
|
6639
6925
|
total,
|
|
6640
|
-
instruction: instruction != null ? instruction : /* @__PURE__ */ (0,
|
|
6926
|
+
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
6641
6927
|
"\u89C2\u770B\u89C6\u9891\uFF0C\u6709\u6548\u89C2\u770B ",
|
|
6642
|
-
/* @__PURE__ */ (0,
|
|
6928
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("b", { children: "\u226590%" }),
|
|
6643
6929
|
" \u89C6\u4E3A\u5B8C\u6210"
|
|
6644
6930
|
] }),
|
|
6645
6931
|
onBack,
|
|
6646
6932
|
className: classNames("rqk-quest", "rqk-video", className),
|
|
6647
6933
|
dataQuest: "video-task",
|
|
6648
|
-
footer: /* @__PURE__ */ (0,
|
|
6649
|
-
children: model.view === "feedback" ? /* @__PURE__ */ (0,
|
|
6650
|
-
/* @__PURE__ */ (0,
|
|
6934
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ActionBar, { actions, index, total, onPrev }),
|
|
6935
|
+
children: model.view === "feedback" ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(VideoFeedback, { data, overall: model.overall, timeOnTask: model.timeOnTask }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
6936
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6651
6937
|
VideoStage,
|
|
6652
6938
|
{
|
|
6653
6939
|
video: model.video,
|
|
@@ -6659,7 +6945,7 @@ function VideoTask({
|
|
|
6659
6945
|
onStageFullscreen: model.toggleStageFullscreen
|
|
6660
6946
|
}
|
|
6661
6947
|
),
|
|
6662
|
-
/* @__PURE__ */ (0,
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6663
6949
|
VideoControls,
|
|
6664
6950
|
{
|
|
6665
6951
|
data,
|
|
@@ -6683,7 +6969,7 @@ function VideoTask({
|
|
|
6683
6969
|
}
|
|
6684
6970
|
|
|
6685
6971
|
// src/primitives/blank-input.tsx
|
|
6686
|
-
var
|
|
6972
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
6687
6973
|
function BlankInput2({
|
|
6688
6974
|
value,
|
|
6689
6975
|
onChange,
|
|
@@ -6698,7 +6984,7 @@ function BlankInput2({
|
|
|
6698
6984
|
var _a;
|
|
6699
6985
|
const measured = Math.max(value.length, (_a = placeholder == null ? void 0 : placeholder.length) != null ? _a : 0, minCh);
|
|
6700
6986
|
const width = `${Math.min(18, Math.max(minCh, measured))}ch`;
|
|
6701
|
-
return /* @__PURE__ */ (0,
|
|
6987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
6702
6988
|
"input",
|
|
6703
6989
|
{
|
|
6704
6990
|
className: classNames(
|
|
@@ -6721,10 +7007,11 @@ function BlankInput2({
|
|
|
6721
7007
|
}
|
|
6722
7008
|
|
|
6723
7009
|
// src/index.tsx
|
|
6724
|
-
var version = "1.0.
|
|
7010
|
+
var version = "1.0.5";
|
|
6725
7011
|
var questkit = {
|
|
6726
7012
|
version,
|
|
6727
7013
|
QuestShell,
|
|
7014
|
+
QuestComplete,
|
|
6728
7015
|
OptionItem,
|
|
6729
7016
|
FeedbackSheet,
|
|
6730
7017
|
Instruction,
|
|
@@ -6766,6 +7053,7 @@ var index_default = questkit;
|
|
|
6766
7053
|
OptionItem,
|
|
6767
7054
|
PictureBox,
|
|
6768
7055
|
Progress,
|
|
7056
|
+
QuestComplete,
|
|
6769
7057
|
QuestConfigProvider,
|
|
6770
7058
|
QuestProvider,
|
|
6771
7059
|
QuestShell,
|