@pie-qti/item-player 0.1.4 → 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/README.md +21 -18
- package/dist/catalog/applyGlossaryTriggers.d.ts +15 -0
- package/dist/catalog/applyGlossaryTriggers.d.ts.map +1 -0
- package/dist/catalog/applyGlossaryTriggers.js +193 -0
- package/dist/catalog/catalogExtractor.d.ts +18 -0
- package/dist/catalog/catalogExtractor.d.ts.map +1 -0
- package/dist/catalog/catalogExtractor.js +114 -0
- package/dist/catalog/catalogLookup.d.ts +18 -0
- package/dist/catalog/catalogLookup.d.ts.map +1 -0
- package/dist/catalog/catalogLookup.js +44 -0
- package/dist/catalog/glossaryAction.d.ts +17 -0
- package/dist/catalog/glossaryAction.d.ts.map +1 -0
- package/dist/catalog/glossaryAction.js +21 -0
- package/dist/catalog/types.d.ts +26 -0
- package/dist/catalog/types.d.ts.map +1 -0
- package/dist/catalog/types.js +6 -0
- package/dist/core/ComponentRegistry.d.ts +14 -4
- package/dist/core/ComponentRegistry.d.ts.map +1 -1
- package/dist/core/ComponentRegistry.js +25 -4
- package/dist/core/ItemRenderer.d.ts.map +1 -1
- package/dist/core/ItemRenderer.js +8 -18
- package/dist/core/Player.d.ts +53 -1
- package/dist/core/Player.d.ts.map +1 -1
- package/dist/core/Player.js +195 -142
- package/dist/core/rolePolicy.d.ts +16 -0
- package/dist/core/rolePolicy.d.ts.map +1 -0
- package/dist/core/rolePolicy.js +15 -0
- package/dist/core/urlPolicy.d.ts.map +1 -1
- package/dist/core/urlPolicy.js +5 -2
- 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.d.ts +22 -0
- package/dist/element.js +5548 -0
- package/dist/element.js.map +1 -0
- package/dist/extraction/ExtractionRegistry.d.ts.map +1 -1
- package/dist/extraction/ExtractionRegistry.js +3 -1
- package/dist/extraction/extractors/associateExtractor.d.ts +1 -27
- package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/associateExtractor.js +1 -94
- package/dist/extraction/extractors/choiceExtractor.d.ts +1 -24
- package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/choiceExtractor.js +1 -83
- 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 -57
- package/dist/extraction/extractors/gapMatchExtractor.d.ts +1 -27
- package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/gapMatchExtractor.js +1 -142
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +1 -39
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/graphicAssociateExtractor.js +1 -140
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +1 -41
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/graphicGapMatchExtractor.js +1 -144
- 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 -140
- 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 -120
- package/dist/extraction/extractors/index.d.ts +5 -58
- package/dist/extraction/extractors/index.d.ts.map +1 -1
- package/dist/extraction/extractors/index.js +5 -81
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +1 -21
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/inlineChoiceExtractor.js +1 -67
- package/dist/extraction/extractors/matchExtractor.d.ts +1 -31
- package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/matchExtractor.js +1 -134
- 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 -25
- package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/orderExtractor.js +1 -86
- package/dist/extraction/extractors/portableCustomExtractor.d.ts +2 -0
- package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +1 -0
- package/dist/extraction/extractors/portableCustomExtractor.js +1 -0
- 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 -19
- package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -1
- package/dist/extraction/extractors/textEntryExtractor.js +1 -48
- 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 -52
- 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 +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- 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/pci/PciHost.d.ts +53 -0
- package/dist/pci/PciHost.d.ts.map +1 -0
- package/dist/pci/PciHost.js +116 -0
- package/dist/pci/types.d.ts +57 -0
- package/dist/pci/types.d.ts.map +1 -0
- package/dist/pci/types.js +19 -0
- package/dist/pnp/applyPnp.d.ts +9 -0
- package/dist/pnp/applyPnp.d.ts.map +1 -0
- package/dist/pnp/applyPnp.js +19 -0
- package/dist/pnp/parsePnpXml.d.ts +9 -0
- package/dist/pnp/parsePnpXml.d.ts.map +1 -0
- package/dist/pnp/parsePnpXml.js +101 -0
- package/dist/pnp/types.d.ts +40 -0
- package/dist/pnp/types.d.ts.map +1 -0
- package/dist/pnp/types.js +1 -0
- package/dist/types/index.d.ts +22 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interactions.d.ts +4 -319
- 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 +19 -9
- package/src/__tests__/catalog.test.ts +267 -0
- package/src/__tests__/fixtures/pci/echo-pci.js +49 -0
- package/src/__tests__/glossaryTriggers.test.ts +411 -0
- package/src/__tests__/pci.test.ts +353 -0
- package/src/__tests__/pnp.test.ts +250 -0
- package/src/__tests__/qti3-extraction.test.ts +5 -5
- package/src/catalog/applyGlossaryTriggers.ts +232 -0
- package/src/catalog/catalogExtractor.ts +130 -0
- package/src/catalog/catalogLookup.ts +53 -0
- package/src/catalog/glossaryAction.ts +28 -0
- package/src/catalog/types.ts +37 -0
- package/src/components/ItemBody.svelte +105 -135
- package/src/components/ItemPlayer.svelte +15 -7
- package/src/components/ModalFeedbackDisplay.svelte +15 -5
- package/src/components/index.ts +3 -0
- package/src/core/ComponentRegistry.ts +36 -7
- package/src/core/Player.ts +212 -157
- package/src/core/rolePolicy.ts +34 -0
- package/src/core/urlPolicy.ts +5 -2
- package/src/document/AssessmentItemDocument.ts +178 -0
- package/src/element.ts +128 -0
- package/src/extraction/ExtractionRegistry.ts +5 -1
- package/src/extraction/extractors/associateExtractor.ts +1 -129
- package/src/extraction/extractors/choiceExtractor.ts +1 -110
- package/src/extraction/extractors/conformance-qti3-advanced.test.ts +239 -0
- package/src/extraction/extractors/conformance-qti3-basic.test.ts +82 -0
- package/src/extraction/extractors/conformance.test.ts +208 -0
- package/src/extraction/extractors/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 -83
- package/src/extraction/extractors/gapMatchExtractor.ts +1 -178
- package/src/extraction/extractors/graphicAssociateExtractor.ts +1 -188
- package/src/extraction/extractors/graphicGapMatchExtractor.ts +1 -185
- package/src/extraction/extractors/graphicOrderExtractor.ts +1 -162
- package/src/extraction/extractors/hotspotExtractor.ts +1 -190
- package/src/extraction/extractors/hottextExtractor.ts +1 -153
- package/src/extraction/extractors/index.ts +5 -107
- package/src/extraction/extractors/inlineChoiceExtractor.ts +1 -88
- package/src/extraction/extractors/matchExtractor.ts +1 -160
- package/src/extraction/extractors/mediaExtractor.ts +1 -168
- package/src/extraction/extractors/orderExtractor.ts +1 -114
- package/src/extraction/extractors/portableCustomExtractor.ts +1 -0
- 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 -72
- package/src/extraction/extractors/uploadExtractor.ts +1 -73
- 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 +19 -8
- 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/pci/PciHost.ts +138 -0
- package/src/pci/types.ts +70 -0
- package/src/pnp/applyPnp.ts +23 -0
- package/src/pnp/parsePnpXml.ts +118 -0
- package/src/pnp/types.ts +33 -0
- package/src/types/index.ts +22 -8
- package/src/types/interactions.ts +4 -350
- 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 -367
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI sliderInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from sliderInteraction elements (slider input)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI slider interaction extractor
|
|
8
|
+
* Handles sliderInteraction elements (slider for numeric input)
|
|
9
|
+
*/
|
|
10
|
+
export const standardSliderExtractor = {
|
|
11
|
+
id: 'qti:slider-interaction',
|
|
12
|
+
name: 'QTI Standard Slider Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['sliderInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI sliderInteraction (slider input)',
|
|
16
|
+
canHandle(element, _context) {
|
|
17
|
+
// All sliderInteraction elements are standard
|
|
18
|
+
return element.rawTagName === 'sliderInteraction';
|
|
19
|
+
},
|
|
20
|
+
extract(element, context) {
|
|
21
|
+
const { utils } = context;
|
|
22
|
+
// Extract required attributes
|
|
23
|
+
const lowerBound = utils.getNumberAttribute(element, 'lowerBound', 0);
|
|
24
|
+
const upperBound = utils.getNumberAttribute(element, 'upperBound', 100);
|
|
25
|
+
const step = utils.getNumberAttribute(element, 'step', 1);
|
|
26
|
+
const orientation = utils.getAttribute(element, 'orientation', 'horizontal');
|
|
27
|
+
const reverse = utils.getBooleanAttribute(element, 'reverse', false);
|
|
28
|
+
// Extract optional attributes
|
|
29
|
+
const stepLabel = utils.getBooleanAttribute(element, 'stepLabel');
|
|
30
|
+
// Extract prompt (optional)
|
|
31
|
+
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
32
|
+
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
33
|
+
return {
|
|
34
|
+
lowerBound,
|
|
35
|
+
upperBound,
|
|
36
|
+
step,
|
|
37
|
+
orientation,
|
|
38
|
+
reverse,
|
|
39
|
+
...(stepLabel ? { stepLabel } : {}),
|
|
40
|
+
prompt,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
validate(data) {
|
|
44
|
+
const errors = [];
|
|
45
|
+
const warnings = [];
|
|
46
|
+
// Validate bounds
|
|
47
|
+
if (data.lowerBound >= data.upperBound) {
|
|
48
|
+
errors.push('lowerBound must be less than upperBound');
|
|
49
|
+
}
|
|
50
|
+
// Validate step
|
|
51
|
+
if (data.step <= 0) {
|
|
52
|
+
errors.push('step must be greater than 0');
|
|
53
|
+
}
|
|
54
|
+
// Validate orientation
|
|
55
|
+
if (data.orientation && !['horizontal', 'vertical'].includes(data.orientation)) {
|
|
56
|
+
errors.push('orientation must be "horizontal" or "vertical"');
|
|
57
|
+
}
|
|
58
|
+
// Warn if step is larger than range
|
|
59
|
+
const range = data.upperBound - data.lowerBound;
|
|
60
|
+
if (data.step > range) {
|
|
61
|
+
warnings.push(`step (${data.step}) is larger than the range (${range})`);
|
|
62
|
+
}
|
|
63
|
+
else if (range % data.step !== 0) {
|
|
64
|
+
// Warn if step doesn't evenly divide range
|
|
65
|
+
warnings.push(`step ${data.step} does not evenly divide range ${range} (${data.lowerBound} to ${data.upperBound})`);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
valid: errors.length === 0,
|
|
69
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
70
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interactions/slider/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './extractor.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/interactions/slider/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI textEntryInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from textEntryInteraction elements (inline text input)
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../../extraction/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Text entry data extracted from textEntryInteraction elements
|
|
9
|
+
*/
|
|
10
|
+
export interface TextEntryData {
|
|
11
|
+
expectedLength: number;
|
|
12
|
+
patternMask: string | null;
|
|
13
|
+
placeholderText: string;
|
|
14
|
+
format?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Standard QTI text entry interaction extractor
|
|
18
|
+
* Handles textEntryInteraction elements (inline text input)
|
|
19
|
+
*/
|
|
20
|
+
export declare const standardTextEntryExtractor: ElementExtractor<TextEntryData>;
|
|
21
|
+
//# sourceMappingURL=extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/interactions/text-entry/extractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,gBAAgB,CAAC,aAAa,CAwDtE,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI textEntryInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from textEntryInteraction elements (inline text input)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI text entry interaction extractor
|
|
8
|
+
* Handles textEntryInteraction elements (inline text input)
|
|
9
|
+
*/
|
|
10
|
+
export const standardTextEntryExtractor = {
|
|
11
|
+
id: 'qti:text-entry-interaction',
|
|
12
|
+
name: 'QTI Standard Text Entry Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['textEntryInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI textEntryInteraction (inline text input)',
|
|
16
|
+
canHandle(element, _context) {
|
|
17
|
+
// All textEntryInteraction elements are standard (both QTI 2.x and 3.0)
|
|
18
|
+
return (element.rawTagName === 'textEntryInteraction' || element.rawTagName === 'qti-text-entry-interaction');
|
|
19
|
+
},
|
|
20
|
+
extract(element, context) {
|
|
21
|
+
const { utils } = context;
|
|
22
|
+
// Extract attributes
|
|
23
|
+
const expectedLength = utils.getNumberAttribute(element, 'expectedLength', 20);
|
|
24
|
+
const patternMask = utils.getAttribute(element, 'patternMask', '');
|
|
25
|
+
const placeholderText = utils.getAttribute(element, 'placeholderText', '');
|
|
26
|
+
const format = utils.getAttribute(element, 'format', '');
|
|
27
|
+
const interactionClasses = utils.getClasses(element);
|
|
28
|
+
const patternMaskMessage = utils.getAttribute(element, 'data-patternmask-message', '') || null;
|
|
29
|
+
return {
|
|
30
|
+
expectedLength,
|
|
31
|
+
patternMask: patternMask || null,
|
|
32
|
+
placeholderText,
|
|
33
|
+
...(format ? { format } : {}),
|
|
34
|
+
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
35
|
+
...(patternMaskMessage ? { patternMaskMessage } : {}),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
validate(data) {
|
|
39
|
+
const errors = [];
|
|
40
|
+
const warnings = [];
|
|
41
|
+
// Validate expectedLength
|
|
42
|
+
if (data.expectedLength < 1) {
|
|
43
|
+
errors.push('expectedLength must be positive');
|
|
44
|
+
}
|
|
45
|
+
if (data.expectedLength > 1000) {
|
|
46
|
+
warnings.push(`expectedLength (${data.expectedLength}) is very large - consider using extendedTextInteraction`);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
valid: errors.length === 0,
|
|
50
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
51
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interactions/text-entry/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './extractor.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/interactions/text-entry/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI uploadInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from uploadInteraction elements (file upload)
|
|
5
|
+
*/
|
|
6
|
+
import type { ElementExtractor } from '../../extraction/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Upload data extracted from uploadInteraction elements
|
|
9
|
+
*/
|
|
10
|
+
export interface UploadData {
|
|
11
|
+
fileTypes: string[];
|
|
12
|
+
rawAttributes: Record<string, string>;
|
|
13
|
+
prompt: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Standard QTI upload interaction extractor
|
|
17
|
+
* Handles uploadInteraction elements (file upload)
|
|
18
|
+
*/
|
|
19
|
+
export declare const standardUploadExtractor: ElementExtractor<UploadData>;
|
|
20
|
+
//# sourceMappingURL=extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/interactions/upload/extractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,CAAC,UAAU,CA2DhE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI uploadInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from uploadInteraction elements (file upload)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard QTI upload interaction extractor
|
|
8
|
+
* Handles uploadInteraction elements (file upload)
|
|
9
|
+
*/
|
|
10
|
+
export const standardUploadExtractor = {
|
|
11
|
+
id: 'qti:upload-interaction',
|
|
12
|
+
name: 'QTI Standard Upload Interaction',
|
|
13
|
+
priority: 10,
|
|
14
|
+
elementTypes: ['uploadInteraction'],
|
|
15
|
+
description: 'Extracts standard QTI uploadInteraction (file upload)',
|
|
16
|
+
canHandle(element, _context) {
|
|
17
|
+
// All uploadInteraction elements are standard
|
|
18
|
+
return element.rawTagName === 'uploadInteraction';
|
|
19
|
+
},
|
|
20
|
+
extract(element, context) {
|
|
21
|
+
const { utils } = context;
|
|
22
|
+
// Extract fileType child elements (vendor / QTI 3.0 style)
|
|
23
|
+
const fileTypeElements = utils.getChildrenByTag(element, 'fileType');
|
|
24
|
+
let fileTypes = fileTypeElements.map((el) => utils.getTextContent(el));
|
|
25
|
+
// Fall back to QTI 2.x `type` attribute when no <fileType> children are present
|
|
26
|
+
if (fileTypes.length === 0) {
|
|
27
|
+
const typeAttr = utils.getAttribute(element, 'type', '');
|
|
28
|
+
if (typeAttr) {
|
|
29
|
+
fileTypes = typeAttr.split(/\s+/).filter(Boolean);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Extract all attributes
|
|
33
|
+
const rawAttributes = {};
|
|
34
|
+
if (element.attributes) {
|
|
35
|
+
for (const [key, value] of Object.entries(element.attributes)) {
|
|
36
|
+
rawAttributes[key] = String(value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Extract prompt (optional)
|
|
40
|
+
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
41
|
+
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
42
|
+
return {
|
|
43
|
+
fileTypes,
|
|
44
|
+
rawAttributes,
|
|
45
|
+
prompt,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
validate(data) {
|
|
49
|
+
const warnings = [];
|
|
50
|
+
// Warn if no file type restrictions
|
|
51
|
+
if (!data.fileTypes || data.fileTypes.length === 0) {
|
|
52
|
+
warnings.push('uploadInteraction has no fileTypes - any file type will be accepted');
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
valid: true,
|
|
56
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interactions/upload/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './extractor.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/interactions/upload/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ExtractedPci } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Loads, initializes, and manages the lifecycle of a single PCI module.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* const host = new PciHost(extractedData, baseUrl);
|
|
7
|
+
* await host.load();
|
|
8
|
+
* host.initialize(domNode);
|
|
9
|
+
* host.getResponse(); // returns current response
|
|
10
|
+
* host.destroy(); // cleanup on player teardown
|
|
11
|
+
*/
|
|
12
|
+
export declare class PciHost {
|
|
13
|
+
private readonly data;
|
|
14
|
+
private readonly baseUrl;
|
|
15
|
+
private module;
|
|
16
|
+
private _response;
|
|
17
|
+
private _onResponseChange;
|
|
18
|
+
constructor(data: ExtractedPci, baseUrl: string);
|
|
19
|
+
/**
|
|
20
|
+
* Register a callback to fire when the PCI's response changes.
|
|
21
|
+
* The player calls this to wire the PCI into its internal response map.
|
|
22
|
+
*/
|
|
23
|
+
onResponseChange(callback: (responseId: string, value: unknown) => void): void;
|
|
24
|
+
/**
|
|
25
|
+
* Load the PCI module from primaryPath, falling back to fallbackPath.
|
|
26
|
+
* Throws PciLoadError if both fail.
|
|
27
|
+
*/
|
|
28
|
+
load(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Initialize the PCI inside the given DOM element.
|
|
31
|
+
* Must be called after load() resolves.
|
|
32
|
+
*/
|
|
33
|
+
initialize(dom: HTMLElement): void;
|
|
34
|
+
/** Return the current response value from the PCI module. */
|
|
35
|
+
getResponse(): unknown;
|
|
36
|
+
/** Restore a response value into the PCI module (e.g. from session state). */
|
|
37
|
+
setResponse(value: unknown): void;
|
|
38
|
+
/** Disable the PCI (e.g. when role is not candidate, or after final submission). */
|
|
39
|
+
disable(): void;
|
|
40
|
+
/** Re-enable the PCI. */
|
|
41
|
+
enable(): void;
|
|
42
|
+
/** Tear down the PCI and release all resources. */
|
|
43
|
+
destroy(): void;
|
|
44
|
+
/** Thin wrapper around dynamic import — overridable in tests. */
|
|
45
|
+
protected dynamicImport(url: string): Promise<any>;
|
|
46
|
+
private resolveUrl;
|
|
47
|
+
/**
|
|
48
|
+
* Extract a PciModule from a dynamic import result.
|
|
49
|
+
* Supports: default export, named `getInstance` export, or the module itself.
|
|
50
|
+
*/
|
|
51
|
+
private extractPciInterface;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=PciHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PciHost.d.ts","sourceRoot":"","sources":["../../src/pci/PciHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAyB,MAAM,YAAY,CAAC;AAGtE;;;;;;;;;GASG;AACH,qBAAa,OAAO;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,iBAAiB,CAA+D;gBAE5E,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM;IAK/C;;;OAGG;IACI,gBAAgB,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAIrF;;;OAGG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBlC;;;OAGG;IACI,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;IAczC,6DAA6D;IACtD,WAAW,IAAI,OAAO;IAI7B,8EAA8E;IACvE,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKxC,oFAAoF;IAC7E,OAAO,IAAI,IAAI;IAItB,yBAAyB;IAClB,MAAM,IAAI,IAAI;IAIrB,mDAAmD;IAC5C,OAAO,IAAI,IAAI;IAStB,iEAAiE;IACjE,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIlD,OAAO,CAAC,UAAU;IAOlB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAU3B"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { PciLoadError } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Loads, initializes, and manages the lifecycle of a single PCI module.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* const host = new PciHost(extractedData, baseUrl);
|
|
7
|
+
* await host.load();
|
|
8
|
+
* host.initialize(domNode);
|
|
9
|
+
* host.getResponse(); // returns current response
|
|
10
|
+
* host.destroy(); // cleanup on player teardown
|
|
11
|
+
*/
|
|
12
|
+
export class PciHost {
|
|
13
|
+
constructor(data, baseUrl) {
|
|
14
|
+
this.module = null;
|
|
15
|
+
this._response = null;
|
|
16
|
+
this._onResponseChange = null;
|
|
17
|
+
this.data = data;
|
|
18
|
+
this.baseUrl = baseUrl;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Register a callback to fire when the PCI's response changes.
|
|
22
|
+
* The player calls this to wire the PCI into its internal response map.
|
|
23
|
+
*/
|
|
24
|
+
onResponseChange(callback) {
|
|
25
|
+
this._onResponseChange = callback;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load the PCI module from primaryPath, falling back to fallbackPath.
|
|
29
|
+
* Throws PciLoadError if both fail.
|
|
30
|
+
*/
|
|
31
|
+
async load() {
|
|
32
|
+
const primary = this.resolveUrl(this.data.primaryPath);
|
|
33
|
+
try {
|
|
34
|
+
const mod = await this.dynamicImport(primary);
|
|
35
|
+
this.module = this.extractPciInterface(mod);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
catch (primaryErr) {
|
|
39
|
+
if (!this.data.fallbackPath) {
|
|
40
|
+
throw new PciLoadError(this.data.primaryPath, undefined, primaryErr);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const fallback = this.resolveUrl(this.data.fallbackPath);
|
|
44
|
+
try {
|
|
45
|
+
const mod = await this.dynamicImport(fallback);
|
|
46
|
+
this.module = this.extractPciInterface(mod);
|
|
47
|
+
}
|
|
48
|
+
catch (fallbackErr) {
|
|
49
|
+
throw new PciLoadError(this.data.primaryPath, this.data.fallbackPath, fallbackErr);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Initialize the PCI inside the given DOM element.
|
|
54
|
+
* Must be called after load() resolves.
|
|
55
|
+
*/
|
|
56
|
+
initialize(dom) {
|
|
57
|
+
if (!this.module)
|
|
58
|
+
return;
|
|
59
|
+
const boundTo = {
|
|
60
|
+
onReady: () => { },
|
|
61
|
+
onResponseChange: (value) => {
|
|
62
|
+
this._response = value;
|
|
63
|
+
this._onResponseChange?.(this.data.responseIdentifier, value);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
this.module.initialize(dom, this.data.config, boundTo);
|
|
67
|
+
}
|
|
68
|
+
/** Return the current response value from the PCI module. */
|
|
69
|
+
getResponse() {
|
|
70
|
+
return this.module ? this.module.getResponse() : this._response;
|
|
71
|
+
}
|
|
72
|
+
/** Restore a response value into the PCI module (e.g. from session state). */
|
|
73
|
+
setResponse(value) {
|
|
74
|
+
this._response = value;
|
|
75
|
+
this.module?.setResponse(value);
|
|
76
|
+
}
|
|
77
|
+
/** Disable the PCI (e.g. when role is not candidate, or after final submission). */
|
|
78
|
+
disable() {
|
|
79
|
+
this.module?.disable();
|
|
80
|
+
}
|
|
81
|
+
/** Re-enable the PCI. */
|
|
82
|
+
enable() {
|
|
83
|
+
this.module?.enable();
|
|
84
|
+
}
|
|
85
|
+
/** Tear down the PCI and release all resources. */
|
|
86
|
+
destroy() {
|
|
87
|
+
this.module?.destroy();
|
|
88
|
+
this.module = null;
|
|
89
|
+
}
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// Private helpers
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
/** Thin wrapper around dynamic import — overridable in tests. */
|
|
94
|
+
dynamicImport(url) {
|
|
95
|
+
return import(/* @vite-ignore */ url);
|
|
96
|
+
}
|
|
97
|
+
resolveUrl(path) {
|
|
98
|
+
if (/^https?:\/\//.test(path) || path.startsWith('/'))
|
|
99
|
+
return path;
|
|
100
|
+
// Relative path: resolve against baseUrl
|
|
101
|
+
const base = this.baseUrl.endsWith('/') ? this.baseUrl : this.baseUrl + '/';
|
|
102
|
+
return base + path;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Extract a PciModule from a dynamic import result.
|
|
106
|
+
* Supports: default export, named `getInstance` export, or the module itself.
|
|
107
|
+
*/
|
|
108
|
+
extractPciInterface(mod) {
|
|
109
|
+
const candidate = mod?.default ?? mod?.getInstance?.() ?? mod;
|
|
110
|
+
if (typeof candidate?.initialize !== 'function') {
|
|
111
|
+
throw new Error(`PCI module at '${this.data.primaryPath}' does not export a valid PciModule interface ` +
|
|
112
|
+
'(expected .initialize, .getResponse, .setResponse, .disable, .enable, .destroy)');
|
|
113
|
+
}
|
|
114
|
+
return candidate;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI 3.0 Portable Custom Interaction (PCI) types.
|
|
3
|
+
* Based on IMS QTI 3.0 Portable Custom Interaction specification.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Callbacks the player provides to a PCI module so it can signal state changes.
|
|
7
|
+
*/
|
|
8
|
+
export interface PciBoundTo {
|
|
9
|
+
/** Called when the PCI has finished initializing and is ready to accept responses. */
|
|
10
|
+
onReady(): void;
|
|
11
|
+
/** Called whenever the candidate's response changes. */
|
|
12
|
+
onResponseChange(value: unknown): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Contract that every PCI module must fulfill.
|
|
16
|
+
* The module's default export (or named `getInstance` export) must implement this interface.
|
|
17
|
+
*/
|
|
18
|
+
export interface PciModule {
|
|
19
|
+
/** Initialize the PCI inside the given DOM element. */
|
|
20
|
+
initialize(dom: HTMLElement, config: Record<string, string>, boundTo: PciBoundTo): void;
|
|
21
|
+
/** Return the current response value. */
|
|
22
|
+
getResponse(): unknown;
|
|
23
|
+
/** Restore a previously-captured response value. */
|
|
24
|
+
setResponse(value: unknown): void;
|
|
25
|
+
/** Disable candidate interaction (e.g. after submission or when role is not candidate). */
|
|
26
|
+
disable(): void;
|
|
27
|
+
/** Re-enable candidate interaction. */
|
|
28
|
+
enable(): void;
|
|
29
|
+
/** Tear down: remove event listeners, cancel timers, free resources. */
|
|
30
|
+
destroy(): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Extracted data from a <qti-portable-custom-interaction> element.
|
|
34
|
+
*/
|
|
35
|
+
export interface ExtractedPci {
|
|
36
|
+
/** responseIdentifier attribute value. */
|
|
37
|
+
responseIdentifier: string;
|
|
38
|
+
/** customInteractionTypeIdentifier attribute value (URN identifying the PCI type). */
|
|
39
|
+
customInteractionTypeIdentifier: string;
|
|
40
|
+
/** Primary JS module path (required). */
|
|
41
|
+
primaryPath: string;
|
|
42
|
+
/** Fallback JS module path (optional). */
|
|
43
|
+
fallbackPath?: string;
|
|
44
|
+
/** Inner HTML of the <qti-interaction-markup> element. */
|
|
45
|
+
markup: string;
|
|
46
|
+
/** Key/value pairs from <qti-pci-properties>/<qti-pci-property>. */
|
|
47
|
+
config: Record<string, string>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Thrown when a PCI module fails to load from both primary and fallback paths.
|
|
51
|
+
*/
|
|
52
|
+
export declare class PciLoadError extends Error {
|
|
53
|
+
readonly primaryPath: string;
|
|
54
|
+
readonly fallbackPath: string | undefined;
|
|
55
|
+
constructor(primaryPath: string, fallbackPath: string | undefined, cause?: Error);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pci/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,sFAAsF;IACtF,OAAO,IAAI,IAAI,CAAC;IAChB,wDAAwD;IACxD,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACzB,uDAAuD;IACvD,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACxF,yCAAyC;IACzC,WAAW,IAAI,OAAO,CAAC;IACvB,oDAAoD;IACpD,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAAC;IAChB,uCAAuC;IACvC,MAAM,IAAI,IAAI,CAAC;IACf,wEAAwE;IACxE,OAAO,IAAI,IAAI,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,0CAA0C;IAC1C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sFAAsF;IACtF,+BAA+B,EAAE,MAAM,CAAC;IACxC,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;aAErB,WAAW,EAAE,MAAM;aACnB,YAAY,EAAE,MAAM,GAAG,SAAS;gBADhC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChD,KAAK,CAAC,EAAE,KAAK;CAUd"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI 3.0 Portable Custom Interaction (PCI) types.
|
|
3
|
+
* Based on IMS QTI 3.0 Portable Custom Interaction specification.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Thrown when a PCI module fails to load from both primary and fallback paths.
|
|
7
|
+
*/
|
|
8
|
+
export class PciLoadError extends Error {
|
|
9
|
+
constructor(primaryPath, fallbackPath, cause) {
|
|
10
|
+
super(fallbackPath
|
|
11
|
+
? `PCI module failed to load from '${primaryPath}' and fallback '${fallbackPath}'`
|
|
12
|
+
: `PCI module failed to load from '${primaryPath}'`);
|
|
13
|
+
this.primaryPath = primaryPath;
|
|
14
|
+
this.fallbackPath = fallbackPath;
|
|
15
|
+
this.name = 'PciLoadError';
|
|
16
|
+
if (cause)
|
|
17
|
+
Object.defineProperty(this, 'cause', { value: cause, writable: true, configurable: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PnpProfile } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Apply a PNP profile to the player root element.
|
|
4
|
+
*
|
|
5
|
+
* Currently handles color scheme (data-qti-colorscheme attribute).
|
|
6
|
+
* Magnification is intentionally deferred — host stylesheets / browser zoom are sufficient for now.
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyPnpToRoot(rootEl: HTMLElement, pnp: PnpProfile | undefined): void;
|
|
9
|
+
//# sourceMappingURL=applyPnp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPnp.d.ts","sourceRoot":"","sources":["../../src/pnp/applyPnp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI,CAYrF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const ATTR = 'data-qti-colorscheme';
|
|
2
|
+
/**
|
|
3
|
+
* Apply a PNP profile to the player root element.
|
|
4
|
+
*
|
|
5
|
+
* Currently handles color scheme (data-qti-colorscheme attribute).
|
|
6
|
+
* Magnification is intentionally deferred — host stylesheets / browser zoom are sufficient for now.
|
|
7
|
+
*/
|
|
8
|
+
export function applyPnpToRoot(rootEl, pnp) {
|
|
9
|
+
const scheme = pnp?.display?.colorScheme;
|
|
10
|
+
if (!scheme || scheme === 'default') {
|
|
11
|
+
rootEl.removeAttribute(ATTR);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
rootEl.setAttribute(ATTR, scheme);
|
|
15
|
+
}
|
|
16
|
+
if (pnp?.display?.magnification !== undefined) {
|
|
17
|
+
console.warn('[QTI Player] PnpProfile.display.magnification is not yet applied by the player. Use browser zoom or a host stylesheet instead.');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PnpProfile } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a QTI 3.0 <personalNeedsProfile> element (or legacy <pnp> element) into a PnpProfile.
|
|
4
|
+
*
|
|
5
|
+
* Accepts either an XML/HTML string containing the profile element, or a live DOM Element.
|
|
6
|
+
* Unknown child elements are silently ignored for forward-compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parsePnpXml(xml: string | Element): PnpProfile;
|
|
9
|
+
//# sourceMappingURL=parsePnpXml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsePnpXml.d.ts","sourceRoot":"","sources":["../../src/pnp/parsePnpXml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAe7D"}
|