@pie-qti/item-player 0.1.1 → 0.1.5
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/README.md +22 -19
- package/dist/catalog/applyGlossaryTriggers.d.ts +15 -0
- package/dist/catalog/applyGlossaryTriggers.d.ts.map +1 -0
- package/dist/catalog/applyGlossaryTriggers.js +193 -0
- package/dist/catalog/catalogExtractor.d.ts +18 -0
- package/dist/catalog/catalogExtractor.d.ts.map +1 -0
- package/dist/catalog/catalogExtractor.js +114 -0
- package/dist/catalog/catalogLookup.d.ts +18 -0
- package/dist/catalog/catalogLookup.d.ts.map +1 -0
- package/dist/catalog/catalogLookup.js +44 -0
- package/dist/catalog/glossaryAction.d.ts +17 -0
- package/dist/catalog/glossaryAction.d.ts.map +1 -0
- package/dist/catalog/glossaryAction.js +21 -0
- package/dist/catalog/types.d.ts +26 -0
- package/dist/catalog/types.d.ts.map +1 -0
- package/dist/catalog/types.js +6 -0
- package/dist/components/actions/typesetAction.d.ts +24 -0
- package/dist/components/actions/typesetAction.d.ts.map +1 -0
- package/dist/components/actions/typesetAction.js +59 -0
- package/dist/components/utils/assignProps.d.ts +2 -0
- package/dist/components/utils/assignProps.d.ts.map +1 -0
- package/dist/components/utils/assignProps.js +1 -0
- package/dist/components/utils/feedbackUtils.d.ts +73 -0
- package/dist/components/utils/feedbackUtils.d.ts.map +1 -0
- package/dist/components/utils/feedbackUtils.js +93 -0
- package/dist/components/utils/index.d.ts +6 -0
- package/dist/components/utils/index.d.ts.map +1 -0
- package/dist/components/utils/index.js +5 -0
- package/dist/core/ComponentRegistry.d.ts +128 -0
- package/dist/core/ComponentRegistry.d.ts.map +1 -0
- package/dist/core/ComponentRegistry.js +137 -0
- package/dist/core/ItemRenderer.d.ts +91 -0
- package/dist/core/ItemRenderer.d.ts.map +1 -0
- package/dist/core/ItemRenderer.js +261 -0
- package/dist/core/Player.d.ts +195 -0
- package/dist/core/Player.d.ts.map +1 -0
- package/dist/core/Player.js +1235 -0
- package/dist/core/Plugin.d.ts +105 -0
- package/dist/core/Plugin.d.ts.map +1 -0
- package/dist/core/Plugin.js +7 -0
- package/dist/core/PluginManager.d.ts +56 -0
- package/dist/core/PluginManager.d.ts.map +1 -0
- package/dist/core/PluginManager.js +147 -0
- package/dist/core/constants.d.ts +68 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +106 -0
- package/dist/core/declarations.d.ts +45 -0
- package/dist/core/declarations.d.ts.map +1 -0
- package/dist/core/declarations.js +133 -0
- package/dist/core/parsingLimits.d.ts +12 -0
- package/dist/core/parsingLimits.d.ts.map +1 -0
- package/dist/core/parsingLimits.js +45 -0
- package/dist/core/random.d.ts +12 -0
- package/dist/core/random.d.ts.map +1 -0
- package/dist/core/random.js +21 -0
- package/dist/core/rolePolicy.d.ts +16 -0
- package/dist/core/rolePolicy.d.ts.map +1 -0
- package/dist/core/rolePolicy.js +15 -0
- package/dist/core/sanitizer.d.ts +34 -0
- package/dist/core/sanitizer.d.ts.map +1 -0
- package/dist/core/sanitizer.js +198 -0
- package/dist/core/trustedTypes.d.ts +16 -0
- package/dist/core/trustedTypes.d.ts.map +1 -0
- package/dist/core/trustedTypes.js +55 -0
- package/dist/core/urlPolicy.d.ts +8 -0
- package/dist/core/urlPolicy.d.ts.map +1 -0
- package/dist/core/urlPolicy.js +90 -0
- package/dist/element.d.ts +22 -0
- package/dist/element.js +5327 -0
- package/dist/element.js.map +1 -0
- package/dist/extensions/MathLiveEditor.d.ts +32 -0
- package/dist/extensions/MathLiveEditor.d.ts.map +1 -0
- package/dist/extensions/MathLiveEditor.js +249 -0
- package/dist/extraction/ExtractionRegistry.d.ts +112 -0
- package/dist/extraction/ExtractionRegistry.d.ts.map +1 -0
- package/dist/extraction/ExtractionRegistry.js +260 -0
- package/dist/extraction/createContext.d.ts +30 -0
- package/dist/extraction/createContext.d.ts.map +1 -0
- package/dist/extraction/createContext.js +39 -0
- package/dist/extraction/extractors/associateExtractor.d.ts +29 -0
- package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/associateExtractor.js +97 -0
- package/dist/extraction/extractors/choiceExtractor.d.ts +27 -0
- package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/choiceExtractor.js +93 -0
- package/dist/extraction/extractors/customExtractor.d.ts +20 -0
- package/dist/extraction/extractors/customExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/customExtractor.js +51 -0
- package/dist/extraction/extractors/drawingExtractor.d.ts +30 -0
- package/dist/extraction/extractors/drawingExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/drawingExtractor.js +78 -0
- package/dist/extraction/extractors/endAttemptExtractor.d.ts +20 -0
- package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/endAttemptExtractor.js +53 -0
- package/dist/extraction/extractors/extendedTextExtractor.d.ts +21 -0
- package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/extendedTextExtractor.js +63 -0
- package/dist/extraction/extractors/gapMatchExtractor.d.ts +29 -0
- package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/gapMatchExtractor.js +155 -0
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +41 -0
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/graphicAssociateExtractor.js +143 -0
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +53 -0
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/graphicGapMatchExtractor.js +205 -0
- package/dist/extraction/extractors/graphicOrderExtractor.d.ts +37 -0
- package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/graphicOrderExtractor.js +121 -0
- package/dist/extraction/extractors/hotspotExtractor.d.ts +38 -0
- package/dist/extraction/extractors/hotspotExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/hotspotExtractor.js +159 -0
- package/dist/extraction/extractors/hottextExtractor.d.ts +26 -0
- package/dist/extraction/extractors/hottextExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/hottextExtractor.js +128 -0
- package/dist/extraction/extractors/index.d.ts +63 -0
- package/dist/extraction/extractors/index.d.ts.map +1 -0
- package/dist/extraction/extractors/index.js +88 -0
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +25 -0
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/inlineChoiceExtractor.js +80 -0
- package/dist/extraction/extractors/matchExtractor.d.ts +37 -0
- package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/matchExtractor.js +160 -0
- package/dist/extraction/extractors/mediaExtractor.d.ts +33 -0
- package/dist/extraction/extractors/mediaExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/mediaExtractor.js +125 -0
- package/dist/extraction/extractors/orderExtractor.d.ts +28 -0
- package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/orderExtractor.js +90 -0
- package/dist/extraction/extractors/portableCustomExtractor.d.ts +14 -0
- package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/portableCustomExtractor.js +96 -0
- package/dist/extraction/extractors/positionObjectExtractor.d.ts +59 -0
- package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/positionObjectExtractor.js +191 -0
- package/dist/extraction/extractors/selectPointExtractor.d.ts +31 -0
- package/dist/extraction/extractors/selectPointExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/selectPointExtractor.js +109 -0
- package/dist/extraction/extractors/sliderExtractor.d.ts +24 -0
- package/dist/extraction/extractors/sliderExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/sliderExtractor.js +73 -0
- package/dist/extraction/extractors/textEntryExtractor.d.ts +21 -0
- package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/textEntryExtractor.js +54 -0
- package/dist/extraction/extractors/uploadExtractor.d.ts +20 -0
- package/dist/extraction/extractors/uploadExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/uploadExtractor.js +59 -0
- package/dist/extraction/index.d.ts +49 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +49 -0
- package/dist/extraction/types.d.ts +209 -0
- package/dist/extraction/types.d.ts.map +1 -0
- package/dist/extraction/types.js +30 -0
- package/dist/extraction/utils.d.ts +15 -0
- package/dist/extraction/utils.d.ts.map +1 -0
- package/dist/extraction/utils.js +178 -0
- package/dist/iframe/IFramePlayerHost.d.ts +122 -0
- package/dist/iframe/IFramePlayerHost.d.ts.map +1 -0
- package/dist/iframe/IFramePlayerHost.js +172 -0
- package/dist/iframe/index.d.ts +9 -0
- package/dist/iframe/index.d.ts.map +1 -0
- package/dist/iframe/index.js +8 -0
- package/dist/iframe/protocol.d.ts +75 -0
- package/dist/iframe/protocol.d.ts.map +1 -0
- package/dist/iframe/protocol.js +53 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/pci/PciHost.d.ts +53 -0
- package/dist/pci/PciHost.d.ts.map +1 -0
- package/dist/pci/PciHost.js +116 -0
- package/dist/pci/types.d.ts +57 -0
- package/dist/pci/types.d.ts.map +1 -0
- package/dist/pci/types.js +19 -0
- package/dist/pnp/applyPnp.d.ts +9 -0
- package/dist/pnp/applyPnp.d.ts.map +1 -0
- package/dist/pnp/applyPnp.js +19 -0
- package/dist/pnp/parsePnpXml.d.ts +9 -0
- package/dist/pnp/parsePnpXml.d.ts.map +1 -0
- package/dist/pnp/parsePnpXml.js +101 -0
- package/dist/pnp/types.d.ts +40 -0
- package/dist/pnp/types.d.ts.map +1 -0
- package/dist/pnp/types.js +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +10 -0
- package/dist/types/index.d.ts +304 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/interactions.d.ts +412 -0
- package/dist/types/interactions.d.ts.map +1 -0
- package/dist/types/interactions.js +7 -0
- package/dist/types/responseValidation.d.ts +25 -0
- package/dist/types/responseValidation.d.ts.map +1 -0
- package/dist/types/responseValidation.js +1 -0
- package/dist/utils/PerformanceMonitor.d.ts +170 -0
- package/dist/utils/PerformanceMonitor.d.ts.map +1 -0
- package/dist/utils/PerformanceMonitor.js +242 -0
- package/dist/utils/drawingUtils.d.ts +39 -0
- package/dist/utils/drawingUtils.d.ts.map +1 -0
- package/dist/utils/drawingUtils.js +57 -0
- package/dist/utils/responseUtils.d.ts +16 -0
- package/dist/utils/responseUtils.d.ts.map +1 -0
- package/dist/utils/responseUtils.js +45 -0
- package/dist/utils/touchDragHelper.d.ts +2 -0
- package/dist/utils/touchDragHelper.d.ts.map +1 -0
- package/dist/utils/touchDragHelper.js +1 -0
- package/dist/web-components/QTIInteractionBase.d.ts +120 -0
- package/dist/web-components/QTIInteractionBase.d.ts.map +1 -0
- package/dist/web-components/QTIInteractionBase.js +243 -0
- package/dist/web-components/QTIInteractionElement.d.ts +77 -0
- package/dist/web-components/QTIInteractionElement.d.ts.map +1 -0
- package/dist/web-components/QTIInteractionElement.js +61 -0
- package/dist/web-components/index.d.ts +8 -0
- package/dist/web-components/index.d.ts.map +1 -0
- package/dist/web-components/index.js +10 -0
- package/package.json +104 -76
- package/src/__tests__/catalog.test.ts +267 -0
- package/src/__tests__/fixtures/pci/echo-pci.js +49 -0
- package/src/__tests__/glossaryTriggers.test.ts +411 -0
- package/src/__tests__/pci.test.ts +353 -0
- package/src/__tests__/pnp.test.ts +250 -0
- package/src/__tests__/qti3-attribute-extraction.test.ts +174 -0
- package/src/__tests__/qti3-debug.test.ts +140 -0
- package/src/__tests__/qti3-extraction.test.ts +309 -0
- package/src/catalog/applyGlossaryTriggers.ts +232 -0
- package/src/catalog/catalogExtractor.ts +130 -0
- package/src/catalog/catalogLookup.ts +53 -0
- package/src/catalog/glossaryAction.ts +28 -0
- package/src/catalog/types.ts +37 -0
- package/src/components/ItemBody.svelte +136 -26
- package/src/components/ItemPlayer.svelte +6 -2
- package/src/components/index.ts +3 -0
- package/src/components/utils/assignProps.ts +1 -23
- package/src/core/ComponentRegistry.ts +14 -0
- package/src/core/ItemRenderer.ts +4 -0
- package/src/core/Player.ts +312 -38
- package/src/core/parsingLimits.ts +1 -1
- package/src/core/rolePolicy.ts +34 -0
- package/src/core/urlPolicy.ts +5 -2
- package/src/element.ts +128 -0
- package/src/extensions/MathLiveEditor.ts +6 -3
- package/src/extraction/ExtractionRegistry.ts +51 -11
- package/src/extraction/createContext.ts +6 -1
- package/src/extraction/extractors/associateExtractor.ts +4 -0
- package/src/extraction/extractors/choiceExtractor.ts +12 -1
- package/src/extraction/extractors/conformance-qti3-advanced.test.ts +239 -0
- package/src/extraction/extractors/conformance-qti3-basic.test.ts +82 -0
- package/src/extraction/extractors/conformance.test.ts +208 -0
- package/src/extraction/extractors/extendedTextExtractor.ts +11 -2
- package/src/extraction/extractors/gapMatchExtractor.ts +36 -21
- package/src/extraction/extractors/graphicAssociateExtractor.ts +4 -0
- package/src/extraction/extractors/graphicGapMatchExtractor.ts +82 -10
- package/src/extraction/extractors/hotspotExtractor.ts +26 -8
- package/src/extraction/extractors/hottextExtractor.ts +15 -5
- package/src/extraction/extractors/index.ts +4 -0
- package/src/extraction/extractors/inlineChoiceExtractor.ts +22 -5
- package/src/extraction/extractors/matchExtractor.ts +33 -6
- package/src/extraction/extractors/orderExtractor.ts +6 -0
- package/src/extraction/extractors/portableCustomExtractor.ts +122 -0
- package/src/extraction/extractors/selectPointExtractor.ts +5 -5
- package/src/extraction/extractors/textEntryExtractor.ts +11 -2
- package/src/extraction/extractors/uploadExtractor.ts +10 -2
- package/src/extraction/utils.ts +99 -16
- package/src/index.ts +19 -1
- package/src/pci/PciHost.ts +138 -0
- package/src/pci/types.ts +70 -0
- package/src/pnp/applyPnp.ts +23 -0
- package/src/pnp/parsePnpXml.ts +118 -0
- package/src/pnp/types.ts +33 -0
- package/src/types/index.ts +50 -16
- package/src/types/interactions.ts +81 -6
- package/src/types/xmldom.d.ts +12 -0
- package/src/utils/drawingUtils.ts +73 -0
- package/src/utils/touchDragHelper.ts +1 -211
- package/.turbo/turbo-build.log +0 -1
- package/CHANGELOG.md +0 -9
- package/docs/QTI-COMPLIANCE.md +0 -197
- package/docs/WCAG-2.2-COMPLIANCE.md +0 -466
- package/docs/custom-extractors.md +0 -679
- package/docs/iframe-mode.md +0 -78
- package/docs/security-audit.md +0 -236
- package/docs/server-api.md +0 -691
- package/tests/conformance/FIXTURE_POLICY.md +0 -29
- package/tests/conformance/README.md +0 -70
- package/tests/conformance/fixtures/baseTypes_all/cases.json +0 -61
- package/tests/conformance/fixtures/baseTypes_all/item.xml +0 -131
- package/tests/conformance/fixtures/baseTypes_all/manifest.json +0 -7
- package/tests/conformance/fixtures/choice_match_correct/cases.json +0 -17
- package/tests/conformance/fixtures/choice_match_correct/item.xml +0 -55
- package/tests/conformance/fixtures/choice_match_correct/manifest.json +0 -14
- package/tests/conformance/fixtures/contains_multiple/cases.json +0 -12
- package/tests/conformance/fixtures/contains_multiple/item.xml +0 -37
- package/tests/conformance/fixtures/contains_multiple/manifest.json +0 -13
- package/tests/conformance/fixtures/isNull_isNotNull/cases.json +0 -9
- package/tests/conformance/fixtures/isNull_isNotNull/item.xml +0 -41
- package/tests/conformance/fixtures/isNull_isNotNull/manifest.json +0 -23
- package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/cases.json +0 -27
- package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/item.xml +0 -30
- package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/manifest.json +0 -15
- package/tests/conformance/fixtures/mapResponse_integer_mapKey/cases.json +0 -11
- package/tests/conformance/fixtures/mapResponse_integer_mapKey/item.xml +0 -26
- package/tests/conformance/fixtures/mapResponse_integer_mapKey/manifest.json +0 -13
- package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/cases.json +0 -27
- package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/item.xml +0 -32
- package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/manifest.json +0 -7
- package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/cases.json +0 -9
- package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/item.xml +0 -25
- package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/manifest.json +0 -12
- package/tests/conformance/fixtures/mapResponse_multiple_cardinality/cases.json +0 -12
- package/tests/conformance/fixtures/mapResponse_multiple_cardinality/item.xml +0 -35
- package/tests/conformance/fixtures/mapResponse_multiple_cardinality/manifest.json +0 -11
- package/tests/conformance/fixtures/mapping_bounds_upperLower/cases.json +0 -12
- package/tests/conformance/fixtures/mapping_bounds_upperLower/item.xml +0 -37
- package/tests/conformance/fixtures/mapping_bounds_upperLower/manifest.json +0 -11
- package/tests/conformance/fixtures/mapping_mapResponse/cases.json +0 -22
- package/tests/conformance/fixtures/mapping_mapResponse/item.xml +0 -53
- package/tests/conformance/fixtures/mapping_mapResponse/manifest.json +0 -16
- package/tests/conformance/fixtures/member_multiple/cases.json +0 -12
- package/tests/conformance/fixtures/member_multiple/item.xml +0 -37
- package/tests/conformance/fixtures/member_multiple/manifest.json +0 -13
- package/tests/conformance/fixtures/modalFeedback_basic/cases.json +0 -17
- package/tests/conformance/fixtures/modalFeedback_basic/item.xml +0 -52
- package/tests/conformance/fixtures/modalFeedback_basic/manifest.json +0 -13
- package/tests/conformance/fixtures/multiple_unordered_match/cases.json +0 -17
- package/tests/conformance/fixtures/multiple_unordered_match/item.xml +0 -44
- package/tests/conformance/fixtures/multiple_unordered_match/manifest.json +0 -11
- package/tests/conformance/fixtures/ordered_match/cases.json +0 -17
- package/tests/conformance/fixtures/ordered_match/item.xml +0 -48
- package/tests/conformance/fixtures/ordered_match/manifest.json +0 -13
- package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/cases.json +0 -27
- package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/item.xml +0 -103
- package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/manifest.json +0 -7
- package/tests/conformance/fixtures/outcomeProcessing_exitTest/cases.json +0 -15
- package/tests/conformance/fixtures/outcomeProcessing_exitTest/item.xml +0 -33
- package/tests/conformance/fixtures/outcomeProcessing_exitTest/manifest.json +0 -10
- package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/cases.json +0 -14
- package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/item.xml +0 -26
- package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/manifest.json +0 -8
- package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/cases.json +0 -17
- package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/item.xml +0 -43
- package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/manifest.json +0 -16
- package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/cases.json +0 -27
- package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/item.xml +0 -37
- package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/manifest.json +0 -16
- package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/cases.json +0 -14
- package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/item.xml +0 -35
- package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/manifest.json +0 -8
- package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/cases.json +0 -14
- package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/item.xml +0 -35
- package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/manifest.json +0 -8
- package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/cases.json +0 -15
- package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/item.xml +0 -39
- package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/manifest.json +0 -11
- package/tests/conformance/fixtures/outcomeProcessing_testVariables/cases.json +0 -14
- package/tests/conformance/fixtures/outcomeProcessing_testVariables/item.xml +0 -35
- package/tests/conformance/fixtures/outcomeProcessing_testVariables/manifest.json +0 -8
- package/tests/conformance/fixtures/pair_unordered_match/cases.json +0 -22
- package/tests/conformance/fixtures/pair_unordered_match/item.xml +0 -44
- package/tests/conformance/fixtures/pair_unordered_match/manifest.json +0 -13
- package/tests/conformance/fixtures/positionObject_coordinateSystem_aspectRatio/cases.json +0 -95
- package/tests/conformance/fixtures/positionObject_coordinateSystem_aspectRatio/item.xml +0 -53
- package/tests/conformance/fixtures/positionObject_mapResponsePoint_scoring/cases.json +0 -115
- package/tests/conformance/fixtures/positionObject_mapResponsePoint_scoring/item.xml +0 -45
- package/tests/conformance/fixtures/positionObject_mapResponse_wrong/cases.json +0 -29
- package/tests/conformance/fixtures/positionObject_mapResponse_wrong/item.xml +0 -40
- package/tests/conformance/fixtures/responseCondition_elseIf_chain/cases.json +0 -10
- package/tests/conformance/fixtures/responseCondition_elseIf_chain/item.xml +0 -49
- package/tests/conformance/fixtures/responseCondition_elseIf_chain/manifest.json +0 -15
- package/tests/conformance/fixtures/responseProcessing_anyN/cases.json +0 -27
- package/tests/conformance/fixtures/responseProcessing_anyN/item.xml +0 -47
- package/tests/conformance/fixtures/responseProcessing_anyN/manifest.json +0 -16
- package/tests/conformance/fixtures/responseProcessing_anyN_allN/cases.json +0 -27
- package/tests/conformance/fixtures/responseProcessing_anyN_allN/item.xml +0 -69
- package/tests/conformance/fixtures/responseProcessing_anyN_allN/manifest.json +0 -23
- package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/cases.json +0 -15
- package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/item.xml +0 -58
- package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/manifest.json +0 -15
- package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/cases.json +0 -37
- package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/item.xml +0 -94
- package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/manifest.json +0 -27
- package/tests/conformance/fixtures/responseProcessing_containerSize_index/cases.json +0 -33
- package/tests/conformance/fixtures/responseProcessing_containerSize_index/item.xml +0 -79
- package/tests/conformance/fixtures/responseProcessing_containerSize_index/manifest.json +0 -16
- package/tests/conformance/fixtures/responseProcessing_customOperator/cases.json +0 -15
- package/tests/conformance/fixtures/responseProcessing_customOperator/item.xml +0 -30
- package/tests/conformance/fixtures/responseProcessing_customOperator/manifest.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_default_expression/cases.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_default_expression/item.xml +0 -48
- package/tests/conformance/fixtures/responseProcessing_default_expression/manifest.json +0 -13
- package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/cases.json +0 -29
- package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/item.xml +0 -68
- package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/manifest.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/cases.json +0 -39
- package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/item.xml +0 -39
- package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/manifest.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_exitResponse/cases.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_exitResponse/item.xml +0 -25
- package/tests/conformance/fixtures/responseProcessing_exitResponse/manifest.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/cases.json +0 -26
- package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/item.xml +0 -134
- package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/manifest.json +0 -16
- package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/cases.json +0 -27
- package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/item.xml +0 -33
- package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/manifest.json +0 -13
- package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/cases.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/item.xml +0 -33
- package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/manifest.json +0 -13
- package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/cases.json +0 -27
- package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/item.xml +0 -40
- package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/manifest.json +0 -18
- package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/cases.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/item.xml +0 -33
- package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/manifest.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/cases.json +0 -29
- package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/item.xml +0 -26
- package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/manifest.json +0 -7
- package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/cases.json +0 -23
- package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/item.xml +0 -28
- package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/manifest.json +0 -11
- package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/cases.json +0 -29
- package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/item.xml +0 -26
- package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/manifest.json +0 -7
- package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/cases.json +0 -31
- package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/item.xml +0 -102
- package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/manifest.json +0 -18
- package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/cases.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/item.xml +0 -45
- package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/manifest.json +0 -21
- package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/cases.json +0 -26
- package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/item.xml +0 -157
- package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/manifest.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_notEqual_basic/cases.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_notEqual_basic/item.xml +0 -39
- package/tests/conformance/fixtures/responseProcessing_notEqual_basic/manifest.json +0 -18
- package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/cases.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/item.xml +0 -51
- package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/manifest.json +0 -19
- package/tests/conformance/fixtures/responseProcessing_preCondition/cases.json +0 -31
- package/tests/conformance/fixtures/responseProcessing_preCondition/item.xml +0 -44
- package/tests/conformance/fixtures/responseProcessing_preCondition/manifest.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/cases.json +0 -27
- package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/item.xml +0 -42
- package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/manifest.json +0 -14
- package/tests/conformance/fixtures/responseProcessing_record_fieldValue/cases.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_record_fieldValue/item.xml +0 -40
- package/tests/conformance/fixtures/responseProcessing_record_fieldValue/manifest.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/cases.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/item.xml +0 -63
- package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/manifest.json +0 -9
- package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/cases.json +0 -12
- package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/item.xml +0 -40
- package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/manifest.json +0 -13
- package/tests/conformance/fixtures/responseProcessing_setDefaultValue/cases.json +0 -15
- package/tests/conformance/fixtures/responseProcessing_setDefaultValue/item.xml +0 -67
- package/tests/conformance/fixtures/responseProcessing_setDefaultValue/manifest.json +0 -9
- package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/cases.json +0 -27
- package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/item.xml +0 -69
- package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/manifest.json +0 -10
- package/tests/conformance/fixtures/responseProcessing_subtract_divide/cases.json +0 -15
- package/tests/conformance/fixtures/responseProcessing_subtract_divide/item.xml +0 -35
- package/tests/conformance/fixtures/responseProcessing_subtract_divide/manifest.json +0 -11
- package/tests/conformance/fixtures/responseProcessing_template_map_response/cases.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_template_map_response/item.xml +0 -31
- package/tests/conformance/fixtures/responseProcessing_template_map_response/manifest.json +0 -8
- package/tests/conformance/fixtures/responseProcessing_template_map_response_point/cases.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_template_map_response_point/item.xml +0 -27
- package/tests/conformance/fixtures/responseProcessing_template_map_response_point/manifest.json +0 -8
- package/tests/conformance/fixtures/responseProcessing_template_match_correct/cases.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_template_match_correct/item.xml +0 -34
- package/tests/conformance/fixtures/responseProcessing_template_match_correct/manifest.json +0 -8
- package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/cases.json +0 -22
- package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/item.xml +0 -30
- package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/manifest.json +0 -7
- package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/cases.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/item.xml +0 -30
- package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/manifest.json +0 -9
- package/tests/conformance/fixtures/responseProcessing_template_match_nothing/cases.json +0 -17
- package/tests/conformance/fixtures/responseProcessing_template_match_nothing/item.xml +0 -30
- package/tests/conformance/fixtures/responseProcessing_template_match_nothing/manifest.json +0 -8
- package/tests/conformance/fixtures/responseProcessing_xiInclude/cases.json +0 -14
- package/tests/conformance/fixtures/responseProcessing_xiInclude/item.xml +0 -25
- package/tests/conformance/fixtures/responseProcessing_xiInclude/manifest.json +0 -9
- package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/cases.json +0 -12
- package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/item.xml +0 -52
- package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/manifest.json +0 -14
- package/tests/conformance/fixtures/templateProcessing_exitTemplate/cases.json +0 -12
- package/tests/conformance/fixtures/templateProcessing_exitTemplate/item.xml +0 -48
- package/tests/conformance/fixtures/templateProcessing_exitTemplate/manifest.json +0 -13
- package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/cases.json +0 -27
- package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/item.xml +0 -74
- package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/manifest.json +0 -22
- package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/cases.json +0 -17
- package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/item.xml +0 -133
- package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/manifest.json +0 -22
- package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/cases.json +0 -12
- package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/item.xml +0 -107
- package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/manifest.json +0 -16
- package/tests/conformance/fixtures/templateProcessing_templateConstraint/cases.json +0 -15
- package/tests/conformance/fixtures/templateProcessing_templateConstraint/item.xml +0 -52
- package/tests/conformance/fixtures/templateProcessing_templateConstraint/manifest.json +0 -14
- package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/cases.json +0 -16
- package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/item.xml +0 -49
- package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/manifest.json +0 -15
- package/tests/conformance/fixtures/template_randomInteger_printedVariable/cases.json +0 -16
- package/tests/conformance/fixtures/template_randomInteger_printedVariable/item.xml +0 -38
- package/tests/conformance/fixtures/template_randomInteger_printedVariable/manifest.json +0 -13
- package/tests/conformance/harness.ts +0 -84
- package/tests/conformance/run-fixtures.test.ts +0 -127
- package/tests/conformance/scripts/normalize-covers.ts +0 -152
- package/tests/conformance/types.ts +0 -53
- package/tests/core/Player.test.ts +0 -563
- package/tests/core/adaptiveItems.test.ts +0 -442
- package/tests/core/correctResponse.test.ts +0 -280
- package/tests/core/interaction-plumbing.test.ts +0 -141
- package/tests/core/modalFeedback.test.ts +0 -308
- package/tests/core/outcome-reset.test.ts +0 -43
- package/tests/extraction/extractors/associateExtractor.test.ts +0 -182
- package/tests/extraction/extractors/choiceExtractor.test.ts +0 -239
- package/tests/extraction/extractors/customExtractor.test.ts +0 -83
- package/tests/extraction/extractors/drawingExtractor.test.ts +0 -94
- package/tests/extraction/extractors/endAttemptExtractor.test.ts +0 -188
- package/tests/extraction/extractors/extendedTextExtractor.test.ts +0 -178
- package/tests/extraction/extractors/gapMatchExtractor.test.ts +0 -318
- package/tests/extraction/extractors/graphicAssociateExtractor.test.ts +0 -260
- package/tests/extraction/extractors/graphicGapMatchExtractor.test.ts +0 -320
- package/tests/extraction/extractors/graphicOrderExtractor.test.ts +0 -223
- package/tests/extraction/extractors/hotspotExtractor.test.ts +0 -298
- package/tests/extraction/extractors/hottextExtractor.test.ts +0 -240
- package/tests/extraction/extractors/inlineChoiceExtractor.test.ts +0 -292
- package/tests/extraction/extractors/matchExtractor.test.ts +0 -241
- package/tests/extraction/extractors/mediaExtractor.test.ts +0 -295
- package/tests/extraction/extractors/orderExtractor.test.ts +0 -212
- package/tests/extraction/extractors/positionObjectExtractor.test.ts +0 -363
- package/tests/extraction/extractors/selectPointExtractor.test.ts +0 -214
- package/tests/extraction/extractors/sliderExtractor.test.ts +0 -293
- package/tests/extraction/extractors/textEntryExtractor.test.ts +0 -133
- package/tests/extraction/extractors/uploadExtractor.test.ts +0 -119
- package/tests/extraction/test-utils.ts +0 -57
- package/tests/iframe/host.test.ts +0 -145
- package/tests/iframe/protocol.test.ts +0 -42
- package/tests/performance/player-benchmarks.bench.ts +0 -191
- package/tests/security/dos-limits.test.ts +0 -56
- package/tests/security/xss-prevention.test.ts +0 -522
- package/tsconfig.json +0 -20
- package/tsconfig.svelte.json +0 -14
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context factory for element extraction
|
|
3
|
+
*
|
|
4
|
+
* Creates ExtractionContext instances with utilities and metadata
|
|
5
|
+
*/
|
|
6
|
+
import type { PlayerConfig } from '../types/index.js';
|
|
7
|
+
import type { QTIElement } from '../types/interactions.js';
|
|
8
|
+
import type { ExtractionContext, VariableDeclaration } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Create an extraction context for an element
|
|
11
|
+
*
|
|
12
|
+
* @param element - The element being extracted
|
|
13
|
+
* @param responseId - Response identifier for this interaction
|
|
14
|
+
* @param dom - Root DOM element for document-wide queries
|
|
15
|
+
* @param declarations - Variable declarations from QTI
|
|
16
|
+
* @param config - Player configuration
|
|
17
|
+
* @returns Complete extraction context with utilities
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const context = createExtractionContext(
|
|
21
|
+
* element,
|
|
22
|
+
* 'RESPONSE',
|
|
23
|
+
* rootElement,
|
|
24
|
+
* declarations,
|
|
25
|
+
* playerConfig
|
|
26
|
+
* );
|
|
27
|
+
* const result = registry.extract<ChoiceData>(element, context);
|
|
28
|
+
*/
|
|
29
|
+
export declare function createExtractionContext(element: QTIElement, responseId: string, dom: QTIElement, declarations: Map<string, VariableDeclaration>, config: PlayerConfig): ExtractionContext;
|
|
30
|
+
//# sourceMappingURL=createContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createContext.d.ts","sourceRoot":"","sources":["../../src/extraction/createContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,UAAU,EACf,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAC9C,MAAM,EAAE,YAAY,GAClB,iBAAiB,CAanB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context factory for element extraction
|
|
3
|
+
*
|
|
4
|
+
* Creates ExtractionContext instances with utilities and metadata
|
|
5
|
+
*/
|
|
6
|
+
import { createExtractionUtils } from './utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create an extraction context for an element
|
|
9
|
+
*
|
|
10
|
+
* @param element - The element being extracted
|
|
11
|
+
* @param responseId - Response identifier for this interaction
|
|
12
|
+
* @param dom - Root DOM element for document-wide queries
|
|
13
|
+
* @param declarations - Variable declarations from QTI
|
|
14
|
+
* @param config - Player configuration
|
|
15
|
+
* @returns Complete extraction context with utilities
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const context = createExtractionContext(
|
|
19
|
+
* element,
|
|
20
|
+
* 'RESPONSE',
|
|
21
|
+
* rootElement,
|
|
22
|
+
* declarations,
|
|
23
|
+
* playerConfig
|
|
24
|
+
* );
|
|
25
|
+
* const result = registry.extract<ChoiceData>(element, context);
|
|
26
|
+
*/
|
|
27
|
+
export function createExtractionContext(element, responseId, dom, declarations, config) {
|
|
28
|
+
// Pass both element and attribute name mappers for QTI version handling
|
|
29
|
+
const elementMapper = config.elementNameMapper;
|
|
30
|
+
const attributeMapper = config.attributeNameMapper;
|
|
31
|
+
return {
|
|
32
|
+
element,
|
|
33
|
+
responseId,
|
|
34
|
+
dom,
|
|
35
|
+
declarations,
|
|
36
|
+
utils: createExtractionUtils(config.security, elementMapper, attributeMapper),
|
|
37
|
+
config,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI associateInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from associateInteraction elements (associating items)
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Associate data extracted from associateInteraction elements
|
|
9
|
+
*/
|
|
10
|
+
export interface AssociateData {
|
|
11
|
+
choices: Array<{
|
|
12
|
+
identifier: string;
|
|
13
|
+
text: string;
|
|
14
|
+
matchMax: number;
|
|
15
|
+
matchMin?: number;
|
|
16
|
+
matchGroup?: string[];
|
|
17
|
+
classes?: string[];
|
|
18
|
+
}>;
|
|
19
|
+
shuffle: boolean;
|
|
20
|
+
maxAssociations: number;
|
|
21
|
+
minAssociations?: number;
|
|
22
|
+
prompt: string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Standard QTI associate interaction extractor
|
|
26
|
+
* Handles associateInteraction elements (creating associations between items)
|
|
27
|
+
*/
|
|
28
|
+
export declare const standardAssociateExtractor: ElementExtractor<AssociateData>;
|
|
29
|
+
//# sourceMappingURL=associateExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"associateExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/associateExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,KAAK,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,gBAAgB,CAAC,aAAa,CAsGtE,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI associateInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from associateInteraction elements (associating items)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI associate interaction extractor
|
|
8
|
+
* Handles associateInteraction elements (creating associations between items)
|
|
9
|
+
*/
|
|
10
|
+
export const standardAssociateExtractor = {
|
|
11
|
+
id: 'qti:associate-interaction',
|
|
12
|
+
name: 'QTI Standard Associate Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['associateInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI associateInteraction (associating items)',
|
|
16
|
+
canHandle(element, context) {
|
|
17
|
+
// All associateInteraction elements with simpleAssociableChoice are standard
|
|
18
|
+
return (element.rawTagName === 'associateInteraction' &&
|
|
19
|
+
context.utils.hasChildWithTag(element, 'simpleAssociableChoice'));
|
|
20
|
+
},
|
|
21
|
+
extract(element, context) {
|
|
22
|
+
const { utils } = context;
|
|
23
|
+
// Extract simpleAssociableChoice children
|
|
24
|
+
const choiceElements = utils.getChildrenByTag(element, 'simpleAssociableChoice');
|
|
25
|
+
const choices = choiceElements.map((choice) => {
|
|
26
|
+
const classes = utils.getClasses(choice);
|
|
27
|
+
const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);
|
|
28
|
+
const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);
|
|
29
|
+
const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');
|
|
30
|
+
const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
|
|
31
|
+
return {
|
|
32
|
+
identifier: utils.getAttribute(choice, 'identifier', ''),
|
|
33
|
+
text: utils.getHtmlContent(choice),
|
|
34
|
+
matchMax,
|
|
35
|
+
...(matchMin > 0 ? { matchMin } : {}),
|
|
36
|
+
...(matchGroup.length > 0 ? { matchGroup } : {}),
|
|
37
|
+
...(classes.length > 0 ? { classes } : {}),
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
// Extract attributes with proper defaults
|
|
41
|
+
const shuffle = utils.getBooleanAttribute(element, 'shuffle');
|
|
42
|
+
const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 0);
|
|
43
|
+
const minAssociations = utils.getNumberAttribute(element, 'minAssociations', 0);
|
|
44
|
+
// Extract prompt (optional)
|
|
45
|
+
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
46
|
+
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
47
|
+
return {
|
|
48
|
+
choices,
|
|
49
|
+
shuffle,
|
|
50
|
+
maxAssociations,
|
|
51
|
+
...(minAssociations > 0 ? { minAssociations } : {}),
|
|
52
|
+
prompt,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
validate(data) {
|
|
56
|
+
const errors = [];
|
|
57
|
+
// Validate choices exist
|
|
58
|
+
if (!data.choices || data.choices.length < 2) {
|
|
59
|
+
errors.push('associateInteraction must have at least 2 choices');
|
|
60
|
+
}
|
|
61
|
+
// Validate choice identifiers
|
|
62
|
+
if (data.choices) {
|
|
63
|
+
const identifiers = new Set();
|
|
64
|
+
for (const choice of data.choices) {
|
|
65
|
+
if (!choice.identifier) {
|
|
66
|
+
errors.push('All choices must have an identifier');
|
|
67
|
+
}
|
|
68
|
+
else if (identifiers.has(choice.identifier)) {
|
|
69
|
+
errors.push(`Duplicate choice identifier: ${choice.identifier}`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
identifiers.add(choice.identifier);
|
|
73
|
+
}
|
|
74
|
+
// Validate matchMax
|
|
75
|
+
if (choice.matchMax < 0) {
|
|
76
|
+
errors.push(`matchMax must be non-negative for choice ${choice.identifier}`);
|
|
77
|
+
}
|
|
78
|
+
// Validate matchMin
|
|
79
|
+
if (choice.matchMin !== undefined && choice.matchMin < 0) {
|
|
80
|
+
errors.push(`matchMin must be non-negative for choice ${choice.identifier}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Validate maxAssociations
|
|
85
|
+
if (data.maxAssociations < 0) {
|
|
86
|
+
errors.push('maxAssociations must be non-negative');
|
|
87
|
+
}
|
|
88
|
+
// Validate minAssociations
|
|
89
|
+
if (data.minAssociations !== undefined && data.minAssociations < 0) {
|
|
90
|
+
errors.push('minAssociations must be non-negative');
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
valid: errors.length === 0,
|
|
94
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI choiceInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from choiceInteraction elements with simpleChoice children
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Choice data extracted from simpleChoice elements
|
|
9
|
+
*/
|
|
10
|
+
export interface ChoiceData {
|
|
11
|
+
choices: Array<{
|
|
12
|
+
identifier: string;
|
|
13
|
+
text: string;
|
|
14
|
+
fixed?: boolean;
|
|
15
|
+
classes?: string[];
|
|
16
|
+
}>;
|
|
17
|
+
shuffle: boolean;
|
|
18
|
+
maxChoices: number;
|
|
19
|
+
minChoices: number;
|
|
20
|
+
prompt: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Standard QTI choice interaction extractor
|
|
24
|
+
* Handles choiceInteraction elements with simpleChoice children
|
|
25
|
+
*/
|
|
26
|
+
export declare const standardChoiceExtractor: ElementExtractor<ChoiceData>;
|
|
27
|
+
//# sourceMappingURL=choiceExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choiceExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/choiceExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,aAAa,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC1F,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,CAAC,UAAU,CAgGhE,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI choiceInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from choiceInteraction elements with simpleChoice children
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI choice interaction extractor
|
|
8
|
+
* Handles choiceInteraction elements with simpleChoice children
|
|
9
|
+
*/
|
|
10
|
+
export const standardChoiceExtractor = {
|
|
11
|
+
id: 'qti:choice-interaction',
|
|
12
|
+
name: 'QTI Standard Choice Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['choiceInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI choiceInteraction with simpleChoice elements',
|
|
16
|
+
canHandle(element, context) {
|
|
17
|
+
// Standard QTI choice interactions have simpleChoice children
|
|
18
|
+
return context.utils.hasChildWithTag(element, 'simpleChoice');
|
|
19
|
+
},
|
|
20
|
+
extract(element, context) {
|
|
21
|
+
const { utils } = context;
|
|
22
|
+
// Extract choices
|
|
23
|
+
const simpleChoices = utils.getChildrenByTag(element, 'simpleChoice');
|
|
24
|
+
const choices = simpleChoices.map((choice) => {
|
|
25
|
+
const classes = utils.getClasses(choice);
|
|
26
|
+
const fixed = utils.getBooleanAttribute(choice, 'fixed');
|
|
27
|
+
return {
|
|
28
|
+
identifier: utils.getAttribute(choice, 'identifier', ''),
|
|
29
|
+
text: utils.getHtmlContent(choice),
|
|
30
|
+
...(fixed ? { fixed } : {}),
|
|
31
|
+
...(classes.length > 0 ? { classes } : {}),
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
// Extract prompt
|
|
35
|
+
const promptElement = utils.querySelector(element, 'prompt');
|
|
36
|
+
const prompt = promptElement ? utils.getHtmlContent(promptElement) : null;
|
|
37
|
+
// Extract attributes
|
|
38
|
+
const shuffle = utils.getBooleanAttribute(element, 'shuffle');
|
|
39
|
+
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);
|
|
40
|
+
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
41
|
+
const interactionClasses = utils.getClasses(element);
|
|
42
|
+
const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;
|
|
43
|
+
const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;
|
|
44
|
+
return {
|
|
45
|
+
choices,
|
|
46
|
+
shuffle,
|
|
47
|
+
maxChoices,
|
|
48
|
+
minChoices,
|
|
49
|
+
prompt,
|
|
50
|
+
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
51
|
+
...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),
|
|
52
|
+
...(minSelectionsMessage ? { minSelectionsMessage } : {}),
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
validate(data) {
|
|
56
|
+
const errors = [];
|
|
57
|
+
const warnings = [];
|
|
58
|
+
// Validate choices exist
|
|
59
|
+
if (!data.choices || data.choices.length === 0) {
|
|
60
|
+
errors.push('choiceInteraction must have at least one choice');
|
|
61
|
+
}
|
|
62
|
+
// Validate choice identifiers
|
|
63
|
+
if (data.choices) {
|
|
64
|
+
const identifiers = new Set();
|
|
65
|
+
for (const choice of data.choices) {
|
|
66
|
+
if (!choice.identifier) {
|
|
67
|
+
errors.push('All choices must have an identifier');
|
|
68
|
+
}
|
|
69
|
+
else if (identifiers.has(choice.identifier)) {
|
|
70
|
+
errors.push(`Duplicate choice identifier: ${choice.identifier}`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
identifiers.add(choice.identifier);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Validate maxChoices
|
|
78
|
+
if (data.maxChoices < 0) {
|
|
79
|
+
errors.push('maxChoices must be non-negative');
|
|
80
|
+
}
|
|
81
|
+
if (data.maxChoices === 0) {
|
|
82
|
+
warnings.push('maxChoices=0 means unlimited selections');
|
|
83
|
+
}
|
|
84
|
+
if (data.maxChoices > data.choices.length) {
|
|
85
|
+
warnings.push(`maxChoices (${data.maxChoices}) is greater than the number of choices (${data.choices.length})`);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
valid: errors.length === 0,
|
|
89
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
90
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI customInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from customInteraction elements (custom/portable interactions)
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Custom interaction data extracted from customInteraction elements
|
|
9
|
+
*/
|
|
10
|
+
export interface CustomData {
|
|
11
|
+
xml: string;
|
|
12
|
+
rawAttributes: Record<string, string>;
|
|
13
|
+
prompt: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Standard QTI custom interaction extractor
|
|
17
|
+
* Handles customInteraction elements (vendor-specific or portable custom interactions)
|
|
18
|
+
*/
|
|
19
|
+
export declare const standardCustomExtractor: ElementExtractor<CustomData>;
|
|
20
|
+
//# sourceMappingURL=customExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/customExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,CAAC,UAAU,CAkDhE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI customInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from customInteraction elements (custom/portable interactions)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI custom interaction extractor
|
|
8
|
+
* Handles customInteraction elements (vendor-specific or portable custom interactions)
|
|
9
|
+
*/
|
|
10
|
+
export const standardCustomExtractor = {
|
|
11
|
+
id: 'qti:custom-interaction',
|
|
12
|
+
name: 'QTI Standard Custom Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['customInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI customInteraction (custom/portable interactions)',
|
|
16
|
+
canHandle(element, _context) {
|
|
17
|
+
// All customInteraction elements are handled by this extractor
|
|
18
|
+
return element.rawTagName === 'customInteraction';
|
|
19
|
+
},
|
|
20
|
+
extract(element, context) {
|
|
21
|
+
const { utils } = context;
|
|
22
|
+
// Capture the raw XML for the custom interaction
|
|
23
|
+
const xml = element.outerHTML || element.toString();
|
|
24
|
+
// Extract all attributes
|
|
25
|
+
const rawAttributes = {};
|
|
26
|
+
if (element.attributes) {
|
|
27
|
+
for (const [key, value] of Object.entries(element.attributes)) {
|
|
28
|
+
rawAttributes[key] = String(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Extract prompt (optional)
|
|
32
|
+
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
33
|
+
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
34
|
+
return {
|
|
35
|
+
xml,
|
|
36
|
+
rawAttributes,
|
|
37
|
+
prompt,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
validate(_data) {
|
|
41
|
+
const warnings = [];
|
|
42
|
+
// Warn if no XML content
|
|
43
|
+
if (!_data.xml || _data.xml.trim() === '') {
|
|
44
|
+
warnings.push('customInteraction has no XML content');
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
valid: true,
|
|
48
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI drawingInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from drawingInteraction elements (drawing on canvas)
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Image data for drawing interaction
|
|
9
|
+
*/
|
|
10
|
+
export interface ImageData {
|
|
11
|
+
type: 'image' | 'svg';
|
|
12
|
+
src?: string;
|
|
13
|
+
content?: string;
|
|
14
|
+
width?: string;
|
|
15
|
+
height?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Drawing data extracted from drawingInteraction elements
|
|
19
|
+
*/
|
|
20
|
+
export interface DrawingData {
|
|
21
|
+
imageData: ImageData | null;
|
|
22
|
+
rawAttributes: Record<string, string>;
|
|
23
|
+
prompt: string | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Standard QTI drawing interaction extractor
|
|
27
|
+
* Handles drawingInteraction elements (drawing on a canvas)
|
|
28
|
+
*/
|
|
29
|
+
export declare const standardDrawingExtractor: ElementExtractor<DrawingData>;
|
|
30
|
+
//# sourceMappingURL=drawingExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawingExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/drawingExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,gBAAgB,CAAC,WAAW,CAgFlE,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI drawingInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from drawingInteraction elements (drawing on canvas)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI drawing interaction extractor
|
|
8
|
+
* Handles drawingInteraction elements (drawing on a canvas)
|
|
9
|
+
*/
|
|
10
|
+
export const standardDrawingExtractor = {
|
|
11
|
+
id: 'qti:drawing-interaction',
|
|
12
|
+
name: 'QTI Standard Drawing Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['drawingInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI drawingInteraction (drawing on canvas)',
|
|
16
|
+
canHandle(element, _context) {
|
|
17
|
+
// All drawingInteraction elements are standard
|
|
18
|
+
return element.rawTagName === 'drawingInteraction';
|
|
19
|
+
},
|
|
20
|
+
extract(element, context) {
|
|
21
|
+
const { utils } = context;
|
|
22
|
+
// Extract background image data from object element (optional)
|
|
23
|
+
const objectElements = utils.getChildrenByTag(element, 'object');
|
|
24
|
+
let imageData = null;
|
|
25
|
+
if (objectElements.length > 0) {
|
|
26
|
+
const objectElement = objectElements[0];
|
|
27
|
+
const type = utils.getAttribute(objectElement, 'type', '');
|
|
28
|
+
const data = utils.getAttribute(objectElement, 'data', '');
|
|
29
|
+
const width = utils.getAttribute(objectElement, 'width', '');
|
|
30
|
+
const height = utils.getAttribute(objectElement, 'height', '');
|
|
31
|
+
if (type.startsWith('image/svg')) {
|
|
32
|
+
// Extract inline SVG content
|
|
33
|
+
const content = utils.getHtmlContent(objectElement);
|
|
34
|
+
imageData = {
|
|
35
|
+
type: 'svg',
|
|
36
|
+
content,
|
|
37
|
+
...(width ? { width } : {}),
|
|
38
|
+
...(height ? { height } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
else if (data) {
|
|
42
|
+
// External image reference
|
|
43
|
+
imageData = {
|
|
44
|
+
type: 'image',
|
|
45
|
+
src: data,
|
|
46
|
+
...(width ? { width } : {}),
|
|
47
|
+
...(height ? { height } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Extract all attributes
|
|
52
|
+
const rawAttributes = {};
|
|
53
|
+
if (element.attributes) {
|
|
54
|
+
for (const [key, value] of Object.entries(element.attributes)) {
|
|
55
|
+
rawAttributes[key] = String(value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Extract prompt (optional)
|
|
59
|
+
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
60
|
+
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
61
|
+
return {
|
|
62
|
+
imageData,
|
|
63
|
+
rawAttributes,
|
|
64
|
+
prompt,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
validate(data) {
|
|
68
|
+
const warnings = [];
|
|
69
|
+
// Warn if no background image
|
|
70
|
+
if (!data.imageData) {
|
|
71
|
+
warnings.push('drawingInteraction has no background image - students will draw on a blank canvas');
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
valid: true,
|
|
75
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI endAttemptInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from endAttemptInteraction elements (end attempt button)
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* End attempt data extracted from endAttemptInteraction elements
|
|
9
|
+
*/
|
|
10
|
+
export interface EndAttemptData {
|
|
11
|
+
title?: string;
|
|
12
|
+
countAttempt?: boolean;
|
|
13
|
+
prompt: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Standard QTI end attempt interaction extractor
|
|
17
|
+
* Handles endAttemptInteraction elements (button to end the attempt)
|
|
18
|
+
*/
|
|
19
|
+
export declare const standardEndAttemptExtractor: ElementExtractor<EndAttemptData>;
|
|
20
|
+
//# sourceMappingURL=endAttemptExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endAttemptExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/endAttemptExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,gBAAgB,CAAC,cAAc,CAoDxE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI endAttemptInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from endAttemptInteraction elements (end attempt button)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI end attempt interaction extractor
|
|
8
|
+
* Handles endAttemptInteraction elements (button to end the attempt)
|
|
9
|
+
*/
|
|
10
|
+
export const standardEndAttemptExtractor = {
|
|
11
|
+
id: 'qti:end-attempt-interaction',
|
|
12
|
+
name: 'QTI Standard End Attempt Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['endAttemptInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI endAttemptInteraction (end attempt button)',
|
|
16
|
+
canHandle(element, _context) {
|
|
17
|
+
// All endAttemptInteraction elements are standard
|
|
18
|
+
return element.rawTagName === 'endAttemptInteraction';
|
|
19
|
+
},
|
|
20
|
+
extract(element, context) {
|
|
21
|
+
const { utils } = context;
|
|
22
|
+
// Extract attributes with defaults
|
|
23
|
+
const title = utils.getAttribute(element, 'title', 'End Attempt');
|
|
24
|
+
const countAttempt = element.hasAttribute('countAttempt')
|
|
25
|
+
? utils.getBooleanAttribute(element, 'countAttempt')
|
|
26
|
+
: true;
|
|
27
|
+
// Extract prompt (optional)
|
|
28
|
+
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
29
|
+
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
30
|
+
return {
|
|
31
|
+
title,
|
|
32
|
+
countAttempt,
|
|
33
|
+
prompt,
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
validate(data) {
|
|
37
|
+
const errors = [];
|
|
38
|
+
const warnings = [];
|
|
39
|
+
// Validate title is not empty
|
|
40
|
+
if (!data.title || data.title.trim() === '') {
|
|
41
|
+
errors.push('endAttemptInteraction must have a title');
|
|
42
|
+
}
|
|
43
|
+
// Warn if countAttempt is false (uncommon usage)
|
|
44
|
+
if (data.countAttempt === false) {
|
|
45
|
+
warnings.push('endAttemptInteraction has countAttempt=false - make sure this is intentional');
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
valid: errors.length === 0,
|
|
49
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
50
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI extendedTextInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from extendedTextInteraction elements (multi-line text input)
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Extended text data extracted from extendedTextInteraction elements
|
|
9
|
+
*/
|
|
10
|
+
export interface ExtendedTextData {
|
|
11
|
+
expectedLines: number;
|
|
12
|
+
expectedLength: number;
|
|
13
|
+
placeholderText: string;
|
|
14
|
+
format: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Standard QTI extended text interaction extractor
|
|
18
|
+
* Handles extendedTextInteraction elements (multi-line text input)
|
|
19
|
+
*/
|
|
20
|
+
export declare const standardExtendedTextExtractor: ElementExtractor<ExtendedTextData>;
|
|
21
|
+
//# sourceMappingURL=extendedTextExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extendedTextExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/extendedTextExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,gBAAgB,CAAC,gBAAgB,CAkE5E,CAAC"}
|