@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,208 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI hotspotInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from hotspotInteraction elements (clickable areas on image)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Image data for hotspot 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
|
-
* Hotspot data extracted from hotspotInteraction elements
|
|
22
|
-
*/
|
|
23
|
-
export interface HotspotData {
|
|
24
|
-
imageData: ImageData | null;
|
|
25
|
-
hotspotChoices: Array<{
|
|
26
|
-
identifier: string;
|
|
27
|
-
shape: 'circle' | 'rect' | 'poly' | 'ellipse' | 'default';
|
|
28
|
-
coords: string;
|
|
29
|
-
hotspotLabel?: string;
|
|
30
|
-
classes?: string[];
|
|
31
|
-
}>;
|
|
32
|
-
maxChoices: number;
|
|
33
|
-
minChoices?: number;
|
|
34
|
-
prompt: string | null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Standard QTI hotspot interaction extractor
|
|
39
|
-
* Handles hotspotInteraction elements (clickable areas on an image)
|
|
40
|
-
*/
|
|
41
|
-
export const standardHotspotExtractor: ElementExtractor<HotspotData> = {
|
|
42
|
-
id: 'qti:hotspot-interaction',
|
|
43
|
-
name: 'QTI Standard Hotspot Interaction',
|
|
44
|
-
priority: 10,
|
|
45
|
-
elementTypes: ['hotspotInteraction'],
|
|
46
|
-
description: 'Extracts standard QTI hotspotInteraction (clickable areas on image)',
|
|
47
|
-
|
|
48
|
-
canHandle(element, _context) {
|
|
49
|
-
// All hotspotInteraction elements are standard
|
|
50
|
-
return element.rawTagName === 'hotspotInteraction';
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
extract(element, context) {
|
|
54
|
-
const { utils } = context;
|
|
55
|
-
|
|
56
|
-
// Extract image data from object element
|
|
57
|
-
const objectElements = utils.getChildrenByTag(element, 'object');
|
|
58
|
-
let imageData: ImageData | null = null;
|
|
59
|
-
|
|
60
|
-
if (objectElements.length > 0) {
|
|
61
|
-
const objectElement = objectElements[0];
|
|
62
|
-
const type = utils.getAttribute(objectElement, 'type', '');
|
|
63
|
-
const data = utils.getAttribute(objectElement, 'data', '');
|
|
64
|
-
const width = utils.getAttribute(objectElement, 'width', 'auto');
|
|
65
|
-
const height = utils.getAttribute(objectElement, 'height', 'auto');
|
|
66
|
-
|
|
67
|
-
if (type.startsWith('image/svg')) {
|
|
68
|
-
// Inline SVG: <object type="image/svg+xml"><svg>...</svg></object>
|
|
69
|
-
// External SVG: <object type="image/svg+xml" data="path/to/file.svg"/>
|
|
70
|
-
// The <object> may contain alt text (not SVG markup) — only treat as inline if content has <svg.
|
|
71
|
-
const content = utils.getHtmlContent(objectElement);
|
|
72
|
-
const hasSvgMarkup = /<svg[\s>]/i.test(content);
|
|
73
|
-
if (hasSvgMarkup) {
|
|
74
|
-
imageData = {
|
|
75
|
-
type: 'svg',
|
|
76
|
-
content,
|
|
77
|
-
width,
|
|
78
|
-
height,
|
|
79
|
-
};
|
|
80
|
-
} else {
|
|
81
|
-
// External SVG file reference — render via <img src> (SVG renders in img tags)
|
|
82
|
-
imageData = {
|
|
83
|
-
type: 'image',
|
|
84
|
-
src: data,
|
|
85
|
-
width,
|
|
86
|
-
height,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
// External image reference
|
|
91
|
-
imageData = {
|
|
92
|
-
type: 'image',
|
|
93
|
-
src: data,
|
|
94
|
-
width,
|
|
95
|
-
height,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Extract hotspotChoice children
|
|
101
|
-
const hotspotElements = utils.getChildrenByTag(element, 'hotspotChoice');
|
|
102
|
-
const hotspotChoices = hotspotElements.map((hotspot) => {
|
|
103
|
-
const classes = utils.getClasses(hotspot);
|
|
104
|
-
const shape = utils.getAttribute(hotspot, 'shape', 'rect');
|
|
105
|
-
const coords = utils.getAttribute(hotspot, 'coords', '');
|
|
106
|
-
const hotspotLabel = utils.getAttribute(hotspot, 'hotspotLabel', '');
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
identifier: utils.getAttribute(hotspot, 'identifier', ''),
|
|
110
|
-
shape: shape as 'circle' | 'rect' | 'poly' | 'ellipse' | 'default',
|
|
111
|
-
coords,
|
|
112
|
-
...(hotspotLabel ? { hotspotLabel } : {}),
|
|
113
|
-
...(classes.length > 0 ? { classes } : {}),
|
|
114
|
-
};
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// Extract attributes
|
|
118
|
-
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);
|
|
119
|
-
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
120
|
-
const interactionClasses = utils.getClasses(element);
|
|
121
|
-
const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;
|
|
122
|
-
const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;
|
|
123
|
-
|
|
124
|
-
// Extract prompt (optional)
|
|
125
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
126
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
imageData,
|
|
130
|
-
hotspotChoices,
|
|
131
|
-
maxChoices,
|
|
132
|
-
...(minChoices > 0 ? { minChoices } : {}),
|
|
133
|
-
prompt,
|
|
134
|
-
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
135
|
-
...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),
|
|
136
|
-
...(minSelectionsMessage ? { minSelectionsMessage } : {}),
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
validate(data) {
|
|
141
|
-
const errors: string[] = [];
|
|
142
|
-
const warnings: string[] = [];
|
|
143
|
-
|
|
144
|
-
// Validate image data
|
|
145
|
-
if (!data.imageData) {
|
|
146
|
-
warnings.push('hotspotInteraction has no image data');
|
|
147
|
-
} else if (data.imageData.type === 'image' && !data.imageData.src) {
|
|
148
|
-
errors.push('hotspotInteraction must have an image URL');
|
|
149
|
-
} else if (data.imageData.type === 'svg' && !data.imageData.content) {
|
|
150
|
-
errors.push('hotspotInteraction must have SVG content');
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Validate hotspots exist
|
|
154
|
-
if (!data.hotspotChoices || data.hotspotChoices.length === 0) {
|
|
155
|
-
errors.push('hotspotInteraction must have at least one hotspot');
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Validate hotspot identifiers and coords
|
|
159
|
-
if (data.hotspotChoices && data.hotspotChoices.length > 0) {
|
|
160
|
-
const identifiers = new Set<string>();
|
|
161
|
-
for (const hotspot of data.hotspotChoices) {
|
|
162
|
-
if (!hotspot.identifier) {
|
|
163
|
-
errors.push('All hotspots must have an identifier');
|
|
164
|
-
} else if (identifiers.has(hotspot.identifier)) {
|
|
165
|
-
errors.push(`Duplicate hotspot identifier: ${hotspot.identifier}`);
|
|
166
|
-
} else {
|
|
167
|
-
identifiers.add(hotspot.identifier);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (!hotspot.coords) {
|
|
171
|
-
errors.push(`Hotspot ${hotspot.identifier} must have coords`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Warn if maxChoices exceeds hotspot count
|
|
176
|
-
if (data.maxChoices > data.hotspotChoices.length) {
|
|
177
|
-
warnings.push(
|
|
178
|
-
`maxChoices (${data.maxChoices}) exceeds the number of hotspots (${data.hotspotChoices.length})`
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Validate maxChoices
|
|
184
|
-
if (data.maxChoices < 0) {
|
|
185
|
-
errors.push('maxChoices must be non-negative');
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Validate minChoices
|
|
189
|
-
if (data.minChoices !== undefined && data.minChoices < 0) {
|
|
190
|
-
errors.push('minChoices must be non-negative');
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Validate minChoices <= maxChoices
|
|
194
|
-
if (
|
|
195
|
-
data.minChoices !== undefined &&
|
|
196
|
-
data.maxChoices > 0 &&
|
|
197
|
-
data.minChoices > data.maxChoices
|
|
198
|
-
) {
|
|
199
|
-
errors.push('minChoices cannot exceed maxChoices');
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
valid: errors.length === 0,
|
|
204
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
205
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
206
|
-
};
|
|
207
|
-
},
|
|
208
|
-
};
|
|
1
|
+
export * from '../../interactions/hotspot/extractor.js';
|
|
@@ -1,163 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI hottextInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from hottextInteraction elements (select text spans)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { sanitizeHtml } from '../../core/sanitizer.js';
|
|
8
|
-
import type { QTIElement } from '../../types/interactions.js';
|
|
9
|
-
import type { ElementExtractor } from '../types.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Hottext data extracted from hottextInteraction elements
|
|
13
|
-
*/
|
|
14
|
-
export interface HottextData {
|
|
15
|
-
hottextChoices: Array<{ identifier: string; text: string; classes?: string[] }>;
|
|
16
|
-
contentHtml: string;
|
|
17
|
-
maxChoices: number;
|
|
18
|
-
minChoices: number;
|
|
19
|
-
prompt: string | null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Standard QTI hottext interaction extractor
|
|
24
|
-
* Handles hottextInteraction elements (selectable text spans)
|
|
25
|
-
*/
|
|
26
|
-
export const standardHottextExtractor: ElementExtractor<HottextData> = {
|
|
27
|
-
id: 'qti:hottext-interaction',
|
|
28
|
-
name: 'QTI Standard Hottext Interaction',
|
|
29
|
-
priority: 10,
|
|
30
|
-
elementTypes: ['hottextInteraction'],
|
|
31
|
-
description: 'Extracts standard QTI hottextInteraction (select text spans)',
|
|
32
|
-
|
|
33
|
-
canHandle(element, _context) {
|
|
34
|
-
// All hottextInteraction elements are standard
|
|
35
|
-
return element.rawTagName === 'hottextInteraction' || element.rawTagName === 'qti-hottext-interaction';
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
extract(element, context) {
|
|
39
|
-
const { utils } = context;
|
|
40
|
-
|
|
41
|
-
// Extract hottext children (selectable text spans) - recursively search entire tree
|
|
42
|
-
const findHottextElements = (el: any): any[] => {
|
|
43
|
-
const results: any[] = [];
|
|
44
|
-
if (el.rawTagName === 'hottext' || el.rawTagName === 'qti-hottext') {
|
|
45
|
-
results.push(el);
|
|
46
|
-
}
|
|
47
|
-
if (el.childNodes) {
|
|
48
|
-
for (const child of el.childNodes) {
|
|
49
|
-
if (typeof child !== 'string') {
|
|
50
|
-
results.push(...findHottextElements(child));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return results;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const hottextElements = findHottextElements(element);
|
|
58
|
-
const hottextChoices = hottextElements.map((hottext) => {
|
|
59
|
-
const classes = utils.getClasses(hottext);
|
|
60
|
-
return {
|
|
61
|
-
identifier: utils.getAttribute(hottext, 'identifier', ''),
|
|
62
|
-
text: utils.getTextContent(hottext),
|
|
63
|
-
...(classes.length > 0 ? { classes } : {}),
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Extract attributes
|
|
68
|
-
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);
|
|
69
|
-
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
70
|
-
const interactionClasses = utils.getClasses(element);
|
|
71
|
-
const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;
|
|
72
|
-
const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;
|
|
73
|
-
|
|
74
|
-
// Extract prompt (optional)
|
|
75
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
76
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
77
|
-
|
|
78
|
-
// Extract content HTML (all content except prompt)
|
|
79
|
-
let contentHtml = '';
|
|
80
|
-
for (const child of element.childNodes) {
|
|
81
|
-
// Skip prompt elements
|
|
82
|
-
if (
|
|
83
|
-
typeof child !== 'string' &&
|
|
84
|
-
(child as QTIElement).rawTagName !== 'prompt' &&
|
|
85
|
-
(child as QTIElement).rawTagName !== 'qti-prompt'
|
|
86
|
-
) {
|
|
87
|
-
contentHtml += (child as QTIElement).outerHTML || child.toString();
|
|
88
|
-
} else if (typeof child === 'string') {
|
|
89
|
-
contentHtml += child;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Sanitize extracted HTML before rendering via {@html} in the component.
|
|
94
|
-
contentHtml = sanitizeHtml(contentHtml, { security: context.config.security });
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
hottextChoices,
|
|
98
|
-
contentHtml,
|
|
99
|
-
maxChoices,
|
|
100
|
-
minChoices,
|
|
101
|
-
prompt,
|
|
102
|
-
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
103
|
-
...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),
|
|
104
|
-
...(minSelectionsMessage ? { minSelectionsMessage } : {}),
|
|
105
|
-
};
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
validate(data) {
|
|
109
|
-
const errors: string[] = [];
|
|
110
|
-
const warnings: string[] = [];
|
|
111
|
-
|
|
112
|
-
// Validate hottextChoices exist
|
|
113
|
-
if (!data.hottextChoices || data.hottextChoices.length === 0) {
|
|
114
|
-
errors.push('hottextInteraction must have at least one hottext');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Validate hottext identifiers
|
|
118
|
-
if (data.hottextChoices) {
|
|
119
|
-
const identifiers = new Set<string>();
|
|
120
|
-
for (const hottext of data.hottextChoices) {
|
|
121
|
-
if (!hottext.identifier) {
|
|
122
|
-
errors.push('All hottext elements must have an identifier');
|
|
123
|
-
} else if (identifiers.has(hottext.identifier)) {
|
|
124
|
-
errors.push(`Duplicate hottext identifier: ${hottext.identifier}`);
|
|
125
|
-
} else {
|
|
126
|
-
identifiers.add(hottext.identifier);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Validate maxChoices
|
|
132
|
-
if (data.maxChoices < 0) {
|
|
133
|
-
errors.push('maxChoices must be non-negative');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Warn if maxChoices exceeds hottext count
|
|
137
|
-
if (data.hottextChoices && data.maxChoices > data.hottextChoices.length) {
|
|
138
|
-
warnings.push(
|
|
139
|
-
`maxChoices (${data.maxChoices}) exceeds the number of hottext choices (${data.hottextChoices.length})`
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Validate minChoices
|
|
144
|
-
if (data.minChoices !== undefined && data.minChoices < 0) {
|
|
145
|
-
errors.push('minChoices must be non-negative');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Validate minChoices <= maxChoices
|
|
149
|
-
if (
|
|
150
|
-
data.minChoices !== undefined &&
|
|
151
|
-
data.maxChoices > 0 &&
|
|
152
|
-
data.minChoices > data.maxChoices
|
|
153
|
-
) {
|
|
154
|
-
errors.push('minChoices cannot exceed maxChoices');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
valid: errors.length === 0,
|
|
159
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
160
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
161
|
-
};
|
|
162
|
-
},
|
|
163
|
-
};
|
|
1
|
+
export * from '../../interactions/hottext/extractor.js';
|
|
@@ -1,115 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Compatibility barrel for standard QTI extractors.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* New code should import from `../../interactions/index.js` or the specific
|
|
5
|
+
* `../../interactions/<interaction>/index.js` module. This path remains for
|
|
6
|
+
* existing tests and public consumers.
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// Import extractors
|
|
10
|
-
import { standardAssociateExtractor } from './associateExtractor.js';
|
|
11
|
-
import { standardChoiceExtractor } from './choiceExtractor.js';
|
|
12
|
-
import { standardCustomExtractor } from './customExtractor.js';
|
|
13
|
-
import { portableCustomExtractor } from './portableCustomExtractor.js';
|
|
14
|
-
import { standardDrawingExtractor } from './drawingExtractor.js';
|
|
15
|
-
import { standardEndAttemptExtractor } from './endAttemptExtractor.js';
|
|
16
|
-
import { standardExtendedTextExtractor } from './extendedTextExtractor.js';
|
|
17
|
-
import { standardGapMatchExtractor } from './gapMatchExtractor.js';
|
|
18
|
-
import { standardGraphicAssociateExtractor } from './graphicAssociateExtractor.js';
|
|
19
|
-
import { standardGraphicGapMatchExtractor } from './graphicGapMatchExtractor.js';
|
|
20
|
-
import { standardGraphicOrderExtractor } from './graphicOrderExtractor.js';
|
|
21
|
-
import { standardHotspotExtractor } from './hotspotExtractor.js';
|
|
22
|
-
import { standardHottextExtractor } from './hottextExtractor.js';
|
|
23
|
-
import { standardInlineChoiceExtractor } from './inlineChoiceExtractor.js';
|
|
24
|
-
import { standardMatchExtractor } from './matchExtractor.js';
|
|
25
|
-
import { standardMediaExtractor } from './mediaExtractor.js';
|
|
26
|
-
import { standardOrderExtractor } from './orderExtractor.js';
|
|
27
|
-
import { standardPositionObjectExtractor } from './positionObjectExtractor.js';
|
|
28
|
-
import { standardSelectPointExtractor } from './selectPointExtractor.js';
|
|
29
|
-
import { standardSliderExtractor } from './sliderExtractor.js';
|
|
30
|
-
import { standardTextEntryExtractor } from './textEntryExtractor.js';
|
|
31
|
-
import { standardUploadExtractor } from './uploadExtractor.js';
|
|
32
|
-
|
|
33
|
-
// Re-export types and extractors
|
|
34
|
-
export type { AssociateData } from './associateExtractor.js';
|
|
35
|
-
export { standardAssociateExtractor } from './associateExtractor.js';
|
|
36
|
-
export type { ChoiceData } from './choiceExtractor.js';
|
|
37
|
-
export { standardChoiceExtractor } from './choiceExtractor.js';
|
|
38
|
-
export type { CustomData } from './customExtractor.js';
|
|
39
|
-
export { standardCustomExtractor } from './customExtractor.js';
|
|
40
|
-
export { portableCustomExtractor } from './portableCustomExtractor.js';
|
|
41
|
-
export type { DrawingData } from './drawingExtractor.js';
|
|
42
|
-
export { standardDrawingExtractor } from './drawingExtractor.js';
|
|
43
|
-
export type { EndAttemptData } from './endAttemptExtractor.js';
|
|
44
|
-
export { standardEndAttemptExtractor } from './endAttemptExtractor.js';
|
|
45
|
-
export type { ExtendedTextData } from './extendedTextExtractor.js';
|
|
46
|
-
export { standardExtendedTextExtractor } from './extendedTextExtractor.js';
|
|
47
|
-
export type { GapMatchData } from './gapMatchExtractor.js';
|
|
48
|
-
export { standardGapMatchExtractor } from './gapMatchExtractor.js';
|
|
49
|
-
export type { GraphicAssociateData } from './graphicAssociateExtractor.js';
|
|
50
|
-
export { standardGraphicAssociateExtractor } from './graphicAssociateExtractor.js';
|
|
51
|
-
export type { GraphicGapMatchData } from './graphicGapMatchExtractor.js';
|
|
52
|
-
export { standardGraphicGapMatchExtractor } from './graphicGapMatchExtractor.js';
|
|
53
|
-
export type { GraphicOrderData } from './graphicOrderExtractor.js';
|
|
54
|
-
export { standardGraphicOrderExtractor } from './graphicOrderExtractor.js';
|
|
55
|
-
export type { HotspotData } from './hotspotExtractor.js';
|
|
56
|
-
export { standardHotspotExtractor } from './hotspotExtractor.js';
|
|
57
|
-
export type { HottextData } from './hottextExtractor.js';
|
|
58
|
-
export { standardHottextExtractor } from './hottextExtractor.js';
|
|
59
|
-
export type { InlineChoiceData } from './inlineChoiceExtractor.js';
|
|
60
|
-
export { standardInlineChoiceExtractor } from './inlineChoiceExtractor.js';
|
|
61
|
-
export type { MatchData } from './matchExtractor.js';
|
|
62
|
-
export { standardMatchExtractor } from './matchExtractor.js';
|
|
63
|
-
export type { MediaData } from './mediaExtractor.js';
|
|
64
|
-
export { standardMediaExtractor } from './mediaExtractor.js';
|
|
65
|
-
export type { OrderData } from './orderExtractor.js';
|
|
66
|
-
export { standardOrderExtractor } from './orderExtractor.js';
|
|
67
|
-
export type { PositionObjectData } from './positionObjectExtractor.js';
|
|
68
|
-
export { standardPositionObjectExtractor } from './positionObjectExtractor.js';
|
|
69
|
-
export type { SelectPointData } from './selectPointExtractor.js';
|
|
70
|
-
export { standardSelectPointExtractor } from './selectPointExtractor.js';
|
|
71
|
-
export type { SliderData } from './sliderExtractor.js';
|
|
72
|
-
export { standardSliderExtractor } from './sliderExtractor.js';
|
|
73
|
-
export type { TextEntryData } from './textEntryExtractor.js';
|
|
74
|
-
export { standardTextEntryExtractor } from './textEntryExtractor.js';
|
|
75
|
-
export type { UploadData } from './uploadExtractor.js';
|
|
76
|
-
export { standardUploadExtractor } from './uploadExtractor.js';
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* All standard QTI extractors
|
|
80
|
-
* Register these with ExtractionRegistry to enable standard QTI support
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* import { ALL_STANDARD_EXTRACTORS } from '@pie-qti/item-player';
|
|
84
|
-
*
|
|
85
|
-
* const registry = new ExtractionRegistry();
|
|
86
|
-
* for (const extractor of ALL_STANDARD_EXTRACTORS) {
|
|
87
|
-
* registry.register(extractor);
|
|
88
|
-
* }
|
|
89
|
-
*/
|
|
90
|
-
export const ALL_STANDARD_EXTRACTORS: ElementExtractor[] = [
|
|
91
|
-
// PCI extractor has higher priority (20) than standardCustomExtractor (10)
|
|
92
|
-
portableCustomExtractor,
|
|
93
|
-
// All 21 standard QTI 2.2 interaction extractors (Phase 2 - Complete)
|
|
94
|
-
standardChoiceExtractor,
|
|
95
|
-
standardTextEntryExtractor,
|
|
96
|
-
standardExtendedTextExtractor,
|
|
97
|
-
standardInlineChoiceExtractor,
|
|
98
|
-
standardOrderExtractor,
|
|
99
|
-
standardMatchExtractor,
|
|
100
|
-
standardAssociateExtractor,
|
|
101
|
-
standardGapMatchExtractor,
|
|
102
|
-
standardSliderExtractor,
|
|
103
|
-
standardHotspotExtractor,
|
|
104
|
-
standardGraphicGapMatchExtractor,
|
|
105
|
-
standardUploadExtractor,
|
|
106
|
-
standardDrawingExtractor,
|
|
107
|
-
standardCustomExtractor,
|
|
108
|
-
standardMediaExtractor,
|
|
109
|
-
standardHottextExtractor,
|
|
110
|
-
standardSelectPointExtractor,
|
|
111
|
-
standardGraphicOrderExtractor,
|
|
112
|
-
standardGraphicAssociateExtractor,
|
|
113
|
-
standardPositionObjectExtractor,
|
|
114
|
-
standardEndAttemptExtractor,
|
|
115
|
-
];
|
|
9
|
+
export * from '../../interactions/index.js';
|
|
@@ -1,105 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI inlineChoiceInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from inlineChoiceInteraction elements (dropdown in text)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Inline choice data extracted from inlineChoiceInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface InlineChoiceData {
|
|
13
|
-
choices: Array<{ identifier: string; text: string; fixed?: boolean }>;
|
|
14
|
-
shuffle: boolean;
|
|
15
|
-
/** Text from the QTI <label> child element; used as the placeholder "Select…" option */
|
|
16
|
-
label: string | null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Standard QTI inline choice interaction extractor
|
|
21
|
-
* Handles inlineChoiceInteraction elements (dropdown selections within text)
|
|
22
|
-
*/
|
|
23
|
-
export const standardInlineChoiceExtractor: ElementExtractor<InlineChoiceData> = {
|
|
24
|
-
id: 'qti:inline-choice-interaction',
|
|
25
|
-
name: 'QTI Standard Inline Choice Interaction',
|
|
26
|
-
priority: 10,
|
|
27
|
-
elementTypes: ['inlineChoiceInteraction'],
|
|
28
|
-
description: 'Extracts standard QTI inlineChoiceInteraction (dropdown in text)',
|
|
29
|
-
|
|
30
|
-
canHandle(element, _context) {
|
|
31
|
-
// All inlineChoiceInteraction elements are standard
|
|
32
|
-
return element.rawTagName === 'inlineChoiceInteraction';
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
extract(element, context) {
|
|
36
|
-
const { utils } = context;
|
|
37
|
-
|
|
38
|
-
// Extract choices (inlineChoice children)
|
|
39
|
-
const inlineChoices = utils.getChildrenByTag(element, 'inlineChoice');
|
|
40
|
-
const choices = inlineChoices.map((choice) => {
|
|
41
|
-
const fixed = utils.getBooleanAttribute(choice, 'fixed');
|
|
42
|
-
return {
|
|
43
|
-
identifier: utils.getAttribute(choice, 'identifier', ''),
|
|
44
|
-
text: utils.getTextContent(choice),
|
|
45
|
-
...(fixed ? { fixed } : {}),
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Extract <label> child — used as placeholder text in the dropdown
|
|
50
|
-
const labelElements = utils.getChildrenByTag(element, 'label');
|
|
51
|
-
const label = labelElements.length > 0 ? utils.getTextContent(labelElements[0]) : null;
|
|
52
|
-
|
|
53
|
-
// data-prompt: alternative placeholder for the dropdown default option
|
|
54
|
-
const dataPrompt = utils.getAttribute(element, 'data-prompt', '') || null;
|
|
55
|
-
|
|
56
|
-
// Extract attributes
|
|
57
|
-
const shuffle = utils.getBooleanAttribute(element, 'shuffle');
|
|
58
|
-
const interactionClasses = utils.getClasses(element);
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
choices,
|
|
62
|
-
shuffle,
|
|
63
|
-
label,
|
|
64
|
-
...(dataPrompt ? { dataPrompt } : {}),
|
|
65
|
-
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
validate(data) {
|
|
70
|
-
const errors: string[] = [];
|
|
71
|
-
const warnings: string[] = [];
|
|
72
|
-
|
|
73
|
-
// Validate choices exist
|
|
74
|
-
if (!data.choices || data.choices.length === 0) {
|
|
75
|
-
errors.push('inlineChoiceInteraction must have at least one choice');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Validate choice identifiers
|
|
79
|
-
if (data.choices) {
|
|
80
|
-
const identifiers = new Set<string>();
|
|
81
|
-
for (const choice of data.choices) {
|
|
82
|
-
if (!choice.identifier) {
|
|
83
|
-
errors.push('All choices must have an identifier');
|
|
84
|
-
} else if (identifiers.has(choice.identifier)) {
|
|
85
|
-
errors.push(`Duplicate choice identifier: ${choice.identifier}`);
|
|
86
|
-
} else {
|
|
87
|
-
identifiers.add(choice.identifier);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Warn if too many choices
|
|
92
|
-
if (data.choices.length >= 10) {
|
|
93
|
-
warnings.push(
|
|
94
|
-
`inlineChoiceInteraction has ${data.choices.length} choices - consider limiting for better usability`
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
valid: errors.length === 0,
|
|
101
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
102
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
};
|
|
1
|
+
export * from '../../interactions/inline-choice/extractor.js';
|