@pie-qti/qti-common 1.0.0-beta.0 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/accessibility/apip.d.ts +66 -0
  2. package/dist/accessibility/apip.js +576 -0
  3. package/dist/accessibility/apip.js.map +1 -0
  4. package/dist/accessibility/catalog-info.d.ts +17 -0
  5. package/dist/accessibility/catalog-info.js +60 -0
  6. package/dist/accessibility/catalog-info.js.map +1 -0
  7. package/dist/accessibility/catalog.d.ts +53 -0
  8. package/dist/accessibility/catalog.js +68 -0
  9. package/dist/accessibility/catalog.js.map +1 -0
  10. package/dist/accessibility/index.d.ts +4 -0
  11. package/dist/accessibility/index.js +5 -0
  12. package/dist/accessibility/index.js.map +1 -0
  13. package/dist/accessibility/markup.d.ts +61 -0
  14. package/dist/accessibility/markup.js +484 -0
  15. package/dist/accessibility/markup.js.map +1 -0
  16. package/dist/dom/assignProps.d.ts +4 -0
  17. package/dist/dom/assignProps.js +9 -0
  18. package/dist/dom/assignProps.js.map +1 -0
  19. package/dist/dom/svelteMountController.d.ts +25 -0
  20. package/dist/dom/svelteMountController.js +131 -0
  21. package/dist/dom/svelteMountController.js.map +1 -0
  22. package/dist/dom/touchDrag.d.ts +10 -0
  23. package/dist/dom/touchDrag.js +141 -0
  24. package/dist/dom/touchDrag.js.map +1 -0
  25. package/dist/element-mapper/AttributeNameMapper.d.ts +66 -0
  26. package/dist/element-mapper/AttributeNameMapper.js +2 -0
  27. package/dist/element-mapper/AttributeNameMapper.js.map +1 -0
  28. package/dist/element-mapper/ElementNameMapper.d.ts +66 -0
  29. package/dist/element-mapper/ElementNameMapper.js +2 -0
  30. package/dist/element-mapper/ElementNameMapper.js.map +1 -0
  31. package/dist/element-mapper/Qti2xAttributeNameMapper.d.ts +27 -0
  32. package/dist/element-mapper/Qti2xAttributeNameMapper.js +38 -0
  33. package/dist/element-mapper/Qti2xAttributeNameMapper.js.map +1 -0
  34. package/dist/element-mapper/Qti2xElementNameMapper.d.ts +37 -0
  35. package/dist/element-mapper/Qti2xElementNameMapper.js +47 -0
  36. package/dist/element-mapper/Qti2xElementNameMapper.js.map +1 -0
  37. package/dist/element-mapper/Qti3AttributeNameMapper.d.ts +40 -0
  38. package/dist/element-mapper/Qti3AttributeNameMapper.js +87 -0
  39. package/dist/element-mapper/Qti3AttributeNameMapper.js.map +1 -0
  40. package/dist/element-mapper/Qti3ElementNameMapper.d.ts +14 -0
  41. package/dist/element-mapper/Qti3ElementNameMapper.js +39 -0
  42. package/dist/element-mapper/Qti3ElementNameMapper.js.map +1 -0
  43. package/dist/element-mapper/index.d.ts +8 -0
  44. package/dist/element-mapper/index.js +7 -0
  45. package/dist/element-mapper/index.js.map +1 -0
  46. package/dist/element-mapper/qti2-to-qti3.d.ts +36 -0
  47. package/dist/element-mapper/qti2-to-qti3.js +228 -0
  48. package/dist/element-mapper/qti2-to-qti3.js.map +1 -0
  49. package/dist/element-mapper/qti3-attribute-map.d.ts +8 -0
  50. package/dist/element-mapper/qti3-attribute-map.js +115 -0
  51. package/dist/element-mapper/qti3-attribute-map.js.map +1 -0
  52. package/dist/element-mapper/qti3-element-mappings.d.ts +538 -0
  53. package/dist/element-mapper/qti3-element-mappings.js +381 -0
  54. package/dist/element-mapper/qti3-element-mappings.js.map +1 -0
  55. package/dist/feedback/visibility.d.ts +12 -0
  56. package/dist/feedback/visibility.js +22 -0
  57. package/dist/feedback/visibility.js.map +1 -0
  58. package/dist/index.d.ts +17 -0
  59. package/dist/index.js +21 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/language/direction.d.ts +10 -0
  62. package/dist/language/direction.js +42 -0
  63. package/dist/language/direction.js.map +1 -0
  64. package/dist/parser-factory.d.ts +137 -0
  65. package/dist/parser-factory.js +146 -0
  66. package/dist/parser-factory.js.map +1 -0
  67. package/dist/version-detection/detectQtiVersion.d.ts +23 -0
  68. package/dist/version-detection/detectQtiVersion.js +129 -0
  69. package/dist/version-detection/detectQtiVersion.js.map +1 -0
  70. package/dist/version-detection/index.d.ts +2 -0
  71. package/dist/version-detection/index.js +2 -0
  72. package/dist/version-detection/index.js.map +1 -0
  73. package/dist/xml/attributes.d.ts +77 -0
  74. package/dist/xml/attributes.js +120 -0
  75. package/dist/xml/attributes.js.map +1 -0
  76. package/package.json +2 -2
