@pie-qti/item-player 0.1.5 → 0.1.6
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/dist/core/ComponentRegistry.d.ts +5 -4
- package/dist/core/ComponentRegistry.d.ts.map +1 -1
- package/dist/core/ComponentRegistry.js +11 -4
- package/dist/core/ItemRenderer.d.ts.map +1 -1
- package/dist/core/ItemRenderer.js +5 -18
- package/dist/core/Player.d.ts +2 -2
- package/dist/core/Player.d.ts.map +1 -1
- package/dist/core/Player.js +46 -147
- package/dist/document/AssessmentItemDocument.d.ts +42 -0
- package/dist/document/AssessmentItemDocument.d.ts.map +1 -0
- package/dist/document/AssessmentItemDocument.js +116 -0
- package/dist/element.js +2515 -2294
- package/dist/element.js.map +1 -1
- package/dist/extraction/extractors/associateExtractor.d.ts +1 -28
- package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/associateExtractor.js +1 -97
- package/dist/extraction/extractors/choiceExtractor.d.ts +1 -26
- package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/choiceExtractor.js +1 -93
- package/dist/extraction/extractors/customExtractor.d.ts +1 -19
- package/dist/extraction/extractors/customExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/customExtractor.js +1 -51
- package/dist/extraction/extractors/drawingExtractor.d.ts +1 -29
- package/dist/extraction/extractors/drawingExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/drawingExtractor.js +1 -78
- package/dist/extraction/extractors/endAttemptExtractor.d.ts +1 -19
- package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/endAttemptExtractor.js +1 -53
- package/dist/extraction/extractors/extendedTextExtractor.d.ts +1 -20
- package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/extendedTextExtractor.js +1 -63
- package/dist/extraction/extractors/gapMatchExtractor.d.ts +1 -28
- package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/gapMatchExtractor.js +1 -155
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +1 -40
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/graphicAssociateExtractor.js +1 -143
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +1 -52
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/graphicGapMatchExtractor.js +1 -205
- package/dist/extraction/extractors/graphicOrderExtractor.d.ts +1 -36
- package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/graphicOrderExtractor.js +1 -121
- package/dist/extraction/extractors/hotspotExtractor.d.ts +1 -37
- package/dist/extraction/extractors/hotspotExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/hotspotExtractor.js +1 -159
- package/dist/extraction/extractors/hottextExtractor.d.ts +1 -25
- package/dist/extraction/extractors/hottextExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/hottextExtractor.js +1 -128
- package/dist/extraction/extractors/index.d.ts +5 -59
- package/dist/extraction/extractors/index.d.ts.map +1 -1
- package/dist/extraction/extractors/index.js +5 -85
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +1 -24
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/inlineChoiceExtractor.js +1 -80
- package/dist/extraction/extractors/matchExtractor.d.ts +1 -36
- package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/matchExtractor.js +1 -160
- package/dist/extraction/extractors/mediaExtractor.d.ts +1 -32
- package/dist/extraction/extractors/mediaExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/mediaExtractor.js +1 -125
- package/dist/extraction/extractors/orderExtractor.d.ts +1 -27
- package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/orderExtractor.js +1 -90
- package/dist/extraction/extractors/portableCustomExtractor.d.ts +1 -13
- package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/portableCustomExtractor.js +1 -96
- package/dist/extraction/extractors/positionObjectExtractor.d.ts +1 -58
- package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/positionObjectExtractor.js +1 -191
- package/dist/extraction/extractors/selectPointExtractor.d.ts +1 -30
- package/dist/extraction/extractors/selectPointExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/selectPointExtractor.js +1 -109
- package/dist/extraction/extractors/sliderExtractor.d.ts +1 -23
- package/dist/extraction/extractors/sliderExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/sliderExtractor.js +1 -73
- package/dist/extraction/extractors/textEntryExtractor.d.ts +1 -20
- package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/textEntryExtractor.js +1 -54
- package/dist/extraction/extractors/uploadExtractor.d.ts +1 -19
- package/dist/extraction/extractors/uploadExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/uploadExtractor.js +1 -59
- package/dist/extraction/index.d.ts +1 -1
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +2 -2
- package/dist/extraction/interactionExtractionPipeline.d.ts +13 -0
- package/dist/extraction/interactionExtractionPipeline.d.ts.map +1 -0
- package/dist/extraction/interactionExtractionPipeline.js +39 -0
- package/dist/extraction/interactionSecurity.d.ts +4 -0
- package/dist/extraction/interactionSecurity.d.ts.map +1 -0
- package/dist/extraction/interactionSecurity.js +48 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/interactions/associate/extractor.d.ts +29 -0
- package/dist/interactions/associate/extractor.d.ts.map +1 -0
- package/dist/interactions/associate/extractor.js +97 -0
- package/dist/interactions/associate/index.d.ts +3 -0
- package/dist/interactions/associate/index.d.ts.map +1 -0
- package/dist/interactions/associate/index.js +1 -0
- package/dist/interactions/associate/types.d.ts +2 -0
- package/dist/interactions/associate/types.d.ts.map +1 -0
- package/dist/interactions/associate/types.js +1 -0
- package/dist/interactions/choice/extractor.d.ts +27 -0
- package/dist/interactions/choice/extractor.d.ts.map +1 -0
- package/dist/interactions/choice/extractor.js +93 -0
- package/dist/interactions/choice/index.d.ts +3 -0
- package/dist/interactions/choice/index.d.ts.map +1 -0
- package/dist/interactions/choice/index.js +1 -0
- package/dist/interactions/choice/types.d.ts +2 -0
- package/dist/interactions/choice/types.d.ts.map +1 -0
- package/dist/interactions/choice/types.js +1 -0
- package/dist/interactions/custom/extractor.d.ts +20 -0
- package/dist/interactions/custom/extractor.d.ts.map +1 -0
- package/dist/interactions/custom/extractor.js +51 -0
- package/dist/interactions/custom/index.d.ts +3 -0
- package/dist/interactions/custom/index.d.ts.map +1 -0
- package/dist/interactions/custom/index.js +1 -0
- package/dist/interactions/custom/types.d.ts +2 -0
- package/dist/interactions/custom/types.d.ts.map +1 -0
- package/dist/interactions/custom/types.js +1 -0
- package/dist/interactions/drawing/extractor.d.ts +30 -0
- package/dist/interactions/drawing/extractor.d.ts.map +1 -0
- package/dist/interactions/drawing/extractor.js +78 -0
- package/dist/interactions/drawing/index.d.ts +3 -0
- package/dist/interactions/drawing/index.d.ts.map +1 -0
- package/dist/interactions/drawing/index.js +1 -0
- package/dist/interactions/drawing/types.d.ts +2 -0
- package/dist/interactions/drawing/types.d.ts.map +1 -0
- package/dist/interactions/drawing/types.js +1 -0
- package/dist/interactions/end-attempt/extractor.d.ts +20 -0
- package/dist/interactions/end-attempt/extractor.d.ts.map +1 -0
- package/dist/interactions/end-attempt/extractor.js +53 -0
- package/dist/interactions/end-attempt/index.d.ts +3 -0
- package/dist/interactions/end-attempt/index.d.ts.map +1 -0
- package/dist/interactions/end-attempt/index.js +1 -0
- package/dist/interactions/end-attempt/types.d.ts +2 -0
- package/dist/interactions/end-attempt/types.d.ts.map +1 -0
- package/dist/interactions/end-attempt/types.js +1 -0
- package/dist/interactions/extended-text/extractor.d.ts +21 -0
- package/dist/interactions/extended-text/extractor.d.ts.map +1 -0
- package/dist/interactions/extended-text/extractor.js +63 -0
- package/dist/interactions/extended-text/index.d.ts +3 -0
- package/dist/interactions/extended-text/index.d.ts.map +1 -0
- package/dist/interactions/extended-text/index.js +1 -0
- package/dist/interactions/extended-text/types.d.ts +2 -0
- package/dist/interactions/extended-text/types.d.ts.map +1 -0
- package/dist/interactions/extended-text/types.js +1 -0
- package/dist/interactions/gap-match/extractor.d.ts +29 -0
- package/dist/interactions/gap-match/extractor.d.ts.map +1 -0
- package/dist/interactions/gap-match/extractor.js +155 -0
- package/dist/interactions/gap-match/index.d.ts +3 -0
- package/dist/interactions/gap-match/index.d.ts.map +1 -0
- package/dist/interactions/gap-match/index.js +1 -0
- package/dist/interactions/gap-match/types.d.ts +2 -0
- package/dist/interactions/gap-match/types.d.ts.map +1 -0
- package/dist/interactions/gap-match/types.js +1 -0
- package/dist/interactions/graphic-associate/extractor.d.ts +41 -0
- package/dist/interactions/graphic-associate/extractor.d.ts.map +1 -0
- package/dist/interactions/graphic-associate/extractor.js +143 -0
- package/dist/interactions/graphic-associate/index.d.ts +3 -0
- package/dist/interactions/graphic-associate/index.d.ts.map +1 -0
- package/dist/interactions/graphic-associate/index.js +1 -0
- package/dist/interactions/graphic-associate/types.d.ts +2 -0
- package/dist/interactions/graphic-associate/types.d.ts.map +1 -0
- package/dist/interactions/graphic-associate/types.js +1 -0
- package/dist/interactions/graphic-gap-match/extractor.d.ts +53 -0
- package/dist/interactions/graphic-gap-match/extractor.d.ts.map +1 -0
- package/dist/interactions/graphic-gap-match/extractor.js +205 -0
- package/dist/interactions/graphic-gap-match/index.d.ts +3 -0
- package/dist/interactions/graphic-gap-match/index.d.ts.map +1 -0
- package/dist/interactions/graphic-gap-match/index.js +1 -0
- package/dist/interactions/graphic-gap-match/types.d.ts +2 -0
- package/dist/interactions/graphic-gap-match/types.d.ts.map +1 -0
- package/dist/interactions/graphic-gap-match/types.js +1 -0
- package/dist/interactions/graphic-order/extractor.d.ts +37 -0
- package/dist/interactions/graphic-order/extractor.d.ts.map +1 -0
- package/dist/interactions/graphic-order/extractor.js +121 -0
- package/dist/interactions/graphic-order/index.d.ts +3 -0
- package/dist/interactions/graphic-order/index.d.ts.map +1 -0
- package/dist/interactions/graphic-order/index.js +1 -0
- package/dist/interactions/graphic-order/types.d.ts +2 -0
- package/dist/interactions/graphic-order/types.d.ts.map +1 -0
- package/dist/interactions/graphic-order/types.js +1 -0
- package/dist/interactions/hotspot/extractor.d.ts +38 -0
- package/dist/interactions/hotspot/extractor.d.ts.map +1 -0
- package/dist/interactions/hotspot/extractor.js +159 -0
- package/dist/interactions/hotspot/index.d.ts +3 -0
- package/dist/interactions/hotspot/index.d.ts.map +1 -0
- package/dist/interactions/hotspot/index.js +1 -0
- package/dist/interactions/hotspot/types.d.ts +2 -0
- package/dist/interactions/hotspot/types.d.ts.map +1 -0
- package/dist/interactions/hotspot/types.js +1 -0
- package/dist/interactions/hottext/extractor.d.ts +26 -0
- package/dist/interactions/hottext/extractor.d.ts.map +1 -0
- package/dist/interactions/hottext/extractor.js +128 -0
- package/dist/interactions/hottext/index.d.ts +3 -0
- package/dist/interactions/hottext/index.d.ts.map +1 -0
- package/dist/interactions/hottext/index.js +1 -0
- package/dist/interactions/hottext/types.d.ts +2 -0
- package/dist/interactions/hottext/types.d.ts.map +1 -0
- package/dist/interactions/hottext/types.js +1 -0
- package/dist/interactions/index.d.ts +33 -0
- package/dist/interactions/index.d.ts.map +1 -0
- package/dist/interactions/index.js +30 -0
- package/dist/interactions/inline/index.d.ts +2 -0
- package/dist/interactions/inline/index.d.ts.map +1 -0
- package/dist/interactions/inline/index.js +1 -0
- package/dist/interactions/inline/render-plan.d.ts +19 -0
- package/dist/interactions/inline/render-plan.d.ts.map +1 -0
- package/dist/interactions/inline/render-plan.js +59 -0
- package/dist/interactions/inline-choice/extractor.d.ts +25 -0
- package/dist/interactions/inline-choice/extractor.d.ts.map +1 -0
- package/dist/interactions/inline-choice/extractor.js +80 -0
- package/dist/interactions/inline-choice/index.d.ts +3 -0
- package/dist/interactions/inline-choice/index.d.ts.map +1 -0
- package/dist/interactions/inline-choice/index.js +1 -0
- package/dist/interactions/inline-choice/types.d.ts +2 -0
- package/dist/interactions/inline-choice/types.d.ts.map +1 -0
- package/dist/interactions/inline-choice/types.js +1 -0
- package/dist/interactions/match/extractor.d.ts +37 -0
- package/dist/interactions/match/extractor.d.ts.map +1 -0
- package/dist/interactions/match/extractor.js +160 -0
- package/dist/interactions/match/index.d.ts +3 -0
- package/dist/interactions/match/index.d.ts.map +1 -0
- package/dist/interactions/match/index.js +1 -0
- package/dist/interactions/match/types.d.ts +2 -0
- package/dist/interactions/match/types.d.ts.map +1 -0
- package/dist/interactions/match/types.js +1 -0
- package/dist/interactions/media/extractor.d.ts +33 -0
- package/dist/interactions/media/extractor.d.ts.map +1 -0
- package/dist/interactions/media/extractor.js +125 -0
- package/dist/interactions/media/index.d.ts +3 -0
- package/dist/interactions/media/index.d.ts.map +1 -0
- package/dist/interactions/media/index.js +1 -0
- package/dist/interactions/media/types.d.ts +2 -0
- package/dist/interactions/media/types.d.ts.map +1 -0
- package/dist/interactions/media/types.js +1 -0
- package/dist/interactions/modules.d.ts +105 -0
- package/dist/interactions/modules.d.ts.map +1 -0
- package/dist/interactions/modules.js +86 -0
- package/dist/interactions/order/extractor.d.ts +28 -0
- package/dist/interactions/order/extractor.d.ts.map +1 -0
- package/dist/interactions/order/extractor.js +90 -0
- package/dist/interactions/order/index.d.ts +3 -0
- package/dist/interactions/order/index.d.ts.map +1 -0
- package/dist/interactions/order/index.js +1 -0
- package/dist/interactions/order/types.d.ts +2 -0
- package/dist/interactions/order/types.d.ts.map +1 -0
- package/dist/interactions/order/types.js +1 -0
- package/dist/interactions/portable-custom/extractor.d.ts +14 -0
- package/dist/interactions/portable-custom/extractor.d.ts.map +1 -0
- package/dist/interactions/portable-custom/extractor.js +96 -0
- package/dist/interactions/portable-custom/index.d.ts +3 -0
- package/dist/interactions/portable-custom/index.d.ts.map +1 -0
- package/dist/interactions/portable-custom/index.js +1 -0
- package/dist/interactions/portable-custom/types.d.ts +2 -0
- package/dist/interactions/portable-custom/types.d.ts.map +1 -0
- package/dist/interactions/portable-custom/types.js +1 -0
- package/dist/interactions/position-object/extractor.d.ts +59 -0
- package/dist/interactions/position-object/extractor.d.ts.map +1 -0
- package/dist/interactions/position-object/extractor.js +191 -0
- package/dist/interactions/position-object/index.d.ts +3 -0
- package/dist/interactions/position-object/index.d.ts.map +1 -0
- package/dist/interactions/position-object/index.js +1 -0
- package/dist/interactions/position-object/types.d.ts +2 -0
- package/dist/interactions/position-object/types.d.ts.map +1 -0
- package/dist/interactions/position-object/types.js +1 -0
- package/dist/interactions/select-point/extractor.d.ts +31 -0
- package/dist/interactions/select-point/extractor.d.ts.map +1 -0
- package/dist/interactions/select-point/extractor.js +109 -0
- package/dist/interactions/select-point/index.d.ts +3 -0
- package/dist/interactions/select-point/index.d.ts.map +1 -0
- package/dist/interactions/select-point/index.js +1 -0
- package/dist/interactions/select-point/types.d.ts +2 -0
- package/dist/interactions/select-point/types.d.ts.map +1 -0
- package/dist/interactions/select-point/types.js +1 -0
- package/dist/interactions/shared/index.d.ts +2 -0
- package/dist/interactions/shared/index.d.ts.map +1 -0
- package/dist/interactions/shared/index.js +1 -0
- package/dist/interactions/shared/types.d.ts +412 -0
- package/dist/interactions/shared/types.d.ts.map +1 -0
- package/dist/interactions/shared/types.js +7 -0
- package/dist/interactions/slider/extractor.d.ts +24 -0
- package/dist/interactions/slider/extractor.d.ts.map +1 -0
- package/dist/interactions/slider/extractor.js +73 -0
- package/dist/interactions/slider/index.d.ts +3 -0
- package/dist/interactions/slider/index.d.ts.map +1 -0
- package/dist/interactions/slider/index.js +1 -0
- package/dist/interactions/slider/types.d.ts +2 -0
- package/dist/interactions/slider/types.d.ts.map +1 -0
- package/dist/interactions/slider/types.js +1 -0
- package/dist/interactions/text-entry/extractor.d.ts +21 -0
- package/dist/interactions/text-entry/extractor.d.ts.map +1 -0
- package/dist/interactions/text-entry/extractor.js +54 -0
- package/dist/interactions/text-entry/index.d.ts +3 -0
- package/dist/interactions/text-entry/index.d.ts.map +1 -0
- package/dist/interactions/text-entry/index.js +1 -0
- package/dist/interactions/text-entry/types.d.ts +2 -0
- package/dist/interactions/text-entry/types.d.ts.map +1 -0
- package/dist/interactions/text-entry/types.js +1 -0
- package/dist/interactions/upload/extractor.d.ts +20 -0
- package/dist/interactions/upload/extractor.d.ts.map +1 -0
- package/dist/interactions/upload/extractor.js +59 -0
- package/dist/interactions/upload/index.d.ts +3 -0
- package/dist/interactions/upload/index.d.ts.map +1 -0
- package/dist/interactions/upload/index.js +1 -0
- package/dist/interactions/upload/types.d.ts +2 -0
- package/dist/interactions/upload/types.d.ts.map +1 -0
- package/dist/interactions/upload/types.js +1 -0
- package/dist/types/interactions.d.ts +4 -408
- package/dist/types/interactions.d.ts.map +1 -1
- package/dist/types/interactions.js +3 -3
- package/dist/web-components/QTIInteractionBase.d.ts +5 -5
- package/dist/web-components/QTIInteractionBase.d.ts.map +1 -1
- package/dist/web-components/QTIInteractionElement.d.ts +11 -8
- package/dist/web-components/QTIInteractionElement.d.ts.map +1 -1
- package/dist/web-components/index.d.ts +1 -1
- package/dist/web-components/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/ItemBody.svelte +35 -173
- package/src/components/ItemPlayer.svelte +9 -5
- package/src/components/ModalFeedbackDisplay.svelte +15 -5
- package/src/core/ComponentRegistry.ts +22 -7
- package/src/core/Player.ts +48 -163
- package/src/document/AssessmentItemDocument.ts +178 -0
- package/src/extraction/extractors/associateExtractor.ts +1 -133
- package/src/extraction/extractors/choiceExtractor.ts +1 -121
- package/src/extraction/extractors/customExtractor.ts +1 -72
- package/src/extraction/extractors/drawingExtractor.ts +1 -113
- package/src/extraction/extractors/endAttemptExtractor.ts +1 -74
- package/src/extraction/extractors/extendedTextExtractor.ts +1 -89
- package/src/extraction/extractors/gapMatchExtractor.ts +1 -193
- package/src/extraction/extractors/graphicAssociateExtractor.ts +1 -192
- package/src/extraction/extractors/graphicGapMatchExtractor.ts +1 -257
- package/src/extraction/extractors/graphicOrderExtractor.ts +1 -162
- package/src/extraction/extractors/hotspotExtractor.ts +1 -208
- package/src/extraction/extractors/hottextExtractor.ts +1 -163
- package/src/extraction/extractors/index.ts +5 -111
- package/src/extraction/extractors/inlineChoiceExtractor.ts +1 -105
- package/src/extraction/extractors/matchExtractor.ts +1 -187
- package/src/extraction/extractors/mediaExtractor.ts +1 -168
- package/src/extraction/extractors/orderExtractor.ts +1 -120
- package/src/extraction/extractors/portableCustomExtractor.ts +1 -122
- package/src/extraction/extractors/positionObjectExtractor.ts +1 -243
- package/src/extraction/extractors/selectPointExtractor.ts +1 -143
- package/src/extraction/extractors/sliderExtractor.ts +1 -102
- package/src/extraction/extractors/textEntryExtractor.ts +1 -79
- package/src/extraction/extractors/uploadExtractor.ts +1 -81
- package/src/extraction/index.ts +1 -2
- package/src/extraction/interactionExtractionPipeline.ts +70 -0
- package/src/extraction/interactionSecurity.ts +60 -0
- package/src/index.ts +2 -7
- package/src/interactions/associate/extractor.ts +133 -0
- package/src/interactions/associate/index.ts +2 -0
- package/src/interactions/associate/types.ts +1 -0
- package/src/interactions/choice/extractor.ts +121 -0
- package/src/interactions/choice/index.ts +2 -0
- package/src/interactions/choice/types.ts +1 -0
- package/src/interactions/custom/extractor.ts +72 -0
- package/src/interactions/custom/index.ts +2 -0
- package/src/interactions/custom/types.ts +1 -0
- package/src/interactions/drawing/extractor.ts +113 -0
- package/src/interactions/drawing/index.ts +2 -0
- package/src/interactions/drawing/types.ts +1 -0
- package/src/interactions/end-attempt/extractor.ts +74 -0
- package/src/interactions/end-attempt/index.ts +2 -0
- package/src/interactions/end-attempt/types.ts +1 -0
- package/src/interactions/extended-text/extractor.ts +89 -0
- package/src/interactions/extended-text/index.ts +2 -0
- package/src/interactions/extended-text/types.ts +1 -0
- package/src/interactions/gap-match/extractor.ts +193 -0
- package/src/interactions/gap-match/index.ts +2 -0
- package/src/interactions/gap-match/types.ts +1 -0
- package/src/interactions/graphic-associate/extractor.ts +192 -0
- package/src/interactions/graphic-associate/index.ts +2 -0
- package/src/interactions/graphic-associate/types.ts +1 -0
- package/src/interactions/graphic-gap-match/extractor.ts +257 -0
- package/src/interactions/graphic-gap-match/index.ts +2 -0
- package/src/interactions/graphic-gap-match/types.ts +1 -0
- package/src/interactions/graphic-order/extractor.ts +162 -0
- package/src/interactions/graphic-order/index.ts +2 -0
- package/src/interactions/graphic-order/types.ts +1 -0
- package/src/interactions/hotspot/extractor.ts +208 -0
- package/src/interactions/hotspot/index.ts +2 -0
- package/src/interactions/hotspot/types.ts +1 -0
- package/src/interactions/hottext/extractor.ts +163 -0
- package/src/interactions/hottext/index.ts +2 -0
- package/src/interactions/hottext/types.ts +1 -0
- package/src/interactions/index.ts +52 -0
- package/src/interactions/inline/index.ts +1 -0
- package/src/interactions/inline/render-plan.ts +105 -0
- package/src/interactions/inline-choice/InlineChoice.svelte +57 -0
- package/src/interactions/inline-choice/extractor.ts +105 -0
- package/src/interactions/inline-choice/index.ts +2 -0
- package/src/interactions/inline-choice/types.ts +1 -0
- package/src/interactions/match/extractor.ts +187 -0
- package/src/interactions/match/index.ts +2 -0
- package/src/interactions/match/types.ts +1 -0
- package/src/interactions/media/extractor.ts +168 -0
- package/src/interactions/media/index.ts +2 -0
- package/src/interactions/media/types.ts +1 -0
- package/src/interactions/modules.ts +111 -0
- package/src/interactions/order/extractor.ts +120 -0
- package/src/interactions/order/index.ts +2 -0
- package/src/interactions/order/types.ts +1 -0
- package/src/interactions/portable-custom/extractor.ts +122 -0
- package/src/interactions/portable-custom/index.ts +2 -0
- package/src/interactions/portable-custom/types.ts +1 -0
- package/src/interactions/position-object/extractor.ts +243 -0
- package/src/interactions/position-object/index.ts +2 -0
- package/src/interactions/position-object/types.ts +1 -0
- package/src/interactions/select-point/extractor.ts +143 -0
- package/src/interactions/select-point/index.ts +2 -0
- package/src/interactions/select-point/types.ts +1 -0
- package/src/interactions/shared/index.ts +1 -0
- package/src/interactions/shared/types.ts +429 -0
- package/src/interactions/slider/extractor.ts +102 -0
- package/src/interactions/slider/index.ts +2 -0
- package/src/interactions/slider/types.ts +1 -0
- package/src/interactions/text-entry/InlineTextEntry.svelte +75 -0
- package/src/interactions/text-entry/extractor.ts +79 -0
- package/src/interactions/text-entry/index.ts +2 -0
- package/src/interactions/text-entry/types.ts +1 -0
- package/src/interactions/upload/extractor.ts +81 -0
- package/src/interactions/upload/index.ts +2 -0
- package/src/interactions/upload/types.ts +1 -0
- package/src/types/interactions.ts +4 -425
- package/src/web-components/QTIInteractionBase.ts +6 -5
- package/src/web-components/QTIInteractionElement.ts +15 -8
- package/src/web-components/index.ts +1 -0
- package/src/core/ItemRenderer.ts +0 -371
|
@@ -1,243 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI positionObjectInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from positionObjectInteraction elements (drag objects to positions)
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ IMPORTANT: QTI 2.2 positionObjectInteraction Limitations
|
|
7
|
-
*
|
|
8
|
-
* This interaction has severe limitations that make it impractical for most educational scenarios:
|
|
9
|
-
*
|
|
10
|
-
* 1. Response format is baseType="point" - only stores coordinates ["158 168"]
|
|
11
|
-
* 2. NO way to track which specific object was placed where
|
|
12
|
-
* 3. Designed ONLY for placing multiple copies of the SAME object (e.g., airport icons)
|
|
13
|
-
* 4. Cannot support "place labeled objects on map" use cases
|
|
14
|
-
*
|
|
15
|
-
* The official QTI 2.2 spec example shows:
|
|
16
|
-
* - ONE positionObjectStage (container) with background image
|
|
17
|
-
* - ONE positionObjectInteraction with ONE draggable object
|
|
18
|
-
* - maxChoices determines how many times the object can be placed
|
|
19
|
-
* - Scoring uses areaMapping to check if ANY placement hits target zones
|
|
20
|
-
*
|
|
21
|
-
* This extractor supports a NON-STANDARD extension with multiple positionObjectStage
|
|
22
|
-
* elements (each with identifiers), but the response format cannot preserve object identity.
|
|
23
|
-
* For labeled-object placement, use graphicGapMatchInteraction instead.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import type { ElementExtractor } from '../types.js';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Image data for position object interaction
|
|
30
|
-
*/
|
|
31
|
-
export interface ImageData {
|
|
32
|
-
type: 'image' | 'svg';
|
|
33
|
-
src?: string;
|
|
34
|
-
content?: string;
|
|
35
|
-
width?: string;
|
|
36
|
-
height?: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Position object data extracted from positionObjectInteraction elements
|
|
41
|
-
*/
|
|
42
|
-
export interface PositionObjectData {
|
|
43
|
-
imageData: ImageData | null;
|
|
44
|
-
positionObjectStages: Array<{
|
|
45
|
-
identifier: string;
|
|
46
|
-
label: string;
|
|
47
|
-
matchMax: number;
|
|
48
|
-
matchMin?: number;
|
|
49
|
-
objectData: ImageData | null;
|
|
50
|
-
classes?: string[];
|
|
51
|
-
}>;
|
|
52
|
-
centerPoint: boolean;
|
|
53
|
-
maxChoices: number;
|
|
54
|
-
minChoices: number;
|
|
55
|
-
prompt: string | null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Standard QTI position object interaction extractor
|
|
60
|
-
* Handles positionObjectInteraction elements (dragging an object to a position)
|
|
61
|
-
*/
|
|
62
|
-
export const standardPositionObjectExtractor: ElementExtractor<PositionObjectData> = {
|
|
63
|
-
id: 'qti:position-object-interaction',
|
|
64
|
-
name: 'QTI Standard Position Object Interaction',
|
|
65
|
-
priority: 10,
|
|
66
|
-
elementTypes: ['positionObjectInteraction'],
|
|
67
|
-
description: 'Extracts standard QTI positionObjectInteraction (drag object to position)',
|
|
68
|
-
|
|
69
|
-
canHandle(element, _context) {
|
|
70
|
-
// All positionObjectInteraction elements are standard
|
|
71
|
-
return element.rawTagName === 'positionObjectInteraction';
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
extract(element, context) {
|
|
75
|
-
const { utils } = context;
|
|
76
|
-
|
|
77
|
-
// Extract background image data from object element (direct child)
|
|
78
|
-
const objectElements = utils.getChildrenByTag(element, 'object');
|
|
79
|
-
let imageData: ImageData | null = null;
|
|
80
|
-
|
|
81
|
-
if (objectElements.length > 0) {
|
|
82
|
-
const objectElement = objectElements[0];
|
|
83
|
-
const type = utils.getAttribute(objectElement, 'type', '');
|
|
84
|
-
const data = utils.getAttribute(objectElement, 'data', '');
|
|
85
|
-
const width = utils.getAttribute(objectElement, 'width', '500');
|
|
86
|
-
const height = utils.getAttribute(objectElement, 'height', '300');
|
|
87
|
-
|
|
88
|
-
if (type.startsWith('image/svg')) {
|
|
89
|
-
// Extract inline SVG content - get full content including <svg> tag
|
|
90
|
-
const content = utils.getHtmlContent(objectElement);
|
|
91
|
-
imageData = {
|
|
92
|
-
type: 'svg',
|
|
93
|
-
content,
|
|
94
|
-
width,
|
|
95
|
-
height,
|
|
96
|
-
};
|
|
97
|
-
} else {
|
|
98
|
-
// External image reference
|
|
99
|
-
imageData = {
|
|
100
|
-
type: 'image',
|
|
101
|
-
src: data,
|
|
102
|
-
width,
|
|
103
|
-
height,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Extract positionObjectStage children
|
|
109
|
-
const stageElements = utils.getChildrenByTag(element, 'positionObjectStage');
|
|
110
|
-
const positionObjectStages = stageElements.map((stage) => {
|
|
111
|
-
const classes = utils.getClasses(stage);
|
|
112
|
-
const identifier = utils.getAttribute(stage, 'identifier', '');
|
|
113
|
-
const matchMax = utils.getNumberAttribute(stage, 'matchMax', 1);
|
|
114
|
-
const matchMin = utils.getNumberAttribute(stage, 'matchMin', 0);
|
|
115
|
-
|
|
116
|
-
// Get text content as label, use identifier as fallback
|
|
117
|
-
const textContent = utils.getTextContent(stage).trim();
|
|
118
|
-
const label = textContent || identifier;
|
|
119
|
-
|
|
120
|
-
// Extract object data from nested object element
|
|
121
|
-
const stageObjectElements = utils.getChildrenByTag(stage, 'object');
|
|
122
|
-
let objectData: ImageData | null = null;
|
|
123
|
-
|
|
124
|
-
if (stageObjectElements.length > 0) {
|
|
125
|
-
const objElement = stageObjectElements[0];
|
|
126
|
-
const objType = utils.getAttribute(objElement, 'type', '');
|
|
127
|
-
const objData = utils.getAttribute(objElement, 'data', '');
|
|
128
|
-
const objWidth = utils.getAttribute(objElement, 'width', '50');
|
|
129
|
-
const objHeight = utils.getAttribute(objElement, 'height', '50');
|
|
130
|
-
|
|
131
|
-
if (objType.startsWith('image/svg')) {
|
|
132
|
-
// Extract inline SVG content
|
|
133
|
-
const content = utils.getHtmlContent(objElement);
|
|
134
|
-
objectData = {
|
|
135
|
-
type: 'svg',
|
|
136
|
-
content,
|
|
137
|
-
width: objWidth,
|
|
138
|
-
height: objHeight,
|
|
139
|
-
};
|
|
140
|
-
} else {
|
|
141
|
-
// External image reference
|
|
142
|
-
objectData = {
|
|
143
|
-
type: 'image',
|
|
144
|
-
src: objData,
|
|
145
|
-
width: objWidth,
|
|
146
|
-
height: objHeight,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
identifier,
|
|
153
|
-
label,
|
|
154
|
-
matchMax,
|
|
155
|
-
...(matchMin > 0 ? { matchMin } : {}),
|
|
156
|
-
objectData,
|
|
157
|
-
...(classes.length > 0 ? { classes } : {}),
|
|
158
|
-
};
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// Extract attributes
|
|
162
|
-
// centerPoint defaults to true when not specified
|
|
163
|
-
const centerPoint = utils.getBooleanAttribute(element, 'centerPoint', true);
|
|
164
|
-
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);
|
|
165
|
-
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
166
|
-
|
|
167
|
-
// Extract prompt (optional)
|
|
168
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
169
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
170
|
-
|
|
171
|
-
return {
|
|
172
|
-
imageData,
|
|
173
|
-
positionObjectStages,
|
|
174
|
-
centerPoint,
|
|
175
|
-
maxChoices,
|
|
176
|
-
minChoices,
|
|
177
|
-
prompt,
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
validate(data) {
|
|
182
|
-
const errors: string[] = [];
|
|
183
|
-
const warnings: string[] = [];
|
|
184
|
-
|
|
185
|
-
// Validate image data
|
|
186
|
-
if (!data.imageData) {
|
|
187
|
-
warnings.push('positionObjectInteraction has no background image');
|
|
188
|
-
} else if (data.imageData.type === 'image' && !data.imageData.src) {
|
|
189
|
-
errors.push('positionObjectInteraction must have an image URL');
|
|
190
|
-
} else if (data.imageData.type === 'svg' && !data.imageData.content) {
|
|
191
|
-
errors.push('positionObjectInteraction must have SVG content');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Warn about dimension consistency (cannot verify actual file dimensions at extraction time)
|
|
195
|
-
if (data.imageData && data.imageData.type === 'image') {
|
|
196
|
-
warnings.push(
|
|
197
|
-
'IMPORTANT: Ensure declared width/height match actual image file dimensions. ' +
|
|
198
|
-
'Mismatched dimensions cause coordinate system errors in mapResponsePoint scoring. ' +
|
|
199
|
-
`Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Validate positionObjectStages exist
|
|
204
|
-
if (!data.positionObjectStages || data.positionObjectStages.length === 0) {
|
|
205
|
-
errors.push('positionObjectInteraction must have at least one positionObjectStage');
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Validate positionObjectStage identifiers
|
|
209
|
-
if (data.positionObjectStages) {
|
|
210
|
-
const identifiers = new Set<string>();
|
|
211
|
-
for (const stage of data.positionObjectStages) {
|
|
212
|
-
if (!stage.identifier) {
|
|
213
|
-
errors.push('All positionObjectStages must have an identifier');
|
|
214
|
-
} else if (identifiers.has(stage.identifier)) {
|
|
215
|
-
errors.push(`Duplicate positionObjectStage identifier: ${stage.identifier}`);
|
|
216
|
-
} else {
|
|
217
|
-
identifiers.add(stage.identifier);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// Validate maxChoices
|
|
223
|
-
if (data.maxChoices < 0) {
|
|
224
|
-
errors.push('maxChoices must be non-negative');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Validate minChoices
|
|
228
|
-
if (data.minChoices < 0) {
|
|
229
|
-
errors.push('minChoices must be non-negative');
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// Validate minChoices <= maxChoices
|
|
233
|
-
if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {
|
|
234
|
-
errors.push('minChoices cannot exceed maxChoices');
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return {
|
|
238
|
-
valid: errors.length === 0,
|
|
239
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
240
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
241
|
-
};
|
|
242
|
-
},
|
|
243
|
-
};
|
|
1
|
+
export * from '../../interactions/position-object/extractor.js';
|
|
@@ -1,143 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI selectPointInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from selectPointInteraction elements (click point on image)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Image data for select point interaction
|
|
11
|
-
*/
|
|
12
|
-
export interface ImageData {
|
|
13
|
-
type: 'image' | 'svg';
|
|
14
|
-
src?: string;
|
|
15
|
-
content?: string;
|
|
16
|
-
width?: string;
|
|
17
|
-
height?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Select point data extracted from selectPointInteraction elements
|
|
22
|
-
*/
|
|
23
|
-
export interface SelectPointData {
|
|
24
|
-
imageData: ImageData | null;
|
|
25
|
-
maxChoices: number;
|
|
26
|
-
minChoices: number;
|
|
27
|
-
prompt: string | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Standard QTI select point interaction extractor
|
|
32
|
-
* Handles selectPointInteraction elements (clicking points on an image)
|
|
33
|
-
*/
|
|
34
|
-
export const standardSelectPointExtractor: ElementExtractor<SelectPointData> = {
|
|
35
|
-
id: 'qti:select-point-interaction',
|
|
36
|
-
name: 'QTI Standard Select Point Interaction',
|
|
37
|
-
priority: 10,
|
|
38
|
-
elementTypes: ['selectPointInteraction'],
|
|
39
|
-
description: 'Extracts standard QTI selectPointInteraction (click point on image)',
|
|
40
|
-
|
|
41
|
-
canHandle(element, _context) {
|
|
42
|
-
// All selectPointInteraction elements are standard
|
|
43
|
-
return element.rawTagName === 'selectPointInteraction';
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
extract(element, context) {
|
|
47
|
-
const { utils } = context;
|
|
48
|
-
|
|
49
|
-
// Extract image data from object or img element
|
|
50
|
-
const objectElements = utils.getChildrenByTag(element, 'object');
|
|
51
|
-
const imgElements = utils.getChildrenByTag(element, 'img');
|
|
52
|
-
let imageData: ImageData | null = null;
|
|
53
|
-
|
|
54
|
-
if (objectElements.length > 0) {
|
|
55
|
-
const objectElement = objectElements[0];
|
|
56
|
-
const type = utils.getAttribute(objectElement, 'type', '');
|
|
57
|
-
const data = utils.getAttribute(objectElement, 'data', '');
|
|
58
|
-
const width = utils.getAttribute(objectElement, 'width', '500');
|
|
59
|
-
const height = utils.getAttribute(objectElement, 'height', '300');
|
|
60
|
-
|
|
61
|
-
if (type.startsWith('image/svg')) {
|
|
62
|
-
// Extract inline SVG content - get full content including <svg> tag
|
|
63
|
-
const content = utils.getHtmlContent(objectElement);
|
|
64
|
-
imageData = {
|
|
65
|
-
type: 'svg',
|
|
66
|
-
content,
|
|
67
|
-
width,
|
|
68
|
-
height,
|
|
69
|
-
};
|
|
70
|
-
} else {
|
|
71
|
-
// External image reference
|
|
72
|
-
imageData = {
|
|
73
|
-
type: 'image',
|
|
74
|
-
src: data,
|
|
75
|
-
width,
|
|
76
|
-
height,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
} else if (imgElements.length > 0) {
|
|
80
|
-
// Handle img element as fallback
|
|
81
|
-
const imgElement = imgElements[0];
|
|
82
|
-
const src = utils.getAttribute(imgElement, 'src', '');
|
|
83
|
-
const width = utils.getAttribute(imgElement, 'width', '500');
|
|
84
|
-
const height = utils.getAttribute(imgElement, 'height', '300');
|
|
85
|
-
imageData = {
|
|
86
|
-
type: 'image',
|
|
87
|
-
src,
|
|
88
|
-
width,
|
|
89
|
-
height,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Extract attributes
|
|
94
|
-
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);
|
|
95
|
-
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
96
|
-
|
|
97
|
-
// Extract prompt (optional)
|
|
98
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
99
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
imageData,
|
|
103
|
-
maxChoices,
|
|
104
|
-
minChoices,
|
|
105
|
-
prompt,
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
validate(data) {
|
|
110
|
-
const errors: string[] = [];
|
|
111
|
-
const warnings: string[] = [];
|
|
112
|
-
|
|
113
|
-
// Validate image data
|
|
114
|
-
if (!data.imageData) {
|
|
115
|
-
warnings.push('selectPointInteraction has no image data');
|
|
116
|
-
} else if (data.imageData.type === 'image' && !data.imageData.src) {
|
|
117
|
-
errors.push('selectPointInteraction must have an image URL');
|
|
118
|
-
} else if (data.imageData.type === 'svg' && !data.imageData.content) {
|
|
119
|
-
errors.push('selectPointInteraction must have SVG content');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Validate maxChoices — 0 means unlimited per QTI spec
|
|
123
|
-
if (data.maxChoices < 0) {
|
|
124
|
-
errors.push('maxChoices must be non-negative');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Validate minChoices
|
|
128
|
-
if (data.minChoices < 0) {
|
|
129
|
-
errors.push('minChoices must be non-negative');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Validate minChoices <= maxChoices (skip when maxChoices=0, meaning unlimited)
|
|
133
|
-
if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {
|
|
134
|
-
errors.push(`minChoices (${data.minChoices}) must be less than or equal to maxChoices (${data.maxChoices})`);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
valid: errors.length === 0,
|
|
139
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
140
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
};
|
|
1
|
+
export * from '../../interactions/select-point/extractor.js';
|
|
@@ -1,102 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI sliderInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from sliderInteraction elements (slider input)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Slider data extracted from sliderInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface SliderData {
|
|
13
|
-
lowerBound: number;
|
|
14
|
-
upperBound: number;
|
|
15
|
-
step: number;
|
|
16
|
-
stepLabel?: boolean;
|
|
17
|
-
orientation: string;
|
|
18
|
-
reverse: boolean;
|
|
19
|
-
prompt: string | null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Standard QTI slider interaction extractor
|
|
24
|
-
* Handles sliderInteraction elements (slider for numeric input)
|
|
25
|
-
*/
|
|
26
|
-
export const standardSliderExtractor: ElementExtractor<SliderData> = {
|
|
27
|
-
id: 'qti:slider-interaction',
|
|
28
|
-
name: 'QTI Standard Slider Interaction',
|
|
29
|
-
priority: 10,
|
|
30
|
-
elementTypes: ['sliderInteraction'],
|
|
31
|
-
description: 'Extracts standard QTI sliderInteraction (slider input)',
|
|
32
|
-
|
|
33
|
-
canHandle(element, _context) {
|
|
34
|
-
// All sliderInteraction elements are standard
|
|
35
|
-
return element.rawTagName === 'sliderInteraction';
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
extract(element, context) {
|
|
39
|
-
const { utils } = context;
|
|
40
|
-
|
|
41
|
-
// Extract required attributes
|
|
42
|
-
const lowerBound = utils.getNumberAttribute(element, 'lowerBound', 0);
|
|
43
|
-
const upperBound = utils.getNumberAttribute(element, 'upperBound', 100);
|
|
44
|
-
const step = utils.getNumberAttribute(element, 'step', 1);
|
|
45
|
-
const orientation = utils.getAttribute(element, 'orientation', 'horizontal');
|
|
46
|
-
const reverse = utils.getBooleanAttribute(element, 'reverse', false);
|
|
47
|
-
|
|
48
|
-
// Extract optional attributes
|
|
49
|
-
const stepLabel = utils.getBooleanAttribute(element, 'stepLabel');
|
|
50
|
-
|
|
51
|
-
// Extract prompt (optional)
|
|
52
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
53
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
lowerBound,
|
|
57
|
-
upperBound,
|
|
58
|
-
step,
|
|
59
|
-
orientation,
|
|
60
|
-
reverse,
|
|
61
|
-
...(stepLabel ? { stepLabel } : {}),
|
|
62
|
-
prompt,
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
validate(data) {
|
|
67
|
-
const errors: string[] = [];
|
|
68
|
-
const warnings: string[] = [];
|
|
69
|
-
|
|
70
|
-
// Validate bounds
|
|
71
|
-
if (data.lowerBound >= data.upperBound) {
|
|
72
|
-
errors.push('lowerBound must be less than upperBound');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Validate step
|
|
76
|
-
if (data.step <= 0) {
|
|
77
|
-
errors.push('step must be greater than 0');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Validate orientation
|
|
81
|
-
if (data.orientation && !['horizontal', 'vertical'].includes(data.orientation)) {
|
|
82
|
-
errors.push('orientation must be "horizontal" or "vertical"');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Warn if step is larger than range
|
|
86
|
-
const range = data.upperBound - data.lowerBound;
|
|
87
|
-
if (data.step > range) {
|
|
88
|
-
warnings.push(`step (${data.step}) is larger than the range (${range})`);
|
|
89
|
-
} else if (range % data.step !== 0) {
|
|
90
|
-
// Warn if step doesn't evenly divide range
|
|
91
|
-
warnings.push(
|
|
92
|
-
`step ${data.step} does not evenly divide range ${range} (${data.lowerBound} to ${data.upperBound})`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
valid: errors.length === 0,
|
|
98
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
99
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
};
|
|
1
|
+
export * from '../../interactions/slider/extractor.js';
|
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI textEntryInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from textEntryInteraction elements (inline text input)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Text entry data extracted from textEntryInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface TextEntryData {
|
|
13
|
-
expectedLength: number;
|
|
14
|
-
patternMask: string | null;
|
|
15
|
-
placeholderText: string;
|
|
16
|
-
format?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Standard QTI text entry interaction extractor
|
|
21
|
-
* Handles textEntryInteraction elements (inline text input)
|
|
22
|
-
*/
|
|
23
|
-
export const standardTextEntryExtractor: ElementExtractor<TextEntryData> = {
|
|
24
|
-
id: 'qti:text-entry-interaction',
|
|
25
|
-
name: 'QTI Standard Text Entry Interaction',
|
|
26
|
-
priority: 10,
|
|
27
|
-
elementTypes: ['textEntryInteraction'],
|
|
28
|
-
description: 'Extracts standard QTI textEntryInteraction (inline text input)',
|
|
29
|
-
|
|
30
|
-
canHandle(element, _context) {
|
|
31
|
-
// All textEntryInteraction elements are standard (both QTI 2.x and 3.0)
|
|
32
|
-
return (
|
|
33
|
-
element.rawTagName === 'textEntryInteraction' || element.rawTagName === 'qti-text-entry-interaction'
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
extract(element, context) {
|
|
38
|
-
const { utils } = context;
|
|
39
|
-
|
|
40
|
-
// Extract attributes
|
|
41
|
-
const expectedLength = utils.getNumberAttribute(element, 'expectedLength', 20);
|
|
42
|
-
const patternMask = utils.getAttribute(element, 'patternMask', '');
|
|
43
|
-
const placeholderText = utils.getAttribute(element, 'placeholderText', '');
|
|
44
|
-
const format = utils.getAttribute(element, 'format', '');
|
|
45
|
-
const interactionClasses = utils.getClasses(element);
|
|
46
|
-
const patternMaskMessage = utils.getAttribute(element, 'data-patternmask-message', '') || null;
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
expectedLength,
|
|
50
|
-
patternMask: patternMask || null,
|
|
51
|
-
placeholderText,
|
|
52
|
-
...(format ? { format } : {}),
|
|
53
|
-
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
54
|
-
...(patternMaskMessage ? { patternMaskMessage } : {}),
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
validate(data) {
|
|
59
|
-
const errors: string[] = [];
|
|
60
|
-
const warnings: string[] = [];
|
|
61
|
-
|
|
62
|
-
// Validate expectedLength
|
|
63
|
-
if (data.expectedLength < 1) {
|
|
64
|
-
errors.push('expectedLength must be positive');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (data.expectedLength > 1000) {
|
|
68
|
-
warnings.push(
|
|
69
|
-
`expectedLength (${data.expectedLength}) is very large - consider using extendedTextInteraction`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
valid: errors.length === 0,
|
|
75
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
76
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
};
|
|
1
|
+
export * from '../../interactions/text-entry/extractor.js';
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI uploadInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from uploadInteraction elements (file upload)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Upload data extracted from uploadInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface UploadData {
|
|
13
|
-
fileTypes: string[];
|
|
14
|
-
rawAttributes: Record<string, string>;
|
|
15
|
-
prompt: string | null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Standard QTI upload interaction extractor
|
|
20
|
-
* Handles uploadInteraction elements (file upload)
|
|
21
|
-
*/
|
|
22
|
-
export const standardUploadExtractor: ElementExtractor<UploadData> = {
|
|
23
|
-
id: 'qti:upload-interaction',
|
|
24
|
-
name: 'QTI Standard Upload Interaction',
|
|
25
|
-
priority: 10,
|
|
26
|
-
elementTypes: ['uploadInteraction'],
|
|
27
|
-
description: 'Extracts standard QTI uploadInteraction (file upload)',
|
|
28
|
-
|
|
29
|
-
canHandle(element, _context) {
|
|
30
|
-
// All uploadInteraction elements are standard
|
|
31
|
-
return element.rawTagName === 'uploadInteraction';
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
extract(element, context) {
|
|
35
|
-
const { utils } = context;
|
|
36
|
-
|
|
37
|
-
// Extract fileType child elements (vendor / QTI 3.0 style)
|
|
38
|
-
const fileTypeElements = utils.getChildrenByTag(element, 'fileType');
|
|
39
|
-
let fileTypes = fileTypeElements.map((el) => utils.getTextContent(el));
|
|
40
|
-
|
|
41
|
-
// Fall back to QTI 2.x `type` attribute when no <fileType> children are present
|
|
42
|
-
if (fileTypes.length === 0) {
|
|
43
|
-
const typeAttr = utils.getAttribute(element, 'type', '');
|
|
44
|
-
if (typeAttr) {
|
|
45
|
-
fileTypes = typeAttr.split(/\s+/).filter(Boolean);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Extract all attributes
|
|
50
|
-
const rawAttributes: Record<string, string> = {};
|
|
51
|
-
if (element.attributes) {
|
|
52
|
-
for (const [key, value] of Object.entries(element.attributes)) {
|
|
53
|
-
rawAttributes[key] = String(value);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Extract prompt (optional)
|
|
58
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
59
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
fileTypes,
|
|
63
|
-
rawAttributes,
|
|
64
|
-
prompt,
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
validate(data) {
|
|
69
|
-
const warnings: string[] = [];
|
|
70
|
-
|
|
71
|
-
// Warn if no file type restrictions
|
|
72
|
-
if (!data.fileTypes || data.fileTypes.length === 0) {
|
|
73
|
-
warnings.push('uploadInteraction has no fileTypes - any file type will be accepted');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
valid: true,
|
|
78
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
};
|
|
1
|
+
export * from '../../interactions/upload/extractor.js';
|
package/src/extraction/index.ts
CHANGED
|
@@ -69,9 +69,8 @@ export type {
|
|
|
69
69
|
UploadData,
|
|
70
70
|
} from './extractors/index.js';
|
|
71
71
|
|
|
72
|
-
// Standard extractors
|
|
72
|
+
// Standard extractors
|
|
73
73
|
export {
|
|
74
|
-
ALL_STANDARD_EXTRACTORS,
|
|
75
74
|
standardAssociateExtractor,
|
|
76
75
|
standardChoiceExtractor,
|
|
77
76
|
standardCustomExtractor,
|