@citolab/qti-components 10.0.0-next.3 → 10.0.0-next.30

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 (94) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +4334 -2688
  3. package/dist/base.d.ts +39 -13
  4. package/dist/base.js +14 -1
  5. package/dist/{chunk-D3BYGEQU.js → chunk-2ZT47EUK.js} +117 -92
  6. package/dist/chunk-2ZT47EUK.js.map +1 -0
  7. package/dist/{chunk-RU6332MD.js → chunk-566LB3G2.js} +4 -4
  8. package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
  9. package/dist/{chunk-OQDBARD5.js → chunk-5KNTKBP6.js} +2 -2
  10. package/dist/chunk-7ISPUOJG.js +209 -0
  11. package/dist/chunk-7ISPUOJG.js.map +1 -0
  12. package/dist/{chunk-GBZNFSFY.js → chunk-ADTCTKXS.js} +2 -2
  13. package/dist/{chunk-FD4AB6TM.js → chunk-BBP7QV32.js} +2 -2
  14. package/dist/{chunk-LFVPS7KB.js → chunk-CFTWXYBO.js} +2 -2
  15. package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
  16. package/dist/chunk-DJ7PB252.js +7 -0
  17. package/dist/chunk-DJ7PB252.js.map +1 -0
  18. package/dist/{chunk-6U3YPHXU.js → chunk-GAPMCYR5.js} +277 -154
  19. package/dist/chunk-GAPMCYR5.js.map +1 -0
  20. package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
  21. package/dist/chunk-GPC53O7P.js.map +1 -0
  22. package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
  23. package/dist/chunk-LPYZVKHX.js.map +1 -0
  24. package/dist/{chunk-TLAVOBEM.js → chunk-O2XRZPKA.js} +356 -62
  25. package/dist/chunk-O2XRZPKA.js.map +1 -0
  26. package/dist/chunk-PZ5AY32C.js +10 -0
  27. package/dist/chunk-PZ5AY32C.js.map +1 -0
  28. package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
  29. package/dist/chunk-TZCOXFPB.js.map +1 -0
  30. package/dist/chunk-UCXLDQYA.js +56 -0
  31. package/dist/chunk-UCXLDQYA.js.map +1 -0
  32. package/dist/chunk-WWY2H2YO.js +7 -0
  33. package/dist/chunk-WWY2H2YO.js.map +1 -0
  34. package/dist/{chunk-SIE3E4FG.js → chunk-YRR6D6UP.js} +753 -2095
  35. package/dist/chunk-YRR6D6UP.js.map +1 -0
  36. package/dist/computed.types.d-BPzPFX3Z.d.ts +91 -0
  37. package/dist/{config.context.d-BvU9r-Mg.d.ts → config.context.d-Dm11aAuw.d.ts} +21 -3
  38. package/dist/corrections.d.ts +137 -24
  39. package/dist/corrections.js +12 -12
  40. package/dist/corrections.js.map +1 -1
  41. package/dist/elements.d.ts +66 -73
  42. package/dist/elements.js +9 -6
  43. package/dist/index.d.ts +21 -17
  44. package/dist/index.js +50 -61
  45. package/dist/interactions.d.ts +98 -19
  46. package/dist/interactions.js +8 -3
  47. package/dist/item.css +1948 -1946
  48. package/dist/item.d.ts +8 -6
  49. package/dist/item.js +6 -5
  50. package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
  51. package/dist/loader.d.ts +5 -3
  52. package/dist/loader.js +3 -2
  53. package/dist/processing.d.ts +19 -7
  54. package/dist/processing.js +4 -3
  55. package/dist/public-events.d-3dGip9pd.d.ts +105 -0
  56. package/dist/qti-components-jsx.d.ts +1725 -1777
  57. package/dist/{qti-condition-expression.d-VJH6cWxf.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
  58. package/dist/{qti-expression.d-BPxEp8HU.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
  59. package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +8 -1
  60. package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-CxP6KtCH.d.ts} +3 -2
  61. package/dist/{qti-rule-base.d-Bdzg8eGH.d.ts → qti-rule-base.d-CeKP0Ooi.d.ts} +2 -2
  62. package/dist/qti-test-state-ybQ6ausy.d.ts +81 -0
  63. package/dist/qti-test-state.d-CjvdranT.d.ts +61 -0
  64. package/dist/{qti-test.d-86TlaMlI.d.ts → qti-test.d-BbtCG7A-.d.ts} +91 -487
  65. package/dist/{qti-text-entry-interaction.d-q8u5BiVK.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +221 -73
  66. package/dist/{qti-transform-test.d-BL7GGFJj.d.ts → qti-transform-test.d-CtNaWJr8.d.ts} +9 -0
  67. package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-N1Bq7e1f.d.ts} +67 -4
  68. package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-9gRdGK4T.d.ts} +7 -1
  69. package/dist/test-plugin-api.d.ts +143 -0
  70. package/dist/test-plugin-api.js +21 -0
  71. package/dist/test-plugin-api.js.map +1 -0
  72. package/dist/test.d.ts +72 -57
  73. package/dist/test.js +22 -48
  74. package/dist/transformers.d.ts +1 -1
  75. package/dist/transformers.js +2 -1
  76. package/dist/{item.types.d-B55QkJ92.d.ts → variables.d-DWHlTszN.d.ts} +8 -24
  77. package/package.json +16 -11
  78. package/dist/chunk-6K3QWJHH.js.map +0 -1
  79. package/dist/chunk-6U3YPHXU.js.map +0 -1
  80. package/dist/chunk-D3BYGEQU.js.map +0 -1
  81. package/dist/chunk-RSMYGGQK.js.map +0 -1
  82. package/dist/chunk-SIE3E4FG.js.map +0 -1
  83. package/dist/chunk-TDWJ6WZA.js.map +0 -1
  84. package/dist/chunk-TLAVOBEM.js.map +0 -1
  85. package/dist/chunk-ZP6QQYSU.js +0 -7
  86. package/dist/chunk-ZP6QQYSU.js.map +0 -1
  87. package/dist/computed.types.d-gJrBeUMG.d.ts +0 -42
  88. /package/dist/{chunk-RU6332MD.js.map → chunk-566LB3G2.js.map} +0 -0
  89. /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
  90. /package/dist/{chunk-OQDBARD5.js.map → chunk-5KNTKBP6.js.map} +0 -0
  91. /package/dist/{chunk-GBZNFSFY.js.map → chunk-ADTCTKXS.js.map} +0 -0
  92. /package/dist/{chunk-FD4AB6TM.js.map → chunk-BBP7QV32.js.map} +0 -0
  93. /package/dist/{chunk-LFVPS7KB.js.map → chunk-CFTWXYBO.js.map} +0 -0
  94. /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
