@cuemath/leap 2.8.62 → 2.8.63-akm-1
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/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js +89 -74
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js.map +1 -1
- package/dist/features/ui/section-list/section-list.js +12 -12
- package/dist/features/ui/section-list/section-list.js.map +1 -1
- package/package.json +1 -1
@@ -1,88 +1,103 @@
|
|
1
|
-
import { useCallback as
|
2
|
-
import { CircleSoundKeyMapper as
|
3
|
-
import { CircleSoundKey as
|
4
|
-
let
|
5
|
-
const
|
6
|
-
[
|
7
|
-
[
|
8
|
-
[
|
9
|
-
[
|
10
|
-
[
|
11
|
-
[
|
12
|
-
[
|
13
|
-
[
|
14
|
-
[
|
15
|
-
[
|
16
|
-
[
|
17
|
-
[
|
18
|
-
[
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
22
|
-
[
|
23
|
-
[
|
24
|
-
[
|
25
|
-
[
|
26
|
-
[
|
27
|
-
[
|
28
|
-
[
|
29
|
-
},
|
30
|
-
const
|
31
|
-
if (!
|
32
|
-
const
|
33
|
-
|
1
|
+
import { useCallback as r, useRef as _, useEffect as R } from "react";
|
2
|
+
import { CircleSoundKeyMapper as m, SWIPE_SOUND_ORDER as I } from "./constants.js";
|
3
|
+
import { CircleSoundKey as n } from "./use-circle-sounds-enums.js";
|
4
|
+
let a = 0;
|
5
|
+
const u = {
|
6
|
+
[n.BACKGROUND]: null,
|
7
|
+
[n.BACKGROUND_RUSHHOUR]: null,
|
8
|
+
[n.TUTORIAL]: null,
|
9
|
+
[n.SWIPE_01]: null,
|
10
|
+
[n.SWIPE_02]: null,
|
11
|
+
[n.SWIPE_03]: null,
|
12
|
+
[n.SWIPE_04]: null,
|
13
|
+
[n.SWIPE_DOWN]: null,
|
14
|
+
[n.TOGGLE]: null,
|
15
|
+
[n.POINTS_AWARDED]: null,
|
16
|
+
[n.POINTS_ADDED]: null,
|
17
|
+
[n.GAME_CARD_CLICK]: null,
|
18
|
+
[n.CLOCK_IN]: null,
|
19
|
+
[n.CLOCK_OUT]: null,
|
20
|
+
[n.ACCURACY_IN]: null,
|
21
|
+
[n.ACCURACY_OUT]: null,
|
22
|
+
[n.STREAK_IN]: null,
|
23
|
+
[n.STREAK_OUT]: null,
|
24
|
+
[n.ACCURACY_INTRO]: null,
|
25
|
+
[n.ACCURACY_TARGET]: null,
|
26
|
+
[n.TIME_INTRO]: null,
|
27
|
+
[n.TIME_TARGET]: null,
|
28
|
+
[n.METER_FILL]: null
|
29
|
+
}, d = {}, U = () => {
|
30
|
+
const s = r((e) => {
|
31
|
+
if (!u[e]) {
|
32
|
+
const o = new Audio(m[e]);
|
33
|
+
o.preload = "auto", u[e] = o;
|
34
34
|
}
|
35
|
-
}, []), p =
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
}, []), p = _(/* @__PURE__ */ new Set());
|
36
|
+
R(() => {
|
37
|
+
const e = () => {
|
38
|
+
document.visibilityState === "hidden" ? (console.log("Pausing sounds"), Object.keys(u).forEach((o) => {
|
39
|
+
const l = u[o];
|
40
|
+
l && !l.paused && (l.pause(), p.current.add(o));
|
41
|
+
})) : document.visibilityState === "visible" && (p.current.forEach((o) => {
|
42
|
+
const l = u[o];
|
43
|
+
l == null || l.play();
|
44
|
+
}), p.current.clear());
|
45
|
+
};
|
46
|
+
return document.addEventListener("visibilitychange", e), () => {
|
47
|
+
document.removeEventListener("visibilitychange", e);
|
48
|
+
};
|
49
|
+
}, []);
|
50
|
+
const C = r(() => {
|
51
|
+
var o;
|
52
|
+
I.forEach((l) => {
|
53
|
+
s(l);
|
39
54
|
});
|
40
|
-
const
|
41
|
-
|
42
|
-
}, [
|
43
|
-
var
|
44
|
-
return
|
45
|
-
}, [
|
46
|
-
(
|
47
|
-
e
|
48
|
-
const
|
49
|
-
if (!
|
50
|
-
if (
|
51
|
-
|
52
|
-
const
|
53
|
-
|
55
|
+
const e = I[a] || n.SWIPE_01;
|
56
|
+
a < I.length - 1 ? a++ : a = 0, (o = u[e]) == null || o.play();
|
57
|
+
}, [s]), S = r(() => {
|
58
|
+
var o;
|
59
|
+
return s(n.TOGGLE), (o = u[n.TOGGLE]) == null ? void 0 : o.play();
|
60
|
+
}, [s]), f = r(
|
61
|
+
(e, o = !0, l = !1) => {
|
62
|
+
s(e);
|
63
|
+
const t = u[e];
|
64
|
+
if (!t) return;
|
65
|
+
if (t.loop = l, o) {
|
66
|
+
t.volume = 1;
|
67
|
+
const c = t.play();
|
68
|
+
d[e] = c;
|
54
69
|
return;
|
55
70
|
}
|
56
|
-
|
57
|
-
const
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
71
|
+
t.volume = 0;
|
72
|
+
const E = t.play();
|
73
|
+
d[e] = E;
|
74
|
+
const i = setInterval(() => {
|
75
|
+
if (!t) return;
|
76
|
+
const c = t.volume || 0;
|
77
|
+
c < 1 ? t.volume = c + 0.1 : clearInterval(i);
|
78
|
+
}, 100);
|
79
|
+
return t;
|
63
80
|
},
|
64
|
-
[
|
65
|
-
),
|
66
|
-
var
|
67
|
-
const
|
68
|
-
|
69
|
-
if (
|
70
|
-
|
81
|
+
[s]
|
82
|
+
), v = r((e, o = !0) => {
|
83
|
+
var t;
|
84
|
+
const l = u[e];
|
85
|
+
d[e] !== void 0 && ((t = d[e]) == null || t.then(() => {
|
86
|
+
if (o) {
|
87
|
+
l == null || l.pause();
|
71
88
|
return;
|
72
89
|
}
|
73
|
-
const
|
74
|
-
if (!
|
75
|
-
const
|
76
|
-
|
90
|
+
const E = setInterval(() => {
|
91
|
+
if (!l) return;
|
92
|
+
const i = l.volume || 0;
|
93
|
+
i - 0.1 <= 0 ? (l.volume = 0, l.pause(), clearInterval(E)) : l.volume = i - 0.1;
|
77
94
|
}, 100);
|
78
|
-
}).catch((c) => {
|
79
|
-
console.log("sound not playing", c);
|
80
95
|
}));
|
81
96
|
}, []);
|
82
|
-
return { playSwipSound:
|
97
|
+
return { playSwipSound: C, play: f, stop: v, playButtonSound: S };
|
83
98
|
};
|
84
99
|
export {
|
85
|
-
|
86
|
-
|
100
|
+
u as soundMapper,
|
101
|
+
U as useCircleSounds
|
87
102
|
};
|
88
103
|
//# sourceMappingURL=use-circle-sounds.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-circle-sounds.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"file":"use-circle-sounds.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { CircleSoundKeyMapper, SWIPE_SOUND_ORDER } from './constants';\nimport { CircleSoundKey } from './use-circle-sounds-enums';\n\nlet swipeSoundIndex = 0;\n\nexport const soundMapper: Record<keyof typeof CircleSoundKeyMapper, null | HTMLAudioElement> = {\n [CircleSoundKey.BACKGROUND]: null,\n [CircleSoundKey.BACKGROUND_RUSHHOUR]: null,\n [CircleSoundKey.TUTORIAL]: null,\n [CircleSoundKey.SWIPE_01]: null,\n [CircleSoundKey.SWIPE_02]: null,\n [CircleSoundKey.SWIPE_03]: null,\n [CircleSoundKey.SWIPE_04]: null,\n [CircleSoundKey.SWIPE_DOWN]: null,\n [CircleSoundKey.TOGGLE]: null,\n [CircleSoundKey.POINTS_AWARDED]: null,\n [CircleSoundKey.POINTS_ADDED]: null,\n [CircleSoundKey.GAME_CARD_CLICK]: null,\n [CircleSoundKey.CLOCK_IN]: null,\n [CircleSoundKey.CLOCK_OUT]: null,\n [CircleSoundKey.ACCURACY_IN]: null,\n [CircleSoundKey.ACCURACY_OUT]: null,\n [CircleSoundKey.STREAK_IN]: null,\n [CircleSoundKey.STREAK_OUT]: null,\n [CircleSoundKey.ACCURACY_INTRO]: null,\n [CircleSoundKey.ACCURACY_TARGET]: null,\n [CircleSoundKey.TIME_INTRO]: null,\n [CircleSoundKey.TIME_TARGET]: null,\n [CircleSoundKey.METER_FILL]: null,\n};\n\nconst soundInstancePromise: Partial<Record<keyof typeof CircleSoundKeyMapper, Promise<void>>> = {};\n\nexport const useCircleSounds = () => {\n const loadSound = useCallback((key: CircleSoundKey) => {\n if (!soundMapper[key]) {\n const loadedSound = new Audio(CircleSoundKeyMapper[key]);\n\n loadedSound.preload = 'auto';\n soundMapper[key] = loadedSound;\n }\n }, []);\n\n const pausedSoundsRef = useRef<Set<CircleSoundKey>>(new Set());\n\n useEffect(() => {\n const handleVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n // Pause all playing sounds and track them\n console.log('Pausing sounds');\n (Object.keys(soundMapper) as CircleSoundKey[]).forEach(key => {\n const sound = soundMapper[key];\n\n if (sound && !sound.paused) {\n sound.pause();\n pausedSoundsRef.current.add(key);\n }\n });\n } else if (document.visibilityState === 'visible') {\n // Resume only previously paused sounds\n pausedSoundsRef.current.forEach(key => {\n const sound = soundMapper[key];\n\n sound?.play();\n });\n pausedSoundsRef.current.clear();\n }\n };\n\n document.addEventListener('visibilitychange', handleVisibilityChange);\n\n return () => {\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n };\n }, []);\n\n const playSwipSound = useCallback(() => {\n SWIPE_SOUND_ORDER.forEach(key => {\n loadSound(key);\n });\n\n const key = SWIPE_SOUND_ORDER[swipeSoundIndex] || CircleSoundKey.SWIPE_01;\n\n if (swipeSoundIndex < SWIPE_SOUND_ORDER.length - 1) {\n swipeSoundIndex++;\n } else {\n swipeSoundIndex = 0;\n }\n soundMapper[key]?.play();\n }, [loadSound]);\n\n const playButtonSound = useCallback(() => {\n loadSound(CircleSoundKey.TOGGLE);\n const sound = soundMapper[CircleSoundKey.TOGGLE]?.play();\n\n return sound;\n }, [loadSound]);\n\n const play = useCallback(\n (key: CircleSoundKey, immediately: boolean = true, loop = false) => {\n loadSound(key);\n const soundInstance = soundMapper[key];\n\n if (!soundInstance) return;\n\n soundInstance.loop = loop;\n if (immediately) {\n soundInstance.volume = 1;\n const promise = soundInstance.play();\n\n soundInstancePromise[key] = promise;\n\n return;\n }\n\n soundInstance.volume = 0;\n const promise = soundInstance.play();\n\n soundInstancePromise[key] = promise;\n\n const intervalId = setInterval(() => {\n if (!soundInstance) return;\n\n const vol = soundInstance.volume || 0;\n\n if (vol < 1) {\n soundInstance.volume = vol + 0.1;\n } else {\n clearInterval(intervalId);\n }\n }, 100);\n\n return soundInstance;\n },\n [loadSound],\n );\n\n const stop = useCallback((key: CircleSoundKey, immediately: boolean = true) => {\n const soundInstance = soundMapper[key];\n\n if (soundInstancePromise[key] !== undefined) {\n soundInstancePromise[key]?.then(() => {\n if (immediately) {\n soundInstance?.pause();\n\n return;\n }\n\n const intervalId = setInterval(() => {\n if (!soundInstance) return;\n\n const vol = soundInstance.volume || 0;\n\n if (vol - 0.1 <= 0) {\n soundInstance.volume = 0;\n soundInstance.pause();\n clearInterval(intervalId);\n } else {\n soundInstance.volume = vol - 0.1;\n }\n }, 100);\n });\n }\n }, []);\n\n return { playSwipSound, play, stop, playButtonSound };\n};\n"],"names":["swipeSoundIndex","soundMapper","CircleSoundKey","soundInstancePromise","useCircleSounds","loadSound","useCallback","key","loadedSound","CircleSoundKeyMapper","pausedSoundsRef","useRef","useEffect","handleVisibilityChange","sound","playSwipSound","SWIPE_SOUND_ORDER","_a","playButtonSound","play","immediately","loop","soundInstance","promise","intervalId","vol","stop"],"mappings":";;;AAMA,IAAIA,IAAkB;AAEf,MAAMC,IAAkF;AAAA,EAC7F,CAACC,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,mBAAmB,GAAG;AAAA,EACtC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ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c,UAAU;AAEpC,QAAIG,IAAM,IACRH,EAAc,SAASG,IAAM,MAE7B,cAAcD,CAAU;AAAA,SAEzB,GAAG;AAEC,aAAAF;AAAA,IACT;AAAA,IACA,CAACjB,CAAS;AAAA,EAAA,GAGNqB,IAAOpB,EAAY,CAACC,GAAqBa,IAAuB,OAAS;;AACvE,UAAAE,IAAgBrB,EAAYM,CAAG;AAEjC,IAAAJ,EAAqBI,CAAG,MAAM,YACXU,IAAAd,EAAAI,CAAG,MAAH,QAAAU,EAAM,KAAK,MAAM;AACpC,UAAIG,GAAa;AACf,QAAAE,KAAA,QAAAA,EAAe;AAEf;AAAA,MACF;AAEM,YAAAE,IAAa,YAAY,MAAM;AACnC,YAAI,CAACF,EAAe;AAEd,cAAAG,IAAMH,EAAc,UAAU;AAEhC,QAAAG,IAAM,OAAO,KACfH,EAAc,SAAS,GACvBA,EAAc,MAAM,GACpB,cAAcE,CAAU,KAExBF,EAAc,SAASG,IAAM;AAAA,SAE9B,GAAG;AAAA,IAAA;AAAA,EAGZ,GAAG,CAAE,CAAA;AAEL,SAAO,EAAE,eAAAV,GAAe,MAAAI,GAAM,MAAAO,GAAM,iBAAAR,EAAgB;AACtD;"}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import { jsx as t, Fragment as p, jsxs as
|
2
|
-
import { memo as
|
3
|
-
import
|
4
|
-
const
|
5
|
-
const { data:
|
6
|
-
return /* @__PURE__ */ t(p, { children:
|
7
|
-
n &&
|
8
|
-
/* @__PURE__ */ t(
|
9
|
-
const l =
|
10
|
-
return /* @__PURE__ */ t(
|
1
|
+
import { jsx as t, Fragment as p, jsxs as h } from "react/jsx-runtime";
|
2
|
+
import { memo as $, Fragment as m } from "react";
|
3
|
+
import f from "../layout/flex-view.js";
|
4
|
+
const g = (i) => {
|
5
|
+
const { data: n, renderSectionHeader: o, renderItem: s, keyExtractor: a } = i;
|
6
|
+
return /* @__PURE__ */ t(p, { children: n.map((e, d) => /* @__PURE__ */ h(f, { children: [
|
7
|
+
n.length > 1 && o && o(e),
|
8
|
+
/* @__PURE__ */ t(m, { children: e.data.map((r, c) => {
|
9
|
+
const l = a ? a(r, c) : `${r}_${c}`;
|
10
|
+
return /* @__PURE__ */ t(m, { children: s(r) }, l);
|
11
11
|
}) })
|
12
|
-
] }, `${
|
13
|
-
},
|
12
|
+
] }, `${e.title}_${d}`)) });
|
13
|
+
}, u = $(g), L = u;
|
14
14
|
export {
|
15
15
|
L as default
|
16
16
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"section-list.js","sources":["../../../../src/features/ui/section-list/section-list.tsx"],"sourcesContent":["import type { ISectionList, TDefaultSection } from './section-list-types';\n\nimport { Fragment, memo } from 'react';\n\nimport FlexView from '../layout/flex-view';\n\nconst SectionListComponent = <Section extends string | number | TDefaultSection>(\n props: ISectionList<Section>,\n): JSX.Element => {\n const { data, renderSectionHeader, renderItem, keyExtractor } = props;\n\n return (\n <>\n {data.map((section, idx) => {\n return (\n <FlexView key={`${section.title}_${idx}`}>\n {renderSectionHeader && renderSectionHeader(section)}\n\n <Fragment>\n {section.data.map((item, itemIdx) => {\n const key = keyExtractor ? keyExtractor(item, itemIdx) : `${item}_${itemIdx}`;\n\n return <Fragment key={key}>{renderItem(item)}</Fragment>;\n })}\n </Fragment>\n </FlexView>\n );\n })}\n </>\n );\n};\n\nconst SelectionList = memo(SectionListComponent) as <\n Section extends string | number | TDefaultSection,\n>(\n props: ISectionList<Section>,\n) => JSX.Element;\n\nexport default SelectionList;\n"],"names":["SectionListComponent","props","data","renderSectionHeader","renderItem","keyExtractor","jsx","Fragment","section","idx","FlexView","item","itemIdx","key","SelectionList","memo","SectionList"],"mappings":";;;AAMA,MAAMA,IAAuB,CAC3BC,MACgB;AAChB,QAAM,EAAE,MAAAC,GAAM,qBAAAC,GAAqB,YAAAC,GAAY,cAAAC,MAAiBJ;AAEhE,SAEK,gBAAAK,EAAAC,GAAA,EAAA,UAAAL,EAAK,IAAI,CAACM,GAASC,wBAEfC,GACE,EAAA,UAAA;AAAA,
|
1
|
+
{"version":3,"file":"section-list.js","sources":["../../../../src/features/ui/section-list/section-list.tsx"],"sourcesContent":["import type { ISectionList, TDefaultSection } from './section-list-types';\n\nimport { Fragment, memo } from 'react';\n\nimport FlexView from '../layout/flex-view';\n\nconst SectionListComponent = <Section extends string | number | TDefaultSection>(\n props: ISectionList<Section>,\n): JSX.Element => {\n const { data, renderSectionHeader, renderItem, keyExtractor } = props;\n\n return (\n <>\n {data.map((section, idx) => {\n return (\n <FlexView key={`${section.title}_${idx}`}>\n {data.length > 1 && renderSectionHeader && renderSectionHeader(section)}\n\n <Fragment>\n {section.data.map((item, itemIdx) => {\n const key = keyExtractor ? keyExtractor(item, itemIdx) : `${item}_${itemIdx}`;\n\n return <Fragment key={key}>{renderItem(item)}</Fragment>;\n })}\n </Fragment>\n </FlexView>\n );\n })}\n </>\n );\n};\n\nconst SelectionList = memo(SectionListComponent) as <\n Section extends string | number | TDefaultSection,\n>(\n props: ISectionList<Section>,\n) => JSX.Element;\n\nexport default SelectionList;\n"],"names":["SectionListComponent","props","data","renderSectionHeader","renderItem","keyExtractor","jsx","Fragment","section","idx","FlexView","item","itemIdx","key","SelectionList","memo","SectionList"],"mappings":";;;AAMA,MAAMA,IAAuB,CAC3BC,MACgB;AAChB,QAAM,EAAE,MAAAC,GAAM,qBAAAC,GAAqB,YAAAC,GAAY,cAAAC,MAAiBJ;AAEhE,SAEK,gBAAAK,EAAAC,GAAA,EAAA,UAAAL,EAAK,IAAI,CAACM,GAASC,wBAEfC,GACE,EAAA,UAAA;AAAA,IAAAR,EAAK,SAAS,KAAKC,KAAuBA,EAAoBK,CAAO;AAAA,IAEtE,gBAAAF,EAACC,GAAA,EACE,UAAAC,EAAQ,KAAK,IAAI,CAACG,GAAMC,MAAY;AAC7B,YAAAC,IAAMR,IAAeA,EAAaM,GAAMC,CAAO,IAAI,GAAGD,CAAI,IAAIC,CAAO;AAE3E,+BAAQL,GAAA,EAAoB,UAAWH,EAAAO,CAAI,KAArBE,CAAuB;AAAA,IAC9C,CAAA,GACH;AAAA,EAAA,EAAA,GATa,GAAGL,EAAQ,KAAK,IAAIC,CAAG,EAUtC,CAEH,EACH,CAAA;AAEJ,GAEMK,IAAgBC,EAAKf,CAAoB,GAM/CgB,IAAeF;"}
|