@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,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin System for QTI 2.2 Item Player
|
|
3
|
+
*
|
|
4
|
+
* Provides extensible plugin architecture for custom extractors
|
|
5
|
+
* and interaction rendering.
|
|
6
|
+
*/
|
|
7
|
+
import type { ExtractionRegistry } from '../extraction/ExtractionRegistry.js';
|
|
8
|
+
import type { PlayerConfig, QTIRole } from '../types/index.js';
|
|
9
|
+
import type { ComponentRegistry } from './ComponentRegistry.js';
|
|
10
|
+
import type { Player } from './Player.js';
|
|
11
|
+
/**
|
|
12
|
+
* QTI element type (from node-html-parser or browser DOM)
|
|
13
|
+
*/
|
|
14
|
+
export type QTIElement = any;
|
|
15
|
+
/**
|
|
16
|
+
* QTI Plugin interface
|
|
17
|
+
*
|
|
18
|
+
* Plugins can register custom extractors and web components to handle vendor-specific QTI extensions.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const myPlugin: QTIPlugin = {
|
|
23
|
+
* name: '@vendor/my-qti-plugin',
|
|
24
|
+
* version: '1.0.0',
|
|
25
|
+
* description: 'Custom QTI extensions',
|
|
26
|
+
*
|
|
27
|
+
* registerExtractors(registry: ExtractionRegistry) {
|
|
28
|
+
* // Register custom element extractors
|
|
29
|
+
* registry.register(myCustomExtractor);
|
|
30
|
+
* },
|
|
31
|
+
*
|
|
32
|
+
* registerComponents(registry: ComponentRegistry) {
|
|
33
|
+
* // Register custom web components
|
|
34
|
+
* registry.register('choiceInteraction', {
|
|
35
|
+
* name: 'my-choice',
|
|
36
|
+
* priority: 100,
|
|
37
|
+
* canHandle: (data) => data.interactionClasses?.includes('my-custom'),
|
|
38
|
+
* tagName: 'my-custom-choice'
|
|
39
|
+
* });
|
|
40
|
+
* }
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface QTIPlugin {
|
|
45
|
+
/** Unique plugin identifier */
|
|
46
|
+
name: string;
|
|
47
|
+
/** Semantic version */
|
|
48
|
+
version: string;
|
|
49
|
+
/** Optional plugin description */
|
|
50
|
+
description?: string;
|
|
51
|
+
/** Dependencies on other plugins (by name) */
|
|
52
|
+
dependencies?: string[];
|
|
53
|
+
/** Lifecycle hooks */
|
|
54
|
+
lifecycle?: PluginLifecycle;
|
|
55
|
+
/** Register custom extractors with the extraction registry */
|
|
56
|
+
registerExtractors?(registry: ExtractionRegistry): void;
|
|
57
|
+
/** Register custom web components with the component registry */
|
|
58
|
+
registerComponents?(registry: ComponentRegistry): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Plugin lifecycle hooks
|
|
62
|
+
*/
|
|
63
|
+
export interface PluginLifecycle {
|
|
64
|
+
/** Called when plugin is registered */
|
|
65
|
+
onRegister?(context: PluginContext): void | Promise<void>;
|
|
66
|
+
/** Called before item rendering starts */
|
|
67
|
+
onBeforeRender?(context: RenderContext): void | Promise<void>;
|
|
68
|
+
/** Called after item rendering completes */
|
|
69
|
+
onAfterRender?(context: RenderContext): void | Promise<void>;
|
|
70
|
+
/** Called when plugin is unregistered */
|
|
71
|
+
onUnregister?(): void | Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Context provided to plugins during registration
|
|
75
|
+
*
|
|
76
|
+
* Note: Player reference is NOT available during registration to avoid circular dependencies.
|
|
77
|
+
* Use RenderContext for lifecycle hooks that need Player access.
|
|
78
|
+
*/
|
|
79
|
+
export interface PluginContext {
|
|
80
|
+
/** Extraction registry for custom extractors */
|
|
81
|
+
extractionRegistry: ExtractionRegistry;
|
|
82
|
+
/** Component registry for custom web components */
|
|
83
|
+
componentRegistry: ComponentRegistry;
|
|
84
|
+
/** Item document (if loaded) - can be browser Document or node-html-parser HTMLElement */
|
|
85
|
+
dom?: QTIElement;
|
|
86
|
+
/** Player configuration */
|
|
87
|
+
config: PlayerConfig;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Context provided during rendering lifecycle hooks
|
|
91
|
+
* Extends PluginContext with Player instance access
|
|
92
|
+
*/
|
|
93
|
+
export interface RenderContext extends PluginContext {
|
|
94
|
+
/** Player instance (available during render hooks) */
|
|
95
|
+
player: Player;
|
|
96
|
+
/**
|
|
97
|
+
* Rendering context (minimal and stable).
|
|
98
|
+
* Note: rendering is via web components; this config is primarily for lifecycle hooks.
|
|
99
|
+
*/
|
|
100
|
+
config: {
|
|
101
|
+
role: QTIRole;
|
|
102
|
+
options?: Record<string, any>;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/core/Plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,SAAS;IACzB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IAEb,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAEhB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,sBAAsB;IACtB,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,8DAA8D;IAC9D,kBAAkB,CAAC,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAExD,iEAAiE;IACjE,kBAAkB,CAAC,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,uCAAuC;IACvC,UAAU,CAAC,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1D,0CAA0C;IAC1C,cAAc,CAAC,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D,4CAA4C;IAC5C,aAAa,CAAC,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D,yCAAyC;IACzC,YAAY,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,gDAAgD;IAChD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,mDAAmD;IACnD,iBAAiB,EAAE,iBAAiB,CAAC;IAErC,0FAA0F;IAC1F,GAAG,CAAC,EAAE,UAAU,CAAC;IAEjB,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,aAAa;IACnD,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,EAAE;QACP,IAAI,EAAE,OAAO,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages plugin registration, dependency resolution, and lifecycle.
|
|
5
|
+
*/
|
|
6
|
+
import type { PluginContext, QTIPlugin, RenderContext } from './Plugin.js';
|
|
7
|
+
export declare class PluginManager {
|
|
8
|
+
private plugins;
|
|
9
|
+
private initialized;
|
|
10
|
+
/**
|
|
11
|
+
* Register a plugin
|
|
12
|
+
* @throws Error if plugin is invalid or dependencies are missing
|
|
13
|
+
*/
|
|
14
|
+
register(plugin: QTIPlugin, context: PluginContext): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Unregister a plugin
|
|
17
|
+
*/
|
|
18
|
+
unregister(pluginName: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Get all registered plugins
|
|
21
|
+
*/
|
|
22
|
+
getAll(): QTIPlugin[];
|
|
23
|
+
/**
|
|
24
|
+
* Get plugin by name
|
|
25
|
+
*/
|
|
26
|
+
get(name: string): QTIPlugin | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Check if plugin is registered
|
|
29
|
+
*/
|
|
30
|
+
has(name: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if plugin is initialized
|
|
33
|
+
*/
|
|
34
|
+
isInitialized(name: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Call onBeforeRender hooks for all plugins
|
|
37
|
+
*/
|
|
38
|
+
callBeforeRenderHooks(context: RenderContext): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Call onAfterRender hooks for all plugins
|
|
41
|
+
*/
|
|
42
|
+
callAfterRenderHooks(context: RenderContext): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Validate plugin structure
|
|
45
|
+
*/
|
|
46
|
+
private validatePlugin;
|
|
47
|
+
/**
|
|
48
|
+
* Check if plugin dependencies are satisfied
|
|
49
|
+
*/
|
|
50
|
+
private checkDependencies;
|
|
51
|
+
/**
|
|
52
|
+
* Clear all plugins
|
|
53
|
+
*/
|
|
54
|
+
clear(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=PluginManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginManager.d.ts","sourceRoot":"","sources":["../../src/core/PluginManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,MAAM,aAAa,CAAC;AAErB,qBAAa,aAAa;IACzB,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,WAAW,CAAqB;IAExC;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BxE;;OAEG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcnD;;OAEG;IACH,MAAM,IAAI,SAAS,EAAE;IAIrB;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIxC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOpC;;OAEG;IACG,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAalE;;OAEG;IACG,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAajE;;OAEG;IACH,OAAO,CAAC,cAAc;IAiBtB;;OAEG;YACW,iBAAiB;IAoB/B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5B"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages plugin registration, dependency resolution, and lifecycle.
|
|
5
|
+
*/
|
|
6
|
+
export class PluginManager {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.plugins = new Map();
|
|
9
|
+
this.initialized = new Set();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Register a plugin
|
|
13
|
+
* @throws Error if plugin is invalid or dependencies are missing
|
|
14
|
+
*/
|
|
15
|
+
async register(plugin, context) {
|
|
16
|
+
// Validate plugin
|
|
17
|
+
this.validatePlugin(plugin);
|
|
18
|
+
// Check if already registered
|
|
19
|
+
if (this.plugins.has(plugin.name)) {
|
|
20
|
+
throw new Error(`Plugin '${plugin.name}' is already registered`);
|
|
21
|
+
}
|
|
22
|
+
// Check dependencies
|
|
23
|
+
await this.checkDependencies(plugin);
|
|
24
|
+
// Store plugin
|
|
25
|
+
this.plugins.set(plugin.name, plugin);
|
|
26
|
+
// Call lifecycle hook
|
|
27
|
+
try {
|
|
28
|
+
await plugin.lifecycle?.onRegister?.(context);
|
|
29
|
+
this.initialized.add(plugin.name);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
// Rollback on error
|
|
33
|
+
this.plugins.delete(plugin.name);
|
|
34
|
+
throw new Error(`Failed to initialize plugin '${plugin.name}': ${error instanceof Error ? error.message : String(error)}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Unregister a plugin
|
|
39
|
+
*/
|
|
40
|
+
async unregister(pluginName) {
|
|
41
|
+
const plugin = this.plugins.get(pluginName);
|
|
42
|
+
if (!plugin)
|
|
43
|
+
return;
|
|
44
|
+
try {
|
|
45
|
+
// Call lifecycle hook
|
|
46
|
+
await plugin.lifecycle?.onUnregister?.();
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
// Remove plugin even if hook fails
|
|
50
|
+
this.plugins.delete(pluginName);
|
|
51
|
+
this.initialized.delete(pluginName);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get all registered plugins
|
|
56
|
+
*/
|
|
57
|
+
getAll() {
|
|
58
|
+
return Array.from(this.plugins.values());
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get plugin by name
|
|
62
|
+
*/
|
|
63
|
+
get(name) {
|
|
64
|
+
return this.plugins.get(name);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if plugin is registered
|
|
68
|
+
*/
|
|
69
|
+
has(name) {
|
|
70
|
+
return this.plugins.has(name);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if plugin is initialized
|
|
74
|
+
*/
|
|
75
|
+
isInitialized(name) {
|
|
76
|
+
return this.initialized.has(name);
|
|
77
|
+
}
|
|
78
|
+
// Legacy getRendererRegistrations() method removed
|
|
79
|
+
// Plugins now register components via ComponentRegistry instead
|
|
80
|
+
/**
|
|
81
|
+
* Call onBeforeRender hooks for all plugins
|
|
82
|
+
*/
|
|
83
|
+
async callBeforeRenderHooks(context) {
|
|
84
|
+
for (const plugin of this.plugins.values()) {
|
|
85
|
+
try {
|
|
86
|
+
await plugin.lifecycle?.onBeforeRender?.(context);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error(`Plugin '${plugin.name}' onBeforeRender hook failed:`, error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Call onAfterRender hooks for all plugins
|
|
95
|
+
*/
|
|
96
|
+
async callAfterRenderHooks(context) {
|
|
97
|
+
for (const plugin of this.plugins.values()) {
|
|
98
|
+
try {
|
|
99
|
+
await plugin.lifecycle?.onAfterRender?.(context);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error(`Plugin '${plugin.name}' onAfterRender hook failed:`, error);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Validate plugin structure
|
|
108
|
+
*/
|
|
109
|
+
validatePlugin(plugin) {
|
|
110
|
+
if (!plugin.name || typeof plugin.name !== 'string') {
|
|
111
|
+
throw new Error('Plugin must have a valid name');
|
|
112
|
+
}
|
|
113
|
+
if (!plugin.version || typeof plugin.version !== 'string') {
|
|
114
|
+
throw new Error(`Plugin '${plugin.name}' must have a valid version`);
|
|
115
|
+
}
|
|
116
|
+
// Validate semantic version format (basic check)
|
|
117
|
+
if (!/^\d+\.\d+\.\d+/.test(plugin.version)) {
|
|
118
|
+
throw new Error(`Plugin '${plugin.name}' has invalid version format: ${plugin.version}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Check if plugin dependencies are satisfied
|
|
123
|
+
*/
|
|
124
|
+
async checkDependencies(plugin) {
|
|
125
|
+
if (!plugin.dependencies || plugin.dependencies.length === 0) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const missing = [];
|
|
129
|
+
for (const dep of plugin.dependencies) {
|
|
130
|
+
if (!this.plugins.has(dep)) {
|
|
131
|
+
missing.push(dep);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (missing.length > 0) {
|
|
135
|
+
throw new Error(`Plugin '${plugin.name}' has missing dependencies: ${missing.join(', ')}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Clear all plugins
|
|
140
|
+
*/
|
|
141
|
+
async clear() {
|
|
142
|
+
const plugins = Array.from(this.plugins.keys());
|
|
143
|
+
for (const pluginName of plugins) {
|
|
144
|
+
await this.unregister(pluginName);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI constants and configuration
|
|
3
|
+
*/
|
|
4
|
+
import type { VariableDeclaration } from '../types/index.js';
|
|
5
|
+
export declare const PREFIX = "pie-qti";
|
|
6
|
+
export declare const ID = "data-pie-qti-identifier";
|
|
7
|
+
export declare const RESPONSE_ID = "data-pie-qti-response-identifier";
|
|
8
|
+
export declare const TAG = "data-pie-qti-tag";
|
|
9
|
+
export declare const NAVMODE = "data-pie-qti-navigation-mode";
|
|
10
|
+
export declare const SHOWHIDE = "data-pie-qti-show-hide";
|
|
11
|
+
export declare const ANSWERED = "pie-qti-answered";
|
|
12
|
+
export declare const ASSOCIABLE = "pie-qti-associable";
|
|
13
|
+
export declare const ASSOCIATION = "pie-qti-association";
|
|
14
|
+
export declare const CHOICES = "pie-qti-choices";
|
|
15
|
+
export declare const CLICKED = "pie-qti-clicked";
|
|
16
|
+
export declare const CURRENT = "pie-qti-current";
|
|
17
|
+
export declare const DRAGGING = "pie-qti-dragging";
|
|
18
|
+
export declare const DRAGOVER = "pie-qti-dragover";
|
|
19
|
+
export declare const GAP = "pie-qti-gap";
|
|
20
|
+
export declare const GHOST = "pie-qti-ghost";
|
|
21
|
+
export declare const HOTSPOT = "pie-qti-hotspot";
|
|
22
|
+
export declare const INTERACTION = "pie-qti-interaction";
|
|
23
|
+
export declare const MATCH = "pie-qti-match";
|
|
24
|
+
export declare const MATCHED = "pie-qti-matched";
|
|
25
|
+
export declare const MODAL = "pie-qti-modal";
|
|
26
|
+
export declare const NAVIGATION = "pie-qti-navigation";
|
|
27
|
+
export declare const PIVOTABLE = "pie-qti-pivotable";
|
|
28
|
+
export declare const SELECTED = "pie-qti-selected";
|
|
29
|
+
export declare const ASSOCIABLE_SEL = ".pie-qti-associable";
|
|
30
|
+
export declare const ASSOCIATION_SEL = ".pie-qti-association";
|
|
31
|
+
export declare const CHOICES_SEL = ".pie-qti-choices";
|
|
32
|
+
export declare const CLICKED_SEL = ".pie-qti-clicked";
|
|
33
|
+
export declare const DRAGGING_SEL = ".pie-qti-dragging";
|
|
34
|
+
export declare const DRAGOVER_SEL = ".pie-qti-dragover";
|
|
35
|
+
export declare const GAP_IMG_SEL = "[data-pie-qti-tag=\"gapImg\"]";
|
|
36
|
+
export declare const GAP_SEL = ".pie-qti-gap";
|
|
37
|
+
export declare const GAP_TEXT_SEL = "[data-pie-qti-tag=\"gapText\"]";
|
|
38
|
+
export declare const GHOST_SEL = ".pie-qti-ghost";
|
|
39
|
+
export declare const HOTSPOT_SEL = ".pie-qti-hotspot";
|
|
40
|
+
export declare const INTERACTION_SEL = ".pie-qti-interaction";
|
|
41
|
+
export declare const ITEM_SEL = "[data-pie-qti-tag=\"assessmentItem\"]";
|
|
42
|
+
export declare const SIMPLECHOICE_SEL = "[data-pie-qti-tag=\"simpleChoice\"]";
|
|
43
|
+
export declare const MSG_OK = "pie-qti-msg-ok";
|
|
44
|
+
export declare const MSG_NONE = "pie-qti-msg-none";
|
|
45
|
+
export declare const MSG_NO_SKIP = "pie-qti-msg-no-skip";
|
|
46
|
+
export declare const MSG_TOO_MANY = "pie-qti-msg-too-many";
|
|
47
|
+
export declare const MSG_TOO_FEW = "pie-qti-msg-too-few";
|
|
48
|
+
export declare const MSG_MISMATCH = "pie-qti-msg-match-not-allowed";
|
|
49
|
+
export declare const BUILTIN_DECLARATIONS: Record<string, VariableDeclaration>;
|
|
50
|
+
/**
|
|
51
|
+
* QTI 2.2 Response Processing Templates namespace.
|
|
52
|
+
* Note: Template resolution is namespace-agnostic - only the template filename is used.
|
|
53
|
+
* Templates from v2p0, v2p1, and v2p2 namespaces are all supported.
|
|
54
|
+
*/
|
|
55
|
+
export declare const RPTEMPLATES = "http://www.imsglobal.org/question/qti_v2p2/rptemplates";
|
|
56
|
+
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
57
|
+
export declare const XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
58
|
+
export declare const XML_NS = "http://www.w3.org/XML/1998/namespace";
|
|
59
|
+
export declare const DEFAULT_THEME = "theme";
|
|
60
|
+
export declare const MAX_TABLE_COLS = 4;
|
|
61
|
+
export declare const EN: {
|
|
62
|
+
UPLOAD: string;
|
|
63
|
+
COMMENT: string;
|
|
64
|
+
EXPECTED_CHARS: (len: number) => string;
|
|
65
|
+
EXPECTED_LINES: (lines: number) => string;
|
|
66
|
+
END_TEST: string;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,eAAO,MAAM,MAAM,YAAY,CAAC;AAGhC,eAAO,MAAM,EAAE,4BAA8B,CAAC;AAC9C,eAAO,MAAM,WAAW,qCAAuC,CAAC;AAChE,eAAO,MAAM,GAAG,qBAAuB,CAAC;AACxC,eAAO,MAAM,OAAO,iCAAmC,CAAC;AACxD,eAAO,MAAM,QAAQ,2BAA6B,CAAC;AAGnD,eAAO,MAAM,QAAQ,qBAAuB,CAAC;AAC7C,eAAO,MAAM,UAAU,uBAAyB,CAAC;AACjD,eAAO,MAAM,WAAW,wBAA0B,CAAC;AACnD,eAAO,MAAM,OAAO,oBAAsB,CAAC;AAC3C,eAAO,MAAM,OAAO,oBAAsB,CAAC;AAC3C,eAAO,MAAM,OAAO,oBAAsB,CAAC;AAC3C,eAAO,MAAM,QAAQ,qBAAuB,CAAC;AAC7C,eAAO,MAAM,QAAQ,qBAAuB,CAAC;AAC7C,eAAO,MAAM,GAAG,gBAAkB,CAAC;AACnC,eAAO,MAAM,KAAK,kBAAoB,CAAC;AACvC,eAAO,MAAM,OAAO,oBAAsB,CAAC;AAC3C,eAAO,MAAM,WAAW,wBAA0B,CAAC;AACnD,eAAO,MAAM,KAAK,kBAAoB,CAAC;AACvC,eAAO,MAAM,OAAO,oBAAsB,CAAC;AAC3C,eAAO,MAAM,KAAK,kBAAoB,CAAC;AACvC,eAAO,MAAM,UAAU,uBAAyB,CAAC;AACjD,eAAO,MAAM,SAAS,sBAAwB,CAAC;AAC/C,eAAO,MAAM,QAAQ,qBAAuB,CAAC;AAG7C,eAAO,MAAM,cAAc,wBAAmB,CAAC;AAC/C,eAAO,MAAM,eAAe,yBAAoB,CAAC;AACjD,eAAO,MAAM,WAAW,qBAAgB,CAAC;AACzC,eAAO,MAAM,WAAW,qBAAgB,CAAC;AACzC,eAAO,MAAM,YAAY,sBAAiB,CAAC;AAC3C,eAAO,MAAM,YAAY,sBAAiB,CAAC;AAC3C,eAAO,MAAM,WAAW,kCAAsB,CAAC;AAC/C,eAAO,MAAM,OAAO,iBAAY,CAAC;AACjC,eAAO,MAAM,YAAY,mCAAuB,CAAC;AACjD,eAAO,MAAM,SAAS,mBAAc,CAAC;AACrC,eAAO,MAAM,WAAW,qBAAgB,CAAC;AACzC,eAAO,MAAM,eAAe,yBAAoB,CAAC;AACjD,eAAO,MAAM,QAAQ,0CAA8B,CAAC;AACpD,eAAO,MAAM,gBAAgB,wCAA4B,CAAC;AAG1D,eAAO,MAAM,MAAM,mBAAqB,CAAC;AACzC,eAAO,MAAM,QAAQ,qBAAuB,CAAC;AAC7C,eAAO,MAAM,WAAW,wBAA0B,CAAC;AACnD,eAAO,MAAM,YAAY,yBAA2B,CAAC;AACrD,eAAO,MAAM,WAAW,wBAA0B,CAAC;AACnD,eAAO,MAAM,YAAY,kCAAoC,CAAC;AAG9D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CA+BpE,CAAC;AAGF;;;;GAIG;AACH,eAAO,MAAM,WAAW,2DAA2D,CAAC;AACpF,eAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,eAAO,MAAM,QAAQ,iCAAiC,CAAC;AACvD,eAAO,MAAM,MAAM,yCAAyC,CAAC;AAG7D,eAAO,MAAM,aAAa,UAAU,CAAC;AACrC,eAAO,MAAM,cAAc,IAAI,CAAC;AAGhC,eAAO,MAAM,EAAE;;;0BAGQ,MAAM;4BACJ,MAAM;;CAE9B,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI constants and configuration
|
|
3
|
+
*/
|
|
4
|
+
// Prefix for data attributes and CSS classes
|
|
5
|
+
export const PREFIX = 'pie-qti';
|
|
6
|
+
// Data attributes
|
|
7
|
+
export const ID = `data-${PREFIX}-identifier`;
|
|
8
|
+
export const RESPONSE_ID = `data-${PREFIX}-response-identifier`;
|
|
9
|
+
export const TAG = `data-${PREFIX}-tag`;
|
|
10
|
+
export const NAVMODE = `data-${PREFIX}-navigation-mode`;
|
|
11
|
+
export const SHOWHIDE = `data-${PREFIX}-show-hide`;
|
|
12
|
+
// CSS class names
|
|
13
|
+
export const ANSWERED = `${PREFIX}-answered`;
|
|
14
|
+
export const ASSOCIABLE = `${PREFIX}-associable`;
|
|
15
|
+
export const ASSOCIATION = `${PREFIX}-association`;
|
|
16
|
+
export const CHOICES = `${PREFIX}-choices`;
|
|
17
|
+
export const CLICKED = `${PREFIX}-clicked`;
|
|
18
|
+
export const CURRENT = `${PREFIX}-current`;
|
|
19
|
+
export const DRAGGING = `${PREFIX}-dragging`;
|
|
20
|
+
export const DRAGOVER = `${PREFIX}-dragover`;
|
|
21
|
+
export const GAP = `${PREFIX}-gap`;
|
|
22
|
+
export const GHOST = `${PREFIX}-ghost`;
|
|
23
|
+
export const HOTSPOT = `${PREFIX}-hotspot`;
|
|
24
|
+
export const INTERACTION = `${PREFIX}-interaction`;
|
|
25
|
+
export const MATCH = `${PREFIX}-match`;
|
|
26
|
+
export const MATCHED = `${PREFIX}-matched`;
|
|
27
|
+
export const MODAL = `${PREFIX}-modal`;
|
|
28
|
+
export const NAVIGATION = `${PREFIX}-navigation`;
|
|
29
|
+
export const PIVOTABLE = `${PREFIX}-pivotable`;
|
|
30
|
+
export const SELECTED = `${PREFIX}-selected`;
|
|
31
|
+
// CSS selectors
|
|
32
|
+
export const ASSOCIABLE_SEL = `.${ASSOCIABLE}`;
|
|
33
|
+
export const ASSOCIATION_SEL = `.${ASSOCIATION}`;
|
|
34
|
+
export const CHOICES_SEL = `.${CHOICES}`;
|
|
35
|
+
export const CLICKED_SEL = `.${CLICKED}`;
|
|
36
|
+
export const DRAGGING_SEL = `.${DRAGGING}`;
|
|
37
|
+
export const DRAGOVER_SEL = `.${DRAGOVER}`;
|
|
38
|
+
export const GAP_IMG_SEL = `[${TAG}="gapImg"]`;
|
|
39
|
+
export const GAP_SEL = `.${GAP}`;
|
|
40
|
+
export const GAP_TEXT_SEL = `[${TAG}="gapText"]`;
|
|
41
|
+
export const GHOST_SEL = `.${GHOST}`;
|
|
42
|
+
export const HOTSPOT_SEL = `.${HOTSPOT}`;
|
|
43
|
+
export const INTERACTION_SEL = `.${INTERACTION}`;
|
|
44
|
+
export const ITEM_SEL = `[${TAG}="assessmentItem"]`;
|
|
45
|
+
export const SIMPLECHOICE_SEL = `[${TAG}="simpleChoice"]`;
|
|
46
|
+
// Message identifiers
|
|
47
|
+
export const MSG_OK = `${PREFIX}-msg-ok`;
|
|
48
|
+
export const MSG_NONE = `${PREFIX}-msg-none`;
|
|
49
|
+
export const MSG_NO_SKIP = `${PREFIX}-msg-no-skip`;
|
|
50
|
+
export const MSG_TOO_MANY = `${PREFIX}-msg-too-many`;
|
|
51
|
+
export const MSG_TOO_FEW = `${PREFIX}-msg-too-few`;
|
|
52
|
+
export const MSG_MISMATCH = `${PREFIX}-msg-match-not-allowed`;
|
|
53
|
+
// Built-in QTI variable declarations
|
|
54
|
+
export const BUILTIN_DECLARATIONS = {
|
|
55
|
+
numAttempts: {
|
|
56
|
+
identifier: 'numAttempts',
|
|
57
|
+
value: 0,
|
|
58
|
+
baseType: 'integer',
|
|
59
|
+
cardinality: 'single',
|
|
60
|
+
},
|
|
61
|
+
duration: {
|
|
62
|
+
identifier: 'duration',
|
|
63
|
+
value: null,
|
|
64
|
+
baseType: 'duration',
|
|
65
|
+
cardinality: 'single',
|
|
66
|
+
},
|
|
67
|
+
completionStatus: {
|
|
68
|
+
identifier: 'completionStatus',
|
|
69
|
+
value: 'not_attempted',
|
|
70
|
+
baseType: 'string',
|
|
71
|
+
cardinality: 'single',
|
|
72
|
+
},
|
|
73
|
+
$comment: {
|
|
74
|
+
identifier: '$comment',
|
|
75
|
+
value: null,
|
|
76
|
+
baseType: 'string',
|
|
77
|
+
cardinality: 'single',
|
|
78
|
+
},
|
|
79
|
+
$dirty: {
|
|
80
|
+
identifier: '$dirty',
|
|
81
|
+
value: false,
|
|
82
|
+
baseType: 'boolean',
|
|
83
|
+
cardinality: 'single',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
// Namespaces
|
|
87
|
+
/**
|
|
88
|
+
* QTI 2.2 Response Processing Templates namespace.
|
|
89
|
+
* Note: Template resolution is namespace-agnostic - only the template filename is used.
|
|
90
|
+
* Templates from v2p0, v2p1, and v2p2 namespaces are all supported.
|
|
91
|
+
*/
|
|
92
|
+
export const RPTEMPLATES = 'http://www.imsglobal.org/question/qti_v2p2/rptemplates';
|
|
93
|
+
export const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
94
|
+
export const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
95
|
+
export const XML_NS = 'http://www.w3.org/XML/1998/namespace';
|
|
96
|
+
// UI constants
|
|
97
|
+
export const DEFAULT_THEME = 'theme';
|
|
98
|
+
export const MAX_TABLE_COLS = 4;
|
|
99
|
+
// Localization (English defaults)
|
|
100
|
+
export const EN = {
|
|
101
|
+
UPLOAD: 'Upload file',
|
|
102
|
+
COMMENT: 'Comment on this question if you wish.',
|
|
103
|
+
EXPECTED_CHARS: (len) => `expected: ${len} chars`,
|
|
104
|
+
EXPECTED_LINES: (lines) => `expected: ${lines} lines`,
|
|
105
|
+
END_TEST: '<p>You have reached the end of the test</p>',
|
|
106
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI variable declarations management
|
|
3
|
+
* Ported from an earlier implementation
|
|
4
|
+
*/
|
|
5
|
+
import type { AreaMapping, Mapping, VariableDeclaration } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Declarations storage for an item or section
|
|
8
|
+
*/
|
|
9
|
+
export interface DeclarationsContext {
|
|
10
|
+
declarations: Record<string, VariableDeclaration>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Initialize declarations for an element
|
|
14
|
+
*/
|
|
15
|
+
export declare function initializeDeclarations(declarations: Record<string, VariableDeclaration>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Add a response or outcome declaration
|
|
18
|
+
*/
|
|
19
|
+
export declare function addDeclaration(declarations: Record<string, VariableDeclaration>, identifier: string, baseType: VariableDeclaration['baseType'], cardinality: VariableDeclaration['cardinality'], defaultValue?: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* Add a mapping to a response declaration
|
|
22
|
+
*/
|
|
23
|
+
export declare function addMapping(declarations: Record<string, VariableDeclaration>, identifier: string, mapping: Mapping): void;
|
|
24
|
+
/**
|
|
25
|
+
* Add an area mapping to a response declaration
|
|
26
|
+
*/
|
|
27
|
+
export declare function addAreaMapping(declarations: Record<string, VariableDeclaration>, identifier: string, areaMapping: AreaMapping): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get a variable value from declarations
|
|
30
|
+
* @returns {any} QTI variables can hold any type
|
|
31
|
+
*/
|
|
32
|
+
export declare function getVariableValue(declarations: Record<string, VariableDeclaration>, identifier: string): any;
|
|
33
|
+
/**
|
|
34
|
+
* Set a variable value in declarations
|
|
35
|
+
*/
|
|
36
|
+
export declare function setVariableValue(declarations: Record<string, VariableDeclaration>, identifier: string, value: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* Reset declarations to default values
|
|
39
|
+
*/
|
|
40
|
+
export declare function resetDeclarations(declarations: Record<string, VariableDeclaration>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Clone declarations (useful for creating new sessions)
|
|
43
|
+
*/
|
|
44
|
+
export declare function cloneDeclarations(source: Record<string, VariableDeclaration>): Record<string, VariableDeclaration>;
|
|
45
|
+
//# sourceMappingURL=declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../../src/core/declarations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGnF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAClD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,IAAI,CAM9F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,EACzC,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,YAAY,CAAC,EAAE,GAAG,GAChB,IAAI,CAUN;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,GACd,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,WAAW,GACtB,IAAI,CAKN;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,UAAU,EAAE,MAAM,GAChB,GAAG,CAGL;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,GAAG,GACR,IAAI,CAyCN;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,IAAI,CAUzF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GACzC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAarC"}
|