@examplary/qti 0.0.1 → 1.0.1

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.
Files changed (66) hide show
  1. package/README.md +6 -1
  2. package/dist/ims/ims-manifest.js +15 -7
  3. package/dist/ims/ims-package.d.ts +1 -1
  4. package/dist/ims/ims-package.js +16 -8
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +23 -6
  7. package/dist/qti/interactions/associate-interaction.d.ts +36 -0
  8. package/dist/qti/interactions/associate-interaction.js +49 -0
  9. package/dist/qti/interactions/choice-interaction.d.ts +36 -0
  10. package/dist/qti/interactions/choice-interaction.js +46 -0
  11. package/dist/qti/interactions/drawing-interaction.d.ts +25 -0
  12. package/dist/qti/interactions/drawing-interaction.js +33 -0
  13. package/dist/qti/interactions/end-attempt-interaction.d.ts +21 -0
  14. package/dist/qti/interactions/end-attempt-interaction.js +30 -0
  15. package/dist/qti/interactions/extended-text-interaction.d.ts +28 -0
  16. package/dist/qti/interactions/extended-text-interaction.js +37 -0
  17. package/dist/qti/interactions/gap-match-interaction.d.ts +34 -0
  18. package/dist/qti/interactions/gap-match-interaction.js +49 -0
  19. package/dist/qti/interactions/graphic-associate-interaction.d.ts +37 -0
  20. package/dist/qti/interactions/graphic-associate-interaction.js +50 -0
  21. package/dist/qti/interactions/graphic-gap-match-interaction.d.ts +42 -0
  22. package/dist/qti/interactions/graphic-gap-match-interaction.js +67 -0
  23. package/dist/qti/interactions/graphic-order-interaction.d.ts +28 -0
  24. package/dist/qti/interactions/graphic-order-interaction.js +49 -0
  25. package/dist/qti/interactions/hotspot-interaction.d.ts +41 -0
  26. package/dist/qti/interactions/hotspot-interaction.js +49 -0
  27. package/dist/qti/interactions/hottext-interaction.d.ts +22 -0
  28. package/dist/qti/interactions/hottext-interaction.js +34 -0
  29. package/dist/qti/interactions/index.d.ts +63 -0
  30. package/dist/qti/interactions/index.js +80 -0
  31. package/dist/qti/interactions/inline-choice-interaction.d.ts +30 -0
  32. package/dist/qti/interactions/inline-choice-interaction.js +43 -0
  33. package/dist/qti/interactions/interaction.d.ts +20 -0
  34. package/dist/qti/interactions/interaction.js +31 -0
  35. package/dist/qti/interactions/match-interaction.d.ts +31 -0
  36. package/dist/qti/interactions/match-interaction.js +66 -0
  37. package/dist/qti/interactions/media-interaction.d.ts +31 -0
  38. package/dist/qti/interactions/media-interaction.js +39 -0
  39. package/dist/qti/interactions/order-interaction.d.ts +28 -0
  40. package/dist/qti/interactions/order-interaction.js +46 -0
  41. package/dist/qti/interactions/position-object-interaction.d.ts +36 -0
  42. package/dist/qti/interactions/position-object-interaction.js +46 -0
  43. package/dist/qti/interactions/select-point-interaction.d.ts +28 -0
  44. package/dist/qti/interactions/select-point-interaction.js +36 -0
  45. package/dist/qti/interactions/slider-interaction.d.ts +26 -0
  46. package/dist/qti/interactions/slider-interaction.js +35 -0
  47. package/dist/qti/interactions/text-entry-interaction.d.ts +25 -0
  48. package/dist/qti/interactions/text-entry-interaction.js +34 -0
  49. package/dist/qti/interactions/upload-interaction.d.ts +19 -0
  50. package/dist/qti/interactions/upload-interaction.js +28 -0
  51. package/dist/qti/qti-element.d.ts +11 -0
  52. package/dist/qti/qti-element.js +32 -0
  53. package/dist/qti/qti-item.d.ts +7 -3
  54. package/dist/qti/qti-item.js +38 -28
  55. package/dist/qti/qti-test.d.ts +5 -3
  56. package/dist/qti/qti-test.js +25 -11
  57. package/dist/qti/types.js +2 -2
  58. package/dist/utils/html.d.ts +2 -0
  59. package/dist/utils/html.js +18 -0
  60. package/package.json +3 -3
  61. package/dist/ims/ims-manifest.js.map +0 -1
  62. package/dist/ims/ims-package.js.map +0 -1
  63. package/dist/index.js.map +0 -1
  64. package/dist/qti/qti-item.js.map +0 -1
  65. package/dist/qti/qti-test.js.map +0 -1
  66. package/dist/qti/types.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphicAssociateInteraction = void 0;
