@citolab/qti-components 7.28.1 → 8.0.0

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 (82) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +6205 -2973
  3. package/dist/base.d.ts +9 -50
  4. package/dist/base.js +27 -6
  5. package/dist/chunk-5QYII4OZ.js +1374 -0
  6. package/dist/chunk-5QYII4OZ.js.map +1 -0
  7. package/dist/{chunk-MPC7LIPC.js → chunk-5SJS36BI.js} +4264 -3647
  8. package/dist/chunk-5SJS36BI.js.map +1 -0
  9. package/dist/chunk-64XSIBGO.js +241 -0
  10. package/dist/chunk-64XSIBGO.js.map +1 -0
  11. package/dist/{chunk-SP6S2WMG.js → chunk-7V4HJFHW.js} +3 -3
  12. package/dist/{chunk-SP6S2WMG.js.map → chunk-7V4HJFHW.js.map} +1 -1
  13. package/dist/{chunk-3XV26R5M.js → chunk-H3J7LFRO.js} +829 -1005
  14. package/dist/chunk-H3J7LFRO.js.map +1 -0
  15. package/dist/{chunk-3WBG257S.js → chunk-IJD53WY6.js} +96 -74
  16. package/dist/chunk-IJD53WY6.js.map +1 -0
  17. package/dist/chunk-KYEZRYO6.js +1608 -0
  18. package/dist/chunk-KYEZRYO6.js.map +1 -0
  19. package/dist/{chunk-HFCZFWSH.js → chunk-LZJHHZQ2.js} +1954 -1729
  20. package/dist/chunk-LZJHHZQ2.js.map +1 -0
  21. package/dist/chunk-MGF5F3S2.js +11 -0
  22. package/dist/chunk-MGF5F3S2.js.map +1 -0
  23. package/dist/chunk-MJVPNN7W.js +11 -0
  24. package/dist/chunk-MJVPNN7W.js.map +1 -0
  25. package/dist/{chunk-REI3AMCZ.js → chunk-NA2N2WSG.js} +1303 -1193
  26. package/dist/chunk-NA2N2WSG.js.map +1 -0
  27. package/dist/chunk-V5G7X53Y.js +11 -0
  28. package/dist/chunk-V5G7X53Y.js.map +1 -0
  29. package/dist/chunk-W4QZPCNC.js +294 -0
  30. package/dist/chunk-W4QZPCNC.js.map +1 -0
  31. package/dist/chunk-WCQ26LV7.js +102 -0
  32. package/dist/chunk-WCQ26LV7.js.map +1 -0
  33. package/dist/{chunk-WDO2TRFM.js → chunk-WVVMNF74.js} +851 -925
  34. package/dist/chunk-WVVMNF74.js.map +1 -0
  35. package/dist/{chunk-FLJAKWXL.js → chunk-X3E5HXG2.js} +2 -2
  36. package/dist/corrections.d.ts +1 -0
  37. package/dist/corrections.js +84 -0
  38. package/dist/elements.d.ts +1 -399
  39. package/dist/elements.js +6 -5
  40. package/dist/index.d.ts +9 -23
  41. package/dist/index.js +185 -76
  42. package/dist/interactions.d.ts +1 -915
  43. package/dist/interactions.js +19 -15
  44. package/dist/item.css +4118 -1920
  45. package/dist/item.d.ts +1 -134
  46. package/dist/item.js +6 -11
  47. package/dist/loader.d.ts +1 -22
  48. package/dist/loader.js +2 -3
  49. package/dist/processing.d.ts +1 -731
  50. package/dist/processing.js +2 -3
  51. package/dist/qti-components-jsx.d.ts +5220 -2571
  52. package/dist/test.d.ts +1 -539
  53. package/dist/test.js +26 -11
  54. package/dist/transformers.d.ts +1 -18
  55. package/dist/transformers.js +1 -2
  56. package/package.json +19 -15
  57. package/custom-elements.json +0 -43251
  58. package/dist/chunk-3WBG257S.js.map +0 -1
  59. package/dist/chunk-3XV26R5M.js.map +0 -1
  60. package/dist/chunk-AQ5RJFM6.js +0 -3673
  61. package/dist/chunk-AQ5RJFM6.js.map +0 -1
  62. package/dist/chunk-HFCZFWSH.js.map +0 -1
  63. package/dist/chunk-MPC7LIPC.js.map +0 -1
  64. package/dist/chunk-QXBXORM3.js +0 -27
  65. package/dist/chunk-REI3AMCZ.js.map +0 -1
  66. package/dist/chunk-RLTYVS2I.js +0 -530
  67. package/dist/chunk-RLTYVS2I.js.map +0 -1
  68. package/dist/chunk-WDO2TRFM.js.map +0 -1
  69. package/dist/computed-item.context-DfsW_96S.d.ts +0 -22
  70. package/dist/computed.context-DHbxad0N.d.ts +0 -45
  71. package/dist/config.context-BjZ2bZSY.d.ts +0 -42
  72. package/dist/interaction-Bgzlw7Iu.d.ts +0 -110
  73. package/dist/item.context-CkUeDcaO.d.ts +0 -15
  74. package/dist/qti-condition-expression-Dam-RER6.d.ts +0 -26
  75. package/dist/qti-feedback-ChmXhZuf.d.ts +0 -21
  76. package/dist/qti-rule-base-ajOnfGXY.d.ts +0 -16
  77. package/dist/qti-transform-test-DoZaWItm.d.ts +0 -70
  78. package/dist/qti.context-CejJMlfZ.d.ts +0 -50
  79. package/dist/test.context-CByZZjkR.d.ts +0 -15
  80. package/dist/variables-CMYcDbyW.d.ts +0 -70
  81. /package/dist/{chunk-FLJAKWXL.js.map → chunk-X3E5HXG2.js.map} +0 -0
  82. /package/dist/{chunk-QXBXORM3.js.map → corrections.js.map} +0 -0
