@digabi/exam-engine-core 23.13.6 → 23.13.8-alpha.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.
Files changed (62) hide show
  1. package/dist/__tests__/playwright/exam/AudioAnswer.test.d.ts +2 -0
  2. package/dist/__tests__/playwright/exam/AudioAnswer.test.d.ts.map +1 -0
  3. package/dist/__tests__/playwright/exam/AudioAnswer.test.js +110 -0
  4. package/dist/__tests__/playwright/exam/AudioAnswer.test.js.map +1 -0
  5. package/dist/__tests__/playwright/stories/exam/AudioAnswer.story.d.ts +5 -0
  6. package/dist/__tests__/playwright/stories/exam/AudioAnswer.story.d.ts.map +1 -0
  7. package/dist/__tests__/playwright/stories/exam/AudioAnswer.story.js +15 -0
  8. package/dist/__tests__/playwright/stories/exam/AudioAnswer.story.js.map +1 -0
  9. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  10. package/dist/components/exam/internal/MyAudioRecorder.d.ts +10 -0
  11. package/dist/components/exam/internal/MyAudioRecorder.d.ts.map +1 -0
  12. package/dist/components/exam/internal/MyAudioRecorder.js +106 -0
  13. package/dist/components/exam/internal/MyAudioRecorder.js.map +1 -0
  14. package/dist/components/exam/internal/MyMediaRecorder.d.ts +10 -0
  15. package/dist/components/exam/internal/MyMediaRecorder.d.ts.map +1 -0
  16. package/dist/components/exam/internal/MyMediaRecorder.js +91 -0
  17. package/dist/components/exam/internal/MyMediaRecorder.js.map +1 -0
  18. package/dist/components/shared/internal/AudioErrorRemoveMe.d.ts +8 -0
  19. package/dist/components/shared/internal/AudioErrorRemoveMe.d.ts.map +1 -0
  20. package/dist/components/shared/internal/AudioErrorRemoveMe.js +17 -0
  21. package/dist/components/shared/internal/AudioErrorRemoveMe.js.map +1 -0
  22. package/dist/main-bundle.js +2 -2
  23. package/package.json +2 -2
  24. package/dist/__tests__/annotations.test.d.ts +0 -2
  25. package/dist/__tests__/annotations.test.d.ts.map +0 -1
  26. package/dist/__tests__/annotations.test.js +0 -217
  27. package/dist/__tests__/annotations.test.js.map +0 -1
  28. package/dist/assets/NotoMono.ttf +0 -0
  29. package/dist/assets/NotoSans-Bold.ttf +0 -0
  30. package/dist/assets/NotoSans-BoldItalic.ttf +0 -0
  31. package/dist/assets/NotoSans-Italic.ttf +0 -0
  32. package/dist/assets/NotoSans-Light.ttf +0 -0
  33. package/dist/assets/NotoSans-LightItalic.ttf +0 -0
  34. package/dist/assets/NotoSans-Regular.ttf +0 -0
  35. package/dist/assets/NotoSans-SemiBold.ttf +0 -0
  36. package/dist/assets/NotoSans-SemiBoldItalic.ttf +0 -0
  37. package/dist/assets/closeButton.svg +0 -1
  38. package/dist/assets/collapse.svg +0 -12
  39. package/dist/assets/expand.svg +0 -12
  40. package/dist/assets/helpButton.svg +0 -9
  41. package/dist/assets/redoButton.svg +0 -5
  42. package/dist/assets/undoButton.svg +0 -5
  43. package/dist/components/exam/ExamineExam.d.ts +0 -5
  44. package/dist/components/exam/ExamineExam.d.ts.map +0 -1
  45. package/dist/components/exam/ExamineExam.js +0 -20
  46. package/dist/components/exam/ExamineExam.js.map +0 -1
  47. package/dist/components/grading/examAnnotationUtils.d.ts +0 -4
  48. package/dist/components/grading/examAnnotationUtils.d.ts.map +0 -1
  49. package/dist/components/grading/examAnnotationUtils.js +0 -51
  50. package/dist/components/grading/examAnnotationUtils.js.map +0 -1
  51. package/dist/components/shared/AnnotatableText.d.ts +0 -7
  52. package/dist/components/shared/AnnotatableText.d.ts.map +0 -1
  53. package/dist/components/shared/AnnotatableText.js +0 -73
  54. package/dist/components/shared/AnnotatableText.js.map +0 -1
  55. package/dist/components/shared/AnnotationPopup.d.ts +0 -3
  56. package/dist/components/shared/AnnotationPopup.d.ts.map +0 -1
  57. package/dist/components/shared/AnnotationPopup.js +0 -74
  58. package/dist/components/shared/AnnotationPopup.js.map +0 -1
  59. package/dist/components/surround.d.ts +0 -8
  60. package/dist/components/surround.d.ts.map +0 -1
  61. package/dist/components/surround.js +0 -19
  62. package/dist/components/surround.js.map +0 -1
