@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
package/src/types/index.ts
CHANGED
|
@@ -2,24 +2,28 @@
|
|
|
2
2
|
* Core QTI types for the player
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
BaseType as ProcessingBaseType,
|
|
7
|
+
Cardinality as ProcessingCardinality,
|
|
8
|
+
QtiValue,
|
|
9
|
+
} from '@pie-qti/qti-processing';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* QTI base type identifier
|
|
9
13
|
* Extensible string type allows custom base types
|
|
10
14
|
*/
|
|
11
|
-
export type
|
|
15
|
+
export type VariableBaseType = ProcessingBaseType;
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* QTI cardinality identifier
|
|
15
19
|
* Extensible string type allows custom cardinality values
|
|
16
20
|
*/
|
|
17
|
-
export type
|
|
21
|
+
export type VariableCardinality = ProcessingCardinality;
|
|
18
22
|
|
|
19
23
|
export interface VariableDeclaration {
|
|
20
24
|
identifier: string;
|
|
21
|
-
baseType:
|
|
22
|
-
cardinality:
|
|
25
|
+
baseType: VariableBaseType;
|
|
26
|
+
cardinality: VariableCardinality;
|
|
23
27
|
value: any;
|
|
24
28
|
defaultValue?: any;
|
|
25
29
|
mapping?: Mapping;
|
|
@@ -48,7 +52,7 @@ export interface AreaMapping {
|
|
|
48
52
|
defaultValue?: number;
|
|
49
53
|
lowerBound?: number;
|
|
50
54
|
upperBound?: number;
|
|
51
|
-
entries:
|
|
55
|
+
entries: AreaMapEntry[];
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
export interface AreaMapEntry {
|
|
@@ -70,7 +74,7 @@ export interface OutcomeDeclaration extends VariableDeclaration {
|
|
|
70
74
|
views?: string[];
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
export interface
|
|
77
|
+
export interface ItemSessionState {
|
|
74
78
|
[variableId: string]: any;
|
|
75
79
|
}
|
|
76
80
|
|
|
@@ -89,6 +93,16 @@ export interface QTIFileResponse {
|
|
|
89
93
|
lastModified: number;
|
|
90
94
|
/** Base64 data URL, e.g. data:application/pdf;base64,... */
|
|
91
95
|
dataUrl: string;
|
|
96
|
+
/**
|
|
97
|
+
* Optional ImageData extracted from canvas (for drawing interactions).
|
|
98
|
+
* This allows custom operators to analyze drawing content synchronously
|
|
99
|
+
* without needing to decode the dataUrl asynchronously.
|
|
100
|
+
*/
|
|
101
|
+
imageData?: {
|
|
102
|
+
data: Uint8ClampedArray;
|
|
103
|
+
width: number;
|
|
104
|
+
height: number;
|
|
105
|
+
};
|
|
92
106
|
}
|
|
93
107
|
|
|
94
108
|
export interface ModalFeedback {
|
|
@@ -135,13 +149,9 @@ export interface AdaptiveAttemptResult extends ScoringResult {
|
|
|
135
149
|
}
|
|
136
150
|
|
|
137
151
|
/**
|
|
138
|
-
* QTI
|
|
139
|
-
* -
|
|
140
|
-
*
|
|
141
|
-
* - proctor: Test administrator/invigilator
|
|
142
|
-
* - testConstructor: Test author/developer
|
|
143
|
-
* - tutor: Instructional/learning mode
|
|
144
|
-
* - author: Content author
|
|
152
|
+
* QTI role/view actors used for audience filtering (for example rubric/outcome visibility).
|
|
153
|
+
* Runtime interaction behavior (readonly vs editable, correct-answer visibility) is a player
|
|
154
|
+
* policy layered on top of these roles.
|
|
145
155
|
*/
|
|
146
156
|
export type QTIRole = 'candidate' | 'scorer' | 'proctor' | 'testConstructor' | 'tutor' | 'author';
|
|
147
157
|
|
|
@@ -167,7 +177,20 @@ export interface QTIComplianceConfig {
|
|
|
167
177
|
|
|
168
178
|
export interface PlayerConfig {
|
|
169
179
|
itemXml?: string;
|
|
170
|
-
|
|
180
|
+
/**
|
|
181
|
+
* QTI 3.0 §6.2 Personal Needs and Preferences profile.
|
|
182
|
+
* Color scheme is applied immediately as data-qti-colorscheme on the player root.
|
|
183
|
+
* Use player.updatePnp() to change mid-session without re-parsing the item.
|
|
184
|
+
*/
|
|
185
|
+
pnp?: import('../pnp/types.js').PnpProfile;
|
|
186
|
+
/**
|
|
187
|
+
* Optional shared catalog XML string (QTI 3.0 §6.3).
|
|
188
|
+
* Parsed and merged with any catalog embedded in the item XML.
|
|
189
|
+
* Item-level catalog entries take precedence over shared entries with the same identifier.
|
|
190
|
+
* Deferred: external catalog files from IMS manifest (G-15) are not yet supported.
|
|
191
|
+
*/
|
|
192
|
+
catalogXml?: string;
|
|
193
|
+
sessionState?: ItemSessionState;
|
|
171
194
|
responses?: InteractionResponse;
|
|
172
195
|
role?: QTIRole;
|
|
173
196
|
/** Optional seed for deterministic random operations (e.g. templateProcessing randomInteger) */
|
|
@@ -176,10 +199,16 @@ export interface PlayerConfig {
|
|
|
176
199
|
rng?: () => number;
|
|
177
200
|
/**
|
|
178
201
|
* Optional element name mapper for handling different QTI versions.
|
|
179
|
-
* Defaults to Qti2xElementNameMapper
|
|
202
|
+
* Defaults to Qti2xElementNameMapper (primary supported QTI format).
|
|
180
203
|
* @since 0.2.0
|
|
181
204
|
*/
|
|
182
205
|
elementNameMapper?: any; // Will be ElementNameMapper from @pie-qti/qti-common
|
|
206
|
+
/**
|
|
207
|
+
* Optional attribute name mapper for handling different QTI versions.
|
|
208
|
+
* Defaults to Qti2xAttributeNameMapper (primary supported QTI format).
|
|
209
|
+
* @since 0.3.0
|
|
210
|
+
*/
|
|
211
|
+
attributeNameMapper?: any; // Will be AttributeNameMapper from @pie-qti/qti-common
|
|
183
212
|
/** Optional web component registry for custom interaction components */
|
|
184
213
|
componentRegistry?: any; // Will be ComponentRegistry, but avoiding circular dependency
|
|
185
214
|
/** Optional extraction registry for custom element extractors */
|
|
@@ -196,6 +225,11 @@ export interface PlayerConfig {
|
|
|
196
225
|
* Keyed by operator `class` (preferred) or `definition` URI.
|
|
197
226
|
*/
|
|
198
227
|
customOperators?: Record<string, (args: QtiValue[], meta: { class?: string; definition?: string }) => QtiValue>;
|
|
228
|
+
/**
|
|
229
|
+
* Optional base URL for resolving relative PCI module paths.
|
|
230
|
+
* Defaults to document.baseURI when running in a browser.
|
|
231
|
+
*/
|
|
232
|
+
pciBaseUrl?: string;
|
|
199
233
|
|
|
200
234
|
/**
|
|
201
235
|
* Security-related controls for untrusted QTI rendered into the host DOM.
|
|
@@ -23,10 +23,15 @@ export interface ChoiceInteractionData extends BaseInteractionData {
|
|
|
23
23
|
type: 'choiceInteraction';
|
|
24
24
|
shuffle: boolean;
|
|
25
25
|
maxChoices: number;
|
|
26
|
+
minChoices: number;
|
|
26
27
|
prompt: string | null;
|
|
27
|
-
choices: Array<{ identifier: string; text: HtmlContent; classes?: string[] }>;
|
|
28
|
+
choices: Array<{ identifier: string; text: HtmlContent; fixed?: boolean; classes?: string[] }>;
|
|
28
29
|
/** CSS classes from the choiceInteraction element for custom renderer detection */
|
|
29
30
|
interactionClasses?: string[];
|
|
31
|
+
/** Message shown when candidate exceeds maxChoices (data-max-selections-message) */
|
|
32
|
+
maxSelectionsMessage?: string | null;
|
|
33
|
+
/** Message shown when candidate submits below minChoices (data-min-selections-message) */
|
|
34
|
+
minSelectionsMessage?: string | null;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
export interface TextEntryInteractionData extends BaseInteractionData {
|
|
@@ -34,6 +39,11 @@ export interface TextEntryInteractionData extends BaseInteractionData {
|
|
|
34
39
|
expectedLength: number;
|
|
35
40
|
patternMask: string | null;
|
|
36
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;
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
export interface ExtendedTextInteractionData extends BaseInteractionData {
|
|
@@ -42,40 +52,68 @@ export interface ExtendedTextInteractionData extends BaseInteractionData {
|
|
|
42
52
|
expectedLength: number;
|
|
43
53
|
placeholderText: string;
|
|
44
54
|
format: string;
|
|
55
|
+
patternMask?: string | null;
|
|
56
|
+
patternMaskMessage?: string | null;
|
|
57
|
+
/** CSS classes from the extendedTextInteraction element (e.g. qti-height-lines-N) */
|
|
58
|
+
interactionClasses?: string[];
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
export interface InlineChoiceInteractionData extends BaseInteractionData {
|
|
48
62
|
type: 'inlineChoiceInteraction';
|
|
49
63
|
shuffle: boolean;
|
|
50
|
-
|
|
64
|
+
/** Placeholder label from the QTI <label> child element; shown as the unselected "Select…" option */
|
|
65
|
+
label: string | null;
|
|
66
|
+
/** Placeholder text from data-prompt attribute; alternative to <label> for dropdown default option */
|
|
67
|
+
dataPrompt?: string | null;
|
|
68
|
+
choices: Array<{ identifier: string; text: string; fixed?: boolean }>;
|
|
69
|
+
/** CSS classes from the inlineChoiceInteraction element (e.g. qti-input-width-N) */
|
|
70
|
+
interactionClasses?: string[];
|
|
51
71
|
}
|
|
52
72
|
|
|
53
73
|
export interface OrderInteractionData extends BaseInteractionData {
|
|
54
74
|
type: 'orderInteraction';
|
|
55
75
|
shuffle: boolean;
|
|
76
|
+
minChoices: number;
|
|
77
|
+
maxChoices: number;
|
|
56
78
|
prompt: string | null;
|
|
57
|
-
choices: Array<{ identifier: string; text: string }>;
|
|
79
|
+
choices: Array<{ identifier: string; text: string; fixed?: boolean }>;
|
|
58
80
|
}
|
|
59
81
|
|
|
60
82
|
export interface AssociableChoice {
|
|
61
83
|
identifier: string;
|
|
62
84
|
text: string;
|
|
63
85
|
matchMax: number;
|
|
86
|
+
/** Minimum number of times this choice must appear in the response (QTI matchMin) */
|
|
87
|
+
matchMin?: number;
|
|
88
|
+
/** Pairing constraint: choice can only be paired with others sharing a group value (QTI matchGroup) */
|
|
89
|
+
matchGroup?: string[];
|
|
90
|
+
/** CSS classes from the choice element for custom renderer detection */
|
|
91
|
+
classes?: string[];
|
|
64
92
|
}
|
|
65
93
|
|
|
66
94
|
export interface MatchInteractionData extends BaseInteractionData {
|
|
67
95
|
type: 'matchInteraction';
|
|
68
96
|
shuffle: boolean;
|
|
69
97
|
maxAssociations: number;
|
|
98
|
+
minAssociations?: number;
|
|
70
99
|
prompt: string | null;
|
|
71
100
|
sourceSet: AssociableChoice[];
|
|
72
101
|
targetSet: AssociableChoice[];
|
|
102
|
+
/** CSS classes from the matchInteraction element (e.g. qti-choices-top, qti-match-tabular) */
|
|
103
|
+
interactionClasses?: string[];
|
|
104
|
+
/** Message shown when candidate exceeds maxAssociations */
|
|
105
|
+
maxSelectionsMessage?: string | null;
|
|
106
|
+
/** Message shown when candidate submits below minAssociations */
|
|
107
|
+
minSelectionsMessage?: string | null;
|
|
108
|
+
/** Label for first column header in tabular mode (data-qti-first-column-header) */
|
|
109
|
+
firstColumnHeader?: string | null;
|
|
73
110
|
}
|
|
74
111
|
|
|
75
112
|
export interface AssociateInteractionData extends BaseInteractionData {
|
|
76
113
|
type: 'associateInteraction';
|
|
77
114
|
shuffle: boolean;
|
|
78
115
|
maxAssociations: number;
|
|
116
|
+
minAssociations?: number;
|
|
79
117
|
prompt: string | null;
|
|
80
118
|
choices: AssociableChoice[];
|
|
81
119
|
}
|
|
@@ -84,9 +122,17 @@ export interface GapMatchInteractionData extends BaseInteractionData {
|
|
|
84
122
|
type: 'gapMatchInteraction';
|
|
85
123
|
shuffle: boolean;
|
|
86
124
|
prompt: string | null;
|
|
87
|
-
gapTexts: Array<{ identifier: string; text: string; matchMax: number }>;
|
|
125
|
+
gapTexts: Array<{ identifier: string; text: string; matchMax: number; matchGroup?: string[]; inputWidth?: number }>;
|
|
88
126
|
gaps: Array<{ identifier: string; index: number }>;
|
|
89
127
|
promptText: string;
|
|
128
|
+
/** CSS classes from the gapMatchInteraction element (e.g. qti-choices-top, qti-choices-bottom) */
|
|
129
|
+
interactionClasses?: string[];
|
|
130
|
+
/** Width of the choice container in px (data-choices-container-width) */
|
|
131
|
+
choicesContainerWidth?: string | null;
|
|
132
|
+
/** Message shown when candidate exceeds max associations */
|
|
133
|
+
maxSelectionsMessage?: string | null;
|
|
134
|
+
/** Message shown when candidate submits below min associations */
|
|
135
|
+
minSelectionsMessage?: string | null;
|
|
90
136
|
}
|
|
91
137
|
|
|
92
138
|
export interface SliderInteractionData extends BaseInteractionData {
|
|
@@ -111,14 +157,23 @@ export interface HotspotChoice {
|
|
|
111
157
|
identifier: string;
|
|
112
158
|
shape: string;
|
|
113
159
|
coords: string;
|
|
160
|
+
/** Author-provided label for the hotspot; used as accessible aria-label */
|
|
161
|
+
hotspotLabel?: string;
|
|
114
162
|
}
|
|
115
163
|
|
|
116
164
|
export interface HotspotInteractionData extends BaseInteractionData {
|
|
117
165
|
type: 'hotspotInteraction';
|
|
118
166
|
maxChoices: number;
|
|
167
|
+
minChoices?: number;
|
|
119
168
|
prompt: string | null;
|
|
120
169
|
imageData: ImageData | null;
|
|
121
170
|
hotspotChoices: HotspotChoice[];
|
|
171
|
+
/** CSS classes from the hotspotInteraction element (e.g. qti-selections-light, qti-selections-dark) */
|
|
172
|
+
interactionClasses?: string[];
|
|
173
|
+
/** Message shown when candidate exceeds maxChoices */
|
|
174
|
+
maxSelectionsMessage?: string | null;
|
|
175
|
+
/** Message shown when candidate submits below minChoices */
|
|
176
|
+
minSelectionsMessage?: string | null;
|
|
122
177
|
}
|
|
123
178
|
|
|
124
179
|
export interface AssociableHotspot {
|
|
@@ -132,8 +187,19 @@ export interface GraphicGapMatchInteractionData extends BaseInteractionData {
|
|
|
132
187
|
type: 'graphicGapMatchInteraction';
|
|
133
188
|
prompt: string | null;
|
|
134
189
|
imageData: ImageData | null;
|
|
135
|
-
|
|
190
|
+
maxAssociations: number;
|
|
191
|
+
gapTexts: Array<{ identifier: string; text: string; matchMax: number; matchGroup?: string[] }>;
|
|
192
|
+
/** Image-based draggable labels (gapImg elements); rendered as <img> in the choice pool */
|
|
193
|
+
gapImages: Array<{ identifier: string; src: string; alt: string; matchMax: number; matchGroup?: string[]; width?: number; height?: number }>;
|
|
136
194
|
hotspots: AssociableHotspot[];
|
|
195
|
+
/** CSS classes from the graphicGapMatchInteraction element (e.g. qti-choices-top, qti-selections-dark) */
|
|
196
|
+
interactionClasses?: string[];
|
|
197
|
+
/** Width of the choice container in px (data-choices-container-width) */
|
|
198
|
+
choicesContainerWidth?: string | null;
|
|
199
|
+
/** Message shown when candidate exceeds max associations */
|
|
200
|
+
maxSelectionsMessage?: string | null;
|
|
201
|
+
/** Message shown when candidate submits below min associations */
|
|
202
|
+
minSelectionsMessage?: string | null;
|
|
137
203
|
}
|
|
138
204
|
|
|
139
205
|
export interface UploadInteractionData extends BaseInteractionData {
|
|
@@ -189,8 +255,15 @@ export interface HottextInteractionData extends BaseInteractionData {
|
|
|
189
255
|
type: 'hottextInteraction';
|
|
190
256
|
prompt: string | null;
|
|
191
257
|
maxChoices: number;
|
|
258
|
+
minChoices: number;
|
|
192
259
|
contentHtml: HtmlContent;
|
|
193
260
|
hottextChoices: HottextChoice[];
|
|
261
|
+
/** CSS classes from the hottextInteraction element (e.g. qti-input-control-hidden) */
|
|
262
|
+
interactionClasses?: string[];
|
|
263
|
+
/** Message shown when candidate exceeds maxChoices */
|
|
264
|
+
maxSelectionsMessage?: string | null;
|
|
265
|
+
/** Message shown when candidate submits below minChoices */
|
|
266
|
+
minSelectionsMessage?: string | null;
|
|
194
267
|
}
|
|
195
268
|
|
|
196
269
|
export interface Point {
|
|
@@ -226,6 +299,8 @@ export interface GraphicAssociateHotspot {
|
|
|
226
299
|
coords: string;
|
|
227
300
|
matchMax: number;
|
|
228
301
|
label: string;
|
|
302
|
+
/** Pairing constraint: hotspot can only be associated with others sharing a group value (QTI matchGroup) */
|
|
303
|
+
matchGroup?: string[];
|
|
229
304
|
}
|
|
230
305
|
|
|
231
306
|
export interface GraphicAssociateInteractionData extends BaseInteractionData {
|
|
@@ -341,7 +416,7 @@ export interface InteractionValueMap {
|
|
|
341
416
|
sliderInteraction: number;
|
|
342
417
|
hotspotInteraction: string[];
|
|
343
418
|
graphicGapMatchInteraction: Record<string, string>;
|
|
344
|
-
uploadInteraction: import('../types/index.js').QTIFileResponse
|
|
419
|
+
uploadInteraction: import('../types/index.js').QTIFileResponse | null;
|
|
345
420
|
drawingInteraction: string;
|
|
346
421
|
customInteraction: any;
|
|
347
422
|
mediaInteraction: any;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drawing analysis utilities for QTI drawing interactions
|
|
3
|
+
*
|
|
4
|
+
* These utilities help analyze drawing content for scoring purposes.
|
|
5
|
+
* They work with ImageData extracted from canvas elements.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { QTIFileResponse } from '../types/index.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Check if a drawing contains at least some drawn content (non-white pixels)
|
|
12
|
+
*
|
|
13
|
+
* @param imageData - ImageData from canvas (RGBA format, 4 bytes per pixel)
|
|
14
|
+
* @param threshold - Minimum number of non-white pixels to consider a line drawn (default: 50)
|
|
15
|
+
* @returns true if the drawing contains at least threshold non-white pixels
|
|
16
|
+
*/
|
|
17
|
+
export function hasLine(
|
|
18
|
+
imageData: { data: Uint8ClampedArray; width: number; height: number },
|
|
19
|
+
threshold: number = 50
|
|
20
|
+
): boolean {
|
|
21
|
+
const { data } = imageData;
|
|
22
|
+
let nonWhitePixels = 0;
|
|
23
|
+
|
|
24
|
+
// Check each pixel (RGBA format: 4 bytes per pixel)
|
|
25
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
26
|
+
const r = data[i];
|
|
27
|
+
const g = data[i + 1];
|
|
28
|
+
const b = data[i + 2];
|
|
29
|
+
const a = data[i + 3];
|
|
30
|
+
|
|
31
|
+
// Consider pixel non-white if:
|
|
32
|
+
// - Alpha is significant (> 10)
|
|
33
|
+
// - AND color is not white/very light (any channel < 240)
|
|
34
|
+
if (a > 10 && (r < 240 || g < 240 || b < 240)) {
|
|
35
|
+
nonWhitePixels++;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return nonWhitePixels >= threshold;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get ImageData from a QTIFileResponse if available
|
|
44
|
+
*
|
|
45
|
+
* @param fileResponse - QTIFileResponse object (may contain imageData)
|
|
46
|
+
* @returns ImageData if available, null otherwise
|
|
47
|
+
*/
|
|
48
|
+
export function getImageDataFromResponse(
|
|
49
|
+
fileResponse: QTIFileResponse | null | undefined
|
|
50
|
+
): { data: Uint8ClampedArray; width: number; height: number } | null {
|
|
51
|
+
if (!fileResponse?.imageData) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return fileResponse.imageData;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Analyze a drawing response to determine if it contains drawn content
|
|
59
|
+
*
|
|
60
|
+
* @param fileResponse - QTIFileResponse from drawing interaction
|
|
61
|
+
* @param threshold - Minimum number of non-white pixels (default: 50)
|
|
62
|
+
* @returns true if drawing contains content, false otherwise
|
|
63
|
+
*/
|
|
64
|
+
export function analyzeDrawing(
|
|
65
|
+
fileResponse: QTIFileResponse | null | undefined,
|
|
66
|
+
threshold: number = 50
|
|
67
|
+
): boolean {
|
|
68
|
+
const imageData = getImageDataFromResponse(fileResponse);
|
|
69
|
+
if (!imageData) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return hasLine(imageData, threshold);
|
|
73
|
+
}
|
|
@@ -1,211 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Touch-enabled drag helper for making HTML5 drag-and-drop work with touch devices
|
|
3
|
-
*
|
|
4
|
-
* HTML5 drag-and-drop API doesn't work on touch devices by default.
|
|
5
|
-
* This helper translates touch events to pointer events for unified handling.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* ```svelte
|
|
9
|
-
* <div
|
|
10
|
-
* use:touchDrag
|
|
11
|
-
* draggable="true"
|
|
12
|
-
* ondragstart={...}
|
|
13
|
-
* >
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
interface TouchDragState {
|
|
18
|
-
element: HTMLElement;
|
|
19
|
-
touchId: number | null;
|
|
20
|
-
isDragging: boolean;
|
|
21
|
-
startX: number;
|
|
22
|
-
startY: number;
|
|
23
|
-
currentX: number;
|
|
24
|
-
currentY: number;
|
|
25
|
-
dragThreshold: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Svelte action to enable touch drag on draggable elements
|
|
30
|
-
*/
|
|
31
|
-
export function touchDrag(node: HTMLElement) {
|
|
32
|
-
const state: TouchDragState = {
|
|
33
|
-
element: node,
|
|
34
|
-
touchId: null,
|
|
35
|
-
isDragging: false,
|
|
36
|
-
startX: 0,
|
|
37
|
-
startY: 0,
|
|
38
|
-
currentX: 0,
|
|
39
|
-
currentY: 0,
|
|
40
|
-
dragThreshold: 10 // px movement to initiate drag
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
function handleTouchStart(e: TouchEvent) {
|
|
44
|
-
// Only handle single touch
|
|
45
|
-
if (e.touches.length !== 1) return;
|
|
46
|
-
|
|
47
|
-
// Check if element is draggable
|
|
48
|
-
const draggable = node.getAttribute('draggable');
|
|
49
|
-
if (draggable !== 'true') return;
|
|
50
|
-
|
|
51
|
-
const touch = e.touches[0];
|
|
52
|
-
state.touchId = touch.identifier;
|
|
53
|
-
state.startX = touch.clientX;
|
|
54
|
-
state.startY = touch.clientY;
|
|
55
|
-
state.currentX = touch.clientX;
|
|
56
|
-
state.currentY = touch.clientY;
|
|
57
|
-
state.isDragging = false;
|
|
58
|
-
|
|
59
|
-
// Add move and end listeners to document for consistent tracking
|
|
60
|
-
document.addEventListener('touchmove', handleTouchMove, { passive: false });
|
|
61
|
-
document.addEventListener('touchend', handleTouchEnd);
|
|
62
|
-
document.addEventListener('touchcancel', handleTouchCancel);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function handleTouchMove(e: TouchEvent) {
|
|
66
|
-
if (state.touchId === null) return;
|
|
67
|
-
|
|
68
|
-
// Find the touch we're tracking
|
|
69
|
-
const touch = Array.from(e.changedTouches).find(t => t.identifier === state.touchId);
|
|
70
|
-
if (!touch) return;
|
|
71
|
-
|
|
72
|
-
state.currentX = touch.clientX;
|
|
73
|
-
state.currentY = touch.clientY;
|
|
74
|
-
|
|
75
|
-
// Check if we've moved enough to start dragging
|
|
76
|
-
const deltaX = state.currentX - state.startX;
|
|
77
|
-
const deltaY = state.currentY - state.startY;
|
|
78
|
-
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
79
|
-
|
|
80
|
-
if (!state.isDragging && distance > state.dragThreshold) {
|
|
81
|
-
// Start drag
|
|
82
|
-
state.isDragging = true;
|
|
83
|
-
|
|
84
|
-
// Trigger dragstart event
|
|
85
|
-
const dragStartEvent = new DragEvent('dragstart', {
|
|
86
|
-
bubbles: true,
|
|
87
|
-
cancelable: true,
|
|
88
|
-
clientX: state.startX,
|
|
89
|
-
clientY: state.startY
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
node.dispatchEvent(dragStartEvent);
|
|
93
|
-
|
|
94
|
-
// Add visual feedback
|
|
95
|
-
node.style.opacity = '0.5';
|
|
96
|
-
e.preventDefault(); // Prevent scrolling
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (state.isDragging) {
|
|
100
|
-
e.preventDefault(); // Prevent scrolling while dragging
|
|
101
|
-
|
|
102
|
-
// Find element under touch point
|
|
103
|
-
const elementUnder = document.elementFromPoint(state.currentX, state.currentY);
|
|
104
|
-
|
|
105
|
-
if (elementUnder && elementUnder !== node) {
|
|
106
|
-
// Trigger dragover on the element under touch
|
|
107
|
-
const dragOverEvent = new DragEvent('dragover', {
|
|
108
|
-
bubbles: true,
|
|
109
|
-
cancelable: true,
|
|
110
|
-
clientX: state.currentX,
|
|
111
|
-
clientY: state.currentY
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
elementUnder.dispatchEvent(dragOverEvent);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function handleTouchEnd(e: TouchEvent) {
|
|
120
|
-
if (state.touchId === null) return;
|
|
121
|
-
|
|
122
|
-
// Find the touch we're tracking
|
|
123
|
-
const touch = Array.from(e.changedTouches).find(t => t.identifier === state.touchId);
|
|
124
|
-
if (!touch) return;
|
|
125
|
-
|
|
126
|
-
if (state.isDragging) {
|
|
127
|
-
// Find element under touch point at drop location
|
|
128
|
-
const elementUnder = document.elementFromPoint(touch.clientX, touch.clientY);
|
|
129
|
-
|
|
130
|
-
if (elementUnder) {
|
|
131
|
-
// Trigger drop event
|
|
132
|
-
const dropEvent = new DragEvent('drop', {
|
|
133
|
-
bubbles: true,
|
|
134
|
-
cancelable: true,
|
|
135
|
-
clientX: touch.clientX,
|
|
136
|
-
clientY: touch.clientY
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
elementUnder.dispatchEvent(dropEvent);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Trigger dragend
|
|
143
|
-
const dragEndEvent = new DragEvent('dragend', {
|
|
144
|
-
bubbles: true,
|
|
145
|
-
cancelable: true
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
node.dispatchEvent(dragEndEvent);
|
|
149
|
-
|
|
150
|
-
// Reset visual feedback
|
|
151
|
-
node.style.opacity = '';
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
cleanup();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function handleTouchCancel() {
|
|
158
|
-
if (state.isDragging) {
|
|
159
|
-
// Trigger dragend
|
|
160
|
-
const dragEndEvent = new DragEvent('dragend', {
|
|
161
|
-
bubbles: true,
|
|
162
|
-
cancelable: true
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
node.dispatchEvent(dragEndEvent);
|
|
166
|
-
|
|
167
|
-
// Reset visual feedback
|
|
168
|
-
node.style.opacity = '';
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
cleanup();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function cleanup() {
|
|
175
|
-
state.touchId = null;
|
|
176
|
-
state.isDragging = false;
|
|
177
|
-
|
|
178
|
-
document.removeEventListener('touchmove', handleTouchMove);
|
|
179
|
-
document.removeEventListener('touchend', handleTouchEnd);
|
|
180
|
-
document.removeEventListener('touchcancel', handleTouchCancel);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Attach initial touch listener
|
|
184
|
-
node.addEventListener('touchstart', handleTouchStart, { passive: true });
|
|
185
|
-
|
|
186
|
-
return {
|
|
187
|
-
destroy() {
|
|
188
|
-
node.removeEventListener('touchstart', handleTouchStart);
|
|
189
|
-
cleanup();
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* CSS helper for touch-friendly drag interactions
|
|
196
|
-
* Returns CSS that should be applied to draggable elements
|
|
197
|
-
*/
|
|
198
|
-
export const touchDragStyles = {
|
|
199
|
-
/* Prevent text selection during drag */
|
|
200
|
-
userSelect: 'none',
|
|
201
|
-
webkitUserSelect: 'none',
|
|
202
|
-
|
|
203
|
-
/* Allow touch events */
|
|
204
|
-
touchAction: 'none',
|
|
205
|
-
|
|
206
|
-
/* Cursor feedback */
|
|
207
|
-
cursor: 'grab',
|
|
208
|
-
|
|
209
|
-
/* Smooth transitions */
|
|
210
|
-
transition: 'opacity 0.2s ease'
|
|
211
|
-
} as const;
|
|
1
|
+
export { touchDrag, touchDragStyles } from '@pie-qti/qti-common';
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$ tsc
|