@cuemath/leap 3.1.13-akm-2 → 3.1.13-akm-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.
@@ -1,80 +1,110 @@
|
|
1
|
-
import {
|
2
|
-
import { memo as
|
3
|
-
import { Accuracy as
|
4
|
-
import { Clock as
|
5
|
-
import {
|
6
|
-
import {
|
1
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
2
|
+
import { memo as y, forwardRef as S, useState as d, useMemo as u, useCallback as s, useImperativeHandle as C } from "react";
|
3
|
+
import { Accuracy as v } from "./accuracy/accuracy.js";
|
4
|
+
import { Clock as g } from "./clock/clock.js";
|
5
|
+
import { DigitalMeter as A } from "./digital-meter/digital-meter.js";
|
6
|
+
import { EPostGameStat as t } from "./enums/post-game-stats-enum.js";
|
7
|
+
import { Points as R } from "./points/points.js";
|
7
8
|
import { StatsWrapper as I, BlackBg as P } from "./post-game-stats-styled.js";
|
8
|
-
import { Score as
|
9
|
-
import { Streak as
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
p == null || p();
|
9
|
+
import { Score as w } from "./score/score.js";
|
10
|
+
import { Streak as E } from "./streak/streak.js";
|
11
|
+
const $ = y(
|
12
|
+
S(({ stats: p, show: h, onComplete: m }, T) => {
|
13
|
+
const [o, c] = d(0), e = u(() => p[o], [o, p]), a = s(() => {
|
14
|
+
var r;
|
15
|
+
if ((r = e == null ? void 0 : e.onComplete) == null || r.call(e), o === p.length - 1) {
|
16
|
+
m == null || m();
|
17
17
|
return;
|
18
18
|
}
|
19
|
-
|
20
|
-
}, [o,
|
21
|
-
|
22
|
-
}, [
|
23
|
-
|
24
|
-
moveToNextAndPlay:
|
25
|
-
}))
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
19
|
+
c((i) => i + 1);
|
20
|
+
}, [o, m, p.length, e]), l = s(() => {
|
21
|
+
e != null && e.stopAtEnd || a();
|
22
|
+
}, [e, a]);
|
23
|
+
C(T, () => ({
|
24
|
+
moveToNextAndPlay: a
|
25
|
+
}));
|
26
|
+
const x = u(() => {
|
27
|
+
if (!e)
|
28
|
+
return null;
|
29
|
+
const r = `${e.type}-${o}`;
|
30
|
+
return {
|
31
|
+
[t.SCORE]: /* @__PURE__ */ n(
|
32
|
+
w,
|
33
|
+
{
|
34
|
+
currentScore: e.value,
|
35
|
+
highScore: e.maxValue ?? 0,
|
36
|
+
show: e.type === t.SCORE,
|
37
|
+
onComplete: l,
|
38
|
+
helperText: e.helperText
|
39
|
+
},
|
40
|
+
r
|
41
|
+
),
|
42
|
+
[t.POINT]: /* @__PURE__ */ n(
|
43
|
+
R,
|
44
|
+
{
|
45
|
+
point: e.value,
|
46
|
+
show: e.type === t.POINT,
|
47
|
+
onComplete: l,
|
48
|
+
onReveal: e.onReveal
|
49
|
+
},
|
50
|
+
r
|
51
|
+
),
|
52
|
+
[t.DIGITAL_METER]: /* @__PURE__ */ n(
|
53
|
+
A,
|
54
|
+
{
|
55
|
+
value: e.value,
|
56
|
+
maxValue: e.maxValue ?? 1,
|
57
|
+
targetValue: e.targetValue,
|
58
|
+
displayText: e.displayText ?? "",
|
59
|
+
progressType: e.progressType ?? "linear",
|
60
|
+
helperTextPrimary: e.helperTextPrimary ?? "",
|
61
|
+
helperTextSecondary: e.helperTextSecondary ?? "",
|
62
|
+
actAsTimer: e.actAsTimer,
|
63
|
+
show: !0,
|
64
|
+
onComplete: l
|
65
|
+
},
|
66
|
+
r
|
67
|
+
),
|
68
|
+
[t.STREAK]: /* @__PURE__ */ n(
|
69
|
+
E,
|
70
|
+
{
|
71
|
+
currStreak: e.value,
|
72
|
+
show: !0,
|
73
|
+
onComplete: l,
|
74
|
+
helperText: e.helperText,
|
75
|
+
onReveal: e.onReveal
|
76
|
+
},
|
77
|
+
r
|
78
|
+
),
|
79
|
+
[t.ACCURACY]: /* @__PURE__ */ n(
|
80
|
+
v,
|
81
|
+
{
|
82
|
+
accuracy: e.value,
|
83
|
+
show: !0,
|
84
|
+
onComplete: l,
|
85
|
+
helperText: e.helperText
|
86
|
+
},
|
87
|
+
r
|
88
|
+
),
|
89
|
+
[t.CLOCK]: /* @__PURE__ */ n(
|
90
|
+
g,
|
91
|
+
{
|
92
|
+
timeInMs: e.value,
|
93
|
+
show: !0,
|
94
|
+
onComplete: l,
|
95
|
+
helperText: e.helperText
|
96
|
+
},
|
97
|
+
r
|
98
|
+
)
|
99
|
+
}[e.type] ?? null;
|
100
|
+
}, [e, o, l]);
|
101
|
+
return !h || p.length === 0 || o >= p.length ? null : /* @__PURE__ */ f(I, { children: [
|
102
|
+
/* @__PURE__ */ n(P, {}),
|
103
|
+
x
|
74
104
|
] });
|
75
105
|
})
|
76
106
|
);
|
77
107
|
export {
|
78
|
-
|
108
|
+
$ as PostGameStats
|
79
109
|
};
|
80
110
|
//# sourceMappingURL=post-game-stats.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"post-game-stats.js","sources":["../../../src/features/post-game-stats/post-game-stats.tsx"],"sourcesContent":["import type { IPostGameStatsProps, IPostGameStatsRef } from './post-game-stats-types';\n\nimport { useState, memo, useCallback, forwardRef, useImperativeHandle, useMemo } from 'react';\n\nimport { Accuracy } from './accuracy/accuracy';\nimport { Clock } from './clock/clock';\nimport { EPostGameStat } from './enums/post-game-stats-enum';\nimport { Points } from './points/points';\nimport * as Styled from './post-game-stats-styled';\nimport { Score } from './score/score';\nimport { Streak } from './streak/streak';\n\nexport const PostGameStats = memo(\n forwardRef<IPostGameStatsRef, IPostGameStatsProps>(({ stats, show, onComplete }, ref) => {\n const [currStatIndex, setCurrentStatIndex] = useState(0);\n const currStatData = useMemo(() => stats[currStatIndex], [currStatIndex, stats]);\n\n const moveToNextAndPlay = useCallback(() => {\n currStatData?.onComplete?.();\n\n if (currStatIndex === stats.length - 1) {\n onComplete?.();\n\n return;\n }\n setCurrentStatIndex(prev => prev + 1);\n }, [currStatIndex, onComplete, stats.length, currStatData]);\n\n const onStatAnimationComplete = useCallback(() => {\n if (currStatData?.stopAtEnd) {\n return;\n }\n moveToNextAndPlay(); // Autoplay since stopAtEnd is false\n }, [currStatData, moveToNextAndPlay]);\n\n useImperativeHandle(ref, () => ({\n moveToNextAndPlay,\n }));\n\n
|
1
|
+
{"version":3,"file":"post-game-stats.js","sources":["../../../src/features/post-game-stats/post-game-stats.tsx"],"sourcesContent":["import type { IPostGameStatsProps, IPostGameStatsRef } from './post-game-stats-types';\n\nimport { useState, memo, useCallback, forwardRef, useImperativeHandle, useMemo } from 'react';\n\nimport { Accuracy } from './accuracy/accuracy';\nimport { Clock } from './clock/clock';\nimport { DigitalMeter } from './digital-meter/digital-meter';\nimport { EPostGameStat } from './enums/post-game-stats-enum';\nimport { Points } from './points/points';\nimport * as Styled from './post-game-stats-styled';\nimport { Score } from './score/score';\nimport { Streak } from './streak/streak';\n\nexport const PostGameStats = memo(\n forwardRef<IPostGameStatsRef, IPostGameStatsProps>(({ stats, show, onComplete }, ref) => {\n const [currStatIndex, setCurrentStatIndex] = useState(0);\n const currStatData = useMemo(() => stats[currStatIndex], [currStatIndex, stats]);\n\n const moveToNextAndPlay = useCallback(() => {\n currStatData?.onComplete?.();\n\n if (currStatIndex === stats.length - 1) {\n onComplete?.();\n\n return;\n }\n setCurrentStatIndex(prev => prev + 1);\n }, [currStatIndex, onComplete, stats.length, currStatData]);\n\n const onStatAnimationComplete = useCallback(() => {\n if (currStatData?.stopAtEnd) {\n return;\n }\n moveToNextAndPlay(); // Autoplay since stopAtEnd is false\n }, [currStatData, moveToNextAndPlay]);\n\n useImperativeHandle(ref, () => ({\n moveToNextAndPlay,\n }));\n\n const renderCurrentStat = useMemo(() => {\n if (!currStatData) {\n return null;\n }\n\n const key = `${currStatData.type}-${currStatIndex}`;\n\n const renderStat = {\n [EPostGameStat.SCORE]: (\n <Score\n key={key}\n currentScore={currStatData.value}\n highScore={currStatData.maxValue ?? 0}\n show={currStatData.type === EPostGameStat.SCORE}\n onComplete={onStatAnimationComplete}\n helperText={currStatData.helperText}\n />\n ),\n\n [EPostGameStat.POINT]: (\n <Points\n key={key}\n point={currStatData.value}\n show={currStatData.type === EPostGameStat.POINT}\n onComplete={onStatAnimationComplete}\n onReveal={currStatData.onReveal}\n />\n ),\n [EPostGameStat.DIGITAL_METER]: (\n <DigitalMeter\n key={key}\n value={currStatData.value}\n maxValue={currStatData.maxValue ?? 1}\n targetValue={currStatData.targetValue}\n displayText={currStatData.displayText ?? ''}\n progressType={currStatData.progressType ?? 'linear'}\n helperTextPrimary={currStatData.helperTextPrimary ?? ''}\n helperTextSecondary={currStatData.helperTextSecondary ?? ''}\n actAsTimer={currStatData.actAsTimer}\n show={true}\n onComplete={onStatAnimationComplete}\n />\n ),\n [EPostGameStat.STREAK]: (\n <Streak\n key={key}\n currStreak={currStatData.value}\n show={true}\n onComplete={onStatAnimationComplete}\n helperText={currStatData.helperText}\n onReveal={currStatData.onReveal}\n />\n ),\n [EPostGameStat.ACCURACY]: (\n <Accuracy\n key={key}\n accuracy={currStatData.value}\n show={true}\n onComplete={onStatAnimationComplete}\n helperText={currStatData.helperText}\n />\n ),\n [EPostGameStat.CLOCK]: (\n <Clock\n key={key}\n timeInMs={currStatData.value}\n show={true}\n onComplete={onStatAnimationComplete}\n helperText={currStatData.helperText}\n />\n ),\n };\n\n return renderStat[currStatData.type] ?? null;\n }, [currStatData, currStatIndex, onStatAnimationComplete]);\n\n if (!show || stats.length === 0 || currStatIndex >= stats.length) {\n return null;\n }\n\n return (\n <Styled.StatsWrapper>\n <Styled.BlackBg />\n\n {renderCurrentStat}\n </Styled.StatsWrapper>\n );\n }),\n);\n"],"names":["PostGameStats","memo","forwardRef","stats","show","onComplete","ref","currStatIndex","setCurrentStatIndex","useState","currStatData","useMemo","moveToNextAndPlay","useCallback","_a","prev","onStatAnimationComplete","useImperativeHandle","renderCurrentStat","key","EPostGameStat","jsx","Score","Points","DigitalMeter","Streak","Accuracy","Clock","jsxs","Styled.StatsWrapper","Styled.BlackBg"],"mappings":";;;;;;;;;;AAaO,MAAMA,IAAgBC;AAAA,EAC3BC,EAAmD,CAAC,EAAE,OAAAC,GAAO,MAAAC,GAAM,YAAAC,EAAA,GAAcC,MAAQ;AACvF,UAAM,CAACC,GAAeC,CAAmB,IAAIC,EAAS,CAAC,GACjDC,IAAeC,EAAQ,MAAMR,EAAMI,CAAa,GAAG,CAACA,GAAeJ,CAAK,CAAC,GAEzES,IAAoBC,EAAY,MAAM;;AAGtC,WAFJC,IAAAJ,KAAA,gBAAAA,EAAc,eAAd,QAAAI,EAAA,KAAAJ,IAEIH,MAAkBJ,EAAM,SAAS,GAAG;AACzB,QAAAE,KAAA,QAAAA;AAEb;AAAA,MACF;AACoB,MAAAG,EAAA,CAAAO,MAAQA,IAAO,CAAC;AAAA,IAAA,GACnC,CAACR,GAAeF,GAAYF,EAAM,QAAQO,CAAY,CAAC,GAEpDM,IAA0BH,EAAY,MAAM;AAChD,MAAIH,KAAA,QAAAA,EAAc,aAGAE;IAAA,GACjB,CAACF,GAAcE,CAAiB,CAAC;AAEpC,IAAAK,EAAoBX,GAAK,OAAO;AAAA,MAC9B,mBAAAM;AAAA,IACA,EAAA;AAEI,UAAAM,IAAoBP,EAAQ,MAAM;AACtC,UAAI,CAACD;AACI,eAAA;AA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