@pie-qti/item-player 0.1.9 → 0.1.11
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 +17 -0
- package/dist/catalog/applyGlossaryTriggers.d.ts +13 -3
- package/dist/catalog/applyGlossaryTriggers.js +1 -0
- package/dist/catalog/applyGlossaryTriggers.js.map +1 -0
- package/dist/catalog/catalogExtractor.d.ts +0 -1
- package/dist/catalog/catalogExtractor.js +1 -0
- package/dist/catalog/catalogExtractor.js.map +1 -0
- package/dist/catalog/catalogLookup.d.ts +0 -1
- package/dist/catalog/catalogLookup.js +1 -0
- package/dist/catalog/catalogLookup.js.map +1 -0
- package/dist/catalog/glossaryAction.d.ts +4 -3
- package/dist/catalog/glossaryAction.js +1 -0
- package/dist/catalog/glossaryAction.js.map +1 -0
- package/dist/catalog/types.d.ts +0 -1
- package/dist/catalog/types.js +1 -0
- package/dist/catalog/types.js.map +1 -0
- package/dist/components/actions/typesetAction.d.ts +0 -1
- package/dist/components/actions/typesetAction.js +1 -0
- package/dist/components/actions/typesetAction.js.map +1 -0
- package/dist/components/utils/feedbackUtils.d.ts +0 -1
- package/dist/components/utils/feedbackUtils.js +1 -0
- package/dist/components/utils/feedbackUtils.js.map +1 -0
- package/dist/components/utils/index.d.ts +1 -3
- package/dist/components/utils/index.js +2 -2
- package/dist/components/utils/index.js.map +1 -0
- package/dist/components/utils/stimulusRender.d.ts +0 -1
- package/dist/components/utils/stimulusRender.js +1 -0
- package/dist/components/utils/stimulusRender.js.map +1 -0
- package/dist/components/utils/stylesheetRender.d.ts +0 -1
- package/dist/components/utils/stylesheetRender.js +1 -0
- package/dist/components/utils/stylesheetRender.js.map +1 -0
- package/dist/core/ComponentRegistry.d.ts +10 -2
- package/dist/core/ComponentRegistry.js +43 -1
- package/dist/core/ComponentRegistry.js.map +1 -0
- package/dist/core/Player.d.ts +10 -3
- package/dist/core/Player.js +55 -46
- package/dist/core/Player.js.map +1 -0
- package/dist/core/Plugin.d.ts +0 -1
- package/dist/core/Plugin.js +1 -0
- package/dist/core/Plugin.js.map +1 -0
- package/dist/core/PluginManager.d.ts +0 -1
- package/dist/core/PluginManager.js +1 -0
- package/dist/core/PluginManager.js.map +1 -0
- package/dist/core/constants.d.ts +0 -1
- package/dist/core/constants.js +1 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/declarations.d.ts +0 -1
- package/dist/core/declarations.js +1 -0
- package/dist/core/declarations.js.map +1 -0
- package/dist/core/parsingLimits.d.ts +0 -1
- package/dist/core/parsingLimits.js +1 -0
- package/dist/core/parsingLimits.js.map +1 -0
- package/dist/core/random.d.ts +0 -1
- package/dist/core/random.js +1 -0
- package/dist/core/random.js.map +1 -0
- package/dist/core/rolePolicy.d.ts +0 -1
- package/dist/core/rolePolicy.js +1 -0
- package/dist/core/rolePolicy.js.map +1 -0
- package/dist/core/sanitizer.d.ts +0 -1
- package/dist/core/sanitizer.js +1 -0
- package/dist/core/sanitizer.js.map +1 -0
- package/dist/core/trustedTypes.d.ts +0 -1
- package/dist/core/trustedTypes.js +1 -0
- package/dist/core/trustedTypes.js.map +1 -0
- package/dist/core/urlPolicy.d.ts +0 -1
- package/dist/core/urlPolicy.js +1 -0
- package/dist/core/urlPolicy.js.map +1 -0
- package/dist/document/AssessmentItemDocument.d.ts +1 -2
- package/dist/document/AssessmentItemDocument.js +1 -0
- package/dist/document/AssessmentItemDocument.js.map +1 -0
- package/dist/element.d.ts +15 -0
- package/dist/element.js +1816 -1625
- package/dist/element.js.map +1 -1
- package/dist/extensions/MathLiveEditor.d.ts +0 -1
- package/dist/extensions/MathLiveEditor.js +1 -0
- package/dist/extensions/MathLiveEditor.js.map +1 -0
- package/dist/extraction/ExtractionRegistry.d.ts +1 -2
- package/dist/extraction/ExtractionRegistry.js +1 -0
- package/dist/extraction/ExtractionRegistry.js.map +1 -0
- package/dist/extraction/createContext.d.ts +1 -2
- package/dist/extraction/createContext.js +1 -0
- package/dist/extraction/createContext.js.map +1 -0
- package/dist/extraction/index.d.ts +2 -3
- package/dist/extraction/index.js +2 -1
- package/dist/extraction/index.js.map +1 -0
- package/dist/extraction/interactionExtractionPipeline.d.ts +1 -2
- package/dist/extraction/interactionExtractionPipeline.js +1 -0
- package/dist/extraction/interactionExtractionPipeline.js.map +1 -0
- package/dist/extraction/interactionSecurity.d.ts +1 -2
- package/dist/extraction/interactionSecurity.js +1 -0
- package/dist/extraction/interactionSecurity.js.map +1 -0
- package/dist/extraction/types.d.ts +1 -2
- package/dist/extraction/types.js +1 -0
- package/dist/extraction/types.js.map +1 -0
- package/dist/extraction/utils.d.ts +0 -1
- package/dist/extraction/utils.js +1 -0
- package/dist/extraction/utils.js.map +1 -0
- package/dist/iframe/IFramePlayerHost.d.ts +0 -1
- package/dist/iframe/IFramePlayerHost.js +1 -0
- package/dist/iframe/IFramePlayerHost.js.map +1 -0
- package/dist/iframe/index.d.ts +0 -1
- package/dist/iframe/index.js +1 -0
- package/dist/iframe/index.js.map +1 -0
- package/dist/iframe/protocol.d.ts +0 -1
- package/dist/iframe/protocol.js +1 -0
- package/dist/iframe/protocol.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/interactions/associate/extractor.d.ts +0 -1
- package/dist/interactions/associate/extractor.js +1 -0
- package/dist/interactions/associate/extractor.js.map +1 -0
- package/dist/interactions/associate/index.d.ts +0 -1
- package/dist/interactions/associate/index.js +1 -0
- package/dist/interactions/associate/index.js.map +1 -0
- package/dist/interactions/associate/types.d.ts +0 -1
- package/dist/interactions/associate/types.js +1 -0
- package/dist/interactions/associate/types.js.map +1 -0
- package/dist/interactions/choice/extractor.d.ts +0 -1
- package/dist/interactions/choice/extractor.js +1 -0
- package/dist/interactions/choice/extractor.js.map +1 -0
- package/dist/interactions/choice/index.d.ts +0 -1
- package/dist/interactions/choice/index.js +1 -0
- package/dist/interactions/choice/index.js.map +1 -0
- package/dist/interactions/choice/types.d.ts +0 -1
- package/dist/interactions/choice/types.js +1 -0
- package/dist/interactions/choice/types.js.map +1 -0
- package/dist/interactions/custom/extractor.d.ts +0 -1
- package/dist/interactions/custom/extractor.js +1 -0
- package/dist/interactions/custom/extractor.js.map +1 -0
- package/dist/interactions/custom/index.d.ts +0 -1
- package/dist/interactions/custom/index.js +1 -0
- package/dist/interactions/custom/index.js.map +1 -0
- package/dist/interactions/custom/types.d.ts +0 -1
- package/dist/interactions/custom/types.js +1 -0
- package/dist/interactions/custom/types.js.map +1 -0
- package/dist/interactions/drawing/extractor.d.ts +0 -1
- package/dist/interactions/drawing/extractor.js +1 -0
- package/dist/interactions/drawing/extractor.js.map +1 -0
- package/dist/interactions/drawing/index.d.ts +0 -1
- package/dist/interactions/drawing/index.js +1 -0
- package/dist/interactions/drawing/index.js.map +1 -0
- package/dist/interactions/drawing/types.d.ts +0 -1
- package/dist/interactions/drawing/types.js +1 -0
- package/dist/interactions/drawing/types.js.map +1 -0
- package/dist/interactions/end-attempt/extractor.d.ts +0 -1
- package/dist/interactions/end-attempt/extractor.js +1 -0
- package/dist/interactions/end-attempt/extractor.js.map +1 -0
- package/dist/interactions/end-attempt/index.d.ts +0 -1
- package/dist/interactions/end-attempt/index.js +1 -0
- package/dist/interactions/end-attempt/index.js.map +1 -0
- package/dist/interactions/end-attempt/types.d.ts +0 -1
- package/dist/interactions/end-attempt/types.js +1 -0
- package/dist/interactions/end-attempt/types.js.map +1 -0
- package/dist/interactions/extended-text/extractor.d.ts +0 -1
- package/dist/interactions/extended-text/extractor.js +1 -0
- package/dist/interactions/extended-text/extractor.js.map +1 -0
- package/dist/interactions/extended-text/index.d.ts +0 -1
- package/dist/interactions/extended-text/index.js +1 -0
- package/dist/interactions/extended-text/index.js.map +1 -0
- package/dist/interactions/extended-text/types.d.ts +0 -1
- package/dist/interactions/extended-text/types.js +1 -0
- package/dist/interactions/extended-text/types.js.map +1 -0
- package/dist/interactions/gap-match/extractor.d.ts +0 -1
- package/dist/interactions/gap-match/extractor.js +1 -0
- package/dist/interactions/gap-match/extractor.js.map +1 -0
- package/dist/interactions/gap-match/index.d.ts +0 -1
- package/dist/interactions/gap-match/index.js +1 -0
- package/dist/interactions/gap-match/index.js.map +1 -0
- package/dist/interactions/gap-match/types.d.ts +0 -1
- package/dist/interactions/gap-match/types.js +1 -0
- package/dist/interactions/gap-match/types.js.map +1 -0
- package/dist/interactions/graphic-associate/extractor.d.ts +0 -1
- package/dist/interactions/graphic-associate/extractor.js +1 -0
- package/dist/interactions/graphic-associate/extractor.js.map +1 -0
- package/dist/interactions/graphic-associate/index.d.ts +0 -1
- package/dist/interactions/graphic-associate/index.js +1 -0
- package/dist/interactions/graphic-associate/index.js.map +1 -0
- package/dist/interactions/graphic-associate/types.d.ts +0 -1
- package/dist/interactions/graphic-associate/types.js +1 -0
- package/dist/interactions/graphic-associate/types.js.map +1 -0
- package/dist/interactions/graphic-gap-match/extractor.d.ts +0 -1
- package/dist/interactions/graphic-gap-match/extractor.js +1 -0
- package/dist/interactions/graphic-gap-match/extractor.js.map +1 -0
- package/dist/interactions/graphic-gap-match/index.d.ts +0 -1
- package/dist/interactions/graphic-gap-match/index.js +1 -0
- package/dist/interactions/graphic-gap-match/index.js.map +1 -0
- package/dist/interactions/graphic-gap-match/types.d.ts +0 -1
- package/dist/interactions/graphic-gap-match/types.js +1 -0
- package/dist/interactions/graphic-gap-match/types.js.map +1 -0
- package/dist/interactions/graphic-order/extractor.d.ts +0 -1
- package/dist/interactions/graphic-order/extractor.js +1 -0
- package/dist/interactions/graphic-order/extractor.js.map +1 -0
- package/dist/interactions/graphic-order/index.d.ts +0 -1
- package/dist/interactions/graphic-order/index.js +1 -0
- package/dist/interactions/graphic-order/index.js.map +1 -0
- package/dist/interactions/graphic-order/types.d.ts +0 -1
- package/dist/interactions/graphic-order/types.js +1 -0
- package/dist/interactions/graphic-order/types.js.map +1 -0
- package/dist/interactions/hotspot/extractor.d.ts +0 -1
- package/dist/interactions/hotspot/extractor.js +1 -0
- package/dist/interactions/hotspot/extractor.js.map +1 -0
- package/dist/interactions/hotspot/index.d.ts +0 -1
- package/dist/interactions/hotspot/index.js +1 -0
- package/dist/interactions/hotspot/index.js.map +1 -0
- package/dist/interactions/hotspot/types.d.ts +0 -1
- package/dist/interactions/hotspot/types.js +1 -0
- package/dist/interactions/hotspot/types.js.map +1 -0
- package/dist/interactions/hottext/extractor.d.ts +0 -1
- package/dist/interactions/hottext/extractor.js +1 -0
- package/dist/interactions/hottext/extractor.js.map +1 -0
- package/dist/interactions/hottext/index.d.ts +0 -1
- package/dist/interactions/hottext/index.js +1 -0
- package/dist/interactions/hottext/index.js.map +1 -0
- package/dist/interactions/hottext/types.d.ts +0 -1
- package/dist/interactions/hottext/types.js +1 -0
- package/dist/interactions/hottext/types.js.map +1 -0
- package/dist/interactions/index.d.ts +0 -1
- package/dist/interactions/index.js +1 -0
- package/dist/interactions/index.js.map +1 -0
- package/dist/interactions/inline/index.d.ts +0 -1
- package/dist/interactions/inline/index.js +1 -0
- package/dist/interactions/inline/index.js.map +1 -0
- package/dist/interactions/inline/render-plan.d.ts +0 -1
- package/dist/interactions/inline/render-plan.js +1 -0
- package/dist/interactions/inline/render-plan.js.map +1 -0
- package/dist/interactions/inline-choice/extractor.d.ts +0 -1
- package/dist/interactions/inline-choice/extractor.js +1 -0
- package/dist/interactions/inline-choice/extractor.js.map +1 -0
- package/dist/interactions/inline-choice/index.d.ts +0 -1
- package/dist/interactions/inline-choice/index.js +1 -0
- package/dist/interactions/inline-choice/index.js.map +1 -0
- package/dist/interactions/inline-choice/types.d.ts +0 -1
- package/dist/interactions/inline-choice/types.js +1 -0
- package/dist/interactions/inline-choice/types.js.map +1 -0
- package/dist/interactions/match/extractor.d.ts +0 -1
- package/dist/interactions/match/extractor.js +1 -0
- package/dist/interactions/match/extractor.js.map +1 -0
- package/dist/interactions/match/index.d.ts +0 -1
- package/dist/interactions/match/index.js +1 -0
- package/dist/interactions/match/index.js.map +1 -0
- package/dist/interactions/match/types.d.ts +0 -1
- package/dist/interactions/match/types.js +1 -0
- package/dist/interactions/match/types.js.map +1 -0
- package/dist/interactions/media/extractor.d.ts +0 -1
- package/dist/interactions/media/extractor.js +1 -0
- package/dist/interactions/media/extractor.js.map +1 -0
- package/dist/interactions/media/index.d.ts +0 -1
- package/dist/interactions/media/index.js +1 -0
- package/dist/interactions/media/index.js.map +1 -0
- package/dist/interactions/media/types.d.ts +0 -1
- package/dist/interactions/media/types.js +1 -0
- package/dist/interactions/media/types.js.map +1 -0
- package/dist/interactions/modules.d.ts +0 -1
- package/dist/interactions/modules.js +1 -0
- package/dist/interactions/modules.js.map +1 -0
- package/dist/interactions/order/extractor.d.ts +0 -1
- package/dist/interactions/order/extractor.js +1 -0
- package/dist/interactions/order/extractor.js.map +1 -0
- package/dist/interactions/order/index.d.ts +0 -1
- package/dist/interactions/order/index.js +1 -0
- package/dist/interactions/order/index.js.map +1 -0
- package/dist/interactions/order/types.d.ts +0 -1
- package/dist/interactions/order/types.js +1 -0
- package/dist/interactions/order/types.js.map +1 -0
- package/dist/interactions/portable-custom/extractor.d.ts +0 -1
- package/dist/interactions/portable-custom/extractor.js +1 -0
- package/dist/interactions/portable-custom/extractor.js.map +1 -0
- package/dist/interactions/portable-custom/index.d.ts +0 -1
- package/dist/interactions/portable-custom/index.js +1 -0
- package/dist/interactions/portable-custom/index.js.map +1 -0
- package/dist/interactions/portable-custom/types.d.ts +0 -1
- package/dist/interactions/portable-custom/types.js +1 -0
- package/dist/interactions/portable-custom/types.js.map +1 -0
- package/dist/interactions/position-object/extractor.d.ts +0 -1
- package/dist/interactions/position-object/extractor.js +1 -0
- package/dist/interactions/position-object/extractor.js.map +1 -0
- package/dist/interactions/position-object/index.d.ts +0 -1
- package/dist/interactions/position-object/index.js +1 -0
- package/dist/interactions/position-object/index.js.map +1 -0
- package/dist/interactions/position-object/types.d.ts +0 -1
- package/dist/interactions/position-object/types.js +1 -0
- package/dist/interactions/position-object/types.js.map +1 -0
- package/dist/interactions/select-point/extractor.d.ts +0 -1
- package/dist/interactions/select-point/extractor.js +1 -0
- package/dist/interactions/select-point/extractor.js.map +1 -0
- package/dist/interactions/select-point/index.d.ts +0 -1
- package/dist/interactions/select-point/index.js +1 -0
- package/dist/interactions/select-point/index.js.map +1 -0
- package/dist/interactions/select-point/types.d.ts +0 -1
- package/dist/interactions/select-point/types.js +1 -0
- package/dist/interactions/select-point/types.js.map +1 -0
- package/dist/interactions/shared/index.d.ts +0 -1
- package/dist/interactions/shared/index.js +1 -0
- package/dist/interactions/shared/index.js.map +1 -0
- package/dist/interactions/shared/types.d.ts +0 -1
- package/dist/interactions/shared/types.js +1 -0
- package/dist/interactions/shared/types.js.map +1 -0
- package/dist/interactions/slider/extractor.d.ts +0 -1
- package/dist/interactions/slider/extractor.js +1 -0
- package/dist/interactions/slider/extractor.js.map +1 -0
- package/dist/interactions/slider/index.d.ts +0 -1
- package/dist/interactions/slider/index.js +1 -0
- package/dist/interactions/slider/index.js.map +1 -0
- package/dist/interactions/slider/types.d.ts +0 -1
- package/dist/interactions/slider/types.js +1 -0
- package/dist/interactions/slider/types.js.map +1 -0
- package/dist/interactions/text-entry/extractor.d.ts +0 -1
- package/dist/interactions/text-entry/extractor.js +1 -0
- package/dist/interactions/text-entry/extractor.js.map +1 -0
- package/dist/interactions/text-entry/index.d.ts +0 -1
- package/dist/interactions/text-entry/index.js +1 -0
- package/dist/interactions/text-entry/index.js.map +1 -0
- package/dist/interactions/text-entry/types.d.ts +0 -1
- package/dist/interactions/text-entry/types.js +1 -0
- package/dist/interactions/text-entry/types.js.map +1 -0
- package/dist/interactions/upload/extractor.d.ts +0 -1
- package/dist/interactions/upload/extractor.js +1 -0
- package/dist/interactions/upload/extractor.js.map +1 -0
- package/dist/interactions/upload/index.d.ts +0 -1
- package/dist/interactions/upload/index.js +1 -0
- package/dist/interactions/upload/index.js.map +1 -0
- package/dist/interactions/upload/types.d.ts +0 -1
- package/dist/interactions/upload/types.js +1 -0
- package/dist/interactions/upload/types.js.map +1 -0
- package/dist/pci/PciHost.d.ts +0 -1
- package/dist/pci/PciHost.js +1 -0
- package/dist/pci/PciHost.js.map +1 -0
- package/dist/pci/types.d.ts +0 -1
- package/dist/pci/types.js +1 -0
- package/dist/pci/types.js.map +1 -0
- package/dist/pnp/applyPnp.d.ts +0 -1
- package/dist/pnp/applyPnp.js +1 -0
- package/dist/pnp/applyPnp.js.map +1 -0
- package/dist/pnp/parsePnpXml.d.ts +0 -1
- package/dist/pnp/parsePnpXml.js +1 -0
- package/dist/pnp/parsePnpXml.js.map +1 -0
- package/dist/pnp/types.d.ts +0 -1
- package/dist/pnp/types.js +1 -0
- package/dist/pnp/types.js.map +1 -0
- package/dist/presentation/itemPresentationPlan.d.ts +53 -0
- package/dist/presentation/itemPresentationPlan.js +98 -0
- package/dist/presentation/itemPresentationPlan.js.map +1 -0
- package/dist/server.d.ts +0 -1
- package/dist/server.js +1 -0
- package/dist/server.js.map +1 -0
- package/dist/types/index.d.ts +17 -3
- package/dist/types/index.js +1 -3
- package/dist/types/index.js.map +1 -0
- package/dist/types/responseValidation.d.ts +0 -1
- package/dist/types/responseValidation.js +1 -0
- package/dist/types/responseValidation.js.map +1 -0
- package/dist/utils/PerformanceMonitor.d.ts +0 -1
- package/dist/utils/PerformanceMonitor.js +1 -0
- package/dist/utils/PerformanceMonitor.js.map +1 -0
- package/dist/utils/drawingUtils.d.ts +0 -1
- package/dist/utils/drawingUtils.js +1 -0
- package/dist/utils/drawingUtils.js.map +1 -0
- package/dist/utils/responseUtils.d.ts +0 -1
- package/dist/utils/responseUtils.js +1 -0
- package/dist/utils/responseUtils.js.map +1 -0
- package/dist/web-components/QTIInteractionBase.d.ts +1 -2
- package/dist/web-components/QTIInteractionBase.js +1 -0
- package/dist/web-components/QTIInteractionBase.js.map +1 -0
- package/dist/web-components/QTIInteractionElement.d.ts +1 -2
- package/dist/web-components/QTIInteractionElement.js +1 -0
- package/dist/web-components/QTIInteractionElement.js.map +1 -0
- package/dist/web-components/index.d.ts +0 -1
- package/dist/web-components/index.js +1 -0
- package/dist/web-components/index.js.map +1 -0
- package/package.json +7 -14
- package/dist/catalog/applyGlossaryTriggers.d.ts.map +0 -1
- package/dist/catalog/catalogExtractor.d.ts.map +0 -1
- package/dist/catalog/catalogLookup.d.ts.map +0 -1
- package/dist/catalog/glossaryAction.d.ts.map +0 -1
- package/dist/catalog/types.d.ts.map +0 -1
- package/dist/components/actions/typesetAction.d.ts.map +0 -1
- package/dist/components/utils/assignProps.d.ts +0 -2
- package/dist/components/utils/assignProps.d.ts.map +0 -1
- package/dist/components/utils/assignProps.js +0 -1
- package/dist/components/utils/feedbackUtils.d.ts.map +0 -1
- package/dist/components/utils/index.d.ts.map +0 -1
- package/dist/components/utils/stimulusRender.d.ts.map +0 -1
- package/dist/components/utils/stylesheetRender.d.ts.map +0 -1
- package/dist/core/ComponentRegistry.d.ts.map +0 -1
- package/dist/core/ItemRenderer.d.ts +0 -91
- package/dist/core/ItemRenderer.d.ts.map +0 -1
- package/dist/core/ItemRenderer.js +0 -248
- package/dist/core/Player.d.ts.map +0 -1
- package/dist/core/Plugin.d.ts.map +0 -1
- package/dist/core/PluginManager.d.ts.map +0 -1
- package/dist/core/constants.d.ts.map +0 -1
- package/dist/core/declarations.d.ts.map +0 -1
- package/dist/core/parsingLimits.d.ts.map +0 -1
- package/dist/core/random.d.ts.map +0 -1
- package/dist/core/rolePolicy.d.ts.map +0 -1
- package/dist/core/sanitizer.d.ts.map +0 -1
- package/dist/core/trustedTypes.d.ts.map +0 -1
- package/dist/core/urlPolicy.d.ts.map +0 -1
- package/dist/document/AssessmentItemDocument.d.ts.map +0 -1
- package/dist/extensions/MathLiveEditor.d.ts.map +0 -1
- package/dist/extraction/ExtractionRegistry.d.ts.map +0 -1
- package/dist/extraction/createContext.d.ts.map +0 -1
- package/dist/extraction/extractors/associateExtractor.d.ts +0 -2
- package/dist/extraction/extractors/associateExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/associateExtractor.js +0 -1
- package/dist/extraction/extractors/choiceExtractor.d.ts +0 -2
- package/dist/extraction/extractors/choiceExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/choiceExtractor.js +0 -1
- package/dist/extraction/extractors/customExtractor.d.ts +0 -2
- package/dist/extraction/extractors/customExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/customExtractor.js +0 -1
- package/dist/extraction/extractors/drawingExtractor.d.ts +0 -2
- package/dist/extraction/extractors/drawingExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/drawingExtractor.js +0 -1
- package/dist/extraction/extractors/endAttemptExtractor.d.ts +0 -2
- package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/endAttemptExtractor.js +0 -1
- package/dist/extraction/extractors/extendedTextExtractor.d.ts +0 -2
- package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/extendedTextExtractor.js +0 -1
- package/dist/extraction/extractors/gapMatchExtractor.d.ts +0 -2
- package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/gapMatchExtractor.js +0 -1
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +0 -2
- package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/graphicAssociateExtractor.js +0 -1
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +0 -2
- package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/graphicGapMatchExtractor.js +0 -1
- package/dist/extraction/extractors/graphicOrderExtractor.d.ts +0 -2
- package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/graphicOrderExtractor.js +0 -1
- package/dist/extraction/extractors/hotspotExtractor.d.ts +0 -2
- package/dist/extraction/extractors/hotspotExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/hotspotExtractor.js +0 -1
- package/dist/extraction/extractors/hottextExtractor.d.ts +0 -2
- package/dist/extraction/extractors/hottextExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/hottextExtractor.js +0 -1
- package/dist/extraction/extractors/index.d.ts +0 -9
- package/dist/extraction/extractors/index.d.ts.map +0 -1
- package/dist/extraction/extractors/index.js +0 -8
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +0 -2
- package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/inlineChoiceExtractor.js +0 -1
- package/dist/extraction/extractors/matchExtractor.d.ts +0 -2
- package/dist/extraction/extractors/matchExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/matchExtractor.js +0 -1
- package/dist/extraction/extractors/mediaExtractor.d.ts +0 -2
- package/dist/extraction/extractors/mediaExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/mediaExtractor.js +0 -1
- package/dist/extraction/extractors/orderExtractor.d.ts +0 -2
- package/dist/extraction/extractors/orderExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/orderExtractor.js +0 -1
- package/dist/extraction/extractors/portableCustomExtractor.d.ts +0 -2
- package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/portableCustomExtractor.js +0 -1
- package/dist/extraction/extractors/positionObjectExtractor.d.ts +0 -2
- package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/positionObjectExtractor.js +0 -1
- package/dist/extraction/extractors/selectPointExtractor.d.ts +0 -2
- package/dist/extraction/extractors/selectPointExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/selectPointExtractor.js +0 -1
- package/dist/extraction/extractors/sliderExtractor.d.ts +0 -2
- package/dist/extraction/extractors/sliderExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/sliderExtractor.js +0 -1
- package/dist/extraction/extractors/textEntryExtractor.d.ts +0 -2
- package/dist/extraction/extractors/textEntryExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/textEntryExtractor.js +0 -1
- package/dist/extraction/extractors/uploadExtractor.d.ts +0 -2
- package/dist/extraction/extractors/uploadExtractor.d.ts.map +0 -1
- package/dist/extraction/extractors/uploadExtractor.js +0 -1
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/interactionExtractionPipeline.d.ts.map +0 -1
- package/dist/extraction/interactionSecurity.d.ts.map +0 -1
- package/dist/extraction/types.d.ts.map +0 -1
- package/dist/extraction/utils.d.ts.map +0 -1
- package/dist/iframe/IFramePlayerHost.d.ts.map +0 -1
- package/dist/iframe/index.d.ts.map +0 -1
- package/dist/iframe/protocol.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interactions/associate/extractor.d.ts.map +0 -1
- package/dist/interactions/associate/index.d.ts.map +0 -1
- package/dist/interactions/associate/types.d.ts.map +0 -1
- package/dist/interactions/choice/extractor.d.ts.map +0 -1
- package/dist/interactions/choice/index.d.ts.map +0 -1
- package/dist/interactions/choice/types.d.ts.map +0 -1
- package/dist/interactions/custom/extractor.d.ts.map +0 -1
- package/dist/interactions/custom/index.d.ts.map +0 -1
- package/dist/interactions/custom/types.d.ts.map +0 -1
- package/dist/interactions/drawing/extractor.d.ts.map +0 -1
- package/dist/interactions/drawing/index.d.ts.map +0 -1
- package/dist/interactions/drawing/types.d.ts.map +0 -1
- package/dist/interactions/end-attempt/extractor.d.ts.map +0 -1
- package/dist/interactions/end-attempt/index.d.ts.map +0 -1
- package/dist/interactions/end-attempt/types.d.ts.map +0 -1
- package/dist/interactions/extended-text/extractor.d.ts.map +0 -1
- package/dist/interactions/extended-text/index.d.ts.map +0 -1
- package/dist/interactions/extended-text/types.d.ts.map +0 -1
- package/dist/interactions/gap-match/extractor.d.ts.map +0 -1
- package/dist/interactions/gap-match/index.d.ts.map +0 -1
- package/dist/interactions/gap-match/types.d.ts.map +0 -1
- package/dist/interactions/graphic-associate/extractor.d.ts.map +0 -1
- package/dist/interactions/graphic-associate/index.d.ts.map +0 -1
- package/dist/interactions/graphic-associate/types.d.ts.map +0 -1
- package/dist/interactions/graphic-gap-match/extractor.d.ts.map +0 -1
- package/dist/interactions/graphic-gap-match/index.d.ts.map +0 -1
- package/dist/interactions/graphic-gap-match/types.d.ts.map +0 -1
- package/dist/interactions/graphic-order/extractor.d.ts.map +0 -1
- package/dist/interactions/graphic-order/index.d.ts.map +0 -1
- package/dist/interactions/graphic-order/types.d.ts.map +0 -1
- package/dist/interactions/hotspot/extractor.d.ts.map +0 -1
- package/dist/interactions/hotspot/index.d.ts.map +0 -1
- package/dist/interactions/hotspot/types.d.ts.map +0 -1
- package/dist/interactions/hottext/extractor.d.ts.map +0 -1
- package/dist/interactions/hottext/index.d.ts.map +0 -1
- package/dist/interactions/hottext/types.d.ts.map +0 -1
- package/dist/interactions/index.d.ts.map +0 -1
- package/dist/interactions/inline/index.d.ts.map +0 -1
- package/dist/interactions/inline/render-plan.d.ts.map +0 -1
- package/dist/interactions/inline-choice/extractor.d.ts.map +0 -1
- package/dist/interactions/inline-choice/index.d.ts.map +0 -1
- package/dist/interactions/inline-choice/types.d.ts.map +0 -1
- package/dist/interactions/match/extractor.d.ts.map +0 -1
- package/dist/interactions/match/index.d.ts.map +0 -1
- package/dist/interactions/match/types.d.ts.map +0 -1
- package/dist/interactions/media/extractor.d.ts.map +0 -1
- package/dist/interactions/media/index.d.ts.map +0 -1
- package/dist/interactions/media/types.d.ts.map +0 -1
- package/dist/interactions/modules.d.ts.map +0 -1
- package/dist/interactions/order/extractor.d.ts.map +0 -1
- package/dist/interactions/order/index.d.ts.map +0 -1
- package/dist/interactions/order/types.d.ts.map +0 -1
- package/dist/interactions/portable-custom/extractor.d.ts.map +0 -1
- package/dist/interactions/portable-custom/index.d.ts.map +0 -1
- package/dist/interactions/portable-custom/types.d.ts.map +0 -1
- package/dist/interactions/position-object/extractor.d.ts.map +0 -1
- package/dist/interactions/position-object/index.d.ts.map +0 -1
- package/dist/interactions/position-object/types.d.ts.map +0 -1
- package/dist/interactions/select-point/extractor.d.ts.map +0 -1
- package/dist/interactions/select-point/index.d.ts.map +0 -1
- package/dist/interactions/select-point/types.d.ts.map +0 -1
- package/dist/interactions/shared/index.d.ts.map +0 -1
- package/dist/interactions/shared/types.d.ts.map +0 -1
- package/dist/interactions/slider/extractor.d.ts.map +0 -1
- package/dist/interactions/slider/index.d.ts.map +0 -1
- package/dist/interactions/slider/types.d.ts.map +0 -1
- package/dist/interactions/text-entry/extractor.d.ts.map +0 -1
- package/dist/interactions/text-entry/index.d.ts.map +0 -1
- package/dist/interactions/text-entry/types.d.ts.map +0 -1
- package/dist/interactions/upload/extractor.d.ts.map +0 -1
- package/dist/interactions/upload/index.d.ts.map +0 -1
- package/dist/interactions/upload/types.d.ts.map +0 -1
- package/dist/pci/PciHost.d.ts.map +0 -1
- package/dist/pci/types.d.ts.map +0 -1
- package/dist/pnp/applyPnp.d.ts.map +0 -1
- package/dist/pnp/parsePnpXml.d.ts.map +0 -1
- package/dist/pnp/types.d.ts.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/interactions.d.ts +0 -8
- package/dist/types/interactions.d.ts.map +0 -1
- package/dist/types/interactions.js +0 -7
- package/dist/types/responseValidation.d.ts.map +0 -1
- package/dist/utils/PerformanceMonitor.d.ts.map +0 -1
- package/dist/utils/drawingUtils.d.ts.map +0 -1
- package/dist/utils/responseUtils.d.ts.map +0 -1
- package/dist/utils/touchDragHelper.d.ts +0 -2
- package/dist/utils/touchDragHelper.d.ts.map +0 -1
- package/dist/utils/touchDragHelper.js +0 -1
- package/dist/web-components/QTIInteractionBase.d.ts.map +0 -1
- package/dist/web-components/QTIInteractionElement.d.ts.map +0 -1
- package/dist/web-components/index.d.ts.map +0 -1
- package/src/__tests__/catalog.test.ts +0 -267
- package/src/__tests__/fixtures/pci/echo-pci.js +0 -49
- package/src/__tests__/pci.test.ts +0 -353
- package/src/__tests__/qti3-attribute-extraction.test.ts +0 -174
- package/src/__tests__/qti3-debug.test.ts +0 -140
- package/src/__tests__/qti3-extraction.test.ts +0 -309
- package/src/catalog/applyGlossaryTriggers.ts +0 -372
- package/src/catalog/catalogExtractor.ts +0 -130
- package/src/catalog/catalogLookup.ts +0 -53
- package/src/catalog/glossaryAction.ts +0 -38
- package/src/catalog/types.ts +0 -37
- package/src/components/ItemBody.svelte +0 -363
- package/src/components/ItemPlayer.svelte +0 -163
- package/src/components/ModalFeedbackDisplay.svelte +0 -97
- package/src/components/actions/typesetAction.ts +0 -74
- package/src/components/index.ts +0 -22
- package/src/components/utils/assignProps.ts +0 -2
- package/src/components/utils/feedbackUtils.ts +0 -140
- package/src/components/utils/index.ts +0 -13
- package/src/components/utils/stimulusRender.ts +0 -93
- package/src/components/utils/stylesheetRender.ts +0 -58
- package/src/core/ComponentRegistry.ts +0 -248
- package/src/core/Player.ts +0 -1618
- package/src/core/Plugin.ts +0 -123
- package/src/core/PluginManager.ts +0 -182
- package/src/core/constants.ts +0 -117
- package/src/core/declarations.ts +0 -171
- package/src/core/parsingLimits.ts +0 -62
- package/src/core/random.ts +0 -24
- package/src/core/rolePolicy.ts +0 -34
- package/src/core/sanitizer.ts +0 -305
- package/src/core/trustedTypes.ts +0 -63
- package/src/core/urlPolicy.ts +0 -98
- package/src/document/AssessmentItemDocument.ts +0 -247
- package/src/element.ts +0 -128
- package/src/extensions/MathLiveEditor.ts +0 -313
- package/src/extraction/ExtractionRegistry.ts +0 -335
- package/src/extraction/createContext.ts +0 -52
- package/src/extraction/extractors/associateExtractor.ts +0 -1
- package/src/extraction/extractors/choiceExtractor.ts +0 -1
- package/src/extraction/extractors/conformance-qti3-advanced.test.ts +0 -239
- package/src/extraction/extractors/conformance-qti3-basic.test.ts +0 -82
- package/src/extraction/extractors/conformance.test.ts +0 -208
- package/src/extraction/extractors/customExtractor.ts +0 -1
- package/src/extraction/extractors/drawingExtractor.ts +0 -1
- package/src/extraction/extractors/endAttemptExtractor.ts +0 -1
- package/src/extraction/extractors/extendedTextExtractor.ts +0 -1
- package/src/extraction/extractors/gapMatchExtractor.ts +0 -1
- package/src/extraction/extractors/graphicAssociateExtractor.ts +0 -1
- package/src/extraction/extractors/graphicGapMatchExtractor.ts +0 -1
- package/src/extraction/extractors/graphicOrderExtractor.ts +0 -1
- package/src/extraction/extractors/hotspotExtractor.ts +0 -1
- package/src/extraction/extractors/hottextExtractor.ts +0 -1
- package/src/extraction/extractors/index.ts +0 -9
- package/src/extraction/extractors/inlineChoiceExtractor.ts +0 -1
- package/src/extraction/extractors/matchExtractor.ts +0 -1
- package/src/extraction/extractors/mediaExtractor.ts +0 -1
- package/src/extraction/extractors/orderExtractor.ts +0 -1
- package/src/extraction/extractors/portableCustomExtractor.ts +0 -1
- package/src/extraction/extractors/positionObjectExtractor.ts +0 -1
- package/src/extraction/extractors/selectPointExtractor.ts +0 -1
- package/src/extraction/extractors/sliderExtractor.ts +0 -1
- package/src/extraction/extractors/textEntryExtractor.ts +0 -1
- package/src/extraction/extractors/uploadExtractor.ts +0 -1
- package/src/extraction/index.ts +0 -108
- package/src/extraction/interactionExtractionPipeline.ts +0 -70
- package/src/extraction/interactionSecurity.ts +0 -60
- package/src/extraction/types.ts +0 -246
- package/src/extraction/utils.ts +0 -243
- package/src/iframe/IFramePlayerHost.ts +0 -265
- package/src/iframe/index.ts +0 -11
- package/src/iframe/protocol.ts +0 -137
- package/src/index.ts +0 -101
- package/src/interactions/associate/extractor.ts +0 -133
- package/src/interactions/associate/index.ts +0 -2
- package/src/interactions/associate/types.ts +0 -1
- package/src/interactions/choice/extractor.ts +0 -121
- package/src/interactions/choice/index.ts +0 -2
- package/src/interactions/choice/types.ts +0 -1
- package/src/interactions/custom/extractor.ts +0 -72
- package/src/interactions/custom/index.ts +0 -2
- package/src/interactions/custom/types.ts +0 -1
- package/src/interactions/drawing/extractor.ts +0 -113
- package/src/interactions/drawing/index.ts +0 -2
- package/src/interactions/drawing/types.ts +0 -1
- package/src/interactions/end-attempt/extractor.ts +0 -74
- package/src/interactions/end-attempt/index.ts +0 -2
- package/src/interactions/end-attempt/types.ts +0 -1
- package/src/interactions/extended-text/extractor.ts +0 -92
- package/src/interactions/extended-text/index.ts +0 -2
- package/src/interactions/extended-text/types.ts +0 -1
- package/src/interactions/gap-match/extractor.ts +0 -193
- package/src/interactions/gap-match/index.ts +0 -2
- package/src/interactions/gap-match/types.ts +0 -1
- package/src/interactions/graphic-associate/extractor.ts +0 -192
- package/src/interactions/graphic-associate/index.ts +0 -2
- package/src/interactions/graphic-associate/types.ts +0 -1
- package/src/interactions/graphic-gap-match/extractor.ts +0 -257
- package/src/interactions/graphic-gap-match/index.ts +0 -2
- package/src/interactions/graphic-gap-match/types.ts +0 -1
- package/src/interactions/graphic-order/extractor.ts +0 -162
- package/src/interactions/graphic-order/index.ts +0 -2
- package/src/interactions/graphic-order/types.ts +0 -1
- package/src/interactions/hotspot/extractor.ts +0 -208
- package/src/interactions/hotspot/index.ts +0 -2
- package/src/interactions/hotspot/types.ts +0 -1
- package/src/interactions/hottext/extractor.ts +0 -163
- package/src/interactions/hottext/index.ts +0 -2
- package/src/interactions/hottext/types.ts +0 -1
- package/src/interactions/index.ts +0 -52
- package/src/interactions/inline/index.ts +0 -1
- package/src/interactions/inline/render-plan.ts +0 -105
- package/src/interactions/inline-choice/InlineChoice.svelte +0 -57
- package/src/interactions/inline-choice/extractor.ts +0 -105
- package/src/interactions/inline-choice/index.ts +0 -2
- package/src/interactions/inline-choice/types.ts +0 -1
- package/src/interactions/match/extractor.ts +0 -187
- package/src/interactions/match/index.ts +0 -2
- package/src/interactions/match/types.ts +0 -1
- package/src/interactions/media/extractor.ts +0 -168
- package/src/interactions/media/index.ts +0 -2
- package/src/interactions/media/types.ts +0 -1
- package/src/interactions/modules.ts +0 -111
- package/src/interactions/order/extractor.ts +0 -120
- package/src/interactions/order/index.ts +0 -2
- package/src/interactions/order/types.ts +0 -1
- package/src/interactions/portable-custom/extractor.ts +0 -122
- package/src/interactions/portable-custom/index.ts +0 -2
- package/src/interactions/portable-custom/types.ts +0 -1
- package/src/interactions/position-object/extractor.ts +0 -243
- package/src/interactions/position-object/index.ts +0 -2
- package/src/interactions/position-object/types.ts +0 -1
- package/src/interactions/select-point/extractor.ts +0 -143
- package/src/interactions/select-point/index.ts +0 -2
- package/src/interactions/select-point/types.ts +0 -1
- package/src/interactions/shared/index.ts +0 -1
- package/src/interactions/shared/types.ts +0 -430
- package/src/interactions/slider/extractor.ts +0 -102
- package/src/interactions/slider/index.ts +0 -2
- package/src/interactions/slider/types.ts +0 -1
- package/src/interactions/text-entry/InlineTextEntry.svelte +0 -75
- package/src/interactions/text-entry/extractor.ts +0 -79
- package/src/interactions/text-entry/index.ts +0 -2
- package/src/interactions/text-entry/types.ts +0 -1
- package/src/interactions/upload/extractor.ts +0 -81
- package/src/interactions/upload/index.ts +0 -2
- package/src/interactions/upload/types.ts +0 -1
- package/src/pci/PciHost.ts +0 -138
- package/src/pci/types.ts +0 -70
- package/src/pnp/applyPnp.ts +0 -29
- package/src/pnp/parsePnpXml.ts +0 -215
- package/src/pnp/types.ts +0 -75
- package/src/server.ts +0 -14
- package/src/types/index.ts +0 -388
- package/src/types/interactions.ts +0 -8
- package/src/types/responseValidation.ts +0 -29
- package/src/types/xmldom.d.ts +0 -12
- package/src/utils/PerformanceMonitor.ts +0 -335
- package/src/utils/drawingUtils.ts +0 -73
- package/src/utils/responseUtils.ts +0 -51
- package/src/utils/touchDragHelper.ts +0 -1
- package/src/web-components/QTIInteractionBase.ts +0 -303
- package/src/web-components/QTIInteractionElement.ts +0 -125
- package/src/web-components/index.ts +0 -22
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { InlineChoiceInteractionData } from '../inline-choice/types.js';
|
|
2
|
-
import type { TextEntryInteractionData } from '../text-entry/types.js';
|
|
3
|
-
import type { InteractionData } from '../shared/types.js';
|
|
4
|
-
import {
|
|
5
|
-
isStandardInlineInteractionTagName,
|
|
6
|
-
isStandardInlineInteractionType,
|
|
7
|
-
} from '../modules.js';
|
|
8
|
-
|
|
9
|
-
export type InlineInteractionData = TextEntryInteractionData | InlineChoiceInteractionData;
|
|
10
|
-
|
|
11
|
-
export type InlineRenderSegment =
|
|
12
|
-
| { type: 'html'; content: string }
|
|
13
|
-
| { type: 'textEntry'; interaction: TextEntryInteractionData }
|
|
14
|
-
| { type: 'inlineChoice'; interaction: InlineChoiceInteractionData };
|
|
15
|
-
|
|
16
|
-
export function isInlineInteractionType(type: string): type is InlineInteractionData['type'] {
|
|
17
|
-
return isStandardInlineInteractionType(type);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function isInlineInteractionTagName(tagName: string): boolean {
|
|
21
|
-
return isStandardInlineInteractionTagName(tagName);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function createInlinePlaceholderHtml(html: string, interactions: InteractionData[]): string {
|
|
25
|
-
return html
|
|
26
|
-
.replace(
|
|
27
|
-
/<textEntryInteraction[^>]*responseIdentifier="([^"]+)"[^>]*?(?:\/>|><\/textEntryInteraction>)/gi,
|
|
28
|
-
(match, responseId: string) =>
|
|
29
|
-
hasInlineInteraction(interactions, responseId, 'textEntryInteraction')
|
|
30
|
-
? placeholder('textEntry', responseId)
|
|
31
|
-
: match
|
|
32
|
-
)
|
|
33
|
-
.replace(
|
|
34
|
-
/<qti-text-entry-interaction[^>]*response-identifier="([^"]+)"[^>]*?(?:\/>|><\/qti-text-entry-interaction>)/gi,
|
|
35
|
-
(match, responseId: string) =>
|
|
36
|
-
hasInlineInteraction(interactions, responseId, 'textEntryInteraction')
|
|
37
|
-
? placeholder('textEntry', responseId)
|
|
38
|
-
: match
|
|
39
|
-
)
|
|
40
|
-
.replace(
|
|
41
|
-
/<inlineChoiceInteraction[^>]*responseIdentifier="([^"]+)"[^>]*>[\s\S]*?<\/inlineChoiceInteraction>/gi,
|
|
42
|
-
(match, responseId: string) =>
|
|
43
|
-
hasInlineInteraction(interactions, responseId, 'inlineChoiceInteraction')
|
|
44
|
-
? placeholder('inlineChoice', responseId)
|
|
45
|
-
: match
|
|
46
|
-
)
|
|
47
|
-
.replace(
|
|
48
|
-
/<qti-inline-choice-interaction[^>]*response-identifier="([^"]+)"[^>]*>[\s\S]*?<\/qti-inline-choice-interaction>/gi,
|
|
49
|
-
(match, responseId: string) =>
|
|
50
|
-
hasInlineInteraction(interactions, responseId, 'inlineChoiceInteraction')
|
|
51
|
-
? placeholder('inlineChoice', responseId)
|
|
52
|
-
: match
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function createInlineRenderPlan(html: string, interactions: InteractionData[]): InlineRenderSegment[] {
|
|
57
|
-
const placeholderHtml = createInlinePlaceholderHtml(html, interactions);
|
|
58
|
-
const result: InlineRenderSegment[] = [];
|
|
59
|
-
const combinedPattern = /\[TEXTENTRY:([^\]]+)\]|\[INLINECHOICE:([^\]]+)\]/g;
|
|
60
|
-
let lastIndex = 0;
|
|
61
|
-
let match: RegExpExecArray | null;
|
|
62
|
-
|
|
63
|
-
while ((match = combinedPattern.exec(placeholderHtml)) !== null) {
|
|
64
|
-
if (match.index > lastIndex) {
|
|
65
|
-
result.push({ type: 'html', content: placeholderHtml.substring(lastIndex, match.index) });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (match[0].startsWith('[TEXTENTRY:')) {
|
|
69
|
-
const interaction = findInlineInteraction(interactions, match[1], 'textEntryInteraction');
|
|
70
|
-
if (interaction) result.push({ type: 'textEntry', interaction });
|
|
71
|
-
} else {
|
|
72
|
-
const interaction = findInlineInteraction(interactions, match[2], 'inlineChoiceInteraction');
|
|
73
|
-
if (interaction) result.push({ type: 'inlineChoice', interaction });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
lastIndex = match.index + match[0].length;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (lastIndex < placeholderHtml.length) {
|
|
80
|
-
result.push({ type: 'html', content: placeholderHtml.substring(lastIndex) });
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return result.length > 0 ? result : [{ type: 'html', content: placeholderHtml }];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function placeholder(kind: 'textEntry' | 'inlineChoice', responseId: string): string {
|
|
87
|
-
return kind === 'textEntry' ? `[TEXTENTRY:${responseId}]` : `[INLINECHOICE:${responseId}]`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function hasInlineInteraction(
|
|
91
|
-
interactions: InteractionData[],
|
|
92
|
-
responseId: string,
|
|
93
|
-
type: InlineInteractionData['type']
|
|
94
|
-
): boolean {
|
|
95
|
-
return Boolean(findInlineInteraction(interactions, responseId, type));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function findInlineInteraction<T extends InlineInteractionData['type']>(
|
|
99
|
-
interactions: InteractionData[],
|
|
100
|
-
responseId: string,
|
|
101
|
-
type: T
|
|
102
|
-
): Extract<InlineInteractionData, { type: T }> | null {
|
|
103
|
-
return (interactions.find((interaction) => interaction.responseId === responseId && interaction.type === type) ??
|
|
104
|
-
null) as Extract<InlineInteractionData, { type: T }> | null;
|
|
105
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
3
|
-
import type { InlineChoiceInteractionData } from './types.js';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
interaction: InlineChoiceInteractionData;
|
|
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
|
-
const displayValue = $derived(correctAnswer !== null ? correctAnswer : response);
|
|
24
|
-
const correctChoice = $derived(correctAnswer ? interaction.choices.find((choice) => choice.identifier === correctAnswer) : null);
|
|
25
|
-
|
|
26
|
-
function handleChange(event: Event) {
|
|
27
|
-
const value = (event.currentTarget as HTMLSelectElement | null)?.value ?? '';
|
|
28
|
-
onResponseChange(interaction.responseId, value);
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<span class="inline-choice-wrapper" style="display: inline-block; position: relative;">
|
|
33
|
-
<select
|
|
34
|
-
class="select select-bordered select-sm inline-select"
|
|
35
|
-
class:border-success={correctAnswer !== null}
|
|
36
|
-
class:bg-success={correctAnswer !== null}
|
|
37
|
-
class:bg-opacity-10={correctAnswer !== null}
|
|
38
|
-
style="display: inline-block; margin: 0 4px; width: auto; min-width: 120px;"
|
|
39
|
-
aria-label={`Inline choice ${interaction.responseId}${correctAnswer && correctChoice ? '. Correct answer: ' + correctChoice.text : ''}`}
|
|
40
|
-
value={displayValue}
|
|
41
|
-
onchange={handleChange}
|
|
42
|
-
{disabled}
|
|
43
|
-
>
|
|
44
|
-
<option value="">{interaction.label ?? interaction.dataPrompt ?? i18n?.t('interactions.inline.selectPlaceholder', 'Select...')}</option>
|
|
45
|
-
{#each interaction.choices as choice}
|
|
46
|
-
{@const isCorrect = correctAnswer === choice.identifier}
|
|
47
|
-
<option value={choice.identifier}>
|
|
48
|
-
{choice.text}{isCorrect ? ' ✓' : ''}
|
|
49
|
-
</option>
|
|
50
|
-
{/each}
|
|
51
|
-
</select>
|
|
52
|
-
{#if correctAnswer !== null && correctChoice}
|
|
53
|
-
<span class="badge badge-success badge-sm" style="position: absolute; top: -1.5rem; left: 0; white-space: nowrap; font-size: 0.7rem;">
|
|
54
|
-
{i18n?.t('interactions.choice.correct', 'Correct') ?? 'Correct'}: {correctChoice.text}
|
|
55
|
-
</span>
|
|
56
|
-
{/if}
|
|
57
|
-
</span>
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard QTI inlineChoiceInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from inlineChoiceInteraction elements (dropdown in text)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../../extraction/types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Inline choice data extracted from inlineChoiceInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface InlineChoiceData {
|
|
13
|
-
choices: Array<{ identifier: string; text: string; fixed?: boolean }>;
|
|
14
|
-
shuffle: boolean;
|
|
15
|
-
/** Text from the QTI <label> child element; used as the placeholder "Select…" option */
|
|
16
|
-
label: string | null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Standard QTI inline choice interaction extractor
|
|
21
|
-
* Handles inlineChoiceInteraction elements (dropdown selections within text)
|
|
22
|
-
*/
|
|
23
|
-
export const standardInlineChoiceExtractor: ElementExtractor<InlineChoiceData> = {
|
|
24
|
-
id: 'qti:inline-choice-interaction',
|
|
25
|
-
name: 'QTI Standard Inline Choice Interaction',
|
|
26
|
-
priority: 10,
|
|
27
|
-
elementTypes: ['inlineChoiceInteraction'],
|
|
28
|
-
description: 'Extracts standard QTI inlineChoiceInteraction (dropdown in text)',
|
|
29
|
-
|
|
30
|
-
canHandle(element, _context) {
|
|
31
|
-
// All inlineChoiceInteraction elements are standard
|
|
32
|
-
return element.rawTagName === 'inlineChoiceInteraction' || element.rawTagName === 'qti-inline-choice-interaction';
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
extract(element, context) {
|
|
36
|
-
const { utils } = context;
|
|
37
|
-
|
|
38
|
-
// Extract choices (inlineChoice children)
|
|
39
|
-
const inlineChoices = utils.getChildrenByTag(element, 'inlineChoice');
|
|
40
|
-
const choices = inlineChoices.map((choice) => {
|
|
41
|
-
const fixed = utils.getBooleanAttribute(choice, 'fixed');
|
|
42
|
-
return {
|
|
43
|
-
identifier: utils.getAttribute(choice, 'identifier', ''),
|
|
44
|
-
text: utils.getTextContent(choice),
|
|
45
|
-
...(fixed ? { fixed } : {}),
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Extract <label> child — used as placeholder text in the dropdown
|
|
50
|
-
const labelElements = utils.getChildrenByTag(element, 'label');
|
|
51
|
-
const label = labelElements.length > 0 ? utils.getTextContent(labelElements[0]) : null;
|
|
52
|
-
|
|
53
|
-
// data-prompt: alternative placeholder for the dropdown default option
|
|
54
|
-
const dataPrompt = utils.getAttribute(element, 'data-prompt', '') || null;
|
|
55
|
-
|
|
56
|
-
// Extract attributes
|
|
57
|
-
const shuffle = utils.getBooleanAttribute(element, 'shuffle');
|
|
58
|
-
const interactionClasses = utils.getClasses(element);
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
choices,
|
|
62
|
-
shuffle,
|
|
63
|
-
label,
|
|
64
|
-
...(dataPrompt ? { dataPrompt } : {}),
|
|
65
|
-
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
validate(data) {
|
|
70
|
-
const errors: string[] = [];
|
|
71
|
-
const warnings: string[] = [];
|
|
72
|
-
|
|
73
|
-
// Validate choices exist
|
|
74
|
-
if (!data.choices || data.choices.length === 0) {
|
|
75
|
-
errors.push('inlineChoiceInteraction must have at least one choice');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Validate choice identifiers
|
|
79
|
-
if (data.choices) {
|
|
80
|
-
const identifiers = new Set<string>();
|
|
81
|
-
for (const choice of data.choices) {
|
|
82
|
-
if (!choice.identifier) {
|
|
83
|
-
errors.push('All choices must have an identifier');
|
|
84
|
-
} else if (identifiers.has(choice.identifier)) {
|
|
85
|
-
errors.push(`Duplicate choice identifier: ${choice.identifier}`);
|
|
86
|
-
} else {
|
|
87
|
-
identifiers.add(choice.identifier);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Warn if too many choices
|
|
92
|
-
if (data.choices.length >= 10) {
|
|
93
|
-
warnings.push(
|
|
94
|
-
`inlineChoiceInteraction has ${data.choices.length} choices - consider limiting for better usability`
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
valid: errors.length === 0,
|
|
101
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
102
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { InlineChoiceInteractionData } from '../shared/types.js';
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard QTI matchInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from matchInteraction elements (matching pairs)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../../extraction/types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Match data extracted from matchInteraction elements
|
|
11
|
-
*/
|
|
12
|
-
export interface MatchData {
|
|
13
|
-
sourceSet: Array<{ identifier: string; text: string; matchMax: number; matchMin?: number; matchGroup?: string[]; classes?: string[] }>;
|
|
14
|
-
targetSet: Array<{ identifier: string; text: string; matchMax: number; matchMin?: number; matchGroup?: string[]; classes?: string[] }>;
|
|
15
|
-
shuffle: boolean;
|
|
16
|
-
maxAssociations: number;
|
|
17
|
-
minAssociations?: number;
|
|
18
|
-
prompt: string | null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Standard QTI match interaction extractor
|
|
23
|
-
* Handles matchInteraction elements (matching pairs between two sets)
|
|
24
|
-
*/
|
|
25
|
-
export const standardMatchExtractor: ElementExtractor<MatchData> = {
|
|
26
|
-
id: 'qti:match-interaction',
|
|
27
|
-
name: 'QTI Standard Match Interaction',
|
|
28
|
-
priority: 10,
|
|
29
|
-
elementTypes: ['matchInteraction'],
|
|
30
|
-
description: 'Extracts standard QTI matchInteraction (matching pairs)',
|
|
31
|
-
|
|
32
|
-
canHandle(element, _context) {
|
|
33
|
-
// All matchInteraction elements are standard (both QTI 2.x and 3.0)
|
|
34
|
-
return element.rawTagName === 'matchInteraction' || element.rawTagName === 'qti-match-interaction';
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
extract(element, context) {
|
|
38
|
-
const { utils } = context;
|
|
39
|
-
|
|
40
|
-
// Extract all simpleAssociableChoice children
|
|
41
|
-
const allChoices = utils.getChildrenByTag(element, 'simpleAssociableChoice');
|
|
42
|
-
|
|
43
|
-
// Determine which are source vs target based on matchSet structure
|
|
44
|
-
// In QTI, matchInteraction can have two simpleMatchSet elements
|
|
45
|
-
const matchSets = utils.getChildrenByTag(element, 'simpleMatchSet');
|
|
46
|
-
|
|
47
|
-
let sourceSet: Array<{ identifier: string; text: string; matchMax: number; matchMin?: number; matchGroup?: string[]; classes?: string[] }> = [];
|
|
48
|
-
let targetSet: Array<{ identifier: string; text: string; matchMax: number; matchMin?: number; matchGroup?: string[]; classes?: string[] }> = [];
|
|
49
|
-
|
|
50
|
-
if (matchSets.length >= 2) {
|
|
51
|
-
// Extract choices from first matchSet (source)
|
|
52
|
-
const sourceMatchSet = matchSets[0];
|
|
53
|
-
const sourceElements = utils.getChildrenByTag(sourceMatchSet, 'simpleAssociableChoice');
|
|
54
|
-
sourceSet = sourceElements.map((choice) => {
|
|
55
|
-
const classes = utils.getClasses(choice);
|
|
56
|
-
const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);
|
|
57
|
-
const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);
|
|
58
|
-
const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');
|
|
59
|
-
const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
|
|
60
|
-
return {
|
|
61
|
-
identifier: utils.getAttribute(choice, 'identifier', ''),
|
|
62
|
-
text: utils.getHtmlContent(choice),
|
|
63
|
-
matchMax,
|
|
64
|
-
...(matchMin > 0 ? { matchMin } : {}),
|
|
65
|
-
...(matchGroup.length > 0 ? { matchGroup } : {}),
|
|
66
|
-
...(classes.length > 0 ? { classes } : {}),
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// Extract choices from second matchSet (target)
|
|
71
|
-
const targetMatchSet = matchSets[1];
|
|
72
|
-
const targetElements = utils.getChildrenByTag(targetMatchSet, 'simpleAssociableChoice');
|
|
73
|
-
targetSet = targetElements.map((choice) => {
|
|
74
|
-
const classes = utils.getClasses(choice);
|
|
75
|
-
const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);
|
|
76
|
-
const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);
|
|
77
|
-
const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');
|
|
78
|
-
const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
|
|
79
|
-
return {
|
|
80
|
-
identifier: utils.getAttribute(choice, 'identifier', ''),
|
|
81
|
-
text: utils.getHtmlContent(choice),
|
|
82
|
-
matchMax,
|
|
83
|
-
...(matchMin > 0 ? { matchMin } : {}),
|
|
84
|
-
...(matchGroup.length > 0 ? { matchGroup } : {}),
|
|
85
|
-
...(classes.length > 0 ? { classes } : {}),
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
} else {
|
|
89
|
-
// Fallback: treat all choices as both source and target
|
|
90
|
-
const extractedChoices = allChoices.map((choice) => {
|
|
91
|
-
const classes = utils.getClasses(choice);
|
|
92
|
-
const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);
|
|
93
|
-
const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);
|
|
94
|
-
const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');
|
|
95
|
-
const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
|
|
96
|
-
return {
|
|
97
|
-
identifier: utils.getAttribute(choice, 'identifier', ''),
|
|
98
|
-
text: utils.getHtmlContent(choice),
|
|
99
|
-
matchMax,
|
|
100
|
-
...(matchMin > 0 ? { matchMin } : {}),
|
|
101
|
-
...(matchGroup.length > 0 ? { matchGroup } : {}),
|
|
102
|
-
...(classes.length > 0 ? { classes } : {}),
|
|
103
|
-
};
|
|
104
|
-
});
|
|
105
|
-
sourceSet = extractedChoices;
|
|
106
|
-
targetSet = extractedChoices;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Extract attributes
|
|
110
|
-
const shuffle = utils.getBooleanAttribute(element, 'shuffle');
|
|
111
|
-
const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 1);
|
|
112
|
-
const minAssociationsRaw = utils.getNumberAttribute(element, 'minAssociations', 0);
|
|
113
|
-
const minAssociations = minAssociationsRaw > 0 ? minAssociationsRaw : undefined;
|
|
114
|
-
const interactionClasses = utils.getClasses(element);
|
|
115
|
-
const maxSelectionsMessage = utils.getAttribute(element, 'data-qti-max-selections-message', '') || null;
|
|
116
|
-
const minSelectionsMessage = utils.getAttribute(element, 'data-qti-min-selections-message', '') || null;
|
|
117
|
-
const firstColumnHeader = utils.getAttribute(element, 'data-qti-first-column-header', '') || null;
|
|
118
|
-
|
|
119
|
-
// Extract prompt (optional)
|
|
120
|
-
const promptElements = utils.getChildrenByTag(element, 'prompt');
|
|
121
|
-
const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
sourceSet,
|
|
125
|
-
targetSet,
|
|
126
|
-
shuffle,
|
|
127
|
-
maxAssociations,
|
|
128
|
-
...(minAssociations !== undefined ? { minAssociations } : {}),
|
|
129
|
-
prompt,
|
|
130
|
-
...(interactionClasses.length > 0 ? { interactionClasses } : {}),
|
|
131
|
-
...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),
|
|
132
|
-
...(minSelectionsMessage ? { minSelectionsMessage } : {}),
|
|
133
|
-
...(firstColumnHeader ? { firstColumnHeader } : {}),
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
validate(data) {
|
|
138
|
-
const errors: string[] = [];
|
|
139
|
-
|
|
140
|
-
// Validate source choices exist
|
|
141
|
-
if (!data.sourceSet || data.sourceSet.length === 0) {
|
|
142
|
-
errors.push('matchInteraction must have at least one source choice');
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Validate target choices exist
|
|
146
|
-
if (!data.targetSet || data.targetSet.length === 0) {
|
|
147
|
-
errors.push('matchInteraction must have at least one target choice');
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Validate choice identifiers
|
|
151
|
-
if (data.sourceSet) {
|
|
152
|
-
const identifiers = new Set<string>();
|
|
153
|
-
for (const choice of data.sourceSet) {
|
|
154
|
-
if (!choice.identifier) {
|
|
155
|
-
errors.push('All source choices must have an identifier');
|
|
156
|
-
} else if (identifiers.has(choice.identifier)) {
|
|
157
|
-
errors.push(`Duplicate source identifier: ${choice.identifier}`);
|
|
158
|
-
} else {
|
|
159
|
-
identifiers.add(choice.identifier);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (data.targetSet) {
|
|
165
|
-
const identifiers = new Set<string>();
|
|
166
|
-
for (const choice of data.targetSet) {
|
|
167
|
-
if (!choice.identifier) {
|
|
168
|
-
errors.push('All target choices must have an identifier');
|
|
169
|
-
} else if (identifiers.has(choice.identifier)) {
|
|
170
|
-
errors.push(`Duplicate target identifier: ${choice.identifier}`);
|
|
171
|
-
} else {
|
|
172
|
-
identifiers.add(choice.identifier);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Validate maxAssociations
|
|
178
|
-
if (data.maxAssociations < 0) {
|
|
179
|
-
errors.push('maxAssociations must be non-negative');
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return {
|
|
183
|
-
valid: errors.length === 0,
|
|
184
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
185
|
-
};
|
|
186
|
-
},
|
|
187
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { MatchInteractionData, AssociableChoice } from '../shared/types.js';
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard QTI mediaInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from mediaInteraction elements (video/audio playback)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { ElementExtractor } from '../../extraction/types.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Media element data
|
|
11
|
-
*/
|
|
12
|
-
export interface MediaElement {
|
|
13
|
-
type: 'audio' | 'video' | 'object';
|
|
14
|
-
src: string;
|
|
15
|
-
mimeType: string;
|
|
16
|
-
width?: number;
|
|
17
|
-
height?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Media data extracted from mediaInteraction elements
|
|
22
|
-
*/
|
|
23
|
-
export interface MediaData {
|
|
24
|
-
mediaElement: MediaElement | null;
|
|
25
|
-
autostart: boolean;
|
|
26
|
-
minPlays: number;
|
|
27
|
-
maxPlays: number;
|
|
28
|
-
loop: boolean;
|
|
29
|
-
prompt: string | null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Standard QTI media interaction extractor
|
|
34
|
-
* Handles mediaInteraction elements (video/audio playback with interaction)
|
|
35
|
-
*/
|
|
36
|
-
export const standardMediaExtractor: ElementExtractor<MediaData> = {
|
|
37
|
-
id: 'qti:media-interaction',
|
|
38
|
-
name: 'QTI Standard Media Interaction',
|
|
39
|
-
priority: 10,
|
|
40
|
-
elementTypes: ['mediaInteraction'],
|
|
41
|
-
description: 'Extracts standard QTI mediaInteraction (video/audio playback)',
|
|
42
|
-
|
|
43
|
-
canHandle(element, _context) {
|
|
44
|
-
// All mediaInteraction elements are standard
|
|
45
|
-
return element.rawTagName === 'mediaInteraction';
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
extract(element, context) {
|
|
49
|
-
const { utils } = context;
|
|
50
|
-
|
|
51
|
-
// Extract attributes
|
|
52
|
-
const autostart = utils.getBooleanAttribute(element, 'autostart', false);
|
|
53
|
-
const minPlays = utils.getNumberAttribute(element, 'minPlays', 0);
|
|
54
|
-
const maxPlays = utils.getNumberAttribute(element, 'maxPlays', 0);
|
|
55
|
-
const loop = utils.getBooleanAttribute(element, 'loop', false);
|
|
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
|
-
// Extract media element (audio, video, or object)
|
|
62
|
-
let mediaElement: MediaElement | null = null;
|
|
63
|
-
|
|
64
|
-
// Check for audio element
|
|
65
|
-
const audioElements = utils.getChildrenByTag(element, 'audio');
|
|
66
|
-
if (audioElements.length > 0) {
|
|
67
|
-
const audioElement = audioElements[0];
|
|
68
|
-
const sourceElements = utils.getChildrenByTag(audioElement, 'source');
|
|
69
|
-
if (sourceElements.length === 0) {
|
|
70
|
-
throw new Error('audio element must contain at least one source element');
|
|
71
|
-
}
|
|
72
|
-
const firstSource = sourceElements[0];
|
|
73
|
-
mediaElement = {
|
|
74
|
-
type: 'audio',
|
|
75
|
-
src: utils.getAttribute(firstSource, 'src', ''),
|
|
76
|
-
mimeType: utils.getAttribute(firstSource, 'type', ''),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Check for video element
|
|
81
|
-
const videoElements = utils.getChildrenByTag(element, 'video');
|
|
82
|
-
if (videoElements.length > 0) {
|
|
83
|
-
const videoElement = videoElements[0];
|
|
84
|
-
const sourceElements = utils.getChildrenByTag(videoElement, 'source');
|
|
85
|
-
if (sourceElements.length === 0) {
|
|
86
|
-
throw new Error('video element must contain at least one source element');
|
|
87
|
-
}
|
|
88
|
-
const firstSource = sourceElements[0];
|
|
89
|
-
const width = utils.getNumberAttribute(videoElement, 'width', 640);
|
|
90
|
-
const height = utils.getNumberAttribute(videoElement, 'height', 480);
|
|
91
|
-
mediaElement = {
|
|
92
|
-
type: 'video',
|
|
93
|
-
src: utils.getAttribute(firstSource, 'src', ''),
|
|
94
|
-
mimeType: utils.getAttribute(firstSource, 'type', ''),
|
|
95
|
-
width,
|
|
96
|
-
height,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Check for object element
|
|
101
|
-
const objectElements = utils.getChildrenByTag(element, 'object');
|
|
102
|
-
if (objectElements.length > 0) {
|
|
103
|
-
const objectElement = objectElements[0];
|
|
104
|
-
const data = utils.getAttribute(objectElement, 'data', '');
|
|
105
|
-
if (!data) {
|
|
106
|
-
throw new Error('object element must have data attribute');
|
|
107
|
-
}
|
|
108
|
-
const width = utils.getNumberAttribute(objectElement, 'width', 0);
|
|
109
|
-
const height = utils.getNumberAttribute(objectElement, 'height', 0);
|
|
110
|
-
mediaElement = {
|
|
111
|
-
type: 'object',
|
|
112
|
-
src: data,
|
|
113
|
-
mimeType: utils.getAttribute(objectElement, 'type', ''),
|
|
114
|
-
...(width > 0 ? { width } : {}),
|
|
115
|
-
...(height > 0 ? { height } : {}),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Throw error if no media element found
|
|
120
|
-
if (!mediaElement) {
|
|
121
|
-
throw new Error('mediaInteraction must contain audio, video, or object element');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
mediaElement,
|
|
126
|
-
autostart,
|
|
127
|
-
minPlays,
|
|
128
|
-
maxPlays,
|
|
129
|
-
loop,
|
|
130
|
-
prompt,
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
validate(data) {
|
|
135
|
-
const errors: string[] = [];
|
|
136
|
-
const warnings: string[] = [];
|
|
137
|
-
|
|
138
|
-
// Validate media element exists
|
|
139
|
-
if (!data.mediaElement) {
|
|
140
|
-
errors.push('mediaInteraction must have a mediaElement');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Validate play constraints
|
|
144
|
-
if (data.minPlays < 0) {
|
|
145
|
-
errors.push('minPlays must be non-negative');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (data.maxPlays < 0) {
|
|
149
|
-
errors.push('maxPlays must be non-negative');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Validate minPlays <= maxPlays (when maxPlays > 0, as 0 means unlimited)
|
|
153
|
-
if (data.maxPlays > 0 && data.minPlays > data.maxPlays) {
|
|
154
|
-
errors.push(`maxPlays (${data.maxPlays}) must be greater than or equal to minPlays (${data.minPlays})`);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Warn if loop is true with maxPlays
|
|
158
|
-
if (data.loop && data.maxPlays > 0) {
|
|
159
|
-
warnings.push('mediaInteraction has loop=true with maxPlays - loop may be ignored');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
valid: errors.length === 0,
|
|
164
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
165
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { MediaInteractionData, MediaElement } from '../shared/types.js';
|