@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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { I18nProvider } from '@pie-qti/i18n';
|
|
3
|
+
import type { TextEntryInteractionData } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
interaction: TextEntryInteractionData;
|
|
7
|
+
response?: string;
|
|
8
|
+
correctAnswer?: string | null;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
i18n?: I18nProvider;
|
|
11
|
+
onResponseChange?: (responseId: string, value: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
interaction,
|
|
16
|
+
response = '',
|
|
17
|
+
correctAnswer = null,
|
|
18
|
+
disabled = false,
|
|
19
|
+
i18n,
|
|
20
|
+
onResponseChange = () => {},
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
|
|
23
|
+
let validationError = $state<string | null>(null);
|
|
24
|
+
const displayValue = $derived(correctAnswer !== null ? correctAnswer : response);
|
|
25
|
+
const inputWidthClass = $derived((interaction.interactionClasses ?? []).find((className) => className.startsWith('qti-input-width-')));
|
|
26
|
+
const extraClasses = $derived((interaction.interactionClasses ?? []).filter((className) => !className.startsWith('qti-input-width-')).join(' '));
|
|
27
|
+
const errorId = $derived(`${interaction.responseId}-error`);
|
|
28
|
+
|
|
29
|
+
function handleInput(event: Event) {
|
|
30
|
+
const input = event.currentTarget as HTMLInputElement | null;
|
|
31
|
+
const value = input?.value ?? '';
|
|
32
|
+
onResponseChange(interaction.responseId, value);
|
|
33
|
+
if (input?.validity.valid) {
|
|
34
|
+
validationError = null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function handleInvalid(event: Event) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
validationError =
|
|
41
|
+
interaction.patternMaskMessage ??
|
|
42
|
+
i18n?.t('interactions.textEntry.patternError', 'Please match the required format') ??
|
|
43
|
+
'Please match the required format';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleBlur(event: Event) {
|
|
47
|
+
(event.currentTarget as HTMLInputElement | null)?.checkValidity();
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<input
|
|
52
|
+
type="text"
|
|
53
|
+
class={['input input-bordered input-sm inline-input', inputWidthClass ?? '', extraClasses].filter(Boolean).join(' ')}
|
|
54
|
+
class:border-success={correctAnswer !== null}
|
|
55
|
+
class:bg-success={correctAnswer !== null}
|
|
56
|
+
class:bg-opacity-10={correctAnswer !== null}
|
|
57
|
+
style={inputWidthClass ? 'min-width: 100px; display: inline-block; margin: 0 4px;' : `width: ${interaction.expectedLength * 8}px; min-width: 100px; display: inline-block; margin: 0 4px;`}
|
|
58
|
+
placeholder={interaction.placeholderText || '...'}
|
|
59
|
+
pattern={interaction.patternMask || undefined}
|
|
60
|
+
title={interaction.patternMask ? `Format: ${interaction.patternMask}` : undefined}
|
|
61
|
+
data-format={interaction.format || undefined}
|
|
62
|
+
aria-label={`Text entry ${interaction.responseId}${correctAnswer ? '. Correct answer: ' + correctAnswer : ''}`}
|
|
63
|
+
aria-invalid={validationError ? 'true' : undefined}
|
|
64
|
+
aria-describedby={validationError ? errorId : undefined}
|
|
65
|
+
value={displayValue}
|
|
66
|
+
oninput={handleInput}
|
|
67
|
+
oninvalid={handleInvalid}
|
|
68
|
+
onblur={handleBlur}
|
|
69
|
+
{disabled}
|
|
70
|
+
/>
|
|
71
|
+
{#if validationError}
|
|
72
|
+
<span id={errorId} role="alert" class="qti-text-entry-error text-error text-xs" style="display: block;">
|
|
73
|
+
{validationError}
|
|
74
|
+
</span>
|
|
75
|
+
{/if}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI textEntryInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from textEntryInteraction elements (inline text input)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ElementExtractor } from '../../extraction/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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { TextEntryInteractionData } from '../shared/types.js';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard QTI uploadInteraction extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts data from uploadInteraction elements (file upload)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ElementExtractor } from '../../extraction/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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { UploadInteractionData } from '../shared/types.js';
|
package/src/pnp/applyPnp.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PnpProfile } from './types.js';
|
|
2
2
|
|
|
3
3
|
const ATTR = 'data-qti-colorscheme';
|
|
4
|
+
const MAGNIFICATION_ATTR = 'data-qti-magnification';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Apply a PNP profile to the player root element.
|
|
@@ -17,7 +18,12 @@ export function applyPnpToRoot(rootEl: HTMLElement, pnp: PnpProfile | undefined)
|
|
|
17
18
|
rootEl.setAttribute(ATTR, scheme);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const magnification = pnp?.display?.magnification;
|
|
22
|
+
if (magnification !== undefined && Number.isFinite(magnification) && magnification > 0) {
|
|
23
|
+
rootEl.setAttribute(MAGNIFICATION_ATTR, String(magnification));
|
|
24
|
+
rootEl.style?.setProperty?.('--qti-magnification', String(magnification));
|
|
25
|
+
} else {
|
|
26
|
+
rootEl.removeAttribute(MAGNIFICATION_ATTR);
|
|
27
|
+
rootEl.style?.removeProperty?.('--qti-magnification');
|
|
22
28
|
}
|
|
23
29
|
}
|
package/src/pnp/parsePnpXml.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse as parseHtml } from 'node-html-parser';
|
|
2
2
|
import type { HTMLElement as NhpElement } from 'node-html-parser';
|
|
3
|
-
import type { PnpProfile } from './types.js';
|
|
3
|
+
import type { CatalogSupportPreference, PnpProfile } from './types.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Parse a QTI 3.0 <personalNeedsProfile> element (or legacy <pnp> element) into a PnpProfile.
|
|
@@ -63,6 +63,43 @@ function extractProfile(root: NhpElement): PnpProfile {
|
|
|
63
63
|
if (languageCode) profile.content.keywordTranslation = { active, languageCode };
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
const illustratedEl = findChild(contentEl, [
|
|
67
|
+
'illustratedglossary',
|
|
68
|
+
'illustrated-glossary',
|
|
69
|
+
'ext:sbacglossaryillustration',
|
|
70
|
+
'ext:sbac-glossary-illustration',
|
|
71
|
+
]);
|
|
72
|
+
if (illustratedEl) {
|
|
73
|
+
profile.content.illustratedGlossary = parseBool(
|
|
74
|
+
illustratedEl.getAttribute('enabled') ?? illustratedEl.getAttribute('active') ?? illustratedEl.text ?? 'true'
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const catalogSupportMap = [
|
|
79
|
+
['ttsPronunciation', ['ttspronunciation', 'tts-pronunciation']],
|
|
80
|
+
['signingDefinition', ['signingdefinition', 'signing-definition']],
|
|
81
|
+
['brailleText', ['brailletext', 'braille-text']],
|
|
82
|
+
['audioDescription', ['audiodescription', 'audio-description']],
|
|
83
|
+
['extendedDescription', ['extendeddescription', 'extended-description']],
|
|
84
|
+
] as const;
|
|
85
|
+
for (const [key, names] of catalogSupportMap) {
|
|
86
|
+
const el = findChild(contentEl, names);
|
|
87
|
+
if (el) {
|
|
88
|
+
profile.content.catalogSupports ??= {};
|
|
89
|
+
profile.content.catalogSupports[key] = parseCatalogSupportPreference(el);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
for (const el of findChildren(contentEl, ['catalogsupport', 'catalog-support', 'qti-catalog-support'])) {
|
|
94
|
+
const usage = normalizeCatalogUsage(
|
|
95
|
+
el.getAttribute('usage') ?? el.getAttribute('support') ?? el.getAttribute('name') ?? ''
|
|
96
|
+
);
|
|
97
|
+
if (!usage) continue;
|
|
98
|
+
const key = catalogSupportPreferenceKey(usage);
|
|
99
|
+
profile.content.catalogSupports ??= {};
|
|
100
|
+
profile.content.catalogSupports[key] = parseCatalogSupportPreference(el);
|
|
101
|
+
}
|
|
102
|
+
|
|
66
103
|
const etEl = findChild(contentEl, ['extendedtime', 'extended-time']);
|
|
67
104
|
if (etEl) {
|
|
68
105
|
const active = parseBool(etEl.getAttribute('active') ?? 'true');
|
|
@@ -96,14 +133,19 @@ function extractProfile(root: NhpElement): PnpProfile {
|
|
|
96
133
|
// Helpers
|
|
97
134
|
// ---------------------------------------------------------------------------
|
|
98
135
|
|
|
99
|
-
function findChild(parent: NhpElement, names: string[]): NhpElement | null {
|
|
136
|
+
function findChild(parent: NhpElement, names: readonly string[]): NhpElement | null {
|
|
137
|
+
return findChildren(parent, names)[0] ?? null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function findChildren(parent: NhpElement, names: readonly string[]): NhpElement[] {
|
|
141
|
+
const matches: NhpElement[] = [];
|
|
100
142
|
for (const child of parent.childNodes) {
|
|
101
143
|
if (child.nodeType !== 1) continue; // element nodes only
|
|
102
144
|
const el = child as NhpElement;
|
|
103
145
|
const tag = (el.rawTagName ?? '').toLowerCase();
|
|
104
|
-
if (names.includes(tag))
|
|
146
|
+
if (names.includes(tag)) matches.push(el);
|
|
105
147
|
}
|
|
106
|
-
return
|
|
148
|
+
return matches;
|
|
107
149
|
}
|
|
108
150
|
|
|
109
151
|
function parseBool(value: string): boolean {
|
|
@@ -111,8 +153,63 @@ function parseBool(value: string): boolean {
|
|
|
111
153
|
return v !== 'false' && v !== '0' && v !== 'no';
|
|
112
154
|
}
|
|
113
155
|
|
|
156
|
+
function parseCatalogSupportPreference(el: NhpElement): CatalogSupportPreference {
|
|
157
|
+
const active = parseBool(el.getAttribute('enabled') ?? el.getAttribute('active') ?? el.text ?? 'true');
|
|
158
|
+
const languageCode = normalizeLanguageCode(
|
|
159
|
+
el.getAttribute('languagecode') ?? el.getAttribute('language-code') ?? el.getAttribute('lang') ?? ''
|
|
160
|
+
);
|
|
161
|
+
return languageCode ? { active, languageCode } : active;
|
|
162
|
+
}
|
|
163
|
+
|
|
114
164
|
type ColorScheme = PnpProfile['display'] extends { colorScheme?: infer C } ? Exclude<C, undefined> : never;
|
|
115
|
-
const COLOR_SCHEMES = new Set<string>([
|
|
165
|
+
const COLOR_SCHEMES = new Set<string>([
|
|
166
|
+
'default',
|
|
167
|
+
'defaultreverse',
|
|
168
|
+
'blackwhite',
|
|
169
|
+
'whiteblack',
|
|
170
|
+
'blackrose',
|
|
171
|
+
'roseblack',
|
|
172
|
+
'yellowblue',
|
|
173
|
+
'blueyellow',
|
|
174
|
+
'mgraydgray',
|
|
175
|
+
'dgraymgray',
|
|
176
|
+
'blackcyan',
|
|
177
|
+
'cyanblack',
|
|
178
|
+
'blackcream',
|
|
179
|
+
'creamblack',
|
|
180
|
+
'whitenav',
|
|
181
|
+
'medgray',
|
|
182
|
+
]);
|
|
116
183
|
function isColorScheme(v: string): v is ColorScheme {
|
|
117
184
|
return COLOR_SCHEMES.has(v);
|
|
118
185
|
}
|
|
186
|
+
|
|
187
|
+
function normalizeCatalogUsage(value: string): string | null {
|
|
188
|
+
const usage = value.trim().toLowerCase();
|
|
189
|
+
if (!/^[a-z][a-z0-9._-]*$/.test(usage)) return null;
|
|
190
|
+
return usage;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function normalizeLanguageCode(value: string): string | undefined {
|
|
194
|
+
const languageCode = value.trim();
|
|
195
|
+
if (!languageCode) return undefined;
|
|
196
|
+
if (!/^[a-zA-Z]{2,8}(?:-[a-zA-Z0-9]{1,8})*$/.test(languageCode)) return undefined;
|
|
197
|
+
return languageCode;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function catalogSupportPreferenceKey(usage: string): string {
|
|
201
|
+
switch (usage) {
|
|
202
|
+
case 'tts-pronunciation':
|
|
203
|
+
return 'ttsPronunciation';
|
|
204
|
+
case 'signing-definition':
|
|
205
|
+
return 'signingDefinition';
|
|
206
|
+
case 'braille-text':
|
|
207
|
+
return 'brailleText';
|
|
208
|
+
case 'audio-description':
|
|
209
|
+
return 'audioDescription';
|
|
210
|
+
case 'extended-description':
|
|
211
|
+
return 'extendedDescription';
|
|
212
|
+
default:
|
|
213
|
+
return usage;
|
|
214
|
+
}
|
|
215
|
+
}
|
package/src/pnp/types.ts
CHANGED
|
@@ -8,7 +8,23 @@ export interface PnpProfile {
|
|
|
8
8
|
* Named color scheme. Maps to the data-qti-colorscheme attribute on the player root.
|
|
9
9
|
* 'default' or undefined → attribute removed (browser/host default).
|
|
10
10
|
*/
|
|
11
|
-
colorScheme?:
|
|
11
|
+
colorScheme?:
|
|
12
|
+
| 'default'
|
|
13
|
+
| 'defaultreverse'
|
|
14
|
+
| 'blackwhite'
|
|
15
|
+
| 'whiteblack'
|
|
16
|
+
| 'blackrose'
|
|
17
|
+
| 'roseblack'
|
|
18
|
+
| 'yellowblue'
|
|
19
|
+
| 'blueyellow'
|
|
20
|
+
| 'mgraydgray'
|
|
21
|
+
| 'dgraymgray'
|
|
22
|
+
| 'blackcyan'
|
|
23
|
+
| 'cyanblack'
|
|
24
|
+
| 'blackcream'
|
|
25
|
+
| 'creamblack'
|
|
26
|
+
| 'whitenav'
|
|
27
|
+
| 'medgray';
|
|
12
28
|
/**
|
|
13
29
|
* CSS zoom factor (1.0 = 100%). Deferred — set by browser zoom or host stylesheet.
|
|
14
30
|
* Stored here for forward-compatibility but not yet applied by the player.
|
|
@@ -20,6 +36,10 @@ export interface PnpProfile {
|
|
|
20
36
|
glossaryOnScreen?: boolean;
|
|
21
37
|
/** Show keyword-translation trigger buttons using the given language code. */
|
|
22
38
|
keywordTranslation?: { active: boolean; languageCode: string };
|
|
39
|
+
/** Show illustrated glossary supports when catalog entries provide them. */
|
|
40
|
+
illustratedGlossary?: boolean;
|
|
41
|
+
/** Enable user-initiated host-routed catalog supports. */
|
|
42
|
+
catalogSupports?: CatalogSupportPreferences;
|
|
23
43
|
/**
|
|
24
44
|
* Scale assessment time limits. multiplier: 1.5 means 50% extra time.
|
|
25
45
|
* multiplier: Infinity removes the time limit entirely.
|
|
@@ -31,3 +51,25 @@ export interface PnpProfile {
|
|
|
31
51
|
eliminationTool?: boolean;
|
|
32
52
|
};
|
|
33
53
|
}
|
|
54
|
+
|
|
55
|
+
export interface CatalogSupportPreferences {
|
|
56
|
+
ttsPronunciation?: CatalogSupportPreference;
|
|
57
|
+
signingDefinition?: CatalogSupportPreference;
|
|
58
|
+
brailleText?: CatalogSupportPreference;
|
|
59
|
+
audioDescription?: CatalogSupportPreference;
|
|
60
|
+
extendedDescription?: CatalogSupportPreference;
|
|
61
|
+
/**
|
|
62
|
+
* Host-defined catalog usage names. Use QTI/catalog usage strings such as
|
|
63
|
+
* "custom-audio" rather than DOM event names or implementation-specific APIs.
|
|
64
|
+
*/
|
|
65
|
+
[usage: string]: CatalogSupportPreference | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type CatalogSupportPreference = boolean | CatalogSupportPreferenceOptions;
|
|
69
|
+
|
|
70
|
+
export interface CatalogSupportPreferenceOptions {
|
|
71
|
+
/** Defaults to true when omitted. */
|
|
72
|
+
active?: boolean;
|
|
73
|
+
/** Preferred catalog entry language for this support, such as "en-US" or "es". */
|
|
74
|
+
languageCode?: string;
|
|
75
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type {
|
|
|
7
7
|
Cardinality as ProcessingCardinality,
|
|
8
8
|
QtiValue,
|
|
9
9
|
} from '@pie-qti/qti-processing';
|
|
10
|
+
import type { ResolvedItemDeliveryContext } from '@pie-qti/ims-cp-core';
|
|
11
|
+
import type { ResponseValidationResult } from './responseValidation.js';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* QTI base type identifier
|
|
@@ -78,6 +80,51 @@ export interface ItemSessionState {
|
|
|
78
80
|
[variableId: string]: any;
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
export type ItemLifecycleStatus = 'initial' | 'interacting' | 'suspended' | 'closed' | 'review' | 'solution' | 'answer';
|
|
84
|
+
|
|
85
|
+
export type SerializedVariableKind = 'response' | 'outcome' | 'template' | 'context';
|
|
86
|
+
|
|
87
|
+
export interface SerializedItemSessionVariable {
|
|
88
|
+
identifier: string;
|
|
89
|
+
kind: SerializedVariableKind;
|
|
90
|
+
baseType: VariableBaseType;
|
|
91
|
+
cardinality: VariableCardinality;
|
|
92
|
+
value: any;
|
|
93
|
+
defaultValue?: any;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface SerializedItemSessionState {
|
|
97
|
+
itemIdentifier?: string;
|
|
98
|
+
sessionGuid: string;
|
|
99
|
+
lifecycleStatus: ItemLifecycleStatus;
|
|
100
|
+
completionStatus: CompletionStatus;
|
|
101
|
+
numAttempts: number;
|
|
102
|
+
/**
|
|
103
|
+
* Time-on-task in milliseconds, stored as the QTI built-in duration variable value.
|
|
104
|
+
*/
|
|
105
|
+
duration: number;
|
|
106
|
+
responseVariables: Record<string, SerializedItemSessionVariable>;
|
|
107
|
+
outcomeVariables: Record<string, SerializedItemSessionVariable>;
|
|
108
|
+
templateVariables: Record<string, SerializedItemSessionVariable>;
|
|
109
|
+
contextVariables: Record<string, SerializedItemSessionVariable>;
|
|
110
|
+
validationMessages: ResponseValidationResult['issues'];
|
|
111
|
+
savedAt: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type ItemSessionAction = 'suspendAttempt' | 'endAttempt' | 'scoreAttempt' | 'newTemplate';
|
|
115
|
+
|
|
116
|
+
export interface ItemSessionActionResult {
|
|
117
|
+
action: ItemSessionAction;
|
|
118
|
+
lifecycleStatus: ItemLifecycleStatus;
|
|
119
|
+
completionStatus: CompletionStatus;
|
|
120
|
+
numAttempts: number;
|
|
121
|
+
duration: number;
|
|
122
|
+
completed: boolean;
|
|
123
|
+
sessionState: SerializedItemSessionState;
|
|
124
|
+
validation?: ResponseValidationResult;
|
|
125
|
+
scoring?: ScoringResult;
|
|
126
|
+
}
|
|
127
|
+
|
|
81
128
|
export interface InteractionResponse {
|
|
82
129
|
[responseId: string]: any;
|
|
83
130
|
}
|
|
@@ -190,6 +237,12 @@ export interface PlayerConfig {
|
|
|
190
237
|
* Deferred: external catalog files from IMS manifest (G-15) are not yet supported.
|
|
191
238
|
*/
|
|
192
239
|
catalogXml?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Optional resolved delivery context produced by IMS package/assessment layers.
|
|
242
|
+
* This is additive to catalogXml: shared catalog sources are merged first, then
|
|
243
|
+
* catalogXml, then item-embedded catalog entries so item-local entries win.
|
|
244
|
+
*/
|
|
245
|
+
deliveryContext?: ResolvedItemDeliveryContext;
|
|
193
246
|
sessionState?: ItemSessionState;
|
|
194
247
|
responses?: InteractionResponse;
|
|
195
248
|
role?: QTIRole;
|