@examplary/qti 0.0.1 → 1.0.0
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 +6 -1
- package/dist/ims/ims-package.d.ts +1 -1
- package/dist/ims/ims-package.js +2 -2
- package/dist/ims/ims-package.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/qti/interactions/associate-interaction.d.ts +36 -0
- package/dist/qti/interactions/associate-interaction.js +46 -0
- package/dist/qti/interactions/associate-interaction.js.map +1 -0
- package/dist/qti/interactions/choice-interaction.d.ts +36 -0
- package/dist/qti/interactions/choice-interaction.js +43 -0
- package/dist/qti/interactions/choice-interaction.js.map +1 -0
- package/dist/qti/interactions/drawing-interaction.d.ts +25 -0
- package/dist/qti/interactions/drawing-interaction.js +30 -0
- package/dist/qti/interactions/drawing-interaction.js.map +1 -0
- package/dist/qti/interactions/end-attempt-interaction.d.ts +21 -0
- package/dist/qti/interactions/end-attempt-interaction.js +27 -0
- package/dist/qti/interactions/end-attempt-interaction.js.map +1 -0
- package/dist/qti/interactions/extended-text-interaction.d.ts +28 -0
- package/dist/qti/interactions/extended-text-interaction.js +34 -0
- package/dist/qti/interactions/extended-text-interaction.js.map +1 -0
- package/dist/qti/interactions/gap-match-interaction.d.ts +34 -0
- package/dist/qti/interactions/gap-match-interaction.js +46 -0
- package/dist/qti/interactions/gap-match-interaction.js.map +1 -0
- package/dist/qti/interactions/graphic-associate-interaction.d.ts +37 -0
- package/dist/qti/interactions/graphic-associate-interaction.js +47 -0
- package/dist/qti/interactions/graphic-associate-interaction.js.map +1 -0
- package/dist/qti/interactions/graphic-gap-match-interaction.d.ts +42 -0
- package/dist/qti/interactions/graphic-gap-match-interaction.js +64 -0
- package/dist/qti/interactions/graphic-gap-match-interaction.js.map +1 -0
- package/dist/qti/interactions/graphic-order-interaction.d.ts +28 -0
- package/dist/qti/interactions/graphic-order-interaction.js +46 -0
- package/dist/qti/interactions/graphic-order-interaction.js.map +1 -0
- package/dist/qti/interactions/hotspot-interaction.d.ts +41 -0
- package/dist/qti/interactions/hotspot-interaction.js +46 -0
- package/dist/qti/interactions/hotspot-interaction.js.map +1 -0
- package/dist/qti/interactions/hottext-interaction.d.ts +22 -0
- package/dist/qti/interactions/hottext-interaction.js +31 -0
- package/dist/qti/interactions/hottext-interaction.js.map +1 -0
- package/dist/qti/interactions/index.d.ts +63 -0
- package/dist/qti/interactions/index.js +64 -0
- package/dist/qti/interactions/index.js.map +1 -0
- package/dist/qti/interactions/inline-choice-interaction.d.ts +30 -0
- package/dist/qti/interactions/inline-choice-interaction.js +40 -0
- package/dist/qti/interactions/inline-choice-interaction.js.map +1 -0
- package/dist/qti/interactions/interaction.d.ts +20 -0
- package/dist/qti/interactions/interaction.js +24 -0
- package/dist/qti/interactions/interaction.js.map +1 -0
- package/dist/qti/interactions/match-interaction.d.ts +31 -0
- package/dist/qti/interactions/match-interaction.js +63 -0
- package/dist/qti/interactions/match-interaction.js.map +1 -0
- package/dist/qti/interactions/media-interaction.d.ts +31 -0
- package/dist/qti/interactions/media-interaction.js +36 -0
- package/dist/qti/interactions/media-interaction.js.map +1 -0
- package/dist/qti/interactions/order-interaction.d.ts +28 -0
- package/dist/qti/interactions/order-interaction.js +43 -0
- package/dist/qti/interactions/order-interaction.js.map +1 -0
- package/dist/qti/interactions/position-object-interaction.d.ts +36 -0
- package/dist/qti/interactions/position-object-interaction.js +43 -0
- package/dist/qti/interactions/position-object-interaction.js.map +1 -0
- package/dist/qti/interactions/select-point-interaction.d.ts +28 -0
- package/dist/qti/interactions/select-point-interaction.js +33 -0
- package/dist/qti/interactions/select-point-interaction.js.map +1 -0
- package/dist/qti/interactions/slider-interaction.d.ts +26 -0
- package/dist/qti/interactions/slider-interaction.js +32 -0
- package/dist/qti/interactions/slider-interaction.js.map +1 -0
- package/dist/qti/interactions/text-entry-interaction.d.ts +25 -0
- package/dist/qti/interactions/text-entry-interaction.js +31 -0
- package/dist/qti/interactions/text-entry-interaction.js.map +1 -0
- package/dist/qti/interactions/upload-interaction.d.ts +19 -0
- package/dist/qti/interactions/upload-interaction.js +25 -0
- package/dist/qti/interactions/upload-interaction.js.map +1 -0
- package/dist/qti/qti-element.d.ts +11 -0
- package/dist/qti/qti-element.js +29 -0
- package/dist/qti/qti-element.js.map +1 -0
- package/dist/qti/qti-item.d.ts +7 -3
- package/dist/qti/qti-item.js +18 -21
- package/dist/qti/qti-item.js.map +1 -1
- package/dist/qti/qti-test.d.ts +5 -3
- package/dist/qti/qti-test.js +8 -6
- package/dist/qti/qti-test.js.map +1 -1
- package/dist/utils/html.d.ts +2 -0
- package/dist/utils/html.js +15 -0
- package/dist/utils/html.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AssociableHotspotOptions } from "./graphic-associate-interaction";
|
|
2
|
+
import { ObjectOptions } from "./hotspot-interaction";
|
|
3
|
+
import { QtiPromptInteraction, QtiPromptInteractionOptions } from "./interaction";
|
|
4
|
+
export type GapImgOptions = {
|
|
5
|
+
identifier: string;
|
|
6
|
+
matchMax?: number;
|
|
7
|
+
matchMin?: number;
|
|
8
|
+
matchGroup?: string;
|
|
9
|
+
objectData: string;
|
|
10
|
+
objectType: string;
|
|
11
|
+
objectWidth?: number;
|
|
12
|
+
objectHeight?: number;
|
|
13
|
+
label?: string;
|
|
14
|
+
};
|
|
15
|
+
export type GraphicGapMatchInteractionOptions = QtiPromptInteractionOptions & {
|
|
16
|
+
minAssociations?: number;
|
|
17
|
+
maxAssociations?: number;
|
|
18
|
+
object: ObjectOptions;
|
|
19
|
+
gapImgs?: GapImgOptions[];
|
|
20
|
+
associableHotspots?: AssociableHotspotOptions[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Presents an image with gap regions and a set of images/text to drag onto those regions.
|
|
24
|
+
* Used for labeling diagrams or placing items in specific locations on an image.
|
|
25
|
+
*
|
|
26
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.ous502odpreo
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const interaction = new GraphicGapMatchInteraction({
|
|
30
|
+
* responseIdentifier: "RESPONSE",
|
|
31
|
+
* object: { data: "diagram.png", type: "image/png", width: 400, height: 300 },
|
|
32
|
+
* gapImgs: [
|
|
33
|
+
* { identifier: "img1", objectData: "label1.png", objectType: "image/png" },
|
|
34
|
+
* ],
|
|
35
|
+
* associableHotspots: [
|
|
36
|
+
* { identifier: "gap1", shape: "rect", coords: "50,50,100,80", matchMax: 1 },
|
|
37
|
+
* ],
|
|
38
|
+
* });
|
|
39
|
+
*/
|
|
40
|
+
export declare class GraphicGapMatchInteraction extends QtiPromptInteraction {
|
|
41
|
+
constructor(options: GraphicGapMatchInteractionOptions);
|
|
42
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { fragment } from "xmlbuilder2";
|
|
2
|
+
import { QtiPromptInteraction, } from "./interaction";
|
|
3
|
+
/**
|
|
4
|
+
* Presents an image with gap regions and a set of images/text to drag onto those regions.
|
|
5
|
+
* Used for labeling diagrams or placing items in specific locations on an image.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.ous502odpreo
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const interaction = new GraphicGapMatchInteraction({
|
|
11
|
+
* responseIdentifier: "RESPONSE",
|
|
12
|
+
* object: { data: "diagram.png", type: "image/png", width: 400, height: 300 },
|
|
13
|
+
* gapImgs: [
|
|
14
|
+
* { identifier: "img1", objectData: "label1.png", objectType: "image/png" },
|
|
15
|
+
* ],
|
|
16
|
+
* associableHotspots: [
|
|
17
|
+
* { identifier: "gap1", shape: "rect", coords: "50,50,100,80", matchMax: 1 },
|
|
18
|
+
* ],
|
|
19
|
+
* });
|
|
20
|
+
*/
|
|
21
|
+
export class GraphicGapMatchInteraction extends QtiPromptInteraction {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
super(options);
|
|
24
|
+
this.item = fragment().ele("qti-graphic-gap-match-interaction", {
|
|
25
|
+
"response-identifier": options.responseIdentifier,
|
|
26
|
+
label: options.label,
|
|
27
|
+
"min-associations": options.minAssociations?.toString(),
|
|
28
|
+
"max-associations": options.maxAssociations?.toString(),
|
|
29
|
+
});
|
|
30
|
+
this.item.ele("object", {
|
|
31
|
+
data: options.object.data,
|
|
32
|
+
type: options.object.type,
|
|
33
|
+
width: options.object.width?.toString(),
|
|
34
|
+
height: options.object.height?.toString(),
|
|
35
|
+
});
|
|
36
|
+
for (const gapImg of options.gapImgs || []) {
|
|
37
|
+
const gapImgEl = this.item.ele("qti-gap-img", {
|
|
38
|
+
identifier: gapImg.identifier,
|
|
39
|
+
"match-max": gapImg.matchMax?.toString(),
|
|
40
|
+
"match-min": gapImg.matchMin?.toString(),
|
|
41
|
+
"match-group": gapImg.matchGroup,
|
|
42
|
+
label: gapImg.label,
|
|
43
|
+
});
|
|
44
|
+
gapImgEl.ele("object", {
|
|
45
|
+
data: gapImg.objectData,
|
|
46
|
+
type: gapImg.objectType,
|
|
47
|
+
width: gapImg.objectWidth?.toString(),
|
|
48
|
+
height: gapImg.objectHeight?.toString(),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
for (const hotspot of options.associableHotspots || []) {
|
|
52
|
+
this.item.ele("qti-associable-hotspot", {
|
|
53
|
+
identifier: hotspot.identifier,
|
|
54
|
+
shape: hotspot.shape,
|
|
55
|
+
coords: hotspot.coords,
|
|
56
|
+
"match-max": hotspot.matchMax?.toString(),
|
|
57
|
+
"match-min": hotspot.matchMin?.toString(),
|
|
58
|
+
"match-group": hotspot.matchGroup,
|
|
59
|
+
"hotspot-label": hotspot.hotspotLabel,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=graphic-gap-match-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphic-gap-match-interaction.js","sourceRoot":"","sources":["../../../src/qti/interactions/graphic-gap-match-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIvC,OAAO,EACL,oBAAoB,GAErB,MAAM,eAAe,CAAC;AAsBvB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,0BAA2B,SAAQ,oBAAoB;IAClE,YAAY,OAA0C;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAC,GAAG,CAAC,mCAAmC,EAAE;YAC9D,qBAAqB,EAAE,OAAO,CAAC,kBAAkB;YACjD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,kBAAkB,EAAE,OAAO,CAAC,eAAe,EAAE,QAAQ,EAAE;YACvD,kBAAkB,EAAE,OAAO,CAAC,eAAe,EAAE,QAAQ,EAAE;SACxD,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACtB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACzB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACzB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE;YACvC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE;SAC1C,CAAC,CAAC;QAEH,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE;gBAC5C,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE;gBACxC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE;gBACxC,aAAa,EAAE,MAAM,CAAC,UAAU;gBAChC,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;YAEH,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE;gBACrB,IAAI,EAAE,MAAM,CAAC,UAAU;gBACvB,IAAI,EAAE,MAAM,CAAC,UAAU;gBACvB,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,QAAQ,EAAE;gBACrC,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,QAAQ,EAAE;aACxC,CAAC,CAAC;QACL,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,kBAAkB,IAAI,EAAE,EAAE,CAAC;YACvD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE;gBACtC,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,WAAW,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE;gBACzC,WAAW,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE;gBACzC,aAAa,EAAE,OAAO,CAAC,UAAU;gBACjC,eAAe,EAAE,OAAO,CAAC,YAAY;aACtC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HotspotShape, ObjectOptions, HotspotChoiceOptions } from "./hotspot-interaction";
|
|
2
|
+
import { QtiPromptInteraction, QtiPromptInteractionOptions } from "./interaction";
|
|
3
|
+
export { HotspotShape, ObjectOptions, HotspotChoiceOptions };
|
|
4
|
+
export type GraphicOrderInteractionOptions = QtiPromptInteractionOptions & {
|
|
5
|
+
minChoices?: number;
|
|
6
|
+
maxChoices?: number;
|
|
7
|
+
object: ObjectOptions;
|
|
8
|
+
hotspotChoices?: HotspotChoiceOptions[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Presents an image with hotspots for candidates to select in a specific order.
|
|
12
|
+
* Used for sequencing tasks on diagrams, maps, or other visual content.
|
|
13
|
+
*
|
|
14
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.973pocg92wxf
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const interaction = new GraphicOrderInteraction({
|
|
18
|
+
* responseIdentifier: "RESPONSE",
|
|
19
|
+
* object: { data: "diagram.png", type: "image/png", width: 400, height: 300 },
|
|
20
|
+
* hotspotChoices: [
|
|
21
|
+
* { identifier: "A", shape: "circle", coords: "100,100,20" },
|
|
22
|
+
* { identifier: "B", shape: "circle", coords: "200,150,20" },
|
|
23
|
+
* ],
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
export declare class GraphicOrderInteraction extends QtiPromptInteraction {
|
|
27
|
+
constructor(options: GraphicOrderInteractionOptions);
|
|
28
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { fragment } from "xmlbuilder2";
|
|
2
|
+
import { QtiPromptInteraction, } from "./interaction";
|
|
3
|
+
/**
|
|
4
|
+
* Presents an image with hotspots for candidates to select in a specific order.
|
|
5
|
+
* Used for sequencing tasks on diagrams, maps, or other visual content.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.973pocg92wxf
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const interaction = new GraphicOrderInteraction({
|
|
11
|
+
* responseIdentifier: "RESPONSE",
|
|
12
|
+
* object: { data: "diagram.png", type: "image/png", width: 400, height: 300 },
|
|
13
|
+
* hotspotChoices: [
|
|
14
|
+
* { identifier: "A", shape: "circle", coords: "100,100,20" },
|
|
15
|
+
* { identifier: "B", shape: "circle", coords: "200,150,20" },
|
|
16
|
+
* ],
|
|
17
|
+
* });
|
|
18
|
+
*/
|
|
19
|
+
export class GraphicOrderInteraction extends QtiPromptInteraction {
|
|
20
|
+
constructor(options) {
|
|
21
|
+
super(options);
|
|
22
|
+
this.item = fragment().ele("qti-graphic-order-interaction", {
|
|
23
|
+
"response-identifier": options.responseIdentifier,
|
|
24
|
+
label: options.label,
|
|
25
|
+
"min-choices": options.minChoices?.toString(),
|
|
26
|
+
"max-choices": options.maxChoices?.toString(),
|
|
27
|
+
});
|
|
28
|
+
this.item.ele("object", {
|
|
29
|
+
data: options.object.data,
|
|
30
|
+
type: options.object.type,
|
|
31
|
+
width: options.object.width?.toString(),
|
|
32
|
+
height: options.object.height?.toString(),
|
|
33
|
+
});
|
|
34
|
+
for (const hotspot of options.hotspotChoices || []) {
|
|
35
|
+
this.item.ele("qti-hotspot-choice", {
|
|
36
|
+
identifier: hotspot.identifier,
|
|
37
|
+
shape: hotspot.shape,
|
|
38
|
+
coords: hotspot.coords,
|
|
39
|
+
"hotspot-label": hotspot.hotspotLabel,
|
|
40
|
+
fixed: hotspot.fixed ? "true" : undefined,
|
|
41
|
+
"template-identifier": hotspot.templateIdentifier,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=graphic-order-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphic-order-interaction.js","sourceRoot":"","sources":["../../../src/qti/interactions/graphic-order-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,OAAO,EACL,oBAAoB,GAErB,MAAM,eAAe,CAAC;AAWvB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,uBAAwB,SAAQ,oBAAoB;IAC/D,YAAY,OAAuC;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAC,GAAG,CAAC,+BAA+B,EAAE;YAC1D,qBAAqB,EAAE,OAAO,CAAC,kBAAkB;YACjD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE;YAC7C,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE;SAC9C,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACtB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACzB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACzB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE;YACvC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE;SAC1C,CAAC,CAAC;QAEH,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,cAAc,IAAI,EAAE,EAAE,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE;gBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,eAAe,EAAE,OAAO,CAAC,YAAY;gBACrC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACzC,qBAAqB,EAAE,OAAO,CAAC,kBAAkB;aAClD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { QtiPromptInteraction, QtiPromptInteractionOptions } from "./interaction";
|
|
2
|
+
export type HotspotShape = "circle" | "rect" | "poly" | "ellipse" | "default";
|
|
3
|
+
export type HotspotChoiceOptions = {
|
|
4
|
+
identifier: string;
|
|
5
|
+
shape: HotspotShape;
|
|
6
|
+
coords: string;
|
|
7
|
+
hotspotLabel?: string;
|
|
8
|
+
fixed?: boolean;
|
|
9
|
+
templateIdentifier?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ObjectOptions = {
|
|
12
|
+
data: string;
|
|
13
|
+
type: string;
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
};
|
|
17
|
+
export type HotspotInteractionOptions = QtiPromptInteractionOptions & {
|
|
18
|
+
minChoices?: number;
|
|
19
|
+
maxChoices?: number;
|
|
20
|
+
object: ObjectOptions;
|
|
21
|
+
hotspotChoices?: HotspotChoiceOptions[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Presents an image with defined clickable regions (hotspots) for candidates to select.
|
|
25
|
+
* Used for questions where candidates identify specific areas on a diagram or map.
|
|
26
|
+
*
|
|
27
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.y2th8rh73267
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const interaction = new HotspotInteraction({
|
|
31
|
+
* responseIdentifier: "RESPONSE",
|
|
32
|
+
* maxChoices: 1,
|
|
33
|
+
* object: { data: "map.png", type: "image/png", width: 400, height: 300 },
|
|
34
|
+
* hotspotChoices: [
|
|
35
|
+
* { identifier: "A", shape: "circle", coords: "100,100,20" },
|
|
36
|
+
* ],
|
|
37
|
+
* });
|
|
38
|
+
*/
|
|
39
|
+
export declare class HotspotInteraction extends QtiPromptInteraction {
|
|
40
|
+
constructor(options: HotspotInteractionOptions);
|
|
41
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { fragment } from "xmlbuilder2";
|
|
2
|
+
import { QtiPromptInteraction, } from "./interaction";
|
|
3
|
+
/**
|
|
4
|
+
* Presents an image with defined clickable regions (hotspots) for candidates to select.
|
|
5
|
+
* Used for questions where candidates identify specific areas on a diagram or map.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.y2th8rh73267
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const interaction = new HotspotInteraction({
|
|
11
|
+
* responseIdentifier: "RESPONSE",
|
|
12
|
+
* maxChoices: 1,
|
|
13
|
+
* object: { data: "map.png", type: "image/png", width: 400, height: 300 },
|
|
14
|
+
* hotspotChoices: [
|
|
15
|
+
* { identifier: "A", shape: "circle", coords: "100,100,20" },
|
|
16
|
+
* ],
|
|
17
|
+
* });
|
|
18
|
+
*/
|
|
19
|
+
export class HotspotInteraction extends QtiPromptInteraction {
|
|
20
|
+
constructor(options) {
|
|
21
|
+
super(options);
|
|
22
|
+
this.item = fragment().ele("qti-hotspot-interaction", {
|
|
23
|
+
"response-identifier": options.responseIdentifier,
|
|
24
|
+
label: options.label,
|
|
25
|
+
"min-choices": options.minChoices?.toString(),
|
|
26
|
+
"max-choices": options.maxChoices?.toString(),
|
|
27
|
+
});
|
|
28
|
+
this.item.ele("object", {
|
|
29
|
+
data: options.object.data,
|
|
30
|
+
type: options.object.type,
|
|
31
|
+
width: options.object.width?.toString(),
|
|
32
|
+
height: options.object.height?.toString(),
|
|
33
|
+
});
|
|
34
|
+
for (const hotspot of options.hotspotChoices || []) {
|
|
35
|
+
this.item.ele("qti-hotspot-choice", {
|
|
36
|
+
identifier: hotspot.identifier,
|
|
37
|
+
shape: hotspot.shape,
|
|
38
|
+
coords: hotspot.coords,
|
|
39
|
+
"hotspot-label": hotspot.hotspotLabel,
|
|
40
|
+
fixed: hotspot.fixed ? "true" : undefined,
|
|
41
|
+
"template-identifier": hotspot.templateIdentifier,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=hotspot-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hotspot-interaction.js","sourceRoot":"","sources":["../../../src/qti/interactions/hotspot-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EACL,oBAAoB,GAErB,MAAM,eAAe,CAAC;AA2BvB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,kBAAmB,SAAQ,oBAAoB;IAC1D,YAAY,OAAkC;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE;YACpD,qBAAqB,EAAE,OAAO,CAAC,kBAAkB;YACjD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE;YAC7C,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE;SAC9C,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACtB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACzB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACzB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE;YACvC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE;SAC1C,CAAC,CAAC;QAEH,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,cAAc,IAAI,EAAE,EAAE,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE;gBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,eAAe,EAAE,OAAO,CAAC,YAAY;gBACrC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACzC,qBAAqB,EAAE,OAAO,CAAC,kBAAkB;aAClD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QtiPromptInteraction, QtiPromptInteractionOptions } from "./interaction";
|
|
2
|
+
export type HottextInteractionOptions = QtiPromptInteractionOptions & {
|
|
3
|
+
minChoices?: number;
|
|
4
|
+
maxChoices?: number;
|
|
5
|
+
content?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Presents text with selectable words or phrases (hottext) for candidates to choose.
|
|
9
|
+
* Used for questions where candidates identify specific parts of a text passage.
|
|
10
|
+
*
|
|
11
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.sbnpx830yzqu
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const interaction = new HottextInteraction({
|
|
15
|
+
* responseIdentifier: "RESPONSE",
|
|
16
|
+
* maxChoices: 1,
|
|
17
|
+
* content: "<p>Select the <qti-hottext identifier='A'>noun</qti-hottext> in: The <qti-hottext identifier='B'>cat</qti-hottext> sat.</p>",
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
export declare class HottextInteraction extends QtiPromptInteraction {
|
|
21
|
+
constructor(options: HottextInteractionOptions);
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { fragment } from "xmlbuilder2";
|
|
2
|
+
import { QtiPromptInteraction, } from "./interaction";
|
|
3
|
+
import { appendHtmlFragment } from "../../utils/html";
|
|
4
|
+
/**
|
|
5
|
+
* Presents text with selectable words or phrases (hottext) for candidates to choose.
|
|
6
|
+
* Used for questions where candidates identify specific parts of a text passage.
|
|
7
|
+
*
|
|
8
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.sbnpx830yzqu
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const interaction = new HottextInteraction({
|
|
12
|
+
* responseIdentifier: "RESPONSE",
|
|
13
|
+
* maxChoices: 1,
|
|
14
|
+
* content: "<p>Select the <qti-hottext identifier='A'>noun</qti-hottext> in: The <qti-hottext identifier='B'>cat</qti-hottext> sat.</p>",
|
|
15
|
+
* });
|
|
16
|
+
*/
|
|
17
|
+
export class HottextInteraction extends QtiPromptInteraction {
|
|
18
|
+
constructor(options) {
|
|
19
|
+
super(options);
|
|
20
|
+
this.item = fragment().ele("qti-hottext-interaction", {
|
|
21
|
+
"response-identifier": options.responseIdentifier,
|
|
22
|
+
label: options.label,
|
|
23
|
+
"min-choices": options.minChoices?.toString(),
|
|
24
|
+
"max-choices": options.maxChoices?.toString(),
|
|
25
|
+
});
|
|
26
|
+
if (options.content) {
|
|
27
|
+
appendHtmlFragment(options.content, this.item);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=hottext-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hottext-interaction.js","sourceRoot":"","sources":["../../../src/qti/interactions/hottext-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EACL,oBAAoB,GAErB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAQtD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,kBAAmB,SAAQ,oBAAoB;IAC1D,YAAY,OAAkC;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE;YACpD,qBAAqB,EAAE,OAAO,CAAC,kBAAkB;YACjD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE;YAC7C,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE;SAC9C,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AssociateInteraction } from "./associate-interaction";
|
|
2
|
+
import { ChoiceInteraction } from "./choice-interaction";
|
|
3
|
+
import { DrawingInteraction } from "./drawing-interaction";
|
|
4
|
+
import { EndAttemptInteraction } from "./end-attempt-interaction";
|
|
5
|
+
import { ExtendedTextInteraction } from "./extended-text-interaction";
|
|
6
|
+
import { GapMatchInteraction } from "./gap-match-interaction";
|
|
7
|
+
import { GraphicAssociateInteraction } from "./graphic-associate-interaction";
|
|
8
|
+
import { GraphicGapMatchInteraction } from "./graphic-gap-match-interaction";
|
|
9
|
+
import { GraphicOrderInteraction } from "./graphic-order-interaction";
|
|
10
|
+
import { HotspotInteraction } from "./hotspot-interaction";
|
|
11
|
+
import { HottextInteraction } from "./hottext-interaction";
|
|
12
|
+
import { InlineChoiceInteraction } from "./inline-choice-interaction";
|
|
13
|
+
import { MatchInteraction } from "./match-interaction";
|
|
14
|
+
import { MediaInteraction } from "./media-interaction";
|
|
15
|
+
import { OrderInteraction } from "./order-interaction";
|
|
16
|
+
import { PositionObjectInteraction } from "./position-object-interaction";
|
|
17
|
+
import { SelectPointInteraction } from "./select-point-interaction";
|
|
18
|
+
import { SliderInteraction } from "./slider-interaction";
|
|
19
|
+
import { TextEntryInteraction } from "./text-entry-interaction";
|
|
20
|
+
import { UploadInteraction } from "./upload-interaction";
|
|
21
|
+
export * from "./associate-interaction";
|
|
22
|
+
export * from "./choice-interaction";
|
|
23
|
+
export * from "./drawing-interaction";
|
|
24
|
+
export * from "./end-attempt-interaction";
|
|
25
|
+
export * from "./extended-text-interaction";
|
|
26
|
+
export * from "./gap-match-interaction";
|
|
27
|
+
export * from "./graphic-associate-interaction";
|
|
28
|
+
export * from "./graphic-gap-match-interaction";
|
|
29
|
+
export * from "./graphic-order-interaction";
|
|
30
|
+
export * from "./hotspot-interaction";
|
|
31
|
+
export * from "./hottext-interaction";
|
|
32
|
+
export * from "./inline-choice-interaction";
|
|
33
|
+
export * from "./interaction";
|
|
34
|
+
export * from "./match-interaction";
|
|
35
|
+
export * from "./media-interaction";
|
|
36
|
+
export * from "./order-interaction";
|
|
37
|
+
export * from "./position-object-interaction";
|
|
38
|
+
export * from "./select-point-interaction";
|
|
39
|
+
export * from "./slider-interaction";
|
|
40
|
+
export * from "./text-entry-interaction";
|
|
41
|
+
export * from "./upload-interaction";
|
|
42
|
+
export declare const qtiInteractionTypes: {
|
|
43
|
+
AssociateInteraction: typeof AssociateInteraction;
|
|
44
|
+
ChoiceInteraction: typeof ChoiceInteraction;
|
|
45
|
+
DrawingInteraction: typeof DrawingInteraction;
|
|
46
|
+
EndAttemptInteraction: typeof EndAttemptInteraction;
|
|
47
|
+
ExtendedTextInteraction: typeof ExtendedTextInteraction;
|
|
48
|
+
GapMatchInteraction: typeof GapMatchInteraction;
|
|
49
|
+
GraphicAssociateInteraction: typeof GraphicAssociateInteraction;
|
|
50
|
+
GraphicGapMatchInteraction: typeof GraphicGapMatchInteraction;
|
|
51
|
+
GraphicOrderInteraction: typeof GraphicOrderInteraction;
|
|
52
|
+
HotspotInteraction: typeof HotspotInteraction;
|
|
53
|
+
HottextInteraction: typeof HottextInteraction;
|
|
54
|
+
InlineChoiceInteraction: typeof InlineChoiceInteraction;
|
|
55
|
+
MatchInteraction: typeof MatchInteraction;
|
|
56
|
+
MediaInteraction: typeof MediaInteraction;
|
|
57
|
+
OrderInteraction: typeof OrderInteraction;
|
|
58
|
+
PositionObjectInteraction: typeof PositionObjectInteraction;
|
|
59
|
+
SelectPointInteraction: typeof SelectPointInteraction;
|
|
60
|
+
SliderInteraction: typeof SliderInteraction;
|
|
61
|
+
TextEntryInteraction: typeof TextEntryInteraction;
|
|
62
|
+
UploadInteraction: typeof UploadInteraction;
|
|
63
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AssociateInteraction } from "./associate-interaction";
|
|
2
|
+
import { ChoiceInteraction } from "./choice-interaction";
|
|
3
|
+
import { DrawingInteraction } from "./drawing-interaction";
|
|
4
|
+
import { EndAttemptInteraction } from "./end-attempt-interaction";
|
|
5
|
+
import { ExtendedTextInteraction } from "./extended-text-interaction";
|
|
6
|
+
import { GapMatchInteraction } from "./gap-match-interaction";
|
|
7
|
+
import { GraphicAssociateInteraction } from "./graphic-associate-interaction";
|
|
8
|
+
import { GraphicGapMatchInteraction } from "./graphic-gap-match-interaction";
|
|
9
|
+
import { GraphicOrderInteraction } from "./graphic-order-interaction";
|
|
10
|
+
import { HotspotInteraction } from "./hotspot-interaction";
|
|
11
|
+
import { HottextInteraction } from "./hottext-interaction";
|
|
12
|
+
import { InlineChoiceInteraction } from "./inline-choice-interaction";
|
|
13
|
+
import { MatchInteraction } from "./match-interaction";
|
|
14
|
+
import { MediaInteraction } from "./media-interaction";
|
|
15
|
+
import { OrderInteraction } from "./order-interaction";
|
|
16
|
+
import { PositionObjectInteraction } from "./position-object-interaction";
|
|
17
|
+
import { SelectPointInteraction } from "./select-point-interaction";
|
|
18
|
+
import { SliderInteraction } from "./slider-interaction";
|
|
19
|
+
import { TextEntryInteraction } from "./text-entry-interaction";
|
|
20
|
+
import { UploadInteraction } from "./upload-interaction";
|
|
21
|
+
export * from "./associate-interaction";
|
|
22
|
+
export * from "./choice-interaction";
|
|
23
|
+
export * from "./drawing-interaction";
|
|
24
|
+
export * from "./end-attempt-interaction";
|
|
25
|
+
export * from "./extended-text-interaction";
|
|
26
|
+
export * from "./gap-match-interaction";
|
|
27
|
+
export * from "./graphic-associate-interaction";
|
|
28
|
+
export * from "./graphic-gap-match-interaction";
|
|
29
|
+
export * from "./graphic-order-interaction";
|
|
30
|
+
export * from "./hotspot-interaction";
|
|
31
|
+
export * from "./hottext-interaction";
|
|
32
|
+
export * from "./inline-choice-interaction";
|
|
33
|
+
export * from "./interaction";
|
|
34
|
+
export * from "./match-interaction";
|
|
35
|
+
export * from "./media-interaction";
|
|
36
|
+
export * from "./order-interaction";
|
|
37
|
+
export * from "./position-object-interaction";
|
|
38
|
+
export * from "./select-point-interaction";
|
|
39
|
+
export * from "./slider-interaction";
|
|
40
|
+
export * from "./text-entry-interaction";
|
|
41
|
+
export * from "./upload-interaction";
|
|
42
|
+
export const qtiInteractionTypes = {
|
|
43
|
+
AssociateInteraction,
|
|
44
|
+
ChoiceInteraction,
|
|
45
|
+
DrawingInteraction,
|
|
46
|
+
EndAttemptInteraction,
|
|
47
|
+
ExtendedTextInteraction,
|
|
48
|
+
GapMatchInteraction,
|
|
49
|
+
GraphicAssociateInteraction,
|
|
50
|
+
GraphicGapMatchInteraction,
|
|
51
|
+
GraphicOrderInteraction,
|
|
52
|
+
HotspotInteraction,
|
|
53
|
+
HottextInteraction,
|
|
54
|
+
InlineChoiceInteraction,
|
|
55
|
+
MatchInteraction,
|
|
56
|
+
MediaInteraction,
|
|
57
|
+
OrderInteraction,
|
|
58
|
+
PositionObjectInteraction,
|
|
59
|
+
SelectPointInteraction,
|
|
60
|
+
SliderInteraction,
|
|
61
|
+
TextEntryInteraction,
|
|
62
|
+
UploadInteraction,
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/qti/interactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AAErC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,oBAAoB;IACpB,iBAAiB;IACjB,kBAAkB;IAClB,qBAAqB;IACrB,uBAAuB;IACvB,mBAAmB;IACnB,2BAA2B;IAC3B,0BAA0B;IAC1B,uBAAuB;IACvB,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,yBAAyB;IACzB,sBAAsB;IACtB,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;CAClB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { QtiInteraction, QtiInteractionOptions } from "./interaction";
|
|
2
|
+
export type InlineChoiceOptions = {
|
|
3
|
+
identifier: string;
|
|
4
|
+
fixed?: boolean;
|
|
5
|
+
templateIdentifier?: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
};
|
|
8
|
+
export type InlineChoiceInteractionOptions = QtiInteractionOptions & {
|
|
9
|
+
shuffle?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
inlineChoices?: InlineChoiceOptions[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Presents a dropdown menu embedded within text content for candidates to select an option.
|
|
15
|
+
* Used for fill-in-the-blank style questions with predefined choices.
|
|
16
|
+
*
|
|
17
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.8zaq47h31112
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const interaction = new InlineChoiceInteraction({
|
|
21
|
+
* responseIdentifier: "RESPONSE",
|
|
22
|
+
* inlineChoices: [
|
|
23
|
+
* { identifier: "A", content: "is" },
|
|
24
|
+
* { identifier: "B", content: "are" },
|
|
25
|
+
* ],
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
export declare class InlineChoiceInteraction extends QtiInteraction {
|
|
29
|
+
constructor(options: InlineChoiceInteractionOptions);
|
|
30
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { fragment } from "xmlbuilder2";
|
|
2
|
+
import { QtiInteraction } from "./interaction";
|
|
3
|
+
import { appendHtmlFragment } from "../../utils/html";
|
|
4
|
+
/**
|
|
5
|
+
* Presents a dropdown menu embedded within text content for candidates to select an option.
|
|
6
|
+
* Used for fill-in-the-blank style questions with predefined choices.
|
|
7
|
+
*
|
|
8
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.8zaq47h31112
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const interaction = new InlineChoiceInteraction({
|
|
12
|
+
* responseIdentifier: "RESPONSE",
|
|
13
|
+
* inlineChoices: [
|
|
14
|
+
* { identifier: "A", content: "is" },
|
|
15
|
+
* { identifier: "B", content: "are" },
|
|
16
|
+
* ],
|
|
17
|
+
* });
|
|
18
|
+
*/
|
|
19
|
+
export class InlineChoiceInteraction extends QtiInteraction {
|
|
20
|
+
constructor(options) {
|
|
21
|
+
super(options);
|
|
22
|
+
this.item = fragment().ele("qti-inline-choice-interaction", {
|
|
23
|
+
"response-identifier": options.responseIdentifier,
|
|
24
|
+
label: options.label,
|
|
25
|
+
shuffle: options.shuffle ? "true" : "false",
|
|
26
|
+
required: options.required ? "true" : undefined,
|
|
27
|
+
});
|
|
28
|
+
for (const choice of options.inlineChoices || []) {
|
|
29
|
+
const choiceEl = this.item.ele("qti-inline-choice", {
|
|
30
|
+
identifier: choice.identifier,
|
|
31
|
+
fixed: choice.fixed ? "true" : undefined,
|
|
32
|
+
"template-identifier": choice.templateIdentifier,
|
|
33
|
+
});
|
|
34
|
+
if (choice.content) {
|
|
35
|
+
appendHtmlFragment(choice.content, choiceEl);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=inline-choice-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-choice-interaction.js","sourceRoot":"","sources":["../../../src/qti/interactions/inline-choice-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAyB,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAetD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,uBAAwB,SAAQ,cAAc;IACzD,YAAY,OAAuC;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAC,GAAG,CAAC,+BAA+B,EAAE;YAC1D,qBAAqB,EAAE,OAAO,CAAC,kBAAkB;YACjD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;YAC3C,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SAChD,CAAC,CAAC;QAEH,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,aAAa,IAAI,EAAE,EAAE,CAAC;YACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB,EAAE;gBAClD,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACxC,qBAAqB,EAAE,MAAM,CAAC,kBAAkB;aACjD,CAAC,CAAC;YAEH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { XMLBuilder } from "xmlbuilder2/lib/interfaces";
|
|
2
|
+
export type QtiInteractionOptions = {
|
|
3
|
+
responseIdentifier: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
};
|
|
6
|
+
export type QtiPromptInteractionOptions = QtiInteractionOptions & {
|
|
7
|
+
prompt?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare abstract class QtiInteraction {
|
|
10
|
+
responseIdentifier: string;
|
|
11
|
+
protected item: XMLBuilder;
|
|
12
|
+
constructor(options: QtiInteractionOptions);
|
|
13
|
+
buildXml(): string;
|
|
14
|
+
getXmlBuilder(): XMLBuilder;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class QtiPromptInteraction extends QtiInteraction {
|
|
17
|
+
prompt: string;
|
|
18
|
+
constructor(options: QtiPromptInteractionOptions);
|
|
19
|
+
buildXml(): string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fragment } from "xmlbuilder2";
|
|
2
|
+
export class QtiInteraction {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
this.responseIdentifier = options.responseIdentifier;
|
|
5
|
+
this.item = fragment();
|
|
6
|
+
}
|
|
7
|
+
buildXml() {
|
|
8
|
+
return this.item.end({ prettyPrint: true });
|
|
9
|
+
}
|
|
10
|
+
getXmlBuilder() {
|
|
11
|
+
return this.item;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class QtiPromptInteraction extends QtiInteraction {
|
|
15
|
+
constructor(options) {
|
|
16
|
+
super({ responseIdentifier: options.responseIdentifier });
|
|
17
|
+
this.prompt = options.prompt || "";
|
|
18
|
+
}
|
|
19
|
+
buildXml() {
|
|
20
|
+
this.item.ele("qti-prompt").txt(this.prompt);
|
|
21
|
+
return super.buildXml();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../../src/qti/interactions/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAWvC,MAAM,OAAgB,cAAc;IAIlC,YAAY,OAA8B;QACxC,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QAErD,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,OAAgB,oBAAqB,SAAQ,cAAc;IAG/D,YAAY,OAAoC;QAC9C,KAAK,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE1D,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;IACrC,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7C,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SimpleAssociableChoiceOptions } from "./associate-interaction";
|
|
2
|
+
import { QtiPromptInteraction, QtiPromptInteractionOptions } from "./interaction";
|
|
3
|
+
export type MatchInteractionOptions = QtiPromptInteractionOptions & {
|
|
4
|
+
shuffle?: boolean;
|
|
5
|
+
minAssociations?: number;
|
|
6
|
+
maxAssociations?: number;
|
|
7
|
+
sourceChoices?: SimpleAssociableChoiceOptions[];
|
|
8
|
+
targetChoices?: SimpleAssociableChoiceOptions[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Presents two sets of choices for candidates to match or associate with each other.
|
|
12
|
+
* Commonly used for matching terms with definitions or pairing related concepts.
|
|
13
|
+
*
|
|
14
|
+
* @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.be4ll1tm4t99
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const interaction = new MatchInteraction({
|
|
18
|
+
* responseIdentifier: "RESPONSE",
|
|
19
|
+
* sourceChoices: [
|
|
20
|
+
* { identifier: "S1", content: "Paris", matchMax: 1 },
|
|
21
|
+
* { identifier: "S2", content: "London", matchMax: 1 },
|
|
22
|
+
* ],
|
|
23
|
+
* targetChoices: [
|
|
24
|
+
* { identifier: "T1", content: "France", matchMax: 1 },
|
|
25
|
+
* { identifier: "T2", content: "England", matchMax: 1 },
|
|
26
|
+
* ],
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
export declare class MatchInteraction extends QtiPromptInteraction {
|
|
30
|
+
constructor(options: MatchInteractionOptions);
|
|
31
|
+
}
|