4
+ const xmlbuilder2_1 = require("xmlbuilder2");
5
+ const interaction_1 = require("./interaction");
6
+ /**
7
+ * Presents an image with hotspots for candidates to associate or connect with each other.
8
+ * Used for drawing connections between points on a diagram or map.
9
+ *
10
+ * @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.acwq9g2z1cwt
11
+ *
12
+ * @example
13
+ * const interaction = new GraphicAssociateInteraction({
14
+ * responseIdentifier: "RESPONSE",
15
+ * object: { data: "circuit.png", type: "image/png", width: 400, height: 300 },
16
+ * associableHotspots: [
17
+ * { identifier: "A", shape: "circle", coords: "100,100,15", matchMax: 1 },
18
+ * { identifier: "B", shape: "circle", coords: "200,100,15", matchMax: 1 },
19
+ * ],
20
+ * });
21
+ */
22
+ class GraphicAssociateInteraction extends interaction_1.QtiPromptInteraction {
23
+ constructor(options) {
24
+ super(options);
25
+ this.item = (0, xmlbuilder2_1.fragment)().ele("qti-graphic-associate-interaction", {
26
+ "response-identifier": options.responseIdentifier,
27
+ label: options.label,
28
+ "min-associations": options.minAssociations?.toString(),
29
+ "max-associations": options.maxAssociations?.toString(),
30
+ });
31
+ this.item.ele("object", {
32
+ data: options.object.data,
33
+ type: options.object.type,
34
+ width: options.object.width?.toString(),
35
+ height: options.object.height?.toString(),
36
+ });
37
+ for (const hotspot of options.associableHotspots || []) {
38
+ this.item.ele("qti-associable-hotspot", {
39
+ identifier: hotspot.identifier,
40
+ shape: hotspot.shape,
41
+ coords: hotspot.coords,
42
+ "match-max": hotspot.matchMax?.toString(),
43
+ "match-min": hotspot.matchMin?.toString(),
44
+ "match-group": hotspot.matchGroup,
45
+ "hotspot-label": hotspot.hotspotLabel,
46
+ });
47
+ }
48
+ }
49
+ }
50
+ exports.GraphicAssociateInteraction = GraphicAssociateInteraction;
@@ -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,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphicGapMatchInteraction = void 0;
4
+ const xmlbuilder2_1 = require("xmlbuilder2");
5
+ const interaction_1 = require("./interaction");
6
+ /**
7
+ * Presents an image with gap regions and a set of images/text to drag onto those regions.
8
+ * Used for labeling diagrams or placing items in specific locations on an image.
9
+ *
10
+ * @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.ous502odpreo
11
+ *
12
+ * @example
13
+ * const interaction = new GraphicGapMatchInteraction({
14
+ * responseIdentifier: "RESPONSE",
15
+ * object: { data: "diagram.png", type: "image/png", width: 400, height: 300 },
16
+ * gapImgs: [
17
+ * { identifier: "img1", objectData: "label1.png", objectType: "image/png" },
18
+ * ],
19
+ * associableHotspots: [
20
+ * { identifier: "gap1", shape: "rect", coords: "50,50,100,80", matchMax: 1 },
21
+ * ],
22
+ * });
23
+ */
24
+ class GraphicGapMatchInteraction extends interaction_1.QtiPromptInteraction {
25
+ constructor(options) {
26
+ super(options);
27
+ this.item = (0, xmlbuilder2_1.fragment)().ele("qti-graphic-gap-match-interaction", {
28
+ "response-identifier": options.responseIdentifier,
29
+ label: options.label,
30
+ "min-associations": options.minAssociations?.toString(),
31
+ "max-associations": options.maxAssociations?.toString(),
32
+ });
33
+ this.item.ele("object", {
34
+ data: options.object.data,
35
+ type: options.object.type,
36
+ width: options.object.width?.toString(),
37
+ height: options.object.height?.toString(),
38
+ });
39
+ for (const gapImg of options.gapImgs || []) {
40
+ const gapImgEl = this.item.ele("qti-gap-img", {
41
+ identifier: gapImg.identifier,
42
+ "match-max": gapImg.matchMax?.toString(),
43
+ "match-min": gapImg.matchMin?.toString(),
44
+ "match-group": gapImg.matchGroup,
45
+ label: gapImg.label,
46
+ });
47
+ gapImgEl.ele("object", {
48
+ data: gapImg.objectData,
49
+ type: gapImg.objectType,
50
+ width: gapImg.objectWidth?.toString(),
51
+ height: gapImg.objectHeight?.toString(),
52
+ });
53
+ }
54
+ for (const hotspot of options.associableHotspots || []) {
55
+ this.item.ele("qti-associable-hotspot", {
56
+ identifier: hotspot.identifier,
57
+ shape: hotspot.shape,
58
+ coords: hotspot.coords,
59
+ "match-max": hotspot.matchMax?.toString(),
60
+ "match-min": hotspot.matchMin?.toString(),
61
+ "match-group": hotspot.matchGroup,
62
+ "hotspot-label": hotspot.hotspotLabel,
63
+ });
64
+ }
65
+ }
66
+ }
67
+ exports.GraphicGapMatchInteraction = GraphicGapMatchInteraction;
@@ -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,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphicOrderInteraction = void 0;
4
+ const xmlbuilder2_1 = require("xmlbuilder2");
5
+ const interaction_1 = require("./interaction");
6
+ /**
7
+ * Presents an image with hotspots for candidates to select in a specific order.
8
+ * Used for sequencing tasks on diagrams, maps, or other visual content.
9
+ *
10
+ * @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.973pocg92wxf
11
+ *
12
+ * @example
13
+ * const interaction = new GraphicOrderInteraction({
14
+ * responseIdentifier: "RESPONSE",
15
+ * object: { data: "diagram.png", type: "image/png", width: 400, height: 300 },
16
+ * hotspotChoices: [
17
+ * { identifier: "A", shape: "circle", coords: "100,100,20" },
18
+ * { identifier: "B", shape: "circle", coords: "200,150,20" },
19
+ * ],
20
+ * });
21
+ */
22
+ class GraphicOrderInteraction extends interaction_1.QtiPromptInteraction {
23
+ constructor(options) {
24
+ super(options);
25
+ this.item = (0, xmlbuilder2_1.fragment)().ele("qti-graphic-order-interaction", {
26
+ "response-identifier": options.responseIdentifier,
27
+ label: options.label,
28
+ "min-choices": options.minChoices?.toString(),
29
+ "max-choices": options.maxChoices?.toString(),
30
+ });
31
+ this.item.ele("object", {
32
+ data: options.object.data,
33
+ type: options.object.type,
34
+ width: options.object.width?.toString(),
35
+ height: options.object.height?.toString(),
36
+ });
37
+ for (const hotspot of options.hotspotChoices || []) {
38
+ this.item.ele("qti-hotspot-choice", {
39
+ identifier: hotspot.identifier,
40
+ shape: hotspot.shape,
41
+ coords: hotspot.coords,
42
+ "hotspot-label": hotspot.hotspotLabel,
43
+ fixed: hotspot.fixed ? "true" : undefined,
44
+ "template-identifier": hotspot.templateIdentifier,
45
+ });
46
+ }
47
+ }
48
+ }
49
+ exports.GraphicOrderInteraction = GraphicOrderInteraction;
@@ -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,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HotspotInteraction = void 0;
4
+ const xmlbuilder2_1 = require("xmlbuilder2");
5
+ const interaction_1 = require("./interaction");
6
+ /**
7
+ * Presents an image with defined clickable regions (hotspots) for candidates to select.
8
+ * Used for questions where candidates identify specific areas on a diagram or map.
9
+ *
10
+ * @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.y2th8rh73267
11
+ *
12
+ * @example
13
+ * const interaction = new HotspotInteraction({
14
+ * responseIdentifier: "RESPONSE",
15
+ * maxChoices: 1,
16
+ * object: { data: "map.png", type: "image/png", width: 400, height: 300 },
17
+ * hotspotChoices: [
18
+ * { identifier: "A", shape: "circle", coords: "100,100,20" },
19
+ * ],
20
+ * });
21
+ */
22
+ class HotspotInteraction extends interaction_1.QtiPromptInteraction {
23
+ constructor(options) {
24
+ super(options);
25
+ this.item = (0, xmlbuilder2_1.fragment)().ele("qti-hotspot-interaction", {
26
+ "response-identifier": options.responseIdentifier,
27
+ label: options.label,
28
+ "min-choices": options.minChoices?.toString(),
29
+ "max-choices": options.maxChoices?.toString(),
30
+ });
31
+ this.item.ele("object", {
32
+ data: options.object.data,
33
+ type: options.object.type,
34
+ width: options.object.width?.toString(),
35
+ height: options.object.height?.toString(),
36
+ });
37
+ for (const hotspot of options.hotspotChoices || []) {
38
+ this.item.ele("qti-hotspot-choice", {
39
+ identifier: hotspot.identifier,
40
+ shape: hotspot.shape,
41
+ coords: hotspot.coords,
42
+ "hotspot-label": hotspot.hotspotLabel,
43
+ fixed: hotspot.fixed ? "true" : undefined,
44
+ "template-identifier": hotspot.templateIdentifier,
45
+ });
46
+ }
47
+ }
48
+ }
49
+ exports.HotspotInteraction = HotspotInteraction;
@@ -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,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HottextInteraction = void 0;
4
+ const xmlbuilder2_1 = require("xmlbuilder2");
5
+ const interaction_1 = require("./interaction");
6
+ const html_1 = require("../../utils/html");
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
+ class HottextInteraction extends interaction_1.QtiPromptInteraction {
21
+ constructor(options) {
22
+ super(options);
23
+ this.item = (0, xmlbuilder2_1.fragment)().ele("qti-hottext-interaction", {
24
+ "response-identifier": options.responseIdentifier,
25
+ label: options.label,
26
+ "min-choices": options.minChoices?.toString(),
27
+ "max-choices": options.maxChoices?.toString(),
28
+ });
29
+ if (options.content) {
30
+ (0, html_1.appendHtmlFragment)(options.content, this.item);
31
+ }
32
+ }
33
+ }
34
+ exports.HottextInteraction = HottextInteraction;
@@ -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,80 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.qtiInteractionTypes = void 0;
18
+ const associate_interaction_1 = require("./associate-interaction");
19
+ const choice_interaction_1 = require("./choice-interaction");
20
+ const drawing_interaction_1 = require("./drawing-interaction");
21
+ const end_attempt_interaction_1 = require("./end-attempt-interaction");
22
+ const extended_text_interaction_1 = require("./extended-text-interaction");
23
+ const gap_match_interaction_1 = require("./gap-match-interaction");
24
+ const graphic_associate_interaction_1 = require("./graphic-associate-interaction");
25
+ const graphic_gap_match_interaction_1 = require("./graphic-gap-match-interaction");
26
+ const graphic_order_interaction_1 = require("./graphic-order-interaction");
27
+ const hotspot_interaction_1 = require("./hotspot-interaction");
28
+ const hottext_interaction_1 = require("./hottext-interaction");
29
+ const inline_choice_interaction_1 = require("./inline-choice-interaction");
30
+ const match_interaction_1 = require("./match-interaction");
31
+ const media_interaction_1 = require("./media-interaction");
32
+ const order_interaction_1 = require("./order-interaction");
33
+ const position_object_interaction_1 = require("./position-object-interaction");
34
+ const select_point_interaction_1 = require("./select-point-interaction");
35
+ const slider_interaction_1 = require("./slider-interaction");
36
+ const text_entry_interaction_1 = require("./text-entry-interaction");
37
+ const upload_interaction_1 = require("./upload-interaction");
38
+ __exportStar(require("./associate-interaction"), exports);
39
+ __exportStar(require("./choice-interaction"), exports);
40
+ __exportStar(require("./drawing-interaction"), exports);
41
+ __exportStar(require("./end-attempt-interaction"), exports);
42
+ __exportStar(require("./extended-text-interaction"), exports);
43
+ __exportStar(require("./gap-match-interaction"), exports);
44
+ __exportStar(require("./graphic-associate-interaction"), exports);
45
+ __exportStar(require("./graphic-gap-match-interaction"), exports);
46
+ __exportStar(require("./graphic-order-interaction"), exports);
47
+ __exportStar(require("./hotspot-interaction"), exports);
48
+ __exportStar(require("./hottext-interaction"), exports);
49
+ __exportStar(require("./inline-choice-interaction"), exports);
50
+ __exportStar(require("./interaction"), exports);
51
+ __exportStar(require("./match-interaction"), exports);
52
+ __exportStar(require("./media-interaction"), exports);
53
+ __exportStar(require("./order-interaction"), exports);
54
+ __exportStar(require("./position-object-interaction"), exports);
55
+ __exportStar(require("./select-point-interaction"), exports);
56
+ __exportStar(require("./slider-interaction"), exports);
57
+ __exportStar(require("./text-entry-interaction"), exports);
58
+ __exportStar(require("./upload-interaction"), exports);
59
+ exports.qtiInteractionTypes = {
60
+ AssociateInteraction: associate_interaction_1.AssociateInteraction,
61
+ ChoiceInteraction: choice_interaction_1.ChoiceInteraction,
62
+ DrawingInteraction: drawing_interaction_1.DrawingInteraction,
63
+ EndAttemptInteraction: end_attempt_interaction_1.EndAttemptInteraction,
64
+ ExtendedTextInteraction: extended_text_interaction_1.ExtendedTextInteraction,
65
+ GapMatchInteraction: gap_match_interaction_1.GapMatchInteraction,
66
+ GraphicAssociateInteraction: graphic_associate_interaction_1.GraphicAssociateInteraction,
67
+ GraphicGapMatchInteraction: graphic_gap_match_interaction_1.GraphicGapMatchInteraction,
68
+ GraphicOrderInteraction: graphic_order_interaction_1.GraphicOrderInteraction,
69
+ HotspotInteraction: hotspot_interaction_1.HotspotInteraction,
70
+ HottextInteraction: hottext_interaction_1.HottextInteraction,
71
+ InlineChoiceInteraction: inline_choice_interaction_1.InlineChoiceInteraction,
72
+ MatchInteraction: match_interaction_1.MatchInteraction,
73
+ MediaInteraction: media_interaction_1.MediaInteraction,
74
+ OrderInteraction: order_interaction_1.OrderInteraction,
75
+ PositionObjectInteraction: position_object_interaction_1.PositionObjectInteraction,
76
+ SelectPointInteraction: select_point_interaction_1.SelectPointInteraction,
77
+ SliderInteraction: slider_interaction_1.SliderInteraction,
78
+ TextEntryInteraction: text_entry_interaction_1.TextEntryInteraction,
79
+ UploadInteraction: upload_interaction_1.UploadInteraction,
80
+ };
@@ -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,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InlineChoiceInteraction = void 0;
4
+ const xmlbuilder2_1 = require("xmlbuilder2");
5
+ const interaction_1 = require("./interaction");
6
+ const html_1 = require("../../utils/html");
7
+ /**
8
+ * Presents a dropdown menu embedded within text content for candidates to select an option.
9
+ * Used for fill-in-the-blank style questions with predefined choices.
10
+ *
11
+ * @see https://www.imsglobal.org/spec/qti/v3p0/impl#h.8zaq47h31112
12
+ *
13
+ * @example
14
+ * const interaction = new InlineChoiceInteraction({
15
+ * responseIdentifier: "RESPONSE",
16
+ * inlineChoices: [
17
+ * { identifier: "A", content: "is" },
18
+ * { identifier: "B", content: "are" },
19
+ * ],
20
+ * });
21
+ */
22
+ class InlineChoiceInteraction extends interaction_1.QtiInteraction {
23
+ constructor(options) {
24
+ super(options);
25
+ this.item = (0, xmlbuilder2_1.fragment)().ele("qti-inline-choice-interaction", {
26
+ "response-identifier": options.responseIdentifier,
27
+ label: options.label,
28
+ shuffle: options.shuffle ? "true" : "false",
29
+ required: options.required ? "true" : undefined,
30
+ });
31
+ for (const choice of options.inlineChoices || []) {
32
+ const choiceEl = this.item.ele("qti-inline-choice", {
33
+ identifier: choice.identifier,
34
+ fixed: choice.fixed ? "true" : undefined,
35
+ "template-identifier": choice.templateIdentifier,
36
+ });
37
+ if (choice.content) {
38
+ (0, html_1.appendHtmlFragment)(choice.content, choiceEl);
39
+ }
40
+ }
41
+ }
42
+ }
43
+ exports.InlineChoiceInteraction = InlineChoiceInteraction;
@@ -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,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QtiPromptInteraction = exports.QtiInteraction = void 0;
4
+ const xmlbuilder2_1 = require("xmlbuilder2");
5
+ class QtiInteraction {
6
+ responseIdentifier;
7
+ item;
8
+ constructor(options) {
9
+ this.responseIdentifier = options.responseIdentifier;
10
+ this.item = (0, xmlbuilder2_1.fragment)();
11
+ }
12
+ buildXml() {
13
+ return this.item.end({ prettyPrint: true });
14
+ }
15
+ getXmlBuilder() {
16
+ return this.item;
17
+ }
18
+ }
19
+ exports.QtiInteraction = QtiInteraction;
20
+ class QtiPromptInteraction extends QtiInteraction {
21
+ prompt;
22
+ constructor(options) {
23
+ super({ responseIdentifier: options.responseIdentifier });
24
+ this.prompt = options.prompt || "";
25
+ }
26
+ buildXml() {
27
+ this.item.ele("qti-prompt").txt(this.prompt);
28
+ return super.buildXml();
29
+ }
30
+ }
31
+ exports.QtiPromptInteraction = QtiPromptInteraction;