@cuemath/leap 3.2.0-aa2 → 3.2.1-aa0
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/ui/modals/modal-provider.js +23 -24
- package/dist/features/ui/modals/modal-provider.js.map +1 -1
- package/dist/features/worksheet/worksheet/constants.js +12 -13
- package/dist/features/worksheet/worksheet/constants.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js +230 -248
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-styled.js +37 -28
- package/dist/features/worksheet/worksheet/worksheet-styled.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet.js +188 -186
- package/dist/features/worksheet/worksheet/worksheet.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,52 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { memo as
|
|
3
|
-
import I from "
|
|
4
|
-
import
|
|
5
|
-
import L from "./modal-context.js";
|
|
1
|
+
import { jsxs as E, jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { memo as h, useState as c, useRef as x, useCallback as f, useMemo as D, useEffect as w } from "react";
|
|
3
|
+
import I from "./modal.js";
|
|
4
|
+
import S from "./modal-context.js";
|
|
6
5
|
import { lockScroll as R, unlockScroll as T } from "./modal-helpers.js";
|
|
7
|
-
const $ = 500,
|
|
8
|
-
const [o, M] =
|
|
6
|
+
const $ = 500, g = h(({ children: p, modals: u, isUserAuthenticated: t }) => {
|
|
7
|
+
const [o, M] = c(null), [m, C] = c(void 0), [r, i] = c(!1), l = x(void 0), v = f(
|
|
9
8
|
(e, s, P) => {
|
|
10
|
-
const d =
|
|
9
|
+
const d = u.find((y) => y.name === e);
|
|
11
10
|
if (!d)
|
|
12
11
|
throw new Error(`Modal with name "${e}" not found`);
|
|
13
12
|
if (d.isPrivate && !t)
|
|
14
13
|
throw new Error(
|
|
15
14
|
`Access violation: Modal "${e}" is private and user is not authenticated`
|
|
16
15
|
);
|
|
17
|
-
l.current = P, i(!1), M(d),
|
|
16
|
+
l.current = P, i(!1), M(d), C(s), document.body.style.overflow !== "hidden" && R();
|
|
18
17
|
},
|
|
19
|
-
[t,
|
|
20
|
-
), n =
|
|
18
|
+
[t, u]
|
|
19
|
+
), n = f(() => {
|
|
21
20
|
i(!0), T(), setTimeout(() => {
|
|
22
21
|
M(null), i(!1);
|
|
23
22
|
}, $);
|
|
24
|
-
}, []),
|
|
23
|
+
}, []), k = D(
|
|
25
24
|
() => ({
|
|
26
25
|
modal: o,
|
|
27
|
-
modalParams:
|
|
28
|
-
openModal:
|
|
26
|
+
modalParams: m,
|
|
27
|
+
openModal: v,
|
|
29
28
|
closeModal: n,
|
|
30
29
|
isClosing: r
|
|
31
30
|
}),
|
|
32
|
-
[o,
|
|
33
|
-
), a =
|
|
31
|
+
[o, m, v, n, r]
|
|
32
|
+
), a = f(() => {
|
|
34
33
|
var e, s;
|
|
35
34
|
(o == null ? void 0 : o.isDismissable) !== !1 && !r && (n(), l.current && ((s = (e = l.current).onCloseModal) == null || s.call(e), l.current.onCloseModal = void 0));
|
|
36
35
|
}, [o, n, r]);
|
|
37
|
-
return
|
|
36
|
+
return w(() => {
|
|
38
37
|
!t && (o != null && o.isPrivate) && n();
|
|
39
|
-
}, [t, o, n]),
|
|
38
|
+
}, [t, o, n]), w(() => {
|
|
40
39
|
const e = (s) => {
|
|
41
40
|
s.key === "Escape" && a();
|
|
42
41
|
};
|
|
43
42
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
44
|
-
}, [a]), /* @__PURE__ */
|
|
45
|
-
|
|
46
|
-
o && /* @__PURE__ */
|
|
47
|
-
] })
|
|
48
|
-
}),
|
|
43
|
+
}, [a]), /* @__PURE__ */ E(S.Provider, { value: k, children: [
|
|
44
|
+
p,
|
|
45
|
+
o && /* @__PURE__ */ b(I, { modal: o, isClosing: r, onClose: a })
|
|
46
|
+
] });
|
|
47
|
+
}), K = g;
|
|
49
48
|
export {
|
|
50
|
-
|
|
49
|
+
K as default
|
|
51
50
|
};
|
|
52
51
|
//# sourceMappingURL=modal-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-provider.js","sources":["../../../../src/features/ui/modals/modal-provider.tsx"],"sourcesContent":["import type { IModal, IModalCallbacks, IModalContext, IModalProviderProps } from './modal-types';\nimport type { FC } from 'react';\n\nimport { memo,
|
|
1
|
+
{"version":3,"file":"modal-provider.js","sources":["../../../../src/features/ui/modals/modal-provider.tsx"],"sourcesContent":["import type { IModal, IModalCallbacks, IModalContext, IModalProviderProps } from './modal-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport Modal from './modal';\nimport ModalContext from './modal-context';\nimport { lockScroll, unlockScroll } from './modal-helpers';\n\nconst ANIMATION_DURATION_MS = 500; // Match the animation duration in modal.tsx\n\n/**\n * Provider component that manages modal state and provides modal context to child components\n */\nconst ModalProvider: FC<IModalProviderProps> = memo(({ children, modals, isUserAuthenticated }) => {\n const [modal, setModal] = useState<IModal | null>(null);\n const [modalParams, setModalParams] = useState<Record<string, unknown> | undefined>(undefined);\n const [isClosing, setIsClosing] = useState(false);\n const callbacksRef = useRef<IModalCallbacks | undefined>(undefined);\n /**\n * Opens a modal by name with optional parameters\n * Handles authentication check for private modals\n */\n const openModal = useCallback<IModalContext['openModal']>(\n (modalName, newModalParams, callbacks) => {\n const newModal = modals.find(m => m.name === modalName);\n\n if (!newModal) {\n throw new Error(`Modal with name \"${modalName}\" not found`);\n }\n\n if (newModal.isPrivate && !isUserAuthenticated) {\n throw new Error(\n `Access violation: Modal \"${modalName}\" is private and user is not authenticated`,\n );\n }\n\n callbacksRef.current = callbacks;\n setIsClosing(false);\n setModal(newModal);\n setModalParams(newModalParams as unknown as Record<string, unknown> | undefined);\n if (document.body.style.overflow !== 'hidden') {\n lockScroll();\n }\n },\n [isUserAuthenticated, modals],\n );\n\n const closeModal = useCallback(() => {\n setIsClosing(true);\n // Wait for the animation to complete before removing the modal\n unlockScroll();\n setTimeout(() => {\n setModal(null);\n setIsClosing(false);\n }, ANIMATION_DURATION_MS);\n }, []);\n\n const modalContent = useMemo<IModalContext>(\n () => ({\n modal,\n modalParams,\n openModal,\n closeModal,\n isClosing,\n }),\n [modal, modalParams, openModal, closeModal, isClosing],\n );\n\n const onModalDismiss = useCallback(() => {\n if (modal?.isDismissable !== false && !isClosing) {\n closeModal();\n if (callbacksRef.current) {\n callbacksRef.current.onCloseModal?.();\n callbacksRef.current.onCloseModal = undefined; // Clear callback reference\n }\n }\n }, [modal, closeModal, isClosing]);\n\n useEffect(() => {\n if (!isUserAuthenticated && modal?.isPrivate) {\n // If the modal is private and user is not authenticated, close it\n closeModal();\n }\n }, [isUserAuthenticated, modal, closeModal]);\n\n // Handle ESC key\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onModalDismiss();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [onModalDismiss]);\n\n return (\n <ModalContext.Provider value={modalContent}>\n {children}\n {modal && <Modal modal={modal} isClosing={isClosing} onClose={onModalDismiss} />}\n </ModalContext.Provider>\n );\n});\n\nexport default ModalProvider;\n"],"names":["ANIMATION_DURATION_MS","ModalProvider","memo","children","modals","isUserAuthenticated","modal","setModal","useState","modalParams","setModalParams","isClosing","setIsClosing","callbacksRef","useRef","openModal","useCallback","modalName","newModalParams","callbacks","newModal","m","lockScroll","closeModal","unlockScroll","modalContent","useMemo","onModalDismiss","_b","_a","useEffect","handleKeyDown","e","jsxs","ModalContext","jsx","Modal","ModalProvider$1"],"mappings":";;;;;AASA,MAAMA,IAAwB,KAKxBC,IAAyCC,EAAK,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,qBAAAC,QAA0B;AACjG,QAAM,CAACC,GAAOC,CAAQ,IAAIC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AmB,EAAU,MAAM;AACV,IAAA,CAACzB,MAAuBC,KAAA,QAAAA,EAAO,cAEtBiB;EAEZ,GAAA,CAAClB,GAAqBC,GAAOiB,CAAU,CAAC,GAG3CO,EAAU,MAAM;AACR,UAAAC,IAAgB,CAACC,MAAqB;AACtC,MAAAA,EAAE,QAAQ,YACGL;IACjB;AAGK,kBAAA,iBAAiB,WAAWI,CAAa,GAEzC,MAAM,OAAO,oBAAoB,WAAWA,CAAa;AAAA,EAAA,GAC/D,CAACJ,CAAc,CAAC,GAGhB,gBAAAM,EAAAC,EAAa,UAAb,EAAsB,OAAOT,GAC3B,UAAA;AAAA,IAAAtB;AAAA,IACAG,KAAU,gBAAA6B,EAAAC,GAAA,EAAM,OAAA9B,GAAc,WAAAK,GAAsB,SAASgB,GAAgB;AAAA,EAChF,EAAA,CAAA;AAEJ,CAAC,GAEDU,IAAepC;"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const t = 792, e = 1008, s = 30, T = 32, n = 28, I = 48,
|
|
1
|
+
const t = 792, e = 1008, s = 30, T = 32, n = 28, I = 48, a = 42, c = 16, E = 56, _ = 0, o = 52, O = { left: 0, top: 56 }, N = [
|
|
2
2
|
"practice-basic-optional",
|
|
3
3
|
"practice-regular-optional",
|
|
4
4
|
"advanced-we-do",
|
|
5
5
|
"advanced-your-turn",
|
|
6
6
|
"advanced-explore",
|
|
7
7
|
"advanced-practice"
|
|
8
|
-
],
|
|
8
|
+
], R = 2e3, S = [
|
|
9
9
|
{ name: "CORRECT", url: "https://static.qumath.in/static/intel-student/cmpress/correct-zap.mp3" },
|
|
10
10
|
{
|
|
11
11
|
name: "INCORRECT",
|
|
12
12
|
url: "https://static.qumath.in/static/intel-student/cmpress/incorrect-zap.mp3"
|
|
13
13
|
}
|
|
14
|
-
],
|
|
14
|
+
], A = [
|
|
15
15
|
{
|
|
16
16
|
name: "VALIDATE",
|
|
17
17
|
url: "https://wmznlejcfq.s3.ap-southeast-1.amazonaws.com/static/intel-student/cmpress/validate-zap.mp3"
|
|
18
18
|
}
|
|
19
|
-
],
|
|
19
|
+
], i = [
|
|
20
20
|
{
|
|
21
21
|
label: "Answered all the questions independently.",
|
|
22
22
|
id: "E"
|
|
@@ -31,21 +31,20 @@ const t = 792, e = 1008, s = 30, T = 32, n = 28, I = 48, E = 42, c = 16, a = 56,
|
|
|
31
31
|
}
|
|
32
32
|
];
|
|
33
33
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
E as ACTION_BAR_HEIGHT,
|
|
35
|
+
R as CLOZE_FORMULA_RESPONSE_LIMIT,
|
|
36
|
+
O as DESMOS_CALC_POSITION,
|
|
37
|
+
i as EXIT_TICKET_RATING_OPTIONS,
|
|
38
38
|
s as INTERSECTION_OBSERVER_THRESHOLD_POINTS,
|
|
39
39
|
T as INTERSECTION_OBSERVER_THROTTLE_TIME,
|
|
40
|
-
|
|
41
|
-
R as OPTIONAL_ITEM_TYPES,
|
|
40
|
+
N as OPTIONAL_ITEM_TYPES,
|
|
42
41
|
c as QUESTIONS_GAP,
|
|
43
42
|
t as QUESTION_WIDTH,
|
|
44
|
-
|
|
43
|
+
o as SIDEBAR_WIDTH,
|
|
45
44
|
e as SPLIT_QUESTION_WIDTH,
|
|
46
45
|
S as SYSTEM_VALIDATION_AUDIO_LIST,
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
A as TEACHER_VALIDATION_AUDIO_LIST,
|
|
47
|
+
a as TOP_NAVIGATION_ARROW_WIDTH,
|
|
49
48
|
I as TOP_NAVIGATION_HEIGHT,
|
|
50
49
|
_ as WORKSHEET_CONTAINER_BORDER_RADIUS,
|
|
51
50
|
n as WORKSHEET_NUDGE_BANNER_HEIGHT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../src/features/worksheet/worksheet/constants.ts"],"sourcesContent":["import type { QUESTIONS_RATING, TItemType } from './worksheet-types';\n\nexport const QUESTION_WIDTH = 792;\nexport const SPLIT_QUESTION_WIDTH = 1008; // 1024 - 16\nexport const INTERSECTION_OBSERVER_THRESHOLD_POINTS = 30;\nexport const INTERSECTION_OBSERVER_THROTTLE_TIME = 32; // in ms, 2 frames\nexport const WORKSHEET_NUDGE_BANNER_HEIGHT = 28;\n\nexport const TOP_NAVIGATION_HEIGHT = 48;\nexport const TOP_NAVIGATION_ARROW_WIDTH = 42;\n\nexport const QUESTIONS_GAP = 16;\nexport const ACTION_BAR_HEIGHT = 56;\nexport const WORKSHEET_CONTAINER_BORDER_RADIUS = 0;\nexport const
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/features/worksheet/worksheet/constants.ts"],"sourcesContent":["import type { QUESTIONS_RATING, TItemType } from './worksheet-types';\n\nexport const QUESTION_WIDTH = 792;\nexport const SPLIT_QUESTION_WIDTH = 1008; // 1024 - 16\nexport const INTERSECTION_OBSERVER_THRESHOLD_POINTS = 30;\nexport const INTERSECTION_OBSERVER_THROTTLE_TIME = 32; // in ms, 2 frames\nexport const WORKSHEET_NUDGE_BANNER_HEIGHT = 28;\n\nexport const TOP_NAVIGATION_HEIGHT = 48;\nexport const TOP_NAVIGATION_ARROW_WIDTH = 42;\n\nexport const QUESTIONS_GAP = 16;\nexport const ACTION_BAR_HEIGHT = 56;\nexport const WORKSHEET_CONTAINER_BORDER_RADIUS = 0;\nexport const SIDEBAR_WIDTH = 52;\n\nexport const DESMOS_CALC_POSITION = { left: 0, top: 56 };\n\nexport const OPTIONAL_ITEM_TYPES: TItemType[] = [\n 'practice-basic-optional',\n 'practice-regular-optional',\n 'advanced-we-do',\n 'advanced-your-turn',\n 'advanced-explore',\n 'advanced-practice',\n];\nexport const CLOZE_FORMULA_RESPONSE_LIMIT = 2000;\n\nexport const SYSTEM_VALIDATION_AUDIO_LIST = [\n { name: 'CORRECT', url: 'https://static.qumath.in/static/intel-student/cmpress/correct-zap.mp3' },\n {\n name: 'INCORRECT',\n url: 'https://static.qumath.in/static/intel-student/cmpress/incorrect-zap.mp3',\n },\n];\nexport const TEACHER_VALIDATION_AUDIO_LIST = [\n {\n name: 'VALIDATE',\n url: 'https://wmznlejcfq.s3.ap-southeast-1.amazonaws.com/static/intel-student/cmpress/validate-zap.mp3',\n },\n];\n\nexport const EXIT_TICKET_RATING_OPTIONS: Array<{\n label: string;\n id: keyof typeof QUESTIONS_RATING;\n}> = [\n {\n label: 'Answered all the questions independently.',\n id: 'E',\n },\n {\n label: 'Needed some help to answer the questions.',\n id: 'S',\n },\n {\n label: 'Needed a lot of help to answer the questions.',\n id: 'H',\n },\n];\n"],"names":["QUESTION_WIDTH","SPLIT_QUESTION_WIDTH","INTERSECTION_OBSERVER_THRESHOLD_POINTS","INTERSECTION_OBSERVER_THROTTLE_TIME","WORKSHEET_NUDGE_BANNER_HEIGHT","TOP_NAVIGATION_HEIGHT","TOP_NAVIGATION_ARROW_WIDTH","QUESTIONS_GAP","ACTION_BAR_HEIGHT","WORKSHEET_CONTAINER_BORDER_RADIUS","SIDEBAR_WIDTH","DESMOS_CALC_POSITION","OPTIONAL_ITEM_TYPES","CLOZE_FORMULA_RESPONSE_LIMIT","SYSTEM_VALIDATION_AUDIO_LIST","TEACHER_VALIDATION_AUDIO_LIST","EXIT_TICKET_RATING_OPTIONS"],"mappings":"AAEO,MAAMA,IAAiB,KACjBC,IAAuB,MACvBC,IAAyC,IACzCC,IAAsC,IACtCC,IAAgC,IAEhCC,IAAwB,IACxBC,IAA6B,IAE7BC,IAAgB,IAChBC,IAAoB,IACpBC,IAAoC,GACpCC,IAAgB,IAEhBC,IAAuB,EAAE,MAAM,GAAG,KAAK,GAAG,GAE1CC,IAAmC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACaC,IAA+B,KAE/BC,IAA+B;AAAA,EAC1C,EAAE,MAAM,WAAW,KAAK,wEAAwE;AAAA,EAChG;AAAA,IACE,MAAM;AAAA,IACN,KAAK;AAAA,EACP;AACF,GACaC,IAAgC;AAAA,EAC3C;AAAA,IACE,MAAM;AAAA,IACN,KAAK;AAAA,EACP;AACF,GAEaC,IAGR;AAAA,EACH;AAAA,IACE,OAAO;AAAA,IACP,IAAI;AAAA,EACN;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,IAAI;AAAA,EACN;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,IAAI;AAAA,EACN;AACF;"}
|