@@ -1,915 +1 @@
1
- import * as lit from 'lit';
2
- import { CSSResultGroup, LitElement, PropertyValues, PropertyValueMap } from 'lit';
3
- import { a as Interaction, I as IInteraction, C as Correctness } from './interaction-Bgzlw7Iu.js';
4
- import { C as ConfigContext } from './config.context-BjZ2bZSY.js';
5
- import { a as Cardinality, B as BaseType } from './variables-CMYcDbyW.js';
6
- import { I as ItemContext } from './item.context-CkUeDcaO.js';
7
- import { Q as QtiContext } from './qti.context-CejJMlfZ.js';
8
- import * as lit_directives_ref_js from 'lit/directives/ref.js';
9
-
10
- /**
11
- * Collision detection algorithms for drag and drop interactions
12
- * Based on dnd-kit collision detection strategies
13
- */
14
- type CollisionDetectionAlgorithm = 'pointerWithin' | 'rectangleIntersection' | 'closestCenter' | 'closestCorners' | 'closestCornersWithInventoryPriority';
15
-
16
- type DragDropCore = Interaction & {
17
- trackedDraggables: HTMLElement[];
18
- trackedDroppables: HTMLElement[];
19
- trackedDragContainers: HTMLElement[];
20
- allDropzones: HTMLElement[];
21
- dragState: DragState;
22
- collisionDetectionAlgorithm: CollisionDetectionAlgorithm;
23
- get response(): string | string[] | null;
24
- set response(value: string | string[] | null);
25
- saveResponse(value?: string | string[]): void;
26
- validate(): boolean;
27
- reportValidity(): boolean;
28
- cacheInteractiveElements(): void;
29
- resetDragState(): void;
30
- afterCache(): void;
31
- allowDrop(draggable: HTMLElement, droppable: HTMLElement): boolean;
32
- handleDrop(draggable: HTMLElement, droppable: HTMLElement): void;
33
- handleInvalidDrop(dragSource: HTMLElement | null): void;
34
- initiateDrag(dragElement: HTMLElement, startX: number, startY: number, inputType: 'mouse' | 'touch', eventSource?: 'pointer' | 'mouse' | 'touch', pointerId?: number, startedFromTrustedEvent?: boolean): void;
35
- createDragClone(element: HTMLElement, rect: DOMRect): HTMLElement;
36
- updateClonePosition(clientX: number, clientY: number): void;
37
- activateAllDroppables(): void;
38
- setupMoveObservables(inputType: 'mouse' | 'touch', eventSource?: 'pointer' | 'mouse' | 'touch'): void;
39
- };
40
- interface DragState {
41
- dragging: boolean;
42
- dragSource: HTMLElement | null;
43
- dragClone: HTMLElement | null;
44
- startOffset: {
45
- x: number;
46
- y: number;
47
- };
48
- currentTarget: HTMLElement | null;
49
- sourceDroppable: HTMLElement | null;
50
- inputType: 'mouse' | 'touch' | null;
51
- pointerId?: number;
52
- startedFromTrustedEvent?: boolean;
53
- initialCoordinates?: {
54
- x: number;
55
- y: number;
56
- };
57
- activationTimeout?: number;
58
- touchCleanup?: () => void;
59
- lastTargetChangeTime?: number;
60
- }
61
-
62
- type DragDropSlotted = DragDropCore & {
63
- minAssociations: number;
64
- maxAssociations: number;
65
- disableAnimations: boolean;
66
- enableFlipAnimations: boolean;
67
- autoSizeDropzones: boolean;
68
- validate(): boolean;
69
- reportValidity(): boolean;
70
- reset(): void;
71
- saveResponse(value?: string | string[]): void;
72
- shouldTreatBlockedMaxAsInvalid(): boolean;
73
- shouldReturnToInventoryOnInventoryDrop(): boolean;
74
- };
75
-
76
- /**
77
- * Shared utilities for sortable drag-and-drop behavior.
78
- * Used by both DragDropSortableMixin (standalone) and SlotSortableEnhancerMixin (composition).
79
- */
80
-
81
- /**
82
- * Configuration for drop placeholder styling
83
- */
84
- interface PlaceholderConfig {
85
- borderStyle?: string;
86
- borderColor?: string;
87
- background?: string;
88
- transitionDuration?: number;
89
- }
90
-
91
- type DragDropSlottedSortable = DragDropSlotted & {
92
- allowReorder: boolean;
93
- readonly isDraggingFromSlot: boolean;
94
- sortablePlaceholderConfig: PlaceholderConfig;
95
- };
96
-
97
- declare const QtiAssociateInteraction_base: (abstract new (...args: any[]) => DragDropSlottedSortable) & (abstract new (...args: any[]) => DragDropSlotted) & typeof Interaction;
98
- declare class QtiAssociateInteraction extends QtiAssociateInteraction_base {
99
- static styles: CSSResultGroup;
100
- protected _childrenMap: Element[];
101
- protected _registerChoiceHandler: (event: CustomEvent) => void;
102
- constructor();
103
- protected _registerChoice(event: CustomEvent): void;
104
- protected getResponse(): string[];
105
- getValue(val: string[]): string[];
106
- render(): lit.TemplateResult<1>;
107
- protected updated(changedProperties: Map<string, unknown>): void;
108
- disconnectedCallback(): void;
109
- }
110
- declare global {
111
- interface HTMLElementTagNameMap {
112
- 'qti-associate-interaction': QtiAssociateInteraction;
113
- }
114
- }
115
-
116
- interface ChoiceInterface {
117
- identifier: string;
118
- disabled: boolean;
119
- readonly: boolean;
120
- }
121
- /**
122
- * A mixin that adds choice functionality to a LitElement-based class.
123
- * It dispatches events with a custom `type` and handles selection logic.
124
- *
125
- * @param Base - The base class to extend.
126
- * @param type - The type of the choice, used in event names.
127
- * @returns A new class extending the base class with choice functionality.
128
- */
129
- interface ActiveElementMixinInterface {
130
- identifier: string;
131
- tabIndex: number;
132
- disabled: boolean;
133
- readonly: boolean;
134
- internals: ElementInternals;
135
- }
136
-
137
- type Choice = HTMLElement & ChoiceInterface & {
138
- internals: ElementInternals;
139
- };
140
- interface ChoicesInterface extends IInteraction {
141
- minChoices: number;
142
- maxChoices: number;
143
- value: string | null;
144
- response: string | string[] | null;
145
- validate(): boolean;
146
- reportValidity(): boolean;
147
- }
148
-
149
- type Orientation = 'horizontal' | 'vertical' | undefined;
150
- declare const QtiChoiceInteraction_base: (abstract new (...args: any[]) => {}) & (abstract new (...args: any[]) => ChoicesInterface) & typeof Interaction;
151
- declare class QtiChoiceInteraction extends QtiChoiceInteraction_base implements ChoicesInterface {
152
- #private;
153
- static styles: CSSResultGroup;
154
- /** @deprecated, use 'qti-orientation-horizontal' or 'qti-orientation-vertical' instead */
155
- orientation: Orientation;
156
- render(): lit.TemplateResult<1>;
157
- }
158
- declare global {
159
- interface HTMLElementTagNameMap {
160
- 'qti-choice-interaction': QtiChoiceInteraction;
161
- }
162
- }
163
-
164
- /**
165
- * QTI Custom Interaction component for legacy CES-based interactions.
166
- *
167
- * This component implements support for custom interactions originally built for the CES
168
- * (Custom Element Standard) player - the predecessor to FACET and the Trifork QTI Player.
169
- *
170
- * @remarks
171
- * The interaction workflow:
172
- * 1. Fetch the CI manifest (JSON file with script, style, media references)
173
- * 2. Check if bootstrap.js uses the CES API
174
- * 3. If CES is used:
175
- * - Fetch index.html from main window (where service worker/fetch works)
176
- * - Inject registerCES proxy script for postMessage-based communication
177
- * - Create blob URL and pass it to ciBootstrap
178
- * 4. Create pciContainer iframe with style and bootstrap script
179
- * 5. Handle postMessage events for getMedia, getResponse, setResponse, getBlobUrl
180
- *
181
- * The postMessage bridge is necessary because:
182
- * - Iframes created via document.write() have about:blank origin
183
- * - They cannot access the parent's global CES object (cross-origin)
184
- * - Service workers don't control about:blank documents
185
- *
186
- * Messages are sent to all parent windows to support embedding scenarios like Storybook
187
- * where window.top might not be the actual host application.
188
- */
189
- declare class QtiCustomInteraction extends Interaction {
190
- #private;
191
- static styles: CSSResultGroup;
192
- constructor();
193
- data: string;
194
- baseItemUrl: string;
195
- baseRefUrl: string;
196
- id: string;
197
- private _errorMessage;
198
- manifest: {
199
- script: string[];
200
- style: string[];
201
- media: string[];
202
- };
203
- connectedCallback(): void;
204
- /**
205
- * Sets up the CES custom interaction by creating the iframe structure and
206
- * handling the CES API communication via postMessage.
207
- *
208
- * For interactions that use CES, this method:
209
- * 1. Fetches the original bootstrap.js and checks if it uses CES
210
- * 2. If CES is used, fetches index.html and injects the registerCES proxy
211
- * 3. Creates a blob URL for the modified HTML (stored in _contentBlobUrl)
212
- * 4. Replaces bootstrap.js with ciBootstrap that loads the blob URL
213
- * 5. Sets up postMessage listeners for CES API calls
214
- */
215
- setupCES(): Promise<void>;
216
- handlePostMessage(event: MessageEvent): void;
217
- validate(): boolean;
218
- get response(): string | string[] | null;
219
- set response(val: string | string[] | null);
220
- disconnectedCallback(): void;
221
- render(): lit.TemplateResult<1>;
222
- }
223
- declare global {
224
- interface HTMLElementTagNameMap {
225
- 'qti-custom-interaction': QtiCustomInteraction;
226
- }
227
- }
228
-
229
- declare class QtiEndAttemptInteraction extends LitElement {
230
- static styles: CSSResultGroup;
231
- responseIdentifier: string;
232
- disabled: boolean;
233
- /** Defines the number of attempts that a user can make using the 'endAttemptInteraction' mechanism (this can be used to limit the number of hints, etc.). [More information](https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/index.html#DataCharacteristic_EndAttemptInteraction.Attr_count-attempt) */
234
- countAttempt: 'true' | 'false' | null;
235
- title: string;
236
- render(): lit.TemplateResult<1>;
237
- endAttempt(_: Event): void;
238
- }
239
- declare global {
240
- interface HTMLElementTagNameMap {
241
- 'qti-end-attempt-interaction': QtiEndAttemptInteraction;
242
- }
243
- }
244
-
245
- declare class QtiExtendedTextInteraction extends Interaction {
246
- static styles: CSSResultGroup;
247
- protected _rows: number;
248
- /** expected length is mapped to the property maxlength on the textarea */
249
- expectedLength: number;
250
- patternMask: string;
251
- /** text appearing in the extended-text-interaction if it is empty */
252
- placeholderText: string;
253
- dataPatternmaskMessage: string;
254
- classNames: string;
255
- handleclassNamesChange(_: any, classes: string): void;
256
- response: string | null;
257
- protected _handleResponseChange: () => void;
258
- get value(): string | null;
259
- set value(val: string | null);
260
- validate(): boolean;
261
- toggleCorrectResponse(): void;
262
- reportValidity(): boolean;
263
- render(): lit.TemplateResult<1>;
264
- protected textChanged(event: Event): void;
265
- protected setEmptyAttribute(text: string): void;
266
- }
267
- declare global {
268
- interface HTMLElementTagNameMap {
269
- 'qti-extended-text-interaction': QtiExtendedTextInteraction;
270
- }
271
- }
272
-
273
- declare const QtiGapMatchInteraction_base: (abstract new (...args: any[]) => DragDropSlottedSortable) & (abstract new (...args: any[]) => DragDropSlotted) & typeof Interaction;
274
- declare class QtiGapMatchInteraction extends QtiGapMatchInteraction_base {
275
- #private;
276
- static styles: CSSResultGroup;
277
- render(): lit.TemplateResult<1>;
278
- toggleCorrectResponse(show: boolean): void;
279
- toggleCandidateCorrection(show: boolean): void;
280
- }
281
- declare global {
282
- interface HTMLElementTagNameMap {
283
- 'qti-gap-match-interaction': QtiGapMatchInteraction;
284
- }
285
- }
286
-
287
- declare class QtiGraphicAssociateInteraction extends Interaction {
288
- #private;
289
- static styles: CSSResultGroup;
290
- private _correctLines;
291
- private startCoord;
292
- private mouseCoord;
293
- grImage: any[];
294
- private _response;
295
- constructor();
296
- reset(): void;
297
- validate(): boolean;
298
- set response(val: string[]);
299
- get response(): string[];
300
- toggleInternalCorrectResponse(show: boolean): void;
301
- render(): lit.TemplateResult<1>;
302
- firstUpdated(): void;
303
- disconnectedCallback(): void;
304
- }
305
- declare global {
306
- interface HTMLElementTagNameMap {
307
- 'qti-graphic-associate-interaction': QtiGraphicAssociateInteraction;
308
- }
309
- }
310
-
311
- declare const QtiGraphicGapMatchInteraction_base: (abstract new (...args: any[]) => DragDropSlottedSortable) & (abstract new (...args: any[]) => DragDropSlotted) & typeof Interaction;
312
- declare class QtiGraphicGapMatchInteraction extends QtiGraphicGapMatchInteraction_base {
313
- #private;
314
- static styles: CSSResultGroup;
315
- render(): lit.TemplateResult<1>;
316
- shouldReturnToInventoryOnInventoryDrop(): boolean;
317
- connectedCallback(): void;
318
- disconnectedCallback(): void;
319
- }
320
- declare global {
321
- interface HTMLElementTagNameMap {
322
- 'qti-graphic-gap-match-interaction': QtiGraphicGapMatchInteraction;
323
- }
324
- }
325
-
326
- declare const QtiGraphicOrderInteraction_base: (abstract new (...args: any[]) => ChoicesInterface) & typeof Interaction;
327
- declare class QtiGraphicOrderInteraction extends QtiGraphicOrderInteraction_base {
328
- #private;
329
- static styles: CSSResultGroup;
330
- protected choiceOrdering: boolean;
331
- protected _choiceElements: Choice[];
332
- render(): lit.TemplateResult<1>;
333
- toggleCorrectResponse(show: boolean): void;
334
- connectedCallback(): void;
335
- disconnectedCallback(): void;
336
- }
337
- declare global {
338
- interface HTMLElementTagNameMap {
339
- 'qti-graphic-order-interaction': QtiGraphicOrderInteraction;
340
- }
341
- }
342
-
343
- declare const QtiHotspotInteraction_base: (abstract new (...args: any[]) => ChoicesInterface) & typeof Interaction;
344
- declare class QtiHotspotInteraction extends QtiHotspotInteraction_base {
345
- #private;
346
- static styles: CSSResultGroup;
347
- render(): lit.TemplateResult<1>;
348
- connectedCallback(): void;
349
- disconnectedCallback(): void;
350
- }
351
- declare global {
352
- interface HTMLElementTagNameMap {
353
- 'qti-hotspot-interaction': QtiHotspotInteraction;
354
- }
355
- }
356
-
357
- declare const QtiHottextInteraction_base: (abstract new (...args: any[]) => ChoicesInterface) & typeof Interaction;
358
- declare class QtiHottextInteraction extends QtiHottextInteraction_base {
359
- #private;
360
- static styles: CSSResultGroup;
361
- class: string;
362
- render: () => lit.TemplateResult<1>;
363
- connectedCallback(): void;
364
- updated(_changedProperties: PropertyValues): void;
365
- }
366
-
367
- interface OptionType {
368
- content: string | Node[];
369
- value: string;
370
- selected: boolean;
371
- }
372
- declare class QtiInlineChoiceInteraction extends Interaction {
373
- #private;
374
- constructor();
375
- get isInline(): boolean;
376
- static get styles(): lit.CSSResultGroup[];
377
- protected options: OptionType[];
378
- protected correctOption: any;
379
- protected _dropdownOpen: boolean;
380
- private _slotObserver;
381
- private readonly _menuId;
382
- configContext: ConfigContext;
383
- render(): lit.TemplateResult<1>;
384
- connectedCallback(): Promise<void>;
385
- disconnectedCallback(): void;
386
- willUpdate(changed: PropertyValues<this>): void;
387
- updated(changed: PropertyValues<this>): void;
388
- validate(): boolean;
389
- reset(): void;
390
- set response(value: string | null);
391
- get response(): string | null;
392
- toggleInternalCorrectResponse(show: boolean): void;
393
- }
394
- declare global {
395
- interface HTMLElementTagNameMap {
396
- 'qti-inline-choice-interaction': QtiInlineChoiceInteraction;
397
- }
398
- }
399
-
400
- declare const QtiSimpleAssociableChoice_base: (abstract new (...args: any[]) => ActiveElementMixinInterface) & typeof LitElement;
401
- declare class QtiSimpleAssociableChoice extends QtiSimpleAssociableChoice_base {
402
- static styles: CSSResultGroup;
403
- /** the minimal number of selections a candidate must make */
404
- matchMin: number;
405
- /** the maximum number of selections a candidate must make, the other options will be disabled when max options is checked */
406
- matchMax: number;
407
- fixed: boolean;
408
- connectedCallback(): void;
409
- render(): lit.TemplateResult<1>;
410
- }
411
- declare global {
412
- interface HTMLElementTagNameMap {
413
- 'qti-simple-associable-choice': QtiSimpleAssociableChoice;
414
- }
415
- }
416
-
417
- declare const QtiMatchInteraction_base: (abstract new (...args: any[]) => DragDropSlottedSortable) & (abstract new (...args: any[]) => DragDropSlotted) & typeof Interaction;
418
- declare class QtiMatchInteraction extends QtiMatchInteraction_base {
419
- #private;
420
- static styles: CSSResultGroup;
421
- protected sourceChoices: QtiSimpleAssociableChoice[];
422
- protected targetChoices: QtiSimpleAssociableChoice[];
423
- protected lastCheckedRadio: HTMLInputElement | null;
424
- class: string;
425
- protected _response: string | string[];
426
- get response(): string[];
427
- set response(val: string[]);
428
- responseIdentifier: string;
429
- protected correctOptions: {
430
- source: string;
431
- target: string;
432
- }[];
433
- connectedCallback(): Promise<void>;
434
- protected handleRadioClick: (e: {
435
- target: HTMLInputElement;
436
- }) => void;
437
- protected handleRadioChange: (e: {
438
- target: any;
439
- }) => void;
440
- validate(): boolean;
441
- toggleInternalCorrectResponse(show: boolean): void;
442
- toggleCandidateCorrection(show: boolean): void;
443
- render(): lit.TemplateResult<1>;
444
- }
445
- declare global {
446
- interface HTMLElementTagNameMap {
447
- 'qti-match-interaction': QtiMatchInteraction;
448
- }
449
- }
450
-
451
- declare class QtiMediaInteraction extends Interaction {
452
- #private;
453
- static styles: CSSResultGroup;
454
- reset(): void;
455
- validate(): boolean;
456
- get response(): string | null;
457
- set response(val: string | null);
458
- static get properties(): {
459
- step: {
460
- type: NumberConstructor;
461
- attribute: string;
462
- default: number;
463
- };
464
- };
465
- render(): lit.TemplateResult<1>;
466
- constructor();
467
- connectedCallback(): void;
468
- }
469
- declare global {
470
- interface HTMLElementTagNameMap {
471
- 'qti-media-interaction': QtiMediaInteraction;
472
- }
473
- }
474
-
475
- declare const QtiOrderInteraction_base: (abstract new (...args: any[]) => DragDropSlottedSortable) & (abstract new (...args: any[]) => DragDropSlotted) & typeof Interaction;
476
- declare class QtiOrderInteraction extends QtiOrderInteraction_base {
477
- #private;
478
- static styles: lit.CSSResult;
479
- protected childrenMap: Element[];
480
- protected nrChoices: number;
481
- correctResponses: string[];
482
- showCorrectResponses: boolean;
483
- /** orientation of choices */
484
- orientation: 'horizontal' | 'vertical';
485
- render(): lit.TemplateResult<1>;
486
- toggleCorrectResponse(show: boolean): void;
487
- toggleCandidateCorrection(show: boolean): void;
488
- getValue(val: string[]): string[];
489
- protected getResponse(): string[];
490
- shouldTreatBlockedMaxAsInvalid(): boolean;
491
- firstUpdated(): Promise<void>;
492
- }
493
- declare global {
494
- interface HTMLElementTagNameMap {
495
- 'qti-order-interaction': QtiOrderInteraction;
496
- }
497
- }
498
-
499
- /**
500
- * QTI base-type `file` representation.
501
- */
502
- type QtiFileData = {
503
- data: string;
504
- mime: string;
505
- name?: string;
506
- };
507
- type QtiBaseBoolean = boolean;
508
- type QtiBaseInteger = number;
509
- type QtiBaseFloat = number;
510
- type QtiBaseString = string;
511
- type QtiBasePoint = [number, number];
512
- type QtiBasePair = [string, string];
513
- type QtiBaseDirectedPair = [string, string];
514
- type QtiBaseDuration = string;
515
- type QtiBaseFile = QtiFileData;
516
- type QtiBaseUri = string;
517
- type QtiBaseIntOrIdentifier = number | string;
518
- type QtiBaseIdentifier = string;
519
- /**
520
- * A QTI record entry for `record` cardinality values.
521
- */
522
- type QtiRecordItem = {
523
- name: string;
524
- base?: QtiBaseTypeJSON | null;
525
- list?: QtiListTypeJSON | null;
526
- };
527
- type ResponseVariableType = QtiVariableJSON;
528
- /**
529
- * QTI Appendix-C style JSON representation for base cardinality.
530
- */
531
- type QtiBaseTypeJSON = {
532
- boolean?: QtiBaseBoolean;
533
- integer?: QtiBaseInteger;
534
- float?: QtiBaseFloat;
535
- string?: QtiBaseString;
536
- point?: QtiBasePoint;
537
- pair?: QtiBasePair;
538
- directedPair?: QtiBaseDirectedPair;
539
- duration?: QtiBaseDuration;
540
- file?: QtiBaseFile;
541
- uri?: QtiBaseUri;
542
- intOrIdentifier?: QtiBaseIntOrIdentifier;
543
- identifier?: QtiBaseIdentifier;
544
- } | null;
545
- /**
546
- * QTI Appendix-C style JSON representation for list cardinality.
547
- */
548
- type QtiListTypeJSON = {
549
- boolean?: QtiBaseBoolean[];
550
- integer?: QtiBaseInteger[];
551
- float?: QtiBaseFloat[];
552
- string?: QtiBaseString[];
553
- point?: QtiBasePoint[];
554
- pair?: QtiBasePair[];
555
- directedPair?: QtiBaseDirectedPair[];
556
- duration?: QtiBaseDuration[];
557
- file?: QtiBaseFile[];
558
- uri?: QtiBaseUri[];
559
- intOrIdentifier?: QtiBaseIntOrIdentifier[];
560
- identifier?: QtiBaseIdentifier[];
561
- } | null;
562
- /**
563
- * Complete QTI variable JSON envelope used by PCI bridge messaging.
564
- */
565
- declare type QtiVariableJSON = {
566
- base?: QtiBaseTypeJSON;
567
- list?: QtiListTypeJSON;
568
- record?: QtiRecordItem[] | null;
569
- };
570
-
571
- declare class QtiPortableCustomInteraction extends Interaction {
572
- #private;
573
- protected _iframeLoaded: boolean;
574
- protected _pendingMessages: Array<{
575
- method: string;
576
- params: any;
577
- }>;
578
- protected iframe: HTMLIFrameElement;
579
- protected _iframeMessageOrigin: string | null;
580
- private _iframeObjectUrl;
581
- static styles: CSSResultGroup;
582
- module: string;
583
- customInteractionTypeIdentifier: string;
584
- requirePathsJson: string;
585
- requireShimJson: string;
586
- requireJsUrl: string;
587
- baseUrl: string;
588
- useDefaultPaths: boolean;
589
- private _errorMessage;
590
- protected context?: ItemContext;
591
- protected qtiContext?: QtiContext;
592
- response: string | string[] | null;
593
- /**
594
- * Get direct child elements by tag name
595
- */
596
- private getDirectChildrenByTag;
597
- /**
598
- * Coerce a scalar value to the expected base-type when possible
599
- */
600
- private coerceBaseValue;
601
- /**
602
- * Normalize an input into a list form
603
- */
604
- private normalizeListValue;
605
- /**
606
- * Convert a variable value to QtiVariableJSON
607
- */
608
- private variableToQtiVariableJSON;
609
- /**
610
- * Convert a record object into QtiVariableJSON
611
- */
612
- private recordToQtiVariableJSON;
613
- /**
614
- * Build a record entry from an arbitrary value
615
- */
616
- private recordEntryFromValue;
617
- /**
618
- * Extract default QTI_CONTEXT values from qti-context-declaration elements
619
- */
620
- private getQtiContextDefaultsFromItem;
621
- /**
622
- * Build a QTI_CONTEXT record for PCI consumption
623
- */
624
- private getQtiContextRecord;
625
- /**
626
- * Collect template variables referenced by qti-template-variable children
627
- */
628
- private getTemplateVariables;
629
- /**
630
- * Collect context variables referenced by qti-context-variable children
631
- */
632
- private getContextVariables;
633
- /**
634
- * Converts response variables to QtiVariableJSON
635
- */
636
- protected responseVariablesToQtiVariableJSON(input: string | string[], cardinality: Cardinality, baseType: BaseType): QtiVariableJSON;
637
- validate(): boolean;
638
- set value(v: string | null);
639
- get value(): string | null;
640
- set boundTo(newValue: Record<string, ResponseVariableType>);
641
- get boundTo(): Record<string, QtiVariableJSON>;
642
- disconnectedCallback(): void;
643
- /**
644
- * IFRAME MODE: Send message to iframe
645
- */
646
- protected sendMessageToIframe(method: string, params: any): void;
647
- /**
648
- * IFRAME MODE: Handle iframe messages
649
- */
650
- protected handleIframeMessage: (event: MessageEvent) => void;
651
- /**
652
- * IFRAME MODE: Create iframe element
653
- */
654
- protected createIframe(): void;
655
- connectedCallback(): void;
656
- /**
657
- * IFRAME MODE: Generate iframe HTML content
658
- */
659
- protected generateIframeContent(): string;
660
- /**
661
- * Toggle the display of the correct response
662
- * @param responseVariable The response variable containing the correct response
663
- * @param show Whether to show or hide the correct response
664
- */
665
- toggleInternalCorrectResponse(show: boolean): void;
666
- /**
667
- * Method to disable the PCI for review mode
668
- * This can be used when showing the correct response
669
- */
670
- disable(): void;
671
- /**
672
- * Method to enable the PCI for interactive mode
673
- */
674
- enable(): void;
675
- render(): lit.TemplateResult<1>;
676
- }
677
- declare global {
678
- interface HTMLElementTagNameMap {
679
- 'qti-portable-custom-interaction': QtiPortableCustomInteraction;
680
- }
681
- }
682
-
683
- declare class QtiPositionObjectInteraction extends LitElement {
684
- static styles: CSSResultGroup;
685
- render(): lit.TemplateResult<1>;
686
- }
687
-
688
- declare class QtiPositionObjectStage extends LitElement {
689
- static styles: CSSResultGroup;
690
- choiceOrdering: boolean;
691
- startX: any;
692
- startY: any;
693
- dragElement: any;
694
- render(): lit.TemplateResult<1>;
695
- constructor();
696
- dragElementHandler(event: MouseEvent): void;
697
- firstUpdated(a: PropertyValueMap<any>): void;
698
- removeMoveListener(): void;
699
- disconnectedCallback(): void;
700
- }
701
- declare global {
702
- interface HTMLElementTagNameMap {
703
- 'qti-position-object-stage': QtiPositionObjectStage;
704
- }
705
- }
706
-
707
- declare class QtiSelectPointInteraction extends Interaction {
708
- #private;
709
- static styles: CSSResultGroup;
710
- maxChoices: number;
711
- minChoices: number;
712
- response: string[] | null;
713
- private _correctAreas;
714
- private _responseCorrection;
715
- connectedCallback(): void;
716
- get responsePoints(): {
717
- x: number;
718
- y: number;
719
- }[];
720
- toggleCandidateCorrection(show: boolean): void;
721
- toggleCorrectResponse(show: boolean): any;
722
- updated(changedProperties: Map<string | number | symbol, unknown>): void;
723
- render(): lit.TemplateResult<1>;
724
- validate(): boolean;
725
- firstUpdated(): void;
726
- disconnectedCallback(): void;
727
- }
728
- declare global {
729
- interface HTMLElementTagNameMap {
730
- 'qti-select-point-interaction': QtiSelectPointInteraction;
731
- }
732
- }
733
-
734
- declare class QtiSliderInteraction extends Interaction {
735
- #private;
736
- static styles: CSSResultGroup;
737
- private _rail;
738
- min: number;
739
- max: number;
740
- step: number;
741
- validate(): boolean;
742
- connectedCallback(): void;
743
- get response(): string;
744
- set response(val: string);
745
- toggleCorrectResponse(show: boolean): void;
746
- render(): lit.TemplateResult<1>;
747
- }
748
- declare global {
749
- interface HTMLElementTagNameMap {
750
- 'qti-slider-interaction': QtiSliderInteraction;
751
- }
752
- }
753
-
754
- declare class QtiTextEntryInteraction extends Interaction {
755
- #private;
756
- static styles: CSSResultGroup;
757
- inputRef: lit_directives_ref_js.Ref<HTMLInputElement>;
758
- expectedLength: number;
759
- patternMask: string;
760
- placeholderText: string;
761
- dataPatternmaskMessage: string;
762
- response: string | null;
763
- private _input;
764
- protected _handleValueChange: () => void;
765
- get value(): string | null;
766
- set value(val: string | null);
767
- get correctness(): Readonly<Correctness | null>;
768
- get isInline(): boolean;
769
- validate(): boolean;
770
- toggleInternalCorrectResponse(show: boolean): void;
771
- render(): lit.TemplateResult<1>;
772
- protected textChanged(event: Event): void;
773
- reportValidity(): boolean;
774
- reset(): void;
775
- }
776
- declare global {
777
- interface HTMLElementTagNameMap {
778
- 'qti-text-entry-interaction': QtiTextEntryInteraction;
779
- }
780
- }
781
-
782
- declare class QtiUploadInteraction extends Interaction {
783
- #private;
784
- static styles: CSSResultGroup;
785
- reset(): void;
786
- validate(): boolean;
787
- get response(): string | null;
788
- set response(base64: string | null);
789
- static get properties(): {
790
- [key: string]: lit.PropertyDeclaration<unknown, unknown>;
791
- };
792
- render(): lit.TemplateResult<1>;
793
- }
794
- declare global {
795
- interface HTMLElementTagNameMap {
796
- 'qti-upload-interaction': QtiUploadInteraction;
797
- }
798
- }
799
-
800
- declare class QtiGapImg extends LitElement {
801
- static styles: CSSResultGroup;
802
- tabindex: number | undefined;
803
- connectedCallback(): void;
804
- }
805
- declare global {
806
- interface HTMLElementTagNameMap {
807
- 'qti-gap-img': QtiGapImg;
808
- }
809
- }
810
-
811
- declare const QtiGapText_base: (abstract new (...args: any[]) => ActiveElementMixinInterface) & typeof LitElement;
812
- declare class QtiGapText extends QtiGapText_base {
813
- static styles: CSSResultGroup;
814
- tabindex: number | undefined;
815
- connectedCallback(): void;
816
- render(): lit.TemplateResult<1>;
817
- }
818
- declare global {
819
- interface HTMLElementTagNameMap {
820
- 'qti-gap-text': QtiGapText;
821
- }
822
- }
823
-
824
- declare class QtiGap extends LitElement {
825
- static styles: CSSResultGroup;
826
- tabindex: number | undefined;
827
- render(): lit.TemplateResult<1>;
828
- }
829
- declare global {
830
- interface HTMLElementTagNameMap {
831
- 'qti-gap': QtiGap;
832
- }
833
- }
834
-
835
- declare const QtiInlineChoice_base: (abstract new (...args: any[]) => ActiveElementMixinInterface) & typeof LitElement;
836
- declare class QtiInlineChoice extends QtiInlineChoice_base {
837
- #private;
838
- static styles: CSSResultGroup;
839
- identifier: string;
840
- connectedCallback(): void;
841
- disconnectedCallback(): void;
842
- render(): lit.TemplateResult<1>;
843
- }
844
- declare global {
845
- interface HTMLElementTagNameMap {
846
- 'qti-inline-choice': QtiInlineChoice;
847
- }
848
- }
849
-
850
- declare const QtiHottext_base: (abstract new (...args: any[]) => ActiveElementMixinInterface) & typeof LitElement;
851
- declare class QtiHottext extends QtiHottext_base {
852
- static styles: CSSResultGroup;
853
- render(): lit.TemplateResult<1>;
854
- }
855
- declare global {
856
- interface HTMLElementTagNameMap {
857
- 'qti-hottext': QtiHottext;
858
- }
859
- }
860
-
861
- declare const QtiSimpleChoice_base: (abstract new (...args: any[]) => ActiveElementMixinInterface) & typeof LitElement;
862
- /**
863
- * qti-order-interaction
864
- * qti-choice-interaction
865
- */
866
- declare class QtiSimpleChoice extends QtiSimpleChoice_base {
867
- static styles: CSSResultGroup;
868
- templateIdentifier: string | null;
869
- showHide: string | null;
870
- fixed: boolean;
871
- marker: string;
872
- get checked(): boolean;
873
- render(): lit.TemplateResult<1>;
874
- }
875
- declare global {
876
- interface HTMLElementTagNameMap {
877
- 'qti-simple-choice': QtiSimpleChoice;
878
- }
879
- }
880
-
881
- declare const QtiHotspotChoice_base: (abstract new (...args: any[]) => ActiveElementMixinInterface) & typeof LitElement;
882
- declare class QtiHotspotChoice extends QtiHotspotChoice_base {
883
- static styles: CSSResultGroup;
884
- order: number;
885
- orderCorrect: number;
886
- }
887
- declare global {
888
- interface HTMLElementTagNameMap {
889
- 'qti-hotspot-choice': QtiHotspotChoice;
890
- }
891
- }
892
-
893
- declare class QtiAssociableHotspot extends LitElement {
894
- static styles: CSSResultGroup;
895
- connectedCallback(): void;
896
- render(): lit.TemplateResult<1>;
897
- }
898
- declare global {
899
- interface HTMLElementTagNameMap {
900
- 'qti-associable-hotspot': QtiAssociableHotspot;
901
- }
902
- }
903
-
904
- declare class QtiPrompt extends LitElement {
905
- static styles: CSSResultGroup;
906
- render(): lit.TemplateResult<1>;
907
- connectedCallback(): void;
908
- }
909
- declare global {
910
- interface HTMLElementTagNameMap {
911
- 'qti-prompt': QtiPrompt;
912
- }
913
- }
914
-
915
- export { type Orientation, QtiAssociableHotspot, QtiAssociateInteraction, QtiChoiceInteraction, QtiCustomInteraction, QtiEndAttemptInteraction, QtiExtendedTextInteraction, QtiGap, QtiGapImg, QtiGapMatchInteraction, QtiGapText, QtiGraphicAssociateInteraction, QtiGraphicGapMatchInteraction, QtiGraphicOrderInteraction, QtiHotspotChoice, QtiHotspotInteraction, QtiHottext, QtiHottextInteraction, QtiInlineChoice, QtiInlineChoiceInteraction, QtiMatchInteraction, QtiMediaInteraction, QtiOrderInteraction, QtiPortableCustomInteraction, QtiPositionObjectInteraction, QtiPositionObjectStage, QtiPrompt, QtiSelectPointInteraction, QtiSimpleAssociableChoice, QtiSimpleChoice, QtiSliderInteraction, QtiTextEntryInteraction, QtiUploadInteraction };
1
+ export * from '@qti-components/interactions';