@pie-qti/item-player 0.1.8 → 0.1.10

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 (199) hide show
  1. package/README.md +17 -0
  2. package/dist/catalog/applyGlossaryTriggers.d.ts +13 -2
  3. package/dist/catalog/applyGlossaryTriggers.d.ts.map +1 -1
  4. package/dist/catalog/glossaryAction.d.ts +4 -2
  5. package/dist/catalog/glossaryAction.d.ts.map +1 -1
  6. package/dist/components/utils/index.d.ts +1 -2
  7. package/dist/components/utils/index.d.ts.map +1 -1
  8. package/dist/components/utils/index.js +1 -2
  9. package/dist/core/ComponentRegistry.d.ts +10 -1
  10. package/dist/core/ComponentRegistry.d.ts.map +1 -1
  11. package/dist/core/ComponentRegistry.js +42 -1
  12. package/dist/core/Player.d.ts +10 -2
  13. package/dist/core/Player.d.ts.map +1 -1
  14. package/dist/core/Player.js +54 -46
  15. package/dist/document/AssessmentItemDocument.d.ts +1 -1
  16. package/dist/element.d.ts +15 -0
  17. package/dist/element.js +1921 -1785
  18. package/dist/element.js.map +1 -1
  19. package/dist/extraction/ExtractionRegistry.d.ts +1 -1
  20. package/dist/extraction/createContext.d.ts +1 -1
  21. package/dist/extraction/index.d.ts +2 -2
  22. package/dist/extraction/index.d.ts.map +1 -1
  23. package/dist/extraction/index.js +1 -1
  24. package/dist/extraction/interactionExtractionPipeline.d.ts +1 -1
  25. package/dist/extraction/interactionSecurity.d.ts +1 -1
  26. package/dist/extraction/types.d.ts +1 -1
  27. package/dist/presentation/itemPresentationPlan.d.ts +54 -0
  28. package/dist/presentation/itemPresentationPlan.d.ts.map +1 -0
  29. package/dist/presentation/itemPresentationPlan.js +98 -0
  30. package/dist/types/index.d.ts +17 -2
  31. package/dist/types/index.d.ts.map +1 -1
  32. package/dist/types/index.js +0 -3
  33. package/dist/web-components/QTIInteractionBase.d.ts +1 -1
  34. package/dist/web-components/QTIInteractionElement.d.ts +1 -1
  35. package/package.json +10 -12
  36. package/src/__tests__/catalog.test.ts +0 -267
  37. package/src/__tests__/fixtures/pci/echo-pci.js +0 -49
  38. package/src/__tests__/pci.test.ts +0 -353
  39. package/src/__tests__/qti3-attribute-extraction.test.ts +0 -174
  40. package/src/__tests__/qti3-debug.test.ts +0 -140
  41. package/src/__tests__/qti3-extraction.test.ts +0 -309
  42. package/src/catalog/applyGlossaryTriggers.ts +0 -372
  43. package/src/catalog/catalogExtractor.ts +0 -130
  44. package/src/catalog/catalogLookup.ts +0 -53
  45. package/src/catalog/glossaryAction.ts +0 -38
  46. package/src/catalog/types.ts +0 -37
  47. package/src/components/ItemBody.svelte +0 -363
  48. package/src/components/ItemPlayer.svelte +0 -163
  49. package/src/components/ModalFeedbackDisplay.svelte +0 -97
  50. package/src/components/actions/typesetAction.ts +0 -74
  51. package/src/components/index.ts +0 -22
  52. package/src/components/utils/assignProps.ts +0 -2
  53. package/src/components/utils/feedbackUtils.ts +0 -140
  54. package/src/components/utils/index.ts +0 -13
  55. package/src/components/utils/stimulusRender.ts +0 -93
  56. package/src/components/utils/stylesheetRender.ts +0 -58
  57. package/src/core/ComponentRegistry.ts +0 -248
  58. package/src/core/Player.ts +0 -1618
  59. package/src/core/Plugin.ts +0 -123
  60. package/src/core/PluginManager.ts +0 -182
  61. package/src/core/constants.ts +0 -117
  62. package/src/core/declarations.ts +0 -171
  63. package/src/core/parsingLimits.ts +0 -62
  64. package/src/core/random.ts +0 -24
  65. package/src/core/rolePolicy.ts +0 -34
  66. package/src/core/sanitizer.ts +0 -305
  67. package/src/core/trustedTypes.ts +0 -63
  68. package/src/core/urlPolicy.ts +0 -98
  69. package/src/document/AssessmentItemDocument.ts +0 -247
  70. package/src/element.ts +0 -128
  71. package/src/extensions/MathLiveEditor.ts +0 -313
  72. package/src/extraction/ExtractionRegistry.ts +0 -335
  73. package/src/extraction/createContext.ts +0 -52
  74. package/src/extraction/extractors/associateExtractor.ts +0 -1
  75. package/src/extraction/extractors/choiceExtractor.ts +0 -1
  76. package/src/extraction/extractors/conformance-qti3-advanced.test.ts +0 -239
  77. package/src/extraction/extractors/conformance-qti3-basic.test.ts +0 -82
  78. package/src/extraction/extractors/conformance.test.ts +0 -208
  79. package/src/extraction/extractors/customExtractor.ts +0 -1
  80. package/src/extraction/extractors/drawingExtractor.ts +0 -1
  81. package/src/extraction/extractors/endAttemptExtractor.ts +0 -1
  82. package/src/extraction/extractors/extendedTextExtractor.ts +0 -1
  83. package/src/extraction/extractors/gapMatchExtractor.ts +0 -1
  84. package/src/extraction/extractors/graphicAssociateExtractor.ts +0 -1
  85. package/src/extraction/extractors/graphicGapMatchExtractor.ts +0 -1
  86. package/src/extraction/extractors/graphicOrderExtractor.ts +0 -1
  87. package/src/extraction/extractors/hotspotExtractor.ts +0 -1
  88. package/src/extraction/extractors/hottextExtractor.ts +0 -1
  89. package/src/extraction/extractors/index.ts +0 -9
  90. package/src/extraction/extractors/inlineChoiceExtractor.ts +0 -1
  91. package/src/extraction/extractors/matchExtractor.ts +0 -1
  92. package/src/extraction/extractors/mediaExtractor.ts +0 -1
  93. package/src/extraction/extractors/orderExtractor.ts +0 -1
  94. package/src/extraction/extractors/portableCustomExtractor.ts +0 -1
  95. package/src/extraction/extractors/positionObjectExtractor.ts +0 -1
  96. package/src/extraction/extractors/selectPointExtractor.ts +0 -1
  97. package/src/extraction/extractors/sliderExtractor.ts +0 -1
  98. package/src/extraction/extractors/textEntryExtractor.ts +0 -1
  99. package/src/extraction/extractors/uploadExtractor.ts +0 -1
  100. package/src/extraction/index.ts +0 -108
  101. package/src/extraction/interactionExtractionPipeline.ts +0 -70
  102. package/src/extraction/interactionSecurity.ts +0 -60
  103. package/src/extraction/types.ts +0 -246
  104. package/src/extraction/utils.ts +0 -243
  105. package/src/iframe/IFramePlayerHost.ts +0 -265
  106. package/src/iframe/index.ts +0 -11
  107. package/src/iframe/protocol.ts +0 -137
  108. package/src/index.ts +0 -101
  109. package/src/interactions/associate/extractor.ts +0 -133
  110. package/src/interactions/associate/index.ts +0 -2
  111. package/src/interactions/associate/types.ts +0 -1
  112. package/src/interactions/choice/extractor.ts +0 -121
  113. package/src/interactions/choice/index.ts +0 -2
  114. package/src/interactions/choice/types.ts +0 -1
  115. package/src/interactions/custom/extractor.ts +0 -72
  116. package/src/interactions/custom/index.ts +0 -2
  117. package/src/interactions/custom/types.ts +0 -1
  118. package/src/interactions/drawing/extractor.ts +0 -113
  119. package/src/interactions/drawing/index.ts +0 -2
  120. package/src/interactions/drawing/types.ts +0 -1
  121. package/src/interactions/end-attempt/extractor.ts +0 -74
  122. package/src/interactions/end-attempt/index.ts +0 -2
  123. package/src/interactions/end-attempt/types.ts +0 -1
  124. package/src/interactions/extended-text/extractor.ts +0 -92
  125. package/src/interactions/extended-text/index.ts +0 -2
  126. package/src/interactions/extended-text/types.ts +0 -1
  127. package/src/interactions/gap-match/extractor.ts +0 -193
  128. package/src/interactions/gap-match/index.ts +0 -2
  129. package/src/interactions/gap-match/types.ts +0 -1
  130. package/src/interactions/graphic-associate/extractor.ts +0 -192
  131. package/src/interactions/graphic-associate/index.ts +0 -2
  132. package/src/interactions/graphic-associate/types.ts +0 -1
  133. package/src/interactions/graphic-gap-match/extractor.ts +0 -257
  134. package/src/interactions/graphic-gap-match/index.ts +0 -2
  135. package/src/interactions/graphic-gap-match/types.ts +0 -1
  136. package/src/interactions/graphic-order/extractor.ts +0 -162
  137. package/src/interactions/graphic-order/index.ts +0 -2
  138. package/src/interactions/graphic-order/types.ts +0 -1
  139. package/src/interactions/hotspot/extractor.ts +0 -208
  140. package/src/interactions/hotspot/index.ts +0 -2
  141. package/src/interactions/hotspot/types.ts +0 -1
  142. package/src/interactions/hottext/extractor.ts +0 -163
  143. package/src/interactions/hottext/index.ts +0 -2
  144. package/src/interactions/hottext/types.ts +0 -1
  145. package/src/interactions/index.ts +0 -52
  146. package/src/interactions/inline/index.ts +0 -1
  147. package/src/interactions/inline/render-plan.ts +0 -105
  148. package/src/interactions/inline-choice/InlineChoice.svelte +0 -57
  149. package/src/interactions/inline-choice/extractor.ts +0 -105
  150. package/src/interactions/inline-choice/index.ts +0 -2
  151. package/src/interactions/inline-choice/types.ts +0 -1
  152. package/src/interactions/match/extractor.ts +0 -187
  153. package/src/interactions/match/index.ts +0 -2
  154. package/src/interactions/match/types.ts +0 -1
  155. package/src/interactions/media/extractor.ts +0 -168
  156. package/src/interactions/media/index.ts +0 -2
  157. package/src/interactions/media/types.ts +0 -1
  158. package/src/interactions/modules.ts +0 -111
  159. package/src/interactions/order/extractor.ts +0 -120
  160. package/src/interactions/order/index.ts +0 -2
  161. package/src/interactions/order/types.ts +0 -1
  162. package/src/interactions/portable-custom/extractor.ts +0 -122
  163. package/src/interactions/portable-custom/index.ts +0 -2
  164. package/src/interactions/portable-custom/types.ts +0 -1
  165. package/src/interactions/position-object/extractor.ts +0 -243
  166. package/src/interactions/position-object/index.ts +0 -2
  167. package/src/interactions/position-object/types.ts +0 -1
  168. package/src/interactions/select-point/extractor.ts +0 -143
  169. package/src/interactions/select-point/index.ts +0 -2
  170. package/src/interactions/select-point/types.ts +0 -1
  171. package/src/interactions/shared/index.ts +0 -1
  172. package/src/interactions/shared/types.ts +0 -430
  173. package/src/interactions/slider/extractor.ts +0 -102
  174. package/src/interactions/slider/index.ts +0 -2
  175. package/src/interactions/slider/types.ts +0 -1
  176. package/src/interactions/text-entry/InlineTextEntry.svelte +0 -75
  177. package/src/interactions/text-entry/extractor.ts +0 -79
  178. package/src/interactions/text-entry/index.ts +0 -2
  179. package/src/interactions/text-entry/types.ts +0 -1
  180. package/src/interactions/upload/extractor.ts +0 -81
  181. package/src/interactions/upload/index.ts +0 -2
  182. package/src/interactions/upload/types.ts +0 -1
  183. package/src/pci/PciHost.ts +0 -138
  184. package/src/pci/types.ts +0 -70
  185. package/src/pnp/applyPnp.ts +0 -29
  186. package/src/pnp/parsePnpXml.ts +0 -215
  187. package/src/pnp/types.ts +0 -75
  188. package/src/server.ts +0 -14
  189. package/src/types/index.ts +0 -388
  190. package/src/types/interactions.ts +0 -8
  191. package/src/types/responseValidation.ts +0 -29
  192. package/src/types/xmldom.d.ts +0 -12
  193. package/src/utils/PerformanceMonitor.ts +0 -335
  194. package/src/utils/drawingUtils.ts +0 -73
  195. package/src/utils/responseUtils.ts +0 -51
  196. package/src/utils/touchDragHelper.ts +0 -1
  197. package/src/web-components/QTIInteractionBase.ts +0 -303
  198. package/src/web-components/QTIInteractionElement.ts +0 -125
  199. package/src/web-components/index.ts +0 -22
