@pie-qti/qti-common 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/dist/element-mapper/Qti3ElementNameMapper.d.ts +2 -37
- package/dist/element-mapper/Qti3ElementNameMapper.js +15 -200
- package/dist/element-mapper/Qti3ElementNameMapper.js.map +1 -1
- package/dist/element-mapper/qti3-element-mappings.d.ts +2 -6
- package/dist/element-mapper/qti3-element-mappings.js +1 -4
- package/dist/element-mapper/qti3-element-mappings.js.map +1 -1
- package/package.json +5 -5
|
@@ -2,48 +2,13 @@ import type { ElementNameMapper } from './ElementNameMapper.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Element name mapper for QTI 3.0.
|
|
4
4
|
*
|
|
5
|
-
* QTI
|
|
6
|
-
*
|
|
7
|
-
* - qti-choice-interaction, qti-simple-choice
|
|
8
|
-
* - qti-response-processing, qti-set-outcome-value
|
|
9
|
-
*
|
|
10
|
-
* This mapper converts to/from lowercase canonical form (without prefix) for internal processing.
|
|
5
|
+
* QTI-defined elements use kebab-case with a `qti-` prefix. HTML, MathML,
|
|
6
|
+
* SVG, and extension vocabularies retain their native names.
|
|
11
7
|
*/
|
|
12
8
|
export declare class Qti3ElementNameMapper implements ElementNameMapper {
|
|
13
9
|
readonly version = "3.0";
|
|
14
10
|
private readonly PREFIX;
|
|
15
|
-
/**
|
|
16
|
-
* Convert QTI 3.0 kebab-case name to canonical lowercase.
|
|
17
|
-
* Removes 'qti-' prefix and converts to lowercase.
|
|
18
|
-
*
|
|
19
|
-
* @param elementName - kebab-case element name with qti- prefix
|
|
20
|
-
* @returns lowercase canonical name without prefix
|
|
21
|
-
*/
|
|
22
11
|
toCanonical(elementName: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Convert canonical lowercase to QTI 3.0 kebab-case with qti- prefix.
|
|
25
|
-
*
|
|
26
|
-
* This converts canonical names like 'choiceinteraction' to 'qti-choice-interaction'.
|
|
27
|
-
*
|
|
28
|
-
* @param canonicalName - lowercase canonical name
|
|
29
|
-
* @returns kebab-case element name with qti- prefix
|
|
30
|
-
*/
|
|
31
12
|
toNative(canonicalName: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* Validate QTI 3.0 element name pattern.
|
|
34
|
-
* QTI 3.0 uses kebab-case with 'qti-' prefix.
|
|
35
|
-
*
|
|
36
|
-
* @param elementName - Element name to validate
|
|
37
|
-
* @returns true if valid kebab-case pattern with qti- prefix
|
|
38
|
-
*/
|
|
39
13
|
isValidElementName(elementName: string): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Convert a canonical name to kebab-case.
|
|
42
|
-
* This is a best-effort conversion based on known QTI element patterns.
|
|
43
|
-
*
|
|
44
|
-
* @param name - Canonical lowercase name
|
|
45
|
-
* @returns kebab-case version
|
|
46
|
-
* @private
|
|
47
|
-
*/
|
|
48
|
-
private toKebabCase;
|
|
49
14
|
}
|
|
@@ -1,60 +1,30 @@
|
|
|
1
|
+
import { getCanonicalName, QTI3_ELEMENT_MAPPINGS } from './qti3-element-mappings.js';
|
|
2
|
+
const QTI3_NATIVE_BY_CANONICAL = new Map(Object.entries(QTI3_ELEMENT_MAPPINGS).map(([native, canonical]) => [canonical, native]));
|
|
1
3
|
/**
|
|
2
4
|
* Element name mapper for QTI 3.0.
|
|
3
5
|
*
|
|
4
|
-
* QTI
|
|
5
|
-
*
|
|
6
|
-
* - qti-choice-interaction, qti-simple-choice
|
|
7
|
-
* - qti-response-processing, qti-set-outcome-value
|
|
8
|
-
*
|
|
9
|
-
* This mapper converts to/from lowercase canonical form (without prefix) for internal processing.
|
|
6
|
+
* QTI-defined elements use kebab-case with a `qti-` prefix. HTML, MathML,
|
|
7
|
+
* SVG, and extension vocabularies retain their native names.
|
|
10
8
|
*/
|
|
11
9
|
export class Qti3ElementNameMapper {
|
|
12
10
|
version = '3.0';
|
|
13
11
|
PREFIX = 'qti-';
|
|
14
|
-
/**
|
|
15
|
-
* Convert QTI 3.0 kebab-case name to canonical lowercase.
|
|
16
|
-
* Removes 'qti-' prefix and converts to lowercase.
|
|
17
|
-
*
|
|
18
|
-
* @param elementName - kebab-case element name with qti- prefix
|
|
19
|
-
* @returns lowercase canonical name without prefix
|
|
20
|
-
*/
|
|
21
12
|
toCanonical(elementName) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
const knownQtiName = getCanonicalName(elementName);
|
|
14
|
+
if (knownQtiName)
|
|
15
|
+
return knownQtiName;
|
|
16
|
+
const canonicalName = elementName.toLowerCase();
|
|
17
|
+
if (QTI3_NATIVE_BY_CANONICAL.has(canonicalName))
|
|
18
|
+
return canonicalName;
|
|
19
|
+
if (elementName.startsWith(this.PREFIX)) {
|
|
20
|
+
return elementName.slice(this.PREFIX.length).replace(/-/g, '').toLowerCase();
|
|
21
|
+
}
|
|
22
|
+
return elementName;
|
|
29
23
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Convert canonical lowercase to QTI 3.0 kebab-case with qti- prefix.
|
|
32
|
-
*
|
|
33
|
-
* This converts canonical names like 'choiceinteraction' to 'qti-choice-interaction'.
|
|
34
|
-
*
|
|
35
|
-
* @param canonicalName - lowercase canonical name
|
|
36
|
-
* @returns kebab-case element name with qti- prefix
|
|
37
|
-
*/
|
|
38
24
|
toNative(canonicalName) {
|
|
39
|
-
|
|
40
|
-
// 'choiceinteraction' needs to become 'choice-interaction'
|
|
41
|
-
// We need to insert hyphens before transitions from lowercase to uppercase
|
|
42
|
-
// But canonical names are already lowercase, so we need a different approach
|
|
43
|
-
// Use a simple mapping for common patterns
|
|
44
|
-
const kebabCase = this.toKebabCase(canonicalName);
|
|
45
|
-
return this.PREFIX + kebabCase;
|
|
25
|
+
return QTI3_NATIVE_BY_CANONICAL.get(canonicalName.toLowerCase()) ?? canonicalName;
|
|
46
26
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Validate QTI 3.0 element name pattern.
|
|
49
|
-
* QTI 3.0 uses kebab-case with 'qti-' prefix.
|
|
50
|
-
*
|
|
51
|
-
* @param elementName - Element name to validate
|
|
52
|
-
* @returns true if valid kebab-case pattern with qti- prefix
|
|
53
|
-
*/
|
|
54
27
|
isValidElementName(elementName) {
|
|
55
|
-
// QTI 3.0: 'qti-' prefix followed by kebab-case
|
|
56
|
-
// Examples: qti-assessment-item, qti-choice-interaction, qti-simple-choice
|
|
57
|
-
// Must not have double hyphens or end with hyphen
|
|
58
28
|
if (!elementName.startsWith(this.PREFIX))
|
|
59
29
|
return false;
|
|
60
30
|
if (elementName === this.PREFIX)
|
|
@@ -65,160 +35,5 @@ export class Qti3ElementNameMapper {
|
|
|
65
35
|
return false;
|
|
66
36
|
return /^qti-[a-z][a-z0-9-]*$/.test(elementName);
|
|
67
37
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Convert a canonical name to kebab-case.
|
|
70
|
-
* This is a best-effort conversion based on known QTI element patterns.
|
|
71
|
-
*
|
|
72
|
-
* @param name - Canonical lowercase name
|
|
73
|
-
* @returns kebab-case version
|
|
74
|
-
* @private
|
|
75
|
-
*/
|
|
76
|
-
toKebabCase(name) {
|
|
77
|
-
// For canonical names like 'choiceinteraction', 'simplechoice', 'responseprocessing'
|
|
78
|
-
// we need to identify word boundaries and insert hyphens
|
|
79
|
-
// Special cases that need direct mapping (multi-word compounds)
|
|
80
|
-
const specialCases = {
|
|
81
|
-
// Core structure
|
|
82
|
-
'itembody': 'item-body',
|
|
83
|
-
'contentbody': 'content-body',
|
|
84
|
-
'testpart': 'test-part',
|
|
85
|
-
'assessmentitem': 'assessment-item',
|
|
86
|
-
'assessmenttest': 'assessment-test',
|
|
87
|
-
'assessmentsection': 'assessment-section',
|
|
88
|
-
'assessmentitemref': 'assessment-item-ref',
|
|
89
|
-
'assessmentstimulusref': 'assessment-stimulus-ref',
|
|
90
|
-
// Feedback
|
|
91
|
-
'rubricblock': 'rubric-block',
|
|
92
|
-
'modalfeedback': 'modal-feedback',
|
|
93
|
-
'modalfeedbackok': 'modal-feedback-ok',
|
|
94
|
-
'feedbackblock': 'feedback-block',
|
|
95
|
-
'feedbackinline': 'feedback-inline',
|
|
96
|
-
// Other multi-word
|
|
97
|
-
'stylesheet': 'style-sheet',
|
|
98
|
-
'printedvariable': 'printed-variable',
|
|
99
|
-
'contextvariable': 'context-variable',
|
|
100
|
-
'templatevariable': 'template-variable',
|
|
101
|
-
'companionmaterialsinfo': 'companion-materials-info',
|
|
102
|
-
// Interaction-specific
|
|
103
|
-
'textentryinteraction': 'text-entry-interaction',
|
|
104
|
-
'extendedtextinteraction': 'extended-text-interaction',
|
|
105
|
-
'inlinechoiceinteraction': 'inline-choice-interaction',
|
|
106
|
-
'gapmatchinteraction': 'gap-match-interaction',
|
|
107
|
-
'graphicgapmatchinteraction': 'graphic-gap-match-interaction',
|
|
108
|
-
'selectpointinteraction': 'select-point-interaction',
|
|
109
|
-
'endattemptinteraction': 'end-attempt-interaction',
|
|
110
|
-
'positionobjectinteraction': 'position-object-interaction',
|
|
111
|
-
'graphicorderinteraction': 'graphic-order-interaction',
|
|
112
|
-
'graphicassociateinteraction': 'graphic-associate-interaction',
|
|
113
|
-
'portablecustominteraction': 'portable-custom-interaction',
|
|
114
|
-
// Interaction children
|
|
115
|
-
'simplechoice': 'simple-choice',
|
|
116
|
-
'simplematchset': 'simple-match-set',
|
|
117
|
-
'simpleassociablechoice': 'simple-associable-choice',
|
|
118
|
-
'gaptext': 'gap-text',
|
|
119
|
-
'gapimg': 'gap-img',
|
|
120
|
-
'gapchoice': 'gap-choice',
|
|
121
|
-
'hotspotchoice': 'hotspot-choice',
|
|
122
|
-
'associablehotspot': 'associable-hotspot',
|
|
123
|
-
'inlinechoice': 'inline-choice',
|
|
124
|
-
// Declarations
|
|
125
|
-
'responsedeclaration': 'response-declaration',
|
|
126
|
-
'outcomedeclaration': 'outcome-declaration',
|
|
127
|
-
'templatedeclaration': 'template-declaration',
|
|
128
|
-
'contextdeclaration': 'context-declaration',
|
|
129
|
-
'correctresponse': 'correct-response',
|
|
130
|
-
'defaultvalue': 'default-value',
|
|
131
|
-
// Mapping
|
|
132
|
-
'areamapping': 'area-mapping',
|
|
133
|
-
'areamapentry': 'area-map-entry',
|
|
134
|
-
'mapentry': 'map-entry',
|
|
135
|
-
'matchtable': 'match-table',
|
|
136
|
-
'matchtableentry': 'match-table-entry',
|
|
137
|
-
'interpolationtable': 'interpolation-table',
|
|
138
|
-
'interpolationtableentry': 'interpolation-table-entry',
|
|
139
|
-
// Processing
|
|
140
|
-
'responseprocessing': 'response-processing',
|
|
141
|
-
'responsecondition': 'response-condition',
|
|
142
|
-
'responseif': 'response-if',
|
|
143
|
-
'responseelseif': 'response-else-if',
|
|
144
|
-
'responseelse': 'response-else',
|
|
145
|
-
'responseprocessingfragment': 'response-processing-fragment',
|
|
146
|
-
'exitresponse': 'exit-response',
|
|
147
|
-
'setoutcomevalue': 'set-outcome-value',
|
|
148
|
-
'lookupoutcomevalue': 'lookup-outcome-value',
|
|
149
|
-
'setcorrectresponse': 'set-correct-response',
|
|
150
|
-
'setdefaultvalue': 'set-default-value',
|
|
151
|
-
'templateprocessing': 'template-processing',
|
|
152
|
-
'templatecondition': 'template-condition',
|
|
153
|
-
'templateif': 'template-if',
|
|
154
|
-
'templateelseif': 'template-else-if',
|
|
155
|
-
'templateelse': 'template-else',
|
|
156
|
-
'templateconstraint': 'template-constraint',
|
|
157
|
-
'settemplatevalue': 'set-template-value',
|
|
158
|
-
'exittemplate': 'exit-template',
|
|
159
|
-
'templateblock': 'template-block',
|
|
160
|
-
'templateinline': 'template-inline',
|
|
161
|
-
'outcomeprocessing': 'outcome-processing',
|
|
162
|
-
'outcomecondition': 'outcome-condition',
|
|
163
|
-
'outcomeif': 'outcome-if',
|
|
164
|
-
'outcomeelseif': 'outcome-else-if',
|
|
165
|
-
'outcomeelse': 'outcome-else',
|
|
166
|
-
'exittest': 'exit-test',
|
|
167
|
-
// Expressions
|
|
168
|
-
'basevalue': 'base-value',
|
|
169
|
-
'fieldvalue': 'field-value',
|
|
170
|
-
'customoperator': 'custom-operator',
|
|
171
|
-
'equalrounded': 'equal-rounded',
|
|
172
|
-
'stringmatch': 'string-match',
|
|
173
|
-
'patternmatch': 'pattern-match',
|
|
174
|
-
'mapresponse': 'map-response',
|
|
175
|
-
'mapresponsepoint': 'map-response-point',
|
|
176
|
-
'integerdivide': 'integer-divide',
|
|
177
|
-
'integermodulus': 'integer-modulus',
|
|
178
|
-
'roundto': 'round-to',
|
|
179
|
-
'mathoperator': 'math-operator',
|
|
180
|
-
'mathconstant': 'math-constant',
|
|
181
|
-
'statsoperator': 'stats-operator',
|
|
182
|
-
'containersize': 'container-size',
|
|
183
|
-
'isnull': 'is-null',
|
|
184
|
-
'randominteger': 'random-integer',
|
|
185
|
-
'randomfloat': 'random-float',
|
|
186
|
-
'testvariables': 'test-variables',
|
|
187
|
-
'outcomemaximum': 'outcome-maximum',
|
|
188
|
-
'outcomeminimum': 'outcome-minimum',
|
|
189
|
-
'numbercorrect': 'number-correct',
|
|
190
|
-
'numberincorrect': 'number-incorrect',
|
|
191
|
-
'numberpresented': 'number-presented',
|
|
192
|
-
'numberresponded': 'number-responded',
|
|
193
|
-
'numberselected': 'number-selected',
|
|
194
|
-
// PCI
|
|
195
|
-
'interactionmodules': 'interaction-modules',
|
|
196
|
-
'interactionmodule': 'interaction-module',
|
|
197
|
-
'interactionmarkup': 'interaction-markup',
|
|
198
|
-
// Catalog
|
|
199
|
-
'cataloginfo': 'catalog-info',
|
|
200
|
-
'cardentry': 'card-entry',
|
|
201
|
-
'htmlcontent': 'html-content',
|
|
202
|
-
'filehref': 'file-href',
|
|
203
|
-
};
|
|
204
|
-
if (specialCases[name]) {
|
|
205
|
-
return specialCases[name];
|
|
206
|
-
}
|
|
207
|
-
// Fallback: apply pattern-based conversion for unmapped cases
|
|
208
|
-
let result = name;
|
|
209
|
-
// Handle compound cases (prefix + suffix) first
|
|
210
|
-
result = result.replace(/^(response|outcome|assessment|template)(processing|declaration|condition)$/, '$1-$2');
|
|
211
|
-
// Handle prefix + interaction/choice
|
|
212
|
-
result = result.replace(/^(simple|graphic|extended|inline|custom|portable)(interaction|choice)$/, '$1-$2');
|
|
213
|
-
// If not already handled, check for prefixes (but only if followed by something else)
|
|
214
|
-
if (!result.includes('-')) {
|
|
215
|
-
result = result.replace(/^(response|outcome|assessment|simple|graphic|extended|inline|custom|portable|template)(.+)/, '$1-$2');
|
|
216
|
-
}
|
|
217
|
-
// If still no hyphen, check for common suffixes
|
|
218
|
-
if (!result.includes('-')) {
|
|
219
|
-
result = result.replace(/(.+)(interaction|processing|declaration|condition|feedback|template|choice|value|operator|variable|attempt)$/, '$1-$2');
|
|
220
|
-
}
|
|
221
|
-
return result;
|
|
222
|
-
}
|
|
223
38
|
}
|
|
224
39
|
//# sourceMappingURL=Qti3ElementNameMapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Qti3ElementNameMapper.js","sourceRoot":"","sources":["../../src/element-mapper/Qti3ElementNameMapper.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,OAAO,qBAAqB;IACxB,OAAO,GAAG,KAAK,CAAC;IACR,MAAM,GAAG,MAAM,CAAC;IAEjC;;;;;;OAMG;IACH,WAAW,CAAC,WAAmB;QAC9B,kFAAkF;QAClF,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YACxD,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YACvC,CAAC,CAAC,WAAW,CAAC;QAEf,uCAAuC;QACvC,8CAA8C;QAC9C,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAqB;QAC7B,4CAA4C;QAC5C,2DAA2D;QAC3D,2EAA2E;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AgB,EAAE,iBAAiB;YAEnC,MAAM;YACN,oBAAoB,EAAE,qBAAqB;YAC3C,mBAAmB,EAAE,oBAAoB;YACzC,mBAAmB,EAAE,oBAAoB;YAEzC,UAAU;YACV,aAAa,EAAE,cAAc;YAC7B,WAAW,EAAE,YAAY;YACzB,aAAa,EAAE,cAAc;YAC7B,UAAU,EAAE,WAAW;SACvB,CAAC;QAEF,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;QAED,8DAA8D;QAC9D,IAAI,MAAM,GAAG,IAAI,CAAC;QAElB,gDAAgD;QAChD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,4EAA4E,EAAE,OAAO,CAAC,CAAC;QAE/G,qCAAqC;QACrC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,wEAAwE,EAAE,OAAO,CAAC,CAAC;QAE3G,sFAAsF;QACtF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,4FAA4F,EAAE,OAAO,CAAC,CAAC;QAChI,CAAC;QAED,gDAAgD;QAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,8GAA8G,EAAE,OAAO,CAAC,CAAC;QAClJ,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["import type { ElementNameMapper } from './ElementNameMapper.js';\n\n/**\n * Element name mapper for QTI 3.0.\n *\n * QTI 3.0 uses kebab-case element names with 'qti-' prefix:\n * - qti-assessment-item, qti-item-body, qti-response-declaration\n * - qti-choice-interaction, qti-simple-choice\n * - qti-response-processing, qti-set-outcome-value\n *\n * This mapper converts to/from lowercase canonical form (without prefix) for internal processing.\n */\nexport class Qti3ElementNameMapper implements ElementNameMapper {\n\treadonly version = '3.0';\n\tprivate readonly PREFIX = 'qti-';\n\n\t/**\n\t * Convert QTI 3.0 kebab-case name to canonical lowercase.\n\t * Removes 'qti-' prefix and converts to lowercase.\n\t *\n\t * @param elementName - kebab-case element name with qti- prefix\n\t * @returns lowercase canonical name without prefix\n\t */\n\ttoCanonical(elementName: string): string {\n\t\t// Remove 'qti-' prefix and convert to lowercase (already lowercase but ensure it)\n\t\tconst withoutPrefix = elementName.startsWith(this.PREFIX)\n\t\t\t? elementName.slice(this.PREFIX.length)\n\t\t\t: elementName;\n\n\t\t// Remove hyphens to get canonical form\n\t\t// 'choice-interaction' => 'choiceinteraction'\n\t\treturn withoutPrefix.replace(/-/g, '').toLowerCase();\n\t}\n\n\t/**\n\t * Convert canonical lowercase to QTI 3.0 kebab-case with qti- prefix.\n\t *\n\t * This converts canonical names like 'choiceinteraction' to 'qti-choice-interaction'.\n\t *\n\t * @param canonicalName - lowercase canonical name\n\t * @returns kebab-case element name with qti- prefix\n\t */\n\ttoNative(canonicalName: string): string {\n\t\t// Convert camelCase/lowercase to kebab-case\n\t\t// 'choiceinteraction' needs to become 'choice-interaction'\n\t\t// We need to insert hyphens before transitions from lowercase to uppercase\n\t\t// But canonical names are already lowercase, so we need a different approach\n\n\t\t// Use a simple mapping for common patterns\n\t\tconst kebabCase = this.toKebabCase(canonicalName);\n\t\treturn this.PREFIX + kebabCase;\n\t}\n\n\t/**\n\t * Validate QTI 3.0 element name pattern.\n\t * QTI 3.0 uses kebab-case with 'qti-' prefix.\n\t *\n\t * @param elementName - Element name to validate\n\t * @returns true if valid kebab-case pattern with qti- prefix\n\t */\n\tisValidElementName(elementName: string): boolean {\n\t\t// QTI 3.0: 'qti-' prefix followed by kebab-case\n\t\t// Examples: qti-assessment-item, qti-choice-interaction, qti-simple-choice\n\t\t// Must not have double hyphens or end with hyphen\n\t\tif (!elementName.startsWith(this.PREFIX)) return false;\n\t\tif (elementName === this.PREFIX) return false;\n\t\tif (elementName.includes('--')) return false;\n\t\tif (elementName.endsWith('-')) return false;\n\t\treturn /^qti-[a-z][a-z0-9-]*$/.test(elementName);\n\t}\n\n\t/**\n\t * Convert a canonical name to kebab-case.\n\t * This is a best-effort conversion based on known QTI element patterns.\n\t *\n\t * @param name - Canonical lowercase name\n\t * @returns kebab-case version\n\t * @private\n\t */\n\tprivate toKebabCase(name: string): string {\n\t\t// For canonical names like 'choiceinteraction', 'simplechoice', 'responseprocessing'\n\t\t// we need to identify word boundaries and insert hyphens\n\n\t\t// Special cases that need direct mapping (multi-word compounds)\n\t\tconst specialCases: Record<string, string> = {\n\t\t\t// Core structure\n\t\t\t'itembody': 'item-body',\n\t\t\t'contentbody': 'content-body',\n\t\t\t'testpart': 'test-part',\n\t\t\t'assessmentitem': 'assessment-item',\n\t\t\t'assessmenttest': 'assessment-test',\n\t\t\t'assessmentsection': 'assessment-section',\n\t\t\t'assessmentitemref': 'assessment-item-ref',\n\t\t\t'assessmentstimulusref': 'assessment-stimulus-ref',\n\n\t\t\t// Feedback\n\t\t\t'rubricblock': 'rubric-block',\n\t\t\t'modalfeedback': 'modal-feedback',\n\t\t\t'modalfeedbackok': 'modal-feedback-ok',\n\t\t\t'feedbackblock': 'feedback-block',\n\t\t\t'feedbackinline': 'feedback-inline',\n\n\t\t\t// Other multi-word\n\t\t\t'stylesheet': 'style-sheet',\n\t\t\t'printedvariable': 'printed-variable',\n\t\t\t'contextvariable': 'context-variable',\n\t\t\t'templatevariable': 'template-variable',\n\t\t\t'companionmaterialsinfo': 'companion-materials-info',\n\n\t\t\t// Interaction-specific\n\t\t\t'textentryinteraction': 'text-entry-interaction',\n\t\t\t'extendedtextinteraction': 'extended-text-interaction',\n\t\t\t'inlinechoiceinteraction': 'inline-choice-interaction',\n\t\t\t'gapmatchinteraction': 'gap-match-interaction',\n\t\t\t'graphicgapmatchinteraction': 'graphic-gap-match-interaction',\n\t\t\t'selectpointinteraction': 'select-point-interaction',\n\t\t\t'endattemptinteraction': 'end-attempt-interaction',\n\t\t\t'positionobjectinteraction': 'position-object-interaction',\n\t\t\t'graphicorderinteraction': 'graphic-order-interaction',\n\t\t\t'graphicassociateinteraction': 'graphic-associate-interaction',\n\t\t\t'portablecustominteraction': 'portable-custom-interaction',\n\n\t\t\t// Interaction children\n\t\t\t'simplechoice': 'simple-choice',\n\t\t\t'simplematchset': 'simple-match-set',\n\t\t\t'simpleassociablechoice': 'simple-associable-choice',\n\t\t\t'gaptext': 'gap-text',\n\t\t\t'gapimg': 'gap-img',\n\t\t\t'gapchoice': 'gap-choice',\n\t\t\t'hotspotchoice': 'hotspot-choice',\n\t\t\t'associablehotspot': 'associable-hotspot',\n\t\t\t'inlinechoice': 'inline-choice',\n\n\t\t\t// Declarations\n\t\t\t'responsedeclaration': 'response-declaration',\n\t\t\t'outcomedeclaration': 'outcome-declaration',\n\t\t\t'templatedeclaration': 'template-declaration',\n\t\t\t'contextdeclaration': 'context-declaration',\n\t\t\t'correctresponse': 'correct-response',\n\t\t\t'defaultvalue': 'default-value',\n\n\t\t\t// Mapping\n\t\t\t'areamapping': 'area-mapping',\n\t\t\t'areamapentry': 'area-map-entry',\n\t\t\t'mapentry': 'map-entry',\n\t\t\t'matchtable': 'match-table',\n\t\t\t'matchtableentry': 'match-table-entry',\n\t\t\t'interpolationtable': 'interpolation-table',\n\t\t\t'interpolationtableentry': 'interpolation-table-entry',\n\n\t\t\t// Processing\n\t\t\t'responseprocessing': 'response-processing',\n\t\t\t'responsecondition': 'response-condition',\n\t\t\t'responseif': 'response-if',\n\t\t\t'responseelseif': 'response-else-if',\n\t\t\t'responseelse': 'response-else',\n\t\t\t'responseprocessingfragment': 'response-processing-fragment',\n\t\t\t'exitresponse': 'exit-response',\n\t\t\t'setoutcomevalue': 'set-outcome-value',\n\t\t\t'lookupoutcomevalue': 'lookup-outcome-value',\n\t\t\t'setcorrectresponse': 'set-correct-response',\n\t\t\t'setdefaultvalue': 'set-default-value',\n\n\t\t\t'templateprocessing': 'template-processing',\n\t\t\t'templatecondition': 'template-condition',\n\t\t\t'templateif': 'template-if',\n\t\t\t'templateelseif': 'template-else-if',\n\t\t\t'templateelse': 'template-else',\n\t\t\t'templateconstraint': 'template-constraint',\n\t\t\t'settemplatevalue': 'set-template-value',\n\t\t\t'exittemplate': 'exit-template',\n\t\t\t'templateblock': 'template-block',\n\t\t\t'templateinline': 'template-inline',\n\n\t\t\t'outcomeprocessing': 'outcome-processing',\n\t\t\t'outcomecondition': 'outcome-condition',\n\t\t\t'outcomeif': 'outcome-if',\n\t\t\t'outcomeelseif': 'outcome-else-if',\n\t\t\t'outcomeelse': 'outcome-else',\n\t\t\t'exittest': 'exit-test',\n\n\t\t\t// Expressions\n\t\t\t'basevalue': 'base-value',\n\t\t\t'fieldvalue': 'field-value',\n\t\t\t'customoperator': 'custom-operator',\n\t\t\t'equalrounded': 'equal-rounded',\n\t\t\t'stringmatch': 'string-match',\n\t\t\t'patternmatch': 'pattern-match',\n\t\t\t'mapresponse': 'map-response',\n\t\t\t'mapresponsepoint': 'map-response-point',\n\t\t\t'integerdivide': 'integer-divide',\n\t\t\t'integermodulus': 'integer-modulus',\n\t\t\t'roundto': 'round-to',\n\t\t\t'mathoperator': 'math-operator',\n\t\t\t'mathconstant': 'math-constant',\n\t\t\t'statsoperator': 'stats-operator',\n\t\t\t'containersize': 'container-size',\n\t\t\t'isnull': 'is-null',\n\t\t\t'randominteger': 'random-integer',\n\t\t\t'randomfloat': 'random-float',\n\t\t\t'testvariables': 'test-variables',\n\t\t\t'outcomemaximum': 'outcome-maximum',\n\t\t\t'outcomeminimum': 'outcome-minimum',\n\t\t\t'numbercorrect': 'number-correct',\n\t\t\t'numberincorrect': 'number-incorrect',\n\t\t\t'numberpresented': 'number-presented',\n\t\t\t'numberresponded': 'number-responded',\n\t\t\t'numberselected': 'number-selected',\n\n\t\t\t// PCI\n\t\t\t'interactionmodules': 'interaction-modules',\n\t\t\t'interactionmodule': 'interaction-module',\n\t\t\t'interactionmarkup': 'interaction-markup',\n\n\t\t\t// Catalog\n\t\t\t'cataloginfo': 'catalog-info',\n\t\t\t'cardentry': 'card-entry',\n\t\t\t'htmlcontent': 'html-content',\n\t\t\t'filehref': 'file-href',\n\t\t};\n\n\t\tif (specialCases[name]) {\n\t\t\treturn specialCases[name];\n\t\t}\n\n\t\t// Fallback: apply pattern-based conversion for unmapped cases\n\t\tlet result = name;\n\n\t\t// Handle compound cases (prefix + suffix) first\n\t\tresult = result.replace(/^(response|outcome|assessment|template)(processing|declaration|condition)$/, '$1-$2');\n\n\t\t// Handle prefix + interaction/choice\n\t\tresult = result.replace(/^(simple|graphic|extended|inline|custom|portable)(interaction|choice)$/, '$1-$2');\n\n\t\t// If not already handled, check for prefixes (but only if followed by something else)\n\t\tif (!result.includes('-')) {\n\t\t\tresult = result.replace(/^(response|outcome|assessment|simple|graphic|extended|inline|custom|portable|template)(.+)/, '$1-$2');\n\t\t}\n\n\t\t// If still no hyphen, check for common suffixes\n\t\tif (!result.includes('-')) {\n\t\t\tresult = result.replace(/(.+)(interaction|processing|declaration|condition|feedback|template|choice|value|operator|variable|attempt)$/, '$1-$2');\n\t\t}\n\n\t\treturn result;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Qti3ElementNameMapper.js","sourceRoot":"","sources":["../../src/element-mapper/Qti3ElementNameMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAErF,MAAM,wBAAwB,GAAG,IAAI,GAAG,CACvC,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CACvF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IACxB,OAAO,GAAG,KAAK,CAAC;IACR,MAAM,GAAG,MAAM,CAAC;IAEjC,WAAW,CAAC,WAAmB;QAC9B,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACnD,IAAI,YAAY;YAAE,OAAO,YAAY,CAAC;QACtC,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QAChD,IAAI,wBAAwB,CAAC,GAAG,CAAC,aAAa,CAAC;YAAE,OAAO,aAAa,CAAC;QAEtE,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9E,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,aAAqB;QAC7B,OAAO,wBAAwB,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,IAAI,aAAa,CAAC;IACnF,CAAC;IAED,kBAAkB,CAAC,WAAmB;QACrC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC;QACvD,IAAI,WAAW,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAC9C,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAC7C,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAC5C,OAAO,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACD","sourcesContent":["import type { ElementNameMapper } from './ElementNameMapper.js';\nimport { getCanonicalName, QTI3_ELEMENT_MAPPINGS } from './qti3-element-mappings.js';\n\nconst QTI3_NATIVE_BY_CANONICAL = new Map<string, string>(\n\tObject.entries(QTI3_ELEMENT_MAPPINGS).map(([native, canonical]) => [canonical, native]),\n);\n\n/**\n * Element name mapper for QTI 3.0.\n *\n * QTI-defined elements use kebab-case with a `qti-` prefix. HTML, MathML,\n * SVG, and extension vocabularies retain their native names.\n */\nexport class Qti3ElementNameMapper implements ElementNameMapper {\n\treadonly version = '3.0';\n\tprivate readonly PREFIX = 'qti-';\n\n\ttoCanonical(elementName: string): string {\n\t\tconst knownQtiName = getCanonicalName(elementName);\n\t\tif (knownQtiName) return knownQtiName;\n\t\tconst canonicalName = elementName.toLowerCase();\n\t\tif (QTI3_NATIVE_BY_CANONICAL.has(canonicalName)) return canonicalName;\n\n\t\tif (elementName.startsWith(this.PREFIX)) {\n\t\t\treturn elementName.slice(this.PREFIX.length).replace(/-/g, '').toLowerCase();\n\t\t}\n\n\t\treturn elementName;\n\t}\n\n\ttoNative(canonicalName: string): string {\n\t\treturn QTI3_NATIVE_BY_CANONICAL.get(canonicalName.toLowerCase()) ?? canonicalName;\n\t}\n\n\tisValidElementName(elementName: string): boolean {\n\t\tif (!elementName.startsWith(this.PREFIX)) return false;\n\t\tif (elementName === this.PREFIX) return false;\n\t\tif (elementName.includes('--')) return false;\n\t\tif (elementName.endsWith('-')) return false;\n\t\treturn /^qti-[a-z][a-z0-9-]*$/.test(elementName);\n\t}\n}\n"]}
|
|
@@ -67,7 +67,6 @@ export declare const INTERACTION_ELEMENTS: {
|
|
|
67
67
|
readonly 'qti-associate-interaction': "associateinteraction";
|
|
68
68
|
readonly 'qti-text-entry-interaction': "textentryinteraction";
|
|
69
69
|
readonly 'qti-inline-choice-interaction': "inlinechoiceinteraction";
|
|
70
|
-
readonly 'qti-composite-interaction': "compositeinteraction";
|
|
71
70
|
};
|
|
72
71
|
/**
|
|
73
72
|
* Interaction child elements
|
|
@@ -85,8 +84,7 @@ export declare const INTERACTION_CHILD_ELEMENTS: {
|
|
|
85
84
|
readonly 'qti-associable-hotspot': "associablehotspot";
|
|
86
85
|
readonly 'qti-hottext': "hottext";
|
|
87
86
|
readonly 'qti-inline-choice': "inlinechoice";
|
|
88
|
-
readonly 'qti-object': "
|
|
89
|
-
readonly 'qti-param': "param";
|
|
87
|
+
readonly 'qti-position-object-stage': "positionobjectstage";
|
|
90
88
|
};
|
|
91
89
|
/**
|
|
92
90
|
* Response processing elements
|
|
@@ -370,8 +368,7 @@ export declare const QTI3_ELEMENT_MAPPINGS: {
|
|
|
370
368
|
readonly 'qti-associable-hotspot': "associablehotspot";
|
|
371
369
|
readonly 'qti-hottext': "hottext";
|
|
372
370
|
readonly 'qti-inline-choice': "inlinechoice";
|
|
373
|
-
readonly 'qti-object': "
|
|
374
|
-
readonly 'qti-param': "param";
|
|
371
|
+
readonly 'qti-position-object-stage': "positionobjectstage";
|
|
375
372
|
readonly 'qti-choice-interaction': "choiceinteraction";
|
|
376
373
|
readonly 'qti-match-interaction': "matchinteraction";
|
|
377
374
|
readonly 'qti-order-interaction': "orderinteraction";
|
|
@@ -394,7 +391,6 @@ export declare const QTI3_ELEMENT_MAPPINGS: {
|
|
|
394
391
|
readonly 'qti-associate-interaction': "associateinteraction";
|
|
395
392
|
readonly 'qti-text-entry-interaction': "textentryinteraction";
|
|
396
393
|
readonly 'qti-inline-choice-interaction': "inlinechoiceinteraction";
|
|
397
|
-
readonly 'qti-composite-interaction': "compositeinteraction";
|
|
398
394
|
readonly 'qti-response-declaration': "responsedeclaration";
|
|
399
395
|
readonly 'qti-outcome-declaration': "outcomedeclaration";
|
|
400
396
|
readonly 'qti-template-declaration': "templatedeclaration";
|
|
@@ -69,8 +69,6 @@ export const INTERACTION_ELEMENTS = {
|
|
|
69
69
|
// Inline interactions
|
|
70
70
|
'qti-text-entry-interaction': 'textentryinteraction',
|
|
71
71
|
'qti-inline-choice-interaction': 'inlinechoiceinteraction',
|
|
72
|
-
// Composite interaction (QTI 3.0 advanced feature)
|
|
73
|
-
'qti-composite-interaction': 'compositeinteraction',
|
|
74
72
|
};
|
|
75
73
|
/**
|
|
76
74
|
* Interaction child elements
|
|
@@ -88,8 +86,7 @@ export const INTERACTION_CHILD_ELEMENTS = {
|
|
|
88
86
|
'qti-associable-hotspot': 'associablehotspot',
|
|
89
87
|
'qti-hottext': 'hottext',
|
|
90
88
|
'qti-inline-choice': 'inlinechoice',
|
|
91
|
-
'qti-object': '
|
|
92
|
-
'qti-param': 'param',
|
|
89
|
+
'qti-position-object-stage': 'positionobjectstage',
|
|
93
90
|
};
|
|
94
91
|
/**
|
|
95
92
|
* Response processing elements
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti3-element-mappings.js","sourceRoot":"","sources":["../../src/element-mapper/qti3-element-mappings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,qBAAqB,EAAE,gBAAgB;IACvC,qBAAqB,EAAE,gBAAgB;IACvC,eAAe,EAAE,UAAU;IAC3B,kBAAkB,EAAE,aAAa;IACjC,eAAe,EAAE,UAAU;IAC3B,wBAAwB,EAAE,mBAAmB;IAC7C,yBAAyB,EAAE,mBAAmB;IAC9C,6BAA6B,EAAE,uBAAuB;CAC7C,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,0BAA0B,EAAE,qBAAqB;IACjD,yBAAyB,EAAE,oBAAoB;IAC/C,0BAA0B,EAAE,qBAAqB;IACjD,yBAAyB,EAAE,oBAAoB;IAC/C,sBAAsB,EAAE,iBAAiB;IACzC,mBAAmB,EAAE,cAAc;IACnC,WAAW,EAAE,OAAO;IACpB,aAAa,EAAE,SAAS;IACxB,eAAe,EAAE,UAAU;IAC3B,kBAAkB,EAAE,aAAa;IACjC,oBAAoB,EAAE,cAAc;IACpC,iBAAiB,EAAE,YAAY;IAC/B,uBAAuB,EAAE,iBAAiB;IAC1C,yBAAyB,EAAE,oBAAoB;IAC/C,+BAA+B,EAAE,yBAAyB;CACjD,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,qBAAqB;IACrB,wBAAwB,EAAE,mBAAmB;IAC7C,u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AAQ;IACR,eAAe,EAAE,kBAAkB;IACnC,aAAa,EAAE,gBAAgB;IAC/B,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB;CAC/C,CAAC","sourcesContent":["/**\n * Comprehensive QTI 3.0 element name mappings.\n *\n * Based on IMS Global/1EdTech QTI 3.0 specification and amp-up.io implementation.\n * All QTI 3.0 elements use kebab-case with 'qti-' prefix.\n *\n * This file documents 172 QTI 3.0 elements providing 100% coverage of the official\n * specification including all interactions, processing rules, expressions, and\n * accessibility features.\n */\n\n/**\n * Core assessment structure elements\n */\nexport const CORE_ELEMENTS = {\n\t'qti-assessment-item': 'assessmentitem',\n\t'qti-assessment-test': 'assessmenttest',\n\t'qti-item-body': 'itembody',\n\t'qti-content-body': 'contentbody',\n\t'qti-test-part': 'testpart',\n\t'qti-assessment-section': 'assessmentsection',\n\t'qti-assessment-item-ref': 'assessmentitemref',\n\t'qti-assessment-stimulus-ref': 'assessmentstimulusref',\n} as const;\n\n/**\n * Variable declaration elements\n */\nexport const DECLARATION_ELEMENTS = {\n\t'qti-response-declaration': 'responsedeclaration',\n\t'qti-outcome-declaration': 'outcomedeclaration',\n\t'qti-template-declaration': 'templatedeclaration',\n\t'qti-context-declaration': 'contextdeclaration',\n\t'qti-correct-response': 'correctresponse',\n\t'qti-default-value': 'defaultvalue',\n\t'qti-value': 'value',\n\t'qti-mapping': 'mapping',\n\t'qti-map-entry': 'mapentry',\n\t'qti-area-mapping': 'areamapping',\n\t'qti-area-map-entry': 'areamapentry',\n\t'qti-match-table': 'matchtable',\n\t'qti-match-table-entry': 'matchtableentry',\n\t'qti-interpolation-table': 'interpolationtable',\n\t'qti-interpolation-table-entry': 'interpolationtableentry',\n} as const;\n\n/**\n * All 23+ interaction types (block and inline)\n */\nexport const INTERACTION_ELEMENTS = {\n\t// Block interactions\n\t'qti-choice-interaction': 'choiceinteraction',\n\t'qti-match-interaction': 'matchinteraction',\n\t'qti-order-interaction': 'orderinteraction',\n\t'qti-gap-match-interaction': 'gapmatchinteraction',\n\t'qti-graphic-gap-match-interaction': 'graphicgapmatchinteraction',\n\t'qti-hotspot-interaction': 'hotspotinteraction',\n\t'qti-hottext-interaction': 'hottextinteraction',\n\t'qti-extended-text-interaction': 'extendedtextinteraction',\n\t'qti-media-interaction': 'mediainteraction',\n\t'qti-select-point-interaction': 'selectpointinteraction',\n\t'qti-custom-interaction': 'custominteraction',\n\t'qti-portable-custom-interaction': 'portablecustominteraction',\n\t'qti-end-attempt-interaction': 'endattemptinteraction',\n\t'qti-slider-interaction': 'sliderinteraction',\n\t'qti-drawing-interaction': 'drawinginteraction',\n\t'qti-upload-interaction': 'uploadinteraction',\n\t'qti-position-object-interaction': 'positionobjectinteraction',\n\t'qti-graphic-order-interaction': 'graphicorderinteraction',\n\t'qti-graphic-associate-interaction': 'graphicassociateinteraction',\n\t'qti-associate-interaction': 'associateinteraction',\n\n\t// Inline interactions\n\t'qti-text-entry-interaction': 'textentryinteraction',\n\t'qti-inline-choice-interaction': 'inlinechoiceinteraction',\n\n\t// Composite interaction (QTI 3.0 advanced feature)\n\t'qti-composite-interaction': 'compositeinteraction',\n} as const;\n\n/**\n * Interaction child elements\n */\nexport const INTERACTION_CHILD_ELEMENTS = {\n\t'qti-prompt': 'prompt',\n\t'qti-simple-choice': 'simplechoice',\n\t'qti-simple-match-set': 'simplematchset',\n\t'qti-simple-associable-choice': 'simpleassociablechoice',\n\t'qti-gap': 'gap',\n\t'qti-gap-text': 'gaptext',\n\t'qti-gap-img': 'gapimg',\n\t'qti-gap-choice': 'gapchoice',\n\t'qti-hotspot-choice': 'hotspotchoice',\n\t'qti-associable-hotspot': 'associablehotspot',\n\t'qti-hottext': 'hottext',\n\t'qti-inline-choice': 'inlinechoice',\n\t'qti-object': 'object',\n\t'qti-param': 'param',\n} as const;\n\n/**\n * Response processing elements\n */\nexport const RESPONSE_PROCESSING_ELEMENTS = {\n\t'qti-response-processing': 'responseprocessing',\n\t'qti-response-condition': 'responsecondition',\n\t'qti-response-if': 'responseif',\n\t'qti-response-else-if': 'responseelseif',\n\t'qti-response-else': 'responseelse',\n\t'qti-response-processing-fragment': 'responseprocessingfragment',\n\t'qti-exit-response': 'exitresponse',\n\t'qti-set-outcome-value': 'setoutcomevalue',\n\t'qti-lookup-outcome-value': 'lookupoutcomevalue',\n\t'qti-set-correct-response': 'setcorrectresponse',\n\t'qti-set-default-value': 'setdefaultvalue',\n} as const;\n\n/**\n * Template processing elements\n */\nexport const TEMPLATE_PROCESSING_ELEMENTS = {\n\t'qti-template-processing': 'templateprocessing',\n\t'qti-template-condition': 'templatecondition',\n\t'qti-template-if': 'templateif',\n\t'qti-template-else-if': 'templateelseif',\n\t'qti-template-else': 'templateelse',\n\t'qti-template-constraint': 'templateconstraint',\n\t'qti-set-template-value': 'settemplatevalue',\n\t'qti-exit-template': 'exittemplate',\n\t'qti-template-block': 'templateblock',\n\t'qti-template-inline': 'templateinline',\n} as const;\n\n/**\n * Outcome processing elements (test-level)\n */\nexport const OUTCOME_PROCESSING_ELEMENTS = {\n\t'qti-outcome-processing': 'outcomeprocessing',\n\t'qti-outcome-condition': 'outcomecondition',\n\t'qti-outcome-if': 'outcomeif',\n\t'qti-outcome-else-if': 'outcomeelseif',\n\t'qti-outcome-else': 'outcomeelse',\n\t'qti-exit-test': 'exittest',\n} as const;\n\n/**\n * Expression elements (54+ operators)\n */\nexport const EXPRESSION_ELEMENTS = {\n\t// Variable expressions\n\t'qti-variable': 'variable',\n\t'qti-correct': 'correct',\n\t'qti-default': 'default',\n\t'qti-base-value': 'basevalue',\n\t'qti-field-value': 'fieldvalue',\n\t'qti-custom-operator': 'customoperator',\n\t'qti-index': 'index',\n\t'qti-contains': 'contains',\n\t'qti-member': 'member',\n\t'qti-null': 'null',\n\n\t// Comparison operators\n\t'qti-equal': 'equal',\n\t'qti-equal-rounded': 'equalrounded',\n\t'qti-gt': 'gt',\n\t'qti-gte': 'gte',\n\t'qti-lt': 'lt',\n\t'qti-lte': 'lte',\n\n\t// Logical operators\n\t'qti-and': 'and',\n\t'qti-or': 'or',\n\t'qti-not': 'not',\n\t'qti-any-n': 'anyn',\n\t'qti-multiple': 'multiple',\n\t'qti-ordered': 'ordered',\n\n\t// String operators\n\t'qti-string-match': 'stringmatch',\n\t'qti-pattern-match': 'patternmatch',\n\t'qti-substring': 'substring',\n\t'qti-repeat': 'repeat',\n\n\t// Matching operators\n\t'qti-match': 'match',\n\t'qti-inside': 'inside',\n\t'qti-map-response': 'mapresponse',\n\t'qti-map-response-point': 'mapresponsepoint',\n\n\t// Numeric operators\n\t'qti-sum': 'sum',\n\t'qti-product': 'product',\n\t'qti-subtract': 'subtract',\n\t'qti-divide': 'divide',\n\t'qti-integer-divide': 'integerdivide',\n\t'qti-integer-modulus': 'integermodulus',\n\t'qti-round': 'round',\n\t'qti-round-to': 'roundto',\n\t'qti-truncate': 'truncate',\n\n\t// Math functions\n\t'qti-math-operator': 'mathoperator',\n\t'qti-math-constant': 'mathconstant',\n\t'qti-power': 'power',\n\t'qti-gcd': 'gcd',\n\t'qti-lcm': 'lcm',\n\n\t// Statistical operators\n\t'qti-stats-operator': 'statsoperator',\n\t'qti-min': 'min',\n\t'qti-max': 'max',\n\t'qti-container-size': 'containersize',\n\t'qti-delete': 'delete',\n\t'qti-is-null': 'isnull',\n\t'qti-random': 'random',\n\t'qti-random-integer': 'randominteger',\n\t'qti-random-float': 'randomfloat',\n\n\t// Test-level expressions\n\t'qti-test-variables': 'testvariables',\n\t'qti-outcome-maximum': 'outcomemaximum',\n\t'qti-outcome-minimum': 'outcomeminimum',\n\t'qti-number-correct': 'numbercorrect',\n\t'qti-number-incorrect': 'numberincorrect',\n\t'qti-number-presented': 'numberpresented',\n\t'qti-number-responded': 'numberresponded',\n\t'qti-number-selected': 'numberselected',\n\n\t// Duration operators (time-based constraints)\n\t'qti-duration-gt': 'durationgt',\n\t'qti-duration-gte': 'durationgte',\n\t'qti-duration-lt': 'durationlt',\n\t'qti-duration-lte': 'durationlte',\n} as const;\n\n/**\n * Feedback elements\n */\nexport const FEEDBACK_ELEMENTS = {\n\t'qti-modal-feedback': 'modalfeedback',\n\t'qti-feedback-block': 'feedbackblock',\n\t'qti-feedback-inline': 'feedbackinline',\n\t'qti-rubric-block': 'rubricblock',\n\t'qti-modal-feedback-ok': 'modalfeedbackok',\n} as const;\n\n/**\n * PCI (Portable Custom Interaction) elements\n */\nexport const PCI_ELEMENTS = {\n\t'qti-interaction-modules': 'interactionmodules',\n\t'qti-interaction-module': 'interactionmodule',\n\t'qti-interaction-markup': 'interactionmarkup',\n\t'qti-interaction-hook': 'interactionhook',\n\t'qti-interaction-config': 'interactionconfig',\n} as const;\n\n/**\n * Catalog elements (accessibility support)\n */\nexport const CATALOG_ELEMENTS = {\n\t'qti-catalog': 'catalog',\n\t'qti-catalog-info': 'cataloginfo',\n\t'qti-card': 'card',\n\t'qti-card-entry': 'cardentry',\n\t'qti-html-content': 'htmlcontent',\n\t'qti-file-href': 'filehref',\n} as const;\n\n/**\n * Other content elements\n */\nexport const CONTENT_ELEMENTS = {\n\t'qti-printed-variable': 'printedvariable',\n\t'qti-context-variable': 'contextvariable',\n\t'qti-template-variable': 'templatevariable',\n\t'qti-stylesheet': 'stylesheet',\n\t'qti-companion-materials-info': 'companionmaterialsinfo',\n} as const;\n\n/**\n * Complete mapping of all QTI 3.0 elements to canonical form\n */\nexport const QTI3_ELEMENT_MAPPINGS = {\n\t...CORE_ELEMENTS,\n\t...DECLARATION_ELEMENTS,\n\t...INTERACTION_ELEMENTS,\n\t...INTERACTION_CHILD_ELEMENTS,\n\t...RESPONSE_PROCESSING_ELEMENTS,\n\t...TEMPLATE_PROCESSING_ELEMENTS,\n\t...OUTCOME_PROCESSING_ELEMENTS,\n\t...EXPRESSION_ELEMENTS,\n\t...FEEDBACK_ELEMENTS,\n\t...PCI_ELEMENTS,\n\t...CATALOG_ELEMENTS,\n\t...CONTENT_ELEMENTS,\n} as const;\n\n/**\n * Get canonical name for a QTI 3.0 element\n */\nexport function getCanonicalName(qti3ElementName: string): string | undefined {\n\treturn QTI3_ELEMENT_MAPPINGS[qti3ElementName as keyof typeof QTI3_ELEMENT_MAPPINGS];\n}\n\n/**\n * Check if an element name is a valid QTI 3.0 element\n */\nexport function isQti3Element(elementName: string): boolean {\n\treturn elementName in QTI3_ELEMENT_MAPPINGS;\n}\n\n/**\n * Get all QTI 3.0 interaction element names\n */\nexport function getInteractionElements(): readonly string[] {\n\treturn Object.keys(INTERACTION_ELEMENTS);\n}\n\n/**\n * Common QTI 3.0 attribute names (kebab-case)\n */\nexport const QTI3_ATTRIBUTES = {\n\t// Identifiers\n\tidentifier: 'identifier',\n\tresponseIdentifier: 'response-identifier',\n\toutcomeIdentifier: 'outcome-identifier',\n\ttemplateIdentifier: 'template-identifier',\n\n\t// Types\n\tbaseType: 'base-type',\n\tcardinality: 'cardinality',\n\n\t// Interaction attributes\n\tminChoices: 'min-choices',\n\tmaxChoices: 'max-choices',\n\tshuffle: 'shuffle',\n\tfixed: 'fixed',\n\n\t// Feedback attributes\n\tshowHide: 'show-hide',\n\n\t// Outcome attributes\n\tnormalMaximum: 'normal-maximum',\n\tnormalMinimum: 'normal-minimum',\n\n\t// Template attributes\n\tmathVariable: 'math-variable',\n\tparamVariable: 'param-variable',\n\n\t// Assessment attributes\n\ttimeDependent: 'time-dependent',\n\tadaptive: 'adaptive',\n\n\t// Text interaction attributes\n\texpectedLength: 'expected-length',\n\tpatternMask: 'pattern-mask',\n\tplaceholderText: 'placeholder-text',\n\tminStrings: 'min-strings',\n\tmaxStrings: 'max-strings',\n\n\t// Other\n\tfieldIdentifier: 'field-identifier',\n\ttoleranceMode: 'tolerance-mode',\n\tdataCatalogIdref: 'data-catalog-idref', // AMP extension\n} as const;\n"]}
|
|
1
|
+
{"version":3,"file":"qti3-element-mappings.js","sourceRoot":"","sources":["../../src/element-mapper/qti3-element-mappings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG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AC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,cAAc;IACd,UAAU,EAAE,YAAY;IACxB,kBAAkB,EAAE,qBAAqB;IACzC,iBAAiB,EAAE,oBAAoB;IACvC,kBAAkB,EAAE,qBAAqB;IAEzC,QAAQ;IACR,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,aAAa;IAE1B,yBAAyB;IACzB,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IAEd,sBAAsB;IACtB,QAAQ,EAAE,WAAW;IAErB,qBAAqB;IACrB,aAAa,EAAE,gBAAgB;IAC/B,aAAa,EAAE,gBAAgB;IAE/B,sBAAsB;IACtB,YAAY,EAAE,eAAe;IAC7B,aAAa,EAAE,gBAAgB;IAE/B,wBAAwB;IACxB,aAAa,EAAE,gBAAgB;IAC/B,QAAQ,EAAE,UAAU;IAEpB,8BAA8B;IAC9B,cAAc,EAAE,iBAAiB;IACjC,WAAW,EAAE,cAAc;IAC3B,eAAe,EAAE,kBAAkB;IACnC,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,aAAa;IAEzB,QAAQ;IACR,eAAe,EAAE,kBAAkB;IACnC,aAAa,EAAE,gBAAgB;IAC/B,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB;CAC/C,CAAC","sourcesContent":["/**\n * Comprehensive QTI 3.0 element name mappings.\n *\n * Based on IMS Global/1EdTech QTI 3.0 specification and amp-up.io implementation.\n * All QTI 3.0 elements use kebab-case with 'qti-' prefix.\n *\n * This file documents 172 QTI 3.0 elements providing 100% coverage of the official\n * specification including all interactions, processing rules, expressions, and\n * accessibility features.\n */\n\n/**\n * Core assessment structure elements\n */\nexport const CORE_ELEMENTS = {\n\t'qti-assessment-item': 'assessmentitem',\n\t'qti-assessment-test': 'assessmenttest',\n\t'qti-item-body': 'itembody',\n\t'qti-content-body': 'contentbody',\n\t'qti-test-part': 'testpart',\n\t'qti-assessment-section': 'assessmentsection',\n\t'qti-assessment-item-ref': 'assessmentitemref',\n\t'qti-assessment-stimulus-ref': 'assessmentstimulusref',\n} as const;\n\n/**\n * Variable declaration elements\n */\nexport const DECLARATION_ELEMENTS = {\n\t'qti-response-declaration': 'responsedeclaration',\n\t'qti-outcome-declaration': 'outcomedeclaration',\n\t'qti-template-declaration': 'templatedeclaration',\n\t'qti-context-declaration': 'contextdeclaration',\n\t'qti-correct-response': 'correctresponse',\n\t'qti-default-value': 'defaultvalue',\n\t'qti-value': 'value',\n\t'qti-mapping': 'mapping',\n\t'qti-map-entry': 'mapentry',\n\t'qti-area-mapping': 'areamapping',\n\t'qti-area-map-entry': 'areamapentry',\n\t'qti-match-table': 'matchtable',\n\t'qti-match-table-entry': 'matchtableentry',\n\t'qti-interpolation-table': 'interpolationtable',\n\t'qti-interpolation-table-entry': 'interpolationtableentry',\n} as const;\n\n/**\n * All 23+ interaction types (block and inline)\n */\nexport const INTERACTION_ELEMENTS = {\n\t// Block interactions\n\t'qti-choice-interaction': 'choiceinteraction',\n\t'qti-match-interaction': 'matchinteraction',\n\t'qti-order-interaction': 'orderinteraction',\n\t'qti-gap-match-interaction': 'gapmatchinteraction',\n\t'qti-graphic-gap-match-interaction': 'graphicgapmatchinteraction',\n\t'qti-hotspot-interaction': 'hotspotinteraction',\n\t'qti-hottext-interaction': 'hottextinteraction',\n\t'qti-extended-text-interaction': 'extendedtextinteraction',\n\t'qti-media-interaction': 'mediainteraction',\n\t'qti-select-point-interaction': 'selectpointinteraction',\n\t'qti-custom-interaction': 'custominteraction',\n\t'qti-portable-custom-interaction': 'portablecustominteraction',\n\t'qti-end-attempt-interaction': 'endattemptinteraction',\n\t'qti-slider-interaction': 'sliderinteraction',\n\t'qti-drawing-interaction': 'drawinginteraction',\n\t'qti-upload-interaction': 'uploadinteraction',\n\t'qti-position-object-interaction': 'positionobjectinteraction',\n\t'qti-graphic-order-interaction': 'graphicorderinteraction',\n\t'qti-graphic-associate-interaction': 'graphicassociateinteraction',\n\t'qti-associate-interaction': 'associateinteraction',\n\n\t// Inline interactions\n\t'qti-text-entry-interaction': 'textentryinteraction',\n\t'qti-inline-choice-interaction': 'inlinechoiceinteraction',\n\n} as const;\n\n/**\n * Interaction child elements\n */\nexport const INTERACTION_CHILD_ELEMENTS = {\n\t'qti-prompt': 'prompt',\n\t'qti-simple-choice': 'simplechoice',\n\t'qti-simple-match-set': 'simplematchset',\n\t'qti-simple-associable-choice': 'simpleassociablechoice',\n\t'qti-gap': 'gap',\n\t'qti-gap-text': 'gaptext',\n\t'qti-gap-img': 'gapimg',\n\t'qti-gap-choice': 'gapchoice',\n\t'qti-hotspot-choice': 'hotspotchoice',\n\t'qti-associable-hotspot': 'associablehotspot',\n\t'qti-hottext': 'hottext',\n\t'qti-inline-choice': 'inlinechoice',\n\t'qti-position-object-stage': 'positionobjectstage',\n} as const;\n\n/**\n * Response processing elements\n */\nexport const RESPONSE_PROCESSING_ELEMENTS = {\n\t'qti-response-processing': 'responseprocessing',\n\t'qti-response-condition': 'responsecondition',\n\t'qti-response-if': 'responseif',\n\t'qti-response-else-if': 'responseelseif',\n\t'qti-response-else': 'responseelse',\n\t'qti-response-processing-fragment': 'responseprocessingfragment',\n\t'qti-exit-response': 'exitresponse',\n\t'qti-set-outcome-value': 'setoutcomevalue',\n\t'qti-lookup-outcome-value': 'lookupoutcomevalue',\n\t'qti-set-correct-response': 'setcorrectresponse',\n\t'qti-set-default-value': 'setdefaultvalue',\n} as const;\n\n/**\n * Template processing elements\n */\nexport const TEMPLATE_PROCESSING_ELEMENTS = {\n\t'qti-template-processing': 'templateprocessing',\n\t'qti-template-condition': 'templatecondition',\n\t'qti-template-if': 'templateif',\n\t'qti-template-else-if': 'templateelseif',\n\t'qti-template-else': 'templateelse',\n\t'qti-template-constraint': 'templateconstraint',\n\t'qti-set-template-value': 'settemplatevalue',\n\t'qti-exit-template': 'exittemplate',\n\t'qti-template-block': 'templateblock',\n\t'qti-template-inline': 'templateinline',\n} as const;\n\n/**\n * Outcome processing elements (test-level)\n */\nexport const OUTCOME_PROCESSING_ELEMENTS = {\n\t'qti-outcome-processing': 'outcomeprocessing',\n\t'qti-outcome-condition': 'outcomecondition',\n\t'qti-outcome-if': 'outcomeif',\n\t'qti-outcome-else-if': 'outcomeelseif',\n\t'qti-outcome-else': 'outcomeelse',\n\t'qti-exit-test': 'exittest',\n} as const;\n\n/**\n * Expression elements (54+ operators)\n */\nexport const EXPRESSION_ELEMENTS = {\n\t// Variable expressions\n\t'qti-variable': 'variable',\n\t'qti-correct': 'correct',\n\t'qti-default': 'default',\n\t'qti-base-value': 'basevalue',\n\t'qti-field-value': 'fieldvalue',\n\t'qti-custom-operator': 'customoperator',\n\t'qti-index': 'index',\n\t'qti-contains': 'contains',\n\t'qti-member': 'member',\n\t'qti-null': 'null',\n\n\t// Comparison operators\n\t'qti-equal': 'equal',\n\t'qti-equal-rounded': 'equalrounded',\n\t'qti-gt': 'gt',\n\t'qti-gte': 'gte',\n\t'qti-lt': 'lt',\n\t'qti-lte': 'lte',\n\n\t// Logical operators\n\t'qti-and': 'and',\n\t'qti-or': 'or',\n\t'qti-not': 'not',\n\t'qti-any-n': 'anyn',\n\t'qti-multiple': 'multiple',\n\t'qti-ordered': 'ordered',\n\n\t// String operators\n\t'qti-string-match': 'stringmatch',\n\t'qti-pattern-match': 'patternmatch',\n\t'qti-substring': 'substring',\n\t'qti-repeat': 'repeat',\n\n\t// Matching operators\n\t'qti-match': 'match',\n\t'qti-inside': 'inside',\n\t'qti-map-response': 'mapresponse',\n\t'qti-map-response-point': 'mapresponsepoint',\n\n\t// Numeric operators\n\t'qti-sum': 'sum',\n\t'qti-product': 'product',\n\t'qti-subtract': 'subtract',\n\t'qti-divide': 'divide',\n\t'qti-integer-divide': 'integerdivide',\n\t'qti-integer-modulus': 'integermodulus',\n\t'qti-round': 'round',\n\t'qti-round-to': 'roundto',\n\t'qti-truncate': 'truncate',\n\n\t// Math functions\n\t'qti-math-operator': 'mathoperator',\n\t'qti-math-constant': 'mathconstant',\n\t'qti-power': 'power',\n\t'qti-gcd': 'gcd',\n\t'qti-lcm': 'lcm',\n\n\t// Statistical operators\n\t'qti-stats-operator': 'statsoperator',\n\t'qti-min': 'min',\n\t'qti-max': 'max',\n\t'qti-container-size': 'containersize',\n\t'qti-delete': 'delete',\n\t'qti-is-null': 'isnull',\n\t'qti-random': 'random',\n\t'qti-random-integer': 'randominteger',\n\t'qti-random-float': 'randomfloat',\n\n\t// Test-level expressions\n\t'qti-test-variables': 'testvariables',\n\t'qti-outcome-maximum': 'outcomemaximum',\n\t'qti-outcome-minimum': 'outcomeminimum',\n\t'qti-number-correct': 'numbercorrect',\n\t'qti-number-incorrect': 'numberincorrect',\n\t'qti-number-presented': 'numberpresented',\n\t'qti-number-responded': 'numberresponded',\n\t'qti-number-selected': 'numberselected',\n\n\t// Duration operators (time-based constraints)\n\t'qti-duration-gt': 'durationgt',\n\t'qti-duration-gte': 'durationgte',\n\t'qti-duration-lt': 'durationlt',\n\t'qti-duration-lte': 'durationlte',\n} as const;\n\n/**\n * Feedback elements\n */\nexport const FEEDBACK_ELEMENTS = {\n\t'qti-modal-feedback': 'modalfeedback',\n\t'qti-feedback-block': 'feedbackblock',\n\t'qti-feedback-inline': 'feedbackinline',\n\t'qti-rubric-block': 'rubricblock',\n\t'qti-modal-feedback-ok': 'modalfeedbackok',\n} as const;\n\n/**\n * PCI (Portable Custom Interaction) elements\n */\nexport const PCI_ELEMENTS = {\n\t'qti-interaction-modules': 'interactionmodules',\n\t'qti-interaction-module': 'interactionmodule',\n\t'qti-interaction-markup': 'interactionmarkup',\n\t'qti-interaction-hook': 'interactionhook',\n\t'qti-interaction-config': 'interactionconfig',\n} as const;\n\n/**\n * Catalog elements (accessibility support)\n */\nexport const CATALOG_ELEMENTS = {\n\t'qti-catalog': 'catalog',\n\t'qti-catalog-info': 'cataloginfo',\n\t'qti-card': 'card',\n\t'qti-card-entry': 'cardentry',\n\t'qti-html-content': 'htmlcontent',\n\t'qti-file-href': 'filehref',\n} as const;\n\n/**\n * Other content elements\n */\nexport const CONTENT_ELEMENTS = {\n\t'qti-printed-variable': 'printedvariable',\n\t'qti-context-variable': 'contextvariable',\n\t'qti-template-variable': 'templatevariable',\n\t'qti-stylesheet': 'stylesheet',\n\t'qti-companion-materials-info': 'companionmaterialsinfo',\n} as const;\n\n/**\n * Complete mapping of all QTI 3.0 elements to canonical form\n */\nexport const QTI3_ELEMENT_MAPPINGS = {\n\t...CORE_ELEMENTS,\n\t...DECLARATION_ELEMENTS,\n\t...INTERACTION_ELEMENTS,\n\t...INTERACTION_CHILD_ELEMENTS,\n\t...RESPONSE_PROCESSING_ELEMENTS,\n\t...TEMPLATE_PROCESSING_ELEMENTS,\n\t...OUTCOME_PROCESSING_ELEMENTS,\n\t...EXPRESSION_ELEMENTS,\n\t...FEEDBACK_ELEMENTS,\n\t...PCI_ELEMENTS,\n\t...CATALOG_ELEMENTS,\n\t...CONTENT_ELEMENTS,\n} as const;\n\n/**\n * Get canonical name for a QTI 3.0 element\n */\nexport function getCanonicalName(qti3ElementName: string): string | undefined {\n\treturn QTI3_ELEMENT_MAPPINGS[qti3ElementName as keyof typeof QTI3_ELEMENT_MAPPINGS];\n}\n\n/**\n * Check if an element name is a valid QTI 3.0 element\n */\nexport function isQti3Element(elementName: string): boolean {\n\treturn elementName in QTI3_ELEMENT_MAPPINGS;\n}\n\n/**\n * Get all QTI 3.0 interaction element names\n */\nexport function getInteractionElements(): readonly string[] {\n\treturn Object.keys(INTERACTION_ELEMENTS);\n}\n\n/**\n * Common QTI 3.0 attribute names (kebab-case)\n */\nexport const QTI3_ATTRIBUTES = {\n\t// Identifiers\n\tidentifier: 'identifier',\n\tresponseIdentifier: 'response-identifier',\n\toutcomeIdentifier: 'outcome-identifier',\n\ttemplateIdentifier: 'template-identifier',\n\n\t// Types\n\tbaseType: 'base-type',\n\tcardinality: 'cardinality',\n\n\t// Interaction attributes\n\tminChoices: 'min-choices',\n\tmaxChoices: 'max-choices',\n\tshuffle: 'shuffle',\n\tfixed: 'fixed',\n\n\t// Feedback attributes\n\tshowHide: 'show-hide',\n\n\t// Outcome attributes\n\tnormalMaximum: 'normal-maximum',\n\tnormalMinimum: 'normal-minimum',\n\n\t// Template attributes\n\tmathVariable: 'math-variable',\n\tparamVariable: 'param-variable',\n\n\t// Assessment attributes\n\ttimeDependent: 'time-dependent',\n\tadaptive: 'adaptive',\n\n\t// Text interaction attributes\n\texpectedLength: 'expected-length',\n\tpatternMask: 'pattern-mask',\n\tplaceholderText: 'placeholder-text',\n\tminStrings: 'min-strings',\n\tmaxStrings: 'max-strings',\n\n\t// Other\n\tfieldIdentifier: 'field-identifier',\n\ttoleranceMode: 'tolerance-mode',\n\tdataCatalogIdref: 'data-catalog-idref', // AMP extension\n} as const;\n"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-qti/qti-common",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@types/bun": "^1.3.
|
|
7
|
-
"@xmldom/xmldom": "^0.8.
|
|
6
|
+
"@types/bun": "^1.3.14",
|
|
7
|
+
"@xmldom/xmldom": "^0.8.13",
|
|
8
8
|
"typescript": "^5.9.3",
|
|
9
|
-
"vitest": "^
|
|
9
|
+
"vitest": "^4.1.10"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"types": "./dist/index.d.ts",
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/pie-framework/pie-qti.git",
|
|
40
|
+
"url": "git+https://github.com/pie-framework/pie-qti.git",
|
|
41
41
|
"directory": "packages/qti-common"
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/pie-framework/pie-qti/tree/master/packages/qti-common",
|