@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,363 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
let nextItemBodyScopeId = 0;
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import type { InteractionData } from '../types';
|
|
7
|
-
import type { Player } from '../core/Player';
|
|
8
|
-
import type { InteractionResponseValue, QTIChangeEventDetail } from '../web-components';
|
|
9
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
10
|
-
import {
|
|
11
|
-
normalizeHeuristicsConfig,
|
|
12
|
-
type QtiHeuristicsConfig,
|
|
13
|
-
type ResolvedItemDeliveryContext
|
|
14
|
-
} from '@pie-qti/ims-cp-core';
|
|
15
|
-
import { processFeedbackInline } from './utils/feedbackUtils';
|
|
16
|
-
import { typesetAction } from './actions/typesetAction';
|
|
17
|
-
import { glossaryAction } from '../catalog/glossaryAction';
|
|
18
|
-
import { assignProps } from './utils/assignProps';
|
|
19
|
-
import { buildScopedStylesheetCss } from './utils/stylesheetRender';
|
|
20
|
-
import { buildEffectiveStimulusContent, injectStimulusContent } from './utils/stimulusRender';
|
|
21
|
-
import { getRoleCapabilities } from '../core/rolePolicy';
|
|
22
|
-
import InlineChoice from '../interactions/inline-choice/InlineChoice.svelte';
|
|
23
|
-
import InlineTextEntry from '../interactions/text-entry/InlineTextEntry.svelte';
|
|
24
|
-
import { createInlineRenderPlan, isInlineInteractionTagName, isInlineInteractionType } from '../interactions/inline/render-plan';
|
|
25
|
-
|
|
26
|
-
type ItemResponseValue = InteractionResponseValue | null;
|
|
27
|
-
type ItemResponseMap = Record<string, ItemResponseValue>;
|
|
28
|
-
type QtiChangeDomEvent = CustomEvent<QTIChangeEventDetail<ItemResponseValue>>;
|
|
29
|
-
|
|
30
|
-
interface Props {
|
|
31
|
-
player: Player;
|
|
32
|
-
responses?: ItemResponseMap;
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
role?: 'candidate' | 'scorer' | 'author' | 'tutor' | 'proctor' | 'testConstructor';
|
|
35
|
-
i18n?: I18nProvider;
|
|
36
|
-
typeset?: (element: HTMLElement) => void;
|
|
37
|
-
onResponseChange?: (responseId: string, value: ItemResponseValue) => void;
|
|
38
|
-
outcomeValues?: Record<string, any>; // Needed for feedbackInline visibility
|
|
39
|
-
heuristicsConfig?: QtiHeuristicsConfig; // Optional heuristics configuration
|
|
40
|
-
/** QTI 3.0 shared stimulus content: map of stimulus identifier → HTML string */
|
|
41
|
-
stimulusContent?: Record<string, string>;
|
|
42
|
-
/** Package/assessment-resolved QTI 3 delivery context. */
|
|
43
|
-
deliveryContext?: ResolvedItemDeliveryContext;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let {
|
|
47
|
-
player,
|
|
48
|
-
responses = {},
|
|
49
|
-
disabled = false,
|
|
50
|
-
role = 'candidate',
|
|
51
|
-
i18n,
|
|
52
|
-
typeset,
|
|
53
|
-
onResponseChange = () => {},
|
|
54
|
-
outcomeValues = {},
|
|
55
|
-
heuristicsConfig,
|
|
56
|
-
stimulusContent = {},
|
|
57
|
-
deliveryContext,
|
|
58
|
-
}: Props = $props();
|
|
59
|
-
const itemBodyScope = `qti-item-body-${++nextItemBodyScopeId}`;
|
|
60
|
-
const itemBodyScopeSelector = `[data-qti-item-body-scope="${itemBodyScope}"]`;
|
|
61
|
-
|
|
62
|
-
// Normalize heuristics configuration with defaults
|
|
63
|
-
const heuristics = $derived(normalizeHeuristicsConfig(heuristicsConfig));
|
|
64
|
-
|
|
65
|
-
// Get the component registry from the player
|
|
66
|
-
const componentRegistry = $derived(player.getComponentRegistry());
|
|
67
|
-
const roleCapabilities = $derived(getRoleCapabilities(role));
|
|
68
|
-
const effectiveDisabled = $derived(disabled || roleCapabilities.isReadOnly);
|
|
69
|
-
|
|
70
|
-
// Process interactions
|
|
71
|
-
const interactions = $derived<InteractionData[]>(player.getInteractionData());
|
|
72
|
-
|
|
73
|
-
// Get correct responses for roles allowed by policy.
|
|
74
|
-
const correctResponses = $derived.by(() => {
|
|
75
|
-
return roleCapabilities.canViewCorrectResponses ? player.getCorrectResponses() : {};
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Get components for block-level interactions only (not inline interactions).
|
|
79
|
-
// Type is always normalized to QTI 2.x camelCase by Player (qti-text-entry-interaction → textEntryInteraction).
|
|
80
|
-
const interactionComponents = $derived(
|
|
81
|
-
interactions
|
|
82
|
-
.filter(
|
|
83
|
-
(interaction) =>
|
|
84
|
-
!isInlineInteractionType(interaction.type)
|
|
85
|
-
)
|
|
86
|
-
.map((interaction) => {
|
|
87
|
-
try {
|
|
88
|
-
// Get the web component tag name from the registry
|
|
89
|
-
const tagName = componentRegistry.getTagName(interaction);
|
|
90
|
-
return {
|
|
91
|
-
interaction,
|
|
92
|
-
tagName,
|
|
93
|
-
};
|
|
94
|
-
} catch (error) {
|
|
95
|
-
console.error(`Failed to get tag name for ${interaction.type}:`, error);
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
.filter((item): item is NonNullable<typeof item> => item !== null)
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
// Get item body HTML and process interactions
|
|
103
|
-
// Block interactions are kept in HTML but wrapped with a hidden marker (see styles below)
|
|
104
|
-
// Inline interactions are replaced with placeholders
|
|
105
|
-
const itemBodyHtml = $derived.by(() => {
|
|
106
|
-
let html = player.getItemBodyHtml();
|
|
107
|
-
const resolvedDeliveryContext = deliveryContext ?? player.getDeliveryContext();
|
|
108
|
-
const stylesheetCss = buildScopedStylesheetCss(resolvedDeliveryContext, itemBodyScopeSelector);
|
|
109
|
-
const effectiveStimulusContent = buildEffectiveStimulusContent(
|
|
110
|
-
resolvedDeliveryContext,
|
|
111
|
-
stimulusContent,
|
|
112
|
-
(content) => player.sanitizeHtmlContent(content)
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
html = injectStimulusContent(html, effectiveStimulusContent);
|
|
116
|
-
if (stylesheetCss) {
|
|
117
|
-
html = `<style data-qti-stylesheets="resolved">${stylesheetCss}</style>${html}`;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Process feedbackInline elements - conditionally show/hide based on outcome values
|
|
121
|
-
html = processFeedbackInline(html, {
|
|
122
|
-
outcomeValues,
|
|
123
|
-
applyHeuristics: heuristics.feedbackTextFormatting,
|
|
124
|
-
wrapWithSpan: false
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
// Wrap all block-level interaction elements with a hidden marker.
|
|
128
|
-
// Matches both QTI 2.x camelCase (*Interaction) and QTI 3.0 kebab-case (qti-*-interaction).
|
|
129
|
-
html = html.replace(
|
|
130
|
-
/<(\w+Interaction|qti-[\w-]+-interaction)(\s[^>]*)?>[\s\S]*?<\/\1>/gi,
|
|
131
|
-
(match, tagName) => {
|
|
132
|
-
const lower = tagName.toLowerCase();
|
|
133
|
-
// Inline interactions are rendered in-flow by the inline render plan.
|
|
134
|
-
if (isInlineInteractionTagName(lower)) {
|
|
135
|
-
return match;
|
|
136
|
-
}
|
|
137
|
-
// Wrap block interactions with a hidden span
|
|
138
|
-
return `<span class="qti-hidden-interaction">${match}</span>`;
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
return html;
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
const inlineSegments = $derived(createInlineRenderPlan(itemBodyHtml, interactions));
|
|
146
|
-
|
|
147
|
-
function getStringResponse(responseId: string): string {
|
|
148
|
-
const response = responses[responseId];
|
|
149
|
-
return typeof response === 'string' ? response : '';
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function handleResponseChange(responseId: string, value: ItemResponseValue) {
|
|
153
|
-
onResponseChange(responseId, value);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Handle qti:change events from web components
|
|
157
|
-
function handleQtiChange(event: QtiChangeDomEvent) {
|
|
158
|
-
const { responseId, value } = event.detail;
|
|
159
|
-
handleResponseChange(responseId, value);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// In runes mode, prefer explicit DOM listener wiring to avoid edge cases with
|
|
163
|
-
// custom events bubbling out of shadow DOM (and to keep typing sane for dynamic elements).
|
|
164
|
-
let rootEl: HTMLDivElement | null = $state(null);
|
|
165
|
-
$effect(() => {
|
|
166
|
-
if (!rootEl) return;
|
|
167
|
-
player.applyPnp(rootEl);
|
|
168
|
-
const handler = (e: Event) => handleQtiChange(e as QtiChangeDomEvent);
|
|
169
|
-
const el = rootEl; // Capture reference for cleanup
|
|
170
|
-
el.addEventListener('qti-change', handler as EventListener);
|
|
171
|
-
return () => {
|
|
172
|
-
el.removeEventListener('qti-change', handler as EventListener);
|
|
173
|
-
};
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// Ensure web-component instances are not accidentally reused across items when
|
|
177
|
-
// different items share the same responseId (common in QTI demos: "RESPONSE").
|
|
178
|
-
function interactionKey(interaction: InteractionData): string {
|
|
179
|
-
const anyInteraction = interaction as any;
|
|
180
|
-
const ids =
|
|
181
|
-
Array.isArray(anyInteraction?.choices) && anyInteraction.choices.length > 0
|
|
182
|
-
? anyInteraction.choices.map((c: any) => c?.identifier).filter(Boolean).join(',')
|
|
183
|
-
: '';
|
|
184
|
-
// Include prompt if present to further reduce accidental reuse.
|
|
185
|
-
const prompt = typeof anyInteraction?.prompt === 'string' ? anyInteraction.prompt : '';
|
|
186
|
-
return `${interaction.type}|${interaction.responseId}|${ids}|${prompt}`;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Action to set typeset and i18n on web components when they mount
|
|
190
|
-
function setWebComponentProps(
|
|
191
|
-
node: HTMLElement,
|
|
192
|
-
params: {
|
|
193
|
-
i18n?: I18nProvider;
|
|
194
|
-
typeset?: (el: HTMLElement) => void;
|
|
195
|
-
[key: string]: unknown;
|
|
196
|
-
}
|
|
197
|
-
) {
|
|
198
|
-
// Use microtask to ensure custom element is fully initialized
|
|
199
|
-
queueMicrotask(() => {
|
|
200
|
-
if (!node) return;
|
|
201
|
-
assignProps(node, params);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
update(
|
|
206
|
-
newParams: {
|
|
207
|
-
i18n?: I18nProvider;
|
|
208
|
-
typeset?: (el: HTMLElement) => void;
|
|
209
|
-
[key: string]: unknown;
|
|
210
|
-
}
|
|
211
|
-
) {
|
|
212
|
-
assignProps(node, newParams);
|
|
213
|
-
},
|
|
214
|
-
destroy() {}
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
</script>
|
|
218
|
-
|
|
219
|
-
<div
|
|
220
|
-
bind:this={rootEl}
|
|
221
|
-
class="qti-item-body"
|
|
222
|
-
data-qti-item-body-scope={itemBodyScope}
|
|
223
|
-
use:typesetAction={{ typeset }}
|
|
224
|
-
use:glossaryAction={{ player }}
|
|
225
|
-
>
|
|
226
|
-
<!-- Item body with inline interactions -->
|
|
227
|
-
<div class="prose max-w-none mb-4">
|
|
228
|
-
<div class="inline-interaction-container">
|
|
229
|
-
{#each inlineSegments as segment}
|
|
230
|
-
{#if segment.type === 'html'}
|
|
231
|
-
{@html segment.content}
|
|
232
|
-
{:else if segment.type === 'textEntry'}
|
|
233
|
-
{@const correctAnswer = roleCapabilities.canViewCorrectResponses ? (correctResponses[segment.interaction.responseId] ?? null) : null}
|
|
234
|
-
<InlineTextEntry
|
|
235
|
-
interaction={segment.interaction}
|
|
236
|
-
response={getStringResponse(segment.interaction.responseId)}
|
|
237
|
-
correctAnswer={roleCapabilities.canViewCorrectResponses ? correctAnswer : null}
|
|
238
|
-
disabled={effectiveDisabled}
|
|
239
|
-
{i18n}
|
|
240
|
-
onResponseChange={handleResponseChange}
|
|
241
|
-
/>
|
|
242
|
-
{:else if segment.type === 'inlineChoice'}
|
|
243
|
-
{@const correctAnswer = roleCapabilities.canViewCorrectResponses ? (correctResponses[segment.interaction.responseId] ?? null) : null}
|
|
244
|
-
<InlineChoice
|
|
245
|
-
interaction={segment.interaction}
|
|
246
|
-
response={getStringResponse(segment.interaction.responseId)}
|
|
247
|
-
correctAnswer={roleCapabilities.canViewCorrectResponses ? correctAnswer : null}
|
|
248
|
-
disabled={effectiveDisabled}
|
|
249
|
-
{i18n}
|
|
250
|
-
onResponseChange={handleResponseChange}
|
|
251
|
-
/>
|
|
252
|
-
{/if}
|
|
253
|
-
{/each}
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
256
|
-
|
|
257
|
-
<!-- Block interactions rendered dynamically as web components -->
|
|
258
|
-
{#each interactionComponents as { interaction, tagName } (interactionKey(interaction))}
|
|
259
|
-
{@const correctRespForInteraction = correctResponses[interaction.responseId] ?? null}
|
|
260
|
-
<svelte:element
|
|
261
|
-
this={tagName}
|
|
262
|
-
use:setWebComponentProps={{
|
|
263
|
-
i18n,
|
|
264
|
-
typeset,
|
|
265
|
-
interaction,
|
|
266
|
-
response: responses[interaction.responseId] ?? null,
|
|
267
|
-
correctResponse: roleCapabilities.canViewCorrectResponses ? correctRespForInteraction : null,
|
|
268
|
-
pnp: player.getPnp(),
|
|
269
|
-
eliminationTool: player.getPnp()?.cognitive?.eliminationTool === true,
|
|
270
|
-
disabled: effectiveDisabled,
|
|
271
|
-
// Avoid invalid ARIA role values on custom-element hosts.
|
|
272
|
-
// Components default to candidate when role is omitted.
|
|
273
|
-
role: roleCapabilities.canViewCorrectResponses ? 'scorer' : undefined,
|
|
274
|
-
}}
|
|
275
|
-
/>
|
|
276
|
-
{/each}
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
<style>
|
|
280
|
-
/* Allow the whole item body to shrink inside flex/grid layouts (prevents overflow). */
|
|
281
|
-
.qti-item-body {
|
|
282
|
-
max-width: 100%;
|
|
283
|
-
min-width: 0;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/*
|
|
287
|
-
* Custom elements default to inline; force them to be block-level and width-contained.
|
|
288
|
-
* This prevents wide interactions (SVGs, tables, canvases) from spilling outside panels.
|
|
289
|
-
*/
|
|
290
|
-
:global(.qti-item-body :is(
|
|
291
|
-
pie-qti-choice,
|
|
292
|
-
pie-qti-slider,
|
|
293
|
-
pie-qti-order,
|
|
294
|
-
pie-qti-match,
|
|
295
|
-
pie-qti-associate,
|
|
296
|
-
pie-qti-gap-match,
|
|
297
|
-
pie-qti-hotspot,
|
|
298
|
-
pie-qti-hottext,
|
|
299
|
-
pie-qti-media,
|
|
300
|
-
pie-qti-custom,
|
|
301
|
-
pie-qti-end-attempt,
|
|
302
|
-
pie-qti-position-object,
|
|
303
|
-
pie-qti-graphic-gap-match,
|
|
304
|
-
pie-qti-graphic-order,
|
|
305
|
-
pie-qti-graphic-associate,
|
|
306
|
-
pie-qti-select-point,
|
|
307
|
-
pie-qti-extended-text
|
|
308
|
-
)) {
|
|
309
|
-
display: block;
|
|
310
|
-
max-width: 100%;
|
|
311
|
-
min-width: 0;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/* Keep inline interactions from breaking paragraph flow */
|
|
315
|
-
.inline-interaction-container :global(p) {
|
|
316
|
-
display: inline;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/*
|
|
320
|
-
* Hide all QTI interaction elements wrapped with qti-hidden-interaction.
|
|
321
|
-
* These are rendered separately as web components above.
|
|
322
|
-
* Keeping them in the HTML (but hidden) makes debugging easier and is fully extensible.
|
|
323
|
-
* Any *Interaction element will be automatically wrapped and hidden - no hardcoded list needed!
|
|
324
|
-
*/
|
|
325
|
-
:global(.qti-item-body .qti-hidden-interaction) {
|
|
326
|
-
display: none !important;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/*
|
|
330
|
-
* Style for inline feedback elements that appear within choice text or other content.
|
|
331
|
-
* Provides visual distinction and spacing for feedback that appears inline with content.
|
|
332
|
-
*/
|
|
333
|
-
:global(.qti-feedback-inline) {
|
|
334
|
-
display: inline-block;
|
|
335
|
-
margin-left: 0.5rem;
|
|
336
|
-
padding-left: 0.5rem;
|
|
337
|
-
border-left: 2px solid var(--color-base-content, currentColor);
|
|
338
|
-
opacity: 0.8;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/* QTI 3.0 Shared Stimulus: stimulus blocks that were prepended before the item body */
|
|
342
|
-
:global(.qti-stimulus-block) {
|
|
343
|
-
margin-bottom: 1rem;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/* QTI 3.0 Shared Vocabulary: qti-input-width-N sets minimum input width in character units. */
|
|
347
|
-
:global(.qti-input-width-1) { min-width: 1ch; }
|
|
348
|
-
:global(.qti-input-width-2) { min-width: 2ch; }
|
|
349
|
-
:global(.qti-input-width-3) { min-width: 3ch; }
|
|
350
|
-
:global(.qti-input-width-4) { min-width: 4ch; }
|
|
351
|
-
:global(.qti-input-width-5) { min-width: 5ch; }
|
|
352
|
-
:global(.qti-input-width-6) { min-width: 6ch; }
|
|
353
|
-
:global(.qti-input-width-10) { min-width: 10ch; }
|
|
354
|
-
:global(.qti-input-width-15) { min-width: 15ch; }
|
|
355
|
-
:global(.qti-input-width-20) { min-width: 20ch; }
|
|
356
|
-
:global(.qti-input-width-25) { min-width: 25ch; }
|
|
357
|
-
:global(.qti-input-width-30) { min-width: 30ch; }
|
|
358
|
-
:global(.qti-input-width-35) { min-width: 35ch; }
|
|
359
|
-
:global(.qti-input-width-40) { min-width: 40ch; }
|
|
360
|
-
:global(.qti-input-width-45) { min-width: 45ch; }
|
|
361
|
-
:global(.qti-input-width-50) { min-width: 50ch; }
|
|
362
|
-
:global(.qti-input-width-72) { min-width: 72ch; }
|
|
363
|
-
</style>
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Player } from '../core/Player';
|
|
3
|
-
import type { AdaptiveAttemptResult, ModalFeedback, PlayerSecurityConfig, QTIRole, ScoringResult } from '../types';
|
|
4
|
-
import type { InteractionResponseValue } from '../web-components';
|
|
5
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
6
|
-
import { typesetMathInElement } from '@pie-qti/typeset-katex';
|
|
7
|
-
import ItemBody from './ItemBody.svelte';
|
|
8
|
-
import ModalFeedbackDisplay from './ModalFeedbackDisplay.svelte';
|
|
9
|
-
|
|
10
|
-
type ItemResponseValue = InteractionResponseValue | null;
|
|
11
|
-
type ItemResponseMap = Record<string, ItemResponseValue>;
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
itemXml: string;
|
|
15
|
-
role?: QTIRole;
|
|
16
|
-
/** Optional security config (URL policy, embed allowances, Trusted Types). */
|
|
17
|
-
security?: PlayerSecurityConfig;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
typeset?: (element: HTMLElement) => void;
|
|
20
|
-
i18n?: I18nProvider;
|
|
21
|
-
onResponseChange?: (responseId: string, value: ItemResponseValue) => void;
|
|
22
|
-
onSubmit?: (responses: ItemResponseMap, scoringResult: ScoringResult) => void;
|
|
23
|
-
/** Called when adaptive item completes (all attempts exhausted) */
|
|
24
|
-
onComplete?: (finalResult: AdaptiveAttemptResult) => void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let {
|
|
28
|
-
itemXml,
|
|
29
|
-
role = 'candidate',
|
|
30
|
-
security,
|
|
31
|
-
disabled = false,
|
|
32
|
-
typeset,
|
|
33
|
-
i18n,
|
|
34
|
-
onResponseChange,
|
|
35
|
-
onSubmit,
|
|
36
|
-
onComplete,
|
|
37
|
-
}: Props = $props();
|
|
38
|
-
|
|
39
|
-
// Use host-provided typeset if given, otherwise fall back to the built-in KaTeX typesetter.
|
|
40
|
-
const effectiveTypeset = $derived(typeset ?? typesetMathInElement);
|
|
41
|
-
|
|
42
|
-
// Create player instance
|
|
43
|
-
let player = $state<Player | null>(null);
|
|
44
|
-
let responses = $state<ItemResponseMap>({});
|
|
45
|
-
let error = $state<string | null>(null);
|
|
46
|
-
let modalFeedback = $state<ModalFeedback[]>([]);
|
|
47
|
-
let outcomeValues = $state<Record<string, any>>({});
|
|
48
|
-
let isAdaptive = $state(false);
|
|
49
|
-
let isCompleted = $state(false);
|
|
50
|
-
let numAttempts = $state(0);
|
|
51
|
-
|
|
52
|
-
// Initialize player when XML changes
|
|
53
|
-
$effect(() => {
|
|
54
|
-
try {
|
|
55
|
-
player = new Player({ itemXml, role, security });
|
|
56
|
-
error = null;
|
|
57
|
-
// Reset state when XML changes
|
|
58
|
-
responses = {};
|
|
59
|
-
modalFeedback = [];
|
|
60
|
-
outcomeValues = {};
|
|
61
|
-
isAdaptive = player.isAdaptive();
|
|
62
|
-
isCompleted = player.isCompleted();
|
|
63
|
-
numAttempts = player.getNumAttempts();
|
|
64
|
-
} catch (e) {
|
|
65
|
-
error = e instanceof Error ? e.message : (i18n?.t('item.parsingError') ?? 'item.parsingError');
|
|
66
|
-
player = null;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
function handleResponseChange(responseId: string, value: ItemResponseValue) {
|
|
71
|
-
responses = { ...responses, [responseId]: value };
|
|
72
|
-
onResponseChange?.(responseId, value);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function handleSubmit(countAttempt: boolean = true) {
|
|
76
|
-
if (!player) return;
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
// Set responses in player
|
|
80
|
-
player.setResponses(responses);
|
|
81
|
-
|
|
82
|
-
// For adaptive items, use submitAttempt()
|
|
83
|
-
if (isAdaptive && !isCompleted) {
|
|
84
|
-
const result = player.submitAttempt(countAttempt);
|
|
85
|
-
|
|
86
|
-
// Update state
|
|
87
|
-
numAttempts = result.numAttempts;
|
|
88
|
-
isCompleted = result.completed;
|
|
89
|
-
modalFeedback = result.modalFeedback || [];
|
|
90
|
-
outcomeValues = result.outcomeValues || {};
|
|
91
|
-
|
|
92
|
-
// Notify parent
|
|
93
|
-
onSubmit?.(responses, result);
|
|
94
|
-
|
|
95
|
-
// If completed, notify parent
|
|
96
|
-
if (result.completed && onComplete) {
|
|
97
|
-
onComplete(result);
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
// Non-adaptive item: use standard processResponses()
|
|
101
|
-
const result = player.processResponses();
|
|
102
|
-
modalFeedback = result.modalFeedback || [];
|
|
103
|
-
outcomeValues = result.outcomeValues || {};
|
|
104
|
-
onSubmit?.(responses, result);
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {
|
|
107
|
-
error = e instanceof Error ? e.message : (i18n?.t('item.processingError') ?? 'item.processingError');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function closeFeedback() {
|
|
112
|
-
modalFeedback = [];
|
|
113
|
-
}
|
|
114
|
-
</script>
|
|
115
|
-
|
|
116
|
-
<div class="qti-item-player">
|
|
117
|
-
{#if error}
|
|
118
|
-
<div class="alert alert-error">
|
|
119
|
-
<span>{error}</span>
|
|
120
|
-
</div>
|
|
121
|
-
{:else if player}
|
|
122
|
-
<ItemBody
|
|
123
|
-
{player}
|
|
124
|
-
{responses}
|
|
125
|
-
{disabled}
|
|
126
|
-
{role}
|
|
127
|
-
typeset={effectiveTypeset}
|
|
128
|
-
{i18n}
|
|
129
|
-
{outcomeValues}
|
|
130
|
-
onResponseChange={handleResponseChange}
|
|
131
|
-
/>
|
|
132
|
-
|
|
133
|
-
{#if role === 'candidate' && !disabled && onSubmit}
|
|
134
|
-
{@const canSubmit = player.canSubmitResponses(responses)}
|
|
135
|
-
<div class="mt-6 flex items-center gap-4">
|
|
136
|
-
<button
|
|
137
|
-
class="btn btn-primary"
|
|
138
|
-
onclick={() => handleSubmit(true)}
|
|
139
|
-
disabled={isCompleted || !canSubmit}
|
|
140
|
-
>
|
|
141
|
-
{isAdaptive && isCompleted ? (i18n?.t('item.completed') ?? 'item.completed') : (i18n?.t('item.submit') ?? 'item.submit')}
|
|
142
|
-
</button>
|
|
143
|
-
|
|
144
|
-
{#if isAdaptive}
|
|
145
|
-
<div class="text-sm text-base-content/70">
|
|
146
|
-
{#if isCompleted}
|
|
147
|
-
<span class="badge badge-success">{i18n?.t('item.complete') ?? 'item.complete'}</span>
|
|
148
|
-
{:else}
|
|
149
|
-
<span>{i18n?.t('item.attempt', { numAttempts: numAttempts + 1 }) ?? `item.attempt (${numAttempts + 1})`}</span>
|
|
150
|
-
{/if}
|
|
151
|
-
</div>
|
|
152
|
-
{/if}
|
|
153
|
-
</div>
|
|
154
|
-
{/if}
|
|
155
|
-
|
|
156
|
-
<!-- Modal feedback display -->
|
|
157
|
-
<ModalFeedbackDisplay feedback={modalFeedback} onClose={closeFeedback} typeset={effectiveTypeset} {i18n} />
|
|
158
|
-
{:else}
|
|
159
|
-
<div class="alert alert-info">
|
|
160
|
-
<span>{i18n?.t('item.loading') ?? 'item.loading'}</span>
|
|
161
|
-
</div>
|
|
162
|
-
{/if}
|
|
163
|
-
</div>
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ModalFeedback } from '../types';
|
|
3
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
4
|
-
import { typesetAction } from './actions/typesetAction';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
feedback: ModalFeedback[];
|
|
8
|
-
onClose?: () => void;
|
|
9
|
-
typeset?: (element: HTMLElement) => void;
|
|
10
|
-
i18n?: I18nProvider;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let { feedback = [], onClose, typeset, i18n }: Props = $props();
|
|
14
|
-
|
|
15
|
-
// Show modal if there's feedback
|
|
16
|
-
const hasActiveFeedback = $derived(feedback.length > 0);
|
|
17
|
-
const modalTitleId = 'item-player-modal-feedback-title';
|
|
18
|
-
const firstTitle = $derived(feedback.find((item) => item.title)?.title);
|
|
19
|
-
|
|
20
|
-
function handleClose() {
|
|
21
|
-
onClose?.();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function handleBackdropClick(e: MouseEvent) {
|
|
25
|
-
// Close when clicking the backdrop (outside the modal content)
|
|
26
|
-
if (e.target === e.currentTarget) {
|
|
27
|
-
handleClose();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
{#if hasActiveFeedback}
|
|
33
|
-
<!-- DaisyUI Modal -->
|
|
34
|
-
<dialog
|
|
35
|
-
open
|
|
36
|
-
class="modal modal-open"
|
|
37
|
-
aria-modal="true"
|
|
38
|
-
aria-labelledby={firstTitle ? modalTitleId : undefined}
|
|
39
|
-
aria-label={firstTitle ? undefined : (i18n?.t('feedback.title') ?? 'Feedback')}
|
|
40
|
-
onclick={handleBackdropClick}
|
|
41
|
-
>
|
|
42
|
-
<div class="modal-box max-w-3xl">
|
|
43
|
-
<!-- Close button -->
|
|
44
|
-
<button
|
|
45
|
-
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
46
|
-
type="button"
|
|
47
|
-
onclick={handleClose}
|
|
48
|
-
aria-label={i18n?.t('feedback.closeFeedback') ?? 'Close feedback'}
|
|
49
|
-
>
|
|
50
|
-
✕
|
|
51
|
-
</button>
|
|
52
|
-
|
|
53
|
-
<!-- Feedback content -->
|
|
54
|
-
{#each feedback as item, index}
|
|
55
|
-
<div class="mb-4 {index < feedback.length - 1 ? 'border-b pb-4' : ''}">
|
|
56
|
-
{#if item.title}
|
|
57
|
-
<h3 id={index === 0 ? modalTitleId : undefined} class="font-bold text-lg mb-2">{item.title}</h3>
|
|
58
|
-
{/if}
|
|
59
|
-
|
|
60
|
-
<!-- Render HTML content with MathJax support -->
|
|
61
|
-
{#if typeset}
|
|
62
|
-
<div
|
|
63
|
-
class="prose max-w-none"
|
|
64
|
-
use:typesetAction={{ typeset }}
|
|
65
|
-
>
|
|
66
|
-
{@html item.content}
|
|
67
|
-
</div>
|
|
68
|
-
{:else}
|
|
69
|
-
<div class="prose max-w-none">
|
|
70
|
-
{@html item.content}
|
|
71
|
-
</div>
|
|
72
|
-
{/if}
|
|
73
|
-
</div>
|
|
74
|
-
{/each}
|
|
75
|
-
|
|
76
|
-
<!-- Action buttons -->
|
|
77
|
-
<div class="modal-action">
|
|
78
|
-
<button class="btn btn-primary" type="button" onclick={handleClose}>
|
|
79
|
-
{i18n?.t('common.continue') ?? 'Continue'}
|
|
80
|
-
</button>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</dialog>
|
|
84
|
-
{/if}
|
|
85
|
-
|
|
86
|
-
<style>
|
|
87
|
-
/* Ensure modal is accessible */
|
|
88
|
-
dialog {
|
|
89
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/* Ensure feedback content is readable */
|
|
93
|
-
.modal-box {
|
|
94
|
-
max-height: 80vh;
|
|
95
|
-
overflow-y: auto;
|
|
96
|
-
}
|
|
97
|
-
</style>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export interface TypesetActionParams {
|
|
2
|
-
/**
|
|
3
|
-
* Typeset function provided by the host app (KaTeX, MathJax, etc).
|
|
4
|
-
* It should be idempotent or at least safe to call repeatedly on updates.
|
|
5
|
-
* Optional - if not provided, the action is a no-op.
|
|
6
|
-
*/
|
|
7
|
-
typeset?: (root: HTMLElement) => void | Promise<void>;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Observe subtree changes and re-typeset automatically.
|
|
11
|
-
* Default: true
|
|
12
|
-
*/
|
|
13
|
-
observe?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Generic Svelte action that calls `params.typeset(node)` initially and on DOM updates.
|
|
18
|
-
*
|
|
19
|
-
* This is intentionally dependency-free so the player/components can be used
|
|
20
|
-
* outside the example app without pulling in a math engine.
|
|
21
|
-
*/
|
|
22
|
-
export function typesetAction(node: HTMLElement, params: TypesetActionParams) {
|
|
23
|
-
const isBrowser = typeof window !== 'undefined' && typeof MutationObserver !== 'undefined';
|
|
24
|
-
if (!isBrowser) return { update() {}, destroy() {} };
|
|
25
|
-
|
|
26
|
-
let disposed = false;
|
|
27
|
-
let scheduled = false;
|
|
28
|
-
let observer: MutationObserver | null = null;
|
|
29
|
-
let current = params;
|
|
30
|
-
|
|
31
|
-
const schedule = () => {
|
|
32
|
-
if (disposed || scheduled || !current.typeset) return;
|
|
33
|
-
scheduled = true;
|
|
34
|
-
requestAnimationFrame(async () => {
|
|
35
|
-
scheduled = false;
|
|
36
|
-
if (disposed || !current.typeset) return;
|
|
37
|
-
try {
|
|
38
|
-
await current.typeset(node);
|
|
39
|
-
} catch {
|
|
40
|
-
// ignore typesetting errors; keep raw text
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const startObserver = () => {
|
|
46
|
-
if (observer) return;
|
|
47
|
-
observer = new MutationObserver(() => schedule());
|
|
48
|
-
observer.observe(node, { childList: true, subtree: true, characterData: true });
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const stopObserver = () => {
|
|
52
|
-
observer?.disconnect();
|
|
53
|
-
observer = null;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// initial
|
|
57
|
-
schedule();
|
|
58
|
-
if (current.observe !== false) startObserver();
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
update(next: TypesetActionParams) {
|
|
62
|
-
current = next;
|
|
63
|
-
if (current.observe === false) stopObserver();
|
|
64
|
-
else startObserver();
|
|
65
|
-
schedule();
|
|
66
|
-
},
|
|
67
|
-
destroy() {
|
|
68
|
-
disposed = true;
|
|
69
|
-
stopObserver();
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|