@citolab/qti-components 10.0.0-next.15 → 10.0.0-next.16

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 (62) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +1535 -2737
  3. package/dist/base.d.ts +31 -7
  4. package/dist/base.js +7 -1
  5. package/dist/{chunk-IWNRQVNW.js → chunk-4DC5Z2LQ.js} +2 -2
  6. package/dist/{chunk-G2EIC7H2.js → chunk-7MYZHZWV.js} +955 -364
  7. package/dist/chunk-7MYZHZWV.js.map +1 -0
  8. package/dist/{chunk-URYYGVTA.js → chunk-H3Z3TMFB.js} +55 -60
  9. package/dist/chunk-H3Z3TMFB.js.map +1 -0
  10. package/dist/{chunk-F553IZPL.js → chunk-J3F3JSCW.js} +2 -2
  11. package/dist/{chunk-32PI7KWX.js → chunk-L3LBSAGZ.js} +2 -2
  12. package/dist/{chunk-WIUPAUJV.js → chunk-L7J2ZOJL.js} +2 -2
  13. package/dist/{chunk-MIQZBDTB.js → chunk-LQ65RILE.js} +140 -105
  14. package/dist/chunk-LQ65RILE.js.map +1 -0
  15. package/dist/{chunk-QT7WQXCS.js → chunk-M4TZIB3W.js} +33 -37
  16. package/dist/chunk-M4TZIB3W.js.map +1 -0
  17. package/dist/{chunk-HT3LSWXL.js → chunk-NWSDBYK7.js} +2 -2
  18. package/dist/{chunk-IM5AKPIJ.js → chunk-NZ7ZC4SP.js} +96 -4
  19. package/dist/chunk-NZ7ZC4SP.js.map +1 -0
  20. package/dist/{chunk-XY5DHYIH.js → chunk-OG5HIRHE.js} +3 -3
  21. package/dist/{chunk-5AJZGRWI.js → chunk-UDJ7MHLF.js} +4 -4
  22. package/dist/chunk-UDJ7MHLF.js.map +1 -0
  23. package/dist/chunk-WWY2H2YO.js +7 -0
  24. package/dist/chunk-WWY2H2YO.js.map +1 -0
  25. package/dist/{computed.types.d-IXACuBr7.d.ts → computed.types.d-n3K2VvB0.d.ts} +2 -2
  26. package/dist/corrections.d.ts +117 -13
  27. package/dist/corrections.js +8 -8
  28. package/dist/elements.d.ts +44 -21
  29. package/dist/elements.js +3 -3
  30. package/dist/index.d.ts +8 -8
  31. package/dist/index.js +19 -13
  32. package/dist/interactions.d.ts +82 -16
  33. package/dist/interactions.js +3 -3
  34. package/dist/item.css +1057 -2383
  35. package/dist/item.d.ts +3 -3
  36. package/dist/item.js +4 -4
  37. package/dist/loader.d.ts +1 -1
  38. package/dist/processing.js +3 -3
  39. package/dist/qti-components-jsx.d.ts +1198 -201
  40. package/dist/{qti-feedback.d-GAqMqAt6.d.ts → qti-feedback.d-1JL_qHjc.d.ts} +1 -1
  41. package/dist/{qti-item.d-pFcNk0th.d.ts → qti-item.d-DDMDjWIk.d.ts} +1 -1
  42. package/dist/{qti-test.d-BjhVQnQy.d.ts → qti-test.d-CDdyCp6e.d.ts} +19 -16
  43. package/dist/{qti-text-entry-interaction.d-DECzpIzi.d.ts → qti-text-entry-interaction.d-BTAKmr4b.d.ts} +142 -42
  44. package/dist/{record.d-CljDLwRz.d.ts → record.d-Bojj6_LW.d.ts} +33 -2
  45. package/dist/{session.context.d-DW09Lrie.d.ts → session.context.d-BNxGeyh9.d.ts} +1 -1
  46. package/dist/test.d.ts +7 -7
  47. package/dist/test.js +5 -5
  48. package/package.json +9 -9
  49. package/dist/chunk-5AJZGRWI.js.map +0 -1
  50. package/dist/chunk-G2EIC7H2.js.map +0 -1
  51. package/dist/chunk-IM5AKPIJ.js.map +0 -1
  52. package/dist/chunk-MIQZBDTB.js.map +0 -1
  53. package/dist/chunk-QT7WQXCS.js.map +0 -1
  54. package/dist/chunk-RNLSNH4N.js +0 -7
  55. package/dist/chunk-RNLSNH4N.js.map +0 -1
  56. package/dist/chunk-URYYGVTA.js.map +0 -1
  57. /package/dist/{chunk-IWNRQVNW.js.map → chunk-4DC5Z2LQ.js.map} +0 -0
  58. /package/dist/{chunk-F553IZPL.js.map → chunk-J3F3JSCW.js.map} +0 -0
  59. /package/dist/{chunk-32PI7KWX.js.map → chunk-L3LBSAGZ.js.map} +0 -0
  60. /package/dist/{chunk-WIUPAUJV.js.map → chunk-L7J2ZOJL.js.map} +0 -0
  61. /package/dist/{chunk-HT3LSWXL.js.map → chunk-NWSDBYK7.js.map} +0 -0
  62. /package/dist/{chunk-XY5DHYIH.js.map → chunk-OG5HIRHE.js.map} +0 -0
@@ -18,7 +18,7 @@ declare abstract class QtiFeedback extends LitElement {
18
18
  checkShowFeedback(outcomeIdentifier: string): void;
19
19
  /**
20
20
  * Called when this feedback is about to show. Return `false` to keep it hidden: the host shows the
21
- * content itself. The elements dispatch `cito-feedback-show` here.
21
+ * content itself. The elements dispatch `qc-feedback-show` here.
22
22
  */
23
23
  protected feedbackShowing(): boolean;
24
24
  /** Called when this feedback is about to hide. Return `false` to keep it showing: the host hides it itself. */
@@ -1,7 +1,7 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement } from 'lit';
3
3
  import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
