@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,247 +0,0 @@
|
|
|
1
|
-
import type { AttributeNameMapper, ElementNameMapper } from '@pie-qti/qti-common';
|
|
2
|
-
import {
|
|
3
|
-
findAssessmentItem,
|
|
4
|
-
findDescendants,
|
|
5
|
-
findFirstDescendant,
|
|
6
|
-
parseXml,
|
|
7
|
-
serializeXml,
|
|
8
|
-
} from '@pie-qti/qti-processing';
|
|
9
|
-
import { parse } from 'node-html-parser';
|
|
10
|
-
import { enforceItemXmlLimits } from '../core/parsingLimits.js';
|
|
11
|
-
import { normalizeInteractionTypeFromTagName } from '../interactions/modules.js';
|
|
12
|
-
import type { PlayerSecurityConfig } from '../types/index.js';
|
|
13
|
-
import type { QTIElement } from '../types/interactions.js';
|
|
14
|
-
|
|
15
|
-
export type ProcessingKind = 'template' | 'response' | 'outcome';
|
|
16
|
-
|
|
17
|
-
export interface DiscoveredInteractionElement {
|
|
18
|
-
element: QTIElement;
|
|
19
|
-
contextRoot: QTIElement;
|
|
20
|
-
responseIdentifier: string;
|
|
21
|
-
normalizedType: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface AssessmentItemDocumentInput {
|
|
25
|
-
itemXml: string;
|
|
26
|
-
elementNameMapper: ElementNameMapper;
|
|
27
|
-
attributeNameMapper: AttributeNameMapper;
|
|
28
|
-
security?: PlayerSecurityConfig;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class AssessmentItemDocument {
|
|
32
|
-
private readonly itemXml: string;
|
|
33
|
-
private readonly security?: PlayerSecurityConfig;
|
|
34
|
-
private readonly mathMlPrefixes: Set<string>;
|
|
35
|
-
readonly elementNameMapper: ElementNameMapper;
|
|
36
|
-
readonly attributeNameMapper: AttributeNameMapper;
|
|
37
|
-
private readonly xmlDocument: Document;
|
|
38
|
-
private readonly assessmentItem: Element;
|
|
39
|
-
private extractionDocument: QTIElement | null = null;
|
|
40
|
-
private extractionRoot: QTIElement | null = null;
|
|
41
|
-
|
|
42
|
-
constructor({
|
|
43
|
-
itemXml,
|
|
44
|
-
elementNameMapper,
|
|
45
|
-
attributeNameMapper,
|
|
46
|
-
security,
|
|
47
|
-
}: AssessmentItemDocumentInput) {
|
|
48
|
-
this.itemXml = itemXml;
|
|
49
|
-
this.security = security;
|
|
50
|
-
this.mathMlPrefixes = findMathMlPrefixes(itemXml);
|
|
51
|
-
this.elementNameMapper = elementNameMapper;
|
|
52
|
-
this.attributeNameMapper = attributeNameMapper;
|
|
53
|
-
|
|
54
|
-
enforceItemXmlLimits(this.itemXml, this.security);
|
|
55
|
-
this.xmlDocument = parseXml(this.itemXml);
|
|
56
|
-
this.assessmentItem = findAssessmentItem(this.xmlDocument);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getAssessmentItem(): Element {
|
|
60
|
-
return this.assessmentItem;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getProcessingElement(kind: ProcessingKind): Element | null {
|
|
64
|
-
const tagName =
|
|
65
|
-
kind === 'template'
|
|
66
|
-
? 'templateprocessing'
|
|
67
|
-
: kind === 'response'
|
|
68
|
-
? 'responseprocessing'
|
|
69
|
-
: 'outcomeprocessing';
|
|
70
|
-
return findFirstDescendant(this.assessmentItem, this.elementNameMapper.toNative(tagName));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
serializeItemBodyChildren(): string {
|
|
74
|
-
const itemBody = this.getItemBodyElement();
|
|
75
|
-
if (!itemBody) return '';
|
|
76
|
-
return this.serializeChildren(itemBody);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
findRubricElements(): Element[] {
|
|
80
|
-
return findDescendants(this.assessmentItem, this.elementNameMapper.toNative('rubricblock'));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
findModalFeedbackElements(): Element[] {
|
|
84
|
-
return findDescendants(this.assessmentItem, this.elementNameMapper.toNative('modalfeedback'));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
findDeclarationElements(kind: 'response' | 'outcome' | 'template'): Element[] {
|
|
88
|
-
const tagName =
|
|
89
|
-
kind === 'response'
|
|
90
|
-
? 'responsedeclaration'
|
|
91
|
-
: kind === 'outcome'
|
|
92
|
-
? 'outcomedeclaration'
|
|
93
|
-
: 'templatedeclaration';
|
|
94
|
-
return findDescendants(this.assessmentItem, this.elementNameMapper.toNative(tagName));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
getAssessmentItemAttribute(name: string): string | null {
|
|
98
|
-
return this.assessmentItem.getAttribute(this.attributeNameMapper.toNative(name));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
serializeChildren(element: Element): string {
|
|
102
|
-
return normalizeMathMlPrefixes(
|
|
103
|
-
unwrapCdataSections(this.serializeChildNodes(element)),
|
|
104
|
-
this.mathMlPrefixes
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
findExtractionElements(elementTypes: Iterable<string>): DiscoveredInteractionElement[] {
|
|
109
|
-
const root = this.getExtractionRoot();
|
|
110
|
-
if (!root) return [];
|
|
111
|
-
|
|
112
|
-
const canonicalTypes = new Set(
|
|
113
|
-
[...elementTypes].map((elementType) => this.elementNameMapper.toCanonical(elementType))
|
|
114
|
-
);
|
|
115
|
-
const elements: DiscoveredInteractionElement[] = [];
|
|
116
|
-
|
|
117
|
-
this.walkExtractionChildren(root, (element) => {
|
|
118
|
-
const rawTagName = element.rawTagName;
|
|
119
|
-
if (!rawTagName) return;
|
|
120
|
-
if (!canonicalTypes.has(this.elementNameMapper.toCanonical(rawTagName))) return;
|
|
121
|
-
|
|
122
|
-
const responseIdentifier = this.getExtractionResponseIdentifier(element);
|
|
123
|
-
if (!responseIdentifier) return;
|
|
124
|
-
|
|
125
|
-
elements.push({
|
|
126
|
-
element,
|
|
127
|
-
contextRoot: root,
|
|
128
|
-
responseIdentifier,
|
|
129
|
-
normalizedType: normalizeInteractionTypeFromTagName(rawTagName),
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
return elements;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private getExtractionRoot(): QTIElement | null {
|
|
137
|
-
if (this.extractionRoot) return this.extractionRoot;
|
|
138
|
-
|
|
139
|
-
const docRoot = this.getExtractionDocument();
|
|
140
|
-
const itemBodyTag = this.elementNameMapper.toNative('itembody').toLowerCase();
|
|
141
|
-
this.extractionRoot = (docRoot.querySelector?.(itemBodyTag) as QTIElement | null) ?? null;
|
|
142
|
-
return this.extractionRoot;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
private getExtractionDocument(): QTIElement {
|
|
146
|
-
if (!this.extractionDocument) {
|
|
147
|
-
enforceItemXmlLimits(this.itemXml, this.security);
|
|
148
|
-
this.extractionDocument = parse(this.serializeItemBodyForExtraction(), {
|
|
149
|
-
lowerCaseTagName: false,
|
|
150
|
-
comment: false,
|
|
151
|
-
}) as unknown as QTIElement;
|
|
152
|
-
}
|
|
153
|
-
return this.extractionDocument;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
private getItemBodyElement(): Element | null {
|
|
157
|
-
return findFirstDescendant(
|
|
158
|
-
this.assessmentItem,
|
|
159
|
-
this.elementNameMapper.toNative('itembody')
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
private serializeItemBodyForExtraction(): string {
|
|
164
|
-
const itemBodyTag = this.elementNameMapper.toNative('itembody');
|
|
165
|
-
const itemBody = this.getItemBodyElement();
|
|
166
|
-
const itemBodyChildren = itemBody ? this.serializeChildren(itemBody) : '';
|
|
167
|
-
|
|
168
|
-
return `<assessmentItem><${itemBodyTag}>${itemBodyChildren}</${itemBodyTag}></assessmentItem>`;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
private serializeChildNodes(element: Element): string {
|
|
172
|
-
const children = (element as any).childNodes as NodeListOf<Node> | undefined;
|
|
173
|
-
if (!children) return '';
|
|
174
|
-
|
|
175
|
-
const serialized: string[] = [];
|
|
176
|
-
for (let index = 0; index < children.length; index++) {
|
|
177
|
-
const child = children[index];
|
|
178
|
-
if (child) {
|
|
179
|
-
serialized.push(serializeXml(child));
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return serialized.join('');
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
private walkExtractionChildren(root: QTIElement, visit: (element: QTIElement) => void): void {
|
|
187
|
-
for (const child of root.childNodes ?? []) {
|
|
188
|
-
const element = child as QTIElement;
|
|
189
|
-
if (!element.rawTagName) continue;
|
|
190
|
-
visit(element);
|
|
191
|
-
this.walkExtractionChildren(element, visit);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private getExtractionResponseIdentifier(element: QTIElement): string {
|
|
196
|
-
const nativeName = this.attributeNameMapper.toNative('responseIdentifier');
|
|
197
|
-
return (
|
|
198
|
-
element.getAttribute?.('responseIdentifier') ||
|
|
199
|
-
element.getAttribute?.(nativeName) ||
|
|
200
|
-
element.getAttribute?.('response-identifier') ||
|
|
201
|
-
element.getAttribute?.('responseidentifier') ||
|
|
202
|
-
''
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export function parseAssessmentItemDocument(input: AssessmentItemDocumentInput): AssessmentItemDocument {
|
|
208
|
-
return new AssessmentItemDocument(input);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function unwrapCdataSections(xml: string): string {
|
|
212
|
-
return xml.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, (_match, content: string) => content);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function findMathMlPrefixes(xml: string): Set<string> {
|
|
216
|
-
const prefixes = new Set<string>();
|
|
217
|
-
for (const match of xml.matchAll(
|
|
218
|
-
/\sxmlns:([A-Za-z_][\w.-]*)=(["'])http:\/\/www\.w3\.org\/1998\/Math\/MathML\2/g
|
|
219
|
-
)) {
|
|
220
|
-
const prefix = match[1];
|
|
221
|
-
if (prefix) {
|
|
222
|
-
prefixes.add(prefix);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return prefixes;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function normalizeMathMlPrefixes(xml: string, prefixes: Set<string>): string {
|
|
229
|
-
let normalized = xml;
|
|
230
|
-
for (const prefix of prefixes) {
|
|
231
|
-
const escapedPrefix = escapeRegExp(prefix);
|
|
232
|
-
normalized = normalized
|
|
233
|
-
.replace(new RegExp(`(<\\/?)${escapedPrefix}:([A-Za-z][\\w.-]*)(?=[\\s>/])`, 'g'), '$1$2')
|
|
234
|
-
.replace(
|
|
235
|
-
new RegExp(
|
|
236
|
-
`\\sxmlns:${escapedPrefix}=(["'])http:\\/\\/www\\.w3\\.org\\/1998\\/Math\\/MathML\\1`,
|
|
237
|
-
'g'
|
|
238
|
-
),
|
|
239
|
-
''
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
return normalized;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function escapeRegExp(value: string): string {
|
|
246
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
247
|
-
}
|
package/src/element.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pie-qti-item-player custom element.
|
|
3
|
-
*
|
|
4
|
-
* Side-effect import that registers <pie-qti-item-player>:
|
|
5
|
-
* import '@pie-qti/item-player/element';
|
|
6
|
-
*
|
|
7
|
-
* String/boolean props map to HTML attributes (item-xml, role, disabled).
|
|
8
|
-
* Complex props (typeset, i18n, security, onResponseChange, onSubmit, onComplete)
|
|
9
|
-
* are JS-only properties — set them on the element instance directly.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { mount, unmount } from 'svelte';
|
|
13
|
-
import ItemPlayer from './components/ItemPlayer.svelte';
|
|
14
|
-
import type { AdaptiveAttemptResult, PlayerSecurityConfig, QTIRole } from './types/index.js';
|
|
15
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
16
|
-
|
|
17
|
-
const TAG = 'pie-qti-item-player';
|
|
18
|
-
|
|
19
|
-
class PieQtiItemPlayerElement extends HTMLElement {
|
|
20
|
-
static observedAttributes = ['item-xml', 'role', 'disabled'];
|
|
21
|
-
|
|
22
|
-
#container: HTMLDivElement | null = null;
|
|
23
|
-
#instance: any = null;
|
|
24
|
-
|
|
25
|
-
// Attribute-backed props
|
|
26
|
-
#itemXml = '';
|
|
27
|
-
#role: QTIRole = 'candidate';
|
|
28
|
-
#disabled = false;
|
|
29
|
-
|
|
30
|
-
// JS-only props
|
|
31
|
-
#typeset: ((el: HTMLElement) => void) | undefined;
|
|
32
|
-
#i18n: I18nProvider | undefined;
|
|
33
|
-
#security: PlayerSecurityConfig | undefined;
|
|
34
|
-
#onResponseChange: ((id: string, value: unknown) => void) | undefined;
|
|
35
|
-
#onSubmit: ((responses: Record<string, unknown>, result: unknown) => void) | undefined;
|
|
36
|
-
#onComplete: ((result: AdaptiveAttemptResult) => void) | undefined;
|
|
37
|
-
|
|
38
|
-
// --- JS-only property accessors ---
|
|
39
|
-
|
|
40
|
-
get typeset() { return this.#typeset; }
|
|
41
|
-
set typeset(v: ((el: HTMLElement) => void) | undefined) { this.#typeset = v; this.#update(); }
|
|
42
|
-
|
|
43
|
-
get i18n() { return this.#i18n; }
|
|
44
|
-
set i18n(v: I18nProvider | undefined) { this.#i18n = v; this.#update(); }
|
|
45
|
-
|
|
46
|
-
get security() { return this.#security; }
|
|
47
|
-
set security(v: PlayerSecurityConfig | undefined) { this.#security = v; this.#update(); }
|
|
48
|
-
|
|
49
|
-
get onResponseChange() { return this.#onResponseChange; }
|
|
50
|
-
set onResponseChange(v: ((id: string, value: unknown) => void) | undefined) { this.#onResponseChange = v; this.#update(); }
|
|
51
|
-
|
|
52
|
-
get onSubmit() { return this.#onSubmit; }
|
|
53
|
-
set onSubmit(v: ((responses: Record<string, unknown>, result: unknown) => void) | undefined) { this.#onSubmit = v; this.#update(); }
|
|
54
|
-
|
|
55
|
-
get onComplete() { return this.#onComplete; }
|
|
56
|
-
set onComplete(v: ((result: AdaptiveAttemptResult) => void) | undefined) { this.#onComplete = v; this.#update(); }
|
|
57
|
-
|
|
58
|
-
// --- Lifecycle ---
|
|
59
|
-
|
|
60
|
-
connectedCallback() {
|
|
61
|
-
this.#mount();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
disconnectedCallback() {
|
|
65
|
-
this.#teardown();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
attributeChangedCallback(name: string, _old: string | null, value: string | null) {
|
|
69
|
-
if (name === 'item-xml') this.#itemXml = value ?? '';
|
|
70
|
-
else if (name === 'role') this.#role = (value ?? 'candidate') as QTIRole;
|
|
71
|
-
else if (name === 'disabled') this.#disabled = value !== null;
|
|
72
|
-
this.#update();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// --- Private helpers ---
|
|
76
|
-
|
|
77
|
-
#getProps() {
|
|
78
|
-
return {
|
|
79
|
-
itemXml: this.#itemXml,
|
|
80
|
-
role: this.#role,
|
|
81
|
-
disabled: this.#disabled,
|
|
82
|
-
typeset: this.#typeset,
|
|
83
|
-
i18n: this.#i18n,
|
|
84
|
-
security: this.#security,
|
|
85
|
-
onResponseChange: this.#onResponseChange,
|
|
86
|
-
onSubmit: this.#onSubmit,
|
|
87
|
-
onComplete: this.#onComplete,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
#mount() {
|
|
92
|
-
if (this.#instance) return;
|
|
93
|
-
if (!this.#container) {
|
|
94
|
-
this.#container = document.createElement('div');
|
|
95
|
-
this.#container.style.display = 'contents';
|
|
96
|
-
this.appendChild(this.#container);
|
|
97
|
-
}
|
|
98
|
-
this.#instance = mount(ItemPlayer, { target: this.#container, props: this.#getProps() });
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
#update() {
|
|
102
|
-
if (!this.#instance) return;
|
|
103
|
-
if (typeof this.#instance.$set === 'function') {
|
|
104
|
-
this.#instance.$set(this.#getProps());
|
|
105
|
-
} else {
|
|
106
|
-
// Svelte 5 runes components: remount with new props
|
|
107
|
-
this.#teardown();
|
|
108
|
-
this.#mount();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
#teardown() {
|
|
113
|
-
if (this.#instance) {
|
|
114
|
-
try { unmount(this.#instance); } catch { /* ignore */ }
|
|
115
|
-
this.#instance = null;
|
|
116
|
-
}
|
|
117
|
-
if (this.#container) {
|
|
118
|
-
this.#container.remove();
|
|
119
|
-
this.#container = null;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (!customElements.get(TAG)) {
|
|
125
|
-
customElements.define(TAG, PieQtiItemPlayerElement);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export { PieQtiItemPlayerElement };
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MathLive Editor Extension for TipTap
|
|
3
|
-
*
|
|
4
|
-
* Integrates MathLive (visual math editor) with TipTap's Mathematics extension.
|
|
5
|
-
* Provides a modal dialog with MathLive mathfield for editing LaTeX formulas.
|
|
6
|
-
*
|
|
7
|
-
* Note: MathLive CSS is loaded dynamically to avoid build issues with package exports.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { MathfieldElement } from 'mathlive';
|
|
11
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
12
|
-
|
|
13
|
-
// Import MathLive CSS from the local package
|
|
14
|
-
import 'mathlive/mathlive-static.css';
|
|
15
|
-
|
|
16
|
-
const DEFAULT_MATHLIVE_CSS_URL = ''; // No longer needed - CSS is imported above
|
|
17
|
-
|
|
18
|
-
// Dynamically import MathLive to register the custom element
|
|
19
|
-
let mathLiveLoaded: Promise<void> | null = null;
|
|
20
|
-
|
|
21
|
-
async function ensureMathLiveLoaded(cssUrl: string = DEFAULT_MATHLIVE_CSS_URL): Promise<void> {
|
|
22
|
-
if (!mathLiveLoaded && typeof window !== 'undefined') {
|
|
23
|
-
mathLiveLoaded = (async () => {
|
|
24
|
-
// Import MathLive to register the <math-field> custom element
|
|
25
|
-
await import('mathlive');
|
|
26
|
-
|
|
27
|
-
// CSS is already imported at the top of this file, but allow custom URL if provided
|
|
28
|
-
if (cssUrl && !document.querySelector('link[href*="mathlive"]')) {
|
|
29
|
-
const link = document.createElement('link');
|
|
30
|
-
link.rel = 'stylesheet';
|
|
31
|
-
link.href = cssUrl;
|
|
32
|
-
document.head.appendChild(link);
|
|
33
|
-
}
|
|
34
|
-
})();
|
|
35
|
-
}
|
|
36
|
-
return mathLiveLoaded || Promise.resolve();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface MathLiveEditorOptions {
|
|
40
|
-
/** Called when user confirms the LaTeX input */
|
|
41
|
-
onConfirm: (latex: string) => void;
|
|
42
|
-
/** Called when user cancels */
|
|
43
|
-
onCancel: () => void;
|
|
44
|
-
/** Initial LaTeX value */
|
|
45
|
-
initialLatex?: string;
|
|
46
|
-
/** Whether this is inline or block math */
|
|
47
|
-
isBlock?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Optional MathLive stylesheet URL. Defaults to jsdelivr CDN.
|
|
50
|
-
* Useful for CSP-restricted deployments (serve from your own domain).
|
|
51
|
-
*/
|
|
52
|
-
cssUrl?: string;
|
|
53
|
-
/** Optional i18n provider for translations */
|
|
54
|
-
i18n?: I18nProvider;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Opens a modal dialog with MathLive editor for LaTeX input
|
|
59
|
-
*/
|
|
60
|
-
export async function openMathLiveEditor(options: MathLiveEditorOptions): Promise<() => void> {
|
|
61
|
-
const { onConfirm, onCancel, initialLatex = '', isBlock = false, cssUrl = DEFAULT_MATHLIVE_CSS_URL, i18n } = options;
|
|
62
|
-
|
|
63
|
-
// Ensure MathLive is loaded and registered before creating the mathfield
|
|
64
|
-
await ensureMathLiveLoaded(cssUrl);
|
|
65
|
-
|
|
66
|
-
// Create modal overlay - use DaisyUI modal classes
|
|
67
|
-
const overlay = document.createElement('div');
|
|
68
|
-
overlay.className = 'modal modal-open';
|
|
69
|
-
overlay.style.cssText = `
|
|
70
|
-
position: fixed;
|
|
71
|
-
top: 0;
|
|
72
|
-
left: 0;
|
|
73
|
-
right: 0;
|
|
74
|
-
bottom: 0;
|
|
75
|
-
background: rgba(0, 0, 0, 0.5);
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
justify-content: center;
|
|
79
|
-
z-index: 9999;
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
// Create modal dialog - use DaisyUI modal-box class
|
|
83
|
-
const modal = document.createElement('div');
|
|
84
|
-
modal.className = 'modal-box max-w-2xl';
|
|
85
|
-
modal.style.cssText = `
|
|
86
|
-
padding: 1.5rem;
|
|
87
|
-
position: relative;
|
|
88
|
-
z-index: 10000;
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
// Create header - use DaisyUI font-bold text-lg
|
|
92
|
-
const header = document.createElement('h3');
|
|
93
|
-
header.textContent = isBlock
|
|
94
|
-
? (i18n?.t('interactions.extendedText.insertBlockMath') ?? 'Insert Block Math')
|
|
95
|
-
: (i18n?.t('interactions.extendedText.insertInlineMath') ?? 'Insert Inline Math');
|
|
96
|
-
header.className = 'font-bold text-lg mb-4';
|
|
97
|
-
|
|
98
|
-
// Create form control wrapper
|
|
99
|
-
const formControl = document.createElement('div');
|
|
100
|
-
formControl.className = 'form-control';
|
|
101
|
-
|
|
102
|
-
// Create label for mathfield
|
|
103
|
-
const label = document.createElement('label');
|
|
104
|
-
label.className = 'label';
|
|
105
|
-
const labelText = document.createElement('span');
|
|
106
|
-
labelText.className = 'label-text';
|
|
107
|
-
labelText.textContent = 'Enter your math expression:';
|
|
108
|
-
label.appendChild(labelText);
|
|
109
|
-
|
|
110
|
-
// Create MathLive mathfield - style like DaisyUI input
|
|
111
|
-
const mathfield = document.createElement('math-field') as MathfieldElement;
|
|
112
|
-
mathfield.value = initialLatex;
|
|
113
|
-
mathfield.className = 'input input-bordered w-full';
|
|
114
|
-
mathfield.style.cssText = `
|
|
115
|
-
display: block;
|
|
116
|
-
min-height: 100px;
|
|
117
|
-
padding: 0.75rem;
|
|
118
|
-
font-size: 1.125rem;
|
|
119
|
-
`;
|
|
120
|
-
|
|
121
|
-
// Set MathLive options for better UX via attributes
|
|
122
|
-
// Use 'manual' mode so keyboard only shows when explicitly requested
|
|
123
|
-
mathfield.setAttribute('virtual-keyboard-mode', 'manual');
|
|
124
|
-
mathfield.setAttribute('smart-mode', 'on');
|
|
125
|
-
// Explicitly enable virtual keyboard
|
|
126
|
-
mathfield.setAttribute('use-shared-virtual-keyboard', 'true');
|
|
127
|
-
// Hide the built-in virtual keyboard toggle
|
|
128
|
-
mathfield.setAttribute('virtual-keyboard-toggle-glyph', '');
|
|
129
|
-
|
|
130
|
-
// Inject CSS to ensure virtual keyboard appears above modal and accepts clicks
|
|
131
|
-
const style = document.createElement('style');
|
|
132
|
-
style.textContent = `
|
|
133
|
-
/* Ensure MathLive virtual keyboard appears above the modal and is clickable */
|
|
134
|
-
.ML__keyboard {
|
|
135
|
-
z-index: 10001 !important;
|
|
136
|
-
pointer-events: auto !important;
|
|
137
|
-
}
|
|
138
|
-
/* Hide the built-in keyboard toggle button in the mathfield - try multiple selectors */
|
|
139
|
-
.ML__virtual-keyboard-toggle,
|
|
140
|
-
.ML__keyboard-toggle,
|
|
141
|
-
math-field::part(virtual-keyboard-toggle) {
|
|
142
|
-
display: none !important;
|
|
143
|
-
visibility: hidden !important;
|
|
144
|
-
opacity: 0 !important;
|
|
145
|
-
pointer-events: none !important;
|
|
146
|
-
}
|
|
147
|
-
`;
|
|
148
|
-
document.head.appendChild(style);
|
|
149
|
-
|
|
150
|
-
// Create LaTeX preview label
|
|
151
|
-
const previewLabel = document.createElement('label');
|
|
152
|
-
previewLabel.className = 'label';
|
|
153
|
-
const previewLabelText = document.createElement('span');
|
|
154
|
-
previewLabelText.className = 'label-text';
|
|
155
|
-
previewLabelText.textContent = 'LaTeX source:';
|
|
156
|
-
previewLabel.appendChild(previewLabelText);
|
|
157
|
-
|
|
158
|
-
// Create LaTeX preview/source - use alert info styling
|
|
159
|
-
const latexPreview = document.createElement('div');
|
|
160
|
-
latexPreview.className = 'alert alert-info';
|
|
161
|
-
latexPreview.style.cssText = `
|
|
162
|
-
font-family: 'Monaco', 'Courier New', monospace;
|
|
163
|
-
font-size: 0.875rem;
|
|
164
|
-
word-break: break-all;
|
|
165
|
-
margin-bottom: 1rem;
|
|
166
|
-
`;
|
|
167
|
-
latexPreview.textContent = initialLatex || '(LaTeX will appear here)';
|
|
168
|
-
|
|
169
|
-
// Update preview when mathfield changes
|
|
170
|
-
mathfield.addEventListener('input', () => {
|
|
171
|
-
const latex = mathfield.value;
|
|
172
|
-
latexPreview.textContent = latex || '(LaTeX will appear here)';
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Create button container - use DaisyUI modal-action class
|
|
176
|
-
const buttons = document.createElement('div');
|
|
177
|
-
buttons.className = 'modal-action';
|
|
178
|
-
buttons.style.cssText = 'justify-content: space-between;';
|
|
179
|
-
|
|
180
|
-
// Create left-side buttons (keyboard toggle)
|
|
181
|
-
const leftButtons = document.createElement('div');
|
|
182
|
-
leftButtons.style.cssText = 'display: flex; gap: 0.5rem;';
|
|
183
|
-
|
|
184
|
-
// Create Keyboard Toggle button
|
|
185
|
-
const keyboardBtn = document.createElement('button');
|
|
186
|
-
keyboardBtn.textContent = '⌨️ Keyboard';
|
|
187
|
-
keyboardBtn.type = 'button';
|
|
188
|
-
keyboardBtn.className = 'btn btn-sm btn-outline';
|
|
189
|
-
keyboardBtn.onclick = () => {
|
|
190
|
-
if (mathfield.executeCommand) {
|
|
191
|
-
mathfield.executeCommand('toggleVirtualKeyboard');
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
leftButtons.appendChild(keyboardBtn);
|
|
196
|
-
|
|
197
|
-
// Create right-side buttons (Cancel/Insert)
|
|
198
|
-
const rightButtons = document.createElement('div');
|
|
199
|
-
rightButtons.style.cssText = 'display: flex; gap: 0.5rem;';
|
|
200
|
-
|
|
201
|
-
// Create Cancel button - use DaisyUI classes
|
|
202
|
-
const cancelBtn = document.createElement('button');
|
|
203
|
-
cancelBtn.textContent = 'Cancel';
|
|
204
|
-
cancelBtn.type = 'button';
|
|
205
|
-
cancelBtn.className = 'btn btn-ghost';
|
|
206
|
-
|
|
207
|
-
// Create Insert button - use DaisyUI classes
|
|
208
|
-
const insertBtn = document.createElement('button');
|
|
209
|
-
insertBtn.textContent = initialLatex ? 'Update' : 'Insert';
|
|
210
|
-
insertBtn.type = 'button';
|
|
211
|
-
insertBtn.className = 'btn btn-primary';
|
|
212
|
-
|
|
213
|
-
rightButtons.appendChild(cancelBtn);
|
|
214
|
-
rightButtons.appendChild(insertBtn);
|
|
215
|
-
|
|
216
|
-
// Assemble modal
|
|
217
|
-
buttons.appendChild(leftButtons);
|
|
218
|
-
buttons.appendChild(rightButtons);
|
|
219
|
-
|
|
220
|
-
// Assemble form-control
|
|
221
|
-
formControl.appendChild(label);
|
|
222
|
-
formControl.appendChild(mathfield);
|
|
223
|
-
formControl.appendChild(previewLabel);
|
|
224
|
-
formControl.appendChild(latexPreview);
|
|
225
|
-
|
|
226
|
-
modal.appendChild(header);
|
|
227
|
-
modal.appendChild(formControl);
|
|
228
|
-
modal.appendChild(buttons);
|
|
229
|
-
|
|
230
|
-
overlay.appendChild(modal);
|
|
231
|
-
|
|
232
|
-
// Cleanup function
|
|
233
|
-
const cleanup = () => {
|
|
234
|
-
// Remove event listeners to prevent memory leaks
|
|
235
|
-
cancelBtn.removeEventListener('click', handleCancel);
|
|
236
|
-
insertBtn.removeEventListener('click', handleConfirm);
|
|
237
|
-
document.removeEventListener('keydown', handleEscape);
|
|
238
|
-
overlay.removeEventListener('click', handleOverlayClick);
|
|
239
|
-
|
|
240
|
-
// Hide virtual keyboard before cleanup
|
|
241
|
-
if (mathfield.executeCommand) {
|
|
242
|
-
mathfield.executeCommand('hideVirtualKeyboard');
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Remove DOM elements
|
|
246
|
-
overlay.remove();
|
|
247
|
-
style.remove();
|
|
248
|
-
|
|
249
|
-
// Restore body scroll
|
|
250
|
-
document.body.style.overflow = '';
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
// Event handlers
|
|
254
|
-
const handleCancel = () => {
|
|
255
|
-
cleanup();
|
|
256
|
-
onCancel();
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const handleConfirm = () => {
|
|
260
|
-
const latex = mathfield.value;
|
|
261
|
-
cleanup();
|
|
262
|
-
onConfirm(latex);
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
const handleEscape = (e: KeyboardEvent) => {
|
|
266
|
-
if (e.key === 'Escape') {
|
|
267
|
-
handleCancel();
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const handleOverlayClick = (e: MouseEvent) => {
|
|
272
|
-
// Don't close if clicking on the modal content or virtual keyboard
|
|
273
|
-
const target = e.target as HTMLElement;
|
|
274
|
-
|
|
275
|
-
// Check if click is on overlay background (not modal or keyboard)
|
|
276
|
-
if (target === overlay) {
|
|
277
|
-
// Additional check: don't close if virtual keyboard is open
|
|
278
|
-
// MathLive virtual keyboard has class 'ML__keyboard'
|
|
279
|
-
const virtualKeyboard = document.querySelector('.ML__keyboard');
|
|
280
|
-
if (!virtualKeyboard) {
|
|
281
|
-
handleCancel();
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// Attach event listeners
|
|
287
|
-
cancelBtn.addEventListener('click', handleCancel);
|
|
288
|
-
insertBtn.addEventListener('click', handleConfirm);
|
|
289
|
-
document.addEventListener('keydown', handleEscape);
|
|
290
|
-
overlay.addEventListener('click', handleOverlayClick);
|
|
291
|
-
|
|
292
|
-
// Prevent body scroll when modal is open
|
|
293
|
-
document.body.style.overflow = 'hidden';
|
|
294
|
-
|
|
295
|
-
// Add to DOM
|
|
296
|
-
document.body.appendChild(overlay);
|
|
297
|
-
|
|
298
|
-
// Focus the mathfield (but don't auto-show keyboard)
|
|
299
|
-
setTimeout(() => {
|
|
300
|
-
mathfield.focus();
|
|
301
|
-
// Try to programmatically disable the built-in toggle via options
|
|
302
|
-
try {
|
|
303
|
-
(mathfield as any).setOptions({
|
|
304
|
-
virtualKeyboardToggleGlyph: '',
|
|
305
|
-
});
|
|
306
|
-
} catch (e) {
|
|
307
|
-
// Silently ignore if this API doesn't exist
|
|
308
|
-
}
|
|
309
|
-
}, 100);
|
|
310
|
-
|
|
311
|
-
// Return cleanup function
|
|
312
|
-
return cleanup;
|
|
313
|
-
}
|