@citolab/tspci 2.0.7 → 2.0.9

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/types/index.d.ts CHANGED
@@ -1,88 +1,88 @@
1
- export interface IMSpci<ConfigProperties> {
2
- typeIdentifier: string;
3
-
4
- /** @access public
5
- * @method getInstance Create a new instance of this portable custom interaction
6
- * Will be called by the qtiCustomInteractionContext
7
- * @param {DOM Element} dom - the DOM Element this PCI is being added to
8
- * @param {Object} configuration - the configuration to apply to this PCI
9
- * @param {String} state - a previous saved state to apply to this instance.
10
- * This must have been obtained from a prior call to getState on an
11
- * instance of this type (same typeIdentifier)
12
- */
13
- getInstance: (dom: HTMLElement, configuration: Configuration<ConfigProperties>, state: string) => void;
14
-
15
- /** @access public
16
- * @method getResponse
17
- * @return {Object} - the value to assign to the bound QTI response variable
18
- */
19
- getResponse: () => QtiVariableJSON;
20
-
21
- /** @access public
22
- * @method getState
23
- * @return {String} The current state of this PCI. May be passed to
24
- * getInstance to later restore this PCI instance.
25
- */
26
- getState: () => string;
27
- oncompleted?: () => void;
28
- destroy?: () => void; // Not used in IMS and not in TAO implementation, so not used here (optional)
29
- }
30
-
31
-
32
-
33
- export declare type Configuration<T> = {
34
- onready: (pci: IMSpci<T>, state?: string) => void;
35
- properties: T;
36
- // PK: following this: https://www.imsglobal.org/spec/qti/v3p0/impl#h.1mc9puik2ft6
37
- // All below are not used in the IMS Reference implementation, keeping for ref
38
- /*
39
- ondone: (pci: IMSPci<T>,response:any,state:string, status?: "interacting" | "closed" | "solution" | "review" ) => void;
40
- status: string;
41
- templateVariables: any;
42
- boundTo: any;
43
- contextVariables
44
- responseIdentifier
45
- */
46
- };
47
-
48
- export interface directedPair {
49
- destination: string;
50
- source: string;
51
- }
52
- export interface ResponseInteraction<T> {
53
- responseIdentifier: string;
54
- responses: T;
55
- }
56
- export interface ResponseItem<T> {
57
- item: string;
58
- interaction: ResponseInteraction<T>;
59
- }
60
- export interface InputResponseFormat<T> {
61
- item: string;
62
- interactions: ResponseInteraction<T>[];
63
- }
64
- export interface Calculate {
65
- calculate: () => ResponseType;
66
- }
67
- export declare type QtiVariableJSON = {
68
- [K in "list" | "base"]?: {
69
- [Ka in "boolean" | "integer" | "float" | "string" | "pair" | "directedPair" | "identifier"]?: ResponseType;
70
- };
71
- };
72
- export declare type float = number;
73
- export declare type integer = number;
74
- export declare type ResponseType = boolean | directedPair | float | integer | string | ResponseType[];
75
- export declare enum BaseType {
76
- boolean = "boolean",
77
- directedPair = "directedPair",
78
- float = "float",
79
- integer = "integer",
80
- string = "string",
81
- }
82
- export declare type Multiple = Array<ResponseType>;
83
- export declare type Ordered = Array<ResponseType>;
84
- export declare enum Cardinality {
85
- multiple = "multiple",
86
- ordered = "ordered",
87
- single = "single",
88
- }
1
+ export interface IMSpci<ConfigProperties> {
2
+ typeIdentifier: string;
3
+
4
+ /** @access public
5
+ * @method getInstance Create a new instance of this portable custom interaction
6
+ * Will be called by the qtiCustomInteractionContext
7
+ * @param {DOM Element} dom - the DOM Element this PCI is being added to
8
+ * @param {Object} configuration - the configuration to apply to this PCI
9
+ * @param {String} state - a previous saved state to apply to this instance.
10
+ * This must have been obtained from a prior call to getState on an
11
+ * instance of this type (same typeIdentifier)
12
+ */
13
+ getInstance: (dom: HTMLElement, configuration: Configuration<ConfigProperties>, state: string) => void;
14
+
15
+ /** @access public
16
+ * @method getResponse
17
+ * @return {Object} - the value to assign to the bound QTI response variable
18
+ */
19
+ getResponse: () => QtiVariableJSON;
20
+
21
+ /** @access public
22
+ * @method getState
23
+ * @return {String} The current state of this PCI. May be passed to
24
+ * getInstance to later restore this PCI instance.
25
+ */
26
+ getState: () => string;
27
+ oncompleted?: () => void;
28
+ destroy?: () => void; // Not used in IMS and not in TAO implementation, so not used here (optional)
29
+ }
30
+
31
+
32
+
33
+ export declare type Configuration<T> = {
34
+ onready: (pci: IMSpci<T>, state?: string) => void;
35
+ properties: T;
36
+ // PK: following this: https://www.imsglobal.org/spec/qti/v3p0/impl#h.1mc9puik2ft6
37
+ // All below are not used in the IMS Reference implementation, keeping for ref
38
+ /*
39
+ ondone: (pci: IMSPci<T>,response:any,state:string, status?: "interacting" | "closed" | "solution" | "review" ) => void;
40
+ status: string;
41
+ templateVariables: any;
42
+ boundTo: any;
43
+ contextVariables
44
+ responseIdentifier
45
+ */
46
+ };
47
+
48
+ export interface directedPair {
49
+ destination: string;
50
+ source: string;
51
+ }
52
+ export interface ResponseInteraction<T> {
53
+ responseIdentifier: string;
54
+ responses: T;
55
+ }
56
+ export interface ResponseItem<T> {
57
+ item: string;
58
+ interaction: ResponseInteraction<T>;
59
+ }
60
+ export interface InputResponseFormat<T> {
61
+ item: string;
62
+ interactions: ResponseInteraction<T>[];
63
+ }
64
+ export interface Calculate {
65
+ calculate: () => ResponseType;
66
+ }
67
+ export declare type QtiVariableJSON = {
68
+ [K in "list" | "base"]?: {
69
+ [Ka in "boolean" | "integer" | "float" | "string" | "pair" | "directedPair" | "identifier"]?: ResponseType;
70
+ };
71
+ };
72
+ export declare type float = number;
73
+ export declare type integer = number;
74
+ export declare type ResponseType = boolean | directedPair | float | integer | string | ResponseType[];
75
+ export declare enum BaseType {
76
+ boolean = "boolean",
77
+ directedPair = "directedPair",
78
+ float = "float",
79
+ integer = "integer",
80
+ string = "string",
81
+ }
82
+ export declare type Multiple = Array<ResponseType>;
83
+ export declare type Ordered = Array<ResponseType>;
84
+ export declare enum Cardinality {
85
+ multiple = "multiple",
86
+ ordered = "ordered",
87
+ single = "single",
88
+ }