@jswork/react-questkit 1.0.1 → 1.0.3
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 +594 -551
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +24 -22
- package/dist/index.d.ts +24 -22
- package/dist/index.mjs +570 -527
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +2 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -285,104 +285,8 @@ function classNames(...values) {
|
|
|
285
285
|
return (0, import_classnames.default)(...values);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
// src/core/icons.tsx
|
|
289
|
-
var import_classnames2 = __toESM(require("classnames"));
|
|
290
|
-
|
|
291
|
-
// src/assets/svg/icon-alert.svg
|
|
292
|
-
var icon_alert_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="2"></circle><path d="M12 7.5v5.5" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"></path><circle cx="12" cy="16.6" r="1.2" fill="currentColor" stroke="none"></circle></svg>\n';
|
|
293
|
-
|
|
294
|
-
// src/assets/svg/icon-back.svg
|
|
295
|
-
var icon_back_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M14.5 5.5L8 12l6.5 6.5" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"></path></svg>\n';
|
|
296
|
-
|
|
297
|
-
// src/assets/svg/icon-check.svg
|
|
298
|
-
var icon_check_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M5 12.5l4.6 4.6L19 7.4" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"></path></svg>\n';
|
|
299
|
-
|
|
300
|
-
// src/assets/svg/icon-cross.svg
|
|
301
|
-
var icon_cross_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M6.5 6.5l11 11M17.5 6.5l-11 11" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"></path></svg>\n';
|
|
302
|
-
|
|
303
|
-
// src/assets/svg/icon-fullscreen.svg
|
|
304
|
-
var icon_fullscreen_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M4.6 9V4.6H9M15 4.6h4.4V9M19.4 15v4.4H15M9 19.4H4.6V15" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"></path></svg>\n';
|
|
305
|
-
|
|
306
|
-
// src/assets/svg/icon-keyboard.svg
|
|
307
|
-
var icon_keyboard_default = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><rect x="2.5" y="6" width="19" height="12" rx="3" stroke="currentColor" stroke-width="1.6"></rect><path d="M7 10h.01M10.5 10h.01M14 10h.01M17.5 10h.01M8 14h8" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path></svg>\n';
|
|
308
|
-
|
|
309
|
-
// src/assets/svg/icon-loop.svg
|
|
310
|
-
var icon_loop_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M5.4 10.4A6.6 6.6 0 0118 9.4M18.6 13.6A6.6 6.6 0 016 14.6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path><path d="M18.6 5.6v4h-4M5.4 18.4v-4h4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>\n';
|
|
311
|
-
|
|
312
|
-
// src/assets/svg/icon-mic.svg
|
|
313
|
-
var icon_mic_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><rect x="9" y="3.6" width="6" height="10" rx="3" stroke="currentColor" stroke-width="1.9"></rect><path d="M5.6 11.4a6.4 6.4 0 0012.8 0" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"></path><path d="M12 17.8V21M9 21h6" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"></path></svg>\n';
|
|
314
|
-
|
|
315
|
-
// src/assets/svg/icon-pause.svg
|
|
316
|
-
var icon_pause_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><rect x="7" y="5.5" width="3.6" height="13" rx="1.4" fill="currentColor"></rect><rect x="13.4" y="5.5" width="3.6" height="13" rx="1.4" fill="currentColor"></rect></svg>\n';
|
|
317
|
-
|
|
318
|
-
// src/assets/svg/icon-play.svg
|
|
319
|
-
var icon_play_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M8 5.4l10.2 6.6L8 18.6V5.4z" fill="currentColor" stroke="currentColor" stroke-width="0.6" stroke-linejoin="round"></path></svg>\n';
|
|
320
|
-
|
|
321
|
-
// src/assets/svg/icon-speaker.svg
|
|
322
|
-
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';
|
|
323
|
-
|
|
324
|
-
// src/core/icons.tsx
|
|
325
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
326
|
-
function SvgIcon(_a) {
|
|
327
|
-
var _b = _a, {
|
|
328
|
-
source,
|
|
329
|
-
size,
|
|
330
|
-
className,
|
|
331
|
-
style
|
|
332
|
-
} = _b, rest = __objRest(_b, [
|
|
333
|
-
"source",
|
|
334
|
-
"size",
|
|
335
|
-
"className",
|
|
336
|
-
"style"
|
|
337
|
-
]);
|
|
338
|
-
const html = size ? source.replace("<svg", '<svg style="width:100%;height:100%"') : source;
|
|
339
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
340
|
-
"span",
|
|
341
|
-
__spreadProps(__spreadValues({
|
|
342
|
-
className: (0, import_classnames2.default)("rqk-icon", className),
|
|
343
|
-
style: size ? __spreadValues({ width: size, height: size }, style) : style,
|
|
344
|
-
"aria-hidden": true
|
|
345
|
-
}, rest), {
|
|
346
|
-
dangerouslySetInnerHTML: { __html: html }
|
|
347
|
-
})
|
|
348
|
-
);
|
|
349
|
-
}
|
|
350
|
-
function CheckIcon(props) {
|
|
351
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_check_default }, props));
|
|
352
|
-
}
|
|
353
|
-
function CrossIcon(props) {
|
|
354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_cross_default }, props));
|
|
355
|
-
}
|
|
356
|
-
function AlertIcon(props) {
|
|
357
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_alert_default }, props));
|
|
358
|
-
}
|
|
359
|
-
function PlayIcon(props) {
|
|
360
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_play_default }, props));
|
|
361
|
-
}
|
|
362
|
-
function PauseIcon(props) {
|
|
363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_pause_default }, props));
|
|
364
|
-
}
|
|
365
|
-
function MicIcon(props) {
|
|
366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_mic_default }, props));
|
|
367
|
-
}
|
|
368
|
-
function SpeakerIcon(props) {
|
|
369
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_speaker_default }, props));
|
|
370
|
-
}
|
|
371
|
-
function BackIcon(props) {
|
|
372
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_back_default }, props));
|
|
373
|
-
}
|
|
374
|
-
function LoopIcon(props) {
|
|
375
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_loop_default }, props));
|
|
376
|
-
}
|
|
377
|
-
function FullscreenIcon(props) {
|
|
378
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_fullscreen_default }, props));
|
|
379
|
-
}
|
|
380
|
-
function KeyboardIcon(props) {
|
|
381
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgIcon, __spreadValues({ source: icon_keyboard_default }, props));
|
|
382
|
-
}
|
|
383
|
-
|
|
384
288
|
// src/primitives/instruction.tsx
|
|
385
|
-
var
|
|
289
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
386
290
|
function Instruction({
|
|
387
291
|
children,
|
|
388
292
|
icon = true,
|
|
@@ -390,24 +294,40 @@ function Instruction({
|
|
|
390
294
|
className
|
|
391
295
|
}) {
|
|
392
296
|
if (!children) return null;
|
|
393
|
-
return /* @__PURE__ */ (0,
|
|
297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
394
298
|
"div",
|
|
395
299
|
{
|
|
396
300
|
className: classNames(
|
|
397
|
-
"rqk-instruction",
|
|
398
|
-
variant
|
|
301
|
+
"rqk-instruction flex flex-none items-start gap-2 px-3 py-2.5",
|
|
302
|
+
variant === "plain" ? "rqk-instruction-plain mx-5 mb-3 mt-1.5 gap-0 rounded-none bg-transparent p-0" : "rounded-[14px] bg-[rgba(228,237,255,0.6)]",
|
|
399
303
|
className
|
|
400
304
|
),
|
|
401
305
|
children: [
|
|
402
|
-
icon && variant !== "plain" ? /* @__PURE__ */ (0,
|
|
403
|
-
|
|
306
|
+
icon && variant !== "plain" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
307
|
+
"span",
|
|
308
|
+
{
|
|
309
|
+
className: "rqk-instruction-icon bg-rqk-blue-500 mt-px grid h-[18px] w-[18px] flex-none place-items-center rounded-full font-serif text-[11px] font-bold italic text-white",
|
|
310
|
+
"aria-hidden": true,
|
|
311
|
+
children: "i"
|
|
312
|
+
}
|
|
313
|
+
) : null,
|
|
314
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
className: classNames(
|
|
318
|
+
"rqk-instruction-text text-rqk-ink-2 text-[13px] leading-[1.55]",
|
|
319
|
+
variant === "plain" ? "text-rqk-cap text-rqk-ink-3 [&_b]:text-rqk-ink-3 [&_strong]:text-rqk-ink-3 font-semibold tracking-[0.1px] [&_b]:font-extrabold [&_strong]:font-extrabold" : "[&_b]:text-rqk-blue-500 [&_strong]:text-rqk-blue-500 [&_b]:font-semibold [&_strong]:font-semibold [&_u]:[text-decoration-color:var(--rqk-blue-300)] [&_u]:[text-underline-offset:3px]"
|
|
320
|
+
),
|
|
321
|
+
children
|
|
322
|
+
}
|
|
323
|
+
)
|
|
404
324
|
]
|
|
405
325
|
}
|
|
406
326
|
);
|
|
407
327
|
}
|
|
408
328
|
|
|
409
329
|
// src/primitives/progress.tsx
|
|
410
|
-
var
|
|
330
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
411
331
|
function Progress({
|
|
412
332
|
value,
|
|
413
333
|
total,
|
|
@@ -417,10 +337,13 @@ function Progress({
|
|
|
417
337
|
}) {
|
|
418
338
|
const safeTotal = total > 0 ? total : 1;
|
|
419
339
|
const percent = Math.max(2, Math.min(100, value / safeTotal * 100));
|
|
420
|
-
return /* @__PURE__ */ (0,
|
|
340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
421
341
|
"div",
|
|
422
342
|
{
|
|
423
|
-
className: classNames(
|
|
343
|
+
className: classNames(
|
|
344
|
+
"rqk-progress flex flex-none items-center gap-3",
|
|
345
|
+
className
|
|
346
|
+
),
|
|
424
347
|
role: "progressbar",
|
|
425
348
|
"aria-label": ariaLabel,
|
|
426
349
|
"aria-valuenow": value,
|
|
@@ -428,12 +351,18 @@ function Progress({
|
|
|
428
351
|
"aria-valuemax": total,
|
|
429
352
|
"aria-valuetext": `${value}/${total}`,
|
|
430
353
|
children: [
|
|
431
|
-
showValue ? /* @__PURE__ */ (0,
|
|
354
|
+
showValue ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "rqk-progress-text text-rqk-cap text-rqk-ink-2 min-w-[34px] flex-none font-extrabold leading-[1.2] tracking-[0.2px] [font-variant-numeric:tabular-nums]", children: [
|
|
432
355
|
value,
|
|
433
356
|
"/",
|
|
434
357
|
total
|
|
435
358
|
] }) : null,
|
|
436
|
-
/* @__PURE__ */ (0,
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "rqk-progress-track rounded-rqk-pill block h-2 flex-1 overflow-hidden bg-[#e9eef7] shadow-[inset_0_1px_2px_rgba(16,24,40,0.05)]", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
360
|
+
"span",
|
|
361
|
+
{
|
|
362
|
+
className: "rqk-progress-fill ease-rqk-ease block h-full rounded-[inherit] bg-[linear-gradient(90deg,#5b95ff,var(--rqk-blue-500)_76%)] shadow-[inset_0_1px_0_rgba(255,255,255,0.28)] transition-[width] duration-[450ms] will-change-[width]",
|
|
363
|
+
style: { width: `${percent}%` }
|
|
364
|
+
}
|
|
365
|
+
) })
|
|
437
366
|
]
|
|
438
367
|
}
|
|
439
368
|
);
|
|
@@ -441,7 +370,7 @@ function Progress({
|
|
|
441
370
|
|
|
442
371
|
// src/primitives/toast.tsx
|
|
443
372
|
var import_react2 = require("react");
|
|
444
|
-
var
|
|
373
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
445
374
|
var QuestToastContext = (0, import_react2.createContext)({ show: () => void 0 });
|
|
446
375
|
function useQuestToast() {
|
|
447
376
|
return (0, import_react2.useContext)(QuestToastContext);
|
|
@@ -465,67 +394,157 @@ function useToastController() {
|
|
|
465
394
|
}
|
|
466
395
|
function Toast({ children, align = "center", className }) {
|
|
467
396
|
if (!children) return null;
|
|
468
|
-
return /* @__PURE__ */ (0,
|
|
397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
className: classNames(
|
|
401
|
+
"rqk-toast rounded-rqk-pill animate-rqk-toast-in absolute bottom-28 z-20 max-w-[78%] bg-[rgba(15,23,42,0.88)] px-4 py-[9px] text-center text-[13px] leading-[1.4] text-white shadow-[0_12px_26px_-10px_rgba(15,23,42,0.5)] backdrop-blur-[8px]",
|
|
402
|
+
`rqk-toast-${align}`,
|
|
403
|
+
align === "left" && "left-5 right-auto translate-x-0 text-left",
|
|
404
|
+
align === "right" && "left-auto right-5 translate-x-0 text-right",
|
|
405
|
+
align === "center" && "left-1/2 -translate-x-1/2",
|
|
406
|
+
className
|
|
407
|
+
),
|
|
408
|
+
role: "status",
|
|
409
|
+
children
|
|
410
|
+
}
|
|
411
|
+
);
|
|
469
412
|
}
|
|
470
413
|
function QuestToastProvider({ api, children }) {
|
|
471
|
-
return /* @__PURE__ */ (0,
|
|
414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(QuestToastContext.Provider, { value: api, children });
|
|
472
415
|
}
|
|
473
416
|
|
|
474
417
|
// src/primitives/quest-shell.tsx
|
|
475
|
-
var
|
|
418
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
476
419
|
function QuestShell({
|
|
477
420
|
mode = "answer",
|
|
478
|
-
title,
|
|
479
421
|
index = 1,
|
|
480
422
|
total = 99,
|
|
481
423
|
instruction,
|
|
482
424
|
instructionVariant = "card",
|
|
483
|
-
onBack,
|
|
484
425
|
footer,
|
|
485
426
|
feedback,
|
|
486
|
-
frame = false,
|
|
487
|
-
statusBar,
|
|
488
427
|
dataQuest,
|
|
489
428
|
className,
|
|
490
429
|
children
|
|
491
430
|
}) {
|
|
492
431
|
const { toast, api } = useToastController();
|
|
493
|
-
|
|
494
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestToastProvider, { api, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(QuestToastProvider, { api, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
495
433
|
"div",
|
|
496
434
|
{
|
|
497
|
-
className: classNames(
|
|
435
|
+
className: classNames(
|
|
436
|
+
"rqk-shell relative isolate flex h-full w-full min-h-0 flex-col overflow-hidden bg-[var(--rqk-screen-bg)]",
|
|
437
|
+
className
|
|
438
|
+
),
|
|
498
439
|
"data-component": "react-questkit",
|
|
499
440
|
"data-mode": mode,
|
|
500
441
|
"data-quest": dataQuest,
|
|
501
442
|
children: [
|
|
502
|
-
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
] }) : null,
|
|
511
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { className: "rqk-nav", children: [
|
|
512
|
-
onBack ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "rqk-nav-back", onClick: onBack, "aria-label": "\u8FD4\u56DE", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BackIcon, { size: 20 }) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "rqk-nav-spacer" }),
|
|
513
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rqk-nav-title", children: title }),
|
|
514
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "rqk-nav-spacer" })
|
|
515
|
-
] }),
|
|
516
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Progress, { value: index, total }),
|
|
517
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Instruction, { variant: instructionVariant, children: instruction }),
|
|
518
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "rqk-body", children: [
|
|
519
|
-
children,
|
|
520
|
-
feedback ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rqk-feedback-wrap", children: feedback }) : null,
|
|
521
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Toast, { align: toast == null ? void 0 : toast.align, children: toast == null ? void 0 : toast.message })
|
|
443
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "rqk-body relative flex min-h-0 flex-1 flex-col", children: [
|
|
444
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "rqk-page", children: [
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Progress, { value: index, total }),
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Instruction, { variant: instructionVariant, children: instruction }),
|
|
447
|
+
children
|
|
448
|
+
] }),
|
|
449
|
+
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,
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Toast, { align: toast == null ? void 0 : toast.align, children: toast == null ? void 0 : toast.message })
|
|
522
451
|
] }),
|
|
523
|
-
footer ? /* @__PURE__ */ (0,
|
|
452
|
+
footer ? /* @__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
|
|
524
453
|
]
|
|
525
454
|
}
|
|
526
455
|
) });
|
|
527
456
|
}
|
|
528
457
|
|
|
458
|
+
// src/core/icons.tsx
|
|
459
|
+
var import_classnames2 = __toESM(require("classnames"));
|
|
460
|
+
|
|
461
|
+
// src/assets/svg/icon-alert.svg
|
|
462
|
+
var icon_alert_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="2"></circle><path d="M12 7.5v5.5" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"></path><circle cx="12" cy="16.6" r="1.2" fill="currentColor" stroke="none"></circle></svg>\n';
|
|
463
|
+
|
|
464
|
+
// src/assets/svg/icon-check.svg
|
|
465
|
+
var icon_check_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M5 12.5l4.6 4.6L19 7.4" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"></path></svg>\n';
|
|
466
|
+
|
|
467
|
+
// src/assets/svg/icon-cross.svg
|
|
468
|
+
var icon_cross_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M6.5 6.5l11 11M17.5 6.5l-11 11" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"></path></svg>\n';
|
|
469
|
+
|
|
470
|
+
// src/assets/svg/icon-fullscreen.svg
|
|
471
|
+
var icon_fullscreen_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M4.6 9V4.6H9M15 4.6h4.4V9M19.4 15v4.4H15M9 19.4H4.6V15" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"></path></svg>\n';
|
|
472
|
+
|
|
473
|
+
// src/assets/svg/icon-keyboard.svg
|
|
474
|
+
var icon_keyboard_default = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><rect x="2.5" y="6" width="19" height="12" rx="3" stroke="currentColor" stroke-width="1.6"></rect><path d="M7 10h.01M10.5 10h.01M14 10h.01M17.5 10h.01M8 14h8" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path></svg>\n';
|
|
475
|
+
|
|
476
|
+
// src/assets/svg/icon-loop.svg
|
|
477
|
+
var icon_loop_default = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M5.4 10.4A6.6 6.6 0 0118 9.4M18.6 13.6A6.6 6.6 0 016 14.6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path><path d="M18.6 5.6v4h-4M5.4 18.4v-4h4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>\n';
|
|
478
|
+
|
|
479
|
+
// src/assets/svg/icon-mic.svg
|
|
480
|
+
var icon_mic_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><rect x="9" y="3.6" width="6" height="10" rx="3" stroke="currentColor" stroke-width="1.9"></rect><path d="M5.6 11.4a6.4 6.4 0 0012.8 0" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"></path><path d="M12 17.8V21M9 21h6" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"></path></svg>\n';
|
|
481
|
+
|
|
482
|
+
// src/assets/svg/icon-pause.svg
|
|
483
|
+
var icon_pause_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><rect x="7" y="5.5" width="3.6" height="13" rx="1.4" fill="currentColor"></rect><rect x="13.4" y="5.5" width="3.6" height="13" rx="1.4" fill="currentColor"></rect></svg>\n';
|
|
484
|
+
|
|
485
|
+
// src/assets/svg/icon-play.svg
|
|
486
|
+
var icon_play_default = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M8 5.4l10.2 6.6L8 18.6V5.4z" fill="currentColor" stroke="currentColor" stroke-width="0.6" stroke-linejoin="round"></path></svg>\n';
|
|
487
|
+
|
|
488
|
+
// src/assets/svg/icon-speaker.svg
|
|
489
|
+
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
|
+
|
|
491
|
+
// src/core/icons.tsx
|
|
492
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
493
|
+
function SvgIcon(_a) {
|
|
494
|
+
var _b = _a, {
|
|
495
|
+
source,
|
|
496
|
+
size,
|
|
497
|
+
className,
|
|
498
|
+
style
|
|
499
|
+
} = _b, rest = __objRest(_b, [
|
|
500
|
+
"source",
|
|
501
|
+
"size",
|
|
502
|
+
"className",
|
|
503
|
+
"style"
|
|
504
|
+
]);
|
|
505
|
+
const html = size ? source.replace("<svg", '<svg style="width:100%;height:100%"') : source;
|
|
506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
507
|
+
"span",
|
|
508
|
+
__spreadProps(__spreadValues({
|
|
509
|
+
className: (0, import_classnames2.default)("rqk-icon", className),
|
|
510
|
+
style: size ? __spreadValues({ width: size, height: size }, style) : style,
|
|
511
|
+
"aria-hidden": true
|
|
512
|
+
}, rest), {
|
|
513
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
514
|
+
})
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
function CheckIcon(props) {
|
|
518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_check_default }, props));
|
|
519
|
+
}
|
|
520
|
+
function CrossIcon(props) {
|
|
521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_cross_default }, props));
|
|
522
|
+
}
|
|
523
|
+
function AlertIcon(props) {
|
|
524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_alert_default }, props));
|
|
525
|
+
}
|
|
526
|
+
function PlayIcon(props) {
|
|
527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_play_default }, props));
|
|
528
|
+
}
|
|
529
|
+
function PauseIcon(props) {
|
|
530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_pause_default }, props));
|
|
531
|
+
}
|
|
532
|
+
function MicIcon(props) {
|
|
533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_mic_default }, props));
|
|
534
|
+
}
|
|
535
|
+
function SpeakerIcon(props) {
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_speaker_default }, props));
|
|
537
|
+
}
|
|
538
|
+
function LoopIcon(props) {
|
|
539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_loop_default }, props));
|
|
540
|
+
}
|
|
541
|
+
function FullscreenIcon(props) {
|
|
542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_fullscreen_default }, props));
|
|
543
|
+
}
|
|
544
|
+
function KeyboardIcon(props) {
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SvgIcon, __spreadValues({ source: icon_keyboard_default }, props));
|
|
546
|
+
}
|
|
547
|
+
|
|
529
548
|
// src/primitives/option-item.tsx
|
|
530
549
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
531
550
|
function OptionItem({
|
|
@@ -729,31 +748,114 @@ function SegmentedControl({
|
|
|
729
748
|
);
|
|
730
749
|
}
|
|
731
750
|
|
|
732
|
-
// src/
|
|
751
|
+
// src/core/quest-config.tsx
|
|
752
|
+
var import_react4 = require("react");
|
|
733
753
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
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
|
+
)) });
|
|
757
859
|
}
|
|
758
860
|
|
|
759
861
|
// src/questions/single-choice/actions.ts
|
|
@@ -762,16 +864,12 @@ function singleChoiceActions({
|
|
|
762
864
|
phase,
|
|
763
865
|
labels,
|
|
764
866
|
selected,
|
|
765
|
-
onPrev,
|
|
766
867
|
onNext,
|
|
767
868
|
onSubmit,
|
|
768
869
|
onRetry
|
|
769
870
|
}) {
|
|
770
871
|
const actions = [];
|
|
771
872
|
if (readonly) {
|
|
772
|
-
if (onPrev) {
|
|
773
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
774
|
-
}
|
|
775
873
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
776
874
|
} else if (phase === "correct" || phase === "locked") {
|
|
777
875
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -789,7 +887,7 @@ function singleChoiceActions({
|
|
|
789
887
|
}
|
|
790
888
|
|
|
791
889
|
// src/questions/single-choice/feedback.tsx
|
|
792
|
-
var
|
|
890
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
793
891
|
function SingleChoiceFeedback({
|
|
794
892
|
readonly,
|
|
795
893
|
phase,
|
|
@@ -798,7 +896,7 @@ function SingleChoiceFeedback({
|
|
|
798
896
|
answerLabel
|
|
799
897
|
}) {
|
|
800
898
|
if (readonly) {
|
|
801
|
-
return /* @__PURE__ */ (0,
|
|
899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
802
900
|
FeedbackSheet,
|
|
803
901
|
{
|
|
804
902
|
tone: "ok",
|
|
@@ -810,10 +908,10 @@ function SingleChoiceFeedback({
|
|
|
810
908
|
);
|
|
811
909
|
}
|
|
812
910
|
if (phase === "retry") {
|
|
813
|
-
return /* @__PURE__ */ (0,
|
|
911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FeedbackSheet, { tone: "bad", title: labels.wrongAnswer, detail: "\u518D\u68C0\u67E5\u4E00\u6B21\uFF0C\u8FD8\u6709\u4E00\u6B21\u673A\u4F1A" });
|
|
814
912
|
}
|
|
815
913
|
if (phase === "correct") {
|
|
816
|
-
return /* @__PURE__ */ (0,
|
|
914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
817
915
|
FeedbackSheet,
|
|
818
916
|
{
|
|
819
917
|
tone: "ok",
|
|
@@ -824,7 +922,7 @@ function SingleChoiceFeedback({
|
|
|
824
922
|
);
|
|
825
923
|
}
|
|
826
924
|
if (phase === "locked") {
|
|
827
|
-
return /* @__PURE__ */ (0,
|
|
925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
828
926
|
FeedbackSheet,
|
|
829
927
|
{
|
|
830
928
|
tone: "bad",
|
|
@@ -856,7 +954,7 @@ function matchesAny(value, answers) {
|
|
|
856
954
|
}
|
|
857
955
|
|
|
858
956
|
// src/questions/single-choice/option-list.tsx
|
|
859
|
-
var
|
|
957
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
860
958
|
function SingleChoiceOptions({
|
|
861
959
|
data,
|
|
862
960
|
canPick,
|
|
@@ -864,7 +962,7 @@ function SingleChoiceOptions({
|
|
|
864
962
|
onPick
|
|
865
963
|
}) {
|
|
866
964
|
const hasImages = data.options.some((option) => option.image);
|
|
867
|
-
return /* @__PURE__ */ (0,
|
|
965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: classNames("rqk-option-list", hasImages && "rqk-option-list-grid"), children: data.options.map((option, optionIndex) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
868
966
|
OptionItem,
|
|
869
967
|
{
|
|
870
968
|
label: optionLetter(optionIndex),
|
|
@@ -872,7 +970,7 @@ function SingleChoiceOptions({
|
|
|
872
970
|
state: stateOf(optionIndex),
|
|
873
971
|
layout: hasImages ? "grid" : "row",
|
|
874
972
|
disabled: !canPick,
|
|
875
|
-
media: option.image ? /* @__PURE__ */ (0,
|
|
973
|
+
media: option.image ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { className: "rqk-option-image", src: option.image, alt: "" }) : void 0,
|
|
876
974
|
audioIndicator: Boolean(option.audio || option.speak),
|
|
877
975
|
onClick: () => onPick(optionIndex),
|
|
878
976
|
children: option.text
|
|
@@ -882,9 +980,9 @@ function SingleChoiceOptions({
|
|
|
882
980
|
}
|
|
883
981
|
|
|
884
982
|
// src/primitives/card.tsx
|
|
885
|
-
var
|
|
983
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
886
984
|
function Card({ children, flush, tint, className }) {
|
|
887
|
-
return /* @__PURE__ */ (0,
|
|
985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
888
986
|
"div",
|
|
889
987
|
{
|
|
890
988
|
className: classNames(
|
|
@@ -899,10 +997,10 @@ function Card({ children, flush, tint, className }) {
|
|
|
899
997
|
}
|
|
900
998
|
|
|
901
999
|
// src/primitives/audio-bar.tsx
|
|
902
|
-
var
|
|
1000
|
+
var import_react6 = require("react");
|
|
903
1001
|
|
|
904
1002
|
// src/core/use-media-progress.ts
|
|
905
|
-
var
|
|
1003
|
+
var import_react5 = require("react");
|
|
906
1004
|
var TICK_MS = 100;
|
|
907
1005
|
function clamp(value, min, max) {
|
|
908
1006
|
return Math.min(max, Math.max(min, value));
|
|
@@ -919,21 +1017,21 @@ function useMediaProgress({
|
|
|
919
1017
|
threshold = 0.9,
|
|
920
1018
|
speed: initialSpeed = 1
|
|
921
1019
|
}) {
|
|
922
|
-
const [position, setPosition] = (0,
|
|
923
|
-
const [credited, setCredited] = (0,
|
|
924
|
-
const [playing, setPlaying] = (0,
|
|
925
|
-
const [finished, setFinished] = (0,
|
|
926
|
-
const [speed, setSpeedState] = (0,
|
|
927
|
-
const [loop, setLoopState] = (0,
|
|
928
|
-
const [timeOnTask, setTimeOnTask] = (0,
|
|
929
|
-
const mediaRef = (0,
|
|
930
|
-
const positionRef = (0,
|
|
931
|
-
const creditedRef = (0,
|
|
932
|
-
const lastTimeRef = (0,
|
|
933
|
-
const playingRef = (0,
|
|
934
|
-
const loopRef = (0,
|
|
935
|
-
const speedRef = (0,
|
|
936
|
-
const applyCredited = (0,
|
|
1020
|
+
const [position, setPosition] = (0, import_react5.useState)(0);
|
|
1021
|
+
const [credited, setCredited] = (0, import_react5.useState)(0);
|
|
1022
|
+
const [playing, setPlaying] = (0, import_react5.useState)(false);
|
|
1023
|
+
const [finished, setFinished] = (0, import_react5.useState)(false);
|
|
1024
|
+
const [speed, setSpeedState] = (0, import_react5.useState)(initialSpeed);
|
|
1025
|
+
const [loop, setLoopState] = (0, import_react5.useState)(false);
|
|
1026
|
+
const [timeOnTask, setTimeOnTask] = (0, import_react5.useState)(0);
|
|
1027
|
+
const mediaRef = (0, import_react5.useRef)(null);
|
|
1028
|
+
const positionRef = (0, import_react5.useRef)(0);
|
|
1029
|
+
const creditedRef = (0, import_react5.useRef)(0);
|
|
1030
|
+
const lastTimeRef = (0, import_react5.useRef)(0);
|
|
1031
|
+
const playingRef = (0, import_react5.useRef)(false);
|
|
1032
|
+
const loopRef = (0, import_react5.useRef)(false);
|
|
1033
|
+
const speedRef = (0, import_react5.useRef)(initialSpeed);
|
|
1034
|
+
const applyCredited = (0, import_react5.useCallback)(
|
|
937
1035
|
(next) => {
|
|
938
1036
|
const capped = clamp(next, 0, Math.max(duration, 0));
|
|
939
1037
|
creditedRef.current = capped;
|
|
@@ -941,7 +1039,7 @@ function useMediaProgress({
|
|
|
941
1039
|
},
|
|
942
1040
|
[duration]
|
|
943
1041
|
);
|
|
944
|
-
const applyPosition = (0,
|
|
1042
|
+
const applyPosition = (0, import_react5.useCallback)(
|
|
945
1043
|
(next) => {
|
|
946
1044
|
const capped = clamp(next, 0, Math.max(duration, 0));
|
|
947
1045
|
positionRef.current = capped;
|
|
@@ -950,7 +1048,7 @@ function useMediaProgress({
|
|
|
950
1048
|
},
|
|
951
1049
|
[duration]
|
|
952
1050
|
);
|
|
953
|
-
const play = (0,
|
|
1051
|
+
const play = (0, import_react5.useCallback)(() => {
|
|
954
1052
|
if (playingRef.current) return;
|
|
955
1053
|
if (positionRef.current >= duration) {
|
|
956
1054
|
applyPosition(0);
|
|
@@ -962,17 +1060,17 @@ function useMediaProgress({
|
|
|
962
1060
|
void mediaRef.current.play().catch(() => void 0);
|
|
963
1061
|
}
|
|
964
1062
|
}, [applyPosition, duration]);
|
|
965
|
-
const pause = (0,
|
|
1063
|
+
const pause = (0, import_react5.useCallback)(() => {
|
|
966
1064
|
if (!playingRef.current) return;
|
|
967
1065
|
playingRef.current = false;
|
|
968
1066
|
setPlaying(false);
|
|
969
1067
|
if (mediaRef.current) mediaRef.current.pause();
|
|
970
1068
|
}, []);
|
|
971
|
-
const toggle = (0,
|
|
1069
|
+
const toggle = (0, import_react5.useCallback)(() => {
|
|
972
1070
|
if (playingRef.current) pause();
|
|
973
1071
|
else play();
|
|
974
1072
|
}, [pause, play]);
|
|
975
|
-
const seek = (0,
|
|
1073
|
+
const seek = (0, import_react5.useCallback)(
|
|
976
1074
|
(seconds) => {
|
|
977
1075
|
applyPosition(seconds);
|
|
978
1076
|
if (seconds < duration) setFinished(false);
|
|
@@ -980,17 +1078,17 @@ function useMediaProgress({
|
|
|
980
1078
|
},
|
|
981
1079
|
[applyPosition, duration]
|
|
982
1080
|
);
|
|
983
|
-
const setSpeed = (0,
|
|
1081
|
+
const setSpeed = (0, import_react5.useCallback)((next) => {
|
|
984
1082
|
speedRef.current = next;
|
|
985
1083
|
setSpeedState(next);
|
|
986
1084
|
if (mediaRef.current) mediaRef.current.playbackRate = next;
|
|
987
1085
|
}, []);
|
|
988
|
-
const setLoop = (0,
|
|
1086
|
+
const setLoop = (0, import_react5.useCallback)((next) => {
|
|
989
1087
|
loopRef.current = next;
|
|
990
1088
|
setLoopState(next);
|
|
991
1089
|
if (mediaRef.current) mediaRef.current.loop = next;
|
|
992
1090
|
}, []);
|
|
993
|
-
const reset = (0,
|
|
1091
|
+
const reset = (0, import_react5.useCallback)(() => {
|
|
994
1092
|
playingRef.current = false;
|
|
995
1093
|
setPlaying(false);
|
|
996
1094
|
applyPosition(0);
|
|
@@ -1002,7 +1100,7 @@ function useMediaProgress({
|
|
|
1002
1100
|
mediaRef.current.currentTime = 0;
|
|
1003
1101
|
}
|
|
1004
1102
|
}, [applyCredited, applyPosition]);
|
|
1005
|
-
(0,
|
|
1103
|
+
(0, import_react5.useEffect)(() => {
|
|
1006
1104
|
if (src || !playing) return void 0;
|
|
1007
1105
|
const timer = window.setInterval(() => {
|
|
1008
1106
|
if (!playingRef.current) return;
|
|
@@ -1028,7 +1126,7 @@ function useMediaProgress({
|
|
|
1028
1126
|
}, TICK_MS);
|
|
1029
1127
|
return () => window.clearInterval(timer);
|
|
1030
1128
|
}, [applyCredited, applyPosition, duration, playing, src]);
|
|
1031
|
-
(0,
|
|
1129
|
+
(0, import_react5.useEffect)(() => {
|
|
1032
1130
|
const media = mediaRef.current;
|
|
1033
1131
|
if (!media || !src) return void 0;
|
|
1034
1132
|
media.playbackRate = speedRef.current;
|
|
@@ -1093,7 +1191,7 @@ function useMediaProgress({
|
|
|
1093
1191
|
}
|
|
1094
1192
|
|
|
1095
1193
|
// src/primitives/audio-bar.tsx
|
|
1096
|
-
var
|
|
1194
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1097
1195
|
var WAVE_BARS = [
|
|
1098
1196
|
10,
|
|
1099
1197
|
16,
|
|
@@ -1140,30 +1238,30 @@ function AudioBar({
|
|
|
1140
1238
|
compact,
|
|
1141
1239
|
className
|
|
1142
1240
|
}) {
|
|
1143
|
-
const audioRef = (0,
|
|
1144
|
-
const [internalPlaying, setInternalPlaying] = (0,
|
|
1145
|
-
const [position, setPosition] = (0,
|
|
1146
|
-
const [sourceDuration, setSourceDuration] = (0,
|
|
1241
|
+
const audioRef = (0, import_react6.useRef)(null);
|
|
1242
|
+
const [internalPlaying, setInternalPlaying] = (0, import_react6.useState)(false);
|
|
1243
|
+
const [position, setPosition] = (0, import_react6.useState)(0);
|
|
1244
|
+
const [sourceDuration, setSourceDuration] = (0, import_react6.useState)(null);
|
|
1147
1245
|
const isPlaying = playing != null ? playing : internalPlaying;
|
|
1148
1246
|
const setPlaying = (next) => {
|
|
1149
1247
|
if (playing === void 0) setInternalPlaying(next);
|
|
1150
1248
|
onPlayingChange == null ? void 0 : onPlayingChange(next);
|
|
1151
1249
|
};
|
|
1152
|
-
(0,
|
|
1250
|
+
(0, import_react6.useEffect)(() => {
|
|
1153
1251
|
if (src || !isPlaying) return void 0;
|
|
1154
1252
|
const timer = window.setInterval(() => {
|
|
1155
1253
|
setPosition((value) => value + 0.1);
|
|
1156
1254
|
}, 100);
|
|
1157
1255
|
return () => window.clearInterval(timer);
|
|
1158
1256
|
}, [isPlaying, src]);
|
|
1159
|
-
(0,
|
|
1257
|
+
(0, import_react6.useEffect)(() => {
|
|
1160
1258
|
if (src || !isPlaying) return;
|
|
1161
1259
|
if (position >= duration) {
|
|
1162
1260
|
setPlaying(false);
|
|
1163
1261
|
setPosition(0);
|
|
1164
1262
|
}
|
|
1165
1263
|
}, [duration, isPlaying, position, src]);
|
|
1166
|
-
(0,
|
|
1264
|
+
(0, import_react6.useEffect)(() => {
|
|
1167
1265
|
const audio = audioRef.current;
|
|
1168
1266
|
if (!audio || !src) return void 0;
|
|
1169
1267
|
const onTime = () => setPosition(audio.currentTime);
|
|
@@ -1209,7 +1307,7 @@ function AudioBar({
|
|
|
1209
1307
|
}
|
|
1210
1308
|
};
|
|
1211
1309
|
const total = src ? sourceDuration != null ? sourceDuration : duration : duration;
|
|
1212
|
-
return /* @__PURE__ */ (0,
|
|
1310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1213
1311
|
"div",
|
|
1214
1312
|
{
|
|
1215
1313
|
className: classNames(
|
|
@@ -1219,32 +1317,32 @@ function AudioBar({
|
|
|
1219
1317
|
className
|
|
1220
1318
|
),
|
|
1221
1319
|
children: [
|
|
1222
|
-
/* @__PURE__ */ (0,
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1223
1321
|
"button",
|
|
1224
1322
|
{
|
|
1225
1323
|
type: "button",
|
|
1226
1324
|
className: "rqk-audio-bar-play",
|
|
1227
1325
|
onClick: handleToggle,
|
|
1228
1326
|
"aria-label": isPlaying ? "\u6682\u505C" : "\u64AD\u653E",
|
|
1229
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
1327
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PauseIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PlayIcon, { size: 18 })
|
|
1230
1328
|
}
|
|
1231
1329
|
),
|
|
1232
|
-
/* @__PURE__ */ (0,
|
|
1233
|
-
label ? /* @__PURE__ */ (0,
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
1330
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "rqk-audio-bar-main", children: [
|
|
1331
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "rqk-audio-bar-label", children: label }) : null,
|
|
1332
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "rqk-audio-bar-wave", "aria-hidden": true, children: WAVE_BARS.map((height, barIndex) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { height: `${height}px` } }, barIndex)) })
|
|
1235
1333
|
] }),
|
|
1236
|
-
/* @__PURE__ */ (0,
|
|
1237
|
-
src ? /* @__PURE__ */ (0,
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "rqk-audio-bar-time", children: formatTime(isPlaying ? position : total) }),
|
|
1335
|
+
src ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("audio", { ref: audioRef, src, preload: "metadata" }) : null
|
|
1238
1336
|
]
|
|
1239
1337
|
}
|
|
1240
1338
|
);
|
|
1241
1339
|
}
|
|
1242
1340
|
|
|
1243
1341
|
// src/primitives/picture-box.tsx
|
|
1244
|
-
var
|
|
1342
|
+
var import_react8 = require("react");
|
|
1245
1343
|
|
|
1246
1344
|
// src/art/illustrations.tsx
|
|
1247
|
-
var
|
|
1345
|
+
var import_react7 = require("react");
|
|
1248
1346
|
|
|
1249
1347
|
// src/assets/svg/art-apple.svg
|
|
1250
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';
|
|
@@ -1277,7 +1375,7 @@ var art_speech_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1
|
|
|
1277
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';
|
|
1278
1376
|
|
|
1279
1377
|
// src/art/illustrations.tsx
|
|
1280
|
-
var
|
|
1378
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1281
1379
|
var ART_SOURCES = {
|
|
1282
1380
|
kid: art_kid_default,
|
|
1283
1381
|
balloon: art_balloon_default,
|
|
@@ -1292,12 +1390,12 @@ var ART_SOURCES = {
|
|
|
1292
1390
|
};
|
|
1293
1391
|
function Art({ name, className, size }) {
|
|
1294
1392
|
var _a;
|
|
1295
|
-
const unique = (0,
|
|
1393
|
+
const unique = (0, import_react7.useId)().replace(/[^a-zA-Z0-9]/g, "");
|
|
1296
1394
|
const source = ((_a = ART_SOURCES[name]) != null ? _a : art_speech_default).replace(
|
|
1297
1395
|
/rqk-grad/g,
|
|
1298
1396
|
`rqk-grad-${unique}`
|
|
1299
1397
|
);
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1301
1399
|
"span",
|
|
1302
1400
|
{
|
|
1303
1401
|
className: ["rqk-art", className].filter(Boolean).join(" "),
|
|
@@ -1309,7 +1407,7 @@ function Art({ name, className, size }) {
|
|
|
1309
1407
|
}
|
|
1310
1408
|
|
|
1311
1409
|
// src/primitives/picture-box.tsx
|
|
1312
|
-
var
|
|
1410
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1313
1411
|
function PictureBox({
|
|
1314
1412
|
src,
|
|
1315
1413
|
alt = "",
|
|
@@ -1320,14 +1418,14 @@ function PictureBox({
|
|
|
1320
1418
|
ratio = "4 / 3",
|
|
1321
1419
|
className
|
|
1322
1420
|
}) {
|
|
1323
|
-
const [failed, setFailed] = (0,
|
|
1324
|
-
const [loaded, setLoaded] = (0,
|
|
1325
|
-
(0,
|
|
1421
|
+
const [failed, setFailed] = (0, import_react8.useState)(false);
|
|
1422
|
+
const [loaded, setLoaded] = (0, import_react8.useState)(false);
|
|
1423
|
+
(0, import_react8.useEffect)(() => {
|
|
1326
1424
|
setFailed(false);
|
|
1327
1425
|
setLoaded(false);
|
|
1328
1426
|
}, [src]);
|
|
1329
1427
|
const resolved = state != null ? state : src ? failed ? "fail" : loaded ? "ok" : "loading" : "default";
|
|
1330
|
-
return /* @__PURE__ */ (0,
|
|
1428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1331
1429
|
"div",
|
|
1332
1430
|
{
|
|
1333
1431
|
className: classNames(
|
|
@@ -1338,7 +1436,7 @@ function PictureBox({
|
|
|
1338
1436
|
style: { aspectRatio: ratio },
|
|
1339
1437
|
"data-state": resolved,
|
|
1340
1438
|
children: [
|
|
1341
|
-
src && resolved !== "fail" ? /* @__PURE__ */ (0,
|
|
1439
|
+
src && resolved !== "fail" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1342
1440
|
"img",
|
|
1343
1441
|
{
|
|
1344
1442
|
src,
|
|
@@ -1347,9 +1445,9 @@ function PictureBox({
|
|
|
1347
1445
|
onError: () => setFailed(true)
|
|
1348
1446
|
}
|
|
1349
1447
|
) : null,
|
|
1350
|
-
resolved === "loading" ? /* @__PURE__ */ (0,
|
|
1351
|
-
resolved === "default" || resolved === "fail" ? /* @__PURE__ */ (0,
|
|
1352
|
-
resolved === "fail" ? /* @__PURE__ */ (0,
|
|
1448
|
+
resolved === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rqk-picture-skeleton", "aria-hidden": true }) : null,
|
|
1449
|
+
resolved === "default" || resolved === "fail" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rqk-picture-fallback", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Art, { name: art }) }) : null,
|
|
1450
|
+
resolved === "fail" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1353
1451
|
"button",
|
|
1354
1452
|
{
|
|
1355
1453
|
type: "button",
|
|
@@ -1358,98 +1456,25 @@ function PictureBox({
|
|
|
1358
1456
|
children: "\u91CD\u65B0\u52A0\u8F7D"
|
|
1359
1457
|
}
|
|
1360
1458
|
) : null,
|
|
1361
|
-
caption ? /* @__PURE__ */ (0,
|
|
1459
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rqk-picture-caption", children: caption }) : null
|
|
1362
1460
|
]
|
|
1363
1461
|
}
|
|
1364
1462
|
);
|
|
1365
1463
|
}
|
|
1366
1464
|
|
|
1367
1465
|
// src/questions/single-choice/stem-card.tsx
|
|
1368
|
-
var
|
|
1466
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1369
1467
|
function SingleChoiceStem({ data }) {
|
|
1370
|
-
return /* @__PURE__ */ (0,
|
|
1371
|
-
data.stemImage ? /* @__PURE__ */ (0,
|
|
1372
|
-
data.stemAudio ? /* @__PURE__ */ (0,
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Card, { className: "rqk-stem-card", children: [
|
|
1469
|
+
data.stemImage ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PictureBox, { src: data.stemImage, art: "books", ratio: "16 / 9", alt: "\u9898\u5E72\u914D\u56FE" }) : null,
|
|
1470
|
+
data.stemAudio ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AudioBar, { src: data.stemAudio }) : null,
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "rqk-stem", children: data.stem })
|
|
1374
1472
|
] });
|
|
1375
1473
|
}
|
|
1376
1474
|
|
|
1377
1475
|
// src/questions/single-choice/use-single-choice.tsx
|
|
1378
1476
|
var import_react9 = require("react");
|
|
1379
1477
|
|
|
1380
|
-
// src/core/quest-config.tsx
|
|
1381
|
-
var import_react8 = require("react");
|
|
1382
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1383
|
-
var defaultQuestLabels = {
|
|
1384
|
-
submit: "\u63D0\u4EA4\u7B54\u6848",
|
|
1385
|
-
submitCount: "\u63D0\u4EA4\u7B54\u6848",
|
|
1386
|
-
retry: "\u91CD\u8BD5\u4E00\u6B21",
|
|
1387
|
-
next: "\u5207\u9898",
|
|
1388
|
-
prev: "\u4E0A\u4E00\u9898",
|
|
1389
|
-
back: "\u8FD4\u56DE",
|
|
1390
|
-
answer: "\u6B63\u786E\u7B54\u6848",
|
|
1391
|
-
analysis: "\u89E3\u6790",
|
|
1392
|
-
correctAll: "\u5168\u90E8\u7B54\u5BF9",
|
|
1393
|
-
wrongAnswer: "\u7B54\u6848\u8FD8\u4E0D\u6B63\u786E",
|
|
1394
|
-
tapToRead: "\u70B9\u51FB\u6717\u8BFB",
|
|
1395
|
-
readAloud: "\u8303\u8BFB",
|
|
1396
|
-
recording: "\u5F55\u97F3\u4E2D",
|
|
1397
|
-
scoring: "\u8BC4\u5206\u4E2D",
|
|
1398
|
-
releaseToSend: "\u677E\u624B\u5373\u63D0\u4EA4",
|
|
1399
|
-
holdToRecord: "\u6309\u4F4F\u5F00\u59CB\u5F55\u97F3",
|
|
1400
|
-
tapToFollow: "\u70B9\u51FB\u8DDF\u8BFB",
|
|
1401
|
-
recordingHint: "\u6B63\u5728\u5F55\u97F3 \xB7 \u677E\u624B\u7ED3\u675F",
|
|
1402
|
-
rescore: "\u91CD\u65B0\u5F55\u97F3",
|
|
1403
|
-
submitted: "\u5DF2\u63D0\u4EA4 \xB7 \u53EF\u91CD\u5F55",
|
|
1404
|
-
noiseHint: "\u97F3\u8D28\u4E0D\u5408\u683C\uFF1A\u4E0D\u51FA\u5206\uFF0C\u8BF7\u6362\u5B89\u9759\u73AF\u5883\u91CD\u8BD5",
|
|
1405
|
-
againHint: "\u672A\u83B7\u53D6\u5206\u6570\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21",
|
|
1406
|
-
attemptsLeft: "\u8FD8\u6709 {n} \u6B21\u5F55\u97F3\u673A\u4F1A",
|
|
1407
|
-
attemptsUsedUp: "\u673A\u4F1A\u5DF2\u7528\u5B8C",
|
|
1408
|
-
play: "\u64AD\u653E",
|
|
1409
|
-
pause: "\u6682\u505C",
|
|
1410
|
-
replay: "\u518D\u542C\u4E00\u904D",
|
|
1411
|
-
loop: "\u5FAA\u73AF",
|
|
1412
|
-
speed: "\u500D\u901F",
|
|
1413
|
-
finish: "\u5B8C\u6210\u5E76\u8FD4\u56DE",
|
|
1414
|
-
submitAndStats: "\u63D0\u4EA4\u5E76\u67E5\u770B\u7EDF\u8BA1",
|
|
1415
|
-
effectivePlay: "\u6709\u6548\u64AD\u653E",
|
|
1416
|
-
totalTime: "\u603B\u65F6\u957F",
|
|
1417
|
-
reading: "\u9605\u8BFB",
|
|
1418
|
-
expand: "\u5C55\u5F00\u5168\u6587",
|
|
1419
|
-
collapse: "\u6536\u8D77",
|
|
1420
|
-
notAnswered: "\u672A\u4F5C\u7B54",
|
|
1421
|
-
fullscreen: "\u5168\u5C4F"
|
|
1422
|
-
};
|
|
1423
|
-
var QuestConfigContext = (0, import_react8.createContext)({});
|
|
1424
|
-
function QuestConfigProvider({
|
|
1425
|
-
config,
|
|
1426
|
-
children
|
|
1427
|
-
}) {
|
|
1428
|
-
const parent = (0, import_react8.useContext)(QuestConfigContext);
|
|
1429
|
-
const value = (0, import_react8.useMemo)(
|
|
1430
|
-
() => {
|
|
1431
|
-
var _a, _b;
|
|
1432
|
-
return {
|
|
1433
|
-
sound: (_a = config == null ? void 0 : config.sound) != null ? _a : parent.sound,
|
|
1434
|
-
speakText: (_b = config == null ? void 0 : config.speakText) != null ? _b : parent.speakText,
|
|
1435
|
-
labels: __spreadValues(__spreadValues({}, parent.labels), config == null ? void 0 : config.labels)
|
|
1436
|
-
};
|
|
1437
|
-
},
|
|
1438
|
-
[config, parent]
|
|
1439
|
-
);
|
|
1440
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(QuestConfigContext.Provider, { value, children });
|
|
1441
|
-
}
|
|
1442
|
-
function useQuestConfig() {
|
|
1443
|
-
return (0, import_react8.useContext)(QuestConfigContext);
|
|
1444
|
-
}
|
|
1445
|
-
function useQuestLabels(override) {
|
|
1446
|
-
const config = useQuestConfig();
|
|
1447
|
-
return (0, import_react8.useMemo)(
|
|
1448
|
-
() => __spreadValues(__spreadValues(__spreadValues({}, defaultQuestLabels), config.labels), override),
|
|
1449
|
-
[config.labels, override]
|
|
1450
|
-
);
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
1478
|
// src/core/speech.ts
|
|
1454
1479
|
var speakWithSynthesis = (text, opts) => {
|
|
1455
1480
|
if (typeof window === "undefined" || !window.speechSynthesis) {
|
|
@@ -1578,7 +1603,6 @@ function SingleChoice({
|
|
|
1578
1603
|
onNext,
|
|
1579
1604
|
onSubmit,
|
|
1580
1605
|
sound,
|
|
1581
|
-
frame,
|
|
1582
1606
|
demoAttempt,
|
|
1583
1607
|
className
|
|
1584
1608
|
}) {
|
|
@@ -1588,7 +1612,6 @@ function SingleChoice({
|
|
|
1588
1612
|
phase: model.judge.phase,
|
|
1589
1613
|
labels: model.labels,
|
|
1590
1614
|
selected: model.selected,
|
|
1591
|
-
onPrev,
|
|
1592
1615
|
onNext,
|
|
1593
1616
|
onSubmit: model.handleSubmit,
|
|
1594
1617
|
onRetry: model.judge.retry
|
|
@@ -1602,7 +1625,6 @@ function SingleChoice({
|
|
|
1602
1625
|
total,
|
|
1603
1626
|
instruction,
|
|
1604
1627
|
onBack,
|
|
1605
|
-
frame,
|
|
1606
1628
|
className: classNames("rqk-quest", className),
|
|
1607
1629
|
dataQuest: "single-choice",
|
|
1608
1630
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -1615,8 +1637,8 @@ function SingleChoice({
|
|
|
1615
1637
|
answerLabel: model.answerLabel
|
|
1616
1638
|
}
|
|
1617
1639
|
),
|
|
1618
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar, { actions }),
|
|
1619
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1640
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar, { actions, index, onPrev }),
|
|
1641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
1620
1642
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SingleChoiceStem, { data }),
|
|
1621
1643
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1622
1644
|
SingleChoiceOptions,
|
|
@@ -1683,7 +1705,7 @@ function recordState(stage) {
|
|
|
1683
1705
|
}
|
|
1684
1706
|
function followArt(data) {
|
|
1685
1707
|
var _a;
|
|
1686
|
-
return (_a = data.art) != null ? _a : data.kind === "
|
|
1708
|
+
return (_a = data.art) != null ? _a : data.kind === "sentence" ? "speech" : null;
|
|
1687
1709
|
}
|
|
1688
1710
|
|
|
1689
1711
|
// src/questions/follow-read/follow-content.tsx
|
|
@@ -1697,12 +1719,57 @@ function FollowContent({
|
|
|
1697
1719
|
startBadgeVisible
|
|
1698
1720
|
}) {
|
|
1699
1721
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1700
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rqk-follow-card flex flex-col gap-3", children: [
|
|
1701
1723
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rqk-follow-stage", children: [
|
|
1702
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Art, { name: art, className: "rqk-follow-art" }),
|
|
1724
|
+
art ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Art, { name: art, className: "rqk-follow-art" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "rqk-follow-no-image", role: "img", "aria-label": "No image", children: [
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1726
|
+
"svg",
|
|
1727
|
+
{
|
|
1728
|
+
className: "rqk-follow-no-image-icon",
|
|
1729
|
+
viewBox: "0 0 48 48",
|
|
1730
|
+
fill: "none",
|
|
1731
|
+
"aria-hidden": true,
|
|
1732
|
+
children: [
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1734
|
+
"rect",
|
|
1735
|
+
{
|
|
1736
|
+
x: "7",
|
|
1737
|
+
y: "10",
|
|
1738
|
+
width: "34",
|
|
1739
|
+
height: "28",
|
|
1740
|
+
rx: "4",
|
|
1741
|
+
stroke: "currentColor",
|
|
1742
|
+
strokeWidth: "2"
|
|
1743
|
+
}
|
|
1744
|
+
),
|
|
1745
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "17", cy: "19", r: "3", fill: "currentColor", opacity: "0.45" }),
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1747
|
+
"path",
|
|
1748
|
+
{
|
|
1749
|
+
d: "M10 34l9-9 7 7 6-6 8 8",
|
|
1750
|
+
stroke: "currentColor",
|
|
1751
|
+
strokeWidth: "2",
|
|
1752
|
+
strokeLinecap: "round",
|
|
1753
|
+
strokeLinejoin: "round"
|
|
1754
|
+
}
|
|
1755
|
+
),
|
|
1756
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1757
|
+
"path",
|
|
1758
|
+
{
|
|
1759
|
+
d: "M11 8l27 32",
|
|
1760
|
+
stroke: "currentColor",
|
|
1761
|
+
strokeWidth: "3",
|
|
1762
|
+
strokeLinecap: "round"
|
|
1763
|
+
}
|
|
1764
|
+
)
|
|
1765
|
+
]
|
|
1766
|
+
}
|
|
1767
|
+
),
|
|
1768
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "rqk-follow-no-image-text", children: "No image" })
|
|
1769
|
+
] }),
|
|
1703
1770
|
startBadgeVisible ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "rqk-follow-start", children: "\u51C6\u5907\u5F00\u59CB\u8DDF\u8BFB" }) : null
|
|
1704
1771
|
] }),
|
|
1705
|
-
data.kind === "word" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1772
|
+
data.kind === "word" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Card, { className: "rqk-follow-word", children: [
|
|
1706
1773
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "rqk-follow-word-text", children: (_a = data.word) == null ? void 0 : _a.text }),
|
|
1707
1774
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rqk-follow-word-meta", children: [
|
|
1708
1775
|
((_b = data.word) == null ? void 0 : _b.phonetic) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "rqk-follow-phonetic", children: data.word.phonetic }) : null,
|
|
@@ -1751,6 +1818,7 @@ function FollowContent({
|
|
|
1751
1818
|
}
|
|
1752
1819
|
|
|
1753
1820
|
// src/primitives/celebration.tsx
|
|
1821
|
+
var import_react10 = require("react");
|
|
1754
1822
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1755
1823
|
var CONFETTI_COLORS = [
|
|
1756
1824
|
"var(--rqk-gold)",
|
|
@@ -1767,9 +1835,25 @@ var GRADE_CONFIG = {
|
|
|
1767
1835
|
nobad: { title: "Not bad", stars: 1, ribbon: "\u7EE7\u7EED\u52A0\u6CB9" },
|
|
1768
1836
|
again: { title: "Try again", stars: 0, ribbon: "\u518D\u6765\u4E00\u6B21" }
|
|
1769
1837
|
};
|
|
1770
|
-
function Celebration({
|
|
1838
|
+
function Celebration({
|
|
1839
|
+
grade,
|
|
1840
|
+
title,
|
|
1841
|
+
ribbon,
|
|
1842
|
+
note,
|
|
1843
|
+
confetti,
|
|
1844
|
+
autoHideMs,
|
|
1845
|
+
className
|
|
1846
|
+
}) {
|
|
1771
1847
|
const config = GRADE_CONFIG[grade];
|
|
1772
1848
|
const withConfetti = confetti != null ? confetti : grade === "perfect" || grade === "great";
|
|
1849
|
+
const [hidden, setHidden] = (0, import_react10.useState)(false);
|
|
1850
|
+
(0, import_react10.useEffect)(() => {
|
|
1851
|
+
setHidden(false);
|
|
1852
|
+
if (!autoHideMs) return;
|
|
1853
|
+
const timer = window.setTimeout(() => setHidden(true), autoHideMs);
|
|
1854
|
+
return () => window.clearTimeout(timer);
|
|
1855
|
+
}, [autoHideMs, grade]);
|
|
1856
|
+
if (hidden) return null;
|
|
1773
1857
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: classNames("rqk-celebrate", className), "data-grade": grade, role: "status", children: [
|
|
1774
1858
|
withConfetti ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "rqk-confetti", "aria-hidden": true, children: Array.from({ length: CONFETTI_COUNT }).map((_, index) => {
|
|
1775
1859
|
const x = 4 + index * 37 % 93;
|
|
@@ -1805,7 +1889,7 @@ function Celebration({ grade, title, ribbon, note, confetti, className }) {
|
|
|
1805
1889
|
}
|
|
1806
1890
|
|
|
1807
1891
|
// src/primitives/record-cluster.tsx
|
|
1808
|
-
var
|
|
1892
|
+
var import_react11 = require("react");
|
|
1809
1893
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1810
1894
|
function formatClock(value) {
|
|
1811
1895
|
const total = Math.max(0, Math.floor(value));
|
|
@@ -1827,10 +1911,10 @@ function RecordCluster({
|
|
|
1827
1911
|
className
|
|
1828
1912
|
}) {
|
|
1829
1913
|
const toast = useQuestToast();
|
|
1830
|
-
const [activeSide, setActiveSide] = (0,
|
|
1831
|
-
const activeTimer = (0,
|
|
1832
|
-
const activeToken = (0,
|
|
1833
|
-
(0,
|
|
1914
|
+
const [activeSide, setActiveSide] = (0, import_react11.useState)(null);
|
|
1915
|
+
const activeTimer = (0, import_react11.useRef)(void 0);
|
|
1916
|
+
const activeToken = (0, import_react11.useRef)(0);
|
|
1917
|
+
(0, import_react11.useEffect)(
|
|
1834
1918
|
() => () => {
|
|
1835
1919
|
if (activeTimer.current) window.clearTimeout(activeTimer.current);
|
|
1836
1920
|
},
|
|
@@ -1863,26 +1947,13 @@ function RecordCluster({
|
|
|
1863
1947
|
if (!recording) return;
|
|
1864
1948
|
onRecordEnd == null ? void 0 : onRecordEnd();
|
|
1865
1949
|
};
|
|
1866
|
-
const
|
|
1867
|
-
if (
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
}
|
|
1871
|
-
};
|
|
1872
|
-
const handleKeyUp = (event) => {
|
|
1873
|
-
if (event.code === "Space") {
|
|
1874
|
-
event.preventDefault();
|
|
1875
|
-
end();
|
|
1876
|
-
}
|
|
1950
|
+
const toggle = () => {
|
|
1951
|
+
if (disabled || scoring) return;
|
|
1952
|
+
if (recording) end();
|
|
1953
|
+
else start();
|
|
1877
1954
|
};
|
|
1878
|
-
const statusText = hint != null ? hint : recording ? "\u6B63\u5728\u5F55\u97F3 \xB7 \
|
|
1955
|
+
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";
|
|
1879
1956
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: classNames("rqk-record-cluster", className), children: [
|
|
1880
|
-
recording ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "rqk-record-timer", "aria-live": "polite", children: [
|
|
1881
|
-
formatClock(seconds),
|
|
1882
|
-
" / ",
|
|
1883
|
-
formatClock(maxSeconds)
|
|
1884
|
-
] }) : null,
|
|
1885
|
-
recording ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rqk-record-wave", "aria-hidden": true, children: Array.from({ length: 8 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { animationDelay: `${index * 0.12}s` } }, index)) }) : null,
|
|
1886
1957
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "rqk-record-row", children: [
|
|
1887
1958
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1888
1959
|
"button",
|
|
@@ -1902,20 +1973,27 @@ function RecordCluster({
|
|
|
1902
1973
|
}
|
|
1903
1974
|
),
|
|
1904
1975
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "rqk-record-main", children: [
|
|
1905
|
-
recording ? /* @__PURE__ */ (0, import_jsx_runtime23.
|
|
1976
|
+
recording ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { className: "rqk-record-ring", viewBox: "0 0 100 100", "aria-hidden": true, children: [
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1978
|
+
"circle",
|
|
1979
|
+
{
|
|
1980
|
+
className: "rqk-record-ring-track",
|
|
1981
|
+
cx: "50",
|
|
1982
|
+
cy: "50",
|
|
1983
|
+
r: "45",
|
|
1984
|
+
strokeDasharray: "283"
|
|
1985
|
+
}
|
|
1986
|
+
),
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "50", cy: "50", r: "45", strokeDasharray: "283", strokeDashoffset: ringOffset })
|
|
1988
|
+
] }) : null,
|
|
1906
1989
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1907
1990
|
"button",
|
|
1908
1991
|
{
|
|
1909
1992
|
type: "button",
|
|
1910
1993
|
className: classNames("rqk-record", recording && "rqk-is-recording"),
|
|
1911
|
-
|
|
1912
|
-
onPointerUp: end,
|
|
1913
|
-
onPointerLeave: end,
|
|
1914
|
-
onPointerCancel: end,
|
|
1915
|
-
onKeyDown: handleKeyDown,
|
|
1916
|
-
onKeyUp: handleKeyUp,
|
|
1994
|
+
onClick: toggle,
|
|
1917
1995
|
disabled: disabled || scoring,
|
|
1918
|
-
"aria-label": recording ? "\
|
|
1996
|
+
"aria-label": recording ? "\u7ED3\u675F\u5F55\u97F3" : "\u5F00\u59CB\u5F55\u97F3",
|
|
1919
1997
|
"aria-pressed": recording,
|
|
1920
1998
|
children: recording ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "rqk-record-stop", "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MicIcon, { size: 30 })
|
|
1921
1999
|
}
|
|
@@ -1939,11 +2017,21 @@ function RecordCluster({
|
|
|
1939
2017
|
}
|
|
1940
2018
|
)
|
|
1941
2019
|
] }),
|
|
1942
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.
|
|
2020
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1943
2021
|
"div",
|
|
1944
2022
|
{
|
|
1945
2023
|
className: classNames("rqk-record-status", hintTone !== "default" && `rqk-is-${hintTone}`),
|
|
1946
|
-
children:
|
|
2024
|
+
children: [
|
|
2025
|
+
recording ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
2026
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "rqk-record-status-timer", children: [
|
|
2027
|
+
formatClock(seconds),
|
|
2028
|
+
" / ",
|
|
2029
|
+
formatClock(maxSeconds)
|
|
2030
|
+
] }),
|
|
2031
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "rqk-record-status-sep", "aria-hidden": true, children: "\xB7" })
|
|
2032
|
+
] }) : null,
|
|
2033
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: statusText })
|
|
2034
|
+
]
|
|
1947
2035
|
}
|
|
1948
2036
|
),
|
|
1949
2037
|
detail ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: classNames("rqk-record-detail", detailTone === "bad" && "rqk-is-bad"), children: detail }) : null
|
|
@@ -1972,7 +2060,7 @@ function FollowControls({
|
|
|
1972
2060
|
}) {
|
|
1973
2061
|
const gradeValue = grade && grade !== "noise" ? grade : "again";
|
|
1974
2062
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rqk-follow-bottom", children: [
|
|
1975
|
-
grade && grade !== "noise" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Celebration, { grade: gradeValue, ribbon }) : null,
|
|
2063
|
+
grade && grade !== "noise" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Celebration, { grade: gradeValue, ribbon, autoHideMs: 3200 }) : null,
|
|
1976
2064
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1977
2065
|
RecordCluster,
|
|
1978
2066
|
{
|
|
@@ -2021,22 +2109,22 @@ function detailHint({
|
|
|
2021
2109
|
}
|
|
2022
2110
|
|
|
2023
2111
|
// src/questions/follow-read/toast.tsx
|
|
2024
|
-
var
|
|
2112
|
+
var import_react12 = require("react");
|
|
2025
2113
|
function FollowReadToast({ message }) {
|
|
2026
2114
|
const { show } = useQuestToast();
|
|
2027
|
-
(0,
|
|
2115
|
+
(0, import_react12.useEffect)(() => {
|
|
2028
2116
|
show(message);
|
|
2029
2117
|
}, [message, show]);
|
|
2030
2118
|
return null;
|
|
2031
2119
|
}
|
|
2032
2120
|
|
|
2033
2121
|
// src/questions/follow-read/use-follow-read.ts
|
|
2034
|
-
var
|
|
2122
|
+
var import_react14 = require("react");
|
|
2035
2123
|
|
|
2036
2124
|
// src/questions/follow-read/use-follow-recorder.ts
|
|
2037
2125
|
var import_audio_recorder_kit = require("@jswork/audio-recorder-kit");
|
|
2038
2126
|
var import_howler_audio_manager2 = require("@jswork/howler-audio-manager");
|
|
2039
|
-
var
|
|
2127
|
+
var import_react13 = require("react");
|
|
2040
2128
|
function useFollowRecorder({
|
|
2041
2129
|
data,
|
|
2042
2130
|
maxSeconds,
|
|
@@ -2045,13 +2133,13 @@ function useFollowRecorder({
|
|
|
2045
2133
|
onRecordingChange
|
|
2046
2134
|
}) {
|
|
2047
2135
|
const config = useQuestConfig();
|
|
2048
|
-
const [seconds, setSeconds] = (0,
|
|
2049
|
-
const [recordedUrl, setRecordedUrl] = (0,
|
|
2050
|
-
const timerRef = (0,
|
|
2051
|
-
const recorderRef = (0,
|
|
2052
|
-
const audioManagerRef = (0,
|
|
2053
|
-
const recordedUrlRef = (0,
|
|
2054
|
-
const finishRef = (0,
|
|
2136
|
+
const [seconds, setSeconds] = (0, import_react13.useState)(0);
|
|
2137
|
+
const [recordedUrl, setRecordedUrl] = (0, import_react13.useState)(null);
|
|
2138
|
+
const timerRef = (0, import_react13.useRef)(null);
|
|
2139
|
+
const recorderRef = (0, import_react13.useRef)(null);
|
|
2140
|
+
const audioManagerRef = (0, import_react13.useRef)(null);
|
|
2141
|
+
const recordedUrlRef = (0, import_react13.useRef)(null);
|
|
2142
|
+
const finishRef = (0, import_react13.useRef)(() => void 0);
|
|
2055
2143
|
const isRecordingStage = () => stageRef.current === "recording";
|
|
2056
2144
|
const stopTimer = () => {
|
|
2057
2145
|
if (timerRef.current) {
|
|
@@ -2145,7 +2233,7 @@ function useFollowRecorder({
|
|
|
2145
2233
|
void ((_d = config.speakText) != null ? _d : speakWithSynthesis)(data.sentence.words.join(" "));
|
|
2146
2234
|
}
|
|
2147
2235
|
};
|
|
2148
|
-
(0,
|
|
2236
|
+
(0, import_react13.useEffect)(() => {
|
|
2149
2237
|
return () => {
|
|
2150
2238
|
var _a, _b;
|
|
2151
2239
|
if (timerRef.current) window.clearInterval(timerRef.current);
|
|
@@ -2185,11 +2273,11 @@ function useFollowRead({
|
|
|
2185
2273
|
const presetGrade = preset === "noise" ? "noise" : preset === "limit" ? "great" : preset === "perfect" || preset === "great" || preset === "nobad" || preset === "again" ? preset : null;
|
|
2186
2274
|
const initialStage = presetGrade ? "result" : "ready";
|
|
2187
2275
|
const initialAttempts = preset === "limit" ? maxAttempts : presetGrade && preset !== "again" ? 1 : 0;
|
|
2188
|
-
const [stage, setStageState] = (0,
|
|
2189
|
-
const [attemptsUsed, setAttemptsUsed] = (0,
|
|
2190
|
-
const [grade, setGrade] = (0,
|
|
2191
|
-
const [noise, setNoise] = (0,
|
|
2192
|
-
const stageRef = (0,
|
|
2276
|
+
const [stage, setStageState] = (0, import_react14.useState)(initialStage);
|
|
2277
|
+
const [attemptsUsed, setAttemptsUsed] = (0, import_react14.useState)(initialAttempts);
|
|
2278
|
+
const [grade, setGrade] = (0, import_react14.useState)(presetGrade);
|
|
2279
|
+
const [noise, setNoise] = (0, import_react14.useState)(preset === "noise");
|
|
2280
|
+
const stageRef = (0, import_react14.useRef)(initialStage);
|
|
2193
2281
|
const text = data.kind === "word" ? (_d = (_c = data.word) == null ? void 0 : _c.text) != null ? _d : "" : (_f = (_e = data.sentence) == null ? void 0 : _e.words.join(" ")) != null ? _f : "";
|
|
2194
2282
|
const goStage = (next) => {
|
|
2195
2283
|
stageRef.current = next;
|
|
@@ -2278,10 +2366,10 @@ function FollowRead({
|
|
|
2278
2366
|
title,
|
|
2279
2367
|
instruction,
|
|
2280
2368
|
onBack,
|
|
2369
|
+
onPrev,
|
|
2281
2370
|
onNext,
|
|
2282
2371
|
onSubmit,
|
|
2283
2372
|
sound,
|
|
2284
|
-
frame,
|
|
2285
2373
|
className,
|
|
2286
2374
|
demoState,
|
|
2287
2375
|
onScore,
|
|
@@ -2323,6 +2411,8 @@ function FollowRead({
|
|
|
2323
2411
|
maxAttempts: model.maxAttempts,
|
|
2324
2412
|
labels: model.labels
|
|
2325
2413
|
});
|
|
2414
|
+
const hasPrev = index > 1 && Boolean(onPrev);
|
|
2415
|
+
const hasFooter = actions.length > 0 || hasPrev;
|
|
2326
2416
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2327
2417
|
QuestShell,
|
|
2328
2418
|
{
|
|
@@ -2331,18 +2421,17 @@ function FollowRead({
|
|
|
2331
2421
|
index,
|
|
2332
2422
|
total,
|
|
2333
2423
|
onBack,
|
|
2334
|
-
frame,
|
|
2335
2424
|
className: classNames(
|
|
2336
2425
|
"rqk-quest",
|
|
2337
2426
|
"rqk-follow",
|
|
2338
2427
|
`rqk-stage-${model.stage}`,
|
|
2339
|
-
|
|
2428
|
+
hasFooter && "rqk-has-footer",
|
|
2340
2429
|
className
|
|
2341
2430
|
),
|
|
2342
2431
|
dataQuest: "follow-read",
|
|
2343
|
-
footer:
|
|
2432
|
+
footer: hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ActionBar, { actions, index, onPrev }) : void 0,
|
|
2344
2433
|
children: [
|
|
2345
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2346
2435
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rqk-follow-instr", children: instructionText }),
|
|
2347
2436
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2348
2437
|
FollowContent,
|
|
@@ -2391,16 +2480,12 @@ function linkMatchActions({
|
|
|
2391
2480
|
complete,
|
|
2392
2481
|
pairCount,
|
|
2393
2482
|
totalPairs,
|
|
2394
|
-
onPrev,
|
|
2395
2483
|
onNext,
|
|
2396
2484
|
onSubmit,
|
|
2397
2485
|
onRetry
|
|
2398
2486
|
}) {
|
|
2399
2487
|
const actions = [];
|
|
2400
2488
|
if (readonly) {
|
|
2401
|
-
if (onPrev) {
|
|
2402
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
2403
|
-
}
|
|
2404
2489
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
2405
2490
|
} else if (phase === "correct" || phase === "locked") {
|
|
2406
2491
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -2648,11 +2733,11 @@ function LinkBoard({
|
|
|
2648
2733
|
}
|
|
2649
2734
|
|
|
2650
2735
|
// src/questions/link-match/use-link-audio.ts
|
|
2651
|
-
var
|
|
2736
|
+
var import_react15 = require("react");
|
|
2652
2737
|
function useLinkAudio(data) {
|
|
2653
2738
|
const config = useQuestConfig();
|
|
2654
|
-
const [playing, setPlaying] = (0,
|
|
2655
|
-
const audioRef = (0,
|
|
2739
|
+
const [playing, setPlaying] = (0, import_react15.useState)(null);
|
|
2740
|
+
const audioRef = (0, import_react15.useRef)(null);
|
|
2656
2741
|
const speakNode = (side, nodeIndex) => {
|
|
2657
2742
|
var _a, _b, _c;
|
|
2658
2743
|
const node = (side === "left" ? data.left : data.right)[nodeIndex];
|
|
@@ -2692,7 +2777,7 @@ function useLinkAudio(data) {
|
|
|
2692
2777
|
}
|
|
2693
2778
|
}
|
|
2694
2779
|
};
|
|
2695
|
-
(0,
|
|
2780
|
+
(0, import_react15.useEffect)(
|
|
2696
2781
|
() => () => {
|
|
2697
2782
|
var _a;
|
|
2698
2783
|
(_a = audioRef.current) == null ? void 0 : _a.pause();
|
|
@@ -2704,23 +2789,23 @@ function useLinkAudio(data) {
|
|
|
2704
2789
|
}
|
|
2705
2790
|
|
|
2706
2791
|
// src/questions/link-match/use-link-geometry.ts
|
|
2707
|
-
var
|
|
2792
|
+
var import_react16 = require("react");
|
|
2708
2793
|
function useLinkGeometry({
|
|
2709
2794
|
data,
|
|
2710
2795
|
phase,
|
|
2711
2796
|
readonly,
|
|
2712
2797
|
pairs
|
|
2713
2798
|
}) {
|
|
2714
|
-
const [paths, setPaths] = (0,
|
|
2715
|
-
const [size, setSize] = (0,
|
|
2716
|
-
const boardRef = (0,
|
|
2717
|
-
const leftRefs = (0,
|
|
2718
|
-
const rightRefs = (0,
|
|
2719
|
-
const expected = (0,
|
|
2799
|
+
const [paths, setPaths] = (0, import_react16.useState)([]);
|
|
2800
|
+
const [size, setSize] = (0, import_react16.useState)({ width: 0, height: 0 });
|
|
2801
|
+
const boardRef = (0, import_react16.useRef)(null);
|
|
2802
|
+
const leftRefs = (0, import_react16.useRef)([]);
|
|
2803
|
+
const rightRefs = (0, import_react16.useRef)([]);
|
|
2804
|
+
const expected = (0, import_react16.useMemo)(
|
|
2720
2805
|
() => new Set(data.pairs.map(([left, right]) => pairKey(left, right))),
|
|
2721
2806
|
[data.pairs]
|
|
2722
2807
|
);
|
|
2723
|
-
const measure = (0,
|
|
2808
|
+
const measure = (0, import_react16.useCallback)(() => {
|
|
2724
2809
|
const board = boardRef.current;
|
|
2725
2810
|
if (!board) return;
|
|
2726
2811
|
const rect = board.getBoundingClientRect();
|
|
@@ -2751,10 +2836,10 @@ function useLinkGeometry({
|
|
|
2751
2836
|
setSize({ width: layoutWidth, height: layoutHeight });
|
|
2752
2837
|
setPaths(next);
|
|
2753
2838
|
}, [data.pairs, expected, pairs, readonly, phase]);
|
|
2754
|
-
(0,
|
|
2839
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
2755
2840
|
measure();
|
|
2756
2841
|
}, [measure]);
|
|
2757
|
-
(0,
|
|
2842
|
+
(0, import_react16.useEffect)(() => {
|
|
2758
2843
|
var _a, _b;
|
|
2759
2844
|
const board = boardRef.current;
|
|
2760
2845
|
if (!board || typeof ResizeObserver === "undefined") return void 0;
|
|
@@ -2771,7 +2856,7 @@ function useLinkGeometry({
|
|
|
2771
2856
|
}
|
|
2772
2857
|
|
|
2773
2858
|
// src/questions/link-match/use-link-pairs.ts
|
|
2774
|
-
var
|
|
2859
|
+
var import_react17 = require("react");
|
|
2775
2860
|
function useLinkPairs({
|
|
2776
2861
|
data,
|
|
2777
2862
|
mode,
|
|
@@ -2784,12 +2869,12 @@ function useLinkPairs({
|
|
|
2784
2869
|
}) {
|
|
2785
2870
|
var _a;
|
|
2786
2871
|
const readonly = isReadonly(mode);
|
|
2787
|
-
const expected = (0,
|
|
2872
|
+
const expected = (0, import_react17.useMemo)(
|
|
2788
2873
|
() => new Set(data.pairs.map(([left, right]) => pairKey(left, right))),
|
|
2789
2874
|
[data.pairs]
|
|
2790
2875
|
);
|
|
2791
|
-
const [pairs, setPairs] = (0,
|
|
2792
|
-
const [selection, setSelection] = (0,
|
|
2876
|
+
const [pairs, setPairs] = (0, import_react17.useState)([]);
|
|
2877
|
+
const [selection, setSelection] = (0, import_react17.useState)(null);
|
|
2793
2878
|
const judge = useJudge({
|
|
2794
2879
|
evaluate: () => pairs.length === data.pairs.length && pairs.every(([left, right]) => expected.has(pairKey(left, right))),
|
|
2795
2880
|
onFirstWrong: () => setPairs((current) => current.filter(([left, right]) => expected.has(pairKey(left, right)))),
|
|
@@ -2875,7 +2960,6 @@ function LinkMatch({
|
|
|
2875
2960
|
onNext,
|
|
2876
2961
|
onSubmit,
|
|
2877
2962
|
sound,
|
|
2878
|
-
frame,
|
|
2879
2963
|
demoAttempt,
|
|
2880
2964
|
className
|
|
2881
2965
|
}) {
|
|
@@ -2908,7 +2992,6 @@ function LinkMatch({
|
|
|
2908
2992
|
complete: pairs.complete,
|
|
2909
2993
|
pairCount: pairs.pairs.length,
|
|
2910
2994
|
totalPairs: data.pairs.length,
|
|
2911
|
-
onPrev,
|
|
2912
2995
|
onNext,
|
|
2913
2996
|
onSubmit: pairs.handleSubmit,
|
|
2914
2997
|
onRetry: pairs.judge.retry
|
|
@@ -2922,7 +3005,6 @@ function LinkMatch({
|
|
|
2922
3005
|
total,
|
|
2923
3006
|
instruction,
|
|
2924
3007
|
onBack,
|
|
2925
|
-
frame,
|
|
2926
3008
|
className: classNames("rqk-quest", className),
|
|
2927
3009
|
dataQuest: "link-match",
|
|
2928
3010
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -2935,8 +3017,8 @@ function LinkMatch({
|
|
|
2935
3017
|
answerText: pairs.answerText
|
|
2936
3018
|
}
|
|
2937
3019
|
),
|
|
2938
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ActionBar, { actions }),
|
|
2939
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3020
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ActionBar, { actions, index, onPrev }),
|
|
3021
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
2940
3022
|
data.hint ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "rqk-link-hint", children: data.hint }) : null,
|
|
2941
3023
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2942
3024
|
LinkBoard,
|
|
@@ -2969,16 +3051,12 @@ function rearrangeActions({
|
|
|
2969
3051
|
phase,
|
|
2970
3052
|
labels,
|
|
2971
3053
|
full,
|
|
2972
|
-
onPrev,
|
|
2973
3054
|
onNext,
|
|
2974
3055
|
onSubmit,
|
|
2975
3056
|
onRetry
|
|
2976
3057
|
}) {
|
|
2977
3058
|
const actions = [];
|
|
2978
3059
|
if (readonly) {
|
|
2979
|
-
if (onPrev) {
|
|
2980
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
2981
|
-
}
|
|
2982
3060
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
2983
3061
|
} else if (phase === "correct" || phase === "locked") {
|
|
2984
3062
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -3160,7 +3238,7 @@ function RearrangePage({
|
|
|
3160
3238
|
onSlot,
|
|
3161
3239
|
onPick
|
|
3162
3240
|
}) {
|
|
3163
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
3164
3242
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3165
3243
|
RearrangeSlots,
|
|
3166
3244
|
{
|
|
@@ -3215,7 +3293,7 @@ function targetAnswerText(data) {
|
|
|
3215
3293
|
}
|
|
3216
3294
|
|
|
3217
3295
|
// src/questions/rearrange/use-rearrange.ts
|
|
3218
|
-
var
|
|
3296
|
+
var import_react18 = require("react");
|
|
3219
3297
|
function useRearrange({
|
|
3220
3298
|
data,
|
|
3221
3299
|
mode,
|
|
@@ -3229,7 +3307,7 @@ function useRearrange({
|
|
|
3229
3307
|
const bank = bankTiles(data, slots);
|
|
3230
3308
|
const words = targetWords(data);
|
|
3231
3309
|
const expected = expectedText(data);
|
|
3232
|
-
const [filled, setFilled] = (0,
|
|
3310
|
+
const [filled, setFilled] = (0, import_react18.useState)(
|
|
3233
3311
|
() => slots.map((slot, slotIndex) => {
|
|
3234
3312
|
if (slot.holder) return null;
|
|
3235
3313
|
if (demoAttempt === 2) {
|
|
@@ -3239,7 +3317,7 @@ function useRearrange({
|
|
|
3239
3317
|
return null;
|
|
3240
3318
|
})
|
|
3241
3319
|
);
|
|
3242
|
-
const [cursor, setCursor] = (0,
|
|
3320
|
+
const [cursor, setCursor] = (0, import_react18.useState)(() => {
|
|
3243
3321
|
const firstEmpty = slots.findIndex((slot) => !slot.holder);
|
|
3244
3322
|
return firstEmpty >= 0 ? firstEmpty : 0;
|
|
3245
3323
|
});
|
|
@@ -3271,7 +3349,7 @@ function useRearrange({
|
|
|
3271
3349
|
demoAttempt
|
|
3272
3350
|
});
|
|
3273
3351
|
const frozen = readonly || judge.phase === "correct" || judge.phase === "locked";
|
|
3274
|
-
(0,
|
|
3352
|
+
(0, import_react18.useEffect)(() => {
|
|
3275
3353
|
if (readonly) {
|
|
3276
3354
|
setFilled(
|
|
3277
3355
|
(current) => current.map((_value, slotIndex) => slots[slotIndex].holder ? null : slots[slotIndex].char)
|
|
@@ -3366,7 +3444,6 @@ function Rearrange({
|
|
|
3366
3444
|
onNext,
|
|
3367
3445
|
onSubmit,
|
|
3368
3446
|
sound,
|
|
3369
|
-
frame,
|
|
3370
3447
|
demoAttempt,
|
|
3371
3448
|
className
|
|
3372
3449
|
}) {
|
|
@@ -3376,7 +3453,6 @@ function Rearrange({
|
|
|
3376
3453
|
phase: model.judge.phase,
|
|
3377
3454
|
labels: model.labels,
|
|
3378
3455
|
full: model.full,
|
|
3379
|
-
onPrev,
|
|
3380
3456
|
onNext,
|
|
3381
3457
|
onSubmit: model.handleSubmit,
|
|
3382
3458
|
onRetry: model.judge.retry
|
|
@@ -3398,7 +3474,6 @@ function Rearrange({
|
|
|
3398
3474
|
"\uFF0C\u62FC\u51FA\u53E5\u5B50"
|
|
3399
3475
|
] }),
|
|
3400
3476
|
onBack,
|
|
3401
|
-
frame,
|
|
3402
3477
|
className: classNames("rqk-quest", "rqk-rearrange", className),
|
|
3403
3478
|
dataQuest: "rearrange",
|
|
3404
3479
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
@@ -3411,7 +3486,7 @@ function Rearrange({
|
|
|
3411
3486
|
answerText: targetAnswerText(data)
|
|
3412
3487
|
}
|
|
3413
3488
|
),
|
|
3414
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ActionBar, { actions }),
|
|
3489
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ActionBar, { actions, index, onPrev }),
|
|
3415
3490
|
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3416
3491
|
RearrangePage,
|
|
3417
3492
|
{
|
|
@@ -3438,16 +3513,12 @@ function classifyActions({
|
|
|
3438
3513
|
phase,
|
|
3439
3514
|
labels,
|
|
3440
3515
|
full,
|
|
3441
|
-
onPrev,
|
|
3442
3516
|
onNext,
|
|
3443
3517
|
onSubmit,
|
|
3444
3518
|
onRetry
|
|
3445
3519
|
}) {
|
|
3446
3520
|
const actions = [];
|
|
3447
3521
|
if (readonly) {
|
|
3448
|
-
if (onPrev) {
|
|
3449
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
3450
|
-
}
|
|
3451
3522
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
3452
3523
|
} else if (phase === "correct" || phase === "locked") {
|
|
3453
3524
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -3562,7 +3633,7 @@ function ClassifyPage({
|
|
|
3562
3633
|
onUnplace,
|
|
3563
3634
|
onPick
|
|
3564
3635
|
}) {
|
|
3565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
3566
3637
|
data.categories.map((category, categoryIndex) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3567
3638
|
ClassifyCategory,
|
|
3568
3639
|
{
|
|
@@ -3626,7 +3697,7 @@ function ClassifyFeedback({
|
|
|
3626
3697
|
}
|
|
3627
3698
|
|
|
3628
3699
|
// src/questions/classify/use-classify.ts
|
|
3629
|
-
var
|
|
3700
|
+
var import_react19 = require("react");
|
|
3630
3701
|
function useClassify({
|
|
3631
3702
|
data,
|
|
3632
3703
|
mode,
|
|
@@ -3637,12 +3708,12 @@ function useClassify({
|
|
|
3637
3708
|
var _a;
|
|
3638
3709
|
const labels = useQuestLabels();
|
|
3639
3710
|
const readonly = isReadonly(mode);
|
|
3640
|
-
const [placed, setPlaced] = (0,
|
|
3711
|
+
const [placed, setPlaced] = (0, import_react19.useState)(
|
|
3641
3712
|
() => data.items.map(
|
|
3642
3713
|
(item) => demoAttempt === 2 ? item.category === data.categories.length - 1 ? 0 : item.category : readonly ? item.category : null
|
|
3643
3714
|
)
|
|
3644
3715
|
);
|
|
3645
|
-
const [current, setCurrent] = (0,
|
|
3716
|
+
const [current, setCurrent] = (0, import_react19.useState)(0);
|
|
3646
3717
|
const judge = useJudge({
|
|
3647
3718
|
evaluate: () => data.items.every((item, itemIndex) => placed[itemIndex] === item.category),
|
|
3648
3719
|
onFirstWrong: () => setPlaced(
|
|
@@ -3721,7 +3792,6 @@ function Classify({
|
|
|
3721
3792
|
onNext,
|
|
3722
3793
|
onSubmit,
|
|
3723
3794
|
sound,
|
|
3724
|
-
frame,
|
|
3725
3795
|
demoAttempt,
|
|
3726
3796
|
className
|
|
3727
3797
|
}) {
|
|
@@ -3731,7 +3801,6 @@ function Classify({
|
|
|
3731
3801
|
phase: model.judge.phase,
|
|
3732
3802
|
labels: model.labels,
|
|
3733
3803
|
full: model.full,
|
|
3734
|
-
onPrev,
|
|
3735
3804
|
onNext,
|
|
3736
3805
|
onSubmit: model.handleSubmit,
|
|
3737
3806
|
onRetry: model.judge.retry
|
|
@@ -3748,7 +3817,6 @@ function Classify({
|
|
|
3748
3817
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("b", { children: "\u6B63\u786E\u7684\u7C7B\u522B" })
|
|
3749
3818
|
] }),
|
|
3750
3819
|
onBack,
|
|
3751
|
-
frame,
|
|
3752
3820
|
className: classNames("rqk-quest", "rqk-classify", className),
|
|
3753
3821
|
dataQuest: "classify",
|
|
3754
3822
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
@@ -3761,7 +3829,7 @@ function Classify({
|
|
|
3761
3829
|
answerText: model.answerText
|
|
3762
3830
|
}
|
|
3763
3831
|
),
|
|
3764
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ActionBar, { actions }),
|
|
3832
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ActionBar, { actions, index, onPrev }),
|
|
3765
3833
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3766
3834
|
ClassifyPage,
|
|
3767
3835
|
{
|
|
@@ -3786,7 +3854,6 @@ function rewriteActions({
|
|
|
3786
3854
|
phase,
|
|
3787
3855
|
labels,
|
|
3788
3856
|
hasValue,
|
|
3789
|
-
onPrev,
|
|
3790
3857
|
onNext,
|
|
3791
3858
|
onSubmit,
|
|
3792
3859
|
onRetry
|
|
@@ -3794,9 +3861,6 @@ function rewriteActions({
|
|
|
3794
3861
|
const actions = [];
|
|
3795
3862
|
const graded = phase === "correct" || phase === "locked";
|
|
3796
3863
|
if (readonly) {
|
|
3797
|
-
if (onPrev) {
|
|
3798
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
3799
|
-
}
|
|
3800
3864
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
3801
3865
|
} else if (graded) {
|
|
3802
3866
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -3907,7 +3971,7 @@ function RewriteKbHint({ text }) {
|
|
|
3907
3971
|
}
|
|
3908
3972
|
|
|
3909
3973
|
// src/questions/rewrite/use-rewrite.ts
|
|
3910
|
-
var
|
|
3974
|
+
var import_react20 = require("react");
|
|
3911
3975
|
function useRewrite({
|
|
3912
3976
|
data,
|
|
3913
3977
|
mode,
|
|
@@ -3917,8 +3981,8 @@ function useRewrite({
|
|
|
3917
3981
|
}) {
|
|
3918
3982
|
const labels = useQuestLabels();
|
|
3919
3983
|
const readonly = isReadonly(mode);
|
|
3920
|
-
const areaRef = (0,
|
|
3921
|
-
const [value, setValue] = (0,
|
|
3984
|
+
const areaRef = (0, import_react20.useRef)(null);
|
|
3985
|
+
const [value, setValue] = (0, import_react20.useState)(
|
|
3922
3986
|
() => {
|
|
3923
3987
|
var _a;
|
|
3924
3988
|
return readonly || demoAttempt === 2 ? (_a = data.answers[0]) != null ? _a : "" : "";
|
|
@@ -3929,7 +3993,7 @@ function useRewrite({
|
|
|
3929
3993
|
sound,
|
|
3930
3994
|
demoAttempt
|
|
3931
3995
|
});
|
|
3932
|
-
(0,
|
|
3996
|
+
(0, import_react20.useEffect)(() => {
|
|
3933
3997
|
const area = areaRef.current;
|
|
3934
3998
|
if (!area) return;
|
|
3935
3999
|
area.style.height = "auto";
|
|
@@ -3976,7 +4040,6 @@ function Rewrite({
|
|
|
3976
4040
|
onNext,
|
|
3977
4041
|
onSubmit,
|
|
3978
4042
|
sound,
|
|
3979
|
-
frame,
|
|
3980
4043
|
demoAttempt,
|
|
3981
4044
|
className
|
|
3982
4045
|
}) {
|
|
@@ -3987,7 +4050,6 @@ function Rewrite({
|
|
|
3987
4050
|
phase: model.judge.phase,
|
|
3988
4051
|
labels: model.labels,
|
|
3989
4052
|
hasValue: Boolean(model.value.trim()),
|
|
3990
|
-
onPrev,
|
|
3991
4053
|
onNext,
|
|
3992
4054
|
onSubmit: model.handleSubmit,
|
|
3993
4055
|
onRetry: model.judge.retry
|
|
@@ -4001,7 +4063,6 @@ function Rewrite({
|
|
|
4001
4063
|
total,
|
|
4002
4064
|
instruction: (_a = instruction != null ? instruction : data.prompt) != null ? _a : "\u6539\u5199\u53E5\u5B50\uFF0C\u4FDD\u6301\u65F6\u6001\u4E0E\u8BED\u5E8F",
|
|
4003
4065
|
onBack,
|
|
4004
|
-
frame,
|
|
4005
4066
|
className: classNames("rqk-quest", "rqk-rewrite", className),
|
|
4006
4067
|
dataQuest: "rewrite",
|
|
4007
4068
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
@@ -4013,8 +4074,8 @@ function Rewrite({
|
|
|
4013
4074
|
labels: model.labels
|
|
4014
4075
|
}
|
|
4015
4076
|
),
|
|
4016
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ActionBar, { actions }),
|
|
4017
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4077
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ActionBar, { actions, index, onPrev }),
|
|
4078
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
4018
4079
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4019
4080
|
RewriteAnswerCard,
|
|
4020
4081
|
{
|
|
@@ -4040,7 +4101,6 @@ function fillBlankActions({
|
|
|
4040
4101
|
phase,
|
|
4041
4102
|
labels,
|
|
4042
4103
|
filled,
|
|
4043
|
-
onPrev,
|
|
4044
4104
|
onNext,
|
|
4045
4105
|
onSubmit,
|
|
4046
4106
|
onRetry
|
|
@@ -4048,9 +4108,6 @@ function fillBlankActions({
|
|
|
4048
4108
|
const actions = [];
|
|
4049
4109
|
const graded = phase === "correct" || phase === "locked";
|
|
4050
4110
|
if (readonly) {
|
|
4051
|
-
if (onPrev) {
|
|
4052
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
4053
|
-
}
|
|
4054
4111
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
4055
4112
|
} else if (graded) {
|
|
4056
4113
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -4183,7 +4240,7 @@ function FillBlankPassage({
|
|
|
4183
4240
|
}
|
|
4184
4241
|
|
|
4185
4242
|
// src/questions/fill-blank/use-fill-blank.ts
|
|
4186
|
-
var
|
|
4243
|
+
var import_react21 = require("react");
|
|
4187
4244
|
function useFillBlank({
|
|
4188
4245
|
data,
|
|
4189
4246
|
mode,
|
|
@@ -4193,7 +4250,7 @@ function useFillBlank({
|
|
|
4193
4250
|
}) {
|
|
4194
4251
|
const labels = useQuestLabels();
|
|
4195
4252
|
const readonly = isReadonly(mode);
|
|
4196
|
-
const [values, setValues] = (0,
|
|
4253
|
+
const [values, setValues] = (0, import_react21.useState)(
|
|
4197
4254
|
() => data.blanks.map((blank, blankIndex) => {
|
|
4198
4255
|
var _a, _b;
|
|
4199
4256
|
if (readonly) return (_a = blank.answers[0]) != null ? _a : "";
|
|
@@ -4268,7 +4325,6 @@ function FillBlank({
|
|
|
4268
4325
|
onNext,
|
|
4269
4326
|
onSubmit,
|
|
4270
4327
|
sound,
|
|
4271
|
-
frame,
|
|
4272
4328
|
demoAttempt,
|
|
4273
4329
|
className
|
|
4274
4330
|
}) {
|
|
@@ -4278,7 +4334,6 @@ function FillBlank({
|
|
|
4278
4334
|
phase: model.judge.phase,
|
|
4279
4335
|
labels: model.labels,
|
|
4280
4336
|
filled: model.filled,
|
|
4281
|
-
onPrev,
|
|
4282
4337
|
onNext,
|
|
4283
4338
|
onSubmit: model.handleSubmit,
|
|
4284
4339
|
onRetry: model.judge.retry
|
|
@@ -4296,7 +4351,6 @@ function FillBlank({
|
|
|
4296
4351
|
"\u5904\u8F93\u5165\u6B63\u786E\u7684\u8BCD"
|
|
4297
4352
|
] }),
|
|
4298
4353
|
onBack,
|
|
4299
|
-
frame,
|
|
4300
4354
|
className: classNames("rqk-quest", "rqk-fill-blank", className),
|
|
4301
4355
|
dataQuest: "fill-blank",
|
|
4302
4356
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
@@ -4309,8 +4363,8 @@ function FillBlank({
|
|
|
4309
4363
|
answerText: model.answerText
|
|
4310
4364
|
}
|
|
4311
4365
|
),
|
|
4312
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActionBar, { actions }),
|
|
4313
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
4366
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActionBar, { actions, index, onPrev }),
|
|
4367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
4314
4368
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4315
4369
|
FillBlankPassage,
|
|
4316
4370
|
{
|
|
@@ -4337,16 +4391,12 @@ function wordSelectActions({
|
|
|
4337
4391
|
phase,
|
|
4338
4392
|
labels,
|
|
4339
4393
|
full,
|
|
4340
|
-
onPrev,
|
|
4341
4394
|
onNext,
|
|
4342
4395
|
onSubmit,
|
|
4343
4396
|
onRetry
|
|
4344
4397
|
}) {
|
|
4345
4398
|
const actions = [];
|
|
4346
4399
|
if (readonly) {
|
|
4347
|
-
if (onPrev) {
|
|
4348
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
4349
|
-
}
|
|
4350
4400
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
4351
4401
|
} else if (phase === "correct" || phase === "locked") {
|
|
4352
4402
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -4473,7 +4523,7 @@ function WordSelectPassage({
|
|
|
4473
4523
|
}
|
|
4474
4524
|
|
|
4475
4525
|
// src/questions/word-select/use-word-select.ts
|
|
4476
|
-
var
|
|
4526
|
+
var import_react22 = require("react");
|
|
4477
4527
|
|
|
4478
4528
|
// src/questions/word-select/word-select-model.ts
|
|
4479
4529
|
function buildBank(words) {
|
|
@@ -4498,16 +4548,16 @@ function useWordSelect({
|
|
|
4498
4548
|
const labels = useQuestLabels();
|
|
4499
4549
|
const readonly = isReadonly(mode);
|
|
4500
4550
|
const interaction = (_a = data.interaction) != null ? _a : "sequence";
|
|
4501
|
-
const [filled, setFilled] = (0,
|
|
4551
|
+
const [filled, setFilled] = (0, import_react22.useState)(
|
|
4502
4552
|
() => data.blanks.map((blank, blankIndex) => {
|
|
4503
4553
|
if (readonly) return blank.answer;
|
|
4504
4554
|
if (demoAttempt === 2) return blankIndex === 1 ? "banana" : blank.answer;
|
|
4505
4555
|
return null;
|
|
4506
4556
|
})
|
|
4507
4557
|
);
|
|
4508
|
-
const [selected, setSelected] = (0,
|
|
4509
|
-
const [notice, setNotice] = (0,
|
|
4510
|
-
(0,
|
|
4558
|
+
const [selected, setSelected] = (0, import_react22.useState)(0);
|
|
4559
|
+
const [notice, setNotice] = (0, import_react22.useState)("");
|
|
4560
|
+
(0, import_react22.useEffect)(() => {
|
|
4511
4561
|
if (!notice) return void 0;
|
|
4512
4562
|
const timer = window.setTimeout(() => setNotice(""), 2400);
|
|
4513
4563
|
return () => window.clearTimeout(timer);
|
|
@@ -4606,7 +4656,6 @@ function WordSelect({
|
|
|
4606
4656
|
onNext,
|
|
4607
4657
|
onSubmit,
|
|
4608
4658
|
sound,
|
|
4609
|
-
frame,
|
|
4610
4659
|
demoAttempt,
|
|
4611
4660
|
className
|
|
4612
4661
|
}) {
|
|
@@ -4616,7 +4665,6 @@ function WordSelect({
|
|
|
4616
4665
|
phase: model.judge.phase,
|
|
4617
4666
|
labels: model.labels,
|
|
4618
4667
|
full: model.full,
|
|
4619
|
-
onPrev,
|
|
4620
4668
|
onNext,
|
|
4621
4669
|
onSubmit: model.handleSubmit,
|
|
4622
4670
|
onRetry: model.judge.retry
|
|
@@ -4634,7 +4682,6 @@ function WordSelect({
|
|
|
4634
4682
|
"\uFF0C\u8865\u5168\u77ED\u6587"
|
|
4635
4683
|
] }),
|
|
4636
4684
|
onBack,
|
|
4637
|
-
frame,
|
|
4638
4685
|
className: classNames("rqk-quest", "rqk-word-select", className),
|
|
4639
4686
|
dataQuest: "word-select",
|
|
4640
4687
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
@@ -4647,8 +4694,8 @@ function WordSelect({
|
|
|
4647
4694
|
answerText: model.answerText
|
|
4648
4695
|
}
|
|
4649
4696
|
),
|
|
4650
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ActionBar, { actions }),
|
|
4651
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4697
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ActionBar, { actions, index, onPrev }),
|
|
4698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
4652
4699
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4653
4700
|
WordSelectPassage,
|
|
4654
4701
|
{
|
|
@@ -4682,23 +4729,24 @@ function sortSentencesActions({
|
|
|
4682
4729
|
phase,
|
|
4683
4730
|
labels,
|
|
4684
4731
|
full,
|
|
4685
|
-
onPrev,
|
|
4686
4732
|
onNext,
|
|
4687
4733
|
onSubmit,
|
|
4688
4734
|
onRetry
|
|
4689
4735
|
}) {
|
|
4690
4736
|
const actions = [];
|
|
4691
4737
|
if (readonly) {
|
|
4692
|
-
if (onPrev) {
|
|
4693
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
4694
|
-
}
|
|
4695
4738
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
4696
4739
|
} else if (phase === "correct" || phase === "locked") {
|
|
4697
4740
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
4698
4741
|
} else if (phase === "retry") {
|
|
4699
4742
|
actions.push({ key: "retry", label: labels.retry, onClick: onRetry });
|
|
4700
|
-
} else
|
|
4701
|
-
actions.push({
|
|
4743
|
+
} else {
|
|
4744
|
+
actions.push({
|
|
4745
|
+
key: "submit",
|
|
4746
|
+
label: labels.submit,
|
|
4747
|
+
onClick: onSubmit,
|
|
4748
|
+
disabled: !full
|
|
4749
|
+
});
|
|
4702
4750
|
}
|
|
4703
4751
|
return actions;
|
|
4704
4752
|
}
|
|
@@ -4810,7 +4858,7 @@ function SortRows({
|
|
|
4810
4858
|
}
|
|
4811
4859
|
|
|
4812
4860
|
// src/questions/sort-sentences/use-sort-sentences.ts
|
|
4813
|
-
var
|
|
4861
|
+
var import_react23 = require("react");
|
|
4814
4862
|
|
|
4815
4863
|
// src/questions/sort-sentences/sort-model.ts
|
|
4816
4864
|
function buildBank2(sentences) {
|
|
@@ -4833,7 +4881,7 @@ function useSortSentences({
|
|
|
4833
4881
|
}) {
|
|
4834
4882
|
const labels = useQuestLabels();
|
|
4835
4883
|
const readonly = isReadonly(mode);
|
|
4836
|
-
const [rows, setRows] = (0,
|
|
4884
|
+
const [rows, setRows] = (0, import_react23.useState)(
|
|
4837
4885
|
() => data.order.map((sentence, rowIndex) => {
|
|
4838
4886
|
var _a;
|
|
4839
4887
|
if (readonly) return sentence;
|
|
@@ -4841,7 +4889,7 @@ function useSortSentences({
|
|
|
4841
4889
|
return null;
|
|
4842
4890
|
})
|
|
4843
4891
|
);
|
|
4844
|
-
const [notice, setNotice] = (0,
|
|
4892
|
+
const [notice, setNotice] = (0, import_react23.useState)("");
|
|
4845
4893
|
const judge = useJudge({
|
|
4846
4894
|
evaluate: () => data.order.every((sentence, rowIndex) => rows[rowIndex] === sentence),
|
|
4847
4895
|
onFirstWrong: () => setRows(
|
|
@@ -4851,7 +4899,7 @@ function useSortSentences({
|
|
|
4851
4899
|
demoAttempt
|
|
4852
4900
|
});
|
|
4853
4901
|
const frozen = readonly || judge.phase === "correct" || judge.phase === "locked";
|
|
4854
|
-
(0,
|
|
4902
|
+
(0, import_react23.useEffect)(() => {
|
|
4855
4903
|
if (!notice) return void 0;
|
|
4856
4904
|
const timer = window.setTimeout(() => setNotice(""), 2400);
|
|
4857
4905
|
return () => window.clearTimeout(timer);
|
|
@@ -4918,7 +4966,6 @@ function SortSentences({
|
|
|
4918
4966
|
onNext,
|
|
4919
4967
|
onSubmit,
|
|
4920
4968
|
sound,
|
|
4921
|
-
frame,
|
|
4922
4969
|
demoAttempt,
|
|
4923
4970
|
className
|
|
4924
4971
|
}) {
|
|
@@ -4928,7 +4975,6 @@ function SortSentences({
|
|
|
4928
4975
|
phase: model.judge.phase,
|
|
4929
4976
|
labels: model.labels,
|
|
4930
4977
|
full: model.full,
|
|
4931
|
-
onPrev,
|
|
4932
4978
|
onNext,
|
|
4933
4979
|
onSubmit: model.handleSubmit,
|
|
4934
4980
|
onRetry: model.judge.retry
|
|
@@ -4946,7 +4992,6 @@ function SortSentences({
|
|
|
4946
4992
|
"\u6392\u5217\u53E5\u5B50\uFF0C\u70B9\u51FB\u7A7A\u884C\u653E\u5165"
|
|
4947
4993
|
] }),
|
|
4948
4994
|
onBack,
|
|
4949
|
-
frame,
|
|
4950
4995
|
className: classNames("rqk-quest", "rqk-sort", className),
|
|
4951
4996
|
dataQuest: "sort-sentences",
|
|
4952
4997
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
@@ -4958,8 +5003,8 @@ function SortSentences({
|
|
|
4958
5003
|
labels: model.labels
|
|
4959
5004
|
}
|
|
4960
5005
|
),
|
|
4961
|
-
footer: actions.length ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ActionBar, { actions }) : void 0,
|
|
4962
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
5006
|
+
footer: actions.length > 0 || index > 1 && Boolean(onPrev) ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ActionBar, { actions, index, onPrev }) : void 0,
|
|
5007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
4963
5008
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4964
5009
|
SortRows,
|
|
4965
5010
|
{
|
|
@@ -4992,16 +5037,12 @@ function clozeActions({
|
|
|
4992
5037
|
phase,
|
|
4993
5038
|
labels,
|
|
4994
5039
|
full,
|
|
4995
|
-
onPrev,
|
|
4996
5040
|
onNext,
|
|
4997
5041
|
onSubmit,
|
|
4998
5042
|
onRetry
|
|
4999
5043
|
}) {
|
|
5000
5044
|
const actions = [];
|
|
5001
5045
|
if (readonly) {
|
|
5002
|
-
if (onPrev) {
|
|
5003
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
5004
|
-
}
|
|
5005
5046
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
5006
5047
|
} else if (phase === "correct" || phase === "locked") {
|
|
5007
5048
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
@@ -5146,7 +5187,7 @@ function ClozePassage({
|
|
|
5146
5187
|
}
|
|
5147
5188
|
|
|
5148
5189
|
// src/questions/cloze/use-cloze.ts
|
|
5149
|
-
var
|
|
5190
|
+
var import_react24 = require("react");
|
|
5150
5191
|
|
|
5151
5192
|
// src/questions/cloze/cloze-model.ts
|
|
5152
5193
|
function answerIndex(options, answer) {
|
|
@@ -5164,7 +5205,7 @@ function useCloze({
|
|
|
5164
5205
|
}) {
|
|
5165
5206
|
const labels = useQuestLabels();
|
|
5166
5207
|
const readonly = isReadonly(mode);
|
|
5167
|
-
const [selected, setSelected] = (0,
|
|
5208
|
+
const [selected, setSelected] = (0, import_react24.useState)(
|
|
5168
5209
|
() => data.gaps.map((gap, gapIndex) => {
|
|
5169
5210
|
var _a, _b, _c;
|
|
5170
5211
|
if (readonly) return answerIndex((_a = data.options[gapIndex]) != null ? _a : [], gap.answer);
|
|
@@ -5174,7 +5215,7 @@ function useCloze({
|
|
|
5174
5215
|
return null;
|
|
5175
5216
|
})
|
|
5176
5217
|
);
|
|
5177
|
-
const [current, setCurrent] = (0,
|
|
5218
|
+
const [current, setCurrent] = (0, import_react24.useState)(0);
|
|
5178
5219
|
const judge = useJudge({
|
|
5179
5220
|
evaluate: () => data.gaps.every(
|
|
5180
5221
|
(gap, gapIndex) => {
|
|
@@ -5255,7 +5296,6 @@ function Cloze({
|
|
|
5255
5296
|
onNext,
|
|
5256
5297
|
onSubmit,
|
|
5257
5298
|
sound,
|
|
5258
|
-
frame,
|
|
5259
5299
|
demoAttempt,
|
|
5260
5300
|
className
|
|
5261
5301
|
}) {
|
|
@@ -5265,7 +5305,6 @@ function Cloze({
|
|
|
5265
5305
|
phase: model.judge.phase,
|
|
5266
5306
|
labels: model.labels,
|
|
5267
5307
|
full: model.full,
|
|
5268
|
-
onPrev,
|
|
5269
5308
|
onNext,
|
|
5270
5309
|
onSubmit: model.handleSubmit,
|
|
5271
5310
|
onRetry: model.judge.retry
|
|
@@ -5279,7 +5318,6 @@ function Cloze({
|
|
|
5279
5318
|
total,
|
|
5280
5319
|
instruction: instruction != null ? instruction : "\u901A\u8BFB\u77ED\u6587\uFF0C\u4E3A\u6BCF\u7A7A\u9009\u62E9\u6700\u4F73\u7B54\u6848",
|
|
5281
5320
|
onBack,
|
|
5282
|
-
frame,
|
|
5283
5321
|
className: classNames("rqk-quest", "rqk-cloze", className),
|
|
5284
5322
|
dataQuest: "cloze",
|
|
5285
5323
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
@@ -5292,8 +5330,8 @@ function Cloze({
|
|
|
5292
5330
|
answerText: model.answerText
|
|
5293
5331
|
}
|
|
5294
5332
|
),
|
|
5295
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ActionBar, { actions }),
|
|
5296
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5333
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ActionBar, { actions, index, onPrev }),
|
|
5334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
5297
5335
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5298
5336
|
ClozePassage,
|
|
5299
5337
|
{
|
|
@@ -5327,23 +5365,24 @@ function readingActions({
|
|
|
5327
5365
|
phase,
|
|
5328
5366
|
labels,
|
|
5329
5367
|
full,
|
|
5330
|
-
onPrev,
|
|
5331
5368
|
onNext,
|
|
5332
5369
|
onSubmit,
|
|
5333
5370
|
onRetry
|
|
5334
5371
|
}) {
|
|
5335
5372
|
const actions = [];
|
|
5336
5373
|
if (readonly) {
|
|
5337
|
-
if (onPrev) {
|
|
5338
|
-
actions.push({ key: "prev", label: labels.prev, variant: "ghost", onClick: onPrev });
|
|
5339
|
-
}
|
|
5340
5374
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
5341
5375
|
} else if (phase === "correct" || phase === "locked") {
|
|
5342
5376
|
actions.push({ key: "next", label: labels.next, onClick: onNext });
|
|
5343
5377
|
} else if (phase === "retry") {
|
|
5344
5378
|
actions.push({ key: "retry", label: labels.retry, onClick: onRetry });
|
|
5345
|
-
} else
|
|
5346
|
-
actions.push({
|
|
5379
|
+
} else {
|
|
5380
|
+
actions.push({
|
|
5381
|
+
key: "submit",
|
|
5382
|
+
label: labels.submit,
|
|
5383
|
+
onClick: onSubmit,
|
|
5384
|
+
disabled: !full
|
|
5385
|
+
});
|
|
5347
5386
|
}
|
|
5348
5387
|
return actions;
|
|
5349
5388
|
}
|
|
@@ -5546,7 +5585,7 @@ function ReadingPage({
|
|
|
5546
5585
|
onChip,
|
|
5547
5586
|
onPick
|
|
5548
5587
|
}) {
|
|
5549
|
-
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
5588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
5550
5589
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
5551
5590
|
ReadingPassage,
|
|
5552
5591
|
{
|
|
@@ -5586,17 +5625,17 @@ function ReadingPage({
|
|
|
5586
5625
|
}
|
|
5587
5626
|
|
|
5588
5627
|
// src/questions/reading-comprehension/use-passage-fold.ts
|
|
5589
|
-
var
|
|
5628
|
+
var import_react25 = require("react");
|
|
5590
5629
|
function usePassageFold({
|
|
5591
5630
|
passage,
|
|
5592
5631
|
collapsible,
|
|
5593
5632
|
defaultCollapsed,
|
|
5594
5633
|
sound
|
|
5595
5634
|
}) {
|
|
5596
|
-
const textRef = (0,
|
|
5597
|
-
const [folded, setFolded] = (0,
|
|
5598
|
-
const [fullHeight, setFullHeight] = (0,
|
|
5599
|
-
(0,
|
|
5635
|
+
const textRef = (0, import_react25.useRef)(null);
|
|
5636
|
+
const [folded, setFolded] = (0, import_react25.useState)(collapsible && defaultCollapsed);
|
|
5637
|
+
const [fullHeight, setFullHeight] = (0, import_react25.useState)(0);
|
|
5638
|
+
(0, import_react25.useEffect)(() => {
|
|
5600
5639
|
const element = textRef.current;
|
|
5601
5640
|
if (!element) return void 0;
|
|
5602
5641
|
const measure = () => setFullHeight(element.scrollHeight);
|
|
@@ -5617,7 +5656,7 @@ function usePassageFold({
|
|
|
5617
5656
|
}
|
|
5618
5657
|
|
|
5619
5658
|
// src/questions/reading-comprehension/use-reading-comprehension.ts
|
|
5620
|
-
var
|
|
5659
|
+
var import_react26 = require("react");
|
|
5621
5660
|
function useReadingComprehension({
|
|
5622
5661
|
data,
|
|
5623
5662
|
mode,
|
|
@@ -5628,7 +5667,7 @@ function useReadingComprehension({
|
|
|
5628
5667
|
var _a;
|
|
5629
5668
|
const labels = useQuestLabels();
|
|
5630
5669
|
const readonly = isReadonly(mode);
|
|
5631
|
-
const [answers, setAnswers] = (0,
|
|
5670
|
+
const [answers, setAnswers] = (0, import_react26.useState)(
|
|
5632
5671
|
() => data.questions.map((question, questionIndex) => {
|
|
5633
5672
|
if (readonly) return question.answer;
|
|
5634
5673
|
if (demoAttempt === 2) {
|
|
@@ -5637,13 +5676,13 @@ function useReadingComprehension({
|
|
|
5637
5676
|
return null;
|
|
5638
5677
|
})
|
|
5639
5678
|
);
|
|
5640
|
-
const [locked, setLocked] = (0,
|
|
5679
|
+
const [locked, setLocked] = (0, import_react26.useState)(
|
|
5641
5680
|
() => data.questions.map(
|
|
5642
5681
|
(question, questionIndex) => demoAttempt === 2 && answers[questionIndex] === question.answer
|
|
5643
5682
|
)
|
|
5644
5683
|
);
|
|
5645
|
-
const [current, setCurrent] = (0,
|
|
5646
|
-
const [notice, setNotice] = (0,
|
|
5684
|
+
const [current, setCurrent] = (0, import_react26.useState)(0);
|
|
5685
|
+
const [notice, setNotice] = (0, import_react26.useState)("");
|
|
5647
5686
|
const judge = useJudge({
|
|
5648
5687
|
evaluate: () => data.questions.every((question, questionIndex) => answers[questionIndex] === question.answer),
|
|
5649
5688
|
onFirstWrong: () => {
|
|
@@ -5666,7 +5705,7 @@ function useReadingComprehension({
|
|
|
5666
5705
|
demoAttempt
|
|
5667
5706
|
});
|
|
5668
5707
|
const judged = judge.phase === "correct" || judge.phase === "locked" || readonly;
|
|
5669
|
-
(0,
|
|
5708
|
+
(0, import_react26.useEffect)(() => {
|
|
5670
5709
|
if (!notice) return void 0;
|
|
5671
5710
|
const timer = window.setTimeout(() => setNotice(""), 2400);
|
|
5672
5711
|
return () => window.clearTimeout(timer);
|
|
@@ -5750,7 +5789,6 @@ function ReadingComprehension({
|
|
|
5750
5789
|
onNext,
|
|
5751
5790
|
onSubmit,
|
|
5752
5791
|
sound,
|
|
5753
|
-
frame,
|
|
5754
5792
|
demoAttempt,
|
|
5755
5793
|
className
|
|
5756
5794
|
}) {
|
|
@@ -5768,7 +5806,6 @@ function ReadingComprehension({
|
|
|
5768
5806
|
phase: model.judge.phase,
|
|
5769
5807
|
labels: model.labels,
|
|
5770
5808
|
full: model.full,
|
|
5771
|
-
onPrev,
|
|
5772
5809
|
onNext,
|
|
5773
5810
|
onSubmit: model.handleSubmit,
|
|
5774
5811
|
onRetry: model.judge.retry
|
|
@@ -5786,7 +5823,6 @@ function ReadingComprehension({
|
|
|
5786
5823
|
" \u9053\u5C0F\u9898"
|
|
5787
5824
|
] }),
|
|
5788
5825
|
onBack,
|
|
5789
|
-
frame,
|
|
5790
5826
|
className: classNames("rqk-quest", "rqk-reading", className),
|
|
5791
5827
|
dataQuest: "reading-comprehension",
|
|
5792
5828
|
feedback: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
@@ -5799,7 +5835,7 @@ function ReadingComprehension({
|
|
|
5799
5835
|
answerText: model.answerText
|
|
5800
5836
|
}
|
|
5801
5837
|
),
|
|
5802
|
-
footer: actions.length ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ActionBar, { actions }) : void 0,
|
|
5838
|
+
footer: actions.length > 0 || index > 1 && Boolean(onPrev) ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ActionBar, { actions, index, onPrev }) : void 0,
|
|
5803
5839
|
children: [
|
|
5804
5840
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5805
5841
|
ReadingPage,
|
|
@@ -5837,8 +5873,13 @@ function listenTaskActions({
|
|
|
5837
5873
|
if (feedback) {
|
|
5838
5874
|
actions.push({ key: "again", label: "\u518D\u542C\u4E00\u904D", variant: "ghost", onClick: onReplay });
|
|
5839
5875
|
actions.push({ key: "next", label: "\u5B8C\u6210\u5E76\u8FD4\u56DE", onClick: onNext });
|
|
5840
|
-
} else
|
|
5841
|
-
actions.push({
|
|
5876
|
+
} else {
|
|
5877
|
+
actions.push({
|
|
5878
|
+
key: "submit",
|
|
5879
|
+
label: "\u63D0\u4EA4\u5E76\u67E5\u770B\u7EDF\u8BA1",
|
|
5880
|
+
onClick: onSubmit,
|
|
5881
|
+
disabled: !completed
|
|
5882
|
+
});
|
|
5842
5883
|
}
|
|
5843
5884
|
return actions;
|
|
5844
5885
|
}
|
|
@@ -6046,9 +6087,9 @@ function ListenPlayer({
|
|
|
6046
6087
|
}
|
|
6047
6088
|
|
|
6048
6089
|
// src/questions/listen-task/use-listen-task.ts
|
|
6049
|
-
var
|
|
6090
|
+
var import_react27 = require("react");
|
|
6050
6091
|
function useListenTask({ data, onSubmit }) {
|
|
6051
|
-
const [view, setView] = (0,
|
|
6092
|
+
const [view, setView] = (0, import_react27.useState)("task");
|
|
6052
6093
|
const progress = useMediaProgress({
|
|
6053
6094
|
duration: data.duration,
|
|
6054
6095
|
src: data.audio,
|
|
@@ -6081,9 +6122,9 @@ function ListenTask({
|
|
|
6081
6122
|
title,
|
|
6082
6123
|
instruction,
|
|
6083
6124
|
onBack,
|
|
6125
|
+
onPrev,
|
|
6084
6126
|
onNext,
|
|
6085
6127
|
onSubmit,
|
|
6086
|
-
frame,
|
|
6087
6128
|
className
|
|
6088
6129
|
}) {
|
|
6089
6130
|
const model = useListenTask({ data, onSubmit });
|
|
@@ -6101,18 +6142,16 @@ function ListenTask({
|
|
|
6101
6142
|
title: title != null ? title : model.view === "feedback" ? "\u542C\u529B\u7EDF\u8BA1" : "\u542C\u529B\u4EFB\u52A1",
|
|
6102
6143
|
index,
|
|
6103
6144
|
total,
|
|
6104
|
-
instructionVariant: "plain",
|
|
6105
6145
|
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
6106
6146
|
"\u542C\u5B8C\u97F3\u9891\uFF0C\u6709\u6548\u64AD\u653E ",
|
|
6107
6147
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("b", { children: "\u226590%" }),
|
|
6108
6148
|
" \u89C6\u4E3A\u5B8C\u6210"
|
|
6109
6149
|
] }),
|
|
6110
6150
|
onBack,
|
|
6111
|
-
frame,
|
|
6112
6151
|
className: classNames("rqk-quest", "rqk-listen", className),
|
|
6113
6152
|
dataQuest: "listen-task",
|
|
6114
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ActionBar, { actions }),
|
|
6115
|
-
children: model.view === "feedback" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ListenFeedback, { data, progress: model.progress, percent: model.percent }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
6153
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ActionBar, { actions, index, onPrev }),
|
|
6154
|
+
children: model.view === "feedback" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ListenFeedback, { data, progress: model.progress, percent: model.percent }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
6116
6155
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ListenHero, { data }),
|
|
6117
6156
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ListenPlayer, { data, progress: model.progress, percent: model.percent })
|
|
6118
6157
|
] })
|
|
@@ -6132,8 +6171,13 @@ function videoTaskActions({
|
|
|
6132
6171
|
if (feedback) {
|
|
6133
6172
|
actions.push({ key: "again", label: "\u518D\u770B\u4E00\u904D", variant: "ghost", onClick: onReplay });
|
|
6134
6173
|
actions.push({ key: "next", label: "\u5B8C\u6210\u5E76\u8FD4\u56DE", onClick: onNext });
|
|
6135
|
-
} else
|
|
6136
|
-
actions.push({
|
|
6174
|
+
} else {
|
|
6175
|
+
actions.push({
|
|
6176
|
+
key: "submit",
|
|
6177
|
+
label: "\u63D0\u4EA4\u5E76\u67E5\u770B\u7EDF\u8BA1",
|
|
6178
|
+
onClick: onSubmit,
|
|
6179
|
+
disabled: !allDone
|
|
6180
|
+
});
|
|
6137
6181
|
}
|
|
6138
6182
|
return actions;
|
|
6139
6183
|
}
|
|
@@ -6225,6 +6269,7 @@ function VideoRing({ percent }) {
|
|
|
6225
6269
|
cx: "24",
|
|
6226
6270
|
cy: "24",
|
|
6227
6271
|
r: "20",
|
|
6272
|
+
pathLength: 100,
|
|
6228
6273
|
strokeDasharray: 100,
|
|
6229
6274
|
strokeDashoffset: 100 - percent
|
|
6230
6275
|
}
|
|
@@ -6367,10 +6412,10 @@ function VideoStage({
|
|
|
6367
6412
|
}
|
|
6368
6413
|
|
|
6369
6414
|
// src/questions/video-task/use-video-task.ts
|
|
6370
|
-
var
|
|
6415
|
+
var import_react29 = require("react");
|
|
6371
6416
|
|
|
6372
6417
|
// src/questions/video-task/use-video-clock.ts
|
|
6373
|
-
var
|
|
6418
|
+
var import_react28 = require("react");
|
|
6374
6419
|
|
|
6375
6420
|
// src/questions/video-task/constants.ts
|
|
6376
6421
|
var TICK_MS2 = 100;
|
|
@@ -6390,13 +6435,13 @@ function useVideoClock({
|
|
|
6390
6435
|
setPosition,
|
|
6391
6436
|
setTimeOnTask
|
|
6392
6437
|
}) {
|
|
6393
|
-
(0,
|
|
6438
|
+
(0, import_react28.useEffect)(() => {
|
|
6394
6439
|
positionRef.current = 0;
|
|
6395
6440
|
setPosition(0);
|
|
6396
6441
|
setPlaying(false);
|
|
6397
6442
|
playingRef.current = false;
|
|
6398
6443
|
}, [current]);
|
|
6399
|
-
(0,
|
|
6444
|
+
(0, import_react28.useEffect)(() => {
|
|
6400
6445
|
if (video.src || !playing) return void 0;
|
|
6401
6446
|
const timer = window.setInterval(() => {
|
|
6402
6447
|
if (!playingRef.current) return;
|
|
@@ -6412,7 +6457,7 @@ function useVideoClock({
|
|
|
6412
6457
|
}, TICK_MS2);
|
|
6413
6458
|
return () => window.clearInterval(timer);
|
|
6414
6459
|
}, [playing, video.duration, video.src]);
|
|
6415
|
-
(0,
|
|
6460
|
+
(0, import_react28.useEffect)(() => {
|
|
6416
6461
|
const element = videoRef.current;
|
|
6417
6462
|
if (!element || !video.src) return void 0;
|
|
6418
6463
|
const handleTime = () => {
|
|
@@ -6440,17 +6485,17 @@ function useVideoClock({
|
|
|
6440
6485
|
// src/questions/video-task/use-video-task.ts
|
|
6441
6486
|
function useVideoTask({ data, onSubmit }) {
|
|
6442
6487
|
var _a;
|
|
6443
|
-
const [view, setView] = (0,
|
|
6444
|
-
const [current, setCurrent] = (0,
|
|
6445
|
-
const [position, setPosition] = (0,
|
|
6446
|
-
const [credits, setCredits] = (0,
|
|
6447
|
-
const [playing, setPlaying] = (0,
|
|
6448
|
-
const [timeOnTask, setTimeOnTask] = (0,
|
|
6449
|
-
const [fullscreen, setFullscreen] = (0,
|
|
6450
|
-
const videoRef = (0,
|
|
6451
|
-
const positionRef = (0,
|
|
6452
|
-
const creditRef = (0,
|
|
6453
|
-
const playingRef = (0,
|
|
6488
|
+
const [view, setView] = (0, import_react29.useState)("task");
|
|
6489
|
+
const [current, setCurrent] = (0, import_react29.useState)(0);
|
|
6490
|
+
const [position, setPosition] = (0, import_react29.useState)(0);
|
|
6491
|
+
const [credits, setCredits] = (0, import_react29.useState)(() => data.videos.map(() => 0));
|
|
6492
|
+
const [playing, setPlaying] = (0, import_react29.useState)(false);
|
|
6493
|
+
const [timeOnTask, setTimeOnTask] = (0, import_react29.useState)(0);
|
|
6494
|
+
const [fullscreen, setFullscreen] = (0, import_react29.useState)(false);
|
|
6495
|
+
const videoRef = (0, import_react29.useRef)(null);
|
|
6496
|
+
const positionRef = (0, import_react29.useRef)(0);
|
|
6497
|
+
const creditRef = (0, import_react29.useRef)(0);
|
|
6498
|
+
const playingRef = (0, import_react29.useRef)(false);
|
|
6454
6499
|
const video = (_a = data.videos[current]) != null ? _a : data.videos[0];
|
|
6455
6500
|
const applyPosition = (value) => {
|
|
6456
6501
|
const next = Math.min(video.duration, Math.max(0, value));
|
|
@@ -6572,9 +6617,9 @@ function VideoTask({
|
|
|
6572
6617
|
title,
|
|
6573
6618
|
instruction,
|
|
6574
6619
|
onBack,
|
|
6620
|
+
onPrev,
|
|
6575
6621
|
onNext,
|
|
6576
6622
|
onSubmit,
|
|
6577
|
-
frame,
|
|
6578
6623
|
className
|
|
6579
6624
|
}) {
|
|
6580
6625
|
const model = useVideoTask({ data, onSubmit });
|
|
@@ -6592,18 +6637,16 @@ function VideoTask({
|
|
|
6592
6637
|
title: title != null ? title : model.view === "feedback" ? "\u89C6\u9891\u7EDF\u8BA1" : "\u89C6\u9891\u4EFB\u52A1",
|
|
6593
6638
|
index,
|
|
6594
6639
|
total,
|
|
6595
|
-
instructionVariant: "plain",
|
|
6596
6640
|
instruction: instruction != null ? instruction : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
6597
6641
|
"\u89C2\u770B\u89C6\u9891\uFF0C\u6709\u6548\u89C2\u770B ",
|
|
6598
6642
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("b", { children: "\u226590%" }),
|
|
6599
6643
|
" \u89C6\u4E3A\u5B8C\u6210"
|
|
6600
6644
|
] }),
|
|
6601
6645
|
onBack,
|
|
6602
|
-
frame,
|
|
6603
6646
|
className: classNames("rqk-quest", "rqk-video", className),
|
|
6604
6647
|
dataQuest: "video-task",
|
|
6605
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ActionBar, { actions }),
|
|
6606
|
-
children: model.view === "feedback" ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(VideoFeedback, { data, overall: model.overall, timeOnTask: model.timeOnTask }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
6648
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ActionBar, { actions, index, onPrev }),
|
|
6649
|
+
children: model.view === "feedback" ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(VideoFeedback, { data, overall: model.overall, timeOnTask: model.timeOnTask }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
6607
6650
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
6608
6651
|
VideoStage,
|
|
6609
6652
|
{
|
|
@@ -6678,7 +6721,7 @@ function BlankInput2({
|
|
|
6678
6721
|
}
|
|
6679
6722
|
|
|
6680
6723
|
// src/index.tsx
|
|
6681
|
-
var version = "1.0.
|
|
6724
|
+
var version = "1.0.3";
|
|
6682
6725
|
var questkit = {
|
|
6683
6726
|
version,
|
|
6684
6727
|
QuestShell,
|