@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
package/src/core/ItemRenderer.ts
DELETED
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ItemRenderer - Framework-agnostic rendering engine for QTI items
|
|
3
|
-
*
|
|
4
|
-
* Replaces ItemBody.svelte with vanilla JavaScript. Creates and manages
|
|
5
|
-
* web component instances for QTI interactions, handles response state,
|
|
6
|
-
* and orchestrates the rendering pipeline.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { InteractionData, QTIElement } from '../types/interactions.js';
|
|
10
|
-
import type { QTIChangeEvent } from '../web-components/QTIInteractionElement.js';
|
|
11
|
-
import type { ComponentRegistry } from './ComponentRegistry.js';
|
|
12
|
-
import type { Player } from './Player.js';
|
|
13
|
-
import { htmlToString, toTrustedHtml } from './trustedTypes.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Configuration for ItemRenderer
|
|
17
|
-
*/
|
|
18
|
-
export interface ItemRendererConfig {
|
|
19
|
-
/** Player instance containing the QTI item */
|
|
20
|
-
player: Player;
|
|
21
|
-
|
|
22
|
-
/** DOM container where the item will be rendered */
|
|
23
|
-
container: HTMLElement;
|
|
24
|
-
|
|
25
|
-
/** Current response values keyed by responseId */
|
|
26
|
-
responses?: Record<string, any>;
|
|
27
|
-
|
|
28
|
-
/** Whether the item is in read-only/disabled mode */
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
|
|
31
|
-
/** Optional function to apply math typesetting (e.g., KaTeX, MathJax) */
|
|
32
|
-
typeset?: (element: HTMLElement) => void;
|
|
33
|
-
|
|
34
|
-
/** Callback when a response changes */
|
|
35
|
-
onResponseChange?: (responseId: string, value: any) => void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* ItemRenderer class manages the rendering of QTI items using web components
|
|
40
|
-
*/
|
|
41
|
-
export class ItemRenderer {
|
|
42
|
-
private player: Player;
|
|
43
|
-
private container: HTMLElement;
|
|
44
|
-
private componentRegistry: ComponentRegistry;
|
|
45
|
-
private responses: Record<string, any>;
|
|
46
|
-
private disabled: boolean;
|
|
47
|
-
private typeset?: (element: HTMLElement) => void;
|
|
48
|
-
private onResponseChange: (responseId: string, value: any) => void;
|
|
49
|
-
|
|
50
|
-
// Tracking for cleanup
|
|
51
|
-
private renderedElements: HTMLElement[] = [];
|
|
52
|
-
private eventListeners: Array<{
|
|
53
|
-
element: HTMLElement;
|
|
54
|
-
type: string;
|
|
55
|
-
handler: EventListener;
|
|
56
|
-
}> = [];
|
|
57
|
-
|
|
58
|
-
// State for AssociateInteraction (pairing selection)
|
|
59
|
-
private selectedForPairing: string | null = null;
|
|
60
|
-
|
|
61
|
-
constructor(config: ItemRendererConfig) {
|
|
62
|
-
this.player = config.player;
|
|
63
|
-
this.container = config.container;
|
|
64
|
-
this.componentRegistry = this.player.getComponentRegistry();
|
|
65
|
-
this.responses = config.responses || {};
|
|
66
|
-
this.disabled = config.disabled || false;
|
|
67
|
-
this.typeset = config.typeset;
|
|
68
|
-
this.onResponseChange = config.onResponseChange || (() => {});
|
|
69
|
-
|
|
70
|
-
// Initial render
|
|
71
|
-
this.render();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Render the entire item with all interactions
|
|
76
|
-
*/
|
|
77
|
-
public render(): void {
|
|
78
|
-
// Clean up previous render
|
|
79
|
-
this.cleanup();
|
|
80
|
-
|
|
81
|
-
// Create wrapper
|
|
82
|
-
const wrapper = document.createElement('div');
|
|
83
|
-
wrapper.className = 'qti-item-body';
|
|
84
|
-
|
|
85
|
-
// Get and process interactions using the player's configured ExtractionRegistry
|
|
86
|
-
const interactions: InteractionData[] = this.player.getInteractionData();
|
|
87
|
-
|
|
88
|
-
// Filter block vs inline interactions
|
|
89
|
-
const blockInteractions = interactions.filter(
|
|
90
|
-
(i) =>
|
|
91
|
-
i.type !== 'textEntryInteraction' && i.type !== 'inlineChoiceInteraction'
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
// Get item body HTML with interactions removed
|
|
95
|
-
const itemBodyHtml = this.getProcessedItemBodyHtml();
|
|
96
|
-
|
|
97
|
-
// Create prose container for body HTML
|
|
98
|
-
const proseContainer = document.createElement('div');
|
|
99
|
-
proseContainer.className = 'prose max-w-none mb-4';
|
|
100
|
-
|
|
101
|
-
// Process inline interactions in HTML
|
|
102
|
-
const processedHtml = this.processInlineInteractions(
|
|
103
|
-
itemBodyHtml,
|
|
104
|
-
interactions
|
|
105
|
-
);
|
|
106
|
-
proseContainer.innerHTML = toTrustedHtml(processedHtml, this.player.getTrustedTypesPolicyName()) as any;
|
|
107
|
-
|
|
108
|
-
wrapper.appendChild(proseContainer);
|
|
109
|
-
|
|
110
|
-
// Render block interactions as web components
|
|
111
|
-
for (const interaction of blockInteractions) {
|
|
112
|
-
try {
|
|
113
|
-
const element = this.createInteractionElement(interaction);
|
|
114
|
-
if (element) {
|
|
115
|
-
wrapper.appendChild(element);
|
|
116
|
-
this.renderedElements.push(element);
|
|
117
|
-
}
|
|
118
|
-
} catch (error) {
|
|
119
|
-
console.error(
|
|
120
|
-
`Failed to create component for ${interaction.type}:`,
|
|
121
|
-
error
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Apply typesetting to the entire wrapper
|
|
127
|
-
if (this.typeset) {
|
|
128
|
-
try {
|
|
129
|
-
this.typeset(wrapper);
|
|
130
|
-
} catch (error) {
|
|
131
|
-
console.error('Typesetting failed:', error);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Mount to container
|
|
136
|
-
this.container.innerHTML = '';
|
|
137
|
-
this.container.appendChild(wrapper);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Get item body HTML with block interactions removed
|
|
142
|
-
*/
|
|
143
|
-
private getProcessedItemBodyHtml(): string {
|
|
144
|
-
let html = htmlToString(this.player.getItemBodyHtml());
|
|
145
|
-
|
|
146
|
-
// Remove block interaction elements (they're rendered separately as web components)
|
|
147
|
-
const interactionPatterns = [
|
|
148
|
-
/<choiceInteraction[\s\S]*?<\/choiceInteraction>/gi,
|
|
149
|
-
/<extendedTextInteraction[\s\S]*?<\/extendedTextInteraction>/gi,
|
|
150
|
-
/<orderInteraction[\s\S]*?<\/orderInteraction>/gi,
|
|
151
|
-
/<matchInteraction[\s\S]*?<\/matchInteraction>/gi,
|
|
152
|
-
/<associateInteraction[\s\S]*?<\/associateInteraction>/gi,
|
|
153
|
-
/<gapMatchInteraction[\s\S]*?<\/gapMatchInteraction>/gi,
|
|
154
|
-
/<sliderInteraction[\s\S]*?<\/sliderInteraction>/gi,
|
|
155
|
-
/<hotspotInteraction[\s\S]*?<\/hotspotInteraction>/gi,
|
|
156
|
-
/<graphicGapMatchInteraction[\s\S]*?<\/graphicGapMatchInteraction>/gi,
|
|
157
|
-
/<graphicOrderInteraction[\s\S]*?<\/graphicOrderInteraction>/gi,
|
|
158
|
-
/<graphicAssociateInteraction[\s\S]*?<\/graphicAssociateInteraction>/gi,
|
|
159
|
-
/<positionObjectInteraction[\s\S]*?<\/positionObjectInteraction>/gi,
|
|
160
|
-
/<endAttemptInteraction[\s\S]*?<\/endAttemptInteraction>/gi,
|
|
161
|
-
/<uploadInteraction[\s\S]*?<\/uploadInteraction>/gi,
|
|
162
|
-
/<drawingInteraction[\s\S]*?<\/drawingInteraction>/gi,
|
|
163
|
-
/<mediaInteraction[\s\S]*?<\/mediaInteraction>/gi,
|
|
164
|
-
/<hottextInteraction[\s\S]*?<\/hottextInteraction>/gi,
|
|
165
|
-
/<selectPointInteraction[\s\S]*?<\/selectPointInteraction>/gi,
|
|
166
|
-
/<customInteraction[\s\S]*?<\/customInteraction>/gi,
|
|
167
|
-
];
|
|
168
|
-
|
|
169
|
-
for (const pattern of interactionPatterns) {
|
|
170
|
-
html = html.replace(pattern, '');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return html;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Process inline interactions (textEntry, inlineChoice)
|
|
178
|
-
* Replaces QTI XML tags with web component placeholders
|
|
179
|
-
*/
|
|
180
|
-
private processInlineInteractions(
|
|
181
|
-
html: string,
|
|
182
|
-
interactions: InteractionData[]
|
|
183
|
-
): string {
|
|
184
|
-
// Replace textEntry with placeholder
|
|
185
|
-
html = html.replace(
|
|
186
|
-
/<textEntryInteraction[^>]*responseIdentifier="([^"]+)"[^>]*?(?:\/>|><\/textEntryInteraction>)/gi,
|
|
187
|
-
(match, responseId) => {
|
|
188
|
-
const interaction = interactions.find(
|
|
189
|
-
(i) => i.responseId === responseId && i.type === 'textEntryInteraction'
|
|
190
|
-
);
|
|
191
|
-
if (interaction) {
|
|
192
|
-
return `<span data-inline-interaction="${responseId}" data-type="textEntry"></span>`;
|
|
193
|
-
}
|
|
194
|
-
return match;
|
|
195
|
-
}
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
// Replace inlineChoice with placeholder
|
|
199
|
-
html = html.replace(
|
|
200
|
-
/<inlineChoiceInteraction[^>]*responseIdentifier="([^"]+)"[^>]*>[\s\S]*?<\/inlineChoiceInteraction>/gi,
|
|
201
|
-
(match, responseId) => {
|
|
202
|
-
const interaction = interactions.find(
|
|
203
|
-
(i) => i.responseId === responseId && i.type === 'inlineChoiceInteraction'
|
|
204
|
-
);
|
|
205
|
-
if (interaction) {
|
|
206
|
-
return `<span data-inline-interaction="${responseId}" data-type="inlineChoice"></span>`;
|
|
207
|
-
}
|
|
208
|
-
return match;
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
return html;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Create a web component element for an interaction
|
|
217
|
-
*/
|
|
218
|
-
private createInteractionElement(
|
|
219
|
-
interaction: InteractionData
|
|
220
|
-
): HTMLElement | null {
|
|
221
|
-
try {
|
|
222
|
-
// Get tag name from registry
|
|
223
|
-
const tagName = this.componentRegistry.getTagName(interaction);
|
|
224
|
-
|
|
225
|
-
// Create element
|
|
226
|
-
const element = document.createElement(tagName) as any;
|
|
227
|
-
|
|
228
|
-
// Set standard properties
|
|
229
|
-
element.interaction = interaction;
|
|
230
|
-
element.response = this.responses[interaction.responseId] ?? null;
|
|
231
|
-
element.disabled = this.disabled;
|
|
232
|
-
element.typeset = this.typeset;
|
|
233
|
-
|
|
234
|
-
// Special handling for AssociateInteraction (pairing selection)
|
|
235
|
-
if (interaction.type === 'associateInteraction') {
|
|
236
|
-
element.selectedForPairing = this.selectedForPairing;
|
|
237
|
-
|
|
238
|
-
// Listen for selection changes
|
|
239
|
-
const selectionHandler = (event: Event) => {
|
|
240
|
-
const customEvent = event as CustomEvent<{ selected: string | null }>;
|
|
241
|
-
this.selectedForPairing = customEvent.detail.selected;
|
|
242
|
-
element.selectedForPairing = this.selectedForPairing;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
element.addEventListener('qti-selection-change', selectionHandler);
|
|
246
|
-
this.eventListeners.push({
|
|
247
|
-
element,
|
|
248
|
-
type: 'qti-selection-change',
|
|
249
|
-
handler: selectionHandler,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Listen for response changes
|
|
254
|
-
const changeHandler = (event: Event) => {
|
|
255
|
-
const qtiEvent = event as QTIChangeEvent;
|
|
256
|
-
this.handleResponseChange(
|
|
257
|
-
qtiEvent.detail.responseId,
|
|
258
|
-
qtiEvent.detail.value
|
|
259
|
-
);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
element.addEventListener('qti-change', changeHandler);
|
|
263
|
-
this.eventListeners.push({
|
|
264
|
-
element,
|
|
265
|
-
type: 'qti-change',
|
|
266
|
-
handler: changeHandler,
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
return element;
|
|
270
|
-
} catch (error) {
|
|
271
|
-
console.error(`Failed to create element for ${interaction.type}:`, error);
|
|
272
|
-
return null;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Handle response change from an interaction
|
|
278
|
-
*/
|
|
279
|
-
private handleResponseChange(responseId: string, value: any): void {
|
|
280
|
-
// Update internal state
|
|
281
|
-
this.responses[responseId] = value;
|
|
282
|
-
|
|
283
|
-
// Notify callback
|
|
284
|
-
this.onResponseChange(responseId, value);
|
|
285
|
-
|
|
286
|
-
// Update any other elements that depend on this response
|
|
287
|
-
this.updateInteractionElement(responseId, value);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Update a specific interaction element's response value
|
|
292
|
-
*/
|
|
293
|
-
private updateInteractionElement(responseId: string, value: any): void {
|
|
294
|
-
for (const element of this.renderedElements) {
|
|
295
|
-
const interaction = (element as any).interaction;
|
|
296
|
-
if (interaction && interaction.responseId === responseId) {
|
|
297
|
-
(element as any).response = value;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Update all responses at once
|
|
304
|
-
*/
|
|
305
|
-
public setResponses(responses: Record<string, any>): void {
|
|
306
|
-
this.responses = { ...responses };
|
|
307
|
-
|
|
308
|
-
// Update all rendered elements
|
|
309
|
-
for (const element of this.renderedElements) {
|
|
310
|
-
const interaction = (element as any).interaction;
|
|
311
|
-
if (interaction) {
|
|
312
|
-
(element as any).response = this.responses[interaction.responseId] ?? null;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Set disabled state for all interactions
|
|
319
|
-
*/
|
|
320
|
-
public setDisabled(disabled: boolean): void {
|
|
321
|
-
this.disabled = disabled;
|
|
322
|
-
|
|
323
|
-
// Update all rendered elements
|
|
324
|
-
for (const element of this.renderedElements) {
|
|
325
|
-
(element as any).disabled = disabled;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Get current responses
|
|
331
|
-
*/
|
|
332
|
-
public getResponses(): Record<string, any> {
|
|
333
|
-
return { ...this.responses };
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Clean up event listeners and elements
|
|
338
|
-
*/
|
|
339
|
-
private cleanup(): void {
|
|
340
|
-
// Remove event listeners
|
|
341
|
-
for (const { element, type, handler } of this.eventListeners) {
|
|
342
|
-
element.removeEventListener(type, handler);
|
|
343
|
-
}
|
|
344
|
-
this.eventListeners = [];
|
|
345
|
-
|
|
346
|
-
// Clear rendered elements
|
|
347
|
-
this.renderedElements = [];
|
|
348
|
-
|
|
349
|
-
// Reset pairing selection
|
|
350
|
-
this.selectedForPairing = null;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Destroy the renderer and clean up all resources
|
|
355
|
-
*/
|
|
356
|
-
public destroy(): void {
|
|
357
|
-
this.cleanup();
|
|
358
|
-
this.container.innerHTML = '';
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Create a new ItemRenderer instance
|
|
364
|
-
*/
|
|
365
|
-
export function createItemRenderer(config: ItemRendererConfig): ItemRenderer {
|
|
366
|
-
return new ItemRenderer(config);
|
|
367
|
-
}
|