4
- import { C as ComputedItemContext, V as View } from './session.context.d-DW09Lrie.js';
4
+ import { C as ComputedItemContext, V as View } from './session.context.d-BNxGeyh9.js';
5
5
  import { C as ConfigContext } from './config.context.d-CCqlJXpE.js';
6
6
  import { QtiAssessmentItem } from './elements.js';
7
7
 
@@ -1,13 +1,13 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
3
3
  import { b as transformTestApi, t as transformItemApi } from './qti-transform-test.d-Bb9vnLzP.js';
4
- import { C as ComputedContext, a as ComputedItem } from './computed.types.d-IXACuBr7.js';
4
+ import { C as ComputedContext, a as ComputedItem } from './computed.types.d-n3K2VvB0.js';
5
5
  import { QtiAssessmentItem, QtiModalFeedback } from './elements.js';
6
6
  import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
7
7
  import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-B-Cfbqlb.js';
8
8
  import { TemplateFunction } from '@heximal/templates';
9
9
  import { h as VariableValue, b as ItemContext, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-DuVR0ZVK.js';
10
- import { S as SessionContext, V as View } from './session.context.d-DW09Lrie.js';
10
+ import { S as SessionContext, V as View } from './session.context.d-BNxGeyh9.js';
11
11
  import { C as ConfigContext } from './config.context.d-CCqlJXpE.js';
12
12
  import { b as QtiRuleBase } from './qti-rule-base.d-CeKP0Ooi.js';
13
13
 
@@ -27,7 +27,7 @@ declare global {
27
27
  }
28
28
  declare module '../../public-events' {
29
29
  interface PublicEventMap {
30
- 'cito-test-loaded': CustomEvent<QtiAssessmentTest>;
30
+ 'qc-test-loaded': CustomEvent<QtiAssessmentTest>;
31
31
  }
32
32
  }
33
33
 
@@ -382,7 +382,7 @@ interface ITestNavigationMixin {
382
382
  /**
383
383
  * Everything a host needs to persist to resume a candidate's test session, and nothing else.
384
384
  *
385
- * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
385
+ * Read it from `qtiTest.state` or the `qc-test-state-changed` event, store it wherever you like —
386
386
  * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
387
387
  *
388
388
  * Deliberately not here:
@@ -435,11 +435,6 @@ interface QtiTestStateSession {
435
435
  navItemRefId?: string | null;
436
436
  }
437
437
 
438
- declare global {
439
- interface GlobalEventHandlersEventMap {
440
- 'qti-state-changed': CustomEvent<QtiTestState>;
441
- }
442
- }
443
438
  interface ITestStateMixin {
444
439
  /**
445
440
  * The candidate's persistable state: what they answered and where they are.
@@ -576,7 +571,7 @@ declare global {
576
571
 
577
572
  /**
578
573
  * A button that ends the attempt of an item: its response is processed, `numAttempts` goes up and
579
- * feedback is shown as the item's session control allows. It dispatches `cito-test-end-attempt`,
574
+ * feedback is shown as the item's session control allows. It dispatches `qc-test-end-attempt`,
580
575
  * which `<test-navigation>` handles.
581
576
  *
582
577
  * Put it inside `<test-navigation>`, either in the toolbar, where it ends the attempt of the item on
@@ -756,7 +751,7 @@ declare global {
756
751
 
757
752
  /**
758
753
  * Shows the test's state (`qtiTest.state`) as a tree you can fold open and shut, and keeps it current
759
- * on every `cito-test-state-changed`. A debug helper: drop it anywhere inside `<qti-test>`.
754
+ * on every `qc-test-state-changed`. A debug helper: drop it anywhere inside `<qti-test>`.
760
755
  *
761
756
  * The first two levels start open. A list entry with an `identifier` (an item, a variable) is labelled
762
757
  * by it. The element only lays out the tree; give it a font, colour and height from the page.
@@ -837,7 +832,7 @@ declare global {
837
832
 
838
833
  /**
839
834
  * Scores the test: on click the test resets its outcomes to their declared defaults, runs its
840
- * outcome processing and dispatches `cito-test-submitted`, after which the host reads the outcomes.
835
+ * outcome processing and dispatches `qc-test-submitted`, after which the host reads the outcomes.
841
836
  * The host decides where it sits, for example on the last item or in a review view.
842
837
  */
843
838
  declare class TestSubmit extends LitElement {
@@ -920,6 +915,8 @@ declare abstract class TtsButtonBase extends LitElement {
920
915
  */
921
916
  label?: string;
922
917
  protected _tts?: TtsContext;
918
+ /** Whether this control is a toggle that is on; mirrored as `:state(selected)`. A plain button never is. */
919
+ protected get selected(): boolean;
923
920
  updated(_changed: PropertyValues): void;
924
921
  }
925
922
  /**
@@ -940,7 +937,9 @@ declare abstract class TtsButtonBase extends LitElement {
940
937
  * The controller lays its controls out as a wrapping row; each control draws an icon button,
941
938
  * and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a
942
939
  * control with a slotted icon a `label`, since an icon has no text to name the button by. Buttons read the qti-theme tokens (with the theme's
943
- * defaults as fallbacks) and can be sized with `--test-button-size` and `--test-tts-icon-size`.
940
+ * defaults as fallbacks), are painted through the `--button-*` slots every button in the theme shares
941
+ * (`--test-button-*` still works as an alias), and can be sized with `--button-size` and
942
+ * `--test-tts-icon-size`.
944
943
  *
945
944
  * ### Language resolution
946
945
  *
@@ -1112,12 +1111,16 @@ declare class TestTtsNext extends TtsButtonBase {
1112
1111
  }
1113
1112
  /**
1114
1113
  * Pick button — toggles pick mode on the controller: every reading element is highlighted and
1115
- * a click on one of them starts reading from there. Reflects the mode as `:state(picking)`.
1114
+ * a click on one of them starts reading from there. Reflects the mode as `:state(picking)`, and,
1115
+ * being the toggle that switched it on, as `:state(selected)`, painted through
1116
+ * `--button-selected-background-color` / `--button-selected-color`.
1116
1117
  * @cssstate idle / playing / paused
1117
1118
  * @cssstate picking
1119
+ * @cssstate selected - This toggle is on: pick mode is active
1118
1120
  * @csspart button
1119
1121
  */
1120
1122
  declare class TestTtsPick extends TtsButtonBase {
1123
+ protected get selected(): boolean;
1121
1124
  render(): lit.TemplateResult<1>;
1122
1125
  }
1123
1126
  declare global {
@@ -1190,8 +1193,8 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
1190
1193
  * You can use normal class names to style the elements.
1191
1194
  * And you can use the `test-prev` and `test-next` elements to navigate through the test.
1192
1195
  *
1193
- * @event qti-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
1194
- * @event qti-test-context-updated - Deprecated: listen to `qti-state-changed` to persist a session. `detail` is the full test context, including declaration metadata and the answer key. Removed in the next major.
1196
+ * @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
1197
+ * @event qti-test-context-updated - Deprecated: listen to `qc-test-state-changed` to persist a session. `detail` is the full test context, including declaration metadata and the answer key. Removed in the next major.
1195
1198
  */
1196
1199
  declare class QtiTest extends QtiTest_base {
1197
1200
  constructor();
@@ -1,6 +1,6 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement, CSSResultGroup, PropertyValues } from 'lit';
3
- import { I as Interaction, b as RecordValue } from './record.d-CljDLwRz.js';
3
+ import { I as Interaction, c as ValidityTrigger, b as RecordValue } from './record.d-Bojj6_LW.js';
4
4
  import { V as ValidatableInteraction } from './interaction.interface.d-CvjHM2bi.js';
5
5
  import { C as ConfigContext } from './config.context.d-CCqlJXpE.js';
6
6
  import { B as BaseType, a as Cardinality, b as ItemContext, Q as QtiAreaMapEntry } from './item.types.d-DuVR0ZVK.js';
@@ -99,9 +99,21 @@ declare global {
99
99
  }
100
100
 
101
101
  declare const QtiHotspotChoice_base: (abstract new (...args: any[]) => ActiveElementMixinInterface) & typeof LitElement;
102
+ /**
103
+ * A clickable area on the image of `qti-hotspot-interaction` or `qti-graphic-order-interaction`.
104
+ *
105
+ * @customElement qti-hotspot-choice
106
+ * @cssstate checked - Chosen by the candidate.
107
+ * @cssstate disabled - Switched off by the interaction.
108
+ * @cssstate readonly - Frozen by the interaction.
109
+ * @attr {number} data-order - Graphic order: the 1-based position the candidate gave this choice.
110
+ * A theme prints it with `attr(data-order)`. Reflected from the `order` property; the old
111
+ * `aria-ordervalue` spelling (not an ARIA attribute) is written too for one major.
112
+ */
102
113
  declare class QtiHotspotChoice extends QtiHotspotChoice_base {
103
114
  static styles: CSSResultGroup;
104
115
  order: number;
116
+ protected updated(changed: PropertyValues<this>): void;
105
117
  }
106
118
  declare global {
107
119
  interface HTMLElementTagNameMap {
@@ -244,7 +256,7 @@ interface DragDropState {
244
256
  * Target identifier -> how many chips it holds for capacity purposes.
245
257
  *
246
258
  * Deliberately *not* `dragsByTarget[id].length`. Capacity counts
247
- * `max(draggablesSelector matches, [qti-draggable] matches)`, because a dropped clone may not
259
+ * `max(draggablesSelector matches, [data-draggable] matches)`, because a dropped clone may not
248
260
  * match the interaction's structural selector (match-interaction's nested choices do; a bare
249
261
  * clone elsewhere may only carry the attribute). Response serialisation uses the selector
250
262
  * only. Collapsing the two would silently change `matchMax` behaviour.
@@ -418,7 +430,7 @@ type DragDropCore = Interaction & {
418
430
  initiateDrag(dragElement: HTMLElement, startX: number, startY: number, inputType: 'mouse' | 'touch', eventSource?: 'pointer' | 'mouse' | 'touch', pointerId?: number, startedFromTrustedEvent?: boolean): void;
419
431
  createDragClone(element: HTMLElement, rect: DOMRect): HTMLElement;
420
432
  updateClonePosition(clientX: number, clientY: number): void;
421
- activateAllDroppables(): void;
433
+ activateAllDroppables(fromDroppable?: boolean): void;
422
434
  setupMoveObservables(inputType: 'mouse' | 'touch', eventSource?: 'pointer' | 'mouse' | 'touch'): void;
423
435
  };
424
436
  interface DragState {
@@ -455,7 +467,9 @@ type DragDropSlotted = DragDropCore & DropzoneAutoSize & {
455
467
  disableAnimations: boolean;
456
468
  enableFlipAnimations: boolean;
457
469
  validate(): boolean;
458
- reportValidity(): boolean;
470
+ reportValidity(options?: {
471
+ trigger?: ValidityTrigger;
472
+ }): boolean;
459
473
  reset(): void;
460
474
  saveResponse(value?: string | string[]): void;
461
475
  shouldTreatBlockedMaxAsInvalid(): boolean;
@@ -506,11 +520,15 @@ declare const QtiAssociateInteraction_base: (abstract new (...args: any[]) => Dr
506
520
  * @slot prompt - The prompt shown above the choices.
507
521
  * @slot qti-simple-associable-choice - The associable choice sources.
508
522
  *
509
- * @csspart drags - Wrapper around the associable choice slot.
523
+ * @csspart bank - The slot holding the unplaced chips (was `drags`).
510
524
  * @csspart drops - The container holding all drop targets.
511
- * @csspart drop-row - Container for one left/right drop pair.
512
- * @csspart drop - Each individual drop target.
525
+ * @csspart row - One left/right drop pair (was `drop-row`).
526
+ * @csspart drop - Each individual drop target. Tokens: `filled`, `full`, `drag-active`, `drag-over`
527
+ * (a plain div cannot carry `:state()`, so the state names are part tokens here).
513
528
  * @csspart message - Live validation message region (role="alert").
529
+ * @cssstate disabled - The interaction is switched off.
530
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
531
+ * @cssstate drag-active - A drag is in progress (was `dragzone-active`, `dragzone-enabled`).
514
532
  */
515
533
  declare class QtiAssociateInteraction extends QtiAssociateInteraction_base {
516
534
  #private;
@@ -565,8 +583,10 @@ declare const QtiChoiceInteraction_base: (abstract new (...args: any[]) => {}) &
565
583
  * @slot - Default slot for `qti-simple-choice` elements.
566
584
  *
567
585
  * @csspart prompt - Wrapper around the prompt slot.
568
- * @csspart slot - Wrapper around the default slot containing the choices.
586
+ * @csspart choices - The slot holding the choices (was `slot`).
569
587
  * @csspart message - Live validation message region (role="alert").
588
+ * @cssstate disabled - The interaction is switched off.
589
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
570
590
  */
571
591
  declare class QtiChoiceInteraction extends QtiChoiceInteraction_base implements ChoicesInterface {
572
592
  #private;
@@ -617,6 +637,9 @@ declare global {
617
637
  * @slot prompt - The prompt shown above the textarea.
618
638
  *
619
639
  * @csspart textarea - The textarea input element.
640
+ * @csspart message - The validation message, hidden until `reportValidity` shows it.
641
+ * @cssstate disabled - The interaction is switched off.
642
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
620
643
  */
621
644
  declare class QtiExtendedTextInteraction extends Interaction {
622
645
  #private;
@@ -649,7 +672,9 @@ declare class QtiExtendedTextInteraction extends Interaction {
649
672
  get value(): string | null;
650
673
  set value(val: string | null);
651
674
  validate(): boolean;
652
- reportValidity(): boolean;
675
+ reportValidity(options?: {
676
+ trigger?: ValidityTrigger;
677
+ }): boolean;
653
678
  /** The prompt, above the field. */
654
679
  protected renderPrompt(): unknown;
655
680
  /** The field itself. */
@@ -689,9 +714,13 @@ declare const QtiGapMatchInteraction_base: (abstract new (...args: any[]) => Dra
689
714
  * @slot drags - The draggable choice sources.
690
715
  * @slot - Default slot for the drop targets (gaps).
691
716
  *
692
- * @csspart drags - Wrapper around the drag sources slot.
693
- * @csspart drops - Wrapper around the drop targets slot.
717
+ * @csspart bank - The slot holding the unplaced chips (was `drags`).
718
+ * @csspart drops - Wrapper around the drop targets slot. The targets themselves are `qti-gap`
719
+ * elements in the light DOM; they carry their own states (`drop`, `filled`, `full`, …).
694
720
  * @csspart message - Live validation message region (role="alert").
721
+ * @cssstate disabled - The interaction is switched off.
722
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
723
+ * @cssstate drag-active - A drag is in progress (was `dragzone-active`, `dragzone-enabled`).
695
724
  */
696
725
  declare class QtiGapMatchInteraction extends QtiGapMatchInteraction_base {
697
726
  static styles: CSSResultGroup;
@@ -711,10 +740,19 @@ declare global {
711
740
  * @slot prompt - The prompt shown above the image.
712
741
  * @slot - Default slot for hotspot choices layered over the image.
713
742
  *
714
- * @csspart line - Each line drawn by the candidate.
715
- * @csspart correct-line - Each line displayed as part of the correct response.
716
- * @csspart point - Each in-progress endpoint indicator.
743
+ * @csspart line - Each line drawn by the candidate. Tokens: `answer-key` on a line of the correct
744
+ * response, drawn by `qti-corrections` (was the part `correct-line`).
745
+ * @csspart point - The in-progress line from the first chosen hotspot to the pointer.
746
+ *
747
+ * Interaction: click (or Enter / Space on a focused point) a point to start a line, then another
748
+ * point to finish it. The chosen start point carries `:state(checked)`; clicking it again, Escape,
749
+ * or a click on the image away from the points cancels. A point that already takes its `match-max`
750
+ * lines carries `:state(full)` and cannot start or end another. Click a line (or focus it and press
751
+ * Enter, Space, Delete or Backspace) to remove it. The response is `pair`, undirected: "B A" is the
752
+ * existing "A B", and a point cannot be paired with itself.
717
753
  * @csspart message - Live validation message region (role="alert").
754
+ * @cssstate disabled - The interaction is switched off.
755
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
718
756
  */
719
757
  declare class QtiGraphicAssociateInteraction extends Interaction {
720
758
  #private;
@@ -724,8 +762,15 @@ declare class QtiGraphicAssociateInteraction extends Interaction {
724
762
  grImage: any[];
725
763
  private _response;
726
764
  constructor();
765
+ /** Fewest associations a valid response holds (QTI `min-associations`, default 0). */
766
+ minAssociations: number;
767
+ /** Most associations a candidate can draw (QTI `max-associations`, default 1; 0 = no limit). */
768
+ maxAssociations: number;
727
769
  reset(): void;
728
770
  validate(): boolean;
771
+ reportValidity(options?: {
772
+ trigger?: ValidityTrigger;
773
+ }): boolean;
729
774
  set response(val: string | string[] | null);
730
775
  get response(): string[] | null;
731
776
  /** Extension hook for optional SVG lines rendered above the candidate response. */
@@ -749,8 +794,11 @@ declare const QtiGraphicGapMatchInteraction_base: (abstract new (...args: any[])
749
794
  * @slot - Default slot for the base image and hotspots.
750
795
  *
751
796
  * @csspart image - Wrapper around the image slot.
752
- * @csspart drags - Wrapper around the drag sources slot.
797
+ * @csspart bank - The slot holding the unplaced chips (was `drags`).
753
798
  * @csspart message - Live validation message region (role="alert").
799
+ * @cssstate disabled - The interaction is switched off.
800
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
801
+ * @cssstate drag-active - A drag is in progress (was `dragzone-active`, `dragzone-enabled`).
754
802
  */
755
803
  declare class QtiGraphicGapMatchInteraction extends QtiGraphicGapMatchInteraction_base {
756
804
  #private;
@@ -793,6 +841,8 @@ declare const QtiGraphicOrderInteraction_base: (abstract new (...args: any[]) =>
793
841
  * @slot - Default slot for the image and hotspot choices.
794
842
  *
795
843
  * @csspart message - Live validation message region (role="alert").
844
+ * @cssstate disabled - The interaction is switched off.
845
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
796
846
  */
797
847
  declare class QtiGraphicOrderInteraction extends QtiGraphicOrderInteraction_base {
798
848
  #private;
@@ -822,6 +872,10 @@ declare const QtiHotspotInteraction_base: (abstract new (...args: any[]) => Choi
822
872
  *
823
873
  * @slot prompt - The prompt shown above the image.
824
874
  * @slot - Default slot for the image and hotspot choices.
875
+ *
876
+ * @csspart message - Live validation message region (role="alert").
877
+ * @cssstate disabled - The interaction is switched off.
878
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
825
879
  */
826
880
  declare class QtiHotspotInteraction extends QtiHotspotInteraction_base {
827
881
  #private;
@@ -852,6 +906,8 @@ declare const QtiHottextInteraction_base: (abstract new (...args: any[]) => Choi
852
906
  * @slot - Default slot for the mixed content and `qti-hottext` choices.
853
907
  *
854
908
  * @csspart message - Live validation message region (role="alert").
909
+ * @cssstate disabled - The interaction is switched off.
910
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
855
911
  */
856
912
  declare class QtiHottextInteraction extends QtiHottextInteraction_base {
857
913
  static styles: CSSResultGroup;
@@ -887,12 +943,19 @@ declare const QtiInlineChoiceInteraction_base: (abstract new (...args: any[]) =>
887
943
  *
888
944
  * @csspart trigger - The dropdown trigger button.
889
945
  * @csspart value - The currently displayed value inside the trigger.
890
- * @csspart dropdown-icon - The chevron icon inside the trigger; also carries `dropdown-icon-open` when open.
946
+ * @csspart icon - The chevron inside the trigger (was `dropdown-icon`). Tokens: `open` while the
947
+ * menu is open (was `dropdown-icon-open`).
891
948
  * @csspart menu - The popover element containing the option list.
892
- * @csspart option - Each option button; also carries `option-prompt`, `option-selected` and
893
- * `option-clear` (the prompt row as a clear button, see `data-clear-label`) variants.
894
- * @csspart option-content - The content wrapper inside each option.
949
+ * @csspart option - The prompt row in the menu: the way back to "nothing chosen". Tokens: `prompt`;
950
+ * `selected` while nothing is chosen; `clear` when the row is the clear button (see
951
+ * `data-clear-label`). Were `option-prompt`, `option-selected`, `option-clear`. The other rows
952
+ * are `qti-inline-choice` elements and carry their own parts and states.
953
+ * @csspart option-content - The content wrapper inside the prompt row.
895
954
  * @csspart clear-icon - The x glyph inside the clear row.
955
+ * @csspart message - The validation message, hidden until `reportValidity` shows it.
956
+ * @cssstate disabled - The interaction is switched off.
957
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
958
+ * @cssstate open - The menu is open. The chosen option carries `checked`, on the `qti-inline-choice`.
896
959
  */
897
960
  declare class QtiInlineChoiceInteraction extends QtiInlineChoiceInteraction_base {
898
961
  #private;
@@ -988,7 +1051,9 @@ declare class QtiInlineChoiceInteraction extends QtiInlineChoiceInteraction_base
988
1051
  */
989
1052
  menuAutoSizeExtraWidth(): number;
990
1053
  validate(): boolean;
991
- reportValidity(): boolean;
1054
+ reportValidity(options?: {
1055
+ trigger?: ValidityTrigger;
1056
+ }): boolean;
992
1057
  reset(): void;
993
1058
  /**
994
1059
  * Captures an attribute-set response before slotted options have been
@@ -1037,18 +1102,21 @@ declare const QtiMatchInteraction_base: (abstract new (...args: any[]) => DragDr
1037
1102
  *
1038
1103
  * @csspart grid - The tabular grid container.
1039
1104
  * @csspart corner - The top-left corner cell of the grid; shows `data-first-column-header`.
1040
- * @csspart cols-wrap - Wrapper row for the column headers.
1041
- * @csspart c-header - The column header slot wrapper.
1042
- * @csspart rows-wrap - Wrapper column for the row headers.
1043
- * @csspart r-header - The row header slot wrapper.
1044
- * @csspart checkbox-grid - The interactive cell grid area.
1045
- * @csspart input-cell - Each cell's label element.
1046
- * @csspart control - The visible checkbox/radio box (tabular mode). Also carries the variant
1047
- * tokens `radio` | `checkbox`, `checked`, and `correct` | `incorrect` — e.g.
1048
- * `::part(control radio checked correct)`. These mirror the custom-state vocabulary; the cells
1049
- * are plain spans in the shadow root, so they cannot carry real `:state()`.
1050
- * @csspart control-mark - The inner mark element; carries the same variant tokens as `control`.
1105
+ * @csspart columns - Wrapper row for the column headers (was `cols-wrap`).
1106
+ * @csspart column-header - The column header slot (was `c-header`).
1107
+ * @csspart rows - Wrapper column for the row headers (was `rows-wrap`).
1108
+ * @csspart row-header - The row header slot (was `r-header`).
1109
+ * @csspart cells - The interactive cell grid area (was `checkbox-grid`).
1110
+ * @csspart cell - Each cell's label element (was `input-cell`).
1111
+ * @csspart control - The visible checkbox/radio box (tabular mode). Tokens: `radio` | `checkbox`,
1112
+ * `checked`, `candidate-correct` | `candidate-incorrect` — e.g.
1113
+ * `::part(control radio checked candidate-correct)`. These mirror the custom-state vocabulary;
1114
+ * the cells are plain spans in the shadow root, so they cannot carry real `:state()`.
1115
+ * @csspart control-mark - The inner mark element; carries the same tokens as `control`.
1051
1116
  * @csspart message - Live validation message region (role="alert").
1117
+ * @cssstate disabled - The interaction is switched off.
1118
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
1119
+ * @cssstate drag-active - A drag is in progress (was `dragzone-active`, `dragzone-enabled`).
1052
1120
  */
1053
1121
  declare class QtiMatchInteraction extends QtiMatchInteraction_base {
1054
1122
  static styles: CSSResultGroup;
@@ -1128,11 +1196,16 @@ declare const QtiOrderInteraction_base: (abstract new (...args: any[]) => DragDr
1128
1196
  * @slot prompt - The prompt shown above the interaction.
1129
1197
  * @slot drags - The draggable choice sources.
1130
1198
  *
1131
- * @csspart container - The outer container wrapping drags and drops.
1132
- * @csspart drags - Wrapper around the drag sources slot.
1199
+ * @csspart container - The outer container wrapping the bank and the drops.
1200
+ * @csspart bank - The slot holding the unplaced chips (was `drags`).
1133
1201
  * @csspart drops - The drop-target region.
1134
- * @csspart drop - Each individual drop target.
1135
- * @csspart drag - A choice that has been placed into a drop target.
1202
+ * @csspart drop - Each individual drop target. Tokens: `filled`, `full`, `drag-active`, `drag-over`
1203
+ * (a plain div cannot carry `:state()`, so the state names are part tokens here).
1204
+ * @csspart chip - A choice placed into a drop target (was `drag`).
1205
+ * @csspart message - Live validation message region (role="alert").
1206
+ * @cssstate disabled - The interaction is switched off.
1207
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
1208
+ * @cssstate drag-active - A drag is in progress (was `dragzone-active`, `dragzone-enabled`).
1136
1209
  */
1137
1210
  declare class QtiOrderInteraction extends QtiOrderInteraction_base {
1138
1211
  static styles: lit.CSSResult[];
@@ -1265,6 +1338,15 @@ declare const inlineScriptText: (text: string) => string;
1265
1338
  declare const inlineStyleText: (text: string) => string;
1266
1339
  /** A response value as this interaction holds it: a record response is its field map. */
1267
1340
  type PciResponseValue = string | string[] | RecordValue;
1341
+ /**
1342
+ * Portable custom interaction (PCI): hosts a third-party interaction module.
1343
+ *
1344
+ * No parts: the PCI renders its own markup into the default slot (or into an iframe) and the
1345
+ * element adds nothing of its own to theme.
1346
+ *
1347
+ * @cssstate disabled - The interaction is switched off.
1348
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
1349
+ */
1268
1350
  declare class QtiPortableCustomInteraction extends Interaction {
1269
1351
  #private;
1270
1352
  protected _iframeLoaded: boolean;
@@ -1477,7 +1559,11 @@ declare global {
1477
1559
  * @slot prompt - The prompt shown above the image.
1478
1560
  * @slot - Default slot for the base image.
1479
1561
  *
1480
- * @csspart point - Each selected point marker.
1562
+ * @csspart point - Each selected point marker. Tokens: `candidate-correct` |
1563
+ * `candidate-incorrect` when `qti-corrections` has marked it.
1564
+ * @csspart message - The validation message, hidden until `reportValidity` shows it.
1565
+ * @cssstate disabled - The interaction is switched off.
1566
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
1481
1567
  * @cssprop --qti-select-point-icon - Marker mask image (SVG data URL). Should be a solid silhouette for color inheritance.
1482
1568
  * @cssprop --qti-select-point-marker-size - Marker size.
1483
1569
  * @cssprop --qti-select-point-marker-anchor - Vertical translate anchor (`-100%` for bottom tip, `-50%` for center).
@@ -1502,6 +1588,11 @@ declare class QtiSelectPointInteraction extends Interaction {
1502
1588
  */
1503
1589
  areaMappings: string | null;
1504
1590
  private _areaEntries;
1591
+ /**
1592
+ * Every route into the response (a click, a removed marker, a restore, a reset) updates the form
1593
+ * value and the validity; a click or a removal also reports, as a change.
1594
+ */
1595
+ protected _handleResponseChange: () => void;
1505
1596
  protected _handleAreaMappingsChange: () => void;
1506
1597
  protected get _effectiveAreaEntries(): QtiAreaMapEntry[];
1507
1598
  connectedCallback(): void;
@@ -1517,7 +1608,9 @@ declare class QtiSelectPointInteraction extends Interaction {
1517
1608
  protected positionOverlayElements(elements: Iterable<HTMLElement>): void;
1518
1609
  render(): lit.TemplateResult<1>;
1519
1610
  validate(): boolean;
1520
- reportValidity(): boolean;
1611
+ reportValidity(options?: {
1612
+ trigger?: ValidityTrigger;
1613
+ }): boolean;
1521
1614
  firstUpdated(): void;
1522
1615
  disconnectedCallback(): void;
1523
1616
  }
@@ -1536,9 +1629,11 @@ declare global {
1536
1629
  * @csspart bounds - The min/max bounds label wrapper.
1537
1630
  * @csspart ticks - The tick marks along the rail.
1538
1631
  * @csspart rail - The rail element the knob slides along.
1539
- * @csspart knob - The draggable knob.
1540
- * @csspart value - The current value display (used twice in the layout).
1541
- * @csspart knob-correct - Ghost knob shown at the correct response position.
1632
+ * @csspart knob - The draggable knob. Tokens: `answer-key` on the ghost knob `qti-corrections`
1633
+ * draws at the correct response (was the part `knob-correct`).
1634
+ * @csspart value - The current value display.
1635
+ * @cssstate disabled - The interaction is switched off.
1636
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
1542
1637
  */
1543
1638
  declare class QtiSliderInteraction extends Interaction {
1544
1639
  #private;
@@ -1586,9 +1681,12 @@ declare global {
1586
1681
  * single-line input has no formatting to render: it can show neither preserved line breaks nor
1587
1682
  * markup. The field is always plain text, so this is not planned either.
1588
1683
  *
1589
- * @csspart answer - The answer-key line, revealed above the field when the correct response is shown.
1684
+ * @csspart answer-key - The correct answer, revealed above the field when the correct response is
1685
+ * shown (was `answer`).
1590
1686
  * @csspart input - The text input element.
1591
1687
  * @csspart message - The validation message, hidden until `reportValidity` shows it.
1688
+ * @cssstate disabled - The interaction is switched off.
1689
+ * @cssstate readonly - The interaction is frozen: it shows its value and takes no input.
1592
1690
  */
1593
1691
  declare class QtiTextEntryInteraction extends Interaction {
1594
1692
  static styles: CSSResultGroup;
@@ -1612,7 +1710,9 @@ declare class QtiTextEntryInteraction extends Interaction {
1612
1710
  protected renderValidationMessage(): unknown;
1613
1711
  render(): lit.TemplateResult<1>;
1614
1712
  protected textChanged(event: Event): void;
1615
- reportValidity(): boolean;
1713
+ reportValidity(options?: {
1714
+ trigger?: ValidityTrigger;
1715
+ }): boolean;
1616
1716
  reset(): void;
1617
1717
  }
1618
1718
  declare global {
@@ -40,6 +40,10 @@ declare const interactionContext: {
40
40
  __context__: Readonly<InteractionContext>;
41
41
  };
42
42
 
43
+ /** Why an interaction is invalid: too few (`min`), too many (`max`), or something else (`other`). */
44
+ type ValidityKind = 'min' | 'max' | 'other';
45
+ /** What asked for the report: the candidate changing the response, or a submit (end attempt, form). */
46
+ type ValidityTrigger = 'change' | 'submit';
43
47
  /**
44
48
  * Shared QTI interaction base. Formative correction behavior is supplied by the
45
49
  * `@qti-components/corrections` package.
@@ -89,7 +93,27 @@ declare abstract class Interaction extends LitElement implements ValidatableInte
89
93
  set value(val: string | null);
90
94
  abstract get response(): string | string[] | null;
91
95
  abstract set response(val: string | string[] | null);
92
- reportValidity(): boolean;
96
+ /** Why the interaction is invalid right now; `undefined` while it is valid. */
97
+ protected _validityKind?: ValidityKind;
98
+ /** Set once a submit has reported; from then on every change reports in full. */
99
+ protected _validityReported: boolean;
100
+ /** True while this element asks its own internals to report, so its `invalid` is not a submit. */
101
+ protected _reportingNatively: boolean;
102
+ /** Forget that a submit has reported: a reset or a new attempt waits for a submit again. */
103
+ protected resetValidityReport(): void;
104
+ /**
105
+ * Show the validity state, in the configured mode.
106
+ *
107
+ * When it shows depends on what asked: a `change` (the candidate picked or dropped something)
108
+ * reports what they just did wrong, too many, at once; too few is not an error until they say they
109
+ * are done, so a `submit` (the item's end attempt, a form's submit) is what first shows it. After
110
+ * that first submit, changes report in full, so the message clears the moment the minimum is met
111
+ * and comes back if it is lost again. The validity itself is always set: a form with a
112
+ * below-minimum interaction cannot submit either way.
113
+ */
114
+ reportValidity(options?: {
115
+ trigger?: ValidityTrigger;
116
+ }): boolean;
93
117
  protected get validationDisplayMode(): ValidationDisplayMode;
94
118
  protected resolveAllowReorder(options?: {
95
119
  defaultWhenUnset?: boolean;
@@ -99,6 +123,7 @@ declare abstract class Interaction extends LitElement implements ValidatableInte
99
123
  }): boolean;
100
124
  protected setInteractionValidity(isValid: boolean, validityMessage?: string, anchor?: HTMLElement | null, options?: {
101
125
  suppressInline?: boolean;
126
+ kind?: ValidityKind;
102
127
  }): void;
103
128
  protected updateInlineValidationMessage(): void;
104
129
  protected clearInlineValidationMessage(): void;
@@ -107,6 +132,12 @@ declare abstract class Interaction extends LitElement implements ValidatableInte
107
132
  formResetCallback(): void;
108
133
  connectedCallback(): void;
109
134
  saveResponse(value: string | string[], state?: string | null): void;
135
+ /**
136
+ * `disabled` and `readonly` are states as well as attributes (qti-theme CONTRACT.md §3): a theme
137
+ * reads `:state(disabled)` on the host the way it reads it on a choice. The attribute stays
138
+ * reflected, so `[disabled]` keeps matching.
139
+ */
140
+ protected update(changed: PropertyValues): void;
110
141
  constructor();
111
142
  /**
112
143
  * Optional lifecycle bridge for interaction subclasses that do not need changed-property data.
@@ -155,4 +186,4 @@ declare const readRecordFieldValues: (valueElements: Iterable<Element>) => Recor
155
186
  */
156
187
  declare const inferRecordFieldBaseType: (value: unknown) => BaseType;
157
188
 
158
- export { type ChoiceRole as C, Interaction as I, type RecordFieldValues as R, type InteractionContext as a, type RecordValue as b, interactionContext as c, isRecordValue as d, inferRecordFieldBaseType as i, readRecordFieldValues as r };
189
+ export { type ChoiceRole as C, Interaction as I, type RecordFieldValues as R, type ValidityKind as V, type InteractionContext as a, type RecordValue as b, type ValidityTrigger as c, interactionContext as d, isRecordValue as e, inferRecordFieldBaseType as i, readRecordFieldValues as r };
@@ -29,7 +29,7 @@ interface SessionContext {
29
29
  /**
30
30
  * What test plugins keep, by plugin name: JSON the test stores and restores without reading it.
31
31
  * Part of the persisted state (`QtiTestState.session.plugins`); written through the
32
- * `cito-test-update-plugin-state` request.
32
+ * `qc-test-update-plugin-state` request.
33
33
  */
34
34
  plugins?: Readonly<Record<string, unknown>>;
35
35
  }
package/dist/test.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { u as TestItemToSpeech, G as TestTtsNext, H as TestTtsPause, J as TestTtsPick, K as TestTtsPlay, L as TestTtsPrev, M as TestTtsResume, N as TestTtsStop, q as TestCheckItem, T as TestBookmark, y as TestPrintContext, A as TestPrintVariables, z as TestPrintState, B as TestScoringButtons, C as TestScoringFeedback, E as TestStamp, F as TestSubmit, O as TestView, P as TestViewToggle, S as QtiTestPluginState$1, U as ItemVariableValue, I as ITestNavigationMixin, a as ITestStateMixin } from './qti-test.d-BjhVQnQy.js';
2
- export { b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiBranchRule, f as QtiItemSessionControl, g as QtiNumberPresented, h as QtiNumberSelected, i as QtiOutcomeProcessing, j as QtiOutcomeProcessingProcessor, k as QtiPreCondition, l as QtiTest, m as QtiTestFeedback, n as QtiTestPart, o as QtiTestVariables, p as QtiTestVariablesExpression, r as TestContainer, s as TestEndAttempt, t as TestItemLink, v as TestNavigation, w as TestNext, x as TestPrev, D as TestSectionLink, R as bookmarkedItems } from './qti-test.d-BjhVQnQy.js';
3
- import { C as ComputedContext } from './computed.types.d-IXACuBr7.js';
1
+ import { u as TestItemToSpeech, G as TestTtsNext, H as TestTtsPause, J as TestTtsPick, K as TestTtsPlay, L as TestTtsPrev, M as TestTtsResume, N as TestTtsStop, q as TestCheckItem, T as TestBookmark, y as TestPrintContext, A as TestPrintVariables, z as TestPrintState, B as TestScoringButtons, C as TestScoringFeedback, E as TestStamp, F as TestSubmit, O as TestView, P as TestViewToggle, S as QtiTestPluginState$1, U as ItemVariableValue, I as ITestNavigationMixin, a as ITestStateMixin } from './qti-test.d-CDdyCp6e.js';
2
+ export { b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiBranchRule, f as QtiItemSessionControl, g as QtiNumberPresented, h as QtiNumberSelected, i as QtiOutcomeProcessing, j as QtiOutcomeProcessingProcessor, k as QtiPreCondition, l as QtiTest, m as QtiTestFeedback, n as QtiTestPart, o as QtiTestVariables, p as QtiTestVariablesExpression, r as TestContainer, s as TestEndAttempt, t as TestItemLink, v as TestNavigation, w as TestNext, x as TestPrev, D as TestSectionLink, R as bookmarkedItems } from './qti-test.d-CDdyCp6e.js';
3
+ import { C as ComputedContext } from './computed.types.d-n3K2VvB0.js';
4
4
  import { LitElement } from 'lit';
5
5
  import { b as ItemContext, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-DuVR0ZVK.js';
6
- import { S as SessionContext } from './session.context.d-DW09Lrie.js';
6
+ import { S as SessionContext } from './session.context.d-BNxGeyh9.js';
7
7
  import { C as ConfigContext } from './config.context.d-CCqlJXpE.js';
8
8
  import { T as TestContext } from './qti-expression.d-B-Cfbqlb.js';
9
9
  import './qti-transform-test.d-Bb9vnLzP.js';
10
10
  import './elements.js';
11
11
  import './interaction.interface.d-CvjHM2bi.js';
12
- import './qti-feedback.d-GAqMqAt6.js';
12
+ import './qti-feedback.d-1JL_qHjc.js';
13
13
  import './qti-rule-base.d-CeKP0Ooi.js';
14
14
  import './qti.context.d-CejJMlfZ.js';
15
15
  import '@heximal/templates';
@@ -110,7 +110,7 @@ declare const pluginElements: readonly [{
110
110
  /**
111
111
  * A plugin's entry in the state, typed through `QtiTestPluginState`, or `undefined` before the
112
112
  * plugin has stored anything. Read it from `computedContext`; write it by dispatching
113
- * `cito-test-update-plugin-state` (`dispatchPublic`).
113
+ * `qc-test-update-plugin-state` (`dispatchPublic`).
114
114
  */
115
115
  declare const pluginState: <K extends keyof QtiTestPluginState$1 & string>(context: Pick<ComputedContext, "plugins"> | undefined, plugin: K) => QtiTestPluginState$1[K] | undefined;
116
116
 
@@ -133,7 +133,7 @@ interface ITestProcessingMixin {
133
133
  /**
134
134
  * Everything a host needs to persist to resume a candidate's test session, and nothing else.
135
135
  *
136
- * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
136
+ * Read it from `qtiTest.state` or the `qc-test-state-changed` event, store it wherever you like —
137
137
  * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
138
138
  *
139
139
  * Deliberately not here: