@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,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interaction type mappings for strongly-typed registry
|
|
3
|
+
*
|
|
4
|
+
* This file defines the complete type system for the plugin-based
|
|
5
|
+
* interaction renderer registry, ensuring compile-time type safety.
|
|
6
|
+
*/
|
|
7
|
+
import type { HTMLElement } from 'node-html-parser';
|
|
8
|
+
import type { HtmlContent } from './index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Type alias for parsed QTI XML elements
|
|
11
|
+
* Uses node-html-parser's HTMLElement type directly
|
|
12
|
+
*/
|
|
13
|
+
export type QTIElement = HTMLElement;
|
|
14
|
+
export interface BaseInteractionData {
|
|
15
|
+
type: string;
|
|
16
|
+
responseId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ChoiceInteractionData extends BaseInteractionData {
|
|
19
|
+
type: 'choiceInteraction';
|
|
20
|
+
shuffle: boolean;
|
|
21
|
+
maxChoices: number;
|
|
22
|
+
minChoices: number;
|
|
23
|
+
prompt: string | null;
|
|
24
|
+
choices: Array<{
|
|
25
|
+
identifier: string;
|
|
26
|
+
text: HtmlContent;
|
|
27
|
+
fixed?: boolean;
|
|
28
|
+
classes?: string[];
|
|
29
|
+
}>;
|
|
30
|
+
/** CSS classes from the choiceInteraction element for custom renderer detection */
|
|
31
|
+
interactionClasses?: string[];
|
|
32
|
+
/** Message shown when candidate exceeds maxChoices (data-max-selections-message) */
|
|
33
|
+
maxSelectionsMessage?: string | null;
|
|
34
|
+
/** Message shown when candidate submits below minChoices (data-min-selections-message) */
|
|
35
|
+
minSelectionsMessage?: string | null;
|
|
36
|
+
}
|
|
37
|
+
export interface TextEntryInteractionData extends BaseInteractionData {
|
|
38
|
+
type: 'textEntryInteraction';
|
|
39
|
+
expectedLength: number;
|
|
40
|
+
patternMask: string | null;
|
|
41
|
+
placeholderText: string;
|
|
42
|
+
format?: string;
|
|
43
|
+
/** CSS classes from the textEntryInteraction element (e.g. qti-input-width-N) */
|
|
44
|
+
interactionClasses?: string[];
|
|
45
|
+
/** Pattern mask validation message (data-patternmask-message) */
|
|
46
|
+
patternMaskMessage?: string | null;
|
|
47
|
+
}
|
|
48
|
+
export interface ExtendedTextInteractionData extends BaseInteractionData {
|
|
49
|
+
type: 'extendedTextInteraction';
|
|
50
|
+
expectedLines: number;
|
|
51
|
+
expectedLength: number;
|
|
52
|
+
placeholderText: string;
|
|
53
|
+
format: string;
|
|
54
|
+
patternMask?: string | null;
|
|
55
|
+
patternMaskMessage?: string | null;
|
|
56
|
+
/** CSS classes from the extendedTextInteraction element (e.g. qti-height-lines-N) */
|
|
57
|
+
interactionClasses?: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface InlineChoiceInteractionData extends BaseInteractionData {
|
|
60
|
+
type: 'inlineChoiceInteraction';
|
|
61
|
+
shuffle: boolean;
|
|
62
|
+
/** Placeholder label from the QTI <label> child element; shown as the unselected "Select…" option */
|
|
63
|
+
label: string | null;
|
|
64
|
+
/** Placeholder text from data-prompt attribute; alternative to <label> for dropdown default option */
|
|
65
|
+
dataPrompt?: string | null;
|
|
66
|
+
choices: Array<{
|
|
67
|
+
identifier: string;
|
|
68
|
+
text: string;
|
|
69
|
+
fixed?: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
/** CSS classes from the inlineChoiceInteraction element (e.g. qti-input-width-N) */
|
|
72
|
+
interactionClasses?: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface OrderInteractionData extends BaseInteractionData {
|
|
75
|
+
type: 'orderInteraction';
|
|
76
|
+
shuffle: boolean;
|
|
77
|
+
minChoices: number;
|
|
78
|
+
maxChoices: number;
|
|
79
|
+
prompt: string | null;
|
|
80
|
+
choices: Array<{
|
|
81
|
+
identifier: string;
|
|
82
|
+
text: string;
|
|
83
|
+
fixed?: boolean;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
export interface AssociableChoice {
|
|
87
|
+
identifier: string;
|
|
88
|
+
text: string;
|
|
89
|
+
matchMax: number;
|
|
90
|
+
/** Minimum number of times this choice must appear in the response (QTI matchMin) */
|
|
91
|
+
matchMin?: number;
|
|
92
|
+
/** Pairing constraint: choice can only be paired with others sharing a group value (QTI matchGroup) */
|
|
93
|
+
matchGroup?: string[];
|
|
94
|
+
/** CSS classes from the choice element for custom renderer detection */
|
|
95
|
+
classes?: string[];
|
|
96
|
+
}
|
|
97
|
+
export interface MatchInteractionData extends BaseInteractionData {
|
|
98
|
+
type: 'matchInteraction';
|
|
99
|
+
shuffle: boolean;
|
|
100
|
+
maxAssociations: number;
|
|
101
|
+
minAssociations?: number;
|
|
102
|
+
prompt: string | null;
|
|
103
|
+
sourceSet: AssociableChoice[];
|
|
104
|
+
targetSet: AssociableChoice[];
|
|
105
|
+
/** CSS classes from the matchInteraction element (e.g. qti-choices-top, qti-match-tabular) */
|
|
106
|
+
interactionClasses?: string[];
|
|
107
|
+
/** Message shown when candidate exceeds maxAssociations */
|
|
108
|
+
maxSelectionsMessage?: string | null;
|
|
109
|
+
/** Message shown when candidate submits below minAssociations */
|
|
110
|
+
minSelectionsMessage?: string | null;
|
|
111
|
+
/** Label for first column header in tabular mode (data-qti-first-column-header) */
|
|
112
|
+
firstColumnHeader?: string | null;
|
|
113
|
+
}
|
|
114
|
+
export interface AssociateInteractionData extends BaseInteractionData {
|
|
115
|
+
type: 'associateInteraction';
|
|
116
|
+
shuffle: boolean;
|
|
117
|
+
maxAssociations: number;
|
|
118
|
+
minAssociations?: number;
|
|
119
|
+
prompt: string | null;
|
|
120
|
+
choices: AssociableChoice[];
|
|
121
|
+
}
|
|
122
|
+
export interface GapMatchInteractionData extends BaseInteractionData {
|
|
123
|
+
type: 'gapMatchInteraction';
|
|
124
|
+
shuffle: boolean;
|
|
125
|
+
prompt: string | null;
|
|
126
|
+
gapTexts: Array<{
|
|
127
|
+
identifier: string;
|
|
128
|
+
text: string;
|
|
129
|
+
matchMax: number;
|
|
130
|
+
matchGroup?: string[];
|
|
131
|
+
inputWidth?: number;
|
|
132
|
+
}>;
|
|
133
|
+
gaps: Array<{
|
|
134
|
+
identifier: string;
|
|
135
|
+
index: number;
|
|
136
|
+
}>;
|
|
137
|
+
promptText: string;
|
|
138
|
+
/** CSS classes from the gapMatchInteraction element (e.g. qti-choices-top, qti-choices-bottom) */
|
|
139
|
+
interactionClasses?: string[];
|
|
140
|
+
/** Width of the choice container in px (data-choices-container-width) */
|
|
141
|
+
choicesContainerWidth?: string | null;
|
|
142
|
+
/** Message shown when candidate exceeds max associations */
|
|
143
|
+
maxSelectionsMessage?: string | null;
|
|
144
|
+
/** Message shown when candidate submits below min associations */
|
|
145
|
+
minSelectionsMessage?: string | null;
|
|
146
|
+
}
|
|
147
|
+
export interface SliderInteractionData extends BaseInteractionData {
|
|
148
|
+
type: 'sliderInteraction';
|
|
149
|
+
lowerBound: number;
|
|
150
|
+
upperBound: number;
|
|
151
|
+
step: number;
|
|
152
|
+
orientation: string;
|
|
153
|
+
reverse: boolean;
|
|
154
|
+
prompt: string | null;
|
|
155
|
+
}
|
|
156
|
+
export interface ImageData {
|
|
157
|
+
type: 'svg' | 'image';
|
|
158
|
+
content?: HtmlContent;
|
|
159
|
+
src?: string;
|
|
160
|
+
width: string;
|
|
161
|
+
height: string;
|
|
162
|
+
}
|
|
163
|
+
export interface HotspotChoice {
|
|
164
|
+
identifier: string;
|
|
165
|
+
shape: string;
|
|
166
|
+
coords: string;
|
|
167
|
+
/** Author-provided label for the hotspot; used as accessible aria-label */
|
|
168
|
+
hotspotLabel?: string;
|
|
169
|
+
}
|
|
170
|
+
export interface HotspotInteractionData extends BaseInteractionData {
|
|
171
|
+
type: 'hotspotInteraction';
|
|
172
|
+
maxChoices: number;
|
|
173
|
+
minChoices?: number;
|
|
174
|
+
prompt: string | null;
|
|
175
|
+
imageData: ImageData | null;
|
|
176
|
+
hotspotChoices: HotspotChoice[];
|
|
177
|
+
/** CSS classes from the hotspotInteraction element (e.g. qti-selections-light, qti-selections-dark) */
|
|
178
|
+
interactionClasses?: string[];
|
|
179
|
+
/** Message shown when candidate exceeds maxChoices */
|
|
180
|
+
maxSelectionsMessage?: string | null;
|
|
181
|
+
/** Message shown when candidate submits below minChoices */
|
|
182
|
+
minSelectionsMessage?: string | null;
|
|
183
|
+
}
|
|
184
|
+
export interface AssociableHotspot {
|
|
185
|
+
identifier: string;
|
|
186
|
+
shape: string;
|
|
187
|
+
coords: string;
|
|
188
|
+
matchMax: number;
|
|
189
|
+
}
|
|
190
|
+
export interface GraphicGapMatchInteractionData extends BaseInteractionData {
|
|
191
|
+
type: 'graphicGapMatchInteraction';
|
|
192
|
+
prompt: string | null;
|
|
193
|
+
imageData: ImageData | null;
|
|
194
|
+
maxAssociations: number;
|
|
195
|
+
gapTexts: Array<{
|
|
196
|
+
identifier: string;
|
|
197
|
+
text: string;
|
|
198
|
+
matchMax: number;
|
|
199
|
+
matchGroup?: string[];
|
|
200
|
+
}>;
|
|
201
|
+
/** Image-based draggable labels (gapImg elements); rendered as <img> in the choice pool */
|
|
202
|
+
gapImages: Array<{
|
|
203
|
+
identifier: string;
|
|
204
|
+
src: string;
|
|
205
|
+
alt: string;
|
|
206
|
+
matchMax: number;
|
|
207
|
+
matchGroup?: string[];
|
|
208
|
+
width?: number;
|
|
209
|
+
height?: number;
|
|
210
|
+
}>;
|
|
211
|
+
hotspots: AssociableHotspot[];
|
|
212
|
+
/** CSS classes from the graphicGapMatchInteraction element (e.g. qti-choices-top, qti-selections-dark) */
|
|
213
|
+
interactionClasses?: string[];
|
|
214
|
+
/** Width of the choice container in px (data-choices-container-width) */
|
|
215
|
+
choicesContainerWidth?: string | null;
|
|
216
|
+
/** Message shown when candidate exceeds max associations */
|
|
217
|
+
maxSelectionsMessage?: string | null;
|
|
218
|
+
/** Message shown when candidate submits below min associations */
|
|
219
|
+
minSelectionsMessage?: string | null;
|
|
220
|
+
}
|
|
221
|
+
export interface UploadInteractionData extends BaseInteractionData {
|
|
222
|
+
type: 'uploadInteraction';
|
|
223
|
+
prompt: string | null;
|
|
224
|
+
/** Allowed MIME types / extensions (vendor-dependent); empty = accept any */
|
|
225
|
+
fileTypes: string[];
|
|
226
|
+
rawAttributes: Record<string, string>;
|
|
227
|
+
}
|
|
228
|
+
export interface DrawingInteractionData extends BaseInteractionData {
|
|
229
|
+
type: 'drawingInteraction';
|
|
230
|
+
prompt: string | null;
|
|
231
|
+
/** Optional background image/SVG to draw on top of */
|
|
232
|
+
imageData: ImageData | null;
|
|
233
|
+
rawAttributes: Record<string, string>;
|
|
234
|
+
}
|
|
235
|
+
export interface CustomInteractionData extends BaseInteractionData {
|
|
236
|
+
type: 'customInteraction';
|
|
237
|
+
prompt: string | null;
|
|
238
|
+
rawAttributes: Record<string, string>;
|
|
239
|
+
/** Outer XML snippet for debugging (best-effort) */
|
|
240
|
+
xml: string;
|
|
241
|
+
}
|
|
242
|
+
export interface MediaElement {
|
|
243
|
+
type: 'audio' | 'video' | 'object';
|
|
244
|
+
src: string;
|
|
245
|
+
mimeType: string;
|
|
246
|
+
width?: number;
|
|
247
|
+
height?: number;
|
|
248
|
+
}
|
|
249
|
+
export interface MediaInteractionData extends BaseInteractionData {
|
|
250
|
+
type: 'mediaInteraction';
|
|
251
|
+
prompt: string | null;
|
|
252
|
+
autostart: boolean;
|
|
253
|
+
minPlays: number;
|
|
254
|
+
maxPlays: number;
|
|
255
|
+
loop: boolean;
|
|
256
|
+
mediaElement: MediaElement;
|
|
257
|
+
/** Whether the renderer should allow <object> embeds for this interaction (default false) */
|
|
258
|
+
allowObjectEmbeds?: boolean;
|
|
259
|
+
}
|
|
260
|
+
export interface HottextChoice {
|
|
261
|
+
identifier: string;
|
|
262
|
+
text: string;
|
|
263
|
+
}
|
|
264
|
+
export interface HottextInteractionData extends BaseInteractionData {
|
|
265
|
+
type: 'hottextInteraction';
|
|
266
|
+
prompt: string | null;
|
|
267
|
+
maxChoices: number;
|
|
268
|
+
minChoices: number;
|
|
269
|
+
contentHtml: HtmlContent;
|
|
270
|
+
hottextChoices: HottextChoice[];
|
|
271
|
+
/** CSS classes from the hottextInteraction element (e.g. qti-input-control-hidden) */
|
|
272
|
+
interactionClasses?: string[];
|
|
273
|
+
/** Message shown when candidate exceeds maxChoices */
|
|
274
|
+
maxSelectionsMessage?: string | null;
|
|
275
|
+
/** Message shown when candidate submits below minChoices */
|
|
276
|
+
minSelectionsMessage?: string | null;
|
|
277
|
+
}
|
|
278
|
+
export interface Point {
|
|
279
|
+
x: number;
|
|
280
|
+
y: number;
|
|
281
|
+
}
|
|
282
|
+
export interface SelectPointInteractionData extends BaseInteractionData {
|
|
283
|
+
type: 'selectPointInteraction';
|
|
284
|
+
prompt: string | null;
|
|
285
|
+
maxChoices: number;
|
|
286
|
+
minChoices: number;
|
|
287
|
+
imageData: ImageData | null;
|
|
288
|
+
}
|
|
289
|
+
export interface GraphicOrderChoice {
|
|
290
|
+
identifier: string;
|
|
291
|
+
shape: string;
|
|
292
|
+
coords: string;
|
|
293
|
+
label: string;
|
|
294
|
+
}
|
|
295
|
+
export interface GraphicOrderInteractionData extends BaseInteractionData {
|
|
296
|
+
type: 'graphicOrderInteraction';
|
|
297
|
+
prompt: string | null;
|
|
298
|
+
imageData: ImageData | null;
|
|
299
|
+
hotspotChoices: GraphicOrderChoice[];
|
|
300
|
+
}
|
|
301
|
+
export interface GraphicAssociateHotspot {
|
|
302
|
+
identifier: string;
|
|
303
|
+
shape: string;
|
|
304
|
+
coords: string;
|
|
305
|
+
matchMax: number;
|
|
306
|
+
label: string;
|
|
307
|
+
/** Pairing constraint: hotspot can only be associated with others sharing a group value (QTI matchGroup) */
|
|
308
|
+
matchGroup?: string[];
|
|
309
|
+
}
|
|
310
|
+
export interface GraphicAssociateInteractionData extends BaseInteractionData {
|
|
311
|
+
type: 'graphicAssociateInteraction';
|
|
312
|
+
prompt: string | null;
|
|
313
|
+
maxAssociations: number;
|
|
314
|
+
minAssociations: number;
|
|
315
|
+
imageData: ImageData | null;
|
|
316
|
+
associableHotspots: GraphicAssociateHotspot[];
|
|
317
|
+
}
|
|
318
|
+
export interface PositionObjectStage {
|
|
319
|
+
identifier: string;
|
|
320
|
+
matchMax: number;
|
|
321
|
+
objectData: {
|
|
322
|
+
type: 'image' | 'svg';
|
|
323
|
+
src?: string;
|
|
324
|
+
content?: HtmlContent;
|
|
325
|
+
width?: string;
|
|
326
|
+
height?: string;
|
|
327
|
+
} | null;
|
|
328
|
+
label: string;
|
|
329
|
+
}
|
|
330
|
+
export interface PositionObjectInteractionData extends BaseInteractionData {
|
|
331
|
+
type: 'positionObjectInteraction';
|
|
332
|
+
prompt: string | null;
|
|
333
|
+
maxChoices: number;
|
|
334
|
+
minChoices: number;
|
|
335
|
+
centerPoint: boolean;
|
|
336
|
+
imageData: ImageData | null;
|
|
337
|
+
positionObjectStages: PositionObjectStage[];
|
|
338
|
+
}
|
|
339
|
+
export interface EndAttemptInteractionData extends BaseInteractionData {
|
|
340
|
+
type: 'endAttemptInteraction';
|
|
341
|
+
prompt: string | null;
|
|
342
|
+
title: string;
|
|
343
|
+
/** Whether this interaction counts as an attempt (default: true) */
|
|
344
|
+
countAttempt: boolean;
|
|
345
|
+
}
|
|
346
|
+
export type InteractionData = ChoiceInteractionData | TextEntryInteractionData | ExtendedTextInteractionData | InlineChoiceInteractionData | OrderInteractionData | MatchInteractionData | AssociateInteractionData | GapMatchInteractionData | SliderInteractionData | HotspotInteractionData | GraphicGapMatchInteractionData | UploadInteractionData | DrawingInteractionData | CustomInteractionData | MediaInteractionData | HottextInteractionData | SelectPointInteractionData | GraphicOrderInteractionData | GraphicAssociateInteractionData | PositionObjectInteractionData | EndAttemptInteractionData;
|
|
347
|
+
/**
|
|
348
|
+
* QTI interaction type identifier
|
|
349
|
+
* Extensible string type allows custom interaction types
|
|
350
|
+
*/
|
|
351
|
+
export type InteractionType = string;
|
|
352
|
+
/**
|
|
353
|
+
* Map interaction types to their data structures
|
|
354
|
+
* TypeScript will ensure registrations use the correct data type
|
|
355
|
+
*/
|
|
356
|
+
export interface InteractionDataMap {
|
|
357
|
+
choiceInteraction: ChoiceInteractionData;
|
|
358
|
+
textEntryInteraction: TextEntryInteractionData;
|
|
359
|
+
extendedTextInteraction: ExtendedTextInteractionData;
|
|
360
|
+
inlineChoiceInteraction: InlineChoiceInteractionData;
|
|
361
|
+
orderInteraction: OrderInteractionData;
|
|
362
|
+
matchInteraction: MatchInteractionData;
|
|
363
|
+
associateInteraction: AssociateInteractionData;
|
|
364
|
+
gapMatchInteraction: GapMatchInteractionData;
|
|
365
|
+
sliderInteraction: SliderInteractionData;
|
|
366
|
+
hotspotInteraction: HotspotInteractionData;
|
|
367
|
+
graphicGapMatchInteraction: GraphicGapMatchInteractionData;
|
|
368
|
+
uploadInteraction: UploadInteractionData;
|
|
369
|
+
drawingInteraction: DrawingInteractionData;
|
|
370
|
+
customInteraction: CustomInteractionData;
|
|
371
|
+
mediaInteraction: MediaInteractionData;
|
|
372
|
+
hottextInteraction: HottextInteractionData;
|
|
373
|
+
selectPointInteraction: SelectPointInteractionData;
|
|
374
|
+
graphicOrderInteraction: GraphicOrderInteractionData;
|
|
375
|
+
graphicAssociateInteraction: GraphicAssociateInteractionData;
|
|
376
|
+
positionObjectInteraction: PositionObjectInteractionData;
|
|
377
|
+
endAttemptInteraction: EndAttemptInteractionData;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Map interaction types to their response value types
|
|
381
|
+
* Ensures getValue/setValue use the correct types
|
|
382
|
+
*/
|
|
383
|
+
export interface InteractionValueMap {
|
|
384
|
+
choiceInteraction: string | string[];
|
|
385
|
+
textEntryInteraction: string;
|
|
386
|
+
extendedTextInteraction: string;
|
|
387
|
+
inlineChoiceInteraction: string;
|
|
388
|
+
orderInteraction: string[];
|
|
389
|
+
matchInteraction: Record<string, string>;
|
|
390
|
+
associateInteraction: Array<[string, string]>;
|
|
391
|
+
gapMatchInteraction: Record<string, string>;
|
|
392
|
+
sliderInteraction: number;
|
|
393
|
+
hotspotInteraction: string[];
|
|
394
|
+
graphicGapMatchInteraction: Record<string, string>;
|
|
395
|
+
uploadInteraction: import('../types/index.js').QTIFileResponse | null;
|
|
396
|
+
drawingInteraction: string;
|
|
397
|
+
customInteraction: any;
|
|
398
|
+
mediaInteraction: any;
|
|
399
|
+
hottextInteraction: string[];
|
|
400
|
+
selectPointInteraction: Array<{
|
|
401
|
+
x: number;
|
|
402
|
+
y: number;
|
|
403
|
+
}>;
|
|
404
|
+
graphicOrderInteraction: string[];
|
|
405
|
+
graphicAssociateInteraction: Array<[string, string]>;
|
|
406
|
+
positionObjectInteraction: Record<string, {
|
|
407
|
+
x: number;
|
|
408
|
+
y: number;
|
|
409
|
+
}>;
|
|
410
|
+
endAttemptInteraction: boolean;
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=interactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactions.d.ts","sourceRoot":"","sources":["../../src/types/interactions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,UAAU,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MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,qBAAqB,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ResponseValidationSeverity = 'error' | 'warning';
|
|
2
|
+
export interface ResponseValidationIssue {
|
|
3
|
+
responseId: string;
|
|
4
|
+
code: string;
|
|
5
|
+
message: string;
|
|
6
|
+
severity: ResponseValidationSeverity;
|
|
7
|
+
}
|
|
8
|
+
export interface ResponseValidationEntry {
|
|
9
|
+
responseId: string;
|
|
10
|
+
interactionType: string;
|
|
11
|
+
/** Whether this interaction is required for submission purposes (derived from constraints like minPlays/minChoices). */
|
|
12
|
+
required: boolean;
|
|
13
|
+
/** Whether the interaction is complete for submission purposes. */
|
|
14
|
+
complete: boolean;
|
|
15
|
+
/** Whether the response value is valid (shape + constraints). */
|
|
16
|
+
valid: boolean;
|
|
17
|
+
errors: string[];
|
|
18
|
+
warnings: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface ResponseValidationResult {
|
|
21
|
+
valid: boolean;
|
|
22
|
+
entries: Record<string, ResponseValidationEntry>;
|
|
23
|
+
issues: ResponseValidationIssue[];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=responseValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responseValidation.d.ts","sourceRoot":"","sources":["../../src/types/responseValidation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,0BAA0B,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,wHAAwH;IACxH,QAAQ,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACxC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,MAAM,EAAE,uBAAuB,EAAE,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Monitor Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides lightweight performance monitoring for QTI player operations
|
|
5
|
+
* without requiring external dependencies. Useful for debugging, optimization,
|
|
6
|
+
* and tracking performance metrics in production.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Measure operation durations
|
|
10
|
+
* - Track custom metrics
|
|
11
|
+
* - Export performance data
|
|
12
|
+
* - Memory-efficient (circular buffer for metrics)
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { PerformanceMonitor } from './utils/PerformanceMonitor';
|
|
17
|
+
*
|
|
18
|
+
* const monitor = new PerformanceMonitor({ enabled: true, maxEntries: 100 });
|
|
19
|
+
*
|
|
20
|
+
* // Measure an operation
|
|
21
|
+
* const stopTimer = monitor.startTimer('render-item');
|
|
22
|
+
* // ... do work
|
|
23
|
+
* stopTimer(); // Records duration
|
|
24
|
+
*
|
|
25
|
+
* // Track custom metrics
|
|
26
|
+
* monitor.recordMetric('item-response-time', 245);
|
|
27
|
+
*
|
|
28
|
+
* // Get performance report
|
|
29
|
+
* const report = monitor.getReport();
|
|
30
|
+
* console.log(report);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export interface PerformanceEntry {
|
|
34
|
+
/** Metric name */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Timestamp when metric was recorded (ms since epoch) */
|
|
37
|
+
timestamp: number;
|
|
38
|
+
/** Duration in milliseconds (for timers) */
|
|
39
|
+
duration?: number;
|
|
40
|
+
/** Custom value (for non-timer metrics) */
|
|
41
|
+
value?: number;
|
|
42
|
+
/** Additional metadata */
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
export interface PerformanceReport {
|
|
46
|
+
/** Total number of metrics recorded */
|
|
47
|
+
totalEntries: number;
|
|
48
|
+
/** Number of entries currently stored (may be less due to circular buffer) */
|
|
49
|
+
storedEntries: number;
|
|
50
|
+
/** Summary statistics by metric name */
|
|
51
|
+
metrics: Record<string, {
|
|
52
|
+
count: number;
|
|
53
|
+
min: number;
|
|
54
|
+
max: number;
|
|
55
|
+
avg: number;
|
|
56
|
+
total: number;
|
|
57
|
+
}>;
|
|
58
|
+
/** Recent entries (last N based on buffer size) */
|
|
59
|
+
recentEntries: PerformanceEntry[];
|
|
60
|
+
}
|
|
61
|
+
export interface PerformanceMonitorConfig {
|
|
62
|
+
/** Enable/disable monitoring (default: false) */
|
|
63
|
+
enabled?: boolean;
|
|
64
|
+
/** Maximum entries to store (circular buffer, default: 100) */
|
|
65
|
+
maxEntries?: number;
|
|
66
|
+
/** Auto-export metrics when buffer is full (default: false) */
|
|
67
|
+
autoExport?: boolean;
|
|
68
|
+
/** Callback for auto-export */
|
|
69
|
+
onExport?: (report: PerformanceReport) => void;
|
|
70
|
+
/** Log warnings to console (default: false) */
|
|
71
|
+
logWarnings?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export declare class PerformanceMonitor {
|
|
74
|
+
private enabled;
|
|
75
|
+
private maxEntries;
|
|
76
|
+
private autoExport;
|
|
77
|
+
private onExport?;
|
|
78
|
+
private logWarnings;
|
|
79
|
+
private entries;
|
|
80
|
+
private totalRecorded;
|
|
81
|
+
private startTimes;
|
|
82
|
+
constructor(config?: PerformanceMonitorConfig);
|
|
83
|
+
/**
|
|
84
|
+
* Enable performance monitoring
|
|
85
|
+
*/
|
|
86
|
+
enable(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Disable performance monitoring
|
|
89
|
+
*/
|
|
90
|
+
disable(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Check if monitoring is enabled
|
|
93
|
+
*/
|
|
94
|
+
isEnabled(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Start a timer for an operation
|
|
97
|
+
*
|
|
98
|
+
* @param name - Name of the operation
|
|
99
|
+
* @param metadata - Optional metadata to attach
|
|
100
|
+
* @returns Function to stop the timer and record duration
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* const stop = monitor.startTimer('render-item', { itemId: 'item-001' });
|
|
104
|
+
* // ... do work
|
|
105
|
+
* stop(); // Records duration automatically
|
|
106
|
+
*/
|
|
107
|
+
startTimer(name: string, metadata?: Record<string, unknown>): () => void;
|
|
108
|
+
/**
|
|
109
|
+
* Record a custom metric value
|
|
110
|
+
*
|
|
111
|
+
* @param name - Name of the metric
|
|
112
|
+
* @param value - Numeric value
|
|
113
|
+
* @param metadata - Optional metadata
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* monitor.recordMetric('item-count', 25);
|
|
117
|
+
* monitor.recordMetric('memory-usage', process.memoryUsage().heapUsed);
|
|
118
|
+
*/
|
|
119
|
+
recordMetric(name: string, value: number, metadata?: Record<string, unknown>): void;
|
|
120
|
+
/**
|
|
121
|
+
* Record a performance entry
|
|
122
|
+
*/
|
|
123
|
+
private recordEntry;
|
|
124
|
+
/**
|
|
125
|
+
* Get performance report with statistics
|
|
126
|
+
*/
|
|
127
|
+
getReport(): PerformanceReport;
|
|
128
|
+
/**
|
|
129
|
+
* Get entries for a specific metric name
|
|
130
|
+
*/
|
|
131
|
+
getEntriesByName(name: string): PerformanceEntry[];
|
|
132
|
+
/**
|
|
133
|
+
* Clear all stored entries
|
|
134
|
+
*/
|
|
135
|
+
clear(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Export report as JSON string
|
|
138
|
+
*/
|
|
139
|
+
exportJSON(): string;
|
|
140
|
+
/**
|
|
141
|
+
* Export report to console
|
|
142
|
+
*/
|
|
143
|
+
exportToConsole(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Get performance marks for Web Performance API integration
|
|
146
|
+
*
|
|
147
|
+
* If using browser's Performance API, this exports entries
|
|
148
|
+
* in a compatible format.
|
|
149
|
+
*/
|
|
150
|
+
getPerformanceMarks(): Array<{
|
|
151
|
+
name: string;
|
|
152
|
+
startTime: number;
|
|
153
|
+
duration?: number;
|
|
154
|
+
}>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Singleton instance for global performance monitoring
|
|
158
|
+
*
|
|
159
|
+
* Usage:
|
|
160
|
+
* ```typescript
|
|
161
|
+
* import { globalPerformanceMonitor } from './utils/PerformanceMonitor';
|
|
162
|
+
*
|
|
163
|
+
* globalPerformanceMonitor.enable();
|
|
164
|
+
* const stop = globalPerformanceMonitor.startTimer('operation');
|
|
165
|
+
* // ... work
|
|
166
|
+
* stop();
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare const globalPerformanceMonitor: PerformanceMonitor;
|
|
170
|
+
//# sourceMappingURL=PerformanceMonitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PerformanceMonitor.d.ts","sourceRoot":"","sources":["../../src/utils/PerformanceMonitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,WAAW,gBAAgB;IAChC,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,C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