@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
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* Framework-agnostic web components that can be used in any JavaScript environment
|
|
5
5
|
*/
|
|
6
6
|
export { QTIInteractionBase } from './QTIInteractionBase.js';
|
|
7
|
-
export { QTIChangeEvent, type QTIChangeEventDetail, QTIErrorEvent, type QTIErrorEventDetail, type QTIInteractionElement, QTIReadyEvent, QTISelectionChangeEvent, type QTISelectionChangeEventDetail, } from './QTIInteractionElement.js';
|
|
7
|
+
export { QTIChangeEvent, type InteractionResponseValue, type QTIChangeEventDetail, QTIErrorEvent, type QTIErrorEventDetail, type QTIInteractionElement, QTIReadyEvent, QTISelectionChangeEvent, type QTISelectionChangeEventDetail, } from './QTIInteractionElement.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACN,cAAc,EACd,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,aAAa,EACb,uBAAuB,EACvB,KAAK,6BAA6B,GAClC,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACN,cAAc,EACd,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,aAAa,EACb,uBAAuB,EACvB,KAAK,6BAA6B,GAClC,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-qti/item-player",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Modern QTI player supporting QTI 2.2 and 3.0 - Client-side with optional backend hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pie-qti/i18n": "0.1.
|
|
31
|
-
"@pie-qti/ims-cp-core": "0.1.
|
|
32
|
-
"@pie-qti/qti-common": "0.1.
|
|
33
|
-
"@pie-qti/qti-processing": "0.1.
|
|
34
|
-
"@pie-qti/typeset-katex": "0.1.
|
|
30
|
+
"@pie-qti/i18n": "0.1.6",
|
|
31
|
+
"@pie-qti/ims-cp-core": "0.1.6",
|
|
32
|
+
"@pie-qti/qti-common": "0.1.6",
|
|
33
|
+
"@pie-qti/qti-processing": "0.1.6",
|
|
34
|
+
"@pie-qti/typeset-katex": "0.1.6",
|
|
35
35
|
"@tiptap/core": "^3.15.3",
|
|
36
36
|
"@tiptap/extension-mathematics": "^3.15.3",
|
|
37
37
|
"@tiptap/extension-placeholder": "^3.15.3",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { InteractionData } from '../types';
|
|
3
3
|
import type { Player } from '../core/Player';
|
|
4
|
+
import type { InteractionResponseValue, QTIChangeEventDetail } from '../web-components';
|
|
4
5
|
import type { I18nProvider } from '@pie-qti/i18n';
|
|
5
6
|
import { normalizeHeuristicsConfig, type QtiHeuristicsConfig } from '@pie-qti/ims-cp-core';
|
|
6
7
|
import { processFeedbackInline } from './utils/feedbackUtils';
|
|
@@ -8,15 +9,22 @@
|
|
|
8
9
|
import { glossaryAction } from '../catalog/glossaryAction';
|
|
9
10
|
import { assignProps } from './utils/assignProps';
|
|
10
11
|
import { getRoleCapabilities } from '../core/rolePolicy';
|
|
12
|
+
import InlineChoice from '../interactions/inline-choice/InlineChoice.svelte';
|
|
13
|
+
import InlineTextEntry from '../interactions/text-entry/InlineTextEntry.svelte';
|
|
14
|
+
import { createInlineRenderPlan, isInlineInteractionTagName, isInlineInteractionType } from '../interactions/inline/render-plan';
|
|
15
|
+
|
|
16
|
+
type ItemResponseValue = InteractionResponseValue | null;
|
|
17
|
+
type ItemResponseMap = Record<string, ItemResponseValue>;
|
|
18
|
+
type QtiChangeDomEvent = CustomEvent<QTIChangeEventDetail<ItemResponseValue>>;
|
|
11
19
|
|
|
12
20
|
interface Props {
|
|
13
21
|
player: Player;
|
|
14
|
-
responses?:
|
|
22
|
+
responses?: ItemResponseMap;
|
|
15
23
|
disabled?: boolean;
|
|
16
24
|
role?: 'candidate' | 'scorer' | 'author' | 'tutor' | 'proctor' | 'testConstructor';
|
|
17
25
|
i18n?: I18nProvider;
|
|
18
26
|
typeset?: (element: HTMLElement) => void;
|
|
19
|
-
onResponseChange?: (responseId: string, value:
|
|
27
|
+
onResponseChange?: (responseId: string, value: ItemResponseValue) => void;
|
|
20
28
|
outcomeValues?: Record<string, any>; // Needed for feedbackInline visibility
|
|
21
29
|
heuristicsConfig?: QtiHeuristicsConfig; // Optional heuristics configuration
|
|
22
30
|
/** QTI 3.0 shared stimulus content: map of stimulus identifier → HTML string */
|
|
@@ -58,8 +66,7 @@
|
|
|
58
66
|
interactions
|
|
59
67
|
.filter(
|
|
60
68
|
(interaction) =>
|
|
61
|
-
interaction.type
|
|
62
|
-
interaction.type !== 'inlineChoiceInteraction'
|
|
69
|
+
!isInlineInteractionType(interaction.type)
|
|
63
70
|
)
|
|
64
71
|
.map((interaction) => {
|
|
65
72
|
try {
|
|
@@ -110,30 +117,6 @@
|
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
119
|
|
|
113
|
-
// Replace inline interactions with placeholders (they need to be rendered in-flow).
|
|
114
|
-
// Handles both QTI 2.x camelCase and QTI 3.0 kebab-case element names.
|
|
115
|
-
html = html
|
|
116
|
-
// QTI 2.x: <textEntryInteraction responseIdentifier="..." />
|
|
117
|
-
.replace(
|
|
118
|
-
/<textEntryInteraction[^>]*responseIdentifier="([^"]+)"[^>]*?(?:\/>|><\/textEntryInteraction>)/gi,
|
|
119
|
-
'[TEXTENTRY:$1]'
|
|
120
|
-
)
|
|
121
|
-
// QTI 3.0: <qti-text-entry-interaction response-identifier="..." />
|
|
122
|
-
.replace(
|
|
123
|
-
/<qti-text-entry-interaction[^>]*response-identifier="([^"]+)"[^>]*?(?:\/>|><\/qti-text-entry-interaction>)/gi,
|
|
124
|
-
'[TEXTENTRY:$1]'
|
|
125
|
-
)
|
|
126
|
-
// QTI 2.x: <inlineChoiceInteraction responseIdentifier="...">...</inlineChoiceInteraction>
|
|
127
|
-
.replace(
|
|
128
|
-
/<inlineChoiceInteraction[^>]*responseIdentifier="([^"]+)"[^>]*>[\s\S]*?<\/inlineChoiceInteraction>/gi,
|
|
129
|
-
'[INLINECHOICE:$1]'
|
|
130
|
-
)
|
|
131
|
-
// QTI 3.0: <qti-inline-choice-interaction response-identifier="...">...</qti-inline-choice-interaction>
|
|
132
|
-
.replace(
|
|
133
|
-
/<qti-inline-choice-interaction[^>]*response-identifier="([^"]+)"[^>]*>[\s\S]*?<\/qti-inline-choice-interaction>/gi,
|
|
134
|
-
'[INLINECHOICE:$1]'
|
|
135
|
-
);
|
|
136
|
-
|
|
137
120
|
// Process feedbackInline elements - conditionally show/hide based on outcome values
|
|
138
121
|
html = processFeedbackInline(html, {
|
|
139
122
|
outcomeValues,
|
|
@@ -147,9 +130,8 @@
|
|
|
147
130
|
/<(\w+Interaction|qti-[\w-]+-interaction)(\s[^>]*)?>[\s\S]*?<\/\1>/gi,
|
|
148
131
|
(match, tagName) => {
|
|
149
132
|
const lower = tagName.toLowerCase();
|
|
150
|
-
//
|
|
151
|
-
if (lower
|
|
152
|
-
lower === 'qti-text-entry-interaction' || lower === 'qti-inline-choice-interaction') {
|
|
133
|
+
// Inline interactions are rendered in-flow by the inline render plan.
|
|
134
|
+
if (isInlineInteractionTagName(lower)) {
|
|
153
135
|
return match;
|
|
154
136
|
}
|
|
155
137
|
// Wrap block interactions with a hidden span
|
|
@@ -160,95 +142,19 @@
|
|
|
160
142
|
return html;
|
|
161
143
|
});
|
|
162
144
|
|
|
163
|
-
|
|
164
|
-
// around component props inference in runes mode.
|
|
165
|
-
interface ParsedSegment {
|
|
166
|
-
type: 'html' | 'textEntry' | 'inlineChoice';
|
|
167
|
-
content?: string;
|
|
168
|
-
interaction?: any;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const inlineSegments = $derived.by(() => {
|
|
172
|
-
const html = itemBodyHtml;
|
|
173
|
-
const result: ParsedSegment[] = [];
|
|
174
|
-
|
|
175
|
-
let lastIndex = 0;
|
|
176
|
-
let match: RegExpExecArray | null;
|
|
177
|
-
|
|
178
|
-
// Find placeholders in order.
|
|
179
|
-
const combinedPattern = /\[TEXTENTRY:([^\]]+)\]|\[INLINECHOICE:([^\]]+)\]/g;
|
|
180
|
-
|
|
181
|
-
while ((match = combinedPattern.exec(html)) !== null) {
|
|
182
|
-
if (match.index > lastIndex) {
|
|
183
|
-
result.push({ type: 'html', content: html.substring(lastIndex, match.index) });
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (match[0].startsWith('[TEXTENTRY:')) {
|
|
187
|
-
const responseId = match[1];
|
|
188
|
-
const interaction = (interactions as any[]).find((i) => i.responseId === responseId);
|
|
189
|
-
if (interaction) result.push({ type: 'textEntry', interaction });
|
|
190
|
-
} else if (match[0].startsWith('[INLINECHOICE:')) {
|
|
191
|
-
const responseId = match[2];
|
|
192
|
-
const interaction = (interactions as any[]).find((i) => i.responseId === responseId);
|
|
193
|
-
if (interaction) result.push({ type: 'inlineChoice', interaction });
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
lastIndex = match.index + match[0].length;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (lastIndex < html.length) {
|
|
200
|
-
result.push({ type: 'html', content: html.substring(lastIndex) });
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (result.length === 0) {
|
|
204
|
-
result.push({ type: 'html', content: html });
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return result;
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
function handleResponseChange(responseId: string, value: any) {
|
|
211
|
-
onResponseChange(responseId, value);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
let textEntryErrors = $state<Map<string, string>>(new Map());
|
|
145
|
+
const inlineSegments = $derived(createInlineRenderPlan(itemBodyHtml, interactions));
|
|
215
146
|
|
|
216
|
-
function
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
handleResponseChange(responseId, value);
|
|
220
|
-
if (input?.validity.valid) {
|
|
221
|
-
const m = new Map(textEntryErrors);
|
|
222
|
-
m.delete(responseId);
|
|
223
|
-
textEntryErrors = m;
|
|
224
|
-
}
|
|
147
|
+
function getStringResponse(responseId: string): string {
|
|
148
|
+
const response = responses[responseId];
|
|
149
|
+
return typeof response === 'string' ? response : '';
|
|
225
150
|
}
|
|
226
151
|
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
const msg = customMessage
|
|
230
|
-
?? i18n?.t('interactions.textEntry.patternError', 'Please match the required format')
|
|
231
|
-
?? 'Please match the required format';
|
|
232
|
-
textEntryErrors = new Map(textEntryErrors).set(responseId, msg);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function handleTextEntryBlur(e: Event) {
|
|
236
|
-
(e.currentTarget as HTMLInputElement | null)?.checkValidity();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function handleInlineChoiceChange(responseId: string, e: Event) {
|
|
240
|
-
const value = (e.currentTarget as HTMLSelectElement | null)?.value ?? '';
|
|
241
|
-
handleResponseChange(responseId, value);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Helper to find correct choice for inline choice interactions
|
|
245
|
-
function findCorrectChoice(choices: any[], correctAnswer: string | null): any {
|
|
246
|
-
if (!correctAnswer) return null;
|
|
247
|
-
return choices.find((c: any) => c.identifier === correctAnswer) || null;
|
|
152
|
+
function handleResponseChange(responseId: string, value: ItemResponseValue) {
|
|
153
|
+
onResponseChange(responseId, value);
|
|
248
154
|
}
|
|
249
155
|
|
|
250
156
|
// Handle qti:change events from web components
|
|
251
|
-
function handleQtiChange(event:
|
|
157
|
+
function handleQtiChange(event: QtiChangeDomEvent) {
|
|
252
158
|
const { responseId, value } = event.detail;
|
|
253
159
|
handleResponseChange(responseId, value);
|
|
254
160
|
}
|
|
@@ -258,7 +164,7 @@
|
|
|
258
164
|
let rootEl: HTMLDivElement | null = $state(null);
|
|
259
165
|
$effect(() => {
|
|
260
166
|
if (!rootEl) return;
|
|
261
|
-
const handler = (e: Event) => handleQtiChange(e as
|
|
167
|
+
const handler = (e: Event) => handleQtiChange(e as QtiChangeDomEvent);
|
|
262
168
|
const el = rootEl; // Capture reference for cleanup
|
|
263
169
|
el.addEventListener('qti-change', handler as EventListener);
|
|
264
170
|
return () => {
|
|
@@ -318,68 +224,24 @@
|
|
|
318
224
|
{@html segment.content}
|
|
319
225
|
{:else if segment.type === 'textEntry'}
|
|
320
226
|
{@const correctAnswer = roleCapabilities.canViewCorrectResponses ? (correctResponses[segment.interaction.responseId] ?? null) : null}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
type="text"
|
|
326
|
-
class={['input input-bordered input-sm inline-input', inputWidthClass ?? '', extraClasses].filter(Boolean).join(' ')}
|
|
327
|
-
class:border-success={correctAnswer !== null}
|
|
328
|
-
class:bg-success={correctAnswer !== null}
|
|
329
|
-
class:bg-opacity-10={correctAnswer !== null}
|
|
330
|
-
style={inputWidthClass ? 'min-width: 100px; display: inline-block; margin: 0 4px;' : `width: ${segment.interaction.expectedLength * 8}px; min-width: 100px; display: inline-block; margin: 0 4px;`}
|
|
331
|
-
placeholder={segment.interaction.placeholderText || '...'}
|
|
332
|
-
pattern={segment.interaction.patternMask || undefined}
|
|
333
|
-
title={segment.interaction.patternMask ? `Format: ${segment.interaction.patternMask}` : undefined}
|
|
334
|
-
data-format={segment.interaction.format || undefined}
|
|
335
|
-
aria-label={`Text entry ${segment.interaction.responseId}${correctAnswer ? '. Correct answer: ' + correctAnswer : ''}`}
|
|
336
|
-
aria-invalid={textEntryErrors.has(segment.interaction.responseId) ? 'true' : undefined}
|
|
337
|
-
aria-describedby={textEntryErrors.has(segment.interaction.responseId) ? `${segment.interaction.responseId}-error` : undefined}
|
|
338
|
-
value={displayValue}
|
|
339
|
-
oninput={(e) => handleTextEntryInput(segment.interaction.responseId, e)}
|
|
340
|
-
oninvalid={(e) => handleTextEntryInvalid(segment.interaction.responseId, e, segment.interaction.patternMaskMessage)}
|
|
341
|
-
onblur={handleTextEntryBlur}
|
|
227
|
+
<InlineTextEntry
|
|
228
|
+
interaction={segment.interaction}
|
|
229
|
+
response={getStringResponse(segment.interaction.responseId)}
|
|
230
|
+
correctAnswer={roleCapabilities.canViewCorrectResponses ? correctAnswer : null}
|
|
342
231
|
disabled={effectiveDisabled}
|
|
232
|
+
{i18n}
|
|
233
|
+
onResponseChange={handleResponseChange}
|
|
343
234
|
/>
|
|
344
|
-
{#if textEntryErrors.has(segment.interaction.responseId)}
|
|
345
|
-
<span
|
|
346
|
-
id="{segment.interaction.responseId}-error"
|
|
347
|
-
role="alert"
|
|
348
|
-
class="qti-text-entry-error text-error text-xs"
|
|
349
|
-
style="display: block;"
|
|
350
|
-
>{textEntryErrors.get(segment.interaction.responseId)}</span>
|
|
351
|
-
{/if}
|
|
352
235
|
{:else if segment.type === 'inlineChoice'}
|
|
353
236
|
{@const correctAnswer = roleCapabilities.canViewCorrectResponses ? (correctResponses[segment.interaction.responseId] ?? null) : null}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
class:bg-opacity-10={correctAnswer !== null}
|
|
363
|
-
style="display: inline-block; margin: 0 4px; width: auto; min-width: 120px;"
|
|
364
|
-
aria-label={`Inline choice ${segment.interaction.responseId}${correctAnswer && correctChoice ? '. Correct answer: ' + (correctChoice as any).text : ''}`}
|
|
365
|
-
value={displayValue}
|
|
366
|
-
onchange={(e) => handleInlineChoiceChange(segment.interaction.responseId, e)}
|
|
367
|
-
disabled={effectiveDisabled}
|
|
368
|
-
>
|
|
369
|
-
<option value="">{segment.interaction.label ?? i18n?.t('interactions.inline.selectPlaceholder', 'Select...')}</option>
|
|
370
|
-
{#each segment.interaction.choices as choice}
|
|
371
|
-
{@const isCorrect = correctAnswer === choice.identifier}
|
|
372
|
-
<option value={choice.identifier}>
|
|
373
|
-
{choice.text}{isCorrect ? ' ✓' : ''}
|
|
374
|
-
</option>
|
|
375
|
-
{/each}
|
|
376
|
-
</select>
|
|
377
|
-
{#if correctAnswer !== null && correctChoice}
|
|
378
|
-
<span class="badge badge-success badge-sm" style="position: absolute; top: -1.5rem; left: 0; white-space: nowrap; font-size: 0.7rem;">
|
|
379
|
-
{i18n?.t('interactions.choice.correct', 'Correct') ?? 'Correct'}: {(correctChoice as any).text}
|
|
380
|
-
</span>
|
|
381
|
-
{/if}
|
|
382
|
-
</span>
|
|
237
|
+
<InlineChoice
|
|
238
|
+
interaction={segment.interaction}
|
|
239
|
+
response={getStringResponse(segment.interaction.responseId)}
|
|
240
|
+
correctAnswer={roleCapabilities.canViewCorrectResponses ? correctAnswer : null}
|
|
241
|
+
disabled={effectiveDisabled}
|
|
242
|
+
{i18n}
|
|
243
|
+
onResponseChange={handleResponseChange}
|
|
244
|
+
/>
|
|
383
245
|
{/if}
|
|
384
246
|
{/each}
|
|
385
247
|
</div>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Player } from '../core/Player';
|
|
3
|
-
import type { AdaptiveAttemptResult, ModalFeedback, PlayerSecurityConfig, QTIRole } from '../types';
|
|
3
|
+
import type { AdaptiveAttemptResult, ModalFeedback, PlayerSecurityConfig, QTIRole, ScoringResult } from '../types';
|
|
4
|
+
import type { InteractionResponseValue } from '../web-components';
|
|
4
5
|
import type { I18nProvider } from '@pie-qti/i18n';
|
|
5
6
|
import { typesetMathInElement } from '@pie-qti/typeset-katex';
|
|
6
7
|
import ItemBody from './ItemBody.svelte';
|
|
7
8
|
import ModalFeedbackDisplay from './ModalFeedbackDisplay.svelte';
|
|
8
9
|
|
|
10
|
+
type ItemResponseValue = InteractionResponseValue | null;
|
|
11
|
+
type ItemResponseMap = Record<string, ItemResponseValue>;
|
|
12
|
+
|
|
9
13
|
interface Props {
|
|
10
14
|
itemXml: string;
|
|
11
15
|
role?: QTIRole;
|
|
@@ -14,8 +18,8 @@
|
|
|
14
18
|
disabled?: boolean;
|
|
15
19
|
typeset?: (element: HTMLElement) => void;
|
|
16
20
|
i18n?: I18nProvider;
|
|
17
|
-
onResponseChange?: (responseId: string, value:
|
|
18
|
-
onSubmit?: (responses:
|
|
21
|
+
onResponseChange?: (responseId: string, value: ItemResponseValue) => void;
|
|
22
|
+
onSubmit?: (responses: ItemResponseMap, scoringResult: ScoringResult) => void;
|
|
19
23
|
/** Called when adaptive item completes (all attempts exhausted) */
|
|
20
24
|
onComplete?: (finalResult: AdaptiveAttemptResult) => void;
|
|
21
25
|
}
|
|
@@ -37,7 +41,7 @@
|
|
|
37
41
|
|
|
38
42
|
// Create player instance
|
|
39
43
|
let player = $state<Player | null>(null);
|
|
40
|
-
let responses = $state<
|
|
44
|
+
let responses = $state<ItemResponseMap>({});
|
|
41
45
|
let error = $state<string | null>(null);
|
|
42
46
|
let modalFeedback = $state<ModalFeedback[]>([]);
|
|
43
47
|
let outcomeValues = $state<Record<string, any>>({});
|
|
@@ -63,7 +67,7 @@
|
|
|
63
67
|
}
|
|
64
68
|
});
|
|
65
69
|
|
|
66
|
-
function handleResponseChange(responseId: string, value:
|
|
70
|
+
function handleResponseChange(responseId: string, value: ItemResponseValue) {
|
|
67
71
|
responses = { ...responses, [responseId]: value };
|
|
68
72
|
onResponseChange?.(responseId, value);
|
|
69
73
|
}
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
// Show modal if there's feedback
|
|
16
16
|
const hasActiveFeedback = $derived(feedback.length > 0);
|
|
17
|
+
const modalTitleId = 'item-player-modal-feedback-title';
|
|
18
|
+
const firstTitle = $derived(feedback.find((item) => item.title)?.title);
|
|
17
19
|
|
|
18
20
|
function handleClose() {
|
|
19
21
|
onClose?.();
|
|
@@ -29,13 +31,21 @@
|
|
|
29
31
|
|
|
30
32
|
{#if hasActiveFeedback}
|
|
31
33
|
<!-- DaisyUI Modal -->
|
|
32
|
-
<dialog
|
|
34
|
+
<dialog
|
|
35
|
+
open
|
|
36
|
+
class="modal modal-open"
|
|
37
|
+
aria-modal="true"
|
|
38
|
+
aria-labelledby={firstTitle ? modalTitleId : undefined}
|
|
39
|
+
aria-label={firstTitle ? undefined : (i18n?.t('feedback.title') ?? 'Feedback')}
|
|
40
|
+
onclick={handleBackdropClick}
|
|
41
|
+
>
|
|
33
42
|
<div class="modal-box max-w-3xl">
|
|
34
43
|
<!-- Close button -->
|
|
35
44
|
<button
|
|
36
45
|
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
46
|
+
type="button"
|
|
37
47
|
onclick={handleClose}
|
|
38
|
-
aria-label={i18n?.t('feedback.closeFeedback') ?? 'feedback
|
|
48
|
+
aria-label={i18n?.t('feedback.closeFeedback') ?? 'Close feedback'}
|
|
39
49
|
>
|
|
40
50
|
✕
|
|
41
51
|
</button>
|
|
@@ -44,7 +54,7 @@
|
|
|
44
54
|
{#each feedback as item, index}
|
|
45
55
|
<div class="mb-4 {index < feedback.length - 1 ? 'border-b pb-4' : ''}">
|
|
46
56
|
{#if item.title}
|
|
47
|
-
<h3 class="font-bold text-lg mb-2">{item.title}</h3>
|
|
57
|
+
<h3 id={index === 0 ? modalTitleId : undefined} class="font-bold text-lg mb-2">{item.title}</h3>
|
|
48
58
|
{/if}
|
|
49
59
|
|
|
50
60
|
<!-- Render HTML content with MathJax support -->
|
|
@@ -65,8 +75,8 @@
|
|
|
65
75
|
|
|
66
76
|
<!-- Action buttons -->
|
|
67
77
|
<div class="modal-action">
|
|
68
|
-
<button class="btn btn-primary" onclick={handleClose}>
|
|
69
|
-
{i18n?.t('common.continue') ?? '
|
|
78
|
+
<button class="btn btn-primary" type="button" onclick={handleClose}>
|
|
79
|
+
{i18n?.t('common.continue') ?? 'Continue'}
|
|
70
80
|
</button>
|
|
71
81
|
</div>
|
|
72
82
|
</div>
|
|
@@ -21,8 +21,9 @@ export interface ComponentConfig<TData extends InteractionData = InteractionData
|
|
|
21
21
|
* - 50: Moderately specific custom renderers
|
|
22
22
|
* - 10: Generic custom renderers
|
|
23
23
|
* - 0: Default fallback renderers
|
|
24
|
+
* Default: 0
|
|
24
25
|
*/
|
|
25
|
-
priority
|
|
26
|
+
priority?: number;
|
|
26
27
|
|
|
27
28
|
/** Optional description for debugging/error messages */
|
|
28
29
|
description?: string;
|
|
@@ -31,8 +32,9 @@ export interface ComponentConfig<TData extends InteractionData = InteractionData
|
|
|
31
32
|
* Predicate to determine if this component can handle the interaction
|
|
32
33
|
* Evaluated in priority order (highest first)
|
|
33
34
|
* @returns true if this component should be used
|
|
35
|
+
* Default: always true
|
|
34
36
|
*/
|
|
35
|
-
canHandle
|
|
37
|
+
canHandle?: (data: TData) => boolean;
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* Web component tag name (must contain a hyphen per web component spec)
|
|
@@ -57,7 +59,10 @@ export interface ComponentConfig<TData extends InteractionData = InteractionData
|
|
|
57
59
|
* Internal registered component with metadata
|
|
58
60
|
*/
|
|
59
61
|
interface RegisteredComponent<TData extends InteractionData = InteractionData> {
|
|
60
|
-
config: ComponentConfig<TData
|
|
62
|
+
config: ComponentConfig<TData> & {
|
|
63
|
+
priority: number;
|
|
64
|
+
canHandle: (data: TData) => boolean;
|
|
65
|
+
};
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
/**
|
|
@@ -88,8 +93,6 @@ export class ComponentRegistry {
|
|
|
88
93
|
* // Default choice component
|
|
89
94
|
* registry.register('choiceInteraction', {
|
|
90
95
|
* name: 'standard-choice',
|
|
91
|
-
* priority: 0,
|
|
92
|
-
* canHandle: () => true,
|
|
93
96
|
* tagName: 'qti-choice-interaction'
|
|
94
97
|
* });
|
|
95
98
|
*/
|
|
@@ -122,11 +125,23 @@ export class ComponentRegistry {
|
|
|
122
125
|
this.components.set(type, components);
|
|
123
126
|
}
|
|
124
127
|
|
|
125
|
-
// Add component and sort by priority (highest first)
|
|
126
|
-
components.push(
|
|
128
|
+
// Add normalized component and sort by priority (highest first)
|
|
129
|
+
components.push(this.createRegisteredComponent(config) as RegisteredComponent);
|
|
127
130
|
components.sort((a, b) => b.config.priority - a.config.priority);
|
|
128
131
|
}
|
|
129
132
|
|
|
133
|
+
private createRegisteredComponent<TData extends InteractionData>(
|
|
134
|
+
config: ComponentConfig<TData>
|
|
135
|
+
): RegisteredComponent<TData> {
|
|
136
|
+
return {
|
|
137
|
+
config: {
|
|
138
|
+
...config,
|
|
139
|
+
priority: config.priority ?? 0,
|
|
140
|
+
canHandle: config.canHandle ?? (() => true),
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
130
145
|
/**
|
|
131
146
|
* Get a web component tag name for an interaction type
|
|
132
147
|
* Evaluates canHandle predicates in priority order
|