@digabi/exam-engine-core 23.8.1 → 23.8.2-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 (180) hide show
  1. package/dist/__tests__/examServerApi.d.ts.map +1 -1
  2. package/dist/__tests__/examServerApi.js +2 -0
  3. package/dist/__tests__/examServerApi.js.map +1 -1
  4. package/dist/__tests__/playwright/exam/Exam.test.js +17 -18
  5. package/dist/__tests__/playwright/exam/Exam.test.js.map +1 -1
  6. package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts +1 -5
  7. package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts.map +1 -1
  8. package/dist/__tests__/playwright/stories/exam/Exam.story.js +7 -45
  9. package/dist/__tests__/playwright/stories/exam/Exam.story.js.map +1 -1
  10. package/dist/__tests__/playwright/utils/utils.d.ts +1 -1
  11. package/dist/__tests__/playwright/utils/utils.d.ts.map +1 -1
  12. package/dist/__tests__/playwright/utils/utils.js +2 -2
  13. package/dist/__tests__/playwright/utils/utils.js.map +1 -1
  14. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  15. package/dist/components/context/QuestionContext.d.ts.map +1 -1
  16. package/dist/components/context/QuestionContext.js +1 -1
  17. package/dist/components/context/QuestionContext.js.map +1 -1
  18. package/dist/components/exam/AudioAnswer.d.ts +7 -0
  19. package/dist/components/exam/AudioAnswer.d.ts.map +1 -0
  20. package/dist/components/exam/AudioAnswer.js +79 -0
  21. package/dist/components/exam/AudioAnswer.js.map +1 -0
  22. package/dist/components/exam/AudioAnswerRecorder.d.ts +10 -0
  23. package/dist/components/exam/AudioAnswerRecorder.d.ts.map +1 -0
  24. package/dist/components/exam/AudioAnswerRecorder.js +28 -0
  25. package/dist/components/exam/AudioAnswerRecorder.js.map +1 -0
  26. package/dist/components/exam/Exam.d.ts.map +1 -1
  27. package/dist/components/exam/Exam.js +13 -2
  28. package/dist/components/exam/Exam.js.map +1 -1
  29. package/dist/components/exam/OralAnswer.d.ts +6 -0
  30. package/dist/components/exam/OralAnswer.d.ts.map +1 -0
  31. package/dist/components/exam/OralAnswer.js +18 -0
  32. package/dist/components/exam/OralAnswer.js.map +1 -0
  33. package/dist/components/grading/GradingAnswer.d.ts +2 -6
  34. package/dist/components/grading/GradingAnswer.d.ts.map +1 -1
  35. package/dist/components/grading/GradingAnswer.js +4 -3
  36. package/dist/components/grading/GradingAnswer.js.map +1 -1
  37. package/dist/components/results/AudioAnswer.d.ts +6 -0
  38. package/dist/components/results/AudioAnswer.d.ts.map +1 -0
  39. package/dist/components/results/AudioAnswer.js +29 -0
  40. package/dist/components/results/AudioAnswer.js.map +1 -0
  41. package/dist/components/results/Results.d.ts.map +1 -1
  42. package/dist/components/results/Results.js +3 -1
  43. package/dist/components/results/Results.js.map +1 -1
  44. package/dist/components/shared/internal/AudioError.d.ts +8 -0
  45. package/dist/components/shared/internal/AudioError.d.ts.map +1 -0
  46. package/dist/components/shared/internal/AudioError.js +17 -0
  47. package/dist/components/shared/internal/AudioError.js.map +1 -0
  48. package/dist/components/shared/internal/AudioRecordingError.d.ts +8 -0
  49. package/dist/components/shared/internal/AudioRecordingError.d.ts.map +1 -0
  50. package/dist/components/shared/internal/AudioRecordingError.js +17 -0
  51. package/dist/components/shared/internal/AudioRecordingError.js.map +1 -0
  52. package/dist/dom-utils.js +1 -1
  53. package/dist/dom-utils.js.map +1 -1
  54. package/dist/i18n/fi-FI.d.ts +4 -0
  55. package/dist/i18n/fi-FI.d.ts.map +1 -1
  56. package/dist/i18n/fi-FI.js +4 -0
  57. package/dist/i18n/fi-FI.js.map +1 -1
  58. package/dist/i18n/sv-FI.d.ts.map +1 -1
  59. package/dist/i18n/sv-FI.js +4 -0
  60. package/dist/i18n/sv-FI.js.map +1 -1
  61. package/dist/index.d.ts +1 -1
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/main-bundle.js +13 -13
  64. package/dist/main-bundle.js.LICENSE.txt +7 -0
  65. package/dist/main.css +1 -1
  66. package/dist/node_modules_music-metadata_lib_aiff_AiffParser_js.main-bundle.js +33 -0
  67. package/dist/node_modules_music-metadata_lib_dsdiff_DsdiffParser_js.main-bundle.js +26 -0
  68. package/dist/node_modules_music-metadata_lib_dsf_DsfParser_js.main-bundle.js +33 -0
  69. package/dist/node_modules_music-metadata_lib_wavpack_WavPackParser_js.main-bundle.js +26 -0
  70. package/dist/parser/parseExamStructure.d.ts +8 -1
  71. package/dist/parser/parseExamStructure.d.ts.map +1 -1
  72. package/dist/parser/parseExamStructure.js +1 -1
  73. package/dist/parser/parseExamStructure.js.map +1 -1
  74. package/dist/types/ExamAnswer.d.ts +5 -1
  75. package/dist/types/ExamAnswer.d.ts.map +1 -1
  76. package/dist/types/ExamServerAPI.d.ts +4 -0
  77. package/dist/types/ExamServerAPI.d.ts.map +1 -1
  78. package/dist/types/GradingStructure.d.ts +7 -1
  79. package/dist/types/GradingStructure.d.ts.map +1 -1
  80. package/dist/validateAnswers.d.ts.map +1 -1
  81. package/dist/validateAnswers.js +1 -0
  82. package/dist/validateAnswers.js.map +1 -1
  83. package/dist/vendors-node_modules_music-metadata_lib_asf_AsfParser_js.main-bundle.js +40 -0
  84. package/dist/vendors-node_modules_music-metadata_lib_flac_FlacParser_js.main-bundle.js +47 -0
  85. package/dist/vendors-node_modules_music-metadata_lib_id3v2_ID3v2Parser_js.main-bundle.js +26 -0
  86. package/dist/vendors-node_modules_music-metadata_lib_matroska_MatroskaParser_js.main-bundle.js +40 -0
  87. package/dist/vendors-node_modules_music-metadata_lib_mp4_MP4Parser_js.main-bundle.js +33 -0
  88. package/dist/vendors-node_modules_music-metadata_lib_mpeg_MpegParser_js.main-bundle.js +47 -0
  89. package/dist/vendors-node_modules_music-metadata_lib_musepack_MusepackParser_js.main-bundle.js +68 -0
  90. package/dist/vendors-node_modules_music-metadata_lib_ogg_OggParser_js.main-bundle.js +82 -0
  91. package/dist/vendors-node_modules_music-metadata_lib_wav_WaveParser_js.main-bundle.js +40 -0
  92. package/package.json +4 -3
  93. package/dist/__tests__/annotations.test.d.ts +0 -2
  94. package/dist/__tests__/annotations.test.d.ts.map +0 -1
  95. package/dist/__tests__/annotations.test.js +0 -306
  96. package/dist/__tests__/annotations.test.js.map +0 -1
  97. package/dist/__tests__/playwright/Annotations.test.d.ts +0 -2
  98. package/dist/__tests__/playwright/Annotations.test.d.ts.map +0 -1
  99. package/dist/__tests__/playwright/Annotations.test.js +0 -201
  100. package/dist/__tests__/playwright/Annotations.test.js.map +0 -1
  101. package/dist/__tests__/playwright/attachments/Attachments.test.d.ts +0 -2
  102. package/dist/__tests__/playwright/attachments/Attachments.test.d.ts.map +0 -1
  103. package/dist/__tests__/playwright/attachments/Attachments.test.js +0 -30
  104. package/dist/__tests__/playwright/attachments/Attachments.test.js.map +0 -1
  105. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.d.ts +0 -2
  106. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.d.ts.map +0 -1
  107. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js +0 -30
  108. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js.map +0 -1
  109. package/dist/__tests__/playwright/stories/Annotations.story.d.ts +0 -15
  110. package/dist/__tests__/playwright/stories/Annotations.story.d.ts.map +0 -1
  111. package/dist/__tests__/playwright/stories/Annotations.story.js +0 -27
  112. package/dist/__tests__/playwright/stories/Annotations.story.js.map +0 -1
  113. package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts +0 -13
  114. package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts.map +0 -1
  115. package/dist/__tests__/playwright/stories/attachments/Attachments.story.js +0 -17
  116. package/dist/__tests__/playwright/stories/attachments/Attachments.story.js.map +0 -1
  117. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts +0 -13
  118. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts.map +0 -1
  119. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.js +0 -16
  120. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.js.map +0 -1
  121. package/dist/assets/closeButton.svg +0 -1
  122. package/dist/assets/collapse.svg +0 -12
  123. package/dist/assets/expand.svg +0 -12
  124. package/dist/assets/helpButton.svg +0 -9
  125. package/dist/assets/redoButton.svg +0 -5
  126. package/dist/assets/undoButton.svg +0 -5
  127. package/dist/components/grading/examAnnotationUtils.d.ts +0 -4
  128. package/dist/components/grading/examAnnotationUtils.d.ts.map +0 -1
  129. package/dist/components/grading/examAnnotationUtils.js +0 -123
  130. package/dist/components/grading/examAnnotationUtils.js.map +0 -1
  131. package/dist/components/results/DNDAnswerContainer.d.ts +0 -4
  132. package/dist/components/results/DNDAnswerContainer.d.ts.map +0 -1
  133. package/dist/components/results/DNDAnswerContainer.js +0 -22
  134. package/dist/components/results/DNDAnswerContainer.js.map +0 -1
  135. package/dist/components/shared/AnnotatableText.d.ts +0 -5
  136. package/dist/components/shared/AnnotatableText.d.ts.map +0 -1
  137. package/dist/components/shared/AnnotatableText.js +0 -25
  138. package/dist/components/shared/AnnotatableText.js.map +0 -1
  139. package/dist/components/shared/AnnotationImageMark.d.ts +0 -16
  140. package/dist/components/shared/AnnotationImageMark.d.ts.map +0 -1
  141. package/dist/components/shared/AnnotationImageMark.js +0 -99
  142. package/dist/components/shared/AnnotationImageMark.js.map +0 -1
  143. package/dist/components/shared/AnnotationMark.d.ts +0 -9
  144. package/dist/components/shared/AnnotationMark.d.ts.map +0 -1
  145. package/dist/components/shared/AnnotationMark.js +0 -14
  146. package/dist/components/shared/AnnotationMark.js.map +0 -1
  147. package/dist/components/shared/AnnotationPopup.d.ts +0 -3
  148. package/dist/components/shared/AnnotationPopup.d.ts.map +0 -1
  149. package/dist/components/shared/AnnotationPopup.js +0 -24
  150. package/dist/components/shared/AnnotationPopup.js.map +0 -1
  151. package/dist/components/shared/AnnotationTextMark.d.ts +0 -11
  152. package/dist/components/shared/AnnotationTextMark.d.ts.map +0 -1
  153. package/dist/components/shared/AnnotationTextMark.js +0 -21
  154. package/dist/components/shared/AnnotationTextMark.js.map +0 -1
  155. package/dist/components/shared/markText.d.ts +0 -6
  156. package/dist/components/shared/markText.d.ts.map +0 -1
  157. package/dist/components/shared/markText.js +0 -77
  158. package/dist/components/shared/markText.js.map +0 -1
  159. package/dist/eslint.config.d.ts +0 -22
  160. package/dist/eslint.config.d.ts.map +0 -1
  161. package/dist/eslint.config.js +0 -31
  162. package/dist/eslint.config.js.map +0 -1
  163. package/dist/i18n/exam_titles_fi-FI.d.ts +0 -46
  164. package/dist/i18n/exam_titles_fi-FI.d.ts.map +0 -1
  165. package/dist/i18n/exam_titles_fi-FI.js +0 -46
  166. package/dist/i18n/exam_titles_fi-FI.js.map +0 -1
  167. package/dist/i18n/exam_titles_fi-FI.json +0 -45
  168. package/dist/i18n/exam_titles_sv-FI.d.ts +0 -46
  169. package/dist/i18n/exam_titles_sv-FI.d.ts.map +0 -1
  170. package/dist/i18n/exam_titles_sv-FI.js +0 -46
  171. package/dist/i18n/exam_titles_sv-FI.js.map +0 -1
  172. package/dist/i18n/exam_titles_sv-FI.json +0 -45
  173. package/dist/i18n/exams.d.ts +0 -11
  174. package/dist/i18n/exams.d.ts.map +0 -1
  175. package/dist/i18n/exams.js +0 -10
  176. package/dist/i18n/exams.js.map +0 -1
  177. package/dist/types/ExamAnnotations.d.ts +0 -46
  178. package/dist/types/ExamAnnotations.d.ts.map +0 -1
  179. package/dist/types/ExamAnnotations.js +0 -2
  180. package/dist/types/ExamAnnotations.js.map +0 -1
