@pie-qti/item-player 0.1.15 → 0.1.17
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-BLaOCHDu.js +6926 -0
- package/dist/element-class-BLaOCHDu.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 +19 -11
|
@@ -1,132 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
/**
|
|
26
|
-
* Standard QTI position object interaction extractor
|
|
27
|
-
* Handles positionObjectInteraction elements (dragging an object to a position)
|
|
28
|
-
*/
|
|
1
|
+
function imageDataFromObject(objectElement, utils, defaultWidth, defaultHeight) {
|
|
2
|
+
if (!objectElement)
|
|
3
|
+
return null;
|
|
4
|
+
const type = utils.getAttribute(objectElement, 'type', '');
|
|
5
|
+
const data = utils.getAttribute(objectElement, 'data', '');
|
|
6
|
+
const width = utils.getAttribute(objectElement, 'width', defaultWidth);
|
|
7
|
+
const height = utils.getAttribute(objectElement, 'height', defaultHeight);
|
|
8
|
+
const content = utils.getHtmlContent(objectElement);
|
|
9
|
+
if (type.startsWith('image/svg') && /<svg[\s>]/i.test(content)) {
|
|
10
|
+
return { type: 'svg', content, width, height };
|
|
11
|
+
}
|
|
12
|
+
return { type: 'image', src: data, width, height };
|
|
13
|
+
}
|
|
29
14
|
export const standardPositionObjectExtractor = {
|
|
30
15
|
id: 'qti:position-object-interaction',
|
|
31
16
|
name: 'QTI Standard Position Object Interaction',
|
|
32
17
|
priority: 10,
|
|
33
18
|
elementTypes: ['positionObjectInteraction'],
|
|
34
|
-
description: 'Extracts
|
|
35
|
-
canHandle(element
|
|
36
|
-
|
|
37
|
-
return
|
|
19
|
+
description: 'Extracts a positionObjectInteraction from its parent positionObjectStage',
|
|
20
|
+
canHandle(element) {
|
|
21
|
+
const tagName = element.rawTagName?.toLowerCase();
|
|
22
|
+
return tagName === 'positionobjectinteraction' || tagName === 'qti-position-object-interaction';
|
|
38
23
|
},
|
|
39
24
|
extract(element, context) {
|
|
40
|
-
const { utils } = context;
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const content = utils.getHtmlContent(objectElement);
|
|
53
|
-
imageData = {
|
|
54
|
-
type: 'svg',
|
|
55
|
-
content,
|
|
56
|
-
width,
|
|
57
|
-
height,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// External image reference
|
|
62
|
-
imageData = {
|
|
63
|
-
type: 'image',
|
|
64
|
-
src: data,
|
|
65
|
-
width,
|
|
66
|
-
height,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// Extract positionObjectStage children
|
|
71
|
-
const stageElements = utils.getChildrenByTag(element, 'positionObjectStage');
|
|
72
|
-
const positionObjectStages = stageElements.map((stage) => {
|
|
73
|
-
const classes = utils.getClasses(stage);
|
|
74
|
-
const identifier = utils.getAttribute(stage, 'identifier', '');
|
|
75
|
-
const matchMax = utils.getNumberAttribute(stage, 'matchMax', 1);
|
|
76
|
-
const matchMin = utils.getNumberAttribute(stage, 'matchMin', 0);
|
|
77
|
-
// Get text content as label, use identifier as fallback
|
|
78
|
-
const textContent = utils.getTextContent(stage).trim();
|
|
79
|
-
const label = textContent || identifier;
|
|
80
|
-
// Extract object data from nested object element
|
|
81
|
-
const stageObjectElements = utils.getChildrenByTag(stage, 'object');
|
|
82
|
-
let objectData = null;
|
|
83
|
-
if (stageObjectElements.length > 0) {
|
|
84
|
-
const objElement = stageObjectElements[0];
|
|
85
|
-
const objType = utils.getAttribute(objElement, 'type', '');
|
|
86
|
-
const objData = utils.getAttribute(objElement, 'data', '');
|
|
87
|
-
const objWidth = utils.getAttribute(objElement, 'width', '50');
|
|
88
|
-
const objHeight = utils.getAttribute(objElement, 'height', '50');
|
|
89
|
-
if (objType.startsWith('image/svg')) {
|
|
90
|
-
// Extract inline SVG content
|
|
91
|
-
const content = utils.getHtmlContent(objElement);
|
|
92
|
-
objectData = {
|
|
93
|
-
type: 'svg',
|
|
94
|
-
content,
|
|
95
|
-
width: objWidth,
|
|
96
|
-
height: objHeight,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
// External image reference
|
|
101
|
-
objectData = {
|
|
102
|
-
type: 'image',
|
|
103
|
-
src: objData,
|
|
104
|
-
width: objWidth,
|
|
105
|
-
height: objHeight,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
identifier,
|
|
111
|
-
label,
|
|
112
|
-
matchMax,
|
|
113
|
-
...(matchMin > 0 ? { matchMin } : {}),
|
|
114
|
-
objectData,
|
|
115
|
-
...(classes.length > 0 ? { classes } : {}),
|
|
116
|
-
};
|
|
117
|
-
});
|
|
118
|
-
// Extract attributes
|
|
119
|
-
// centerPoint defaults to true when not specified
|
|
120
|
-
const centerPoint = utils.getBooleanAttribute(element, 'centerPoint', true);
|
|
121
|
-
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);
|
|
25
|
+
const { utils, responseId } = context;
|
|
26
|
+
const parent = element.parentNode;
|
|
27
|
+
const parentTagName = parent?.rawTagName?.toLowerCase();
|
|
28
|
+
const isPositionObjectStage = parentTagName === 'positionobjectstage' || parentTagName === 'qti-position-object-stage';
|
|
29
|
+
const stage = parent && isPositionObjectStage && utils.getChildrenByTag(parent, 'positionObjectInteraction').includes(element)
|
|
30
|
+
? parent
|
|
31
|
+
: undefined;
|
|
32
|
+
const backgroundObject = stage ? utils.getChildrenByTag(stage, 'object')[0] : undefined;
|
|
33
|
+
const draggableObject = utils.getChildrenByTag(element, 'object')[0];
|
|
34
|
+
const imageData = imageDataFromObject(backgroundObject, utils, '500', '300');
|
|
35
|
+
const objectData = imageDataFromObject(draggableObject, utils, '50', '50');
|
|
36
|
+
const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);
|
|
122
37
|
const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
const prompt =
|
|
38
|
+
const label = utils.getTextContent(draggableObject).trim() || responseId;
|
|
39
|
+
const classes = utils.getClasses(element);
|
|
40
|
+
const prompt = utils.getPrompt(element);
|
|
126
41
|
return {
|
|
127
42
|
imageData,
|
|
128
|
-
positionObjectStages
|
|
129
|
-
|
|
43
|
+
positionObjectStages: [
|
|
44
|
+
{
|
|
45
|
+
identifier: responseId,
|
|
46
|
+
label,
|
|
47
|
+
matchMax: maxChoices,
|
|
48
|
+
objectData,
|
|
49
|
+
...(classes.length > 0 ? { classes } : {}),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
// The renderer currently represents the QTI default (the object's centre)
|
|
53
|
+
// as a boolean. Explicit centre coordinates remain a follow-up API change.
|
|
54
|
+
centerPoint: true,
|
|
130
55
|
maxChoices,
|
|
131
56
|
minChoices,
|
|
132
57
|
prompt,
|
|
@@ -135,53 +60,33 @@ export const standardPositionObjectExtractor = {
|
|
|
135
60
|
validate(data) {
|
|
136
61
|
const errors = [];
|
|
137
62
|
const warnings = [];
|
|
138
|
-
// Validate image data
|
|
139
63
|
if (!data.imageData) {
|
|
140
|
-
|
|
64
|
+
errors.push('positionObjectInteraction must have a parent positionObjectStage with a background object');
|
|
141
65
|
}
|
|
142
66
|
else if (data.imageData.type === 'image' && !data.imageData.src) {
|
|
143
|
-
errors.push('
|
|
67
|
+
errors.push('positionObjectStage background object must have a data URL');
|
|
144
68
|
}
|
|
145
69
|
else if (data.imageData.type === 'svg' && !data.imageData.content) {
|
|
146
|
-
errors.push('
|
|
147
|
-
}
|
|
148
|
-
// Warn about dimension consistency (cannot verify actual file dimensions at extraction time)
|
|
149
|
-
if (data.imageData && data.imageData.type === 'image') {
|
|
150
|
-
warnings.push('IMPORTANT: Ensure declared width/height match actual image file dimensions. ' +
|
|
151
|
-
'Mismatched dimensions cause coordinate system errors in mapResponsePoint scoring. ' +
|
|
152
|
-
`Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`);
|
|
70
|
+
errors.push('positionObjectStage background object must have SVG content');
|
|
153
71
|
}
|
|
154
|
-
|
|
155
|
-
if (!
|
|
156
|
-
errors.push('positionObjectInteraction must
|
|
72
|
+
const draggable = data.positionObjectStages[0];
|
|
73
|
+
if (!draggable?.objectData) {
|
|
74
|
+
errors.push('positionObjectInteraction must contain one draggable object');
|
|
157
75
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const identifiers = new Set();
|
|
161
|
-
for (const stage of data.positionObjectStages) {
|
|
162
|
-
if (!stage.identifier) {
|
|
163
|
-
errors.push('All positionObjectStages must have an identifier');
|
|
164
|
-
}
|
|
165
|
-
else if (identifiers.has(stage.identifier)) {
|
|
166
|
-
errors.push(`Duplicate positionObjectStage identifier: ${stage.identifier}`);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
identifiers.add(stage.identifier);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
76
|
+
else if (draggable.objectData.type === 'image' && !draggable.objectData.src) {
|
|
77
|
+
errors.push('positionObjectInteraction draggable object must have a data URL');
|
|
172
78
|
}
|
|
173
|
-
|
|
174
|
-
if (data.maxChoices < 0) {
|
|
79
|
+
if (data.maxChoices < 0)
|
|
175
80
|
errors.push('maxChoices must be non-negative');
|
|
176
|
-
|
|
177
|
-
// Validate minChoices
|
|
178
|
-
if (data.minChoices < 0) {
|
|
81
|
+
if (data.minChoices < 0)
|
|
179
82
|
errors.push('minChoices must be non-negative');
|
|
180
|
-
}
|
|
181
|
-
// Validate minChoices <= maxChoices
|
|
182
83
|
if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {
|
|
183
84
|
errors.push('minChoices cannot exceed maxChoices');
|
|
184
85
|
}
|
|
86
|
+
if (data.imageData?.type === 'image') {
|
|
87
|
+
warnings.push('Ensure the declared positionObjectStage width/height match the image dimensions. ' +
|
|
88
|
+
`Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`);
|
|
89
|
+
}
|
|
185
90
|
return {
|
|
186
91
|
valid: errors.length === 0,
|
|
187
92
|
errors: errors.length > 0 ? errors : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../../src/interactions/position-object/extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAkCH;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAyC;IACpF,EAAE,EAAE,iCAAiC;IACrC,IAAI,EAAE,0CAA0C;IAChD,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,CAAC,2BAA2B,CAAC;IAC3C,WAAW,EAAE,2EAA2E;IAExF,SAAS,CAAC,OAAO,EAAE,QAAQ;QAC1B,sDAAsD;QACtD,OAAO,OAAO,CAAC,UAAU,KAAK,2BAA2B,CAAC;IAC3D,CAAC;IAED,OAAO,CAAC,OAAO,EAAE,OAAO;QACvB,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAE1B,mEAAmE;QACnE,MAAM,cAAc,GAAG,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE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oBACvB,MAAM,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;gBACjE,CAAC;qBAAM,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC9C,MAAM,CAAC,IAAI,CAAC,6CAA6C,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC9E,CAAC;qBAAM,CAAC;oBACP,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;gBACnC,CAAC;YACF,CAAC;QACF,CAAC;QAED,sBAAsB;QACtB,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAChD,CAAC;QAED,sBAAsB;QACtB,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAChD,CAAC;QAED,oCAAoC;QACpC,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC9D,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACpD,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 positionObjectInteraction extractor\n *\n * Extracts data from positionObjectInteraction elements (drag objects to positions)\n *\n * ⚠️ IMPORTANT: QTI 2.2 positionObjectInteraction Limitations\n *\n * This interaction has severe limitations that make it impractical for most educational scenarios:\n *\n * 1. Response format is baseType=\"point\" - only stores coordinates [\"158 168\"]\n * 2. NO way to track which specific object was placed where\n * 3. Designed ONLY for placing multiple copies of the SAME object (e.g., airport icons)\n * 4. Cannot support \"place labeled objects on map\" use cases\n *\n * The official QTI 2.2 spec example shows:\n * - ONE positionObjectStage (container) with background image\n * - ONE positionObjectInteraction with ONE draggable object\n * - maxChoices determines how many times the object can be placed\n * - Scoring uses areaMapping to check if ANY placement hits target zones\n *\n * This extractor supports a NON-STANDARD extension with multiple positionObjectStage\n * elements (each with identifiers), but the response format cannot preserve object identity.\n * For labeled-object placement, use graphicGapMatchInteraction instead.\n */\n\nimport type { ElementExtractor } from '../../extraction/types.js';\n\n/**\n * Image data for position object interaction\n */\nexport interface ImageData {\n\ttype: 'image' | 'svg';\n\tsrc?: string;\n\tcontent?: string;\n\twidth?: string;\n\theight?: string;\n}\n\n/**\n * Position object data extracted from positionObjectInteraction elements\n */\nexport interface PositionObjectData {\n\timageData: ImageData | null;\n\tpositionObjectStages: Array<{\n\t\tidentifier: string;\n\t\tlabel: string;\n\t\tmatchMax: number;\n\t\tmatchMin?: number;\n\t\tobjectData: ImageData | null;\n\t\tclasses?: string[];\n\t}>;\n\tcenterPoint: boolean;\n\tmaxChoices: number;\n\tminChoices: number;\n\tprompt: string | null;\n}\n\n/**\n * Standard QTI position object interaction extractor\n * Handles positionObjectInteraction elements (dragging an object to a position)\n */\nexport const standardPositionObjectExtractor: ElementExtractor<PositionObjectData> = {\n\tid: 'qti:position-object-interaction',\n\tname: 'QTI Standard Position Object Interaction',\n\tpriority: 10,\n\telementTypes: ['positionObjectInteraction'],\n\tdescription: 'Extracts standard QTI positionObjectInteraction (drag object to position)',\n\n\tcanHandle(element, _context) {\n\t\t// All positionObjectInteraction elements are standard\n\t\treturn element.rawTagName === 'positionObjectInteraction';\n\t},\n\n\textract(element, context) {\n\t\tconst { utils } = context;\n\n\t\t// Extract background image data from object element (direct child)\n\t\tconst objectElements = utils.getChildrenByTag(element, 'object');\n\t\tlet imageData: ImageData | null = null;\n\n\t\tif (objectElements.length > 0) {\n\t\t\tconst objectElement = objectElements[0];\n\t\t\tconst type = utils.getAttribute(objectElement, 'type', '');\n\t\t\tconst data = utils.getAttribute(objectElement, 'data', '');\n\t\t\tconst width = utils.getAttribute(objectElement, 'width', '500');\n\t\t\tconst height = utils.getAttribute(objectElement, 'height', '300');\n\n\t\t\tif (type.startsWith('image/svg')) {\n\t\t\t\t// Extract inline SVG content - get full content including <svg> tag\n\t\t\t\tconst content = utils.getHtmlContent(objectElement);\n\t\t\t\timageData = {\n\t\t\t\t\ttype: 'svg',\n\t\t\t\t\tcontent,\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// External image reference\n\t\t\t\timageData = {\n\t\t\t\t\ttype: 'image',\n\t\t\t\t\tsrc: data,\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Extract positionObjectStage children\n\t\tconst stageElements = utils.getChildrenByTag(element, 'positionObjectStage');\n\t\tconst positionObjectStages = stageElements.map((stage) => {\n\t\t\tconst classes = utils.getClasses(stage);\n\t\t\tconst identifier = utils.getAttribute(stage, 'identifier', '');\n\t\t\tconst matchMax = utils.getNumberAttribute(stage, 'matchMax', 1);\n\t\t\tconst matchMin = utils.getNumberAttribute(stage, 'matchMin', 0);\n\n\t\t\t// Get text content as label, use identifier as fallback\n\t\t\tconst textContent = utils.getTextContent(stage).trim();\n\t\t\tconst label = textContent || identifier;\n\n\t\t\t// Extract object data from nested object element\n\t\t\tconst stageObjectElements = utils.getChildrenByTag(stage, 'object');\n\t\t\tlet objectData: ImageData | null = null;\n\n\t\t\tif (stageObjectElements.length > 0) {\n\t\t\t\tconst objElement = stageObjectElements[0];\n\t\t\t\tconst objType = utils.getAttribute(objElement, 'type', '');\n\t\t\t\tconst objData = utils.getAttribute(objElement, 'data', '');\n\t\t\t\tconst objWidth = utils.getAttribute(objElement, 'width', '50');\n\t\t\t\tconst objHeight = utils.getAttribute(objElement, 'height', '50');\n\n\t\t\t\tif (objType.startsWith('image/svg')) {\n\t\t\t\t\t// Extract inline SVG content\n\t\t\t\t\tconst content = utils.getHtmlContent(objElement);\n\t\t\t\t\tobjectData = {\n\t\t\t\t\t\ttype: 'svg',\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t\twidth: objWidth,\n\t\t\t\t\t\theight: objHeight,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\t// External image reference\n\t\t\t\t\tobjectData = {\n\t\t\t\t\t\ttype: 'image',\n\t\t\t\t\t\tsrc: objData,\n\t\t\t\t\t\twidth: objWidth,\n\t\t\t\t\t\theight: objHeight,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tidentifier,\n\t\t\t\tlabel,\n\t\t\t\tmatchMax,\n\t\t\t\t...(matchMin > 0 ? { matchMin } : {}),\n\t\t\t\tobjectData,\n\t\t\t\t...(classes.length > 0 ? { classes } : {}),\n\t\t\t};\n\t\t});\n\n\t\t// Extract attributes\n\t\t// centerPoint defaults to true when not specified\n\t\tconst centerPoint = utils.getBooleanAttribute(element, 'centerPoint', true);\n\t\tconst maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);\n\t\tconst minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n\n\t\t// Extract prompt (optional)\n\t\tconst promptElements = utils.getChildrenByTag(element, 'prompt');\n\t\tconst prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n\n\t\treturn {\n\t\t\timageData,\n\t\t\tpositionObjectStages,\n\t\t\tcenterPoint,\n\t\t\tmaxChoices,\n\t\t\tminChoices,\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 image data\n\t\tif (!data.imageData) {\n\t\t\twarnings.push('positionObjectInteraction has no background image');\n\t\t} else if (data.imageData.type === 'image' && !data.imageData.src) {\n\t\t\terrors.push('positionObjectInteraction must have an image URL');\n\t\t} else if (data.imageData.type === 'svg' && !data.imageData.content) {\n\t\t\terrors.push('positionObjectInteraction must have SVG content');\n\t\t}\n\n\t\t// Warn about dimension consistency (cannot verify actual file dimensions at extraction time)\n\t\tif (data.imageData && data.imageData.type === 'image') {\n\t\t\twarnings.push(\n\t\t\t\t'IMPORTANT: Ensure declared width/height match actual image file dimensions. ' +\n\t\t\t\t\t'Mismatched dimensions cause coordinate system errors in mapResponsePoint scoring. ' +\n\t\t\t\t\t`Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`\n\t\t\t);\n\t\t}\n\n\t\t// Validate positionObjectStages exist\n\t\tif (!data.positionObjectStages || data.positionObjectStages.length === 0) {\n\t\t\terrors.push('positionObjectInteraction must have at least one positionObjectStage');\n\t\t}\n\n\t\t// Validate positionObjectStage identifiers\n\t\tif (data.positionObjectStages) {\n\t\t\tconst identifiers = new Set<string>();\n\t\t\tfor (const stage of data.positionObjectStages) {\n\t\t\t\tif (!stage.identifier) {\n\t\t\t\t\terrors.push('All positionObjectStages must have an identifier');\n\t\t\t\t} else if (identifiers.has(stage.identifier)) {\n\t\t\t\t\terrors.push(`Duplicate positionObjectStage identifier: ${stage.identifier}`);\n\t\t\t\t} else {\n\t\t\t\t\tidentifiers.add(stage.identifier);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Validate maxChoices\n\t\tif (data.maxChoices < 0) {\n\t\t\terrors.push('maxChoices must be non-negative');\n\t\t}\n\n\t\t// Validate minChoices\n\t\tif (data.minChoices < 0) {\n\t\t\terrors.push('minChoices must be non-negative');\n\t\t}\n\n\t\t// Validate minChoices <= maxChoices\n\t\tif (data.maxChoices > 0 && data.minChoices > data.maxChoices) {\n\t\t\terrors.push('minChoices cannot exceed maxChoices');\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
|
+
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../../src/interactions/position-object/extractor.ts"],"names":[],"mappings":"AA+BA,SAAS,mBAAmB,CAC3B,aAAqC,EACrC,KAA8E,EAC9E,YAAoB,EACpB,aAAqB;IAErB,IAAI,CAAC,aAAa;QAAE,OAAO,IAAI,CAAC;IAEhC,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IAEpD,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAChE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAyC;IACpF,EAAE,EAAE,iCAAiC;IACrC,IAAI,EAAE,0CAA0C;IAChD,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,CAAC,2BAA2B,CAAC;IAC3C,WAAW,EAAE,0EAA0E;IAEvF,SAA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} from '../index.js';\n\nexport interface ImageData {\n\ttype: 'image' | 'svg';\n\tsrc?: string;\n\tcontent?: string;\n\twidth?: string;\n\theight?: string;\n}\n\nexport interface PositionObjectData {\n\timageData: ImageData | null;\n\t/**\n\t * Compatibility shape consumed by the existing renderer. Each extracted\n\t * interaction contributes its one draggable object here; the actual QTI\n\t * positionObjectStage is the interaction's parent and supplies imageData.\n\t */\n\tpositionObjectStages: Array<{\n\t\tidentifier: string;\n\t\tlabel: string;\n\t\tmatchMax: number;\n\t\tobjectData: ImageData | null;\n\t\tclasses?: string[];\n\t}>;\n\tcenterPoint: boolean;\n\tmaxChoices: number;\n\tminChoices: number;\n\tprompt: string | null;\n}\n\nfunction imageDataFromObject(\n\tobjectElement: QTIElement | undefined,\n\tutils: Parameters<ElementExtractor<PositionObjectData>['extract']>[1]['utils'],\n\tdefaultWidth: string,\n\tdefaultHeight: string,\n): ImageData | null {\n\tif (!objectElement) return null;\n\n\tconst type = utils.getAttribute(objectElement, 'type', '');\n\tconst data = utils.getAttribute(objectElement, 'data', '');\n\tconst width = utils.getAttribute(objectElement, 'width', defaultWidth);\n\tconst height = utils.getAttribute(objectElement, 'height', defaultHeight);\n\tconst content = utils.getHtmlContent(objectElement);\n\n\tif (type.startsWith('image/svg') && /<svg[\\s>]/i.test(content)) {\n\t\treturn { type: 'svg', content, width, height };\n\t}\n\n\treturn { type: 'image', src: data, width, height };\n}\n\nexport const standardPositionObjectExtractor: ElementExtractor<PositionObjectData> = {\n\tid: 'qti:position-object-interaction',\n\tname: 'QTI Standard Position Object Interaction',\n\tpriority: 10,\n\telementTypes: ['positionObjectInteraction'],\n\tdescription: 'Extracts a positionObjectInteraction from its parent positionObjectStage',\n\n\tcanHandle(element) {\n\t\tconst tagName = element.rawTagName?.toLowerCase();\n\t\treturn tagName === 'positionobjectinteraction' || tagName === 'qti-position-object-interaction';\n\t},\n\n\textract(element, context) {\n\t\tconst { utils, responseId } = context;\n\t\tconst parent = element.parentNode as QTIElement | undefined;\n\t\tconst parentTagName = parent?.rawTagName?.toLowerCase();\n\t\tconst isPositionObjectStage =\n\t\t\tparentTagName === 'positionobjectstage' || parentTagName === 'qti-position-object-stage';\n\t\tconst stage = parent && isPositionObjectStage && utils.getChildrenByTag(parent, 'positionObjectInteraction').includes(element)\n\t\t\t? parent\n\t\t\t: undefined;\n\n\t\tconst backgroundObject = stage ? utils.getChildrenByTag(stage, 'object')[0] : undefined;\n\t\tconst draggableObject = utils.getChildrenByTag(element, 'object')[0];\n\t\tconst imageData = imageDataFromObject(backgroundObject, utils, '500', '300');\n\t\tconst objectData = imageDataFromObject(draggableObject, utils, '50', '50');\n\t\tconst maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);\n\t\tconst minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n\t\tconst label = utils.getTextContent(draggableObject).trim() || responseId;\n\t\tconst classes = utils.getClasses(element);\n\t\tconst prompt = utils.getPrompt(element);\n\n\t\treturn {\n\t\t\timageData,\n\t\t\tpositionObjectStages: [\n\t\t\t\t{\n\t\t\t\t\tidentifier: responseId,\n\t\t\t\t\tlabel,\n\t\t\t\t\tmatchMax: maxChoices,\n\t\t\t\t\tobjectData,\n\t\t\t\t\t...(classes.length > 0 ? { classes } : {}),\n\t\t\t\t},\n\t\t\t],\n\t\t\t// The renderer currently represents the QTI default (the object's centre)\n\t\t\t// as a boolean. Explicit centre coordinates remain a follow-up API change.\n\t\t\tcenterPoint: true,\n\t\t\tmaxChoices,\n\t\t\tminChoices,\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\tif (!data.imageData) {\n\t\t\terrors.push('positionObjectInteraction must have a parent positionObjectStage with a background object');\n\t\t} else if (data.imageData.type === 'image' && !data.imageData.src) {\n\t\t\terrors.push('positionObjectStage background object must have a data URL');\n\t\t} else if (data.imageData.type === 'svg' && !data.imageData.content) {\n\t\t\terrors.push('positionObjectStage background object must have SVG content');\n\t\t}\n\n\t\tconst draggable = data.positionObjectStages[0];\n\t\tif (!draggable?.objectData) {\n\t\t\terrors.push('positionObjectInteraction must contain one draggable object');\n\t\t} else if (draggable.objectData.type === 'image' && !draggable.objectData.src) {\n\t\t\terrors.push('positionObjectInteraction draggable object must have a data URL');\n\t\t}\n\n\t\tif (data.maxChoices < 0) errors.push('maxChoices must be non-negative');\n\t\tif (data.minChoices < 0) errors.push('minChoices must be non-negative');\n\t\tif (data.maxChoices > 0 && data.minChoices > data.maxChoices) {\n\t\t\terrors.push('minChoices cannot exceed maxChoices');\n\t\t}\n\n\t\tif (data.imageData?.type === 'image') {\n\t\t\twarnings.push(\n\t\t\t\t'Ensure the declared positionObjectStage width/height match the image dimensions. ' +\n\t\t\t\t\t`Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`,\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"]}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* interaction renderer registry, ensuring compile-time type safety.
|
|
6
6
|
*/
|
|
7
7
|
import type { HTMLElement } from 'node-html-parser';
|
|
8
|
+
import type { ExtractedPci } from '../../pci/types.js';
|
|
8
9
|
import type { HtmlContent, QTIFileResponse } from '../../types/index.js';
|
|
9
10
|
/**
|
|
10
11
|
* Type alias for parsed QTI XML elements
|
|
@@ -47,6 +48,13 @@ export interface TextEntryInteractionData extends BaseInteractionData {
|
|
|
47
48
|
}
|
|
48
49
|
export interface ExtendedTextInteractionData extends BaseInteractionData {
|
|
49
50
|
type: 'extendedTextInteraction';
|
|
51
|
+
cardinality: 'single' | 'multiple' | 'ordered' | 'record';
|
|
52
|
+
baseType?: string;
|
|
53
|
+
base: number;
|
|
54
|
+
stringIdentifier?: string;
|
|
55
|
+
minStrings: number;
|
|
56
|
+
/** Zero means no authored upper bound. */
|
|
57
|
+
maxStrings: number;
|
|
50
58
|
expectedLines: number;
|
|
51
59
|
expectedLength: number;
|
|
52
60
|
prompt: string | null;
|
|
@@ -240,6 +248,10 @@ export interface CustomInteractionData extends BaseInteractionData {
|
|
|
240
248
|
/** Outer XML snippet for debugging (best-effort) */
|
|
241
249
|
xml: string;
|
|
242
250
|
}
|
|
251
|
+
/** Canonical interaction data for QTI 2.x and 3.0 Portable Custom Interactions. */
|
|
252
|
+
export interface PortableCustomInteractionData extends BaseInteractionData, ExtractedPci {
|
|
253
|
+
type: 'portableCustomInteraction';
|
|
254
|
+
}
|
|
243
255
|
export interface MediaElement {
|
|
244
256
|
type: 'audio' | 'video' | 'object';
|
|
245
257
|
src: string;
|
|
@@ -344,7 +356,7 @@ export interface EndAttemptInteractionData extends BaseInteractionData {
|
|
|
344
356
|
/** Whether this interaction counts as an attempt (default: true) */
|
|
345
357
|
countAttempt: boolean;
|
|
346
358
|
}
|
|
347
|
-
export type InteractionData = ChoiceInteractionData | TextEntryInteractionData | ExtendedTextInteractionData | InlineChoiceInteractionData | OrderInteractionData | MatchInteractionData | AssociateInteractionData | GapMatchInteractionData | SliderInteractionData | HotspotInteractionData | GraphicGapMatchInteractionData | UploadInteractionData | DrawingInteractionData | CustomInteractionData | MediaInteractionData | HottextInteractionData | SelectPointInteractionData | GraphicOrderInteractionData | GraphicAssociateInteractionData | PositionObjectInteractionData | EndAttemptInteractionData;
|
|
359
|
+
export type InteractionData = ChoiceInteractionData | TextEntryInteractionData | ExtendedTextInteractionData | InlineChoiceInteractionData | OrderInteractionData | MatchInteractionData | AssociateInteractionData | GapMatchInteractionData | SliderInteractionData | HotspotInteractionData | GraphicGapMatchInteractionData | UploadInteractionData | DrawingInteractionData | CustomInteractionData | PortableCustomInteractionData | MediaInteractionData | HottextInteractionData | SelectPointInteractionData | GraphicOrderInteractionData | GraphicAssociateInteractionData | PositionObjectInteractionData | EndAttemptInteractionData;
|
|
348
360
|
/**
|
|
349
361
|
* QTI interaction type identifier
|
|
350
362
|
* Extensible string type allows custom interaction types
|
|
@@ -369,6 +381,7 @@ export interface InteractionDataMap {
|
|
|
369
381
|
uploadInteraction: UploadInteractionData;
|
|
370
382
|
drawingInteraction: DrawingInteractionData;
|
|
371
383
|
customInteraction: CustomInteractionData;
|
|
384
|
+
portableCustomInteraction: PortableCustomInteractionData;
|
|
372
385
|
mediaInteraction: MediaInteractionData;
|
|
373
386
|
hottextInteraction: HottextInteractionData;
|
|
374
387
|
selectPointInteraction: SelectPointInteractionData;
|
|
@@ -396,6 +409,7 @@ export interface InteractionValueMap {
|
|
|
396
409
|
uploadInteraction: QTIFileResponse | null;
|
|
397
410
|
drawingInteraction: string;
|
|
398
411
|
customInteraction: any;
|
|
412
|
+
portableCustomInteraction: unknown;
|
|
399
413
|
mediaInteraction: any;
|
|
400
414
|
hottextInteraction: string[];
|
|
401
415
|
selectPointInteraction: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/interactions/shared/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * Interaction type mappings for strongly-typed registry\n *\n * This file defines the complete type system for the plugin-based\n * interaction renderer registry, ensuring compile-time type safety.\n */\n\nimport type { HTMLElement } from 'node-html-parser';\nimport type { HtmlContent, QTIFileResponse } from '../../types/index.js';\n\n/**\n * Type alias for parsed QTI XML elements\n * Uses node-html-parser's HTMLElement type directly\n */\nexport type QTIElement = HTMLElement;\n\nexport interface BaseInteractionData {\n\ttype: string;\n\tresponseId: string;\n}\n\nexport interface ChoiceInteractionData extends BaseInteractionData {\n\ttype: 'choiceInteraction';\n\tshuffle: boolean;\n\tmaxChoices: number;\n\tminChoices: number;\n\tprompt: string | null;\n\tchoices: Array<{ identifier: string; text: HtmlContent; fixed?: boolean; classes?: string[] }>;\n\t/** CSS classes from the choiceInteraction element for custom renderer detection */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxChoices (data-max-selections-message) */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minChoices (data-min-selections-message) */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface TextEntryInteractionData extends BaseInteractionData {\n\ttype: 'textEntryInteraction';\n\texpectedLength: number;\n\tpatternMask: string | null;\n\tplaceholderText: string;\n\tformat?: string;\n\t/** CSS classes from the textEntryInteraction element (e.g. qti-input-width-N) */\n\tinteractionClasses?: string[];\n\t/** Pattern mask validation message (data-patternmask-message) */\n\tpatternMaskMessage?: string | null;\n}\n\nexport interface ExtendedTextInteractionData extends BaseInteractionData {\n\ttype: 'extendedTextInteraction';\n\texpectedLines: number;\n\texpectedLength: number;\n\tprompt: string | null;\n\tplaceholderText: string;\n\tformat: string;\n\tpatternMask?: string | null;\n\tpatternMaskMessage?: string | null;\n\t/** CSS classes from the extendedTextInteraction element (e.g. qti-height-lines-N) */\n\tinteractionClasses?: string[];\n}\n\nexport interface InlineChoiceInteractionData extends BaseInteractionData {\n\ttype: 'inlineChoiceInteraction';\n\tshuffle: boolean;\n\t/** Placeholder label from the QTI <label> child element; shown as the unselected \"Select…\" option */\n\tlabel: string | null;\n\t/** Placeholder text from data-prompt attribute; alternative to <label> for dropdown default option */\n\tdataPrompt?: string | null;\n\tchoices: Array<{ identifier: string; text: string; fixed?: boolean }>;\n\t/** CSS classes from the inlineChoiceInteraction element (e.g. qti-input-width-N) */\n\tinteractionClasses?: string[];\n}\n\nexport interface OrderInteractionData extends BaseInteractionData {\n\ttype: 'orderInteraction';\n\tshuffle: boolean;\n\tminChoices: number;\n\tmaxChoices: number;\n\tprompt: string | null;\n\tchoices: Array<{ identifier: string; text: string; fixed?: boolean }>;\n}\n\nexport interface AssociableChoice {\n\tidentifier: string;\n\ttext: string;\n\tmatchMax: number;\n\t/** Minimum number of times this choice must appear in the response (QTI matchMin) */\n\tmatchMin?: number;\n\t/** Pairing constraint: choice can only be paired with others sharing a group value (QTI matchGroup) */\n\tmatchGroup?: string[];\n\t/** CSS classes from the choice element for custom renderer detection */\n\tclasses?: string[];\n}\n\nexport interface MatchInteractionData extends BaseInteractionData {\n\ttype: 'matchInteraction';\n\tshuffle: boolean;\n\tmaxAssociations: number;\n\tminAssociations?: number;\n\tprompt: string | null;\n\tsourceSet: AssociableChoice[];\n\ttargetSet: AssociableChoice[];\n\t/** CSS classes from the matchInteraction element (e.g. qti-choices-top, qti-match-tabular) */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxAssociations */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minAssociations */\n\tminSelectionsMessage?: string | null;\n\t/** Label for first column header in tabular mode (data-qti-first-column-header) */\n\tfirstColumnHeader?: string | null;\n}\n\nexport interface AssociateInteractionData extends BaseInteractionData {\n\ttype: 'associateInteraction';\n\tshuffle: boolean;\n\tmaxAssociations: number;\n\tminAssociations?: number;\n\tprompt: string | null;\n\tchoices: AssociableChoice[];\n}\n\nexport interface GapMatchInteractionData extends BaseInteractionData {\n\ttype: 'gapMatchInteraction';\n\tshuffle: boolean;\n\tprompt: string | null;\n\tgapTexts: Array<{ identifier: string; text: string; matchMax: number; matchGroup?: string[]; inputWidth?: number }>;\n\tgaps: Array<{ identifier: string; index: number }>;\n\tpromptText: string;\n\t/** CSS classes from the gapMatchInteraction element (e.g. qti-choices-top, qti-choices-bottom) */\n\tinteractionClasses?: string[];\n\t/** Width of the choice container in px (data-choices-container-width) */\n\tchoicesContainerWidth?: string | null;\n\t/** Message shown when candidate exceeds max associations */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below min associations */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface SliderInteractionData extends BaseInteractionData {\n\ttype: 'sliderInteraction';\n\tlowerBound: number;\n\tupperBound: number;\n\tstep: number;\n\torientation: string;\n\treverse: boolean;\n\tprompt: string | null;\n}\n\nexport interface ImageData {\n\ttype: 'svg' | 'image';\n\tcontent?: HtmlContent;\n\tsrc?: string;\n\twidth: string;\n\theight: string;\n}\n\nexport interface HotspotChoice {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\t/** Author-provided label for the hotspot; used as accessible aria-label */\n\thotspotLabel?: string;\n}\n\nexport interface HotspotInteractionData extends BaseInteractionData {\n\ttype: 'hotspotInteraction';\n\tmaxChoices: number;\n\tminChoices?: number;\n\tprompt: string | null;\n\timageData: ImageData | null;\n\thotspotChoices: HotspotChoice[];\n\t/** CSS classes from the hotspotInteraction element (e.g. qti-selections-light, qti-selections-dark) */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxChoices */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minChoices */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface AssociableHotspot {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\tmatchMax: number;\n}\n\nexport interface GraphicGapMatchInteractionData extends BaseInteractionData {\n\ttype: 'graphicGapMatchInteraction';\n\tprompt: string | null;\n\timageData: ImageData | null;\n\tmaxAssociations: number;\n\tgapTexts: Array<{ identifier: string; text: string; matchMax: number; matchGroup?: string[] }>;\n\t/** Image-based draggable labels (gapImg elements); rendered as <img> in the choice pool */\n\tgapImages: Array<{ identifier: string; src: string; alt: string; matchMax: number; matchGroup?: string[]; width?: number; height?: number }>;\n\thotspots: AssociableHotspot[];\n\t/** CSS classes from the graphicGapMatchInteraction element (e.g. qti-choices-top, qti-selections-dark) */\n\tinteractionClasses?: string[];\n\t/** Width of the choice container in px (data-choices-container-width) */\n\tchoicesContainerWidth?: string | null;\n\t/** Message shown when candidate exceeds max associations */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below min associations */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface UploadInteractionData extends BaseInteractionData {\n\ttype: 'uploadInteraction';\n\tprompt: string | null;\n\t/** Allowed MIME types / extensions (vendor-dependent); empty = accept any */\n\tfileTypes: string[];\n\trawAttributes: Record<string, string>;\n}\n\nexport interface DrawingInteractionData extends BaseInteractionData {\n\ttype: 'drawingInteraction';\n\tprompt: string | null;\n\t/** Optional background image/SVG to draw on top of */\n\timageData: ImageData | null;\n\trawAttributes: Record<string, string>;\n}\n\nexport interface CustomInteractionData extends BaseInteractionData {\n\ttype: 'customInteraction';\n\tprompt: string | null;\n\trawAttributes: Record<string, string>;\n\t/** Outer XML snippet for debugging (best-effort) */\n\txml: string;\n}\n\nexport interface MediaElement {\n\ttype: 'audio' | 'video' | 'object';\n\tsrc: string;\n\tmimeType: string;\n\twidth?: number;\n\theight?: number;\n}\n\nexport interface MediaInteractionData extends BaseInteractionData {\n\ttype: 'mediaInteraction';\n\tprompt: string | null;\n\tautostart: boolean;\n\tminPlays: number;\n\tmaxPlays: number; // 0 = unlimited\n\tloop: boolean;\n\tmediaElement: MediaElement;\n\t/** Whether the renderer should allow <object> embeds for this interaction (default false) */\n\tallowObjectEmbeds?: boolean;\n}\n\nexport interface HottextChoice {\n\tidentifier: string;\n\ttext: string;\n}\n\nexport interface HottextInteractionData extends BaseInteractionData {\n\ttype: 'hottextInteraction';\n\tprompt: string | null;\n\tmaxChoices: number;\n\tminChoices: number;\n\tcontentHtml: HtmlContent;\n\thottextChoices: HottextChoice[];\n\t/** CSS classes from the hottextInteraction element (e.g. qti-input-control-hidden) */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxChoices */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minChoices */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface Point {\n\tx: number;\n\ty: number;\n}\n\nexport interface SelectPointInteractionData extends BaseInteractionData {\n\ttype: 'selectPointInteraction';\n\tprompt: string | null;\n\tmaxChoices: number;\n\tminChoices: number;\n\timageData: ImageData | null;\n}\n\nexport interface GraphicOrderChoice {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\tlabel: string;\n}\n\nexport interface GraphicOrderInteractionData extends BaseInteractionData {\n\ttype: 'graphicOrderInteraction';\n\tprompt: string | null;\n\timageData: ImageData | null;\n\thotspotChoices: GraphicOrderChoice[];\n}\n\nexport interface GraphicAssociateHotspot {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\tmatchMax: number;\n\tlabel: string;\n\t/** Pairing constraint: hotspot can only be associated with others sharing a group value (QTI matchGroup) */\n\tmatchGroup?: string[];\n}\n\nexport interface GraphicAssociateInteractionData extends BaseInteractionData {\n\ttype: 'graphicAssociateInteraction';\n\tprompt: string | null;\n\tmaxAssociations: number;\n\tminAssociations: number;\n\timageData: ImageData | null;\n\tassociableHotspots: GraphicAssociateHotspot[];\n}\n\nexport interface PositionObjectStage {\n\tidentifier: string;\n\tmatchMax: number;\n\tobjectData: {\n\t\ttype: 'image' | 'svg';\n\t\tsrc?: string;\n\t\tcontent?: HtmlContent;\n\t\twidth?: string;\n\t\theight?: string;\n\t} | null;\n\tlabel: string;\n}\n\nexport interface PositionObjectInteractionData extends BaseInteractionData {\n\ttype: 'positionObjectInteraction';\n\tprompt: string | null;\n\tmaxChoices: number;\n\tminChoices: number;\n\tcenterPoint: boolean;\n\timageData: ImageData | null;\n\tpositionObjectStages: PositionObjectStage[];\n}\n\nexport interface EndAttemptInteractionData extends BaseInteractionData {\n\ttype: 'endAttemptInteraction';\n\tprompt: string | null;\n\ttitle: string;\n\t/** Whether this interaction counts as an attempt (default: true) */\n\tcountAttempt: boolean;\n}\n\nexport type InteractionData =\n\t| ChoiceInteractionData\n\t| TextEntryInteractionData\n\t| ExtendedTextInteractionData\n\t| InlineChoiceInteractionData\n\t| OrderInteractionData\n\t| MatchInteractionData\n\t| AssociateInteractionData\n\t| GapMatchInteractionData\n\t| SliderInteractionData\n\t| HotspotInteractionData\n\t| GraphicGapMatchInteractionData\n\t| UploadInteractionData\n\t| DrawingInteractionData\n\t| CustomInteractionData\n\t| MediaInteractionData\n\t| HottextInteractionData\n\t| SelectPointInteractionData\n\t| GraphicOrderInteractionData\n\t| GraphicAssociateInteractionData\n\t| PositionObjectInteractionData\n\t| EndAttemptInteractionData;\n\n/**\n * QTI interaction type identifier\n * Extensible string type allows custom interaction types\n */\nexport type InteractionType = string;\n\n/**\n * Map interaction types to their data structures\n * TypeScript will ensure registrations use the correct data type\n */\nexport interface InteractionDataMap {\n\tchoiceInteraction: ChoiceInteractionData;\n\ttextEntryInteraction: TextEntryInteractionData;\n\textendedTextInteraction: ExtendedTextInteractionData;\n\tinlineChoiceInteraction: InlineChoiceInteractionData;\n\torderInteraction: OrderInteractionData;\n\tmatchInteraction: MatchInteractionData;\n\tassociateInteraction: AssociateInteractionData;\n\tgapMatchInteraction: GapMatchInteractionData;\n\tsliderInteraction: SliderInteractionData;\n\thotspotInteraction: HotspotInteractionData;\n\tgraphicGapMatchInteraction: GraphicGapMatchInteractionData;\n\tuploadInteraction: UploadInteractionData;\n\tdrawingInteraction: DrawingInteractionData;\n\tcustomInteraction: CustomInteractionData;\n\tmediaInteraction: MediaInteractionData;\n\thottextInteraction: HottextInteractionData;\n\tselectPointInteraction: SelectPointInteractionData;\n\tgraphicOrderInteraction: GraphicOrderInteractionData;\n\tgraphicAssociateInteraction: GraphicAssociateInteractionData;\n\tpositionObjectInteraction: PositionObjectInteractionData;\n\tendAttemptInteraction: EndAttemptInteractionData;\n}\n\n/**\n * Map interaction types to their response value types\n * Ensures getValue/setValue use the correct types\n */\nexport interface InteractionValueMap {\n\tchoiceInteraction: string | string[];\n\ttextEntryInteraction: string;\n\textendedTextInteraction: string;\n\tinlineChoiceInteraction: string;\n\torderInteraction: string[];\n\tmatchInteraction: Record<string, string>;\n\tassociateInteraction: Array<[string, string]>;\n\tgapMatchInteraction: Record<string, string>;\n\tsliderInteraction: number;\n\thotspotInteraction: string[];\n\tgraphicGapMatchInteraction: Record<string, string>;\n\tuploadInteraction: QTIFileResponse | null;\n\tdrawingInteraction: string;\n\tcustomInteraction: any;\n\tmediaInteraction: any;\n\thottextInteraction: string[];\n\tselectPointInteraction: Array<{ x: number; y: number }>;\n\tgraphicOrderInteraction: string[];\n\tgraphicAssociateInteraction: Array<[string, string]>;\n\tpositionObjectInteraction: Record<string, { x: number; y: number }>;\n\tendAttemptInteraction: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/interactions/shared/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * Interaction type mappings for strongly-typed registry\n *\n * This file defines the complete type system for the plugin-based\n * interaction renderer registry, ensuring compile-time type safety.\n */\n\nimport type { HTMLElement } from 'node-html-parser';\nimport type { ExtractedPci } from '../../pci/types.js';\nimport type { HtmlContent, QTIFileResponse } from '../../types/index.js';\n\n/**\n * Type alias for parsed QTI XML elements\n * Uses node-html-parser's HTMLElement type directly\n */\nexport type QTIElement = HTMLElement;\n\nexport interface BaseInteractionData {\n\ttype: string;\n\tresponseId: string;\n}\n\nexport interface ChoiceInteractionData extends BaseInteractionData {\n\ttype: 'choiceInteraction';\n\tshuffle: boolean;\n\tmaxChoices: number;\n\tminChoices: number;\n\tprompt: string | null;\n\tchoices: Array<{ identifier: string; text: HtmlContent; fixed?: boolean; classes?: string[] }>;\n\t/** CSS classes from the choiceInteraction element for custom renderer detection */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxChoices (data-max-selections-message) */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minChoices (data-min-selections-message) */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface TextEntryInteractionData extends BaseInteractionData {\n\ttype: 'textEntryInteraction';\n\texpectedLength: number;\n\tpatternMask: string | null;\n\tplaceholderText: string;\n\tformat?: string;\n\t/** CSS classes from the textEntryInteraction element (e.g. qti-input-width-N) */\n\tinteractionClasses?: string[];\n\t/** Pattern mask validation message (data-patternmask-message) */\n\tpatternMaskMessage?: string | null;\n}\n\nexport interface ExtendedTextInteractionData extends BaseInteractionData {\n\ttype: 'extendedTextInteraction';\n\tcardinality: 'single' | 'multiple' | 'ordered' | 'record';\n\tbaseType?: string;\n\tbase: number;\n\tstringIdentifier?: string;\n\tminStrings: number;\n\t/** Zero means no authored upper bound. */\n\tmaxStrings: number;\n\texpectedLines: number;\n\texpectedLength: number;\n\tprompt: string | null;\n\tplaceholderText: string;\n\tformat: string;\n\tpatternMask?: string | null;\n\tpatternMaskMessage?: string | null;\n\t/** CSS classes from the extendedTextInteraction element (e.g. qti-height-lines-N) */\n\tinteractionClasses?: string[];\n}\n\nexport interface InlineChoiceInteractionData extends BaseInteractionData {\n\ttype: 'inlineChoiceInteraction';\n\tshuffle: boolean;\n\t/** Placeholder label from the QTI <label> child element; shown as the unselected \"Select…\" option */\n\tlabel: string | null;\n\t/** Placeholder text from data-prompt attribute; alternative to <label> for dropdown default option */\n\tdataPrompt?: string | null;\n\tchoices: Array<{ identifier: string; text: string; fixed?: boolean }>;\n\t/** CSS classes from the inlineChoiceInteraction element (e.g. qti-input-width-N) */\n\tinteractionClasses?: string[];\n}\n\nexport interface OrderInteractionData extends BaseInteractionData {\n\ttype: 'orderInteraction';\n\tshuffle: boolean;\n\tminChoices: number;\n\tmaxChoices: number;\n\tprompt: string | null;\n\tchoices: Array<{ identifier: string; text: string; fixed?: boolean }>;\n}\n\nexport interface AssociableChoice {\n\tidentifier: string;\n\ttext: string;\n\tmatchMax: number;\n\t/** Minimum number of times this choice must appear in the response (QTI matchMin) */\n\tmatchMin?: number;\n\t/** Pairing constraint: choice can only be paired with others sharing a group value (QTI matchGroup) */\n\tmatchGroup?: string[];\n\t/** CSS classes from the choice element for custom renderer detection */\n\tclasses?: string[];\n}\n\nexport interface MatchInteractionData extends BaseInteractionData {\n\ttype: 'matchInteraction';\n\tshuffle: boolean;\n\tmaxAssociations: number;\n\tminAssociations?: number;\n\tprompt: string | null;\n\tsourceSet: AssociableChoice[];\n\ttargetSet: AssociableChoice[];\n\t/** CSS classes from the matchInteraction element (e.g. qti-choices-top, qti-match-tabular) */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxAssociations */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minAssociations */\n\tminSelectionsMessage?: string | null;\n\t/** Label for first column header in tabular mode (data-qti-first-column-header) */\n\tfirstColumnHeader?: string | null;\n}\n\nexport interface AssociateInteractionData extends BaseInteractionData {\n\ttype: 'associateInteraction';\n\tshuffle: boolean;\n\tmaxAssociations: number;\n\tminAssociations?: number;\n\tprompt: string | null;\n\tchoices: AssociableChoice[];\n}\n\nexport interface GapMatchInteractionData extends BaseInteractionData {\n\ttype: 'gapMatchInteraction';\n\tshuffle: boolean;\n\tprompt: string | null;\n\tgapTexts: Array<{ identifier: string; text: string; matchMax: number; matchGroup?: string[]; inputWidth?: number }>;\n\tgaps: Array<{ identifier: string; index: number }>;\n\tpromptText: string;\n\t/** CSS classes from the gapMatchInteraction element (e.g. qti-choices-top, qti-choices-bottom) */\n\tinteractionClasses?: string[];\n\t/** Width of the choice container in px (data-choices-container-width) */\n\tchoicesContainerWidth?: string | null;\n\t/** Message shown when candidate exceeds max associations */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below min associations */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface SliderInteractionData extends BaseInteractionData {\n\ttype: 'sliderInteraction';\n\tlowerBound: number;\n\tupperBound: number;\n\tstep: number;\n\torientation: string;\n\treverse: boolean;\n\tprompt: string | null;\n}\n\nexport interface ImageData {\n\ttype: 'svg' | 'image';\n\tcontent?: HtmlContent;\n\tsrc?: string;\n\twidth: string;\n\theight: string;\n}\n\nexport interface HotspotChoice {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\t/** Author-provided label for the hotspot; used as accessible aria-label */\n\thotspotLabel?: string;\n}\n\nexport interface HotspotInteractionData extends BaseInteractionData {\n\ttype: 'hotspotInteraction';\n\tmaxChoices: number;\n\tminChoices?: number;\n\tprompt: string | null;\n\timageData: ImageData | null;\n\thotspotChoices: HotspotChoice[];\n\t/** CSS classes from the hotspotInteraction element (e.g. qti-selections-light, qti-selections-dark) */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxChoices */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minChoices */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface AssociableHotspot {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\tmatchMax: number;\n}\n\nexport interface GraphicGapMatchInteractionData extends BaseInteractionData {\n\ttype: 'graphicGapMatchInteraction';\n\tprompt: string | null;\n\timageData: ImageData | null;\n\tmaxAssociations: number;\n\tgapTexts: Array<{ identifier: string; text: string; matchMax: number; matchGroup?: string[] }>;\n\t/** Image-based draggable labels (gapImg elements); rendered as <img> in the choice pool */\n\tgapImages: Array<{ identifier: string; src: string; alt: string; matchMax: number; matchGroup?: string[]; width?: number; height?: number }>;\n\thotspots: AssociableHotspot[];\n\t/** CSS classes from the graphicGapMatchInteraction element (e.g. qti-choices-top, qti-selections-dark) */\n\tinteractionClasses?: string[];\n\t/** Width of the choice container in px (data-choices-container-width) */\n\tchoicesContainerWidth?: string | null;\n\t/** Message shown when candidate exceeds max associations */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below min associations */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface UploadInteractionData extends BaseInteractionData {\n\ttype: 'uploadInteraction';\n\tprompt: string | null;\n\t/** Allowed MIME types / extensions (vendor-dependent); empty = accept any */\n\tfileTypes: string[];\n\trawAttributes: Record<string, string>;\n}\n\nexport interface DrawingInteractionData extends BaseInteractionData {\n\ttype: 'drawingInteraction';\n\tprompt: string | null;\n\t/** Optional background image/SVG to draw on top of */\n\timageData: ImageData | null;\n\trawAttributes: Record<string, string>;\n}\n\nexport interface CustomInteractionData extends BaseInteractionData {\n\ttype: 'customInteraction';\n\tprompt: string | null;\n\trawAttributes: Record<string, string>;\n\t/** Outer XML snippet for debugging (best-effort) */\n\txml: string;\n}\n\n/** Canonical interaction data for QTI 2.x and 3.0 Portable Custom Interactions. */\nexport interface PortableCustomInteractionData extends BaseInteractionData, ExtractedPci {\n\ttype: 'portableCustomInteraction';\n}\n\nexport interface MediaElement {\n\ttype: 'audio' | 'video' | 'object';\n\tsrc: string;\n\tmimeType: string;\n\twidth?: number;\n\theight?: number;\n}\n\nexport interface MediaInteractionData extends BaseInteractionData {\n\ttype: 'mediaInteraction';\n\tprompt: string | null;\n\tautostart: boolean;\n\tminPlays: number;\n\tmaxPlays: number; // 0 = unlimited\n\tloop: boolean;\n\tmediaElement: MediaElement;\n\t/** Whether the renderer should allow <object> embeds for this interaction (default false) */\n\tallowObjectEmbeds?: boolean;\n}\n\nexport interface HottextChoice {\n\tidentifier: string;\n\ttext: string;\n}\n\nexport interface HottextInteractionData extends BaseInteractionData {\n\ttype: 'hottextInteraction';\n\tprompt: string | null;\n\tmaxChoices: number;\n\tminChoices: number;\n\tcontentHtml: HtmlContent;\n\thottextChoices: HottextChoice[];\n\t/** CSS classes from the hottextInteraction element (e.g. qti-input-control-hidden) */\n\tinteractionClasses?: string[];\n\t/** Message shown when candidate exceeds maxChoices */\n\tmaxSelectionsMessage?: string | null;\n\t/** Message shown when candidate submits below minChoices */\n\tminSelectionsMessage?: string | null;\n}\n\nexport interface Point {\n\tx: number;\n\ty: number;\n}\n\nexport interface SelectPointInteractionData extends BaseInteractionData {\n\ttype: 'selectPointInteraction';\n\tprompt: string | null;\n\tmaxChoices: number;\n\tminChoices: number;\n\timageData: ImageData | null;\n}\n\nexport interface GraphicOrderChoice {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\tlabel: string;\n}\n\nexport interface GraphicOrderInteractionData extends BaseInteractionData {\n\ttype: 'graphicOrderInteraction';\n\tprompt: string | null;\n\timageData: ImageData | null;\n\thotspotChoices: GraphicOrderChoice[];\n}\n\nexport interface GraphicAssociateHotspot {\n\tidentifier: string;\n\tshape: string;\n\tcoords: string;\n\tmatchMax: number;\n\tlabel: string;\n\t/** Pairing constraint: hotspot can only be associated with others sharing a group value (QTI matchGroup) */\n\tmatchGroup?: string[];\n}\n\nexport interface GraphicAssociateInteractionData extends BaseInteractionData {\n\ttype: 'graphicAssociateInteraction';\n\tprompt: string | null;\n\tmaxAssociations: number;\n\tminAssociations: number;\n\timageData: ImageData | null;\n\tassociableHotspots: GraphicAssociateHotspot[];\n}\n\nexport interface PositionObjectStage {\n\tidentifier: string;\n\tmatchMax: number;\n\tobjectData: {\n\t\ttype: 'image' | 'svg';\n\t\tsrc?: string;\n\t\tcontent?: HtmlContent;\n\t\twidth?: string;\n\t\theight?: string;\n\t} | null;\n\tlabel: string;\n}\n\nexport interface PositionObjectInteractionData extends BaseInteractionData {\n\ttype: 'positionObjectInteraction';\n\tprompt: string | null;\n\tmaxChoices: number;\n\tminChoices: number;\n\tcenterPoint: boolean;\n\timageData: ImageData | null;\n\tpositionObjectStages: PositionObjectStage[];\n}\n\nexport interface EndAttemptInteractionData extends BaseInteractionData {\n\ttype: 'endAttemptInteraction';\n\tprompt: string | null;\n\ttitle: string;\n\t/** Whether this interaction counts as an attempt (default: true) */\n\tcountAttempt: boolean;\n}\n\nexport type InteractionData =\n\t| ChoiceInteractionData\n\t| TextEntryInteractionData\n\t| ExtendedTextInteractionData\n\t| InlineChoiceInteractionData\n\t| OrderInteractionData\n\t| MatchInteractionData\n\t| AssociateInteractionData\n\t| GapMatchInteractionData\n\t| SliderInteractionData\n\t| HotspotInteractionData\n\t| GraphicGapMatchInteractionData\n\t| UploadInteractionData\n\t| DrawingInteractionData\n\t| CustomInteractionData\n\t| PortableCustomInteractionData\n\t| MediaInteractionData\n\t| HottextInteractionData\n\t| SelectPointInteractionData\n\t| GraphicOrderInteractionData\n\t| GraphicAssociateInteractionData\n\t| PositionObjectInteractionData\n\t| EndAttemptInteractionData;\n\n/**\n * QTI interaction type identifier\n * Extensible string type allows custom interaction types\n */\nexport type InteractionType = string;\n\n/**\n * Map interaction types to their data structures\n * TypeScript will ensure registrations use the correct data type\n */\nexport interface InteractionDataMap {\n\tchoiceInteraction: ChoiceInteractionData;\n\ttextEntryInteraction: TextEntryInteractionData;\n\textendedTextInteraction: ExtendedTextInteractionData;\n\tinlineChoiceInteraction: InlineChoiceInteractionData;\n\torderInteraction: OrderInteractionData;\n\tmatchInteraction: MatchInteractionData;\n\tassociateInteraction: AssociateInteractionData;\n\tgapMatchInteraction: GapMatchInteractionData;\n\tsliderInteraction: SliderInteractionData;\n\thotspotInteraction: HotspotInteractionData;\n\tgraphicGapMatchInteraction: GraphicGapMatchInteractionData;\n\tuploadInteraction: UploadInteractionData;\n\tdrawingInteraction: DrawingInteractionData;\n\tcustomInteraction: CustomInteractionData;\n\tportableCustomInteraction: PortableCustomInteractionData;\n\tmediaInteraction: MediaInteractionData;\n\thottextInteraction: HottextInteractionData;\n\tselectPointInteraction: SelectPointInteractionData;\n\tgraphicOrderInteraction: GraphicOrderInteractionData;\n\tgraphicAssociateInteraction: GraphicAssociateInteractionData;\n\tpositionObjectInteraction: PositionObjectInteractionData;\n\tendAttemptInteraction: EndAttemptInteractionData;\n}\n\n/**\n * Map interaction types to their response value types\n * Ensures getValue/setValue use the correct types\n */\nexport interface InteractionValueMap {\n\tchoiceInteraction: string | string[];\n\ttextEntryInteraction: string;\n\textendedTextInteraction: string;\n\tinlineChoiceInteraction: string;\n\torderInteraction: string[];\n\tmatchInteraction: Record<string, string>;\n\tassociateInteraction: Array<[string, string]>;\n\tgapMatchInteraction: Record<string, string>;\n\tsliderInteraction: number;\n\thotspotInteraction: string[];\n\tgraphicGapMatchInteraction: Record<string, string>;\n\tuploadInteraction: QTIFileResponse | null;\n\tdrawingInteraction: string;\n\tcustomInteraction: any;\n\tportableCustomInteraction: unknown;\n\tmediaInteraction: any;\n\thottextInteraction: string[];\n\tselectPointInteraction: Array<{ x: number; y: number }>;\n\tgraphicOrderInteraction: string[];\n\tgraphicAssociateInteraction: Array<[string, string]>;\n\tpositionObjectInteraction: Record<string, { x: number; y: number }>;\n\tendAttemptInteraction: boolean;\n}\n"]}
|
package/dist/pci/PciHost.d.ts
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import type { ExtractedPci } from './types.js';
|
|
1
|
+
import type { ExtractedPci, PciHostController, PciHostOptions } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Loads, initializes, and manages the lifecycle of a single PCI module.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* const host = new PciHost(extractedData, baseUrl);
|
|
6
|
+
* const host = new PciHost(extractedData, { baseUrl, moduleResolver });
|
|
7
7
|
* await host.load();
|
|
8
8
|
* host.initialize(domNode);
|
|
9
9
|
* host.getResponse(); // returns current response
|
|
10
10
|
* host.destroy(); // cleanup on player teardown
|
|
11
11
|
*/
|
|
12
|
-
export declare class PciHost {
|
|
12
|
+
export declare class PciHost implements PciHostController {
|
|
13
13
|
private readonly data;
|
|
14
14
|
private readonly baseUrl;
|
|
15
|
+
private readonly moduleResolver;
|
|
15
16
|
private module;
|
|
17
|
+
private destroyed;
|
|
18
|
+
private loadGeneration;
|
|
16
19
|
private _response;
|
|
17
|
-
private
|
|
18
|
-
|
|
20
|
+
private _hasResponse;
|
|
21
|
+
private readonly _responseChangeListeners;
|
|
22
|
+
constructor(data: ExtractedPci, options?: PciHostOptions | string);
|
|
19
23
|
/**
|
|
20
24
|
* Register a callback to fire when the PCI's response changes.
|
|
21
25
|
* The player calls this to wire the PCI into its internal response map.
|
|
22
26
|
*/
|
|
23
|
-
onResponseChange(callback: (responseId: string, value: unknown) => void): void;
|
|
27
|
+
onResponseChange(callback: (responseId: string, value: unknown) => void): () => void;
|
|
24
28
|
/**
|
|
25
29
|
* Load the PCI module from primaryPath, falling back to fallbackPath.
|
|
26
30
|
* Throws PciLoadError if both fail.
|
|
@@ -41,11 +45,12 @@ export declare class PciHost {
|
|
|
41
45
|
enable(): void;
|
|
42
46
|
/** Tear down the PCI and release all resources. */
|
|
43
47
|
destroy(): void;
|
|
44
|
-
|
|
45
|
-
protected dynamicImport(url: string): Promise<any>;
|
|
48
|
+
private resolveModule;
|
|
46
49
|
private resolveUrl;
|
|
50
|
+
private isCurrentLoad;
|
|
51
|
+
private adoptResolvedModule;
|
|
47
52
|
/**
|
|
48
|
-
* Extract a PciModule from
|
|
53
|
+
* Extract a PciModule from the host resolver's result.
|
|
49
54
|
* Supports: default export, named `getInstance` export, or the module itself.
|
|
50
55
|
*/
|
|
51
56
|
private extractPciInterface;
|