@@ -1,74 +0,0 @@
1
- import React, { useContext, useEffect, useState } from 'react';
2
- import { makeRichText } from 'rich-text-editor';
3
- import { AnnotationContext } from '../context/AnnotationProvider';
4
- export function AnnotationPopup() {
5
- const popupRef = React.createRef();
6
- const textAreaRef = React.createRef();
7
- const { newAnnotation, setNewAnnotation, newAnnotationRef, onSaveAnnotation } = useContext(AnnotationContext);
8
- const [comment, setComment] = useState('');
9
- const [saveEnabled, setSaveEnabled] = useState(false);
10
- useEffect(() => {
11
- if (newAnnotationRef && textAreaRef.current) {
12
- showAndPositionElement(newAnnotationRef, popupRef);
13
- textAreaRef.current.innerHTML = comment;
14
- makeRichText(textAreaRef.current, {
15
- locale: 'FI',
16
- screenshotSaver: () => Promise.resolve('')
17
- }, value => {
18
- setComment(value.answerHTML);
19
- setSaveEnabled(value.answerHTML.trim().length > 0);
20
- });
21
- textAreaRef.current.focus();
22
- }
23
- }, [newAnnotationRef]);
24
- if (!newAnnotation) {
25
- if (comment) {
26
- setComment('');
27
- }
28
- return null;
29
- }
30
- const closeEditor = () => {
31
- setNewAnnotation(null);
32
- closeMathEditor(textAreaRef.current);
33
- };
34
- function updateComment(annotation, comment) {
35
- onSaveAnnotation({ ...annotation, message: comment });
36
- closeEditor();
37
- }
38
- return (React.createElement("div", { className: "annotation-popup", style: { position: 'absolute', opacity: 0 }, ref: popupRef, "data-testid": "annotation-popup" },
39
- React.createElement("div", { className: "comment-content", "data-testid": "edit-comment", role: "textbox", "aria-multiline": "true", ref: textAreaRef }),
40
- React.createElement("span", { className: "comment-button-area" },
41
- React.createElement("span", null,
42
- React.createElement("button", { className: "button", onClick: e => {
43
- e.stopPropagation();
44
- closeMathEditor(textAreaRef.current);
45
- updateComment(newAnnotation, comment);
46
- }, "data-testid": "save-comment", disabled: !saveEnabled }, "Vastaa"),
47
- React.createElement("button", { className: "button text-button", onClick: closeEditor }, "Peru")))));
48
- }
49
- function showAndPositionElement(mark, popupRef) {
50
- const popup = popupRef.current;
51
- if (mark && popup) {
52
- const style = popup.style;
53
- const markRect = mark === null || mark === void 0 ? void 0 : mark.getBoundingClientRect();
54
- const popupRect = popup.getBoundingClientRect();
55
- const top = markRect.height + markRect.top + window.scrollY;
56
- const windowWidth = window.innerWidth;
57
- style.top = `${String(top)}px`;
58
- style.opacity = '1';
59
- const popupHitsWindowRight = markRect.left + popupRect.width > windowWidth;
60
- if (popupHitsWindowRight) {
61
- style.left = `${markRect.right - popupRect.width}px`;
62
- }
63
- else {
64
- style.left = `${markRect.left}px`;
65
- }
66
- }
67
- }
68
- function closeMathEditor(element) {
69
- // rich-text-editor does not properly support several rich-text-editor instances created at different times.
70
- // In order to close math editor that is open, we need to dispatch events like this.
71
- element.dispatchEvent(new Event('focus', { bubbles: true, cancelable: true }));
72
- element.dispatchEvent(new Event('blur', { bubbles: true, cancelable: true }));
73
- }
74
- //# sourceMappingURL=AnnotationPopup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationPopup.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEjE,MAAM,UAAU,eAAe;IAC7B,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAA;IAClD,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAA;IACrD,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC7G,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAA;IAClD,MAAM,CAAC,WAAW,EAAE,cA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CAAC,KAAK,GAAG,WAAW,CAAA;QAE1E,IAAI,oBAAoB,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,CAAA;QACtD,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,IAAI,CAAA;QACnC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,OAAuB;IAC9C,4GAA4G;IAC5G,oFAAoF;IACpF,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC9E,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC/E,CAAC"}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { ExamComponentProps } from '../createRenderChildNodes';
3
- /** Surrounds an Exam component with a static HTML element.
4
- *
5
- * @example surround(Question, 'div', {className: 'foobar'})
6
- */
7
- export default function surround<K extends keyof JSX.IntrinsicElements>(Component: React.ComponentType<ExamComponentProps>, Tag: K, props?: JSX.IntrinsicElements[K]): React.ComponentType<ExamComponentProps>;
8
- //# sourceMappingURL=surround.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"surround.d.ts","sourceRoot":"","sources":["../../src/components/surround.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,EACpE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAClD,GAAG,EAAE,CAAC,EACN,KAAK,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAC/B,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAczC"}
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { getDisplayName } from '../getDisplayName';
3
- /** Surrounds an Exam component with a static HTML element.
4
- *
5
- * @example surround(Question, 'div', {className: 'foobar'})
6
- */
7
- export default function surround(Component, Tag, props) {
8
- const Wrapped = (componentProps) => {
9
- // Can't seem to be able to limit the type to HTML elements that accept children.
10
- // So as a hack, type them as any inside the function to make the compiler happy.
11
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
12
- const TagAsAny = Tag;
13
- return (React.createElement(TagAsAny, { ...props },
14
- React.createElement(Component, { ...componentProps })));
15
- };
16
- Wrapped.displayName = `Surround(${getDisplayName(Component)})`;
17
- return Wrapped;
18
- }
19
- //# sourceMappingURL=surround.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"surround.js","sourceRoot":"","sources":["../../src/components/surround.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGlD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,SAAkD,EAClD,GAAM,EACN,KAAgC;IAEhC,MAAM,OAAO,GAAG,CAAC,cAAkC,EAAE,EAAE;QACrD,iFAAiF;QACjF,iFAAiF;QACjF,mEAAmE;QACnE,MAAM,QAAQ,GAAG,GAAU,CAAA;QAC3B,OAAO,CACL,oBAAC,QAAQ,OAAK,KAAK;YACjB,oBAAC,SAAS,OAAK,cAAc,GAAI,CACxB,CACZ,CAAA;IACH,CAAC,CAAA;IACD,OAAO,CAAC,WAAW,GAAG,YAAY,cAAc,CAAC,SAAS,CAAC,GAAG,CAAA;IAC9D,OAAO,OAAO,CAAA;AAChB,CAAC"}