@@ -1,303 +0,0 @@
1
- /**
2
- * Abstract base class for all QTI interaction web components
3
- *
4
- * Provides common functionality including:
5
- * - Reactive property system
6
- * - Shadow DOM management
7
- * - Event emission helpers
8
- * - Update scheduling
9
- * - Lifecycle management
10
- *
11
- * @example
12
- * ```typescript
13
- * export class QTIChoiceInteraction extends QTIInteractionBase<ChoiceInteractionData> {
14
- * protected render(): void {
15
- * this.shadowRoot.innerHTML = `...`;
16
- * this.attachEventListeners();
17
- * }
18
- *
19
- * protected cleanup(): void {
20
- * // Optional cleanup
21
- * }
22
- * }
23
- * ```
24
- */
25
-
26
- import type { HtmlContent } from '../types/index.js';
27
- import type { InteractionData } from '../types/interactions.js';
28
- import {
29
- type InteractionResponseValue,
30
- QTIChangeEvent,
31
- QTIErrorEvent,
32
- type QTIInteractionElement,
33
- QTIReadyEvent,
34
- } from './QTIInteractionElement.js';
35
-
36
- export abstract class QTIInteractionBase<TData extends InteractionData = InteractionData>
37
- extends HTMLElement
38
- implements QTIInteractionElement<TData>
39
- {
40
- private _interaction: TData | null = null;
41
- private _response: InteractionResponseValue<TData> | null = null;
42
- private _disabled = false;
43
- private _typeset?: (element: HTMLElement) => void;
44
-
45
- declare shadowRoot: ShadowRoot; // Override HTMLElement's shadowRoot type
46
- private updateScheduled = false;
47
- private isInitialized = false;
48
-
49
- constructor() {
50
- super();
51
- // attachShadow returns ShadowRoot, and we cast to ensure type compatibility
52
- (this as any).shadowRoot = this.attachShadow({ mode: 'open' });
53
- }
54
-
55
- // ========== Property Getters/Setters ==========
56
-
57
- /**
58
- * The processed interaction data from QTI XML
59
- * Required property - throws if accessed before being set
60
- */
61
- get interaction(): TData {
62
- if (!this._interaction) {
63
- throw new Error(
64
- `${this.tagName}: interaction property must be set before use`
65
- );
66
- }
67
- return this._interaction;
68
- }
69
-
70
- set interaction(value: TData) {
71
- if (this._interaction !== value) {
72
- this._interaction = value;
73
- this.requestUpdate();
74
- }
75
- }
76
-
77
- /**
78
- * Current response value (type depends on interaction type)
79
- * May be null if no response has been provided yet
80
- */
81
- get response(): InteractionResponseValue<TData> | null {
82
- return this._response;
83
- }
84
-
85
- set response(value: InteractionResponseValue<TData> | null) {
86
- if (this._response !== value) {
87
- this._response = value;
88
- this.requestUpdate();
89
- }
90
- }
91
-
92
- /**
93
- * Whether the interaction is in read-only/disabled mode
94
- */
95
- get disabled(): boolean {
96
- return this._disabled;
97
- }
98
-
99
- set disabled(value: boolean) {
100
- const newValue = Boolean(value);
101
- if (this._disabled !== newValue) {
102
- this._disabled = newValue;
103
- this.requestUpdate();
104
- }
105
- }
106
-
107
- /**
108
- * Optional function to apply math typesetting (e.g., KaTeX, MathJax)
109
- */
110
- get typeset(): ((element: HTMLElement) => void) | undefined {
111
- return this._typeset;
112
- }
113
-
114
- set typeset(value: ((element: HTMLElement) => void) | undefined) {
115
- if (this._typeset !== value) {
116
- this._typeset = value;
117
- this.requestUpdate();
118
- }
119
- }
120
-
121
- // ========== Lifecycle Hooks ==========
122
-
123
- /**
124
- * Called when the element is connected to the DOM
125
- */
126
- connectedCallback(): void {
127
- if (!this.isInitialized) {
128
- this.isInitialized = true;
129
- this.init();
130
- }
131
- this.requestUpdate();
132
- }
133
-
134
- /**
135
- * Called when the element is disconnected from the DOM
136
- */
137
- disconnectedCallback(): void {
138
- this.cleanup();
139
- }
140
-
141
- /**
142
- * Called once when the element is first connected
143
- * Override this to perform one-time initialization
144
- */
145
- protected init(): void {
146
- // Override in subclasses if needed
147
- }
148
-
149
- // ========== Reactive Updates ==========
150
-
151
- /**
152
- * Schedule a re-render on the next microtask
153
- * Multiple calls within the same tick are batched
154
- */
155
- protected requestUpdate(): void {
156
- if (!this.updateScheduled && this.isConnected) {
157
- this.updateScheduled = true;
158
- queueMicrotask(() => {
159
- this.updateScheduled = false;
160
- try {
161
- this.render();
162
- if (this.isInitialized) {
163
- this.emitReady();
164
- }
165
- } catch (error) {
166
- this.emitError(error as Error, 'render');
167
- }
168
- });
169
- }
170
- }
171
-
172
- // ========== Abstract Methods ==========
173
-
174
- /**
175
- * Render the component's UI
176
- * Called automatically when properties change
177
- * Must be implemented by subclasses
178
- */
179
- protected abstract render(): void;
180
-
181
- /**
182
- * Clean up resources when component is removed from DOM
183
- * Override this to remove event listeners, cancel timers, etc.
184
- */
185
- protected abstract cleanup(): void;
186
-
187
- // ========== Event Helpers ==========
188
-
189
- /**
190
- * Emit a qti-change event when the user response changes
191
- * @param value - The new response value
192
- */
193
- protected emitChange(value: InteractionResponseValue<TData> | null): void {
194
- if (!this._interaction) {
195
- console.warn(`${this.tagName}: Cannot emit change without interaction data`);
196
- return;
197
- }
198
-
199
- const event = new QTIChangeEvent({
200
- responseId: this._interaction.responseId,
201
- value,
202
- timestamp: Date.now(),
203
- });
204
-
205
- this.dispatchEvent(event);
206
- }
207
-
208
- /**
209
- * Emit a qti-ready event when component is initialized
210
- */
211
- private emitReady(): void {
212
- this.dispatchEvent(new QTIReadyEvent());
213
- }
214
-
215
- /**
216
- * Emit a qti-error event when an error occurs
217
- */
218
- protected emitError(error: Error, context: string): void {
219
- const event = new QTIErrorEvent({ error, context });
220
- this.dispatchEvent(event);
221
- console.error(`${this.tagName} error in ${context}:`, error);
222
- }
223
-
224
- // ========== Utility Methods ==========
225
-
226
- /**
227
- * Apply math typesetting to the shadow root
228
- * Call this after updating the DOM with math content
229
- */
230
- protected applyTypesetting(): void {
231
- if (this._typeset && this.shadowRoot) {
232
- try {
233
- this._typeset(this.shadowRoot as any);
234
- } catch (error) {
235
- this.emitError(error as Error, 'typesetting');
236
- }
237
- }
238
- }
239
-
240
- /**
241
- * Get base styles for all interaction components
242
- * Override and call super.getStyles() to extend these styles
243
- */
244
- protected getStyles(): string {
245
- return `
246
- :host {
247
- display: block;
248
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
249
- Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
250
- font-size: 16px;
251
- line-height: 1.5;
252
- }
253
-
254
- :host([disabled]) {
255
- opacity: 0.6;
256
- pointer-events: none;
257
- }
258
-
259
- * {
260
- box-sizing: border-box;
261
- }
262
-
263
- .qti-prompt {
264
- margin-bottom: 1rem;
265
- font-weight: 600;
266
- }
267
-
268
- .qti-error {
269
- color: #dc2626;
270
- padding: 0.75rem;
271
- background: #fee2e2;
272
- border-radius: 0.375rem;
273
- margin: 0.5rem 0;
274
- }
275
- `;
276
- }
277
-
278
- /**
279
- * Safely set innerHTML with error handling
280
- */
281
- protected safeSetInnerHTML(element: HTMLElement | ShadowRoot, html: HtmlContent): void {
282
- try {
283
- element.innerHTML = html as any;
284
- } catch (error) {
285
- this.emitError(error as Error, 'setInnerHTML');
286
- element.innerHTML = `<div class="qti-error">Failed to render content</div>`;
287
- }
288
- }
289
-
290
- /**
291
- * Create an element with classes
292
- */
293
- protected createElement<K extends keyof HTMLElementTagNameMap>(
294
- tagName: K,
295
- classes?: string[]
296
- ): HTMLElementTagNameMap[K] {
297
- const element = document.createElement(tagName);
298
- if (classes && classes.length > 0) {
299
- element.className = classes.join(' ');
300
- }
301
- return element;
302
- }
303
- }
@@ -1,125 +0,0 @@
1
- /**
2
- * Standard interface and event types for QTI interaction web components
3
- *
4
- * All QTI interaction web components must implement the QTIInteractionElement
5
- * interface and emit QTIChangeEvent when the user response changes.
6
- */
7
-
8
- import type { InteractionData, InteractionValueMap } from '../types/interactions.js';
9
-
10
- export type InteractionResponseValue<TData extends InteractionData = InteractionData> =
11
- TData extends { type: infer TType }
12
- ? TType extends keyof InteractionValueMap
13
- ? InteractionValueMap[TType]
14
- : unknown
15
- : unknown;
16
-
17
- /**
18
- * Standard interface that all QTI interaction web components must implement
19
- */
20
- export interface QTIInteractionElement<TData extends InteractionData = InteractionData> extends HTMLElement {
21
- /** The processed interaction data from the QTI XML */
22
- interaction: TData;
23
-
24
- /** The current response value (type depends on interaction type) */
25
- response: InteractionResponseValue<TData> | null;
26
-
27
- /** Whether the interaction is in read-only/disabled mode */
28
- disabled: boolean;
29
-
30
- /** Optional function to apply math typesetting (e.g., KaTeX, MathJax) */
31
- typeset?: (element: HTMLElement) => void;
32
- }
33
-
34
- /**
35
- * Detail payload for the qti-change event
36
- */
37
- export interface QTIChangeEventDetail<TValue = InteractionResponseValue | null> {
38
- /** The response identifier for this interaction */
39
- responseId: string;
40
-
41
- /** The new response value */
42
- value: TValue;
43
-
44
- /** Timestamp when the change occurred */
45
- timestamp: number;
46
- }
47
-
48
- /**
49
- * Custom event emitted when an interaction's response changes
50
- *
51
- * This event bubbles and can cross shadow DOM boundaries, making it
52
- * easy to listen for changes at the container level.
53
- *
54
- * @example
55
- * ```typescript
56
- * element.addEventListener('qti-change', (event: QTIChangeEvent) => {
57
- * console.log('Response changed:', event.detail.responseId, event.detail.value);
58
- * });
59
- * ```
60
- */
61
- export class QTIChangeEvent<TValue = InteractionResponseValue | null> extends CustomEvent<QTIChangeEventDetail<TValue>> {
62
- constructor(detail: QTIChangeEventDetail<TValue>) {
63
- super('qti-change', {
64
- detail,
65
- bubbles: true, // Bubble up through DOM tree
66
- composed: true, // Cross shadow DOM boundaries
67
- cancelable: false, // Cannot be prevented
68
- });
69
- }
70
- }
71
-
72
- /**
73
- * Event emitted when a component is ready (initialized and rendered)
74
- */
75
- export class QTIReadyEvent extends CustomEvent<void> {
76
- constructor() {
77
- super('qti-ready', {
78
- bubbles: true,
79
- composed: true,
80
- cancelable: false,
81
- });
82
- }
83
- }
84
-
85
- /**
86
- * Event emitted when an error occurs in a component
87
- */
88
- export interface QTIErrorEventDetail {
89
- /** The error that occurred */
90
- error: Error;
91
-
92
- /** Context about where the error occurred */
93
- context: string;
94
- }
95
-
96
- export class QTIErrorEvent extends CustomEvent<QTIErrorEventDetail> {
97
- constructor(detail: QTIErrorEventDetail) {
98
- super('qti-error', {
99
- detail,
100
- bubbles: true,
101
- composed: true,
102
- cancelable: false,
103
- });
104
- }
105
- }
106
-
107
- /**
108
- * Special event for AssociateInteraction selection state
109
- * (used for tracking which item is selected for pairing)
110
- */
111
- export interface QTISelectionChangeEventDetail {
112
- /** The identifier of the selected item, or null if deselected */
113
- selected: string | null;
114
- }
115
-
116
- export class QTISelectionChangeEvent extends CustomEvent<QTISelectionChangeEventDetail> {
117
- constructor(detail: QTISelectionChangeEventDetail) {
118
- super('qti-selection-change', {
119
- detail,
120
- bubbles: true,
121
- composed: true,
122
- cancelable: false,
123
- });
124
- }
125
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Web Components for QTI Interactions
3
- *
4
- * Framework-agnostic web components that can be used in any JavaScript environment
5
- */
6
-
7
- // Export base classes and interfaces
8
- export { QTIInteractionBase } from './QTIInteractionBase.js';
9
- export {
10
- QTIChangeEvent,
11
- type InteractionResponseValue,
12
- type QTIChangeEventDetail,
13
- QTIErrorEvent,
14
- type QTIErrorEventDetail,
15
- type QTIInteractionElement,
16
- QTIReadyEvent,
17
- QTISelectionChangeEvent,
18
- type QTISelectionChangeEventDetail,
19
- } from './QTIInteractionElement.js';
20
-
21
- // Note: Web component implementations are provided by separate packages
22
- // (e.g., @pie-qti/default-components) that use these base classes