@pie-qti/item-player 0.1.15 → 0.1.16
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 +18 -6
- package/dist/core/ComponentRegistry.js +1 -0
- package/dist/core/ComponentRegistry.js.map +1 -1
- package/dist/core/Player.d.ts +4 -0
- package/dist/core/Player.js +296 -89
- package/dist/core/Player.js.map +1 -1
- package/dist/core/declarations.js +11 -4
- package/dist/core/declarations.js.map +1 -1
- package/dist/core/sanitizer.js +119 -1
- package/dist/core/sanitizer.js.map +1 -1
- package/dist/core/shuffle.d.ts +42 -0
- package/dist/core/shuffle.js +83 -0
- package/dist/core/shuffle.js.map +1 -0
- package/dist/core/urlPolicy.js +34 -23
- package/dist/core/urlPolicy.js.map +1 -1
- package/dist/element-class-hT-bDysz.js +6808 -0
- package/dist/element-class-hT-bDysz.js.map +1 -0
- package/dist/element-class.d.ts +73 -0
- package/dist/element-class.js +2 -0
- package/dist/element.d.ts +6 -40
- package/dist/element.js +4 -6299
- package/dist/element.js.map +1 -1
- package/dist/extraction/ExtractionRegistry.js +1 -1
- package/dist/extraction/ExtractionRegistry.js.map +1 -1
- package/dist/extraction/createContext.d.ts +1 -1
- package/dist/extraction/createContext.js +5 -1
- package/dist/extraction/createContext.js.map +1 -1
- package/dist/extraction/interactionExtractionPipeline.d.ts +6 -1
- package/dist/extraction/interactionExtractionPipeline.js +6 -3
- package/dist/extraction/interactionExtractionPipeline.js.map +1 -1
- package/dist/extraction/types.d.ts +10 -0
- package/dist/extraction/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interactions/associate/extractor.js +2 -1
- package/dist/interactions/associate/extractor.js.map +1 -1
- package/dist/interactions/choice/extractor.js +2 -1
- package/dist/interactions/choice/extractor.js.map +1 -1
- package/dist/interactions/custom/extractor.js +22 -2
- package/dist/interactions/custom/extractor.js.map +1 -1
- package/dist/interactions/extended-text/extractor.d.ts +6 -0
- package/dist/interactions/extended-text/extractor.js +40 -6
- package/dist/interactions/extended-text/extractor.js.map +1 -1
- package/dist/interactions/extended-text/index.d.ts +1 -0
- package/dist/interactions/extended-text/index.js +1 -0
- package/dist/interactions/extended-text/index.js.map +1 -1
- package/dist/interactions/extended-text/response.d.ts +31 -0
- package/dist/interactions/extended-text/response.js +193 -0
- package/dist/interactions/extended-text/response.js.map +1 -0
- package/dist/interactions/gap-match/extractor.js +8 -7
- package/dist/interactions/gap-match/extractor.js.map +1 -1
- package/dist/interactions/inline-choice/extractor.js +2 -1
- package/dist/interactions/inline-choice/extractor.js.map +1 -1
- package/dist/interactions/match/extractor.js +3 -2
- package/dist/interactions/match/extractor.js.map +1 -1
- package/dist/interactions/modules.d.ts +4 -0
- package/dist/interactions/modules.js +2 -0
- package/dist/interactions/modules.js.map +1 -1
- package/dist/interactions/order/extractor.js +2 -1
- package/dist/interactions/order/extractor.js.map +1 -1
- package/dist/interactions/portable-custom/extractor.d.ts +3 -2
- package/dist/interactions/portable-custom/extractor.js +66 -25
- package/dist/interactions/portable-custom/extractor.js.map +1 -1
- package/dist/interactions/portable-custom/index.d.ts +1 -1
- package/dist/interactions/portable-custom/index.js.map +1 -1
- package/dist/interactions/portable-custom/types.d.ts +1 -1
- package/dist/interactions/portable-custom/types.js.map +1 -1
- package/dist/interactions/position-object/extractor.d.ts +5 -35
- package/dist/interactions/position-object/extractor.js +58 -153
- package/dist/interactions/position-object/extractor.js.map +1 -1
- package/dist/interactions/shared/types.d.ts +15 -1
- package/dist/interactions/shared/types.js.map +1 -1
- package/dist/pci/PciHost.d.ts +14 -9
- package/dist/pci/PciHost.js +89 -22
- package/dist/pci/PciHost.js.map +1 -1
- package/dist/pci/index.d.ts +3 -0
- package/dist/pci/index.js +3 -0
- package/dist/pci/index.js.map +1 -0
- package/dist/pci/types.d.ts +72 -0
- package/dist/pci/types.js +12 -0
- package/dist/pci/types.js.map +1 -1
- package/dist/presentation/itemPresentationPlan.d.ts +2 -0
- package/dist/presentation/itemPresentationPlan.js +6 -0
- package/dist/presentation/itemPresentationPlan.js.map +1 -1
- package/dist/types/index.d.ts +26 -5
- package/dist/types/index.js.map +1 -1
- package/package.json +15 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/interactions/modules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAA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F,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,IAAY;IAC3D,OAAO,4BAA4B,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,QAAQ,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,IAAY;IAC1D,OAAO,4BAA4B,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,OAAe;IACjE,OAAO,+BAA+B,CAAC,mCAAmC,CAAC,OAAO,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import type { ElementExtractor } from '../extraction/types.js';\nimport type { InteractionDataMap } from './shared/types.js';\nimport { standardAssociateExtractor } from './associate/index.js';\nimport { standardChoiceExtractor } from './choice/index.js';\nimport { standardCustomExtractor } from './custom/index.js';\nimport { standardDrawingExtractor } from './drawing/index.js';\nimport { standardEndAttemptExtractor } from './end-attempt/index.js';\nimport { standardExtendedTextExtractor } from './extended-text/index.js';\nimport { standardGapMatchExtractor } from './gap-match/index.js';\nimport { standardGraphicAssociateExtractor } from './graphic-associate/index.js';\nimport { standardGraphicGapMatchExtractor } from './graphic-gap-match/index.js';\nimport { standardGraphicOrderExtractor } from './graphic-order/index.js';\nimport { standardHotspotExtractor } from './hotspot/index.js';\nimport { standardHottextExtractor } from './hottext/index.js';\nimport { standardInlineChoiceExtractor } from './inline-choice/index.js';\nimport { standardMatchExtractor } from './match/index.js';\nimport { standardMediaExtractor } from './media/index.js';\nimport { standardOrderExtractor } from './order/index.js';\nimport { standardPositionObjectExtractor } from './position-object/index.js';\nimport { standardSelectPointExtractor } from './select-point/index.js';\nimport { standardSliderExtractor } from './slider/index.js';\nimport { standardTextEntryExtractor } from './text-entry/index.js';\nimport { standardUploadExtractor } from './upload/index.js';\n\nexport type StandardInteractionType = keyof InteractionDataMap;\nexport type InteractionPlacement = 'block' | 'inline';\n\nexport interface StandardInteractionModule {\n\ttype: StandardInteractionType;\n\textractor: ElementExtractor;\n\tplacement: InteractionPlacement;\n}\n\nexport const STANDARD_INTERACTION_MODULES = [\n\t{ type: 'choiceInteraction', extractor: standardChoiceExtractor, placement: 'block' },\n\t{ type: 'textEntryInteraction', extractor: standardTextEntryExtractor, placement: 'inline' },\n\t{ type: 'extendedTextInteraction', extractor: standardExtendedTextExtractor, placement: 'block' },\n\t{ type: 'inlineChoiceInteraction', extractor: standardInlineChoiceExtractor, placement: 'inline' },\n\t{ type: 'orderInteraction', extractor: standardOrderExtractor, placement: 'block' },\n\t{ type: 'matchInteraction', extractor: standardMatchExtractor, placement: 'block' },\n\t{ type: 'associateInteraction', extractor: standardAssociateExtractor, placement: 'block' },\n\t{ type: 'gapMatchInteraction', extractor: standardGapMatchExtractor, placement: 'block' },\n\t{ type: 'sliderInteraction', extractor: standardSliderExtractor, placement: 'block' },\n\t{ type: 'hotspotInteraction', extractor: standardHotspotExtractor, placement: 'block' },\n\t{ type: 'graphicGapMatchInteraction', extractor: standardGraphicGapMatchExtractor, placement: 'block' },\n\t{ type: 'uploadInteraction', extractor: standardUploadExtractor, placement: 'block' },\n\t{ type: 'drawingInteraction', extractor: standardDrawingExtractor, placement: 'block' },\n\t{ type: 'customInteraction', extractor: standardCustomExtractor, placement: 'block' },\n\t{ type: 'mediaInteraction', extractor: standardMediaExtractor, placement: 'block' },\n\t{ type: 'hottextInteraction', extractor: standardHottextExtractor, placement: 'block' },\n\t{ type: 'selectPointInteraction', extractor: standardSelectPointExtractor, placement: 'block' },\n\t{ type: 'graphicOrderInteraction', extractor: standardGraphicOrderExtractor, placement: 'block' },\n\t{ type: 'graphicAssociateInteraction', extractor: standardGraphicAssociateExtractor, placement: 'block' },\n\t{ type: 'positionObjectInteraction', extractor: standardPositionObjectExtractor, placement: 'block' },\n\t{ type: 'endAttemptInteraction', extractor: standardEndAttemptExtractor, placement: 'block' },\n] as const satisfies readonly StandardInteractionModule[];\n\nexport function getStandardInteractionModules(): readonly StandardInteractionModule[] {\n\treturn STANDARD_INTERACTION_MODULES;\n}\n\nexport function getStandardBlockInteractionModules(): readonly StandardInteractionModule[] {\n\treturn STANDARD_INTERACTION_MODULES.filter((module) => module.placement === 'block');\n}\n\nexport function getStandardInlineInteractionModules(): readonly StandardInteractionModule[] {\n\treturn STANDARD_INTERACTION_MODULES.filter((module) => module.placement === 'inline');\n}\n\nexport function getStandardInteractionExtractors(): readonly ElementExtractor[] {\n\treturn STANDARD_INTERACTION_MODULES.map((module) => module.extractor);\n}\n\nexport function getStandardInteractionElementTypes(): string[] {\n\tconst elementTypes = new Set<string>();\n\tfor (const module of STANDARD_INTERACTION_MODULES) {\n\t\tfor (const elementType of module.extractor.elementTypes) {\n\t\t\telementTypes.add(elementType);\n\t\t}\n\t}\n\treturn [...elementTypes];\n}\n\nconst STANDARD_TYPE_BY_LOWERCASE = new Map(\n\tSTANDARD_INTERACTION_MODULES.map((module) => [module.type.toLowerCase(), module.type])\n);\n\nexport function normalizeInteractionTypeFromTagName(tagName: string): string {\n\tconst lowerTagName = tagName.toLowerCase();\n\tif (lowerTagName.startsWith('qti-')) {\n\t\treturn lowerTagName.slice(4).replace(/-([a-z])/g, (_match, letter: string) => letter.toUpperCase());\n\t}\n\treturn STANDARD_TYPE_BY_LOWERCASE.get(lowerTagName) ?? tagName;\n}\n\nexport function getStandardInteractionModule(type: string): StandardInteractionModule | null {\n\tconst normalizedType = normalizeInteractionTypeFromTagName(type);\n\treturn STANDARD_INTERACTION_MODULES.find((module) => module.type === normalizedType) ?? null;\n}\n\nexport function isStandardInlineInteractionType(type: string): type is 'textEntryInteraction' | 'inlineChoiceInteraction' {\n\treturn getStandardInteractionModule(type)?.placement === 'inline';\n}\n\nexport function isStandardBlockInteractionType(type: string): boolean {\n\treturn getStandardInteractionModule(type)?.placement === 'block';\n}\n\nexport function isStandardInlineInteractionTagName(tagName: string): boolean {\n\treturn isStandardInlineInteractionType(normalizeInteractionTypeFromTagName(tagName));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":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O,4BAA4B,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,QAAQ,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,IAAY;IAC1D,OAAO,4BAA4B,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,OAAe;IACjE,OAAO,+BAA+B,CAAC,mCAAmC,CAAC,OAAO,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import type { ElementExtractor } from '../extraction/types.js';\nimport type { InteractionDataMap } from './shared/types.js';\nimport { standardAssociateExtractor } from './associate/index.js';\nimport { standardChoiceExtractor } from './choice/index.js';\nimport { standardCustomExtractor } from './custom/index.js';\nimport { standardDrawingExtractor } from './drawing/index.js';\nimport { standardEndAttemptExtractor } from './end-attempt/index.js';\nimport { standardExtendedTextExtractor } from './extended-text/index.js';\nimport { standardGapMatchExtractor } from './gap-match/index.js';\nimport { standardGraphicAssociateExtractor } from './graphic-associate/index.js';\nimport { standardGraphicGapMatchExtractor } from './graphic-gap-match/index.js';\nimport { standardGraphicOrderExtractor } from './graphic-order/index.js';\nimport { standardHotspotExtractor } from './hotspot/index.js';\nimport { standardHottextExtractor } from './hottext/index.js';\nimport { standardInlineChoiceExtractor } from './inline-choice/index.js';\nimport { standardMatchExtractor } from './match/index.js';\nimport { standardMediaExtractor } from './media/index.js';\nimport { standardOrderExtractor } from './order/index.js';\nimport { standardPositionObjectExtractor } from './position-object/index.js';\nimport { portableCustomExtractor } from './portable-custom/index.js';\nimport { standardSelectPointExtractor } from './select-point/index.js';\nimport { standardSliderExtractor } from './slider/index.js';\nimport { standardTextEntryExtractor } from './text-entry/index.js';\nimport { standardUploadExtractor } from './upload/index.js';\n\nexport type StandardInteractionType = keyof InteractionDataMap;\nexport type InteractionPlacement = 'block' | 'inline';\n\nexport interface StandardInteractionModule {\n\ttype: StandardInteractionType;\n\textractor: ElementExtractor;\n\tplacement: InteractionPlacement;\n}\n\nexport const STANDARD_INTERACTION_MODULES = [\n\t{ type: 'choiceInteraction', extractor: standardChoiceExtractor, placement: 'block' },\n\t{ type: 'textEntryInteraction', extractor: standardTextEntryExtractor, placement: 'inline' },\n\t{ type: 'extendedTextInteraction', extractor: standardExtendedTextExtractor, placement: 'block' },\n\t{ type: 'inlineChoiceInteraction', extractor: standardInlineChoiceExtractor, placement: 'inline' },\n\t{ type: 'orderInteraction', extractor: standardOrderExtractor, placement: 'block' },\n\t{ type: 'matchInteraction', extractor: standardMatchExtractor, placement: 'block' },\n\t{ type: 'associateInteraction', extractor: standardAssociateExtractor, placement: 'block' },\n\t{ type: 'gapMatchInteraction', extractor: standardGapMatchExtractor, placement: 'block' },\n\t{ type: 'sliderInteraction', extractor: standardSliderExtractor, placement: 'block' },\n\t{ type: 'hotspotInteraction', extractor: standardHotspotExtractor, placement: 'block' },\n\t{ type: 'graphicGapMatchInteraction', extractor: standardGraphicGapMatchExtractor, placement: 'block' },\n\t{ type: 'uploadInteraction', extractor: standardUploadExtractor, placement: 'block' },\n\t{ type: 'drawingInteraction', extractor: standardDrawingExtractor, placement: 'block' },\n\t{ type: 'customInteraction', extractor: standardCustomExtractor, placement: 'block' },\n\t{ type: 'portableCustomInteraction', extractor: portableCustomExtractor, placement: 'block' },\n\t{ type: 'mediaInteraction', extractor: standardMediaExtractor, placement: 'block' },\n\t{ type: 'hottextInteraction', extractor: standardHottextExtractor, placement: 'block' },\n\t{ type: 'selectPointInteraction', extractor: standardSelectPointExtractor, placement: 'block' },\n\t{ type: 'graphicOrderInteraction', extractor: standardGraphicOrderExtractor, placement: 'block' },\n\t{ type: 'graphicAssociateInteraction', extractor: standardGraphicAssociateExtractor, placement: 'block' },\n\t{ type: 'positionObjectInteraction', extractor: standardPositionObjectExtractor, placement: 'block' },\n\t{ type: 'endAttemptInteraction', extractor: standardEndAttemptExtractor, placement: 'block' },\n] as const satisfies readonly StandardInteractionModule[];\n\nexport function getStandardInteractionModules(): readonly StandardInteractionModule[] {\n\treturn STANDARD_INTERACTION_MODULES;\n}\n\nexport function getStandardBlockInteractionModules(): readonly StandardInteractionModule[] {\n\treturn STANDARD_INTERACTION_MODULES.filter((module) => module.placement === 'block');\n}\n\nexport function getStandardInlineInteractionModules(): readonly StandardInteractionModule[] {\n\treturn STANDARD_INTERACTION_MODULES.filter((module) => module.placement === 'inline');\n}\n\nexport function getStandardInteractionExtractors(): readonly ElementExtractor[] {\n\treturn STANDARD_INTERACTION_MODULES.map((module) => module.extractor);\n}\n\nexport function getStandardInteractionElementTypes(): string[] {\n\tconst elementTypes = new Set<string>();\n\tfor (const module of STANDARD_INTERACTION_MODULES) {\n\t\tfor (const elementType of module.extractor.elementTypes) {\n\t\t\telementTypes.add(elementType);\n\t\t}\n\t}\n\treturn [...elementTypes];\n}\n\nconst STANDARD_TYPE_BY_LOWERCASE = new Map(\n\tSTANDARD_INTERACTION_MODULES.map((module) => [module.type.toLowerCase(), module.type])\n);\n\nexport function normalizeInteractionTypeFromTagName(tagName: string): string {\n\tconst lowerTagName = tagName.toLowerCase();\n\tif (lowerTagName.startsWith('qti-')) {\n\t\treturn lowerTagName.slice(4).replace(/-([a-z])/g, (_match, letter: string) => letter.toUpperCase());\n\t}\n\treturn STANDARD_TYPE_BY_LOWERCASE.get(lowerTagName) ?? tagName;\n}\n\nexport function getStandardInteractionModule(type: string): StandardInteractionModule | null {\n\tconst normalizedType = normalizeInteractionTypeFromTagName(type);\n\treturn STANDARD_INTERACTION_MODULES.find((module) => module.type === normalizedType) ?? null;\n}\n\nexport function isStandardInlineInteractionType(type: string): type is 'textEntryInteraction' | 'inlineChoiceInteraction' {\n\treturn getStandardInteractionModule(type)?.placement === 'inline';\n}\n\nexport function isStandardBlockInteractionType(type: string): boolean {\n\treturn getStandardInteractionModule(type)?.placement === 'block';\n}\n\nexport function isStandardInlineInteractionTagName(tagName: string): boolean {\n\treturn isStandardInlineInteractionType(normalizeInteractionTypeFromTagName(tagName));\n}\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extracts data from orderInteraction elements (ordering/ranking tasks)
|
|
5
5
|
*/
|
|
6
|
+
import { maybeShuffle } from '../../core/shuffle.js';
|
|
6
7
|
/**
|
|
7
8
|
* Standard QTI order interaction extractor
|
|
8
9
|
* Handles orderInteraction elements with simpleChoice children
|
|
@@ -40,7 +41,7 @@ export const standardOrderExtractor = {
|
|
|
40
41
|
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
41
42
|
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);
|
|
42
43
|
return {
|
|
43
|
-
choices,
|
|
44
|
+
choices: maybeShuffle(choices, shuffle, context.shuffleRng),
|
|
44
45
|
shuffle,
|
|
45
46
|
orientation,
|
|
46
47
|
minChoices,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../../src/interactions/order/extractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../../src/interactions/order/extractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAcrD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAgC;IAClE,EAAE,EAAE,uBAAuB;IAC3B,IAAI,EAAE,gCAAgC;IACtC,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,CAAC,kBAAkB,CAAC;IAClC,WAAW,EAAE,iEAAiE;IAE9E,SAAS,CAAC,OAAO,EAAE,OAAO;QACzB,6DAA6D;QAC7D,OAAO,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,CAAC,OAAO,EAAE,OAAO;QACvB,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAE1B,kBAAkB;QAClB,MAAM,aAAa,GAAG,K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QAC1C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;YACrD,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBACnD,QAAQ,CAAC,IAAI,CACZ,gBAAgB,IAAI,CAAC,WAAW,gCAAgC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC/F,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO;YACN,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YAC9C,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;SACpD,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["/**\n * Standard QTI orderInteraction extractor\n *\n * Extracts data from orderInteraction elements (ordering/ranking tasks)\n */\n\nimport type { ElementExtractor } from '../../extraction/types.js';\nimport { maybeShuffle } from '../../core/shuffle.js';\n\n/**\n * Order data extracted from orderInteraction elements\n */\nexport interface OrderData {\n\tchoices: Array<{ identifier: string; text: string; fixed?: boolean; classes?: string[] }>;\n\tshuffle: boolean;\n\tminChoices: number;\n\tmaxChoices: number;\n\torientation?: string;\n\tprompt: string | null;\n}\n\n/**\n * Standard QTI order interaction extractor\n * Handles orderInteraction elements with simpleChoice children\n */\nexport const standardOrderExtractor: ElementExtractor<OrderData> = {\n\tid: 'qti:order-interaction',\n\tname: 'QTI Standard Order Interaction',\n\tpriority: 10,\n\telementTypes: ['orderInteraction'],\n\tdescription: 'Extracts standard QTI orderInteraction (ordering/ranking tasks)',\n\n\tcanHandle(element, context) {\n\t\t// Standard QTI order interactions have simpleChoice children\n\t\treturn context.utils.hasChildWithTag(element, 'simpleChoice');\n\t},\n\n\textract(element, context) {\n\t\tconst { utils } = context;\n\n\t\t// Extract choices\n\t\tconst simpleChoices = utils.getChildrenByTag(element, 'simpleChoice');\n\t\tconst choices = simpleChoices.map((choice) => {\n\t\t\tconst classes = utils.getClasses(choice);\n\t\t\tconst fixed = utils.getBooleanAttribute(choice, 'fixed');\n\n\t\t\treturn {\n\t\t\t\tidentifier: utils.getAttribute(choice, 'identifier', ''),\n\t\t\t\ttext: utils.getHtmlContent(choice),\n\t\t\t\t...(fixed ? { fixed } : {}),\n\t\t\t\t...(classes.length > 0 ? { classes } : {}),\n\t\t\t};\n\t\t});\n\n\t\t// Extract prompt\n\t\tconst promptElement = utils.querySelector(element, 'prompt');\n\t\tconst prompt = promptElement ? utils.getHtmlContent(promptElement) : null;\n\n\t\t// Extract attributes\n\t\tconst shuffle = utils.getBooleanAttribute(element, 'shuffle');\n\t\tconst orientation = utils.getAttribute(element, 'orientation', 'vertical');\n\t\tconst minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n\t\tconst maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);\n\n\t\treturn {\n\t\t\tchoices: maybeShuffle(choices, shuffle, context.shuffleRng),\n\t\t\tshuffle,\n\t\t\torientation,\n\t\t\tminChoices,\n\t\t\tmaxChoices,\n\t\t\tprompt,\n\t\t};\n\t},\n\n\tvalidate(data) {\n\t\tconst errors: string[] = [];\n\t\tconst warnings: string[] = [];\n\n\t\t// Validate choices exist\n\t\tif (!data.choices || data.choices.length < 2) {\n\t\t\terrors.push('orderInteraction must have at least 2 choices');\n\t\t}\n\n\t\t// Warn if too many choices (difficult to order)\n\t\tif (data.choices && data.choices.length > 10) {\n\t\t\twarnings.push(\n\t\t\t\t`orderInteraction has ${data.choices.length} choices - this may be difficult for users to order`\n\t\t\t);\n\t\t}\n\n\t\t// Validate choice identifiers\n\t\tif (data.choices) {\n\t\t\tconst identifiers = new Set<string>();\n\t\t\tfor (const choice of data.choices) {\n\t\t\t\tif (!choice.identifier) {\n\t\t\t\t\terrors.push('All choices must have an identifier');\n\t\t\t\t} else if (identifiers.has(choice.identifier)) {\n\t\t\t\t\terrors.push(`Duplicate choice identifier: ${choice.identifier}`);\n\t\t\t\t} else {\n\t\t\t\t\tidentifiers.add(choice.identifier);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Validate orientation (only if provided)\n\t\tif (data.orientation) {\n\t\t\tconst validOrientations = ['vertical', 'horizontal'];\n\t\t\tif (!validOrientations.includes(data.orientation)) {\n\t\t\t\twarnings.push(\n\t\t\t\t\t`orientation '${data.orientation}' is not standard (expected: ${validOrientations.join(', ')})`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tvalid: errors.length === 0,\n\t\t\terrors: errors.length > 0 ? errors : undefined,\n\t\t\twarnings: warnings.length > 0 ? warnings : undefined,\n\t\t};\n\t},\n};\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ElementExtractor } from '../../extraction/types.js';
|
|
2
2
|
import type { ExtractedPci } from '../../pci/types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Extractor for <qti-portable-custom-interaction> (QTI 3.0) and
|
|
5
|
-
* <portableCustomInteraction>
|
|
4
|
+
* Extractor for <qti-portable-custom-interaction> (QTI 3.0) and the
|
|
5
|
+
* namespaced <pci:portableCustomInteraction> payload inside a QTI 2.x
|
|
6
|
+
* <customInteraction> wrapper.
|
|
6
7
|
*
|
|
7
8
|
* Extracts the module paths, markup, and config properties needed by PciHost
|
|
8
9
|
* to load and initialize the PCI JavaScript module.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Extractor for <qti-portable-custom-interaction> (QTI 3.0) and
|
|
3
|
-
* <portableCustomInteraction>
|
|
2
|
+
* Extractor for <qti-portable-custom-interaction> (QTI 3.0) and the
|
|
3
|
+
* namespaced <pci:portableCustomInteraction> payload inside a QTI 2.x
|
|
4
|
+
* <customInteraction> wrapper.
|
|
4
5
|
*
|
|
5
6
|
* Extracts the module paths, markup, and config properties needed by PciHost
|
|
6
7
|
* to load and initialize the PCI JavaScript module.
|
|
@@ -13,30 +14,42 @@ export const portableCustomExtractor = {
|
|
|
13
14
|
name: 'QTI Portable Custom Interaction',
|
|
14
15
|
priority: 20,
|
|
15
16
|
elementTypes: [
|
|
17
|
+
'customInteraction',
|
|
16
18
|
'portableCustomInteraction',
|
|
17
19
|
'qti-portable-custom-interaction',
|
|
18
20
|
],
|
|
19
|
-
description: 'Extracts QTI 3.0 portable custom interaction module paths, markup, and config',
|
|
21
|
+
description: 'Extracts QTI 2.x/3.0 portable custom interaction module paths, markup, and config',
|
|
20
22
|
canHandle(element, _context) {
|
|
21
|
-
const tag = element
|
|
22
|
-
return (tag === '
|
|
23
|
-
tag === '
|
|
23
|
+
const tag = localTagName(element);
|
|
24
|
+
return (tag === 'portablecustominteraction' ||
|
|
25
|
+
tag === 'qti-portable-custom-interaction' ||
|
|
26
|
+
(tag === 'custominteraction' && findDescendant(element, ['portablecustominteraction']) !== null));
|
|
24
27
|
},
|
|
25
28
|
extract(element, context) {
|
|
26
29
|
const { utils } = context;
|
|
30
|
+
const outerTag = localTagName(element);
|
|
31
|
+
const pciElement = outerTag === 'custominteraction'
|
|
32
|
+
? findDescendant(element, ['portablecustominteraction'])
|
|
33
|
+
: element;
|
|
34
|
+
if (!pciElement) {
|
|
35
|
+
throw new Error('customInteraction does not contain a portableCustomInteraction payload');
|
|
36
|
+
}
|
|
27
37
|
const responseIdentifier = utils.getAttribute(element, 'responseIdentifier') ||
|
|
28
|
-
utils.getAttribute(element, 'response-identifier') ||
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
utils.getAttribute(element, 'response-identifier') ||
|
|
39
|
+
context.responseId ||
|
|
40
|
+
'';
|
|
41
|
+
const customInteractionTypeIdentifier = utils.getAttribute(pciElement, 'customInteractionTypeIdentifier') ||
|
|
42
|
+
utils.getAttribute(pciElement, 'custom-interaction-type-identifier') ||
|
|
43
|
+
utils.getAttribute(pciElement, 'customInteractionIdentifierType') ||
|
|
44
|
+
utils.getAttribute(pciElement, 'custom-interaction-identifier-type') ||
|
|
45
|
+
'';
|
|
31
46
|
// --- Module paths from <qti-interaction-modules>/<qti-interaction-module> ---
|
|
32
47
|
// These element names ARE in the standard QTI 3.0 element mapper so utils.querySelector works.
|
|
33
48
|
let primaryPath = '';
|
|
34
49
|
let fallbackPath;
|
|
35
|
-
const modulesEl =
|
|
36
|
-
utils.querySelector(element, 'interactionmodules');
|
|
50
|
+
const modulesEl = findDescendant(pciElement, ['interactionmodules', 'qti-interaction-modules']);
|
|
37
51
|
if (modulesEl) {
|
|
38
|
-
const moduleEl =
|
|
39
|
-
utils.querySelector(modulesEl, 'interactionmodule');
|
|
52
|
+
const moduleEl = findDescendant(modulesEl, ['interactionmodule', 'qti-interaction-module']);
|
|
40
53
|
if (moduleEl) {
|
|
41
54
|
primaryPath =
|
|
42
55
|
utils.getAttribute(moduleEl, 'primaryPath') ||
|
|
@@ -47,30 +60,35 @@ export const portableCustomExtractor = {
|
|
|
47
60
|
fallbackPath = fb;
|
|
48
61
|
}
|
|
49
62
|
}
|
|
63
|
+
// QTI 2.x PCI v1.0 embeds one or more script hooks in <pci:instance>.
|
|
64
|
+
// The first external script identifies the resource a host resolver must map.
|
|
65
|
+
const instanceEl = findDescendant(pciElement, ['instance']);
|
|
66
|
+
if (!primaryPath && instanceEl) {
|
|
67
|
+
const externalScript = findDescendants(instanceEl, ['script']).find((script) => Boolean(utils.getAttribute(script, 'src')));
|
|
68
|
+
primaryPath = externalScript ? utils.getAttribute(externalScript, 'src') : '';
|
|
69
|
+
}
|
|
50
70
|
// --- Markup from <qti-interaction-markup> ---
|
|
51
|
-
const markupEl =
|
|
52
|
-
|
|
53
|
-
|
|
71
|
+
const markupEl = findDescendant(pciElement, ['interactionmarkup', 'qti-interaction-markup']);
|
|
72
|
+
// sanitizeHtml removes script hooks from the QTI 2.x instance while preserving
|
|
73
|
+
// the authored DOM scaffold that the resolved module initializes.
|
|
74
|
+
const markupSource = markupEl ?? instanceEl;
|
|
75
|
+
const markup = markupSource ? utils.getHtmlContent(markupSource) : '';
|
|
54
76
|
// --- Config from <qti-pci-properties>/<qti-pci-property> ---
|
|
55
77
|
// qti-pci-properties is NOT in the standard QTI 3.0 element mapper, so we use the
|
|
56
78
|
// native node-html-parser querySelector (available as element.querySelector on the raw element).
|
|
57
79
|
const config = {};
|
|
58
|
-
const
|
|
59
|
-
const propsEl = rawEl.querySelector?.('qti-pci-properties') ??
|
|
60
|
-
rawEl.querySelector?.('pciproperties');
|
|
80
|
+
const propsEl = findDescendant(pciElement, ['pciproperties', 'qti-pci-properties']);
|
|
61
81
|
if (propsEl) {
|
|
62
|
-
const propEls = [
|
|
63
|
-
...(propsEl.querySelectorAll?.('qti-pci-property') ?? []),
|
|
64
|
-
...(propsEl.querySelectorAll?.('pciproperty') ?? []),
|
|
65
|
-
];
|
|
82
|
+
const propEls = findDescendants(propsEl, ['pciproperty', 'qti-pci-property']);
|
|
66
83
|
for (const propEl of propEls) {
|
|
67
|
-
const key =
|
|
68
|
-
const value =
|
|
84
|
+
const key = utils.getAttribute(propEl, 'key') || utils.getAttribute(propEl, 'name') || '';
|
|
85
|
+
const value = utils.getAttribute(propEl, 'value') || (propEl.textContent ?? '').trim() || '';
|
|
69
86
|
if (key)
|
|
70
87
|
config[key] = value;
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
return {
|
|
91
|
+
type: 'portableCustomInteraction',
|
|
74
92
|
responseIdentifier,
|
|
75
93
|
customInteractionTypeIdentifier,
|
|
76
94
|
primaryPath,
|
|
@@ -94,4 +112,27 @@ export const portableCustomExtractor = {
|
|
|
94
112
|
return { valid: errors.length === 0, errors: errors.length ? errors : undefined, warnings: warnings.length ? warnings : undefined };
|
|
95
113
|
},
|
|
96
114
|
};
|
|
115
|
+
function localTagName(element) {
|
|
116
|
+
const raw = element.rawTagName?.toLowerCase() ?? '';
|
|
117
|
+
return raw.includes(':') ? raw.slice(raw.lastIndexOf(':') + 1) : raw;
|
|
118
|
+
}
|
|
119
|
+
function findDescendant(element, localNames) {
|
|
120
|
+
return findDescendants(element, localNames)[0] ?? null;
|
|
121
|
+
}
|
|
122
|
+
function findDescendants(element, localNames) {
|
|
123
|
+
const expected = new Set(localNames.map((name) => name.toLowerCase()));
|
|
124
|
+
const matches = [];
|
|
125
|
+
const visit = (parent) => {
|
|
126
|
+
for (const child of parent.childNodes ?? []) {
|
|
127
|
+
const candidate = child;
|
|
128
|
+
if (!candidate.rawTagName)
|
|
129
|
+
continue;
|
|
130
|
+
if (expected.has(localTagName(candidate)))
|
|
131
|
+
matches.push(candidate);
|
|
132
|
+
visit(candidate);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
visit(element);
|
|
136
|
+
return matches;
|
|
137
|
+
}
|
|
97
138
|
//# sourceMappingURL=extractor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../../src/interactions/portable-custom/extractor.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmC;IACtE,EAAE,EAAE,iCAAiC;IACrC,IAAI,EAAE,iCAAiC;IACvC,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE;QACb,2BAA2B;QAC3B,iCAAiC;KACjC;IACD,WAAW,EAAE,+EAA+E;IAE5F,SAAS,CAAC,OAAO,EAAE,QAAQ;QAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QACpD,OAAO,CACN,GAAG,KAAK,iCAAiC;YACzC,GAAG,KAAK,2BAA2B,CACnC,CAAC;IACH,CAAC;IAED,OAAO,CAAC,OAAO,EAAE,OAAO;QACvB,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAE1B,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,C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C,kBAAkB,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;QACxF,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACrI,CAAC;CACD,CAAC","sourcesContent":["import type { ElementExtractor } from '../../extraction/types.js';\nimport type { ExtractedPci } from '../../pci/types.js';\n\n/**\n * Extractor for <qti-portable-custom-interaction> (QTI 3.0) and\n * <portableCustomInteraction> (QTI 2.x vendor extension).\n *\n * Extracts the module paths, markup, and config properties needed by PciHost\n * to load and initialize the PCI JavaScript module.\n *\n * Priority 20 > standardCustomExtractor priority 10, so this runs first when\n * both would match the same element.\n */\nexport const portableCustomExtractor: ElementExtractor<ExtractedPci> = {\n\tid: 'qti:portable-custom-interaction',\n\tname: 'QTI Portable Custom Interaction',\n\tpriority: 20,\n\telementTypes: [\n\t\t'portableCustomInteraction',\n\t\t'qti-portable-custom-interaction',\n\t],\n\tdescription: 'Extracts QTI 3.0 portable custom interaction module paths, markup, and config',\n\n\tcanHandle(element, _context) {\n\t\tconst tag = element.rawTagName?.toLowerCase() ?? '';\n\t\treturn (\n\t\t\ttag === 'qti-portable-custom-interaction' ||\n\t\t\ttag === 'portablecustominteraction'\n\t\t);\n\t},\n\n\textract(element, context) {\n\t\tconst { utils } = context;\n\n\t\tconst responseIdentifier = utils.getAttribute(element, 'responseIdentifier') ||\n\t\t\tutils.getAttribute(element, 'response-identifier') || '';\n\n\t\tconst customInteractionTypeIdentifier =\n\t\t\tutils.getAttribute(element, 'customInteractionTypeIdentifier') ||\n\t\t\tutils.getAttribute(element, 'custom-interaction-type-identifier') || '';\n\n\t\t// --- Module paths from <qti-interaction-modules>/<qti-interaction-module> ---\n\t\t// These element names ARE in the standard QTI 3.0 element mapper so utils.querySelector works.\n\t\tlet primaryPath = '';\n\t\tlet fallbackPath: string | undefined;\n\n\t\tconst modulesEl =\n\t\t\tutils.querySelector(element, 'qti-interaction-modules') ??\n\t\t\tutils.querySelector(element, 'interactionmodules');\n\n\t\tif (modulesEl) {\n\t\t\tconst moduleEl =\n\t\t\t\tutils.querySelector(modulesEl, 'qti-interaction-module') ??\n\t\t\t\tutils.querySelector(modulesEl, 'interactionmodule');\n\n\t\t\tif (moduleEl) {\n\t\t\t\tprimaryPath =\n\t\t\t\t\tutils.getAttribute(moduleEl, 'primaryPath') ||\n\t\t\t\t\tutils.getAttribute(moduleEl, 'primary-path') || '';\n\t\t\t\tconst fb =\n\t\t\t\t\tutils.getAttribute(moduleEl, 'fallbackPath') ||\n\t\t\t\t\tutils.getAttribute(moduleEl, 'fallback-path') || '';\n\t\t\t\tif (fb) fallbackPath = fb;\n\t\t\t}\n\t\t}\n\n\t\t// --- Markup from <qti-interaction-markup> ---\n\t\tconst markupEl =\n\t\t\tutils.querySelector(element, 'qti-interaction-markup') ??\n\t\t\tutils.querySelector(element, 'interactionmarkup');\n\n\t\tconst markup = markupEl ? utils.getHtmlContent(markupEl) : '';\n\n\t\t// --- Config from <qti-pci-properties>/<qti-pci-property> ---\n\t\t// qti-pci-properties is NOT in the standard QTI 3.0 element mapper, so we use the\n\t\t// native node-html-parser querySelector (available as element.querySelector on the raw element).\n\t\tconst config: Record<string, string> = {};\n\n\t\tconst rawEl = element as any;\n\t\tconst propsEl =\n\t\t\trawEl.querySelector?.('qti-pci-properties') ??\n\t\t\trawEl.querySelector?.('pciproperties');\n\n\t\tif (propsEl) {\n\t\t\tconst propEls: any[] = [\n\t\t\t\t...(propsEl.querySelectorAll?.('qti-pci-property') ?? []),\n\t\t\t\t...(propsEl.querySelectorAll?.('pciproperty') ?? []),\n\t\t\t];\n\t\t\tfor (const propEl of propEls) {\n\t\t\t\tconst key = propEl.getAttribute?.('key') || propEl.getAttribute?.('name') || '';\n\t\t\t\tconst value = propEl.getAttribute?.('value') || (propEl.textContent ?? '').trim() || '';\n\t\t\t\tif (key) config[key] = value;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tresponseIdentifier,\n\t\t\tcustomInteractionTypeIdentifier,\n\t\t\tprimaryPath,\n\t\t\tfallbackPath,\n\t\t\tmarkup,\n\t\t\tconfig,\n\t\t};\n\t},\n\n\tvalidate(data) {\n\t\tconst errors: string[] = [];\n\t\tconst warnings: string[] = [];\n\n\t\tif (!data.responseIdentifier) {\n\t\t\terrors.push('portableCustomInteraction is missing responseIdentifier');\n\t\t}\n\t\tif (!data.customInteractionTypeIdentifier) {\n\t\t\twarnings.push('portableCustomInteraction is missing customInteractionTypeIdentifier');\n\t\t}\n\t\tif (!data.primaryPath) {\n\t\t\terrors.push('portableCustomInteraction has no primaryPath in qti-interaction-modules');\n\t\t}\n\n\t\treturn { valid: errors.length === 0, errors: errors.length ? errors : undefined, warnings: warnings.length ? warnings : undefined };\n\t},\n};\n"]}
|
|
1
|
+
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../../src/interactions/portable-custom/extractor.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmC;IACtE,EAAE,EAAE,iCAAiC;IACrC,IAAI,EAAE,iCAAiC;IACvC,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE;QACb,mBAAmB;QACnB,2BAA2B;QAC3B,iCAAiC;KACjC;IACD,WAAW,EAAE,mFAAmF;IAEhG,SAAS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,KAAK,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,KAA2B,CAAC;YAC9C,IAAI,CAAC,SAAS,CAAC,UAAU;gBAAE,SAAS;YACpC,IAAI,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACnE,KAAK,CAAC,SAAS,CAAC,CAAC;QAClB,CAAC;IACF,CAAC,CAAC;IACF,KAAK,CAAC,OAAO,CAAC,CAAC;IACf,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import type { ElementExtractor } from '../../extraction/types.js';\nimport type { ExtractedPci } from '../../pci/types.js';\n\n/**\n * Extractor for <qti-portable-custom-interaction> (QTI 3.0) and the\n * namespaced <pci:portableCustomInteraction> payload inside a QTI 2.x\n * <customInteraction> wrapper.\n *\n * Extracts the module paths, markup, and config properties needed by PciHost\n * to load and initialize the PCI JavaScript module.\n *\n * Priority 20 > standardCustomExtractor priority 10, so this runs first when\n * both would match the same element.\n */\nexport const portableCustomExtractor: ElementExtractor<ExtractedPci> = {\n\tid: 'qti:portable-custom-interaction',\n\tname: 'QTI Portable Custom Interaction',\n\tpriority: 20,\n\telementTypes: [\n\t\t'customInteraction',\n\t\t'portableCustomInteraction',\n\t\t'qti-portable-custom-interaction',\n\t],\n\tdescription: 'Extracts QTI 2.x/3.0 portable custom interaction module paths, markup, and config',\n\n\tcanHandle(element, _context) {\n\t\tconst tag = localTagName(element);\n\t\treturn (\n\t\t\ttag === 'portablecustominteraction' ||\n\t\t\ttag === 'qti-portable-custom-interaction' ||\n\t\t\t(tag === 'custominteraction' && findDescendant(element, ['portablecustominteraction']) !== null)\n\t\t);\n\t},\n\n\textract(element, context) {\n\t\tconst { utils } = context;\n\t\tconst outerTag = localTagName(element);\n\t\tconst pciElement =\n\t\t\touterTag === 'custominteraction'\n\t\t\t\t? findDescendant(element, ['portablecustominteraction'])\n\t\t\t\t: element;\n\n\t\tif (!pciElement) {\n\t\t\tthrow new Error('customInteraction does not contain a portableCustomInteraction payload');\n\t\t}\n\n\t\tconst responseIdentifier =\n\t\t\tutils.getAttribute(element, 'responseIdentifier') ||\n\t\t\tutils.getAttribute(element, 'response-identifier') ||\n\t\t\tcontext.responseId ||\n\t\t\t'';\n\n\t\tconst customInteractionTypeIdentifier =\n\t\t\tutils.getAttribute(pciElement, 'customInteractionTypeIdentifier') ||\n\t\t\tutils.getAttribute(pciElement, 'custom-interaction-type-identifier') ||\n\t\t\tutils.getAttribute(pciElement, 'customInteractionIdentifierType') ||\n\t\t\tutils.getAttribute(pciElement, 'custom-interaction-identifier-type') ||\n\t\t\t'';\n\n\t\t// --- Module paths from <qti-interaction-modules>/<qti-interaction-module> ---\n\t\t// These element names ARE in the standard QTI 3.0 element mapper so utils.querySelector works.\n\t\tlet primaryPath = '';\n\t\tlet fallbackPath: string | undefined;\n\n\t\tconst modulesEl = findDescendant(pciElement, ['interactionmodules', 'qti-interaction-modules']);\n\n\t\tif (modulesEl) {\n\t\t\tconst moduleEl = findDescendant(modulesEl, ['interactionmodule', 'qti-interaction-module']);\n\n\t\t\tif (moduleEl) {\n\t\t\t\tprimaryPath =\n\t\t\t\t\tutils.getAttribute(moduleEl, 'primaryPath') ||\n\t\t\t\t\tutils.getAttribute(moduleEl, 'primary-path') || '';\n\t\t\t\tconst fb =\n\t\t\t\t\tutils.getAttribute(moduleEl, 'fallbackPath') ||\n\t\t\t\t\tutils.getAttribute(moduleEl, 'fallback-path') || '';\n\t\t\t\tif (fb) fallbackPath = fb;\n\t\t\t}\n\t\t}\n\n\t\t// QTI 2.x PCI v1.0 embeds one or more script hooks in <pci:instance>.\n\t\t// The first external script identifies the resource a host resolver must map.\n\t\tconst instanceEl = findDescendant(pciElement, ['instance']);\n\t\tif (!primaryPath && instanceEl) {\n\t\t\tconst externalScript = findDescendants(instanceEl, ['script']).find((script) =>\n\t\t\t\tBoolean(utils.getAttribute(script, 'src'))\n\t\t\t);\n\t\t\tprimaryPath = externalScript ? utils.getAttribute(externalScript, 'src') : '';\n\t\t}\n\n\t\t// --- Markup from <qti-interaction-markup> ---\n\t\tconst markupEl = findDescendant(pciElement, ['interactionmarkup', 'qti-interaction-markup']);\n\n\t\t// sanitizeHtml removes script hooks from the QTI 2.x instance while preserving\n\t\t// the authored DOM scaffold that the resolved module initializes.\n\t\tconst markupSource = markupEl ?? instanceEl;\n\t\tconst markup = markupSource ? utils.getHtmlContent(markupSource) : '';\n\n\t\t// --- Config from <qti-pci-properties>/<qti-pci-property> ---\n\t\t// qti-pci-properties is NOT in the standard QTI 3.0 element mapper, so we use the\n\t\t// native node-html-parser querySelector (available as element.querySelector on the raw element).\n\t\tconst config: Record<string, string> = {};\n\n\t\tconst propsEl = findDescendant(pciElement, ['pciproperties', 'qti-pci-properties']);\n\n\t\tif (propsEl) {\n\t\t\tconst propEls = findDescendants(propsEl, ['pciproperty', 'qti-pci-property']);\n\t\t\tfor (const propEl of propEls) {\n\t\t\t\tconst key = utils.getAttribute(propEl, 'key') || utils.getAttribute(propEl, 'name') || '';\n\t\t\t\tconst value = utils.getAttribute(propEl, 'value') || (propEl.textContent ?? '').trim() || '';\n\t\t\t\tif (key) config[key] = value;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'portableCustomInteraction',\n\t\t\tresponseIdentifier,\n\t\t\tcustomInteractionTypeIdentifier,\n\t\t\tprimaryPath,\n\t\t\tfallbackPath,\n\t\t\tmarkup,\n\t\t\tconfig,\n\t\t};\n\t},\n\n\tvalidate(data) {\n\t\tconst errors: string[] = [];\n\t\tconst warnings: string[] = [];\n\n\t\tif (!data.responseIdentifier) {\n\t\t\terrors.push('portableCustomInteraction is missing responseIdentifier');\n\t\t}\n\t\tif (!data.customInteractionTypeIdentifier) {\n\t\t\twarnings.push('portableCustomInteraction is missing customInteractionTypeIdentifier');\n\t\t}\n\t\tif (!data.primaryPath) {\n\t\t\terrors.push('portableCustomInteraction has no primaryPath in qti-interaction-modules');\n\t\t}\n\n\t\treturn { valid: errors.length === 0, errors: errors.length ? errors : undefined, warnings: warnings.length ? warnings : undefined };\n\t},\n};\n\ntype ExtractableElement = Parameters<typeof portableCustomExtractor.canHandle>[0];\n\nfunction localTagName(element: ExtractableElement): string {\n\tconst raw = element.rawTagName?.toLowerCase() ?? '';\n\treturn raw.includes(':') ? raw.slice(raw.lastIndexOf(':') + 1) : raw;\n}\n\nfunction findDescendant(\n\telement: ExtractableElement,\n\tlocalNames: readonly string[]\n): ExtractableElement | null {\n\treturn findDescendants(element, localNames)[0] ?? null;\n}\n\nfunction findDescendants(\n\telement: ExtractableElement,\n\tlocalNames: readonly string[]\n): ExtractableElement[] {\n\tconst expected = new Set(localNames.map((name) => name.toLowerCase()));\n\tconst matches: ExtractableElement[] = [];\n\tconst visit = (parent: ExtractableElement) => {\n\t\tfor (const child of parent.childNodes ?? []) {\n\t\t\tconst candidate = child as ExtractableElement;\n\t\t\tif (!candidate.rawTagName) continue;\n\t\t\tif (expected.has(localTagName(candidate))) matches.push(candidate);\n\t\t\tvisit(candidate);\n\t\t}\n\t};\n\tvisit(element);\n\treturn matches;\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './extractor.js';
|
|
2
|
-
export type {
|
|
2
|
+
export type { PortableCustomInteractionData } from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interactions/portable-custom/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './extractor.js';\nexport type {
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interactions/portable-custom/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './extractor.js';\nexport type { PortableCustomInteractionData } from './types.js';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { PortableCustomInteractionData } from '../shared/types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/interactions/portable-custom/types.ts"],"names":[],"mappings":"","sourcesContent":["export type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/interactions/portable-custom/types.ts"],"names":[],"mappings":"","sourcesContent":["export type { PortableCustomInteractionData } from '../shared/types.js';\n"]}
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard QTI positionObjectInteraction extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts data from positionObjectInteraction elements (drag objects to positions)
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ IMPORTANT: QTI 2.2 positionObjectInteraction Limitations
|
|
7
|
-
*
|
|
8
|
-
* This interaction has severe limitations that make it impractical for most educational scenarios:
|
|
9
|
-
*
|
|
10
|
-
* 1. Response format is baseType="point" - only stores coordinates ["158 168"]
|
|
11
|
-
* 2. NO way to track which specific object was placed where
|
|
12
|
-
* 3. Designed ONLY for placing multiple copies of the SAME object (e.g., airport icons)
|
|
13
|
-
* 4. Cannot support "place labeled objects on map" use cases
|
|
14
|
-
*
|
|
15
|
-
* The official QTI 2.2 spec example shows:
|
|
16
|
-
* - ONE positionObjectStage (container) with background image
|
|
17
|
-
* - ONE positionObjectInteraction with ONE draggable object
|
|
18
|
-
* - maxChoices determines how many times the object can be placed
|
|
19
|
-
* - Scoring uses areaMapping to check if ANY placement hits target zones
|
|
20
|
-
*
|
|
21
|
-
* This extractor supports a NON-STANDARD extension with multiple positionObjectStage
|
|
22
|
-
* elements (each with identifiers), but the response format cannot preserve object identity.
|
|
23
|
-
* For labeled-object placement, use graphicGapMatchInteraction instead.
|
|
24
|
-
*/
|
|
25
1
|
import type { ElementExtractor } from '../../extraction/types.js';
|
|
26
|
-
/**
|
|
27
|
-
* Image data for position object interaction
|
|
28
|
-
*/
|
|
29
2
|
export interface ImageData {
|
|
30
3
|
type: 'image' | 'svg';
|
|
31
4
|
src?: string;
|
|
@@ -33,16 +6,17 @@ export interface ImageData {
|
|
|
33
6
|
width?: string;
|
|
34
7
|
height?: string;
|
|
35
8
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Position object data extracted from positionObjectInteraction elements
|
|
38
|
-
*/
|
|
39
9
|
export interface PositionObjectData {
|
|
40
10
|
imageData: ImageData | null;
|
|
11
|
+
/**
|
|
12
|
+
* Compatibility shape consumed by the existing renderer. Each extracted
|
|
13
|
+
* interaction contributes its one draggable object here; the actual QTI
|
|
14
|
+
* positionObjectStage is the interaction's parent and supplies imageData.
|
|
15
|
+
*/
|
|
41
16
|
positionObjectStages: Array<{
|
|
42
17
|
identifier: string;
|
|
43
18
|
label: string;
|
|
44
19
|
matchMax: number;
|
|
45
|
-
matchMin?: number;
|
|
46
20
|
objectData: ImageData | null;
|
|
47
21
|
classes?: string[];
|
|
48
22
|
}>;
|
|
@@ -51,8 +25,4 @@ export interface PositionObjectData {
|
|
|
51
25
|
minChoices: number;
|
|
52
26
|
prompt: string | null;
|
|
53
27
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Standard QTI position object interaction extractor
|
|
56
|
-
* Handles positionObjectInteraction elements (dragging an object to a position)
|
|
57
|
-
*/
|
|
58
28
|
export declare const standardPositionObjectExtractor: ElementExtractor<PositionObjectData>;
|