@jswork/react-questkit 1.0.5 → 1.0.7
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 +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -479,9 +479,11 @@ declare function SingleChoice({ data, mode, index, total, title, instruction, on
|
|
|
479
479
|
|
|
480
480
|
interface FollowReadProps extends QuestCommonProps, FollowReadExtraProps {
|
|
481
481
|
data: FollowReadData;
|
|
482
|
+
/** 已用录音次数回填(0~maxAttempts),用于断点续做时对齐服务端累计重录次数。 */
|
|
483
|
+
initialAttempts?: number;
|
|
482
484
|
}
|
|
483
485
|
|
|
484
|
-
declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, className, demoState, onScore, onRecordingChange, }: FollowReadProps): react.JSX.Element;
|
|
486
|
+
declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, className, demoState, onScore, onRecordingChange, initialAttempts, }: FollowReadProps): react.JSX.Element;
|
|
485
487
|
|
|
486
488
|
interface LinkMatchProps extends QuestCommonProps {
|
|
487
489
|
data: LinkMatchData;
|
package/dist/index.d.ts
CHANGED
|
@@ -479,9 +479,11 @@ declare function SingleChoice({ data, mode, index, total, title, instruction, on
|
|
|
479
479
|
|
|
480
480
|
interface FollowReadProps extends QuestCommonProps, FollowReadExtraProps {
|
|
481
481
|
data: FollowReadData;
|
|
482
|
+
/** 已用录音次数回填(0~maxAttempts),用于断点续做时对齐服务端累计重录次数。 */
|
|
483
|
+
initialAttempts?: number;
|
|
482
484
|
}
|
|
483
485
|
|
|
484
|
-
declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, className, demoState, onScore, onRecordingChange, }: FollowReadProps): react.JSX.Element;
|
|
486
|
+
declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, className, demoState, onScore, onRecordingChange, initialAttempts, }: FollowReadProps): react.JSX.Element;
|
|
485
487
|
|
|
486
488
|
interface LinkMatchProps extends QuestCommonProps {
|
|
487
489
|
data: LinkMatchData;
|
package/dist/index.mjs
CHANGED
|
@@ -2257,7 +2257,8 @@ function useFollowRead({
|
|
|
2257
2257
|
sound,
|
|
2258
2258
|
demoState,
|
|
2259
2259
|
onScore,
|
|
2260
|
-
onRecordingChange
|
|
2260
|
+
onRecordingChange,
|
|
2261
|
+
initialAttempts
|
|
2261
2262
|
}) {
|
|
2262
2263
|
var _a, _b, _c, _d, _e, _f;
|
|
2263
2264
|
const labels = useQuestLabels();
|
|
@@ -2267,9 +2268,10 @@ function useFollowRead({
|
|
|
2267
2268
|
const preset = readonly ? void 0 : demoState;
|
|
2268
2269
|
const presetGrade = preset === "noise" ? "noise" : preset === "limit" ? "great" : preset === "perfect" || preset === "great" || preset === "nobad" || preset === "again" ? preset : null;
|
|
2269
2270
|
const initialStage = presetGrade ? "result" : "ready";
|
|
2270
|
-
const
|
|
2271
|
+
const demoAttempts = preset === "limit" ? maxAttempts : presetGrade && preset !== "again" ? 1 : 0;
|
|
2272
|
+
const restoredAttempts = initialAttempts == null ? demoAttempts : Math.min(maxAttempts, Math.max(0, Math.trunc(initialAttempts)));
|
|
2271
2273
|
const [stage, setStageState] = useState11(initialStage);
|
|
2272
|
-
const [attemptsUsed, setAttemptsUsed] = useState11(
|
|
2274
|
+
const [attemptsUsed, setAttemptsUsed] = useState11(restoredAttempts);
|
|
2273
2275
|
const [grade, setGrade] = useState11(presetGrade);
|
|
2274
2276
|
const [noise, setNoise] = useState11(preset === "noise");
|
|
2275
2277
|
const stageRef = useRef8(initialStage);
|
|
@@ -2368,7 +2370,8 @@ function FollowRead({
|
|
|
2368
2370
|
className,
|
|
2369
2371
|
demoState,
|
|
2370
2372
|
onScore,
|
|
2371
|
-
onRecordingChange
|
|
2373
|
+
onRecordingChange,
|
|
2374
|
+
initialAttempts
|
|
2372
2375
|
}) {
|
|
2373
2376
|
const model = useFollowRead({
|
|
2374
2377
|
data,
|
|
@@ -2377,7 +2380,8 @@ function FollowRead({
|
|
|
2377
2380
|
sound,
|
|
2378
2381
|
demoState,
|
|
2379
2382
|
onScore,
|
|
2380
|
-
onRecordingChange
|
|
2383
|
+
onRecordingChange,
|
|
2384
|
+
initialAttempts
|
|
2381
2385
|
});
|
|
2382
2386
|
const actions = followReadActions({
|
|
2383
2387
|
readonly: model.readonly,
|
|
@@ -6937,7 +6941,7 @@ function BlankInput2({
|
|
|
6937
6941
|
}
|
|
6938
6942
|
|
|
6939
6943
|
// src/index.tsx
|
|
6940
|
-
var version = "1.0.
|
|
6944
|
+
var version = "1.0.7";
|
|
6941
6945
|
var questkit = {
|
|
6942
6946
|
version,
|
|
6943
6947
|
QuestShell,
|