@pie-qti/qti-common 0.1.25 → 0.1.26

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.
@@ -38,15 +38,3 @@ export declare class Qti3AttributeNameMapper implements AttributeNameMapper {
38
38
  */
39
39
  private camelToKebabCase;
40
40
  }
41
- /**
42
- * Get all QTI 3.0 attribute names (kebab-case).
43
- */
44
- export declare function getQti3AttributeNames(): readonly string[];
45
- /**
46
- * Get canonical name for a QTI 3.0 attribute.
47
- */
48
- export declare function getCanonicalAttributeName(qti3AttributeName: string): string | undefined;
49
- /**
50
- * Check if an attribute name is a valid QTI 3.0 attribute.
51
- */
52
- export declare function isQti3Attribute(attributeName: string): boolean;
@@ -1,171 +1,4 @@
1
- /**
2
- * QTI 3.0 attribute name mappings from kebab-case to camelCase.
3
- *
4
- * Based on QTI 3.0 specification where all attributes use kebab-case.
5
- * This provides comprehensive mappings for all standard QTI attributes.
6
- */
7
- const QTI3_ATTRIBUTE_MAPPINGS = {
8
- // Core identifiers
9
- identifier: 'identifier',
10
- 'response-identifier': 'responseIdentifier',
11
- 'outcome-identifier': 'outcomeIdentifier',
12
- 'template-identifier': 'templateIdentifier',
13
- 'context-identifier': 'contextIdentifier',
14
- // Types and cardinality
15
- 'base-type': 'baseType',
16
- cardinality: 'cardinality',
17
- // Choice/selection attributes
18
- 'max-choices': 'maxChoices',
19
- 'min-choices': 'minChoices',
20
- shuffle: 'shuffle',
21
- fixed: 'fixed',
22
- orientation: 'orientation',
23
- required: 'required',
24
- // Match/association attributes
25
- 'match-max': 'matchMax',
26
- 'match-min': 'matchMin',
27
- 'max-associations': 'maxAssociations',
28
- 'min-associations': 'minAssociations',
29
- // Text interaction attributes
30
- 'expected-length': 'expectedLength',
31
- 'expected-lines': 'expectedLines',
32
- 'pattern-mask': 'patternMask',
33
- 'placeholder-text': 'placeholderText',
34
- format: 'format',
35
- 'string-identifier': 'stringIdentifier',
36
- 'min-strings': 'minStrings',
37
- 'max-strings': 'maxStrings',
38
- // Slider attributes
39
- 'lower-bound': 'lowerBound',
40
- 'upper-bound': 'upperBound',
41
- step: 'step',
42
- 'step-label': 'stepLabel',
43
- reverse: 'reverse',
44
- // Hotspot/graphic attributes
45
- shape: 'shape',
46
- coords: 'coords',
47
- 'hotspot-label': 'hotspotLabel',
48
- 'min-hotspots': 'minHotspots',
49
- 'max-hotspots': 'maxHotspots',
50
- // Media attributes
51
- autostart: 'autostart',
52
- 'min-plays': 'minPlays',
53
- 'max-plays': 'maxPlays',
54
- loop: 'loop',
55
- controls: 'controls',
56
- // Feedback attributes
57
- 'show-hide': 'showHide',
58
- 'outcome-value': 'outcomeValue',
59
- access: 'access',
60
- view: 'view',
61
- // Outcome/result attributes
62
- 'normal-maximum': 'normalMaximum',
63
- 'normal-minimum': 'normalMinimum',
64
- 'mastery-value': 'masteryValue',
65
- interpretation: 'interpretation',
66
- 'long-interpretation': 'longInterpretation',
67
- // Template attributes
68
- 'math-variable': 'mathVariable',
69
- 'param-variable': 'paramVariable',
70
- // Assessment/test attributes
71
- 'time-dependent': 'timeDependent',
72
- adaptive: 'adaptive',
73
- title: 'title',
74
- label: 'label',
75
- // Test structure attributes
76
- 'navigation-mode': 'navigationMode',
77
- 'submission-mode': 'submissionMode',
78
- 'item-session-control': 'itemSessionControl',
79
- 'time-limits': 'timeLimits',
80
- // Time limits
81
- 'min-time': 'minTime',
82
- 'max-time': 'maxTime',
83
- 'allow-late-submission': 'allowLateSubmission',
84
- // Item session control
85
- 'max-attempts': 'maxAttempts',
86
- 'show-feedback': 'showFeedback',
87
- 'allow-review': 'allowReview',
88
- 'show-solution': 'showSolution',
89
- 'allow-comment': 'allowComment',
90
- 'allow-skipping': 'allowSkipping',
91
- 'validate-responses': 'validateResponses',
92
- // Processing attributes
93
- template: 'template',
94
- 'template-location': 'templateLocation',
95
- // Expression attributes
96
- 'field-identifier': 'fieldIdentifier',
97
- 'base-value': 'baseValue',
98
- 'tolerance-mode': 'toleranceMode',
99
- 'include-category': 'includeCategory',
100
- 'exclude-category': 'excludeCategory',
101
- 'section-identifier': 'sectionIdentifier',
102
- 'weight-identifier': 'weightIdentifier',
103
- // Mapping attributes
104
- 'map-key': 'mapKey',
105
- 'mapped-value': 'mappedValue',
106
- 'case-sensitive': 'caseSensitive',
107
- 'default-value': 'defaultValue',
108
- // Note: lower-bound and upper-bound already defined above (used in slider and mapping contexts)
109
- // Interpolation attributes
110
- 'source-value': 'sourceValue',
111
- 'target-value': 'targetValue',
112
- 'include-boundary': 'includeBoundary',
113
- // Ordering attributes
114
- 'keep-together': 'keepTogether',
115
- // Selection attributes
116
- select: 'select',
117
- 'with-replacement': 'withReplacement',
118
- // Pre-conditions and branching
119
- 'pre-condition': 'preCondition',
120
- 'branch-rule': 'branchRule',
121
- // Catalog/accessibility attributes
122
- 'data-catalog-idref': 'dataCatalogIdref',
123
- support: 'support',
124
- 'card-idref': 'cardIdref',
125
- // PCI attributes
126
- hook: 'hook',
127
- module: 'module',
128
- 'entry-point': 'entryPoint',
129
- // Object attributes
130
- data: 'data',
131
- type: 'type',
132
- width: 'width',
133
- height: 'height',
134
- codetype: 'codetype',
135
- codebase: 'codebase',
136
- archive: 'archive',
137
- // Param attributes
138
- name: 'name',
139
- value: 'value',
140
- valuetype: 'valuetype',
141
- // Stylesheet attributes
142
- href: 'href',
143
- media: 'media',
144
- // Math operator attributes
145
- operator: 'operator',
146
- // Stats operator attributes
147
- 'stats-operator': 'statsOperator',
148
- // Rounding attributes
149
- 'rounding-mode': 'roundingMode',
150
- figures: 'figures',
151
- // Variable matching
152
- 'variable-identifier': 'variableIdentifier',
153
- // Index attributes
154
- n: 'n',
155
- // String matching
156
- 'substring-match': 'substringMatch',
157
- // Container attributes
158
- 'ordered-container': 'orderedContainer',
159
- // Custom operator
160
- class: 'class',
161
- definition: 'definition',
162
- // Standard XML attributes (pass through)
163
- lang: 'lang',
164
- 'xml:lang': 'xml:lang',
165
- 'xml:base': 'xml:base',
166
- id: 'id',
167
- xmlns: 'xmlns',
168
- };
1
+ import { QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';
169
2
  /**
170
3
  * QTI 3.0 attribute name mapper.
171
4
  *
@@ -188,7 +21,7 @@ export class Qti3AttributeNameMapper {
188
21
  */
189
22
  toCanonical(attributeName) {
190
23
  // Direct lookup
191
- const canonical = QTI3_ATTRIBUTE_MAPPINGS[attributeName];
24
+ const canonical = QTI3_ATTRIBUTE_TO_QTI2.get(attributeName);
192
25
  if (canonical) {
193
26
  return canonical;
194
27
  }
@@ -206,7 +39,7 @@ export class Qti3AttributeNameMapper {
206
39
  // Build reverse map on first use
207
40
  if (!this.reverseMap) {
208
41
  this.reverseMap = new Map();
209
- for (const [kebab, camel] of Object.entries(QTI3_ATTRIBUTE_MAPPINGS)) {
42
+ for (const [kebab, camel] of QTI3_ATTRIBUTE_TO_QTI2) {
210
43
  this.reverseMap.set(camel, kebab);
211
44
  }
212
45
  }
@@ -251,22 +84,4 @@ export class Qti3AttributeNameMapper {
251
84
  return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
252
85
  }
253
86
  }
254
- /**
255
- * Get all QTI 3.0 attribute names (kebab-case).
256
- */
257
- export function getQti3AttributeNames() {
258
- return Object.keys(QTI3_ATTRIBUTE_MAPPINGS);
259
- }
260
- /**
261
- * Get canonical name for a QTI 3.0 attribute.
262
- */
263
- export function getCanonicalAttributeName(qti3AttributeName) {
264
- return QTI3_ATTRIBUTE_MAPPINGS[qti3AttributeName];
265
- }
266
- /**
267
- * Check if an attribute name is a valid QTI 3.0 attribute.
268
- */
269
- export function isQti3Attribute(attributeName) {
270
- return attributeName in QTI3_ATTRIBUTE_MAPPINGS;
271
- }
272
87
  //# sourceMappingURL=Qti3AttributeNameMapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Qti3AttributeNameMapper.js","sourceRoot":"","sources":["../../src/element-mapper/Qti3AttributeNameMapper.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAC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C,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,aAAqB;QACzC,2CAA2C;QAC3C,IACC,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC;YAChC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;YACjC,aAAa,KAAK,IAAI,EACrB,CAAC;YACF,OAAO,IAAI,CAAC;QACb,CAAC;QAED,mEAAmE;QACnE,wDAAwD;QACxD,OAAO,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACK,gBAAgB,CAAC,GAAW;QACnC,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACK,gBAAgB,CAAC,GAAW;QACnC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;CACD;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,iBAAyB;IAClE,OAAO,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,aAAqB;IACpD,OAAO,aAAa,IAAI,uBAAuB,CAAC;AACjD,CAAC","sourcesContent":["import type { AttributeNameMapper } from './AttributeNameMapper.js';\n\n/**\n * QTI 3.0 attribute name mappings from kebab-case to camelCase.\n *\n * Based on QTI 3.0 specification where all attributes use kebab-case.\n * This provides comprehensive mappings for all standard QTI attributes.\n */\nconst QTI3_ATTRIBUTE_MAPPINGS: Record<string, string> = {\n\t// Core identifiers\n\tidentifier: 'identifier',\n\t'response-identifier': 'responseIdentifier',\n\t'outcome-identifier': 'outcomeIdentifier',\n\t'template-identifier': 'templateIdentifier',\n\t'context-identifier': 'contextIdentifier',\n\n\t// Types and cardinality\n\t'base-type': 'baseType',\n\tcardinality: 'cardinality',\n\n\t// Choice/selection attributes\n\t'max-choices': 'maxChoices',\n\t'min-choices': 'minChoices',\n\tshuffle: 'shuffle',\n\tfixed: 'fixed',\n\torientation: 'orientation',\n\trequired: 'required',\n\n\t// Match/association attributes\n\t'match-max': 'matchMax',\n\t'match-min': 'matchMin',\n\t'max-associations': 'maxAssociations',\n\t'min-associations': 'minAssociations',\n\n\t// Text interaction attributes\n\t'expected-length': 'expectedLength',\n\t'expected-lines': 'expectedLines',\n\t'pattern-mask': 'patternMask',\n\t'placeholder-text': 'placeholderText',\n\tformat: 'format',\n\t'string-identifier': 'stringIdentifier',\n\t'min-strings': 'minStrings',\n\t'max-strings': 'maxStrings',\n\n\t// Slider attributes\n\t'lower-bound': 'lowerBound',\n\t'upper-bound': 'upperBound',\n\tstep: 'step',\n\t'step-label': 'stepLabel',\n\treverse: 'reverse',\n\n\t// Hotspot/graphic attributes\n\tshape: 'shape',\n\tcoords: 'coords',\n\t'hotspot-label': 'hotspotLabel',\n\t'min-hotspots': 'minHotspots',\n\t'max-hotspots': 'maxHotspots',\n\n\t// Media attributes\n\tautostart: 'autostart',\n\t'min-plays': 'minPlays',\n\t'max-plays': 'maxPlays',\n\tloop: 'loop',\n\tcontrols: 'controls',\n\n\t// Feedback attributes\n\t'show-hide': 'showHide',\n\t'outcome-value': 'outcomeValue',\n\taccess: 'access',\n\tview: 'view',\n\n\t// Outcome/result attributes\n\t'normal-maximum': 'normalMaximum',\n\t'normal-minimum': 'normalMinimum',\n\t'mastery-value': 'masteryValue',\n\tinterpretation: 'interpretation',\n\t'long-interpretation': 'longInterpretation',\n\n\t// Template attributes\n\t'math-variable': 'mathVariable',\n\t'param-variable': 'paramVariable',\n\n\t// Assessment/test attributes\n\t'time-dependent': 'timeDependent',\n\tadaptive: 'adaptive',\n\ttitle: 'title',\n\tlabel: 'label',\n\n\t// Test structure attributes\n\t'navigation-mode': 'navigationMode',\n\t'submission-mode': 'submissionMode',\n\t'item-session-control': 'itemSessionControl',\n\t'time-limits': 'timeLimits',\n\n\t// Time limits\n\t'min-time': 'minTime',\n\t'max-time': 'maxTime',\n\t'allow-late-submission': 'allowLateSubmission',\n\n\t// Item session control\n\t'max-attempts': 'maxAttempts',\n\t'show-feedback': 'showFeedback',\n\t'allow-review': 'allowReview',\n\t'show-solution': 'showSolution',\n\t'allow-comment': 'allowComment',\n\t'allow-skipping': 'allowSkipping',\n\t'validate-responses': 'validateResponses',\n\n\t// Processing attributes\n\ttemplate: 'template',\n\t'template-location': 'templateLocation',\n\n\t// Expression attributes\n\t'field-identifier': 'fieldIdentifier',\n\t'base-value': 'baseValue',\n\t'tolerance-mode': 'toleranceMode',\n\t'include-category': 'includeCategory',\n\t'exclude-category': 'excludeCategory',\n\t'section-identifier': 'sectionIdentifier',\n\t'weight-identifier': 'weightIdentifier',\n\n\t// Mapping attributes\n\t'map-key': 'mapKey',\n\t'mapped-value': 'mappedValue',\n\t'case-sensitive': 'caseSensitive',\n\t'default-value': 'defaultValue',\n\t// Note: lower-bound and upper-bound already defined above (used in slider and mapping contexts)\n\n\t// Interpolation attributes\n\t'source-value': 'sourceValue',\n\t'target-value': 'targetValue',\n\t'include-boundary': 'includeBoundary',\n\n\t// Ordering attributes\n\t'keep-together': 'keepTogether',\n\n\t// Selection attributes\n\tselect: 'select',\n\t'with-replacement': 'withReplacement',\n\n\t// Pre-conditions and branching\n\t'pre-condition': 'preCondition',\n\t'branch-rule': 'branchRule',\n\n\t// Catalog/accessibility attributes\n\t'data-catalog-idref': 'dataCatalogIdref',\n\tsupport: 'support',\n\t'card-idref': 'cardIdref',\n\n\t// PCI attributes\n\thook: 'hook',\n\tmodule: 'module',\n\t'entry-point': 'entryPoint',\n\n\t// Object attributes\n\tdata: 'data',\n\ttype: 'type',\n\twidth: 'width',\n\theight: 'height',\n\tcodetype: 'codetype',\n\tcodebase: 'codebase',\n\tarchive: 'archive',\n\n\t// Param attributes\n\tname: 'name',\n\tvalue: 'value',\n\tvaluetype: 'valuetype',\n\n\t// Stylesheet attributes\n\thref: 'href',\n\tmedia: 'media',\n\n\t// Math operator attributes\n\toperator: 'operator',\n\n\t// Stats operator attributes\n\t'stats-operator': 'statsOperator',\n\n\t// Rounding attributes\n\t'rounding-mode': 'roundingMode',\n\tfigures: 'figures',\n\n\t// Variable matching\n\t'variable-identifier': 'variableIdentifier',\n\n\t// Index attributes\n\tn: 'n',\n\n\t// String matching\n\t'substring-match': 'substringMatch',\n\n\t// Container attributes\n\t'ordered-container': 'orderedContainer',\n\n\t// Custom operator\n\tclass: 'class',\n\tdefinition: 'definition',\n\n\t// Standard XML attributes (pass through)\n\tlang: 'lang',\n\t'xml:lang': 'xml:lang',\n\t'xml:base': 'xml:base',\n\tid: 'id',\n\txmlns: 'xmlns',\n} as const;\n\n/**\n * QTI 3.0 attribute name mapper.\n *\n * QTI 3.0 uses kebab-case for attribute names. This mapper converts\n * between kebab-case (QTI 3.0) and camelCase (internal canonical form).\n *\n * @example\n * const mapper = new Qti3AttributeNameMapper();\n * mapper.toCanonical('response-identifier'); // => 'responseIdentifier'\n * mapper.toCanonical('max-choices'); // => 'maxChoices'\n * mapper.toNative('responseIdentifier'); // => 'response-identifier'\n * mapper.toNative('maxChoices'); // => 'max-choices'\n */\nexport class Qti3AttributeNameMapper implements AttributeNameMapper {\n\treadonly version = '3.0';\n\n\t// Reverse mapping cache (camelCase -> kebab-case)\n\tprivate reverseMap: Map<string, string> | null = null;\n\n\t/**\n\t * Convert QTI 3.0 kebab-case attribute to canonical camelCase.\n\t */\n\ttoCanonical(attributeName: string): string {\n\t\t// Direct lookup\n\t\tconst canonical = QTI3_ATTRIBUTE_MAPPINGS[attributeName];\n\t\tif (canonical) {\n\t\t\treturn canonical;\n\t\t}\n\n\t\t// If already in camelCase (no hyphens), return as-is\n\t\tif (!attributeName.includes('-')) {\n\t\t\treturn attributeName;\n\t\t}\n\n\t\t// Fallback: convert kebab-case to camelCase programmatically\n\t\treturn this.kebabToCamelCase(attributeName);\n\t}\n\n\t/**\n\t * Convert canonical camelCase to QTI 3.0 kebab-case.\n\t */\n\ttoNative(canonicalName: string): string {\n\t\t// Build reverse map on first use\n\t\tif (!this.reverseMap) {\n\t\t\tthis.reverseMap = new Map();\n\t\t\tfor (const [kebab, camel] of Object.entries(QTI3_ATTRIBUTE_MAPPINGS)) {\n\t\t\t\tthis.reverseMap.set(camel, kebab);\n\t\t\t}\n\t\t}\n\n\t\t// Direct lookup\n\t\tconst native = this.reverseMap.get(canonicalName);\n\t\tif (native) {\n\t\t\treturn native;\n\t\t}\n\n\t\t// If already in kebab-case, return as-is\n\t\tif (canonicalName.includes('-')) {\n\t\t\treturn canonicalName;\n\t\t}\n\n\t\t// Fallback: convert camelCase to kebab-case programmatically\n\t\treturn this.camelToKebabCase(canonicalName);\n\t}\n\n\t/**\n\t * Check if attribute name is valid kebab-case.\n\t */\n\tisValidAttributeName(attributeName: string): boolean {\n\t\t// Standard XML attributes are always valid\n\t\tif (\n\t\t\tattributeName.startsWith('xml:') ||\n\t\t\tattributeName.startsWith('xmlns') ||\n\t\t\tattributeName === 'id'\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// QTI 3.0 attributes should be kebab-case (lowercase with hyphens)\n\t\t// or simple lowercase (like 'shuffle', 'type', 'value')\n\t\treturn /^[a-z][a-z0-9-]*$/.test(attributeName);\n\t}\n\n\t/**\n\t * Convert kebab-case to camelCase.\n\t * @private\n\t */\n\tprivate kebabToCamelCase(str: string): string {\n\t\treturn str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n\t}\n\n\t/**\n\t * Convert camelCase to kebab-case.\n\t * @private\n\t */\n\tprivate camelToKebabCase(str: string): string {\n\t\treturn str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n\t}\n}\n\n/**\n * Get all QTI 3.0 attribute names (kebab-case).\n */\nexport function getQti3AttributeNames(): readonly string[] {\n\treturn Object.keys(QTI3_ATTRIBUTE_MAPPINGS);\n}\n\n/**\n * Get canonical name for a QTI 3.0 attribute.\n */\nexport function getCanonicalAttributeName(qti3AttributeName: string): string | undefined {\n\treturn QTI3_ATTRIBUTE_MAPPINGS[qti3AttributeName];\n}\n\n/**\n * Check if an attribute name is a valid QTI 3.0 attribute.\n */\nexport function isQti3Attribute(attributeName: string): boolean {\n\treturn attributeName in QTI3_ATTRIBUTE_MAPPINGS;\n}\n"]}
1
+ {"version":3,"file":"Qti3AttributeNameMapper.js","sourceRoot":"","sources":["../../src/element-mapper/Qti3AttributeNameMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,uBAAuB;IAC1B,OAAO,GAAG,KAAK,CAAC;IAEzB,kDAAkD;IAC1C,UAAU,GAA+B,IAAI,CAAC;IAEtD;;OAEG;IACH,WAAW,CAAC,aAAqB;QAChC,gBAAgB;QAChB,MAAM,SAAS,GAAG,sBAAsB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC5D,IAAI,SAAS,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,qDAAqD;QACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,OAAO,aAAa,CAAC;QACtB,CAAC;QAED,6DAA6D;QAC7D,OAAO,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,aAAqB;QAC7B,iCAAiC;QACjC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAA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per.js';\nimport { QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';\n\n/**\n * QTI 3.0 attribute name mapper.\n *\n * QTI 3.0 uses kebab-case for attribute names. This mapper converts\n * between kebab-case (QTI 3.0) and camelCase (internal canonical form).\n *\n * @example\n * const mapper = new Qti3AttributeNameMapper();\n * mapper.toCanonical('response-identifier'); // => 'responseIdentifier'\n * mapper.toCanonical('max-choices'); // => 'maxChoices'\n * mapper.toNative('responseIdentifier'); // => 'response-identifier'\n * mapper.toNative('maxChoices'); // => 'max-choices'\n */\nexport class Qti3AttributeNameMapper implements AttributeNameMapper {\n\treadonly version = '3.0';\n\n\t// Reverse mapping cache (camelCase -> kebab-case)\n\tprivate reverseMap: Map<string, string> | null = null;\n\n\t/**\n\t * Convert QTI 3.0 kebab-case attribute to canonical camelCase.\n\t */\n\ttoCanonical(attributeName: string): string {\n\t\t// Direct lookup\n\t\tconst canonical = QTI3_ATTRIBUTE_TO_QTI2.get(attributeName);\n\t\tif (canonical) {\n\t\t\treturn canonical;\n\t\t}\n\n\t\t// If already in camelCase (no hyphens), return as-is\n\t\tif (!attributeName.includes('-')) {\n\t\t\treturn attributeName;\n\t\t}\n\n\t\t// Fallback: convert kebab-case to camelCase programmatically\n\t\treturn this.kebabToCamelCase(attributeName);\n\t}\n\n\t/**\n\t * Convert canonical camelCase to QTI 3.0 kebab-case.\n\t */\n\ttoNative(canonicalName: string): string {\n\t\t// Build reverse map on first use\n\t\tif (!this.reverseMap) {\n\t\t\tthis.reverseMap = new Map();\n\t\t\tfor (const [kebab, camel] of QTI3_ATTRIBUTE_TO_QTI2) {\n\t\t\t\tthis.reverseMap.set(camel, kebab);\n\t\t\t}\n\t\t}\n\n\t\t// Direct lookup\n\t\tconst native = this.reverseMap.get(canonicalName);\n\t\tif (native) {\n\t\t\treturn native;\n\t\t}\n\n\t\t// If already in kebab-case, return as-is\n\t\tif (canonicalName.includes('-')) {\n\t\t\treturn canonicalName;\n\t\t}\n\n\t\t// Fallback: convert camelCase to kebab-case programmatically\n\t\treturn this.camelToKebabCase(canonicalName);\n\t}\n\n\t/**\n\t * Check if attribute name is valid kebab-case.\n\t */\n\tisValidAttributeName(attributeName: string): boolean {\n\t\t// Standard XML attributes are always valid\n\t\tif (\n\t\t\tattributeName.startsWith('xml:') ||\n\t\t\tattributeName.startsWith('xmlns') ||\n\t\t\tattributeName === 'id'\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// QTI 3.0 attributes should be kebab-case (lowercase with hyphens)\n\t\t// or simple lowercase (like 'shuffle', 'type', 'value')\n\t\treturn /^[a-z][a-z0-9-]*$/.test(attributeName);\n\t}\n\n\t/**\n\t * Convert kebab-case to camelCase.\n\t * @private\n\t */\n\tprivate kebabToCamelCase(str: string): string {\n\t\treturn str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n\t}\n\n\t/**\n\t * Convert camelCase to kebab-case.\n\t * @private\n\t */\n\tprivate camelToKebabCase(str: string): string {\n\t\treturn str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n\t}\n}\n"]}
@@ -4,3 +4,4 @@ export { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';
4
4
  export type { AttributeNameMapper } from './AttributeNameMapper.js';
5
5
  export { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';
6
6
  export { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';
7
+ export { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';
@@ -2,4 +2,5 @@ export { Qti2xElementNameMapper } from './Qti2xElementNameMapper.js';
2
2
  export { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';
3
3
  export { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';
4
4
  export { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';
5
+ export { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/element-mapper/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export type { ElementNameMapper } from './ElementNameMapper.js';\nexport { Qti2xElementNameMapper } from './Qti2xElementNameMapper.js';\nexport { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';\n\nexport type { AttributeNameMapper } from './AttributeNameMapper.js';\nexport { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';\nexport { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/element-mapper/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export type { ElementNameMapper } from './ElementNameMapper.js';\nexport { Qti2xElementNameMapper } from './Qti2xElementNameMapper.js';\nexport { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';\n\nexport type { AttributeNameMapper } from './AttributeNameMapper.js';\nexport { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';\nexport { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';\nexport { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';\n"]}
@@ -0,0 +1,8 @@
1
+ /** QTI 3.0 kebab-case attribute name → QTI 2.x camelCase equivalent. 79 entries. */
2
+ export declare const QTI3_ATTRIBUTE_TO_QTI2: Map<string, string>;
3
+ /**
4
+ * QTI 2.2 interactions whose content model permits a `prompt` child (it must come first).
5
+ * The inline interactions are deliberately absent: moving a prompt into one would trade one
6
+ * schema violation for another.
7
+ */
8
+ export declare const QTI2_PROMPT_BEARING_INTERACTIONS: ReadonlySet<string>;
@@ -0,0 +1,115 @@
1
+ // GENERATED FILE — do not edit by hand.
2
+ // Regenerate with:
3
+ // bun run packages/qti-common/scripts/generate-qti3-attribute-map.ts
4
+ //
5
+ // Derived from the IMS QTI schemas vendored in packages/to-pie (imsqti_v2p1.xsd, imsqti_v2p2.xsd) by taking every
6
+ // camelCase attribute name in the QTI 2.x vocabulary and kebab-casing it, which is exactly
7
+ // the QTI 3.0 attribute rename. Attributes already kebab-case in QTI 2.x (`aria-*`) carry
8
+ // no uppercase letter and so are absent here by construction — as are `data-*`,
9
+ // `xml:lang` and HTML attributes, since lookup is by exact name.
10
+ /** QTI 3.0 kebab-case attribute name → QTI 2.x camelCase equivalent. 79 entries. */
11
+ export const QTI3_ATTRIBUTE_TO_QTI2 = new Map([
12
+ ['allow-comment', 'allowComment'],
13
+ ['allow-late-submission', 'allowLateSubmission'],
14
+ ['allow-review', 'allowReview'],
15
+ ['allow-skipping', 'allowSkipping'],
16
+ ['base-type', 'baseType'],
17
+ ['case-sensitive', 'caseSensitive'],
18
+ ['center-point', 'centerPoint'],
19
+ ['centre-point', 'centrePoint'],
20
+ ['count-attempt', 'countAttempt'],
21
+ ['data-extension', 'dataExtension'],
22
+ ['default-value', 'defaultValue'],
23
+ ['exclude-category', 'excludeCategory'],
24
+ ['expected-length', 'expectedLength'],
25
+ ['expected-lines', 'expectedLines'],
26
+ ['external-scored', 'externalScored'],
27
+ ['field-identifier', 'fieldIdentifier'],
28
+ ['hotspot-label', 'hotspotLabel'],
29
+ ['include-boundary', 'includeBoundary'],
30
+ ['include-category', 'includeCategory'],
31
+ ['include-lower-bound', 'includeLowerBound'],
32
+ ['include-upper-bound', 'includeUpperBound'],
33
+ ['keep-together', 'keepTogether'],
34
+ ['long-interpretation', 'longInterpretation'],
35
+ ['lower-bound', 'lowerBound'],
36
+ ['map-key', 'mapKey'],
37
+ ['mapped-value', 'mappedValue'],
38
+ ['mapping-indicator', 'mappingIndicator'],
39
+ ['mastery-value', 'masteryValue'],
40
+ ['match-group', 'matchGroup'],
41
+ ['match-max', 'matchMax'],
42
+ ['match-min', 'matchMin'],
43
+ ['math-variable', 'mathVariable'],
44
+ ['max-associations', 'maxAssociations'],
45
+ ['max-attempts', 'maxAttempts'],
46
+ ['max-choices', 'maxChoices'],
47
+ ['max-plays', 'maxPlays'],
48
+ ['max-strings', 'maxStrings'],
49
+ ['max-time', 'maxTime'],
50
+ ['min-associations', 'minAssociations'],
51
+ ['min-choices', 'minChoices'],
52
+ ['min-plays', 'minPlays'],
53
+ ['min-strings', 'minStrings'],
54
+ ['min-time', 'minTime'],
55
+ ['navigation-mode', 'navigationMode'],
56
+ ['normal-maximum', 'normalMaximum'],
57
+ ['normal-minimum', 'normalMinimum'],
58
+ ['number-repeats', 'numberRepeats'],
59
+ ['object-label', 'objectLabel'],
60
+ ['outcome-identifier', 'outcomeIdentifier'],
61
+ ['param-variable', 'paramVariable'],
62
+ ['pattern-mask', 'patternMask'],
63
+ ['placeholder-text', 'placeholderText'],
64
+ ['power-form', 'powerForm'],
65
+ ['response-identifier', 'responseIdentifier'],
66
+ ['rounding-mode', 'roundingMode'],
67
+ ['section-identifier', 'sectionIdentifier'],
68
+ ['show-feedback', 'showFeedback'],
69
+ ['show-hide', 'showHide'],
70
+ ['show-solution', 'showSolution'],
71
+ ['source-identifier', 'sourceIdentifier'],
72
+ ['source-value', 'sourceValue'],
73
+ ['step-label', 'stepLabel'],
74
+ ['string-identifier', 'stringIdentifier'],
75
+ ['submission-mode', 'submissionMode'],
76
+ ['target-identifier', 'targetIdentifier'],
77
+ ['target-type', 'targetType'],
78
+ ['target-value', 'targetValue'],
79
+ ['template-identifier', 'templateIdentifier'],
80
+ ['template-location', 'templateLocation'],
81
+ ['time-dependent', 'timeDependent'],
82
+ ['tolerance-mode', 'toleranceMode'],
83
+ ['tool-name', 'toolName'],
84
+ ['tool-version', 'toolVersion'],
85
+ ['upper-bound', 'upperBound'],
86
+ ['validate-responses', 'validateResponses'],
87
+ ['variable-identifier', 'variableIdentifier'],
88
+ ['variable-identifier-ref', 'variableIdentifierRef'],
89
+ ['weight-identifier', 'weightIdentifier'],
90
+ ['with-replacement', 'withReplacement'],
91
+ ]);
92
+ /**
93
+ * QTI 2.2 interactions whose content model permits a `prompt` child (it must come first).
94
+ * The inline interactions are deliberately absent: moving a prompt into one would trade one
95
+ * schema violation for another.
96
+ */
97
+ export const QTI2_PROMPT_BEARING_INTERACTIONS = new Set([
98
+ 'associateInteraction',
99
+ 'choiceInteraction',
100
+ 'drawingInteraction',
101
+ 'extendedTextInteraction',
102
+ 'gapMatchInteraction',
103
+ 'graphicAssociateInteraction',
104
+ 'graphicGapMatchInteraction',
105
+ 'graphicOrderInteraction',
106
+ 'hotspotInteraction',
107
+ 'hottextInteraction',
108
+ 'matchInteraction',
109
+ 'mediaInteraction',
110
+ 'orderInteraction',
111
+ 'selectPointInteraction',
112
+ 'sliderInteraction',
113
+ 'uploadInteraction',
114
+ ]);
115
+ //# sourceMappingURL=qti3-attribute-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti3-attribute-map.js","sourceRoot":"","sources":["../../src/element-mapper/qti3-attribute-map.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,mBAAmB;AACnB,uEAAuE;AACvE,EAAE;AACF,kHAAkH;AAClH,2FAA2F;AAC3F,0FAA0F;AAC1F,gFAAgF;AAChF,iEAAiE;AAEjE,oFAAoF;AACpF,MAAM,CAA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C,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;IACrC,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;IACzC,CAAC,aAAa,EAAE,YAAY,CAAC;IAC7B,CAAC,cAAc,EAAE,aAAa,CAAC;IAC/B,CAAC,qBAAqB,EAAE,oBAAoB,CAAC;IAC7C,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;IACzC,CAAC,gBAAgB,EAAE,eAAe,CAAC;IACnC,CAAC,gBAAgB,EAAE,eAAe,CAAC;IACnC,CAAC,WAAW,EAAE,UAAU,CAAC;IACzB,CAAC,cAAc,EAAE,aAAa,CAAC;IAC/B,CAAC,aAAa,EAAE,YAAY,CAAC;IAC7B,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;IAC3C,CAAC,qBAAqB,EAAE,oBAAoB,CAAC;IAC7C,CAAC,yBAAyB,EAAE,uBAAuB,CAAC;IACpD,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;IACzC,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;CACxC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAwB,IAAI,GAAG,CAAC;IAC3E,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;IACrB,6BAA6B;IAC7B,4BAA4B;IAC5B,yBAAyB;IACzB,oBAAoB;IACpB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,wBAAwB;IACxB,mBAAmB;IACnB,mBAAmB;CACpB,CAAC,CAAC","sourcesContent":["// GENERATED FILE — do not edit by hand.\n// Regenerate with:\n// bun run packages/qti-common/scripts/generate-qti3-attribute-map.ts\n//\n// Derived from the IMS QTI schemas vendored in packages/to-pie (imsqti_v2p1.xsd, imsqti_v2p2.xsd) by taking every\n// camelCase attribute name in the QTI 2.x vocabulary and kebab-casing it, which is exactly\n// the QTI 3.0 attribute rename. Attributes already kebab-case in QTI 2.x (`aria-*`) carry\n// no uppercase letter and so are absent here by construction — as are `data-*`,\n// `xml:lang` and HTML attributes, since lookup is by exact name.\n\n/** QTI 3.0 kebab-case attribute name → QTI 2.x camelCase equivalent. 79 entries. */\nexport const QTI3_ATTRIBUTE_TO_QTI2 = new Map<string, string>([\n ['allow-comment', 'allowComment'],\n ['allow-late-submission', 'allowLateSubmission'],\n ['allow-review', 'allowReview'],\n ['allow-skipping', 'allowSkipping'],\n ['base-type', 'baseType'],\n ['case-sensitive', 'caseSensitive'],\n ['center-point', 'centerPoint'],\n ['centre-point', 'centrePoint'],\n ['count-attempt', 'countAttempt'],\n ['data-extension', 'dataExtension'],\n ['default-value', 'defaultValue'],\n ['exclude-category', 'excludeCategory'],\n ['expected-length', 'expectedLength'],\n ['expected-lines', 'expectedLines'],\n ['external-scored', 'externalScored'],\n ['field-identifier', 'fieldIdentifier'],\n ['hotspot-label', 'hotspotLabel'],\n ['include-boundary', 'includeBoundary'],\n ['include-category', 'includeCategory'],\n ['include-lower-bound', 'includeLowerBound'],\n ['include-upper-bound', 'includeUpperBound'],\n ['keep-together', 'keepTogether'],\n ['long-interpretation', 'longInterpretation'],\n ['lower-bound', 'lowerBound'],\n ['map-key', 'mapKey'],\n ['mapped-value', 'mappedValue'],\n ['mapping-indicator', 'mappingIndicator'],\n ['mastery-value', 'masteryValue'],\n ['match-group', 'matchGroup'],\n ['match-max', 'matchMax'],\n ['match-min', 'matchMin'],\n ['math-variable', 'mathVariable'],\n ['max-associations', 'maxAssociations'],\n ['max-attempts', 'maxAttempts'],\n ['max-choices', 'maxChoices'],\n ['max-plays', 'maxPlays'],\n ['max-strings', 'maxStrings'],\n ['max-time', 'maxTime'],\n ['min-associations', 'minAssociations'],\n ['min-choices', 'minChoices'],\n ['min-plays', 'minPlays'],\n ['min-strings', 'minStrings'],\n ['min-time', 'minTime'],\n ['navigation-mode', 'navigationMode'],\n ['normal-maximum', 'normalMaximum'],\n ['normal-minimum', 'normalMinimum'],\n ['number-repeats', 'numberRepeats'],\n ['object-label', 'objectLabel'],\n ['outcome-identifier', 'outcomeIdentifier'],\n ['param-variable', 'paramVariable'],\n ['pattern-mask', 'patternMask'],\n ['placeholder-text', 'placeholderText'],\n ['power-form', 'powerForm'],\n ['response-identifier', 'responseIdentifier'],\n ['rounding-mode', 'roundingMode'],\n ['section-identifier', 'sectionIdentifier'],\n ['show-feedback', 'showFeedback'],\n ['show-hide', 'showHide'],\n ['show-solution', 'showSolution'],\n ['source-identifier', 'sourceIdentifier'],\n ['source-value', 'sourceValue'],\n ['step-label', 'stepLabel'],\n ['string-identifier', 'stringIdentifier'],\n ['submission-mode', 'submissionMode'],\n ['target-identifier', 'targetIdentifier'],\n ['target-type', 'targetType'],\n ['target-value', 'targetValue'],\n ['template-identifier', 'templateIdentifier'],\n ['template-location', 'templateLocation'],\n ['time-dependent', 'timeDependent'],\n ['tolerance-mode', 'toleranceMode'],\n ['tool-name', 'toolName'],\n ['tool-version', 'toolVersion'],\n ['upper-bound', 'upperBound'],\n ['validate-responses', 'validateResponses'],\n ['variable-identifier', 'variableIdentifier'],\n ['variable-identifier-ref', 'variableIdentifierRef'],\n ['weight-identifier', 'weightIdentifier'],\n ['with-replacement', 'withReplacement'],\n]);\n\n/**\n * QTI 2.2 interactions whose content model permits a `prompt` child (it must come first).\n * The inline interactions are deliberately absent: moving a prompt into one would trade one\n * schema violation for another.\n */\nexport const QTI2_PROMPT_BEARING_INTERACTIONS: ReadonlySet<string> = new Set([\n 'associateInteraction',\n 'choiceInteraction',\n 'drawingInteraction',\n 'extendedTextInteraction',\n 'gapMatchInteraction',\n 'graphicAssociateInteraction',\n 'graphicGapMatchInteraction',\n 'graphicOrderInteraction',\n 'hotspotInteraction',\n 'hottextInteraction',\n 'matchInteraction',\n 'mediaInteraction',\n 'orderInteraction',\n 'selectPointInteraction',\n 'sliderInteraction',\n 'uploadInteraction',\n]);\n"]}
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { Qti3ElementNameMapper } from './element-mapper/Qti3ElementNameMapper.js
4
4
  export type { AttributeNameMapper } from './element-mapper/AttributeNameMapper.js';
5
5
  export { Qti2xAttributeNameMapper } from './element-mapper/Qti2xAttributeNameMapper.js';
6
6
  export { Qti3AttributeNameMapper } from './element-mapper/Qti3AttributeNameMapper.js';
7
+ export { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2, } from './element-mapper/qti3-attribute-map.js';
7
8
  export { detectQtiVersion } from './version-detection/detectQtiVersion.js';
8
9
  export type { QtiVersion } from './version-detection/detectQtiVersion.js';
9
10
  export { getAttribute, getBooleanAttribute, getNumberAttribute, hasAttribute, toCamelCase, toKebabCase, } from './xml/attributes.js';
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export { Qti2xElementNameMapper } from './element-mapper/Qti2xElementNameMapper.
2
2
  export { Qti3ElementNameMapper } from './element-mapper/Qti3ElementNameMapper.js';
3
3
  export { Qti2xAttributeNameMapper } from './element-mapper/Qti2xAttributeNameMapper.js';
4
4
  export { Qti3AttributeNameMapper } from './element-mapper/Qti3AttributeNameMapper.js';
5
+ export { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2, } from './element-mapper/qti3-attribute-map.js';
5
6
  // Version detection
6
7
  export { detectQtiVersion } from './version-detection/detectQtiVersion.js';
7
8
  // XML attribute utilities
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAIlF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,oBAAoB;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3E,0BAA0B;AAC1B,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,GACX,MAAM,qBAAqB,CAAC;AAE7B,oDAAoD;AACpD,OAAO,EAAE,WAAW,EAA2B,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACN,2BAA2B,GAG3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,iBAAiB;AACjB,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,+BAA+B,EAC/B,MAAM,EACN,MAAM,GAGN,MAAM,qBAAqB,CAAC","sourcesContent":["// Element name mapping\nexport type { ElementNameMapper } from './element-mapper/ElementNameMapper.js';\nexport { Qti2xElementNameMapper } from './element-mapper/Qti2xElementNameMapper.js';\nexport { Qti3ElementNameMapper } from './element-mapper/Qti3ElementNameMapper.js';\n\n// Attribute name mapping\nexport type { AttributeNameMapper } from './element-mapper/AttributeNameMapper.js';\nexport { Qti2xAttributeNameMapper } from './element-mapper/Qti2xAttributeNameMapper.js';\nexport { Qti3AttributeNameMapper } from './element-mapper/Qti3AttributeNameMapper.js';\n\n// Version detection\nexport { detectQtiVersion } from './version-detection/detectQtiVersion.js';\nexport type { QtiVersion } from './version-detection/detectQtiVersion.js';\n\n// XML attribute utilities\nexport {\n\tgetAttribute,\n\tgetBooleanAttribute,\n\tgetNumberAttribute,\n\thasAttribute,\n\ttoCamelCase,\n\ttoKebabCase,\n} from './xml/attributes.js';\n\n// DOM utility helpers shared across player packages\nexport { assignProps, type AssignPropsOptions } from './dom/assignProps.js';\nexport {\n\tcreateSvelteMountController,\n\ttype SvelteMountController,\n\ttype SvelteMountControllerOptions,\n} from './dom/svelteMountController.js';\nexport { touchDrag, touchDragStyles } from './dom/touchDrag.js';\n\n// Parser factory\nexport {\n\tcreateQtiParser,\n\tcreateMapperForVersion,\n\tcreateAttributeMapperForVersion,\n\tisQti2,\n\tisQti3,\n\ttype QtiParserResult,\n\ttype CreateParserOptions,\n} from './parser-factory.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAIlF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EACN,gCAAgC,EAChC,sBAAsB,GACtB,MAAM,wCAAwC,CAAC;AAEhD,oBAAoB;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3E,0BAA0B;AAC1B,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,GACX,MAAM,qBAAqB,CAAC;AAE7B,oDAAoD;AACpD,OAAO,EAAE,WAAW,EAA2B,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACN,2BAA2B,GAG3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,iBAAiB;AACjB,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,+BAA+B,EAC/B,MAAM,EACN,MAAM,GAGN,MAAM,qBAAqB,CAAC","sourcesContent":["// Element name mapping\nexport type { ElementNameMapper } from './element-mapper/ElementNameMapper.js';\nexport { Qti2xElementNameMapper } from './element-mapper/Qti2xElementNameMapper.js';\nexport { Qti3ElementNameMapper } from './element-mapper/Qti3ElementNameMapper.js';\n\n// Attribute name mapping\nexport type { AttributeNameMapper } from './element-mapper/AttributeNameMapper.js';\nexport { Qti2xAttributeNameMapper } from './element-mapper/Qti2xAttributeNameMapper.js';\nexport { Qti3AttributeNameMapper } from './element-mapper/Qti3AttributeNameMapper.js';\nexport {\n\tQTI2_PROMPT_BEARING_INTERACTIONS,\n\tQTI3_ATTRIBUTE_TO_QTI2,\n} from './element-mapper/qti3-attribute-map.js';\n\n// Version detection\nexport { detectQtiVersion } from './version-detection/detectQtiVersion.js';\nexport type { QtiVersion } from './version-detection/detectQtiVersion.js';\n\n// XML attribute utilities\nexport {\n\tgetAttribute,\n\tgetBooleanAttribute,\n\tgetNumberAttribute,\n\thasAttribute,\n\ttoCamelCase,\n\ttoKebabCase,\n} from './xml/attributes.js';\n\n// DOM utility helpers shared across player packages\nexport { assignProps, type AssignPropsOptions } from './dom/assignProps.js';\nexport {\n\tcreateSvelteMountController,\n\ttype SvelteMountController,\n\ttype SvelteMountControllerOptions,\n} from './dom/svelteMountController.js';\nexport { touchDrag, touchDragStyles } from './dom/touchDrag.js';\n\n// Parser factory\nexport {\n\tcreateQtiParser,\n\tcreateMapperForVersion,\n\tcreateAttributeMapperForVersion,\n\tisQti2,\n\tisQti3,\n\ttype QtiParserResult,\n\ttype CreateParserOptions,\n} from './parser-factory.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-qti/qti-common",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "main": "./dist/index.js",
5
5
  "devDependencies": {
6
6
  "@types/bun": "^1.4.2",