@@ -1,123 +0,0 @@
1
- import { textAnnotationFromRange } from './editAnnotations';
2
- export function onMouseDownForAnnotation(e, mouseUpCallback) {
3
- function onMouseUpAfterAnswerMouseDown() {
4
- var _a, _b;
5
- window.removeEventListener('mouseup', onMouseUpAfterAnswerMouseDown);
6
- /**
7
- * selection.anchorNode = where mouse is pressed down (chronologically first)
8
- * selection.getRangeAt(0).startContainer = where selection starts (first in DOM)
9
- */
10
- const selection = window.getSelection();
11
- const initialStartNode = (_a = selection === null || selection === void 0 ? void 0 : selection.anchorNode) === null || _a === void 0 ? void 0 : _a.parentElement;
12
- const initialEndNode = (_b = selection === null || selection === void 0 ? void 0 : selection.focusNode) === null || _b === void 0 ? void 0 : _b.parentElement;
13
- if (selection && initialStartNode && initialEndNode && selection.toString().length > 0) {
14
- const isReversed = initialStartNode.compareDocumentPosition(initialEndNode) & Node.DOCUMENT_POSITION_PRECEDING;
15
- const startNode = findAnnotatableNode(initialStartNode, isReversed ? 'previousElementSibling' : 'nextElementSibling');
16
- const endNode = findAnnotatableNode(initialEndNode, isReversed ? 'nextElementSibling' : 'previousElementSibling');
17
- const hasMarks = selectionContainsNonhiddenMarks(selection);
18
- const startNodedisplayNumber = getDisplayNumber(startNode);
19
- const endNodeDisplayNumber = getDisplayNumber(endNode);
20
- if (startNodedisplayNumber === endNodeDisplayNumber &&
21
- isAnnotatable(startNode) &&
22
- isAnnotatable(endNode) &&
23
- !hasMarks) {
24
- const annotations = extractAnnotationsFromSelection(selection);
25
- mouseUpCallback({
26
- annotationType: 'text',
27
- annotationParts: annotations,
28
- displayNumber: startNodedisplayNumber !== null && startNodedisplayNumber !== void 0 ? startNodedisplayNumber : '',
29
- selectedText: annotations.map(a => a.selectedText).join(' ')
30
- });
31
- }
32
- }
33
- }
34
- // Do annotations only with left mouse buttons
35
- if (e.button !== 0) {
36
- return;
37
- }
38
- window.addEventListener('mouseup', onMouseUpAfterAnswerMouseDown);
39
- }
40
- const findAnnotatableNode = (node, siblingDirection) => {
41
- if (node.matches('.e-annotatable')) {
42
- return node;
43
- }
44
- const sibling = node[siblingDirection];
45
- if (sibling instanceof HTMLElement) {
46
- if (sibling.matches('.e-annotatable')) {
47
- return sibling;
48
- }
49
- return sibling.querySelector('.e-annotatable') || findAnnotatableNode(sibling, siblingDirection);
50
- }
51
- return node;
52
- };
53
- const selectionContainsNonhiddenMarks = (selection) => {
54
- const rangeChildren = Array.from(selection === null || selection === void 0 ? void 0 : selection.getRangeAt(0).cloneContents().children);
55
- const childIsNonHiddenMark = rangeChildren === null || rangeChildren === void 0 ? void 0 : rangeChildren.some(child => child.tagName === 'MARK' && child.getAttribute('data-hidden') === 'false');
56
- const childContainsNonHiddenMark = rangeChildren.some(child => child.querySelector('mark[data-hidden="false"]'));
57
- return childIsNonHiddenMark || childContainsNonHiddenMark;
58
- };
59
- const getDisplayNumber = (node) => { var _a; return (_a = node === null || node === void 0 ? void 0 : node.closest('[data-annotation-anchor]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-annotation-anchor'); };
60
- const isAnnotatable = (node) => (node === null || node === void 0 ? void 0 : node.getAttribute('data-annotation-path')) && node.tagName !== 'MARK';
61
- const extractAnnotationsFromSelection = (selection) => {
62
- var _a, _b;
63
- const range = selection.getRangeAt(0);
64
- const rangeChildren = Array.from(selection === null || selection === void 0 ? void 0 : selection.getRangeAt(0).cloneContents().children);
65
- const firstSelectedNodeInDOM = range.startContainer.parentElement;
66
- if (!(rangeChildren === null || rangeChildren === void 0 ? void 0 : rangeChildren.length)) {
67
- // selection is plain text
68
- const annotationAnchor = (_b = (_a = selection === null || selection === void 0 ? void 0 : selection.focusNode) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.getAttribute('data-annotation-path');
69
- const startAndLength = textAnnotationFromRange(firstSelectedNodeInDOM, range);
70
- return [
71
- {
72
- annotationAnchor,
73
- selectedText: (selection === null || selection === void 0 ? void 0 : selection.toString()) || '',
74
- startIndex: (startAndLength === null || startAndLength === void 0 ? void 0 : startAndLength.startIndex) || 0,
75
- length: (startAndLength === null || startAndLength === void 0 ? void 0 : startAndLength.length) || 0
76
- }
77
- ];
78
- }
79
- else {
80
- // selection is in multiple elements
81
- const annotations = rangeChildren === null || rangeChildren === void 0 ? void 0 : rangeChildren.reduce((acc, child, index, arr) => {
82
- var _a;
83
- const childsAnnotationPath = child.getAttribute('data-annotation-path');
84
- const isLastRangeChild = index === arr.length - 1;
85
- if (childsAnnotationPath) {
86
- // child is an annotable node, like <span> text </span>
87
- const textContent = (_a = child.textContent) !== null && _a !== void 0 ? _a : '';
88
- const newElement = {
89
- annotationAnchor: childsAnnotationPath,
90
- selectedText: textContent,
91
- startIndex: index === 0 ? range.startOffset : 0,
92
- length: isLastRangeChild ? range.endOffset : textContent.length
93
- };
94
- return [...acc, newElement];
95
- }
96
- else {
97
- // child is a node with children, like <b> <span> text </span> </b>
98
- const allChildrenWithAnnotationPath = child.querySelectorAll('[data-annotation-path]');
99
- allChildrenWithAnnotationPath === null || allChildrenWithAnnotationPath === void 0 ? void 0 : allChildrenWithAnnotationPath.forEach((grandChild, kidIndex) => {
100
- var _a;
101
- const dataAnnotationPath = grandChild.getAttribute('data-annotation-path');
102
- const textContent = (_a = grandChild.textContent) !== null && _a !== void 0 ? _a : '';
103
- if (dataAnnotationPath) {
104
- const isFirstOfAll = index === 0 && kidIndex === 0;
105
- const isLastGrandChild = kidIndex === allChildrenWithAnnotationPath.length - 1;
106
- const isLastOfAll = isLastRangeChild && isLastGrandChild;
107
- const startAndLength = textAnnotationFromRange(firstSelectedNodeInDOM, range);
108
- const newElement = {
109
- annotationAnchor: dataAnnotationPath,
110
- selectedText: textContent,
111
- startIndex: isFirstOfAll ? (startAndLength === null || startAndLength === void 0 ? void 0 : startAndLength.startIndex) || 0 : 0,
112
- length: isLastOfAll ? range.endOffset : textContent.length
113
- };
114
- acc.push(newElement);
115
- }
116
- });
117
- return acc;
118
- }
119
- }, []);
120
- return annotations;
121
- }
122
- };
123
- //# sourceMappingURL=examAnnotationUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"examAnnotationUtils.js","sourceRoot":"","sources":["../../../src/components/grading/examAnnotationUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,UAAU,wBAAwB,CAAC,CAAmB,EAAE,eAA+C;IAC3G,SAAS,6BAA6B;;QACpC,MAAM,CAAC,mBA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6BAA6B,CAAE,OAAO,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;;oBAC9D,MAAM,kBAAkB,GAAG,UAAU,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAA;oBAC1E,MAAM,WAAW,GAAG,MAAA,UAAU,CAAC,WAAW,mCAAI,EAAE,CAAA;oBAChD,IAAI,kBAAkB,EAAE,CAAC;wBACvB,MAAM,YAAY,GAAG,KAAK,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAA;wBAClD,MAAM,gBAAgB,GAAG,QAAQ,KAAK,6BAA6B,CAAC,MAAM,GAAG,CAAC,CAAA;wBAC9E,MAAM,WAAW,GAAG,gBAAgB,IAAI,gBAAgB,CAAA;wBACxD,MAAM,cAAc,GAAG,uBAAuB,CAAC,sBAAqC,EAAE,KAAK,CAAC,CAAA;wBAC5F,MAAM,UAAU,GAAG;4BACjB,gBAAgB,EAAE,kBAAkB;4BACpC,YAAY,EAAE,WAAW;4BACzB,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,KAAI,CAAC,CAAC,CAAC,CAAC,CAAC;4BAC9D,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM;yBAC3D,CAAA;wBACD,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;oBACtB,CAAC;gBACH,CAAC,CAAC,CAAA;gBACF,OAAO,GAAG,CAAA;YACZ,CAAC;QACH,CAAC,EAAE,EAAsB,CAAC,CAAA;QAE1B,OAAO,WAAW,CAAA;IACpB,CAAC;AACH,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { ExamComponentProps } from '../..';
3
- export declare const DNDAnswerContainer: ({ element, renderChildNodes }: ExamComponentProps) => React.JSX.Element;
4
- //# sourceMappingURL=DNDAnswerContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDAnswerContainer.d.ts","sourceRoot":"","sources":["../../../src/components/results/DNDAnswerContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAO1C,eAAO,MAAM,kBAAkB,kCAAmC,kBAAkB,sBAuCnF,CAAA"}
@@ -1,22 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { query, queryAll } from '../../dom-utils';
3
- import { ResultsContext } from '../context/ResultsContext';
4
- import { getAnswerOptionIdsByQuestionId, getAnswerOptionsByOptionId } from '../exam/DNDAnswerContainer';
5
- import { DNDTitleAndDroppable } from '../shared/DNDTitleAndDroppable';
6
- import { CorrectDNDAnswers } from './CorrectDNDAnswers';
7
- export const DNDAnswerContainer = ({ element, renderChildNodes }) => {
8
- const { answersByQuestionId, gradingStructure } = useContext(ResultsContext);
9
- const answerOptionIdsByQuestionId = getAnswerOptionIdsByQuestionId(element, answersByQuestionId);
10
- const answerOptionsByOptionId = getAnswerOptionsByOptionId(element);
11
- const dndAnswersWithQuestion = queryAll(element, 'dnd-answer').filter(e => !!query(e, 'dnd-answer-title'));
12
- return (React.createElement("div", { className: "e-dnd-answer-container" }, dndAnswersWithQuestion.map(element => {
13
- var _a;
14
- const questionId = element.getAttribute('question-id');
15
- const itemIds = answerOptionIdsByQuestionId[questionId] || [];
16
- const answerOptionElements = (_a = (answerOptionIdsByQuestionId[questionId] || [])) === null || _a === void 0 ? void 0 : _a.map(id => (answerOptionsByOptionId === null || answerOptionsByOptionId === void 0 ? void 0 : answerOptionsByOptionId[id]) || null).filter(Boolean);
17
- return (React.createElement(React.Fragment, { key: questionId },
18
- React.createElement(DNDTitleAndDroppable, { key: questionId, element: element, answerOptionElements: answerOptionElements, renderChildNodes: renderChildNodes, itemIds: itemIds, page: "results" }),
19
- gradingStructure && (React.createElement(CorrectDNDAnswers, { key: `${questionId}-correct`, element: element, renderChildNodes: renderChildNodes, answerOptionsById: answerOptionsByOptionId }))));
20
- })));
21
- };
22
- //# sourceMappingURL=DNDAnswerContainer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDAnswerContainer.js","sourceRoot":"","sources":["../../../src/components/results/DNDAnswerContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAsB,EAAE,EAAE;IACtF,MAAM,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAC5E,MAAM,2BAA2B,GAAG,8BAA8B,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAA;IAChG,MAAM,uBAAuB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAA;IACnE,MAAM,sBAAsB,GAAG,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAA;IAE1G,OAAO,CACL,6BAAK,SAAS,EAAC,wBAAwB,IACpC,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;;QACpC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAE,CAAA;QACvD,MAAM,OAAO,GAAG,2BAA2B,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;QAC7D,MAAM,oBAAoB,GAAG,MAAA,CAAC,2BAA2B,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,0CACxE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAG,EAAE,CAAC,KAAI,IAAI,EAChD,MAAM,CAAC,OAAO,CAAC,CAAA;QAElB,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,UAAU;YAC7B,oBAAC,oBAAoB,IACnB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,SAAS,GACd;YAED,gBAAgB,IAAI,CACnB,oBAAC,iBAAiB,IAChB,GAAG,EAAE,GAAG,UAAU,UAAU,EAC5B,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,uBAAuB,GAC1C,CACH,CACc,CAClB,CAAA;IACH,CAAC,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const AnnotatableText: ({ node }: {
3
- node: Node;
4
- }) => string | React.JSX.Element;
5
- //# sourceMappingURL=AnnotatableText.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotatableText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/AnnotatableText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAMzC,eAAO,MAAM,eAAe,aAAc;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,+BA6BvD,CAAA"}
@@ -1,25 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { getElementPath } from '../../dom-utils';
3
- import { AnnotationContext } from '../context/AnnotationProvider';
4
- import { IsInSidebarContext } from '../context/IsInSidebarContext';
5
- import { markText } from './markText';
6
- export const AnnotatableText = ({ node }) => {
7
- var _a, _b;
8
- const annotationContextData = useContext(AnnotationContext);
9
- const { isInSidebar } = useContext(IsInSidebarContext);
10
- const canNotBeAnnotated = !annotationContextData.annotationsEnabled || ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim().length) === 0 || isInSidebar !== undefined;
11
- if (canNotBeAnnotated) {
12
- return node.textContent;
13
- }
14
- const { textAnnotations, onClickAnnotation, setNewAnnotationRef, newAnnotation } = annotationContextData;
15
- const path = getElementPath(node);
16
- const newAnnotationPartsForThisNode = (newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationType) === 'text'
17
- ? ((_b = newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationParts) === null || _b === void 0 ? void 0 : _b.filter(p => p.annotationAnchor === path)) || []
18
- : [];
19
- const savedAnnotationsForThisNode = (textAnnotations === null || textAnnotations === void 0 ? void 0 : textAnnotations[path]) || [];
20
- const allAnnotationsForThisNode = [...savedAnnotationsForThisNode, ...newAnnotationPartsForThisNode];
21
- return (React.createElement("span", { className: "e-annotatable", key: path, "data-annotation-path": path, "data-testid": path }, allAnnotationsForThisNode.length > 0 && onClickAnnotation
22
- ? markText(node.textContent, allAnnotationsForThisNode, onClickAnnotation, setNewAnnotationRef)
23
- : node.textContent));
24
- };
25
- //# sourceMappingURL=AnnotatableText.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotatableText.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotatableText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,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C,QAAQ,CAAC,IAAI,CAAC,WAAY,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,mBAAmB,CAAC;QAChG,CAAC,CAAC,IAAI,CAAC,WAAW,CACf,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { AnnotationRect, NewExamAnnotation, NewExamImageAnnotation } from '../../types/ExamAnnotations';
3
- export declare const AnnotationImageMark: React.NamedExoticComponent<{
4
- rect: NewExamImageAnnotation["rect"];
5
- onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, annotationId: number) => void;
6
- setNewAnnotationRef: (e: HTMLElement | null) => void;
7
- annotationId?: number;
8
- markNumber?: number;
9
- resolved?: boolean;
10
- }>;
11
- export declare function useImageAnnotation(anchor: string, description: string, setNewAnnotation: (a: NewExamAnnotation | null) => void): {
12
- elementRef: React.RefObject<HTMLElement>;
13
- annotationRect: AnnotationRect | undefined;
14
- onMouseDown: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
15
- };
16
- //# sourceMappingURL=AnnotationImageMark.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationImageMark.d.ts","sourceRoot":"","sources":["../../../src/components/shared/AnnotationImageMark.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAGvG,eAAO,MAAM,mBAAmB;UAQxB,sBAAsB,CAAC,MAAM,CAAC;uBACjB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI;yBAC1E,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;mBACrC,MAAM;iBACR,MAAM;eACR,OAAO;EA6ClB,CAAA;AAEF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI;;;qBA4DnB,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC;EAkB9E"}
@@ -1,99 +0,0 @@
1
- import classNames from 'classnames';
2
- import { clamp } from 'lodash-es';
3
- import React, { useCallback, useEffect, useRef, useState } from 'react';
4
- // eslint-disable-next-line prefer-arrow-callback
5
- export const AnnotationImageMark = React.memo(function AnnotationImageMark({ rect: { x1, y1, x2, y2 }, onClickAnnotation, setNewAnnotationRef, annotationId, markNumber, resolved }) {
6
- const markRef = useRef(null);
7
- const supRef = useRef(null);
8
- useEffect(() => {
9
- if (markRef.current) {
10
- markRef.current.style['inset'] =
11
- `${100 * Math.min(y1, y2)}% ${100 * (1 - Math.max(x1, x2))}% ${100 * (1 - Math.max(y1, y2))}% ${100 * Math.min(x1, x2)}%`;
12
- }
13
- if (supRef.current) {
14
- supRef.current.style['left'] = `${100 * Math.max(x1, x2)}%`;
15
- supRef.current.style['top'] = `${100 * Math.min(y1, y2)}%`;
16
- }
17
- }, [x1, y1, x2, y2]);
18
- useEffect(() => {
19
- if (markRef.current && annotationId === undefined) {
20
- setNewAnnotationRef(markRef.current);
21
- }
22
- }, []);
23
- const onMouseDown = useCallback((e) => {
24
- if (annotationId) {
25
- e.stopPropagation();
26
- onClickAnnotation(e, annotationId);
27
- }
28
- }, [annotationId, onClickAnnotation]);
29
- return (React.createElement(React.Fragment, null,
30
- React.createElement("mark", { ref: markRef, className: classNames('e-annotation e-annotation--shape', { resolved }), "data-annotation-id": annotationId, "data-hidden": "false", onMouseDown: onMouseDown }),
31
- markNumber && React.createElement("sup", { ref: supRef, className: "e-annotation", "data-content": markNumber })));
32
- });
33
- export function useImageAnnotation(anchor, description, setNewAnnotation) {
34
- const elementRef = useRef(null);
35
- const [annotationRect, setAnnotationRect] = useState();
36
- const annotationRectRef = useRef();
37
- useEffect(() => {
38
- annotationRectRef.current = annotationRect;
39
- }, [annotationRect]);
40
- const onMouseMove = useCallback((e) => {
41
- const el = elementRef.current;
42
- if (el === null) {
43
- return;
44
- }
45
- e.preventDefault();
46
- e.stopPropagation();
47
- const [x2, y2] = getMousePosition(el, e);
48
- setAnnotationRect(rect => {
49
- if (rect) {
50
- const { x1, y1 } = rect;
51
- return { x1, y1, x2, y2 };
52
- }
53
- return rect;
54
- });
55
- }, []);
56
- const onMouseUp = useCallback((e) => {
57
- var _a, _b;
58
- const el = elementRef.current;
59
- if (el === null) {
60
- return;
61
- }
62
- window.removeEventListener('mouseup', onMouseUp);
63
- window.removeEventListener('mousemove', onMouseMove);
64
- const displayNumber = (_b = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.closest('div[data-annotation-anchor]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-annotation-anchor');
65
- if (!displayNumber || !annotationRectRef.current) {
66
- setAnnotationRect(undefined);
67
- return;
68
- }
69
- const { x1, y1 } = annotationRectRef.current;
70
- const [x2, y2] = getMousePosition(el, e);
71
- setNewAnnotation({
72
- annotationType: 'image',
73
- displayNumber,
74
- annotationAnchor: anchor,
75
- rect: { x1, y1, x2, y2 },
76
- description
77
- });
78
- setAnnotationRect(undefined);
79
- }, []);
80
- const onMouseDown = useCallback((e) => {
81
- const el = elementRef.current;
82
- if (el === null || e.button !== 0) {
83
- return;
84
- }
85
- e.preventDefault();
86
- e.stopPropagation();
87
- window.addEventListener('mouseup', onMouseUp);
88
- window.addEventListener('mousemove', onMouseMove);
89
- const [x1, y1] = getMousePosition(el, e);
90
- setAnnotationRect({ x1, y1, x2: x1, y2: y1 });
91
- setNewAnnotation(null);
92
- }, []);
93
- return { elementRef, annotationRect, onMouseDown };
94
- }
95
- function getMousePosition(el, e) {
96
- const bbox = el.getBoundingClientRect();
97
- return [clamp((e.clientX - bbox.left) / bbox.width, 0, 1), clamp((e.clientY - bbox.top) / bbox.height, 0, 1)];
98
- }
99
- //# sourceMappingURL=AnnotationImageMark.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationImageMark.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotationImageMark.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGvE,iDAAiD;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,mBAAmB,CAAC,EACzE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,QAAQ,EAQT;IACC,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IACzC,MAAM,MAAM,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;gBAC5B,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;QAC7H,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,G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EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,CAAA;AACpD,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAe,EAAE,CAAuC;IAChF,MAAM,IAAI,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAA;IACvC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC/G,CAAC"}
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { NewRenderableAnnotation, RenderableAnnotation } from '../../types/Score';
3
- export declare const AnnotationMark: ({ annotation, markedText, onClickAnnotation, setNewAnnotationRef }: {
4
- annotation: RenderableAnnotation | NewRenderableAnnotation;
5
- markedText: string;
6
- onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, a: RenderableAnnotation) => void;
7
- setNewAnnotationRef: (ref: HTMLElement | null) => void;
8
- }) => React.JSX.Element;
9
- //# sourceMappingURL=AnnotationMark.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationMark.d.ts","sourceRoot":"","sources":["../../../src/components/shared/AnnotationMark.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAGjF,eAAO,MAAM,cAAc,uEAKxB;IACD,UAAU,EAAE,oBAAoB,GAAG,uBAAuB,CAAA;IAC1D,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAClG,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACvD,sBAsBA,CAAA"}
@@ -1,14 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { isExistingAnnotation } from './markText';
3
- export const AnnotationMark = ({ annotation, markedText, onClickAnnotation, setNewAnnotationRef }) => {
4
- const markRef = useRef(null);
5
- useEffect(() => {
6
- if (markRef.current && !isExistingAnnotation(annotation)) {
7
- setNewAnnotationRef(markRef.current);
8
- }
9
- }, []);
10
- return (React.createElement("mark", { ref: markRef, className: `e-annotation ${annotation.resolved ? 'resolved' : ''}`, "data-annotation-id": isExistingAnnotation(annotation) ? annotation.annotationId : '', "data-hidden": "false", "data-annotation-path": annotation.annotationAnchor, onClick: e => (isExistingAnnotation(annotation) ? onClickAnnotation(e, annotation) : undefined) },
11
- markedText,
12
- (annotation === null || annotation === void 0 ? void 0 : annotation.markNumber) && React.createElement("sup", { className: "e-annotation", "data-content": annotation === null || annotation === void 0 ? void 0 : annotation.markNumber })));
13
- };
14
- //# sourceMappingURL=AnnotationMark.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationMark.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotationMark.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EAMpB,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;YACzD,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,8BACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,gBAAgB,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,wBAC9C,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,iBACvE,OAAO,0BACG,UAAU,CAAC,gBAAgB,EACjD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9F,UAAU;QACV,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,6BAAK,SAAS,EAAC,cAAc,kBAAe,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,GAAI,CAC5F,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare function AnnotationPopup(): React.JSX.Element | null;
3
- //# sourceMappingURL=AnnotationPopup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationPopup.d.ts","sourceRoot":"","sources":["../../../src/components/shared/AnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,wBAAgB,eAAe,6BAgC9B"}
@@ -1,24 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { AnnotationContext } from '../context/AnnotationProvider';
3
- import { Popup } from './Popup';
4
- export function AnnotationPopup() {
5
- const annotationContext = useContext(AnnotationContext);
6
- if (!annotationContext.annotationsEnabled ||
7
- !annotationContext.newAnnotation ||
8
- !annotationContext.newAnnotationRef) {
9
- return null;
10
- }
11
- const { newAnnotation, newAnnotationRef, setNewAnnotation, setNewAnnotationRef, onSaveAnnotation } = annotationContext;
12
- return (React.createElement(Popup, { element: newAnnotationRef, initialTextContent: '', onValueSave: async (comment) => {
13
- const error = await onSaveAnnotation(newAnnotation, comment);
14
- if (!error) {
15
- setNewAnnotation(null);
16
- setNewAnnotationRef(null);
17
- }
18
- return error;
19
- }, enableDelete: false, onCancel: () => {
20
- setNewAnnotation(null);
21
- setNewAnnotationRef(null);
22
- } }));
23
- }
24
- //# 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,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,UAAU,eAAe;IAC7B,MAAM,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAEvD,IACE,CAAC,iBAAiB,CAAC,kBAAkB;QACrC,CAAC,iBAAiB,CAAC,aAAa;QAChC,CAAC,iBAAiB,CAAC,gBAAgB,EACnC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,CAAA;IAEtH,OAAO,CACL,oBAAC,KAAK,IACJ,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,EAAE,EACtB,WAAW,EAAE,KAAK,EAAE,OAAe,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;YAC5D,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,gBAAgB,CAAC,IAAI,CAAC,CAAA;gBACtB,mBAAmB,CAAC,IAAI,CAAC,CAAA;YAC3B,CAAC;YACD,OAAO,KAAK,CAAA;QACd,CAAC,EACD,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,GAAG,EAAE;YACb,gBAAgB,CAAC,IAAI,CAAC,CAAA;YACtB,mBAAmB,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC,GACD,CACH,CAAA;AACH,CAAC"}
@@ -1,11 +0,0 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { AnnotationPart } from '../../types/ExamAnnotations';
3
- declare function AnnotationMark({ annotation, onClickAnnotation, setNewAnnotationRef, __html, children }: PropsWithChildren<{
4
- annotation: AnnotationPart;
5
- onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, annotationId: number) => void;
6
- setNewAnnotationRef: (ref: HTMLElement | null) => void;
7
- __html?: string;
8
- }>): React.JSX.Element;
9
- declare const _default: React.MemoExoticComponent<typeof AnnotationMark>;
10
- export default _default;
11
- //# sourceMappingURL=AnnotationTextMark.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationTextMark.d.ts","sourceRoot":"","sources":["../../../src/components/shared/AnnotationTextMark.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAqB,MAAM,OAAO,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAG5D,iBAAS,cAAc,CAAC,EACtB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACT,EAAE,iBAAiB,CAAC;IACnB,UAAU,EAAE,cAAc,CAAA;IAC1B,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/F,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC,qBAgCD;;AAED,wBAAyC"}
@@ -1,21 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { isExistingAnnotation } from './markText';
3
- function AnnotationMark({ annotation, onClickAnnotation, setNewAnnotationRef, __html, children }) {
4
- const markRef = useRef(null);
5
- useEffect(() => {
6
- if (markRef.current && !isExistingAnnotation(annotation)) {
7
- setNewAnnotationRef(markRef.current);
8
- }
9
- }, []);
10
- const dangerouslySetInnerHTML = __html ? { dangerouslySetInnerHTML: { __html } } : {};
11
- return (React.createElement(React.Fragment, null,
12
- React.createElement("mark", { ref: markRef, className: `e-annotation ${annotation.resolved ? 'resolved' : ''}`, "data-annotation-id": isExistingAnnotation(annotation) ? annotation.annotationId : '', "data-hidden": "false", "data-annotation-path": annotation.annotationAnchor, onClick: e => {
13
- if (isExistingAnnotation(annotation)) {
14
- e.stopPropagation();
15
- onClickAnnotation(e, annotation.annotationId);
16
- }
17
- }, ...dangerouslySetInnerHTML }, __html ? null : children),
18
- (annotation === null || annotation === void 0 ? void 0 : annotation.markNumber) && React.createElement("sup", { className: "e-annotation", "data-content": annotation === null || annotation === void 0 ? void 0 : annotation.markNumber })));
19
- }
20
- export default React.memo(AnnotationMark);
21
- //# sourceMappingURL=AnnotationTextMark.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnnotationTextMark.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotationTextMark.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAqB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,SAAS,cAAc,CAAC,EACtB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACN,QAAQ,EAMR;IACA,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;YACzD,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,uBAAuB,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAErF,OAAO,CACL;QACE,8BACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,gBAAgB,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,wBAC9C,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,iBACvE,OAAO,0BACG,UAAU,CAAC,gBAAgB,EACjD,OAAO,EAAE,CAAC,CAAC,EAAE;gBACX,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;oBACrC,CAAC,CAAC,eAAe,EAAE,CAAA;oBACnB,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAA;gBAC/C,CAAC;YACH,CAAC,KACG,uBAAuB,IAE1B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CACpB;QACN,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,6BAAK,SAAS,EAAC,cAAc,kBAAe,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,GAAI,CAChG,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA"}
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { AnnotationPart, WithAnnotationId } from '../../types/ExamAnnotations';
3
- export declare function getKey(annotation: AnnotationPart): string;
4
- export declare function isExistingAnnotation(annotation: AnnotationPart): annotation is WithAnnotationId<AnnotationPart>;
5
- export declare function markText(text: string, annotations: AnnotationPart[], onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, annotationId: number) => void, setNewAnnotationRef: (ref: HTMLElement | null) => void): React.ReactNode[];
6
- //# sourceMappingURL=markText.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAI9E,wBAAgB,MAAM,CAAC,UAAU,EAAE,cAAc,UAIhD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,UAAU,IAAI,gBAAgB,CAAC,cAAc,CAAC,CAE/G;AAMD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,cAAc,EAAE,EAC7B,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,EAC/F,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,qBAgGvD"}
@@ -1,77 +0,0 @@
1
- import * as _ from 'lodash-es';
2
- import React from 'react';
3
- import AnnotationTextMark from './AnnotationTextMark';
4
- import HiddenAnnotationMark from './HiddenAnnotationMark';
5
- export function getKey(annotation) {
6
- return isExistingAnnotation(annotation)
7
- ? annotation.annotationId + annotation.annotationAnchor
8
- : annotation.annotationAnchor;
9
- }
10
- export function isExistingAnnotation(annotation) {
11
- return 'annotationId' in annotation;
12
- }
13
- function getMarkedText(text, startIndex, length) {
14
- return text.substring(startIndex, startIndex + length);
15
- }
16
- export function markText(text, annotations, onClickAnnotation, setNewAnnotationRef) {
17
- var _a;
18
- if (annotations.length === 0) {
19
- return [text];
20
- }
21
- annotations.sort((a, b) => a.startIndex - b.startIndex);
22
- const [hiddenAnnotations, visibleAnnotations] = _.partition(annotations, a => a.hidden);
23
- const nodes = [];
24
- hiddenAnnotations.forEach(annotation => {
25
- const key = getKey(annotation);
26
- const annotationId = isExistingAnnotation(annotation) ? annotation.annotationId : null;
27
- nodes.push(React.createElement(HiddenAnnotationMark, { key: key, annotationId: annotationId }));
28
- });
29
- let lastIndex = 0;
30
- const onlyLeadingSpacesRemoved = text.replace(/^\s+/, ' ');
31
- const indentationSize = text.length - onlyLeadingSpacesRemoved.length;
32
- const notOverlappingAnnotations = visibleAnnotations.reduce((acc, annotation) => {
33
- const overlapsWithAnyVisibleAnnotation = acc.some(a => annotation.startIndex < a.startIndex + a.length &&
34
- a.startIndex < annotation.startIndex + annotation.length &&
35
- !a.hidden);
36
- acc.push({
37
- ...annotation,
38
- hidden: annotation.hidden || overlapsWithAnyVisibleAnnotation
39
- });
40
- return acc;
41
- }, []);
42
- for (const annotation of notOverlappingAnnotations) {
43
- /* "August 2024 annotation" refers to annotations made on or after 7.8.2024, and on or before x.8.2024.
44
- * They use trimmed exam content (textWithoutLineBreaksAndExtraSpaces) for calculating startIndex.
45
- * Support for "August 2024 annotations" can be removed at least when S25 exams are held.
46
- *
47
- * TODO:
48
- * When support for Aug 2024 annotations can be removed, just do:
49
- * const correctStartIndex = annotation.startIndex
50
- * and remove any unused code left behind
51
- */
52
- const textWithoutLineBreaksAndExtraSpaces = text.replace(/\n/g, ' ').replace(/\s+/g, ' ');
53
- const annotatedTextAugust2024 = getMarkedText(textWithoutLineBreaksAndExtraSpaces, annotation.startIndex, annotation.length);
54
- const isAugust2024Annotation = annotatedTextAugust2024 === annotation.selectedText;
55
- /**
56
- * index difference is defined by how much indentation the text paragraph has in xml,
57
- * and by how many line breaks there are before the annotated text.
58
- * */
59
- const amountOfLineBreaksBeforeAnnotation = ((_a = text.split(annotation.selectedText)[0].match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
60
- const startIndexDifference = amountOfLineBreaksBeforeAnnotation * indentationSize;
61
- const correctStartIndex = annotation.startIndex + (isAugust2024Annotation ? startIndexDifference : 0);
62
- const annotatedTextWithCorrectedStartIndex = getMarkedText(text, correctStartIndex, annotation.length);
63
- // Add unmarked text before this mark
64
- if (correctStartIndex > lastIndex) {
65
- nodes.push(text.substring(lastIndex, correctStartIndex));
66
- }
67
- // Add marked text
68
- const key = getKey(annotation);
69
- const annotationId = isExistingAnnotation(annotation) ? annotation.annotationId : null;
70
- nodes.push(annotation.hidden ? (React.createElement(HiddenAnnotationMark, { key: key, annotationId: annotationId })) : (React.createElement(AnnotationTextMark, { key: key, annotation: annotation, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef }, annotatedTextWithCorrectedStartIndex)));
71
- lastIndex = correctStartIndex + annotation.length;
72
- }
73
- // Add remaining unmarked text
74
- nodes.push(text.substring(lastIndex));
75
- return nodes;
76
- }
77
- //# sourceMappingURL=markText.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markText.js","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,kBAAkB,MAAM,sBAAsB,CAAA;AACrD,OAAO,oBAAoB,MAAM,wBAAwB,CAAA;AAEzD,MAAM,UAAU,MAAM,CAAC,UAA0B;IAC/C,OAAO,oBAAoB,CAAC,UAAU,CAAC;QACrC,CAAC,CAAC,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,gBAAgB;QACvD,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,UAA0B;IAC7D,OAAO,cAAc,IAAI,UAAU,CAAA;AACrC,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,UAAkB,EAAE,MAAc;IACrE,OA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CAAC,CAAA;QAEtG,qCAAqC;QACrC,IAAI,iBAAiB,GAAG,SAAS,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAA;QAC1D,CAAC;QAED,kBAAkB;QAClB,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;QAC9B,MAAM,YAAY,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAA;QACtF,KAAK,CAAC,IAAI,CACR,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAClB,oBAAC,oBAAoB,IAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,YAAY,GAAI,CAC/D,CAAC,CAAC,CAAC,CACF,oBAAC,kBAAkB,IACjB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,mBAAmB,IAEvC,oCAAoC,CAClB,CACtB,CACF,CAAA;QAED,SAAS,GAAG,iBAAiB,GAAG,UAAU,CAAC,MAAM,CAAA;IACnD,CAAC;IAED,8BAA8B;IAC9B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;IACrC,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -1,22 +0,0 @@
1
- declare const _exports: ({
2
- parserOptions: {
3
- project: string;
4
- tsconfigRootDir: string;
5
- };
6
- rules: {
7
- 'no-restricted-imports': (string | {
8
- paths: ({
9
- name: string;
10
- message: string;
11
- } | {
12
- name: string;
13
- importNames: string[];
14
- message: string;
15
- })[];
16
- })[];
17
- };
18
- } | {
19
- ignores: string[];
20
- })[];
21
- export = _exports;
22
- //# sourceMappingURL=eslint.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../src/eslint.config.js"],"names":[],"mappings":""}