@pie-qti/item-player 0.1.5 → 0.1.7
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/catalog/applyGlossaryTriggers.d.ts +2 -1
- package/dist/catalog/applyGlossaryTriggers.d.ts.map +1 -1
- package/dist/catalog/applyGlossaryTriggers.js +145 -30
- package/dist/catalog/glossaryAction.d.ts.map +1 -1
- package/dist/catalog/glossaryAction.js +14 -4
- package/dist/components/utils/stimulusRender.d.ts +17 -0
- package/dist/components/utils/stimulusRender.d.ts.map +1 -0
- package/dist/components/utils/stimulusRender.js +70 -0
- package/dist/components/utils/stylesheetRender.d.ts +4 -0
- package/dist/components/utils/stylesheetRender.d.ts.map +1 -0
- package/dist/components/utils/stylesheetRender.js +57 -0
- 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 +39 -4
- package/dist/core/Player.d.ts.map +1 -1
- package/dist/core/Player.js +364 -193
- 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 +3318 -2733
- 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 +2 -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/pnp/applyPnp.d.ts.map +1 -1
- package/dist/pnp/applyPnp.js +9 -2
- package/dist/pnp/parsePnpXml.d.ts.map +1 -1
- package/dist/pnp/parsePnpXml.js +91 -3
- package/dist/pnp/types.d.ts +24 -1
- package/dist/pnp/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +47 -0
- package/dist/types/index.d.ts.map +1 -1
- 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/catalog/applyGlossaryTriggers.ts +174 -34
- package/src/catalog/glossaryAction.ts +14 -4
- package/src/components/ItemBody.svelte +71 -200
- package/src/components/ItemPlayer.svelte +9 -5
- package/src/components/ModalFeedbackDisplay.svelte +15 -5
- package/src/components/utils/stimulusRender.ts +93 -0
- package/src/components/utils/stylesheetRender.ts +58 -0
- package/src/core/ComponentRegistry.ts +22 -7
- package/src/core/Player.ts +401 -209
- 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 +3 -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/pnp/applyPnp.ts +8 -2
- package/src/pnp/parsePnpXml.ts +102 -5
- package/src/pnp/types.ts +43 -1
- package/src/types/index.ts +53 -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/__tests__/glossaryTriggers.test.ts +0 -411
- package/src/__tests__/pnp.test.ts +0 -250
- package/src/core/ItemRenderer.ts +0 -371
|
@@ -1,143 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI selectPointInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from selectPointInteraction elements (click point on image)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Image data for select point interaction
|
|
11
|
-
*/
|
|
12
|
-
export interface ImageData {
|
|
13
|
-
type: 'image' | 'svg';
|
|
14
|
-
src?: string;
|
|
15
|
-
content?: string;
|
|
16
|
-
width?: string;
|
|
17
|
-
height?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Select point data extracted from selectPointInteraction elements
|
|
22
|
-
*/
|
|
23
|
-
export interface SelectPointData {
|
|
24
|
-
imageData: ImageData | null;
|
|
25
|
-
maxChoices: number;
|
|
26
|
-
minChoices: number;
|
|
27
|
-
prompt: string | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Standard QTI select point interaction extractor
|
|
32
|
-
* Handles selectPointInteraction elements (clicking points on an image)
|
|
33
|
-
*/
|
|
34
|
-
export const standardSelectPointExtractor: ElementExtractor<SelectPointData> = {
|
|
35
|
-
id: 'qti:select-point-interaction',
|
|
36
|
-
name: 'QTI Standard Select Point Interaction',
|
|
37
|
-
priority: 10,
|
|
38
|
-
elementTypes: ['selectPointInteraction'],
|
|
39
|
-
description: 'Extracts standard QTI selectPointInteraction (click point on image)',
|
|
40
|
-
|
|
41
|
-
canHandle(element, _context) {
|
|
42
|
-
// All selectPointInteraction elements are standard
|
|
43
|
-
return element.rawTagName === 'selectPointInteraction';
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
extract(element, context) {
|
|
47
|
-
const { utils } = context;
|
|
48
|
-
|
|
49
|
-
// Extract image data from object or img element
|
|
50
|
-
const objectElements = utils.getChildrenByTag(element, 'object');
|
|
51
|
-
const imgElements = utils.getChildrenByTag(element, 'img');
|
|
52
|
-
let imageData: ImageData | null = null;
|
|
53
|
-
|
|
54
|
-
if (objectElements.length > 0) {
|
|
55
|
-
const objectElement = objectElements[0];
|
|
56
|
-
const type = utils.getAttribute(objectElement, 'type', '');
|
|
57
|
-
const data = utils.getAttribute(objectElement, 'data', '');
|
|
58
|
-
const width = utils.getAttribute(objectElement, 'width', '500');
|
|
59
|
-
const height = utils.getAttribute(objectElement, 'height', '300');
|
|
60
|
-
|
|
61
|
-
if (type.startsWith('image/svg')) {
|
|
62
|
-
// Extract inline SVG content - get full content including <svg> tag
|
|
63
|
-
const content = utils.getHtmlContent(objectElement);
|
|
64
|
-
imageData = {
|
|
65
|
-
type: 'svg',
|
|
66
|
-
content,
|
|
67
|
-
width,
|
|
68
|
-
height,
|
|
69
|
-
};
|
|
70
|
-
} else {
|
|
71
|
-
// External image reference
|
|
72
|
-
imageData = {
|
|
73
|
-
type: 'image',
|
|
74
|
-
src: data,
|
|
75
|
-
width,
|
|
76
|
-
height,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
} else if (imgElements.length > 0) {
|
|
80
|
-
// Handle img element as fallback
|
|
81
|
-
const imgElement = imgElements[0];
|
|
82
|
-
const src = utils.getAttribute(imgElement, 'src', '');
|
|
83
|
-
const width = utils.getAttribute(imgElement, 'width', '500');
|
|
84
|
-
const height = utils.getAttribute(imgElement, 'height', '300');
|
|
85
|
-
imageData = {
|
|
86
|
-
type: 'image',
|
|
87
|
-
src,
|
|
88
|
-
width,
|
|
89
|
-
height,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Extract attributes
|
|
94
|
-
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);
|
|
95
|
-
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
96
|
-
|
|
97
|
-
// Extract prompt (optional)
|
|
98
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
99
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
imageData,
|
|
103
|
-
maxChoices,
|
|
104
|
-
minChoices,
|
|
105
|
-
prompt,
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
validate(data) {
|
|
110
|
-
const errors: string[] = [];
|
|
111
|
-
const warnings: string[] = [];
|
|
112
|
-
|
|
113
|
-
// Validate image data
|
|
114
|
-
if (!data.imageData) {
|
|
115
|
-
warnings.push('selectPointInteraction has no image data');
|
|
116
|
-
} else if (data.imageData.type === 'image' && !data.imageData.src) {
|
|
117
|
-
errors.push('selectPointInteraction must have an image URL');
|
|
118
|
-
} else if (data.imageData.type === 'svg' && !data.imageData.content) {
|
|
119
|
-
errors.push('selectPointInteraction must have SVG content');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Validate maxChoices — 0 means unlimited per QTI spec
|
|
123
|
-
if (data.maxChoices < 0) {
|
|
124
|
-
errors.push('maxChoices must be non-negative');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Validate minChoices
|
|
128
|
-
if (data.minChoices < 0) {
|
|
129
|
-
errors.push('minChoices must be non-negative');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Validate minChoices <= maxChoices (skip when maxChoices=0, meaning unlimited)
|
|
133
|
-
if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {
|
|
134
|
-
errors.push(`minChoices (${data.minChoices}) must be less than or equal to maxChoices (${data.maxChoices})`);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
valid: errors.length === 0,
|
|
139
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
140
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
};
|
|
1
|
+
export * from '../../interactions/select-point/extractor.js';
|
|
@@ -1,102 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI sliderInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from sliderInteraction elements (slider input)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Slider data extracted from sliderInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface SliderData {
|
|
13
|
-
lowerBound: number;
|
|
14
|
-
upperBound: number;
|
|
15
|
-
step: number;
|
|
16
|
-
stepLabel?: boolean;
|
|
17
|
-
orientation: string;
|
|
18
|
-
reverse: boolean;
|
|
19
|
-
prompt: string | null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Standard QTI slider interaction extractor
|
|
24
|
-
* Handles sliderInteraction elements (slider for numeric input)
|
|
25
|
-
*/
|
|
26
|
-
export const standardSliderExtractor: ElementExtractor<SliderData> = {
|
|
27
|
-
id: 'qti:slider-interaction',
|
|
28
|
-
name: 'QTI Standard Slider Interaction',
|
|
29
|
-
priority: 10,
|
|
30
|
-
elementTypes: ['sliderInteraction'],
|
|
31
|
-
description: 'Extracts standard QTI sliderInteraction (slider input)',
|
|
32
|
-
|
|
33
|
-
canHandle(element, _context) {
|
|
34
|
-
// All sliderInteraction elements are standard
|
|
35
|
-
return element.rawTagName === 'sliderInteraction';
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
extract(element, context) {
|
|
39
|
-
const { utils } = context;
|
|
40
|
-
|
|
41
|
-
// Extract required attributes
|
|
42
|
-
const lowerBound = utils.getNumberAttribute(element, 'lowerBound', 0);
|
|
43
|
-
const upperBound = utils.getNumberAttribute(element, 'upperBound', 100);
|
|
44
|
-
const step = utils.getNumberAttribute(element, 'step', 1);
|
|
45
|
-
const orientation = utils.getAttribute(element, 'orientation', 'horizontal');
|
|
46
|
-
const reverse = utils.getBooleanAttribute(element, 'reverse', false);
|
|
47
|
-
|
|
48
|
-
// Extract optional attributes
|
|
49
|
-
const stepLabel = utils.getBooleanAttribute(element, 'stepLabel');
|
|
50
|
-
|
|
51
|
-
// Extract prompt (optional)
|
|
52
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
53
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
lowerBound,
|
|
57
|
-
upperBound,
|
|
58
|
-
step,
|
|
59
|
-
orientation,
|
|
60
|
-
reverse,
|
|
61
|
-
...(stepLabel ? { stepLabel } : {}),
|
|
62
|
-
prompt,
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
validate(data) {
|
|
67
|
-
const errors: string[] = [];
|
|
68
|
-
const warnings: string[] = [];
|
|
69
|
-
|
|
70
|
-
// Validate bounds
|
|
71
|
-
if (data.lowerBound >= data.upperBound) {
|
|
72
|
-
errors.push('lowerBound must be less than upperBound');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Validate step
|
|
76
|
-
if (data.step <= 0) {
|
|
77
|
-
errors.push('step must be greater than 0');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Validate orientation
|
|
81
|
-
if (data.orientation && !['horizontal', 'vertical'].includes(data.orientation)) {
|
|
82
|
-
errors.push('orientation must be "horizontal" or "vertical"');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Warn if step is larger than range
|
|
86
|
-
const range = data.upperBound - data.lowerBound;
|
|
87
|
-
if (data.step > range) {
|
|
88
|
-
warnings.push(`step (${data.step}) is larger than the range (${range})`);
|
|
89
|
-
} else if (range % data.step !== 0) {
|
|
90
|
-
// Warn if step doesn't evenly divide range
|
|
91
|
-
warnings.push(
|
|
92
|
-
`step ${data.step} does not evenly divide range ${range} (${data.lowerBound} to ${data.upperBound})`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
valid: errors.length === 0,
|
|
98
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
99
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
};
|
|
1
|
+
export * from '../../interactions/slider/extractor.js';
|
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI textEntryInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from textEntryInteraction elements (inline text input)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Text entry data extracted from textEntryInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface TextEntryData {
|
|
13
|
-
expectedLength: number;
|
|
14
|
-
patternMask: string | null;
|
|
15
|
-
placeholderText: string;
|
|
16
|
-
format?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Standard QTI text entry interaction extractor
|
|
21
|
-
* Handles textEntryInteraction elements (inline text input)
|
|
22
|
-
*/
|
|
23
|
-
export const standardTextEntryExtractor: ElementExtractor<TextEntryData> = {
|
|
24
|
-
id: 'qti:text-entry-interaction',
|
|
25
|
-
name: 'QTI Standard Text Entry Interaction',
|
|
26
|
-
priority: 10,
|
|
27
|
-
elementTypes: ['textEntryInteraction'],
|
|
28
|
-
description: 'Extracts standard QTI textEntryInteraction (inline text input)',
|
|
29
|
-
|
|
30
|
-
canHandle(element, _context) {
|
|
31
|
-
// All textEntryInteraction elements are standard (both QTI 2.x and 3.0)
|
|
32
|
-
return (
|
|
33
|
-
element.rawTagName === 'textEntryInteraction' || element.rawTagName === 'qti-text-entry-interaction'
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
extract(element, context) {
|
|
38
|
-
const { utils } = context;
|
|
39
|
-
|
|
40
|
-
// Extract attributes
|
|
41
|
-
const expectedLength = utils.getNumberAttribute(element, 'expectedLength', 20);
|
|
42
|
-
const patternMask = utils.getAttribute(element, 'patternMask', '');
|
|
43
|
-
const placeholderText = utils.getAttribute(element, 'placeholderText', '');
|
|
44
|
-
const format = utils.getAttribute(element, 'format', '');
|
|
45
|
-
const interactionClasses = utils.getClasses(element);
|
|
46
|
-
const patternMaskMessage = utils.getAttribute(element, 'data-patternmask-message', '') || null;
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
expectedLength,
|
|
50
|
-
patternMask: patternMask || null,
|
|
51
|
-
placeholderText,
|
|
52
|
-
...(format ? { format } : {}),
|
|
53
|
-
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
54
|
-
...(patternMaskMessage ? { patternMaskMessage } : {}),
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
validate(data) {
|
|
59
|
-
const errors: string[] = [];
|
|
60
|
-
const warnings: string[] = [];
|
|
61
|
-
|
|
62
|
-
// Validate expectedLength
|
|
63
|
-
if (data.expectedLength < 1) {
|
|
64
|
-
errors.push('expectedLength must be positive');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (data.expectedLength > 1000) {
|
|
68
|
-
warnings.push(
|
|
69
|
-
`expectedLength (${data.expectedLength}) is very large - consider using extendedTextInteraction`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
valid: errors.length === 0,
|
|
75
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
76
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
};
|
|
1
|
+
export * from '../../interactions/text-entry/extractor.js';
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Standard QTI uploadInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from uploadInteraction elements (file upload)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Upload data extracted from uploadInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface UploadData {
|
|
13
|
-
fileTypes: string[];
|
|
14
|
-
rawAttributes: Record<string, string>;
|
|
15
|
-
prompt: string | null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Standard QTI upload interaction extractor
|
|
20
|
-
* Handles uploadInteraction elements (file upload)
|
|
21
|
-
*/
|
|
22
|
-
export const standardUploadExtractor: ElementExtractor<UploadData> = {
|
|
23
|
-
id: 'qti:upload-interaction',
|
|
24
|
-
name: 'QTI Standard Upload Interaction',
|
|
25
|
-
priority: 10,
|
|
26
|
-
elementTypes: ['uploadInteraction'],
|
|
27
|
-
description: 'Extracts standard QTI uploadInteraction (file upload)',
|
|
28
|
-
|
|
29
|
-
canHandle(element, _context) {
|
|
30
|
-
// All uploadInteraction elements are standard
|
|
31
|
-
return element.rawTagName === 'uploadInteraction';
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
extract(element, context) {
|
|
35
|
-
const { utils } = context;
|
|
36
|
-
|
|
37
|
-
// Extract fileType child elements (vendor / QTI 3.0 style)
|
|
38
|
-
const fileTypeElements = utils.getChildrenByTag(element, 'fileType');
|
|
39
|
-
let fileTypes = fileTypeElements.map((el) => utils.getTextContent(el));
|
|
40
|
-
|
|
41
|
-
// Fall back to QTI 2.x `type` attribute when no <fileType> children are present
|
|
42
|
-
if (fileTypes.length === 0) {
|
|
43
|
-
const typeAttr = utils.getAttribute(element, 'type', '');
|
|
44
|
-
if (typeAttr) {
|
|
45
|
-
fileTypes = typeAttr.split(/\s+/).filter(Boolean);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Extract all attributes
|
|
50
|
-
const rawAttributes: Record<string, string> = {};
|
|
51
|
-
if (element.attributes) {
|
|
52
|
-
for (const [key, value] of Object.entries(element.attributes)) {
|
|
53
|
-
rawAttributes[key] = String(value);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Extract prompt (optional)
|
|
58
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
59
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
fileTypes,
|
|
63
|
-
rawAttributes,
|
|
64
|
-
prompt,
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
validate(data) {
|
|
69
|
-
const warnings: string[] = [];
|
|
70
|
-
|
|
71
|
-
// Warn if no file type restrictions
|
|
72
|
-
if (!data.fileTypes || data.fileTypes.length === 0) {
|
|
73
|
-
warnings.push('uploadInteraction has no fileTypes - any file type will be accepted');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
valid: true,
|
|
78
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
};
|
|
1
|
+
export * from '../../interactions/upload/extractor.js';
|
package/src/extraction/index.ts
CHANGED
|
@@ -69,9 +69,8 @@ export type {
|
|
|
69
69
|
UploadData,
|
|
70
70
|
} from './extractors/index.js';
|
|
71
71
|
|
|
72
|
-
// Standard extractors
|
|
72
|
+
// Standard extractors
|
|
73
73
|
export {
|
|
74
|
-
ALL_STANDARD_EXTRACTORS,
|
|
75
74
|
standardAssociateExtractor,
|
|
76
75
|
standardChoiceExtractor,
|
|
77
76
|
standardCustomExtractor,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { AssessmentItemDocument } from '../document/AssessmentItemDocument.js';
|
|
2
|
+
import type { ExtractionRegistry } from './ExtractionRegistry.js';
|
|
3
|
+
import { createExtractionContext } from './createContext.js';
|
|
4
|
+
import { applyInteractionSecurity } from './interactionSecurity.js';
|
|
5
|
+
import type { VariableDeclaration as ExtractionVariableDeclaration } from './types.js';
|
|
6
|
+
import type { DeclarationMap } from '@pie-qti/qti-processing';
|
|
7
|
+
import type { PlayerConfig } from '../types/index.js';
|
|
8
|
+
import type { InteractionData } from '../types/interactions.js';
|
|
9
|
+
|
|
10
|
+
export interface InteractionExtractionPipelineInput {
|
|
11
|
+
document: AssessmentItemDocument;
|
|
12
|
+
extractionRegistry: ExtractionRegistry;
|
|
13
|
+
declarations: DeclarationMap;
|
|
14
|
+
config: PlayerConfig;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function extractInteractionData({
|
|
18
|
+
document,
|
|
19
|
+
extractionRegistry,
|
|
20
|
+
declarations,
|
|
21
|
+
config,
|
|
22
|
+
}: InteractionExtractionPipelineInput): InteractionData[] {
|
|
23
|
+
const declMap = projectDeclarationsForExtraction(declarations);
|
|
24
|
+
const elements = document.findExtractionElements(getRegisteredElementTypes(extractionRegistry));
|
|
25
|
+
|
|
26
|
+
const interactions: InteractionData[] = [];
|
|
27
|
+
for (const discovered of elements) {
|
|
28
|
+
const context = createExtractionContext(
|
|
29
|
+
discovered.element,
|
|
30
|
+
discovered.responseIdentifier,
|
|
31
|
+
discovered.contextRoot,
|
|
32
|
+
declMap,
|
|
33
|
+
config
|
|
34
|
+
);
|
|
35
|
+
const result = extractionRegistry.extract<any>(discovered.element, context);
|
|
36
|
+
if (!result.success) continue;
|
|
37
|
+
|
|
38
|
+
interactions.push({
|
|
39
|
+
type: discovered.normalizedType as any,
|
|
40
|
+
responseId: discovered.responseIdentifier,
|
|
41
|
+
...result.data,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return applyInteractionSecurity(interactions, config.security);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getRegisteredElementTypes(extractionRegistry: ExtractionRegistry): string[] {
|
|
49
|
+
const elementTypes = new Set<string>();
|
|
50
|
+
for (const extractor of extractionRegistry.getExtractors()) {
|
|
51
|
+
for (const elementType of extractor.elementTypes) {
|
|
52
|
+
elementTypes.add(elementType);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return [...elementTypes];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function projectDeclarationsForExtraction(
|
|
59
|
+
declarations: DeclarationMap
|
|
60
|
+
): Map<string, ExtractionVariableDeclaration> {
|
|
61
|
+
const declMap = new Map<string, ExtractionVariableDeclaration>();
|
|
62
|
+
for (const declaration of Object.values(declarations)) {
|
|
63
|
+
declMap.set(declaration.identifier, {
|
|
64
|
+
identifier: declaration.identifier,
|
|
65
|
+
cardinality: declaration.cardinality as any,
|
|
66
|
+
baseType: declaration.baseType,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return declMap;
|
|
70
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { InteractionData } from '../types/interactions.js';
|
|
2
|
+
import type { PlayerSecurityConfig } from '../types/index.js';
|
|
3
|
+
import { toTrustedHtml } from '../core/trustedTypes.js';
|
|
4
|
+
import { sanitizeResourceUrl } from '../core/urlPolicy.js';
|
|
5
|
+
|
|
6
|
+
export function applyInteractionSecurity(
|
|
7
|
+
interactions: InteractionData[],
|
|
8
|
+
security?: PlayerSecurityConfig
|
|
9
|
+
): InteractionData[] {
|
|
10
|
+
const policy = security?.urlPolicy;
|
|
11
|
+
const allowObjectEmbeds = security?.allowObjectEmbeds === true;
|
|
12
|
+
const ttPolicyName = security?.trustedTypesPolicyName;
|
|
13
|
+
|
|
14
|
+
for (const interaction of interactions as any[]) {
|
|
15
|
+
// Wrap known HTML injection fields in TrustedHTML (when enabled).
|
|
16
|
+
// Important: do NOT wrap fields rendered as plain text (e.g. prompt).
|
|
17
|
+
if (interaction.type === 'choiceInteraction' && Array.isArray(interaction.choices)) {
|
|
18
|
+
for (const choice of interaction.choices) {
|
|
19
|
+
if (typeof choice?.text === 'string') {
|
|
20
|
+
choice.text = toTrustedHtml(choice.text, ttPolicyName);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Shared ImageData shape.
|
|
26
|
+
if (interaction.imageData?.src) {
|
|
27
|
+
interaction.imageData.src = sanitizeResourceUrl(interaction.imageData.src, policy, 'img') ?? '';
|
|
28
|
+
}
|
|
29
|
+
if (interaction.imageData?.content && typeof interaction.imageData.content === 'string') {
|
|
30
|
+
interaction.imageData.content = toTrustedHtml(interaction.imageData.content, ttPolicyName);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// positionObject stages.
|
|
34
|
+
if (Array.isArray(interaction.positionObjectStages)) {
|
|
35
|
+
for (const stage of interaction.positionObjectStages) {
|
|
36
|
+
if (stage?.objectData?.src) {
|
|
37
|
+
stage.objectData.src = sanitizeResourceUrl(stage.objectData.src, policy, 'img') ?? '';
|
|
38
|
+
}
|
|
39
|
+
if (stage?.objectData?.content && typeof stage.objectData.content === 'string') {
|
|
40
|
+
stage.objectData.content = toTrustedHtml(stage.objectData.content, ttPolicyName);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// mediaInteraction.
|
|
46
|
+
if (interaction.type === 'mediaInteraction' && interaction.mediaElement?.src) {
|
|
47
|
+
const kind = interaction.mediaElement.type === 'object' ? 'object' : 'media';
|
|
48
|
+
interaction.mediaElement.src =
|
|
49
|
+
sanitizeResourceUrl(interaction.mediaElement.src, policy, kind) ?? '';
|
|
50
|
+
interaction.allowObjectEmbeds = allowObjectEmbeds;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// hottextInteraction content is injected via {@html}.
|
|
54
|
+
if (interaction.type === 'hottextInteraction' && typeof interaction.contentHtml === 'string') {
|
|
55
|
+
interaction.contentHtml = toTrustedHtml(interaction.contentHtml, ttPolicyName);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return interactions;
|
|
60
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -15,12 +15,6 @@ export * from './core/constants.js';
|
|
|
15
15
|
export * from './core/declarations.js';
|
|
16
16
|
// Export drawing utilities
|
|
17
17
|
export * from './utils/drawingUtils.js';
|
|
18
|
-
// Export ItemRenderer for framework-agnostic rendering
|
|
19
|
-
export {
|
|
20
|
-
createItemRenderer,
|
|
21
|
-
ItemRenderer,
|
|
22
|
-
type ItemRendererConfig,
|
|
23
|
-
} from './core/ItemRenderer.js';
|
|
24
18
|
export { Player } from './core/Player.js';
|
|
25
19
|
export { getRoleCapabilities, type RoleCapabilities } from './core/rolePolicy.js';
|
|
26
20
|
// Plugin system (new extraction-based plugins)
|
|
@@ -32,6 +26,7 @@ export {
|
|
|
32
26
|
} from './core/Plugin.js';
|
|
33
27
|
export { PluginManager } from './core/PluginManager.js';
|
|
34
28
|
// Export extraction system (PUBLIC API)
|
|
29
|
+
export * from './interactions/index.js';
|
|
35
30
|
export type {
|
|
36
31
|
ElementExtractor,
|
|
37
32
|
ExtractionContext,
|
|
@@ -50,7 +45,7 @@ export {
|
|
|
50
45
|
isSuccessResult,
|
|
51
46
|
} from './extraction/index.js';
|
|
52
47
|
// NOTE:
|
|
53
|
-
// The player’s primary rendering contract is via web components
|
|
48
|
+
// The player’s primary rendering contract is via web components and the Svelte component entrypoint.
|
|
54
49
|
// If you need non-web-component rendering, build it externally against the public extraction APIs.
|
|
55
50
|
// Export all types including adaptive item types
|
|
56
51
|
export * from './types/index.js';
|
|
@@ -74,6 +69,7 @@ export { parsePnpXml } from './pnp/parsePnpXml.js';
|
|
|
74
69
|
export type { CatalogIndex, CatalogCard, CatalogEntry } from './catalog/types.js';
|
|
75
70
|
export { extractCatalog, extractCatalogFromItemXml, mergeCatalogs } from './catalog/catalogExtractor.js';
|
|
76
71
|
export { getCatalogEntry } from './catalog/catalogLookup.js';
|
|
72
|
+
export type { ResolvedItemDeliveryContext } from '@pie-qti/ims-cp-core';
|
|
77
73
|
|
|
78
74
|
// PCI — Portable Custom Interaction (QTI 3.0 §6.1)
|
|
79
75
|
export type { PciModule, PciBoundTo, ExtractedPci } from './pci/types.js';
|