@@ -0,0 +1,381 @@
1
+ /**
2
+ * QTI 3.0 element name mappings: every `qti-*` element of the 1EdTech QTI 3.0 ASI schema,
3
+ * mapped to its lowercase canonical name. `qti3-xsd-conformance.test.ts` checks the map
4
+ * against the schema vendored in `schemas/qti3/`, in both directions.
5
+ *
6
+ * XHTML and HTML5 content elements keep their unprefixed names in QTI 3 and are not listed.
7
+ */
8
+ /**
9
+ * Core assessment structure elements
10
+ */
11
+ export const CORE_ELEMENTS = {
12
+ 'qti-assessment-item': 'assessmentitem',
13
+ 'qti-assessment-test': 'assessmenttest',
14
+ 'qti-item-body': 'itembody',
15
+ 'qti-content-body': 'contentbody',
16
+ 'qti-test-part': 'testpart',
17
+ 'qti-assessment-section': 'assessmentsection',
18
+ 'qti-assessment-item-ref': 'assessmentitemref',
19
+ 'qti-assessment-stimulus-ref': 'assessmentstimulusref',
20
+ };
21
+ /**
22
+ * Test structure elements
23
+ */
24
+ export const TEST_STRUCTURE_ELEMENTS = {
25
+ 'qti-assessment-section-ref': 'assessmentsectionref',
26
+ 'qti-item-session-control': 'itemsessioncontrol',
27
+ 'qti-time-limits': 'timelimits',
28
+ 'qti-selection': 'selection',
29
+ 'qti-ordering': 'ordering',
30
+ 'qti-branch-rule': 'branchrule',
31
+ 'qti-pre-condition': 'precondition',
32
+ 'qti-test-feedback': 'testfeedback',
33
+ 'qti-template-default': 'templatedefault',
34
+ 'qti-variable-mapping': 'variablemapping',
35
+ 'qti-weight': 'weight',
36
+ 'qti-outcome-processing-fragment': 'outcomeprocessingfragment',
37
+ };
38
+ /**
39
+ * Shared stimulus elements
40
+ */
41
+ export const STIMULUS_ELEMENTS = {
42
+ 'qti-assessment-stimulus': 'assessmentstimulus',
43
+ 'qti-stimulus-body': 'stimulusbody',
44
+ };
45
+ /**
46
+ * Variable declaration elements
47
+ */
48
+ export const DECLARATION_ELEMENTS = {
49
+ 'qti-response-declaration': 'responsedeclaration',
50
+ 'qti-outcome-declaration': 'outcomedeclaration',
51
+ 'qti-template-declaration': 'templatedeclaration',
52
+ 'qti-context-declaration': 'contextdeclaration',
53
+ 'qti-correct-response': 'correctresponse',
54
+ 'qti-default-value': 'defaultvalue',
55
+ 'qti-value': 'value',
56
+ 'qti-mapping': 'mapping',
57
+ 'qti-map-entry': 'mapentry',
58
+ 'qti-area-mapping': 'areamapping',
59
+ 'qti-area-map-entry': 'areamapentry',
60
+ 'qti-match-table': 'matchtable',
61
+ 'qti-match-table-entry': 'matchtableentry',
62
+ 'qti-interpolation-table': 'interpolationtable',
63
+ 'qti-interpolation-table-entry': 'interpolationtableentry',
64
+ };
65
+ /**
66
+ * All 23+ interaction types (block and inline)
67
+ */
68
+ export const INTERACTION_ELEMENTS = {
69
+ // Block interactions
70
+ 'qti-choice-interaction': 'choiceinteraction',
71
+ 'qti-match-interaction': 'matchinteraction',
72
+ 'qti-order-interaction': 'orderinteraction',
73
+ 'qti-gap-match-interaction': 'gapmatchinteraction',
74
+ 'qti-graphic-gap-match-interaction': 'graphicgapmatchinteraction',
75
+ 'qti-hotspot-interaction': 'hotspotinteraction',
76
+ 'qti-hottext-interaction': 'hottextinteraction',
77
+ 'qti-extended-text-interaction': 'extendedtextinteraction',
78
+ 'qti-media-interaction': 'mediainteraction',
79
+ 'qti-select-point-interaction': 'selectpointinteraction',
80
+ 'qti-custom-interaction': 'custominteraction',
81
+ 'qti-portable-custom-interaction': 'portablecustominteraction',
82
+ 'qti-end-attempt-interaction': 'endattemptinteraction',
83
+ 'qti-slider-interaction': 'sliderinteraction',
84
+ 'qti-drawing-interaction': 'drawinginteraction',
85
+ 'qti-upload-interaction': 'uploadinteraction',
86
+ 'qti-position-object-interaction': 'positionobjectinteraction',
87
+ 'qti-graphic-order-interaction': 'graphicorderinteraction',
88
+ 'qti-graphic-associate-interaction': 'graphicassociateinteraction',
89
+ 'qti-associate-interaction': 'associateinteraction',
90
+ // Inline interactions
91
+ 'qti-text-entry-interaction': 'textentryinteraction',
92
+ 'qti-inline-choice-interaction': 'inlinechoiceinteraction',
93
+ };
94
+ /**
95
+ * Interaction child elements
96
+ */
97
+ export const INTERACTION_CHILD_ELEMENTS = {
98
+ 'qti-prompt': 'prompt',
99
+ 'qti-simple-choice': 'simplechoice',
100
+ 'qti-simple-match-set': 'simplematchset',
101
+ 'qti-simple-associable-choice': 'simpleassociablechoice',
102
+ 'qti-gap': 'gap',
103
+ 'qti-gap-text': 'gaptext',
104
+ 'qti-gap-img': 'gapimg',
105
+ 'qti-hotspot-choice': 'hotspotchoice',
106
+ 'qti-associable-hotspot': 'associablehotspot',
107
+ 'qti-hottext': 'hottext',
108
+ 'qti-inline-choice': 'inlinechoice',
109
+ 'qti-position-object-stage': 'positionobjectstage',
110
+ };
111
+ /**
112
+ * Response processing elements
113
+ */
114
+ export const RESPONSE_PROCESSING_ELEMENTS = {
115
+ 'qti-response-processing': 'responseprocessing',
116
+ 'qti-response-condition': 'responsecondition',
117
+ 'qti-response-if': 'responseif',
118
+ 'qti-response-else-if': 'responseelseif',
119
+ 'qti-response-else': 'responseelse',
120
+ 'qti-response-processing-fragment': 'responseprocessingfragment',
121
+ 'qti-exit-response': 'exitresponse',
122
+ 'qti-set-outcome-value': 'setoutcomevalue',
123
+ 'qti-lookup-outcome-value': 'lookupoutcomevalue',
124
+ 'qti-set-correct-response': 'setcorrectresponse',
125
+ 'qti-set-default-value': 'setdefaultvalue',
126
+ };
127
+ /**
128
+ * Template processing elements
129
+ */
130
+ export const TEMPLATE_PROCESSING_ELEMENTS = {
131
+ 'qti-template-processing': 'templateprocessing',
132
+ 'qti-template-condition': 'templatecondition',
133
+ 'qti-template-if': 'templateif',
134
+ 'qti-template-else-if': 'templateelseif',
135
+ 'qti-template-else': 'templateelse',
136
+ 'qti-template-constraint': 'templateconstraint',
137
+ 'qti-set-template-value': 'settemplatevalue',
138
+ 'qti-exit-template': 'exittemplate',
139
+ 'qti-template-block': 'templateblock',
140
+ 'qti-template-inline': 'templateinline',
141
+ };
142
+ /**
143
+ * Outcome processing elements (test-level)
144
+ */
145
+ export const OUTCOME_PROCESSING_ELEMENTS = {
146
+ 'qti-outcome-processing': 'outcomeprocessing',
147
+ 'qti-outcome-condition': 'outcomecondition',
148
+ 'qti-outcome-if': 'outcomeif',
149
+ 'qti-outcome-else-if': 'outcomeelseif',
150
+ 'qti-outcome-else': 'outcomeelse',
151
+ 'qti-exit-test': 'exittest',
152
+ };
153
+ /**
154
+ * Expression elements (54+ operators)
155
+ */
156
+ export const EXPRESSION_ELEMENTS = {
157
+ // Variable expressions
158
+ 'qti-variable': 'variable',
159
+ 'qti-correct': 'correct',
160
+ 'qti-default': 'default',
161
+ 'qti-base-value': 'basevalue',
162
+ 'qti-field-value': 'fieldvalue',
163
+ 'qti-custom-operator': 'customoperator',
164
+ 'qti-index': 'index',
165
+ 'qti-contains': 'contains',
166
+ 'qti-member': 'member',
167
+ 'qti-null': 'null',
168
+ // Comparison operators
169
+ 'qti-equal': 'equal',
170
+ 'qti-equal-rounded': 'equalrounded',
171
+ 'qti-gt': 'gt',
172
+ 'qti-gte': 'gte',
173
+ 'qti-lt': 'lt',
174
+ 'qti-lte': 'lte',
175
+ // Logical operators
176
+ 'qti-and': 'and',
177
+ 'qti-or': 'or',
178
+ 'qti-not': 'not',
179
+ 'qti-any-n': 'anyn',
180
+ 'qti-multiple': 'multiple',
181
+ 'qti-ordered': 'ordered',
182
+ // String operators
183
+ 'qti-string-match': 'stringmatch',
184
+ 'qti-pattern-match': 'patternmatch',
185
+ 'qti-substring': 'substring',
186
+ 'qti-repeat': 'repeat',
187
+ // Matching operators
188
+ 'qti-match': 'match',
189
+ 'qti-inside': 'inside',
190
+ 'qti-map-response': 'mapresponse',
191
+ 'qti-map-response-point': 'mapresponsepoint',
192
+ // Numeric operators
193
+ 'qti-sum': 'sum',
194
+ 'qti-product': 'product',
195
+ 'qti-subtract': 'subtract',
196
+ 'qti-divide': 'divide',
197
+ 'qti-integer-divide': 'integerdivide',
198
+ 'qti-integer-modulus': 'integermodulus',
199
+ 'qti-round': 'round',
200
+ 'qti-round-to': 'roundto',
201
+ 'qti-truncate': 'truncate',
202
+ // Math functions
203
+ 'qti-math-operator': 'mathoperator',
204
+ 'qti-math-constant': 'mathconstant',
205
+ 'qti-power': 'power',
206
+ 'qti-gcd': 'gcd',
207
+ 'qti-lcm': 'lcm',
208
+ // Statistical operators
209
+ 'qti-stats-operator': 'statsoperator',
210
+ 'qti-min': 'min',
211
+ 'qti-max': 'max',
212
+ 'qti-container-size': 'containersize',
213
+ 'qti-delete': 'delete',
214
+ 'qti-is-null': 'isnull',
215
+ 'qti-random': 'random',
216
+ 'qti-random-integer': 'randominteger',
217
+ 'qti-random-float': 'randomfloat',
218
+ // Test-level expressions
219
+ 'qti-test-variables': 'testvariables',
220
+ 'qti-outcome-maximum': 'outcomemaximum',
221
+ 'qti-outcome-minimum': 'outcomeminimum',
222
+ 'qti-number-correct': 'numbercorrect',
223
+ 'qti-number-incorrect': 'numberincorrect',
224
+ 'qti-number-presented': 'numberpresented',
225
+ 'qti-number-responded': 'numberresponded',
226
+ 'qti-number-selected': 'numberselected',
227
+ // Type conversion
228
+ 'qti-integer-to-float': 'integertofloat',
229
+ // Duration operators (QTI 2 durationGTE and durationLT)
230
+ 'qti-duration-gte': 'durationgte',
231
+ 'qti-duration-lt': 'durationlt',
232
+ };
233
+ /**
234
+ * Feedback elements
235
+ */
236
+ export const FEEDBACK_ELEMENTS = {
237
+ 'qti-modal-feedback': 'modalfeedback',
238
+ 'qti-feedback-block': 'feedbackblock',
239
+ 'qti-feedback-inline': 'feedbackinline',
240
+ 'qti-rubric-block': 'rubricblock',
241
+ };
242
+ /**
243
+ * PCI (Portable Custom Interaction) elements
244
+ */
245
+ export const PCI_ELEMENTS = {
246
+ 'qti-interaction-modules': 'interactionmodules',
247
+ 'qti-interaction-module': 'interactionmodule',
248
+ 'qti-interaction-markup': 'interactionmarkup',
249
+ };
250
+ /**
251
+ * Catalog elements (accessibility support)
252
+ */
253
+ export const CATALOG_ELEMENTS = {
254
+ 'qti-catalog': 'catalog',
255
+ 'qti-catalog-info': 'cataloginfo',
256
+ 'qti-card': 'card',
257
+ 'qti-card-entry': 'cardentry',
258
+ 'qti-html-content': 'htmlcontent',
259
+ 'qti-file-href': 'filehref',
260
+ };
261
+ /**
262
+ * Other content elements
263
+ */
264
+ export const CONTENT_ELEMENTS = {
265
+ 'qti-printed-variable': 'printedvariable',
266
+ 'qti-context-variable': 'contextvariable',
267
+ 'qti-template-variable': 'templatevariable',
268
+ 'qti-stylesheet': 'stylesheet',
269
+ };
270
+ /**
271
+ * Companion materials (calculators, rulers, protractors, reference material)
272
+ */
273
+ export const COMPANION_MATERIAL_ELEMENTS = {
274
+ 'qti-companion-materials-info': 'companionmaterialsinfo',
275
+ 'qti-calculator': 'calculator',
276
+ 'qti-calculator-info': 'calculatorinfo',
277
+ 'qti-calculator-type': 'calculatortype',
278
+ 'qti-description': 'description',
279
+ 'qti-digital-material': 'digitalmaterial',
280
+ 'qti-physical-material': 'physicalmaterial',
281
+ 'qti-label': 'label',
282
+ 'qti-protractor': 'protractor',
283
+ 'qti-rule': 'rule',
284
+ 'qti-rule-system-si': 'rulesystemsi',
285
+ 'qti-rule-system-us': 'rulesystemus',
286
+ 'qti-increment-si': 'incrementsi',
287
+ 'qti-increment-us': 'incrementus',
288
+ 'qti-major-increment': 'majorincrement',
289
+ 'qti-minor-increment': 'minorincrement',
290
+ 'qti-minimum-length': 'minimumlength',
291
+ };
292
+ /**
293
+ * Adaptive delivery and metadata references
294
+ */
295
+ export const REFERENCE_ELEMENTS = {
296
+ 'qti-adaptive-selection': 'adaptiveselection',
297
+ 'qti-adaptive-engine-ref': 'adaptiveengineref',
298
+ 'qti-adaptive-settings-ref': 'adaptivesettingsref',
299
+ 'qti-metadata-ref': 'metadataref',
300
+ 'qti-usagedata-ref': 'usagedataref',
301
+ 'qti-resource-icon': 'resourceicon',
302
+ };
303
+ /**
304
+ * Complete mapping of all QTI 3.0 elements to canonical form
305
+ */
306
+ export const QTI3_ELEMENT_MAPPINGS = {
307
+ ...CORE_ELEMENTS,
308
+ ...TEST_STRUCTURE_ELEMENTS,
309
+ ...STIMULUS_ELEMENTS,
310
+ ...DECLARATION_ELEMENTS,
311
+ ...INTERACTION_ELEMENTS,
312
+ ...INTERACTION_CHILD_ELEMENTS,
313
+ ...RESPONSE_PROCESSING_ELEMENTS,
314
+ ...TEMPLATE_PROCESSING_ELEMENTS,
315
+ ...OUTCOME_PROCESSING_ELEMENTS,
316
+ ...EXPRESSION_ELEMENTS,
317
+ ...FEEDBACK_ELEMENTS,
318
+ ...PCI_ELEMENTS,
319
+ ...CATALOG_ELEMENTS,
320
+ ...CONTENT_ELEMENTS,
321
+ ...COMPANION_MATERIAL_ELEMENTS,
322
+ ...REFERENCE_ELEMENTS,
323
+ };
324
+ /**
325
+ * Get canonical name for a QTI 3.0 element
326
+ */
327
+ export function getCanonicalName(qti3ElementName) {
328
+ return QTI3_ELEMENT_MAPPINGS[qti3ElementName];
329
+ }
330
+ /**
331
+ * Check if an element name is a valid QTI 3.0 element
332
+ */
333
+ export function isQti3Element(elementName) {
334
+ return elementName in QTI3_ELEMENT_MAPPINGS;
335
+ }
336
+ /**
337
+ * Get all QTI 3.0 interaction element names
338
+ */
339
+ export function getInteractionElements() {
340
+ return Object.keys(INTERACTION_ELEMENTS);
341
+ }
342
+ /**
343
+ * Common QTI 3.0 attribute names (kebab-case)
344
+ */
345
+ export const QTI3_ATTRIBUTES = {
346
+ // Identifiers
347
+ identifier: 'identifier',
348
+ responseIdentifier: 'response-identifier',
349
+ outcomeIdentifier: 'outcome-identifier',
350
+ templateIdentifier: 'template-identifier',
351
+ // Types
352
+ baseType: 'base-type',
353
+ cardinality: 'cardinality',
354
+ // Interaction attributes
355
+ minChoices: 'min-choices',
356
+ maxChoices: 'max-choices',
357
+ shuffle: 'shuffle',
358
+ fixed: 'fixed',
359
+ // Feedback attributes
360
+ showHide: 'show-hide',
361
+ // Outcome attributes
362
+ normalMaximum: 'normal-maximum',
363
+ normalMinimum: 'normal-minimum',
364
+ // Template attributes
365
+ mathVariable: 'math-variable',
366
+ paramVariable: 'param-variable',
367
+ // Assessment attributes
368
+ timeDependent: 'time-dependent',
369
+ adaptive: 'adaptive',
370
+ // Text interaction attributes
371
+ expectedLength: 'expected-length',
372
+ patternMask: 'pattern-mask',
373
+ placeholderText: 'placeholder-text',
374
+ minStrings: 'min-strings',
375
+ maxStrings: 'max-strings',
376
+ // Other
377
+ fieldIdentifier: 'field-identifier',
378
+ toleranceMode: 'tolerance-mode',
379
+ dataCatalogIdref: 'data-catalog-idref', // AMP extension
380
+ };
381
+ //# sourceMappingURL=qti3-element-mappings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti3-element-mappings.js","sourceRoot":"","sources":["../../src/element-mapper/qti3-element-mappings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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,uBAAuB,GAAG;IACtC,4BAA4B,EAAE,sBAAsB;IACpD,0BAA0B,EAAE,oBAAoB;IAChD,iBAAiB,EAAE,YAAY;IAC/B,eAAe,EAAE,WAAW;IAC5B,cAAc,EAAE,UAAU;IAC1B,iBAA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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 * QTI 3.0 element name mappings: every `qti-*` element of the 1EdTech QTI 3.0 ASI schema,\n * mapped to its lowercase canonical name. `qti3-xsd-conformance.test.ts` checks the map\n * against the schema vendored in `schemas/qti3/`, in both directions.\n *\n * XHTML and HTML5 content elements keep their unprefixed names in QTI 3 and are not listed.\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 * Test structure elements\n */\nexport const TEST_STRUCTURE_ELEMENTS = {\n\t'qti-assessment-section-ref': 'assessmentsectionref',\n\t'qti-item-session-control': 'itemsessioncontrol',\n\t'qti-time-limits': 'timelimits',\n\t'qti-selection': 'selection',\n\t'qti-ordering': 'ordering',\n\t'qti-branch-rule': 'branchrule',\n\t'qti-pre-condition': 'precondition',\n\t'qti-test-feedback': 'testfeedback',\n\t'qti-template-default': 'templatedefault',\n\t'qti-variable-mapping': 'variablemapping',\n\t'qti-weight': 'weight',\n\t'qti-outcome-processing-fragment': 'outcomeprocessingfragment',\n} as const;\n\n/**\n * Shared stimulus elements\n */\nexport const STIMULUS_ELEMENTS = {\n\t'qti-assessment-stimulus': 'assessmentstimulus',\n\t'qti-stimulus-body': 'stimulusbody',\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-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// Type conversion\n\t'qti-integer-to-float': 'integertofloat',\n\n\t// Duration operators (QTI 2 durationGTE and durationLT)\n\t'qti-duration-gte': 'durationgte',\n\t'qti-duration-lt': 'durationlt',\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} 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} 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} as const;\n\n/**\n * Companion materials (calculators, rulers, protractors, reference material)\n */\nexport const COMPANION_MATERIAL_ELEMENTS = {\n\t'qti-companion-materials-info': 'companionmaterialsinfo',\n\t'qti-calculator': 'calculator',\n\t'qti-calculator-info': 'calculatorinfo',\n\t'qti-calculator-type': 'calculatortype',\n\t'qti-description': 'description',\n\t'qti-digital-material': 'digitalmaterial',\n\t'qti-physical-material': 'physicalmaterial',\n\t'qti-label': 'label',\n\t'qti-protractor': 'protractor',\n\t'qti-rule': 'rule',\n\t'qti-rule-system-si': 'rulesystemsi',\n\t'qti-rule-system-us': 'rulesystemus',\n\t'qti-increment-si': 'incrementsi',\n\t'qti-increment-us': 'incrementus',\n\t'qti-major-increment': 'majorincrement',\n\t'qti-minor-increment': 'minorincrement',\n\t'qti-minimum-length': 'minimumlength',\n} as const;\n\n/**\n * Adaptive delivery and metadata references\n */\nexport const REFERENCE_ELEMENTS = {\n\t'qti-adaptive-selection': 'adaptiveselection',\n\t'qti-adaptive-engine-ref': 'adaptiveengineref',\n\t'qti-adaptive-settings-ref': 'adaptivesettingsref',\n\t'qti-metadata-ref': 'metadataref',\n\t'qti-usagedata-ref': 'usagedataref',\n\t'qti-resource-icon': 'resourceicon',\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...TEST_STRUCTURE_ELEMENTS,\n\t...STIMULUS_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\t...COMPANION_MATERIAL_ELEMENTS,\n\t...REFERENCE_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"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Feedback and template visibility
3
+ *
4
+ * A feedback or template element names a variable and an `identifier`. The identifier matches a
5
+ * single value by equality and a container by membership; NULL matches nothing. `showHide="show"`
6
+ * (the default) shows the element on a match, `showHide="hide"` shows it unless there is one.
7
+ * Item feedback, modal feedback, test feedback and template content all use this rule.
8
+ */
9
+ /** Whether `identifier` matches `value`, the plain value of the variable the element names. */
10
+ export declare function matchesIdentifier(value: unknown, identifier: string): boolean;
11
+ /** Whether an element with this `identifier` and `showHide` is shown for `value`. */
12
+ export declare function isShownByIdentifier(value: unknown, identifier: string, showHide?: string | null): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Feedback and template visibility
3
+ *
4
+ * A feedback or template element names a variable and an `identifier`. The identifier matches a
5
+ * single value by equality and a container by membership; NULL matches nothing. `showHide="show"`
6
+ * (the default) shows the element on a match, `showHide="hide"` shows it unless there is one.
7
+ * Item feedback, modal feedback, test feedback and template content all use this rule.
8
+ */
9
+ /** Whether `identifier` matches `value`, the plain value of the variable the element names. */
10
+ export function matchesIdentifier(value, identifier) {
11
+ if (Array.isArray(value))
12
+ return value.some((item) => item !== null && String(item) === identifier);
13
+ if (value === null || value === undefined || value === '')
14
+ return false;
15
+ return String(value) === identifier;
16
+ }
17
+ /** Whether an element with this `identifier` and `showHide` is shown for `value`. */
18
+ export function isShownByIdentifier(value, identifier, showHide) {
19
+ const matched = matchesIdentifier(value, identifier);
20
+ return showHide?.trim().toLowerCase() === 'hide' ? !matched : matched;
21
+ }
22
+ //# sourceMappingURL=visibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.js","sourceRoot":"","sources":["../../src/feedback/visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,+FAA+F;AAC/F,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,UAAkB;IACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;IACpG,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IACxE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAE,UAAkB,EAAE,QAAwB;IAC/F,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACrD,OAAO,QAAQ,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC","sourcesContent":["/**\n * Feedback and template visibility\n *\n * A feedback or template element names a variable and an `identifier`. The identifier matches a\n * single value by equality and a container by membership; NULL matches nothing. `showHide=\"show\"`\n * (the default) shows the element on a match, `showHide=\"hide\"` shows it unless there is one.\n * Item feedback, modal feedback, test feedback and template content all use this rule.\n */\n\n/** Whether `identifier` matches `value`, the plain value of the variable the element names. */\nexport function matchesIdentifier(value: unknown, identifier: string): boolean {\n\tif (Array.isArray(value)) return value.some((item) => item !== null && String(item) === identifier);\n\tif (value === null || value === undefined || value === '') return false;\n\treturn String(value) === identifier;\n}\n\n/** Whether an element with this `identifier` and `showHide` is shown for `value`. */\nexport function isShownByIdentifier(value: unknown, identifier: string, showHide?: string | null): boolean {\n\tconst matched = matchesIdentifier(value, identifier);\n\treturn showHide?.trim().toLowerCase() === 'hide' ? !matched : matched;\n}\n"]}
@@ -0,0 +1,17 @@
1
+ export type { ElementNameMapper } from './element-mapper/ElementNameMapper.js';
2
+ export { Qti2xElementNameMapper } from './element-mapper/Qti2xElementNameMapper.js';
3
+ export { Qti3ElementNameMapper } from './element-mapper/Qti3ElementNameMapper.js';
4
+ export type { AttributeNameMapper } from './element-mapper/AttributeNameMapper.js';
5
+ export { Qti2xAttributeNameMapper } from './element-mapper/Qti2xAttributeNameMapper.js';
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';
8
+ export { convertQti2ToQti3, QTI3_ASI_SCHEMA_LOCATION, QTI3_NAMESPACE, QTI3_RPTEMPLATE_BASE, } from './element-mapper/qti2-to-qti3.js';
9
+ export { isShownByIdentifier, matchesIdentifier } from './feedback/visibility.js';
10
+ export { detectQtiVersion } from './version-detection/detectQtiVersion.js';
11
+ export type { QtiVersion } from './version-detection/detectQtiVersion.js';
12
+ export { getAttribute, getBooleanAttribute, getNumberAttribute, hasAttribute, toCamelCase, toKebabCase, } from './xml/attributes.js';
13
+ export { assignProps, type AssignPropsOptions } from './dom/assignProps.js';
14
+ export { createSvelteMountController, type SvelteMountController, type SvelteMountControllerOptions, } from './dom/svelteMountController.js';
15
+ export { touchDrag, touchDragStyles } from './dom/touchDrag.js';
16
+ export { languageDirection, type TextDirection } from './language/direction.js';
17
+ export { createQtiParser, createMapperForVersion, createAttributeMapperForVersion, isQti2, isQti3, type QtiParserResult, type CreateParserOptions, } from './parser-factory.js';
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ export { Qti2xElementNameMapper } from './element-mapper/Qti2xElementNameMapper.js';
2
+ export { Qti3ElementNameMapper } from './element-mapper/Qti3ElementNameMapper.js';
3
+ export { Qti2xAttributeNameMapper } from './element-mapper/Qti2xAttributeNameMapper.js';
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';
6
+ export { convertQti2ToQti3, QTI3_ASI_SCHEMA_LOCATION, QTI3_NAMESPACE, QTI3_RPTEMPLATE_BASE, } from './element-mapper/qti2-to-qti3.js';
7
+ // Feedback and template visibility
8
+ export { isShownByIdentifier, matchesIdentifier } from './feedback/visibility.js';
9
+ // Version detection
10
+ export { detectQtiVersion } from './version-detection/detectQtiVersion.js';
11
+ // XML attribute utilities
12
+ export { getAttribute, getBooleanAttribute, getNumberAttribute, hasAttribute, toCamelCase, toKebabCase, } from './xml/attributes.js';
13
+ // DOM utility helpers shared across player packages
14
+ export { assignProps } from './dom/assignProps.js';
15
+ export { createSvelteMountController, } from './dom/svelteMountController.js';
16
+ export { touchDrag, touchDragStyles } from './dom/touchDrag.js';
17
+ // Writing direction
18
+ export { languageDirection } from './language/direction.js';
19
+ // Parser factory
20
+ export { createQtiParser, createMapperForVersion, createAttributeMapperForVersion, isQti2, isQti3, } from './parser-factory.js';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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;AACtF,OAAO,EACN,gCAAgC,EAChC,sBAAsB,GACtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,GACpB,MAAM,kCAAkC,CAAC;AAE1C,mCAAmC;AACnC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElF,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,oBAAoB;AACpB,OAAO,EAAE,iBAAiB,EAAsB,MAAM,yBAAyB,CAAC;AAEhF,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';\nexport {\n\tconvertQti2ToQti3,\n\tQTI3_ASI_SCHEMA_LOCATION,\n\tQTI3_NAMESPACE,\n\tQTI3_RPTEMPLATE_BASE,\n} from './element-mapper/qti2-to-qti3.js';\n\n// Feedback and template visibility\nexport { isShownByIdentifier, matchesIdentifier } from './feedback/visibility.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// Writing direction\nexport { languageDirection, type TextDirection } from './language/direction.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"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Writing direction of a language tag.
3
+ *
4
+ * The same answer as `languageDirection` in `@pie-qti/i18n`, which this package
5
+ * does not depend on; item-player's `language-direction-parity.test.ts` holds
6
+ * the two to one table.
7
+ */
8
+ export type TextDirection = 'ltr' | 'rtl';
9
+ /** Writing direction of a language tag; `ltr` for anything unrecognised. */
10
+ export declare function languageDirection(tag: string | null | undefined): TextDirection;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Writing direction of a language tag.
3
+ *
4
+ * The same answer as `languageDirection` in `@pie-qti/i18n`, which this package
5
+ * does not depend on; item-player's `language-direction-parity.test.ts` holds
6
+ * the two to one table.
7
+ */
8
+ /** Right-to-left primary subtags, for engines whose `Intl.Locale` has no text info. */
9
+ const RTL_LANGUAGES = new Set([
10
+ 'ar',
11
+ 'ckb',
12
+ 'dv',
13
+ 'fa',
14
+ 'he',
15
+ 'iw',
16
+ 'ks',
17
+ 'ku',
18
+ 'nqo',
19
+ 'ps',
20
+ 'sd',
21
+ 'syr',
22
+ 'ug',
23
+ 'ur',
24
+ 'yi',
25
+ ]);
26
+ /** Writing direction of a language tag; `ltr` for anything unrecognised. */
27
+ export function languageDirection(tag) {
28
+ const normalized = (tag ?? '').trim().replace(/_/g, '-').split(/[.@]/)[0]?.toLowerCase() ?? '';
29
+ if (!normalized)
30
+ return 'ltr';
31
+ try {
32
+ const locale = new Intl.Locale(normalized);
33
+ const direction = (locale.getTextInfo?.() ?? locale.textInfo)?.direction;
34
+ if (direction === 'rtl' || direction === 'ltr')
35
+ return direction;
36
+ }
37
+ catch {
38
+ // Not a tag Intl.Locale accepts; the subtag check below still answers.
39
+ }
40
+ return RTL_LANGUAGES.has(normalized.split('-')[0] ?? '') ? 'rtl' : 'ltr';
41
+ }
42
+ //# sourceMappingURL=direction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direction.js","sourceRoot":"","sources":["../../src/language/direction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,uFAAuF;AACvF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC7B,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;CACJ,CAAC,CAAC;AAOH,4EAA4E;AAC5E,MAAM,UAAU,iBAAiB,CAAC,GAA8B;IAC/D,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC/F,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9B,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAmB,CAAC;QAC7D,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;QACzE,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,KAAK,KAAK;YAAE,OAAO,SAAS,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACR,uEAAuE;IACxE,CAAC;IACD,OAAO,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * Writing direction of a language tag.\n *\n * The same answer as `languageDirection` in `@pie-qti/i18n`, which this package\n * does not depend on; item-player's `language-direction-parity.test.ts` holds\n * the two to one table.\n */\n\nexport type TextDirection = 'ltr' | 'rtl';\n\n/** Right-to-left primary subtags, for engines whose `Intl.Locale` has no text info. */\nconst RTL_LANGUAGES = new Set([\n\t'ar',\n\t'ckb',\n\t'dv',\n\t'fa',\n\t'he',\n\t'iw',\n\t'ks',\n\t'ku',\n\t'nqo',\n\t'ps',\n\t'sd',\n\t'syr',\n\t'ug',\n\t'ur',\n\t'yi',\n]);\n\ntype TextInfoLocale = Intl.Locale & {\n\tgetTextInfo?: () => { direction?: string };\n\ttextInfo?: { direction?: string };\n};\n\n/** Writing direction of a language tag; `ltr` for anything unrecognised. */\nexport function languageDirection(tag: string | null | undefined): TextDirection {\n\tconst normalized = (tag ?? '').trim().replace(/_/g, '-').split(/[.@]/)[0]?.toLowerCase() ?? '';\n\tif (!normalized) return 'ltr';\n\ttry {\n\t\tconst locale = new Intl.Locale(normalized) as TextInfoLocale;\n\t\tconst direction = (locale.getTextInfo?.() ?? locale.textInfo)?.direction;\n\t\tif (direction === 'rtl' || direction === 'ltr') return direction;\n\t} catch {\n\t\t// Not a tag Intl.Locale accepts; the subtag check below still answers.\n\t}\n\treturn RTL_LANGUAGES.has(normalized.split('-')[0] ?? '') ? 'rtl' : 'ltr';\n}\n"]}