@@ -1,15 +1,18 @@
1
1
  import * as lit from 'lit';
2
- import { LitElement, PropertyValues, nothing } from 'lit';
3
- import { b as transformTestApi, t as transformItemApi } from './qti-transform-test.d-BL7GGFJj.js';
4
- import { C as ComputedContext, a as ComputedItem } from './computed.types.d-gJrBeUMG.js';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ import { b as transformTestApi, t as transformItemApi } from './qti-transform-test.d-CtNaWJr8.js';
4
+ import { C as ComputedContext, a as ComputedItem } from './computed.types.d-BPzPFX3Z.js';
5
+ import './public-events.d-3dGip9pd.js';
5
6
  import { QtiAssessmentItem, QtiModalFeedback } from './elements.js';
6
7
  import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
7
- import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-BPxEp8HU.js';
8
+ import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-iH3w6mqf.js';
8
9
  import { TemplateFunction } from '@heximal/templates';
9
- import { h as VariableValue, b as ItemContext, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-B55QkJ92.js';
10
- import { S as SessionContext, V as View } from './session.context.d-D5080LVx.js';
11
- import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
12
- import { b as QtiRuleBase } from './qti-rule-base.d-Bdzg8eGH.js';
10
+ import { g as VariableValue, b as OutcomeVariable, V as VariableDeclaration } from './variables.d-DWHlTszN.js';
11
+ import { S as SessionContext, V as View } from './session.context.d-9gRdGK4T.js';
12
+ import { C as ConfigContext } from './config.context.d-Dm11aAuw.js';
13
+ import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
14
+ import { Q as QtiTestState } from './qti-test-state.d-CjvdranT.js';
15
+ import { b as QtiRuleBase } from './qti-rule-base.d-CeKP0Ooi.js';
13
16
 
14
17
  declare class QtiAssessmentTest extends LitElement {
15
18
  #private;
@@ -27,7 +30,7 @@ declare global {
27
30
  }
28
31
  declare module '../../public-events' {
29
32
  interface PublicEventMap {
30
- 'cito-test-loaded': CustomEvent<QtiAssessmentTest>;
33
+ 'qc-test-loaded': CustomEvent<QtiAssessmentTest>;
31
34
  }
32
35
  }
33
36
 
@@ -116,8 +119,6 @@ declare class QtiAssessmentSection extends LitElement {
116
119
  set title(value: string);
117
120
  visible: boolean;
118
121
  keepTogether: boolean;
119
- navigationMode?: 'linear' | 'nonlinear';
120
- submissionMode?: 'individual' | 'simultaneous';
121
122
  _testContext?: TestContext;
122
123
  connectedCallback(): Promise<void>;
123
124
  render(): lit.TemplateResult<1>;
@@ -379,56 +380,6 @@ interface ITestNavigationMixin {
379
380
  };
380
381
  }
381
382
 
382
- /**
383
- * Everything a host needs to persist to resume a candidate's test session, and nothing else.
384
- *
385
- * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
386
- * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
387
- *
388
- * Deliberately not here:
389
- * - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes
390
- * from the item XML on every load, and persisting the answer key with the candidate's data is
391
- * both bloat and a leak;
392
- * - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.
393
- * The shuffle `seed` in particular must be passed in again, or the restored order changes;
394
- * - `view`: a role the host decides, not something the candidate produced;
395
- * - anything computed — scores per section, `done`, `active` — which is rederived from this.
396
- */
397
- interface QtiTestState {
398
- /** Bumped on any incompatible change to this shape. A state with another version is ignored. */
399
- version: 1;
400
- test: {
401
- items: QtiTestStateItem[];
402
- /** Test-level outcome values. Only outcomes the test declares are restored. */
403
- outcomes: QtiTestStateValue[];
404
- };
405
- session: QtiTestStateSession;
406
- }
407
- interface QtiTestStateItem {
408
- /** The `qti-assessment-item-ref` identifier. */
409
- identifier: string;
410
- variables: (QtiTestStateValue & {
411
- type?: 'response' | 'outcome' | 'template' | 'context';
412
- })[];
413
- /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
414
- state?: Record<string, string | null>;
415
- }
416
- interface QtiTestStateValue {
417
- identifier: string;
418
- value: string | string[] | null;
419
- }
420
- /** Where the candidate is. */
421
- interface QtiTestStateSession {
422
- navPartId?: string | null;
423
- navSectionId?: string | null;
424
- navItemRefId?: string | null;
425
- }
426
-
427
- declare global {
428
- interface GlobalEventHandlersEventMap {
429
- 'qti-state-changed': CustomEvent<QtiTestState>;
430
- }
431
- }
432
383
  interface ITestStateMixin {
433
384
  /**
434
385
  * The candidate's persistable state: what they answered and where they are.
@@ -441,10 +392,50 @@ interface ITestStateMixin {
441
392
  * Items are matched by item-ref identifier; items the state does not mention start fresh, and
442
393
  * stored items, test outcomes or a position the test no longer has are ignored. Restoring is a
443
394
  * resume, so linear-mode navigation restrictions do not apply.
395
+ *
396
+ * A value that is not a version 1 `QtiTestState` is ignored and reported with
397
+ * `qc-test-state-refused`: at once when the test has loaded, or when it does if it was assigned
398
+ * before. A state assigned earlier that could be read stays in effect. A stored 9.x
399
+ * `testContext` is turned into a state with `stateFromContexts`.
444
400
  */
445
401
  state: QtiTestState;
446
402
  }
447
403
 
404
+ /**
405
+ * What a `qti-assessment-item` says about itself, read from its XML when it is fetched: no live
406
+ * state, nothing that needs the item rendered. Plain JSON, so a server can read the same file.
407
+ *
408
+ * Experimental (0.x): roadmap 1 phase T1; see `plans/test-model.md`.
409
+ */
410
+ interface ItemFacts {
411
+ /** The item's own `identifier`, which may differ from the item-ref's. */
412
+ identifier: string;
413
+ /** `adaptive`; false when absent (XSD default). */
414
+ adaptive: boolean;
415
+ /** `time-dependent`; false when absent. */
416
+ timeDependent: boolean;
417
+ /**
418
+ * A response declaration has a correct response, or a mapping with a map entry, or an area
419
+ * mapping with an area-map entry: something to compare a response with.
420
+ */
421
+ hasCorrectResponse: boolean;
422
+ /** The item has `qti-response-processing`. */
423
+ hasResponseProcessing: boolean;
424
+ /** `external-scored` on the `SCORE` outcome declaration, or null when not externally scored. */
425
+ externalScored: 'human' | 'externalMachine' | null;
426
+ /** `label`, or null when absent. */
427
+ label: string | null;
428
+ /** `title`; empty when absent. */
429
+ title: string;
430
+ }
431
+
432
+ /**
433
+ * The facts of every item fetched so far, by item-ref identifier, read from the item XML when
434
+ * `qti-test` loads it (`readItemFacts`). `test-navigation` puts them on the `computedContext` items.
435
+ * A new map on every change, so subscribers are notified. Internal: not exported, not API.
436
+ */
437
+ type ItemFactsByRef = ReadonlyMap<string, ItemFacts>;
438
+
448
439
  declare class TestNavigation extends LitElement {
449
440
  #private;
450
441
  identifier: string | undefined;
@@ -464,6 +455,8 @@ declare class TestNavigation extends LitElement {
464
455
  configContext: ConfigContext;
465
456
  protected _testContext?: TestContext;
466
457
  protected _sessionContext?: SessionContext;
458
+ /** Read from each item's XML when `qti-test` fetches it; see `itemFactsContext`. */
459
+ protected _itemFacts?: ItemFactsByRef;
467
460
  protected computedContext: ComputedContext;
468
461
  autoScoreItems: boolean;
469
462
  constructor();
@@ -480,6 +473,7 @@ declare class TestNavigation extends LitElement {
480
473
  protected get activeAssessmentItem(): QtiAssessmentItem | undefined;
481
474
  render(): lit.TemplateResult<1>;
482
475
  protected willUpdate(_changedProperties: PropertyValues): void;
476
+ protected updated(changedProperties: PropertyValues): void;
483
477
  }
484
478
  declare global {
485
479
  interface HTMLElementTagNameMap {
@@ -505,7 +499,7 @@ declare class TestNext extends LitElement {
505
499
  sectionItems: ComputedItem[];
506
500
  itemIndex: number;
507
501
  _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext): void;
508
- static styles: lit.CSSResult;
502
+ static styles: lit.CSSResult[];
509
503
  constructor();
510
504
  connectedCallback(): void;
511
505
  willUpdate(_changedProperties: Map<string | number | symbol, unknown>): void;
@@ -549,42 +543,34 @@ declare global {
549
543
  }
550
544
  }
551
545
 
552
- declare class TestView extends LitElement {
553
- #private;
554
- static DEFAULT_VIEW_OPTIONS: string[];
555
- private sessionContext;
556
- /** label accompanying the select view dropdown */
557
- label: string;
558
- /** The options to display in the dropdown, default: ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'] */
559
- viewOptions: string;
560
- protected _handleViewOptionsChange: () => void;
561
- connectedCallback(): void;
562
- private _viewOptions;
563
- protected _switchView(view: string): void;
564
- render(): lit.TemplateResult<1>;
565
- }
566
- declare global {
567
- interface HTMLElementTagNameMap {
568
- 'test-view': TestView;
569
- }
570
- }
571
-
572
- declare class TestItemLink extends LitElement {
573
- static styles: lit.CSSResult;
574
- private itemId;
575
- constructor();
576
- protected _requestItem(identifier: string): void;
577
- render(): lit.TemplateResult<1>;
578
- }
579
- declare global {
580
- interface HTMLElementTagNameMap {
581
- 'test-item-link': TestItemLink;
582
- }
583
- }
584
-
546
+ /**
547
+ * A button that ends the attempt of an item: its response is processed, `numAttempts` goes up and
548
+ * feedback is shown as the item's session control allows. It dispatches `qc-test-end-attempt`,
549
+ * which `<test-navigation>` handles.
550
+ *
551
+ * Put it inside `<test-navigation>`, either in the toolbar, where it ends the attempt of the item on
552
+ * screen, or in the `<template item-ref>`, where each item gets its own and it ends the attempt of
553
+ * that item: with `<qti-test navigate="section">` every item of the section is on screen, each with
554
+ * its own button. Give it an `item` (an item-ref identifier) to end the attempt of that item instead,
555
+ * wherever the button sits.
556
+ *
557
+ * It is `disabled` by the state of its item: when the attempts allowed by `max-attempts` are used
558
+ * (non-adaptive items), when the last attempt was already optimal (non-adaptive items), when an
559
+ * adaptive item is completed, or, when skipping is not allowed, while the response is invalid or
560
+ * still the default.
561
+ *
562
+ * @slot - The label.
563
+ * @attr require-answer - Also disabled while the response is invalid or still the default, without `allow-skipping="false"` (which is about leaving an item, not about ending its attempt).
564
+ * @attr item - The item-ref identifier whose attempt this button ends; without it, the item it is stamped into, or else the one on screen.
565
+ * @attr disabled - Reflected: the item's attempt cannot be ended.
566
+ */
585
567
  declare class TestEndAttempt extends LitElement {
568
+ #private;
586
569
  protected computedContext: ComputedContext;
587
570
  _internalDisabled: boolean;
571
+ item?: string;
572
+ /** Ends no attempt until the response is valid and not the default, whatever the item's `allow-skipping` says. */
573
+ requireAnswer: boolean;
588
574
  _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext): void;
589
575
  static styles: lit.CSSResult;
590
576
  constructor();
@@ -598,24 +584,6 @@ declare global {
598
584
  }
599
585
  }
600
586
 
601
- /**
602
- * @deprecated test-paging-buttons-stamp is deprecated and will be removed in the future.
603
- */
604
- declare class TestPagingButtonsStamp extends LitElement {
605
- #private;
606
- private computedContext;
607
- myTemplate: TemplateFunction;
608
- protected createRenderRoot(): HTMLElement | DocumentFragment;
609
- constructor();
610
- connectedCallback(): void;
611
- render(): lit.TemplateResult<1>;
612
- }
613
- declare global {
614
- interface HTMLElementTagNameMap {
615
- 'test-paging-buttons-stamp': TestPagingButtonsStamp;
616
- }
617
- }
618
-
619
587
  /**
620
588
  * `<test-container>` is a custom element designed for hosting the qti-assessment-item.
621
589
  * The `qti-assessment-test` will be placed inside the shadow DOM of this element.
@@ -655,385 +623,19 @@ declare global {
655
623
  }
656
624
  }
657
625
 
658
- declare class TestPrintVariables extends LitElement {
659
- computedContext?: ComputedContext;
660
- static styles: lit.CSSResult;
661
- render(): lit.TemplateResult<1>;
662
- }
663
- declare global {
664
- interface HTMLElementTagNameMap {
665
- 'test-print-item-variables': TestPrintVariables;
666
- }
667
- }
668
-
669
626
  /**
670
- * @deprecated test-section-buttons-stamp is deprecated and will be removed in the future.
627
+ * Scores the test: on click the test resets its outcomes to their declared defaults, runs its
628
+ * outcome processing and dispatches `qc-test-submitted`, after which the host reads the outcomes.
629
+ * The host decides where it sits, for example on the last item or in a review view.
671
630
  */
672
- declare class TestSectionButtonsStamp extends LitElement {
673
- #private;
674
- private computedContext;
675
- myTemplate: TemplateFunction;
676
- protected createRenderRoot(): HTMLElement | DocumentFragment;
677
- constructor();
678
- connectedCallback(): void;
679
- render(): lit.TemplateResult<1>;
680
- }
681
- declare global {
682
- interface HTMLElementTagNameMap {
683
- 'test-section-buttons-stamp': TestSectionButtonsStamp;
684
- }
685
- }
686
-
687
- declare class TestSectionLink extends LitElement {
688
- #private;
631
+ declare class TestSubmit extends LitElement {
689
632
  static styles: lit.CSSResult;
690
- private sectionId;
691
633
  constructor();
692
634
  render(): lit.TemplateResult<1>;
693
635
  }
694
636
  declare global {
695
637
  interface HTMLElementTagNameMap {
696
- 'test-section-link': TestSectionLink;
697
- }
698
- }
699
-
700
- declare class TestPrintContext extends LitElement {
701
- computedContext?: ComputedContext;
702
- render(): lit.TemplateResult<1>;
703
- }
704
- declare global {
705
- interface HTMLElementTagNameMap {
706
- 'test-print-context': TestPrintContext;
707
- }
708
- }
709
-
710
- /**
711
- * A custom web component that renders a test stamp using the Lit framework.
712
- * This component is deprecated and will be removed in the future.
713
- * @customElement
714
- * @extends {LitElement}
715
- */
716
- declare class TestStamp extends LitElement {
717
- /**
718
- * Indicates whether the component is in debug mode.
719
- * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.
720
- */
721
- debug: boolean;
722
- private computedContext;
723
- private stampContext;
724
- myTemplate: TemplateFunction;
725
- protected createRenderRoot(): HTMLElement | DocumentFragment;
726
- connectedCallback(): void;
727
- protected willUpdate(_changedProperties: PropertyValues): void;
728
- render(): lit.TemplateResult<1>;
729
- }
730
- declare global {
731
- interface HTMLElementTagNameMap {
732
- 'test-stamp': TestStamp;
733
- }
734
- }
735
-
736
- declare class TestScoringButtons extends LitElement {
737
- #private;
738
- view: string;
739
- disabled: boolean;
740
- myTemplate: TemplateFunction | null;
741
- protected createRenderRoot(): HTMLElement | DocumentFragment;
742
- connectedCallback(): void;
743
- protected computedContext?: ComputedContext;
744
- render(): lit.TemplateResult<1> | typeof nothing;
745
- constructor();
746
- }
747
- declare global {
748
- interface HTMLElementTagNameMap {
749
- 'test-scoring-buttons': TestScoringButtons;
750
- }
751
- }
752
-
753
- declare class TestViewToggle extends LitElement {
754
- myTemplate: any;
755
- protected createRenderRoot(): HTMLElement | DocumentFragment;
756
- private sessionContext;
757
- connectedCallback(): void;
758
- _switchView(view: string): void;
759
- protected firstUpdated(_changedProperties: PropertyValues): void;
760
- render(): lit.TemplateResult<1>;
761
- }
762
- declare global {
763
- interface HTMLElementTagNameMap {
764
- 'test-view-toggle': TestViewToggle;
765
- }
766
- }
767
-
768
- declare class TestScoringFeedback extends LitElement {
769
- protected computedContext?: ComputedContext;
770
- view: View;
771
- render(): lit.TemplateResult<1>;
772
- }
773
- declare global {
774
- interface HTMLElementTagNameMap {
775
- 'test-scoring-feedback': TestScoringFeedback;
776
- }
777
- }
778
-
779
- declare class TestCheckItem extends LitElement {
780
- protected testHost?: TestHost;
781
- static styles: lit.CSSResult;
782
- constructor();
783
- render(): lit.TemplateResult<1>;
784
- }
785
- declare global {
786
- interface HTMLElementTagNameMap {
787
- 'test-check-item': TestCheckItem;
788
- }
789
- }
790
-
791
- type SpeechState = 'idle' | 'playing' | 'paused';
792
- interface TtsContext {
793
- state: SpeechState;
794
- /** True while every reading element is highlighted and a click on one starts reading there. */
795
- picking: boolean;
796
- /** Index of the currently highlighted reading element (0-based). */
797
- currentElementIndex: number;
798
- /** Total number of navigable reading elements in the current item. */
799
- elementCount: number;
800
- play(): void;
801
- pause(): void;
802
- resume(): void;
803
- stop(): void;
804
- prevElement(): void;
805
- nextElement(): void;
806
- /** Toggle pick mode: highlight all reading elements, then read from the one that is clicked. */
807
- togglePick(): void;
808
- }
809
-
810
- declare const ttsContext: {
811
- __context__: TtsContext;
812
- };
813
- /**
814
- * Base class shared by all TTS control elements. Consumes `ttsContext` and
815
- * mirrors the current speech state onto CSS custom states so each child can
816
- * be styled with `:state(playing)`, `:state(paused)`, `:state(idle)`.
817
- */
818
- declare abstract class TtsButtonBase extends LitElement {
819
- #private;
820
- static styles: lit.CSSResult;
821
- /**
822
- * Accessible name of the button. Without it the default icon carries an English name, and
823
- * slotted content names the button by its text; set it when you slot an icon of your own,
824
- * which has no text to be named by.
825
- */
826
- label?: string;
827
- protected _tts?: TtsContext;
828
- updated(_changed: PropertyValues): void;
829
- }
830
- /**
831
- * `<test-item-to-speech>` is the controller and context provider. It manages
832
- * speech synthesis, word highlighting, and item element lookup. Compose your
833
- * own player by placing control elements as children.
834
- *
835
- * @example
836
- * ```html
837
- * <test-item-to-speech language="nl-NL">
838
- * <test-tts-play></test-tts-play>
839
- * <test-tts-prev></test-tts-prev>
840
- * <test-tts-next></test-tts-next>
841
- * <test-tts-stop></test-tts-stop>
842
- * </test-item-to-speech>
843
- * ```
844
- *
845
- * The controller lays its controls out as a wrapping row; each control draws an icon button,
846
- * and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a
847
- * 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
848
- * defaults as fallbacks) and can be sized with `--test-button-size` and `--test-tts-icon-size`.
849
- *
850
- * ### Language resolution
851
- *
852
- * Each reading element is spoken in the language of the nearest `lang` attribute:
853
- *
854
- * 1. `lang` (or `xml:lang`) on the element itself
855
- * 2. `lang` on the closest ancestor — including `<qti-assessment-item xml:lang>` and, across
856
- * shadow roots, anything wrapping the test
857
- * 3. `lang` on the document's `<html>` element
858
- * 4. the `language` attribute on `<test-item-to-speech>`
859
- *
860
- * The transformer copies `xml:lang` over as a plain `lang` attribute, so QTI authored with
861
- * `xml:lang="en-GB"` on a `<p>` or on the item root is honoured without further work.
862
- *
863
- * ### What is read
864
- *
865
- * Decided once per connect, by where the player is placed. The first rule that matches wins:
866
- *
867
- * 1. **Next to a stimulus placeholder** — the player shares its parent with a
868
- * `[data-stimulus-idref]` element, e.g. in a reading-text panel beside the questions: the
869
- * player reads that stimulus (its `qti-stimulus-body`), and only that. Not inside the
870
- * placeholder: loading a stimulus replaces the placeholder's content. Items and navigation
871
- * are ignored; when the stimulus is (re)loaded or the placeholder swapped, the player starts
872
- * over on the new content.
873
- * 2. **Next to `[data-tts-content]`** — the player shares its parent with an element marked
874
- * `data-tts-content`: any HTML, not QTI, e.g. a start screen rendered by React. The marker goes
875
- * on one container; the player reads the readable elements inside it. Navigation is ignored.
876
- * The reading list is rebuilt when the player starts from the top, and when an element in it
877
- * has left the page — so a re-render of the content never interrupts speech.
878
- * 3. **Inside a `qti-assessment-item-ref`** — e.g. in a `<template item-ref>` on `<qti-test>`,
879
- * so every item gets a player of its own: the player reads that item, and only that item.
880
- * The navigation cursor is ignored; speech stops when the player leaves the page with its item.
881
- * 4. **Anywhere else** — a toolbar in the page chrome: the player follows the navigation cursor
882
- * and reads the item `navItemRefId` (session context) points at, found in any
883
- * `test-container` reachable from the player. Navigating stops speech and starts the next
884
- * item from the top.
885
- *
886
- * ```html
887
- * <!-- 1. a player for the shared reading text -->
888
- * <aside>
889
- * <test-item-to-speech>…</test-item-to-speech>
890
- * <div data-stimulus-idref="Stimulus1"></div>
891
- * </aside>
892
- *
893
- * <!-- 2. a player for any other HTML -->
894
- * <div>
895
- * <test-item-to-speech>…</test-item-to-speech>
896
- * <section data-tts-content lang="nl-NL">…</section>
897
- * </div>
898
- *
899
- * <!-- 3. one player per item -->
900
- * <qti-test>
901
- * <template item-ref>
902
- * <test-item-to-speech>…</test-item-to-speech>
903
- * {{ xmlDoc }}
904
- * </template>
905
- * …
906
- * </qti-test>
907
- *
908
- * <!-- 4. one player in the toolbar, following navigation -->
909
- * <test-navigation>
910
- * <header><test-item-to-speech>…</test-item-to-speech></header>
911
- * <test-container test-url="…"></test-container>
912
- * </test-navigation>
913
- * ```
914
- *
915
- * In modes 3 and 4 the item re-rendering (navigating to the item already shown) restarts the
916
- * player on the fresh content. An item player reads the item body as rendered: a stimulus
917
- * placed inside the item is read with it, one placed outside (mode 1) is not. Only one player
918
- * can speak at a time; starting one stops any other.
919
- *
920
- * Read are `p`, `h1`–`h6`, `li`, `dt`, `dd`, `th`, `td`, `caption`, `blockquote`, `figcaption`,
921
- * `qti-prompt` and `qti-simple-choice` — the innermost match only — unless hidden (`display: none`)
922
- * or inside `aria-hidden="true"`.
923
- *
924
- * ### Starting somewhere in the middle
925
- *
926
- * `<test-tts-pick>` switches the player into pick mode: every reading element gets the blue
927
- * cursor highlight, and the first click on one of them leaves pick mode and starts reading
928
- * from that element. Pressing the button again leaves pick mode without reading.
929
- *
930
- * @cssstate idle - No speech active
931
- * @cssstate picking - Pick mode: all reading elements highlighted, waiting for a click
932
- * @cssstate playing - Speech is playing
933
- * @cssstate paused - Speech is paused
934
- */
935
- declare class TestItemToSpeech extends LitElement {
936
- #private;
937
- static styles: lit.CSSResult;
938
- /** Fallback language when neither the item content nor the document declares one. */
939
- language: string;
940
- protected _sessionContext?: SessionContext;
941
- /** The `qti-test` this player is in, across shadow roots. */
942
- protected testHost?: TestHost;
943
- _ttsContext: TtsContext;
944
- constructor();
945
- willUpdate(changed: PropertyValues): void;
946
- connectedCallback(): void;
947
- disconnectedCallback(): void;
948
- render(): lit.TemplateResult<1>;
949
- }
950
- /**
951
- * Play/pause/resume toggle button — always enabled, cycles through states.
952
- * Use named slots `play` and `pause` to customise the icons/labels independently; `label` and
953
- * `pause-label` name the button in each state (set them when the slotted content is an icon).
954
- *
955
- * @example
956
- * ```html
957
- * <test-tts-play>
958
- * <span slot="play">Voorlezen</span>
959
- * <span slot="pause">Pauzeren</span>
960
- * </test-tts-play>
961
- * ```
962
- *
963
- * @cssstate idle / playing / paused
964
- * @csspart button
965
- */
966
- declare class TestTtsPlay extends TtsButtonBase {
967
- #private;
968
- /** Accessible name of the button while speech is playing; see `label`. */
969
- pauseLabel?: string;
970
- render(): lit.TemplateResult<1>;
971
- }
972
- /**
973
- * Pause button — enabled only when playing.
974
- * @cssstate idle / playing / paused
975
- * @csspart button
976
- */
977
- declare class TestTtsPause extends TtsButtonBase {
978
- render(): lit.TemplateResult<1>;
979
- }
980
- /**
981
- * Resume button — enabled only when paused.
982
- * @cssstate idle / playing / paused
983
- * @csspart button
984
- */
985
- declare class TestTtsResume extends TtsButtonBase {
986
- render(): lit.TemplateResult<1>;
987
- }
988
- /**
989
- * Stop button — enabled when playing, paused, or in pick mode (where it leaves pick mode).
990
- * @cssstate idle / playing / paused
991
- * @csspart button
992
- */
993
- declare class TestTtsStop extends TtsButtonBase {
994
- render(): lit.TemplateResult<1>;
995
- }
996
- /**
997
- * Prev-element button — moves cursor to the previous reading element and pauses.
998
- * Disabled at the first element. Reading elements are collected lazily, so an element count
999
- * of 0 means "not looked yet" rather than "nothing to read": the button stays enabled and the
1000
- * first click collects them.
1001
- * @cssstate idle / playing / paused
1002
- * @csspart button
1003
- */
1004
- declare class TestTtsPrev extends TtsButtonBase {
1005
- render(): lit.TemplateResult<1>;
1006
- }
1007
- /**
1008
- * Next-element button — moves cursor to the next reading element and pauses.
1009
- * Disabled at the last element; enabled while the elements have not been collected yet
1010
- * (see `TestTtsPrev`).
1011
- * @cssstate idle / playing / paused
1012
- * @csspart button
1013
- */
1014
- declare class TestTtsNext extends TtsButtonBase {
1015
- render(): lit.TemplateResult<1>;
1016
- }
1017
- /**
1018
- * Pick button — toggles pick mode on the controller: every reading element is highlighted and
1019
- * a click on one of them starts reading from there. Reflects the mode as `:state(picking)`.
1020
- * @cssstate idle / playing / paused
1021
- * @cssstate picking
1022
- * @csspart button
1023
- */
1024
- declare class TestTtsPick extends TtsButtonBase {
1025
- render(): lit.TemplateResult<1>;
1026
- }
1027
- declare global {
1028
- interface HTMLElementTagNameMap {
1029
- 'test-item-to-speech': TestItemToSpeech;
1030
- 'test-tts-play': TestTtsPlay;
1031
- 'test-tts-pause': TestTtsPause;
1032
- 'test-tts-resume': TestTtsResume;
1033
- 'test-tts-stop': TestTtsStop;
1034
- 'test-tts-prev': TestTtsPrev;
1035
- 'test-tts-next': TestTtsNext;
1036
- 'test-tts-pick': TestTtsPick;
638
+ 'test-submit': TestSubmit;
1037
639
  }
1038
640
  }
1039
641
 
@@ -1044,6 +646,7 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
1044
646
  getOutcome(identifier: string): Readonly<OutcomeVariable>;
1045
647
  getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
1046
648
  outcomeProcessing(): boolean;
649
+ submit(): boolean;
1047
650
  getTestFeedback(access?: "atEnd" | "during"): QtiTestFeedback[];
1048
651
  }) & (abstract new (...args: any[]) => ITestStateMixin) & (abstract new (...args: any[]) => TestBaseInterface) & typeof LitElement;
1049
652
  /**
@@ -1093,8 +696,9 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
1093
696
  * You can use normal class names to style the elements.
1094
697
  * And you can use the `test-prev` and `test-next` elements to navigate through the test.
1095
698
  *
1096
- * @event qti-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
1097
- * @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.
699
+ * @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
700
+ * @event qc-test-state-refused - A value assigned to `state` is not a version 1 `QtiTestState` and was ignored; the test goes on without it. `detail` is `{ message, state }`. Sent once the test has loaded.
701
+ * @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.
1098
702
  */
1099
703
  declare class QtiTest extends QtiTest_base {
1100
704
  constructor();
@@ -1123,4 +727,4 @@ declare global {
1123
727
  }
1124
728
  }
1125
729
 
1126
- export { TestScoringButtons as A, TestScoringFeedback as B, TestSectionButtonsStamp as C, TestSectionLink as D, TestStamp as E, TestTtsNext as F, TestTtsPause as G, TestTtsPick as H, type ITestNavigationMixin as I, TestTtsPlay as J, TestTtsPrev as K, TestTtsResume as L, TestTtsStop as M, TestView as N, TestViewToggle as O, type TtsContext as P, QtiAssessmentItemRef as Q, ttsContext as R, type SpeechState as S, TestCheckItem as T, type ItemVariableValue as U, type ITestStateMixin as a, type ItemRefTemplateModel as b, QtiAssessmentSection as c, QtiAssessmentTest as d, QtiBranchRule as e, QtiItemSessionControl as f, QtiNumberPresented as g, QtiNumberSelected as h, QtiOutcomeProcessing as i, QtiOutcomeProcessingProcessor as j, QtiPreCondition as k, QtiTest as l, QtiTestFeedback as m, QtiTestPart as n, QtiTestVariables as o, QtiTestVariablesExpression as p, TestContainer as q, TestEndAttempt as r, TestItemLink as s, TestItemToSpeech as t, TestNavigation as u, TestNext as v, TestPagingButtonsStamp as w, TestPrev as x, TestPrintContext as y, TestPrintVariables as z };
730
+ export { type ITestNavigationMixin as I, QtiAssessmentItemRef as Q, TestContainer as T, type ITestStateMixin as a, type ItemRefTemplateModel as b, QtiAssessmentSection as c, QtiAssessmentTest as d, QtiBranchRule as e, QtiItemSessionControl as f, QtiNumberPresented as g, QtiNumberSelected as h, QtiOutcomeProcessing as i, QtiOutcomeProcessingProcessor as j, QtiPreCondition as k, QtiTest as l, QtiTestFeedback as m, QtiTestPart as n, QtiTestVariables as o, QtiTestVariablesExpression as p, TestEndAttempt as q, TestNavigation as r, TestNext as s, TestPrev as t, TestSubmit as u, type ItemVariableValue as v };