@citolab/qti-components 10.0.0-next.2 → 10.0.0-next.21

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-RU6332MD.js → chunk-2A52V5TQ.js} +4 -4
  6. package/dist/{chunk-2KP5UU5A.js → chunk-55WWIRLN.js} +117 -92
  7. package/dist/chunk-55WWIRLN.js.map +1 -0
  8. package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
  9. package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
  10. package/dist/chunk-DJ7PB252.js +7 -0
  11. package/dist/chunk-DJ7PB252.js.map +1 -0
  12. package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
  13. package/dist/chunk-GPC53O7P.js.map +1 -0
  14. package/dist/{chunk-6U3YPHXU.js → chunk-H6DO5UHC.js} +277 -154
  15. package/dist/chunk-H6DO5UHC.js.map +1 -0
  16. package/dist/chunk-J6VX4N7M.js +197 -0
  17. package/dist/chunk-J6VX4N7M.js.map +1 -0
  18. package/dist/{chunk-3ZNECUPV.js → chunk-JIDSFFFD.js} +2 -2
  19. package/dist/{chunk-FD4AB6TM.js → chunk-KQ2LED4X.js} +2 -2
  20. package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
  21. package/dist/chunk-LPYZVKHX.js.map +1 -0
  22. package/dist/chunk-PZ5AY32C.js +10 -0
  23. package/dist/chunk-PZ5AY32C.js.map +1 -0
  24. package/dist/{chunk-K3VKQ6QF.js → chunk-TB2OI3ED.js} +677 -1894
  25. package/dist/chunk-TB2OI3ED.js.map +1 -0
  26. package/dist/{chunk-GBZNFSFY.js → chunk-TSJGL6FI.js} +2 -2
  27. package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
  28. package/dist/chunk-TZCOXFPB.js.map +1 -0
  29. package/dist/chunk-UCXLDQYA.js +56 -0
  30. package/dist/chunk-UCXLDQYA.js.map +1 -0
  31. package/dist/chunk-WWY2H2YO.js +7 -0
  32. package/dist/chunk-WWY2H2YO.js.map +1 -0
  33. package/dist/{chunk-LFVPS7KB.js → chunk-XWRZP2RM.js} +2 -2
  34. package/dist/{chunk-TLAVOBEM.js → chunk-ZRORBAHB.js} +122 -3
  35. package/dist/chunk-ZRORBAHB.js.map +1 -0
  36. package/dist/computed.types.d-6Ht-HNRx.d.ts +80 -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 +47 -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 +1780 -1727
  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-CF9S8X9C.d.ts +68 -0
  63. package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
  64. package/dist/{qti-test.d-DkpBNcsv.d.ts → qti-test.d-DBT-YpRu.d.ts} +124 -485
  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-Bb9vnLzP.d.ts} +1 -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 +134 -0
  70. package/dist/test-plugin-api.js +19 -0
  71. package/dist/test-plugin-api.js.map +1 -0
  72. package/dist/test.d.ts +26 -57
  73. package/dist/test.js +19 -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-2KP5UU5A.js.map +0 -1
  79. package/dist/chunk-6K3QWJHH.js.map +0 -1
  80. package/dist/chunk-6U3YPHXU.js.map +0 -1
  81. package/dist/chunk-K3VKQ6QF.js.map +0 -1
  82. package/dist/chunk-RSMYGGQK.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-2A52V5TQ.js.map} +0 -0
  89. /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
  90. /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
  91. /package/dist/{chunk-3ZNECUPV.js.map → chunk-JIDSFFFD.js.map} +0 -0
  92. /package/dist/{chunk-FD4AB6TM.js.map → chunk-KQ2LED4X.js.map} +0 -0
  93. /package/dist/{chunk-GBZNFSFY.js.map → chunk-TSJGL6FI.js.map} +0 -0
  94. /package/dist/{chunk-LFVPS7KB.js.map → chunk-XWRZP2RM.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-Bb9vnLzP.js';
4
+ import { C as ComputedContext, a as ComputedItem } from './computed.types.d-6Ht-HNRx.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-D8Q89RzZ.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
 
@@ -184,6 +187,33 @@ declare global {
184
187
  }
185
188
  }
186
189
 
190
+ /**
191
+ * @summary The qti-number-presented expression counts the selected items that have been presented to the candidate.
192
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.number-presented
193
+ *
194
+ * Outcome processing only. `section-identifier`, `include-category` and
195
+ * `exclude-category` narrow which item references are counted, the same way as
196
+ * for `qti-number-selected` and `qti-test-variables`.
197
+ *
198
+ * An item is presented once its `completionStatus` has left `not_attempted`:
199
+ * presenting an item starts its first attempt. An item a linear test part
200
+ * passed over (pre-condition, branch rule) or one the candidate has not reached
201
+ * keeps `not_attempted`. That makes this the count to use for a total over the
202
+ * candidate's own route, such as a maximum score of one point per presented item.
203
+ */
204
+ declare class QtiNumberPresented extends QtiExpression<number> {
205
+ #private;
206
+ _testContext?: TestContext;
207
+ constructor();
208
+ getResult(): number;
209
+ calculate(): number;
210
+ }
211
+ declare global {
212
+ interface HTMLElementTagNameMap {
213
+ 'qti-number-presented': QtiNumberPresented;
214
+ }
215
+ }
216
+
187
217
  /**
188
218
  * @summary The qti-number-selected expression counts the item refs selected for the test.
189
219
  * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.number-selected
@@ -247,8 +277,19 @@ declare class QtiOutcomeProcessingProcessor {
247
277
  process(rules: QtiRuleBase[]): void;
248
278
  }
249
279
 
280
+ /**
281
+ * Test-level feedback. It renders nothing where it is declared: where and when it appears is up to
282
+ * the host. After outcome processing, `qtiTest.getTestFeedback(access)` returns the ones that apply.
283
+ */
250
284
  declare class QtiTestFeedback extends QtiModalFeedback {
251
285
  static styles: lit.CSSResult;
286
+ /** When the feedback may be shown: at the end of the test (`atEnd`), or while it runs (`during`). */
287
+ access: 'atEnd' | 'during';
288
+ /**
289
+ * Whether this feedback applies for a value of its `outcome-identifier`: with `show-hide="show"`
290
+ * when the value is (or, for a container, holds) its `identifier`; with `hide` when it is not.
291
+ */
292
+ matches(value: string | readonly string[] | null | undefined): boolean;
252
293
  render(): lit.TemplateResult<1>;
253
294
  }
254
295
  declare global {
@@ -341,56 +382,6 @@ interface ITestNavigationMixin {
341
382
  };
342
383
  }
343
384
 
344
- /**
345
- * Everything a host needs to persist to resume a candidate's test session, and nothing else.
346
- *
347
- * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
348
- * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
349
- *
350
- * Deliberately not here:
351
- * - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes
352
- * from the item XML on every load, and persisting the answer key with the candidate's data is
353
- * both bloat and a leak;
354
- * - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.
355
- * The shuffle `seed` in particular must be passed in again, or the restored order changes;
356
- * - `view`: a role the host decides, not something the candidate produced;
357
- * - anything computed — scores per section, `done`, `active` — which is rederived from this.
358
- */
359
- interface QtiTestState {
360
- /** Bumped on any incompatible change to this shape. A state with another version is ignored. */
361
- version: 1;
362
- test: {
363
- items: QtiTestStateItem[];
364
- /** Test-level outcome values. Only outcomes the test declares are restored. */
365
- outcomes: QtiTestStateValue[];
366
- };
367
- session: QtiTestStateSession;
368
- }
369
- interface QtiTestStateItem {
370
- /** The `qti-assessment-item-ref` identifier. */
371
- identifier: string;
372
- variables: (QtiTestStateValue & {
373
- type?: 'response' | 'outcome' | 'template' | 'context';
374
- })[];
375
- /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
376
- state?: Record<string, string | null>;
377
- }
378
- interface QtiTestStateValue {
379
- identifier: string;
380
- value: string | string[] | null;
381
- }
382
- /** Where the candidate is. */
383
- interface QtiTestStateSession {
384
- navPartId?: string | null;
385
- navSectionId?: string | null;
386
- navItemRefId?: string | null;
387
- }
388
-
389
- declare global {
390
- interface GlobalEventHandlersEventMap {
391
- 'qti-state-changed': CustomEvent<QtiTestState>;
392
- }
393
- }
394
385
  interface ITestStateMixin {
395
386
  /**
396
387
  * The candidate's persistable state: what they answered and where they are.
@@ -407,6 +398,41 @@ interface ITestStateMixin {
407
398
  state: QtiTestState;
408
399
  }
409
400
 
401
+ /**
402
+ * What a `qti-assessment-item` says about itself, read from its XML when it is fetched: no live
403
+ * state, nothing that needs the item rendered. Plain JSON, so a server can read the same file.
404
+ *
405
+ * Experimental (0.x): roadmap 1 phase T1; see `plans/test-model.md`.
406
+ */
407
+ interface ItemFacts {
408
+ /** The item's own `identifier`, which may differ from the item-ref's. */
409
+ identifier: string;
410
+ /** `adaptive`; false when absent (XSD default). */
411
+ adaptive: boolean;
412
+ /** `time-dependent`; false when absent. */
413
+ timeDependent: boolean;
414
+ /**
415
+ * A response declaration has a correct response, or a mapping with a map entry, or an area
416
+ * mapping with an area-map entry: something to compare a response with.
417
+ */
418
+ hasCorrectResponse: boolean;
419
+ /** The item has `qti-response-processing`. */
420
+ hasResponseProcessing: boolean;
421
+ /** `external-scored` on the `SCORE` outcome declaration, or null when not externally scored. */
422
+ externalScored: 'human' | 'externalMachine' | null;
423
+ /** `label`, or null when absent. */
424
+ label: string | null;
425
+ /** `title`; empty when absent. */
426
+ title: string;
427
+ }
428
+
429
+ /**
430
+ * The facts of every item fetched so far, by item-ref identifier, read from the item XML when
431
+ * `qti-test` loads it (`readItemFacts`). `test-navigation` puts them on the `computedContext` items.
432
+ * A new map on every change, so subscribers are notified. Internal: not exported, not API.
433
+ */
434
+ type ItemFactsByRef = ReadonlyMap<string, ItemFacts>;
435
+
410
436
  declare class TestNavigation extends LitElement {
411
437
  #private;
412
438
  identifier: string | undefined;
@@ -426,6 +452,8 @@ declare class TestNavigation extends LitElement {
426
452
  configContext: ConfigContext;
427
453
  protected _testContext?: TestContext;
428
454
  protected _sessionContext?: SessionContext;
455
+ /** Read from each item's XML when `qti-test` fetches it; see `itemFactsContext`. */
456
+ protected _itemFacts?: ItemFactsByRef;
429
457
  protected computedContext: ComputedContext;
430
458
  autoScoreItems: boolean;
431
459
  constructor();
@@ -442,6 +470,7 @@ declare class TestNavigation extends LitElement {
442
470
  protected get activeAssessmentItem(): QtiAssessmentItem | undefined;
443
471
  render(): lit.TemplateResult<1>;
444
472
  protected willUpdate(_changedProperties: PropertyValues): void;
473
+ protected updated(changedProperties: PropertyValues): void;
445
474
  }
446
475
  declare global {
447
476
  interface HTMLElementTagNameMap {
@@ -467,7 +496,7 @@ declare class TestNext extends LitElement {
467
496
  sectionItems: ComputedItem[];
468
497
  itemIndex: number;
469
498
  _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext): void;
470
- static styles: lit.CSSResult;
499
+ static styles: lit.CSSResult[];
471
500
  constructor();
472
501
  connectedCallback(): void;
473
502
  willUpdate(_changedProperties: Map<string | number | symbol, unknown>): void;
@@ -511,42 +540,34 @@ declare global {
511
540
  }
512
541
  }
513
542
 
514
- declare class TestView extends LitElement {
515
- #private;
516
- static DEFAULT_VIEW_OPTIONS: string[];
517
- private sessionContext;
518
- /** label accompanying the select view dropdown */
519
- label: string;
520
- /** The options to display in the dropdown, default: ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'] */
521
- viewOptions: string;
522
- protected _handleViewOptionsChange: () => void;
523
- connectedCallback(): void;
524
- private _viewOptions;
525
- protected _switchView(view: string): void;
526
- render(): lit.TemplateResult<1>;
527
- }
528
- declare global {
529
- interface HTMLElementTagNameMap {
530
- 'test-view': TestView;
531
- }
532
- }
533
-
534
- declare class TestItemLink extends LitElement {
535
- static styles: lit.CSSResult;
536
- private itemId;
537
- constructor();
538
- protected _requestItem(identifier: string): void;
539
- render(): lit.TemplateResult<1>;
540
- }
541
- declare global {
542
- interface HTMLElementTagNameMap {
543
- 'test-item-link': TestItemLink;
544
- }
545
- }
546
-
543
+ /**
544
+ * A button that ends the attempt of an item: its response is processed, `numAttempts` goes up and
545
+ * feedback is shown as the item's session control allows. It dispatches `qc-test-end-attempt`,
546
+ * which `<test-navigation>` handles.
547
+ *
548
+ * Put it inside `<test-navigation>`, either in the toolbar, where it ends the attempt of the item on
549
+ * screen, or in the `<template item-ref>`, where each item gets its own and it ends the attempt of
550
+ * that item: with `<qti-test navigate="section">` every item of the section is on screen, each with
551
+ * its own button. Give it an `item` (an item-ref identifier) to end the attempt of that item instead,
552
+ * wherever the button sits.
553
+ *
554
+ * It is `disabled` by the state of its item: when the attempts allowed by `max-attempts` are used
555
+ * (non-adaptive items), when the last attempt was already optimal (non-adaptive items), when an
556
+ * adaptive item is completed, or, when skipping is not allowed, while the response is invalid or
557
+ * still the default.
558
+ *
559
+ * @slot - The label.
560
+ * @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).
561
+ * @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.
562
+ * @attr disabled - Reflected: the item's attempt cannot be ended.
563
+ */
547
564
  declare class TestEndAttempt extends LitElement {
565
+ #private;
548
566
  protected computedContext: ComputedContext;
549
567
  _internalDisabled: boolean;
568
+ item?: string;
569
+ /** Ends no attempt until the response is valid and not the default, whatever the item's `allow-skipping` says. */
570
+ requireAnswer: boolean;
550
571
  _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext): void;
551
572
  static styles: lit.CSSResult;
552
573
  constructor();
@@ -560,24 +581,6 @@ declare global {
560
581
  }
561
582
  }
562
583
 
563
- /**
564
- * @deprecated test-paging-buttons-stamp is deprecated and will be removed in the future.
565
- */
566
- declare class TestPagingButtonsStamp extends LitElement {
567
- #private;
568
- private computedContext;
569
- myTemplate: TemplateFunction;
570
- protected createRenderRoot(): HTMLElement | DocumentFragment;
571
- constructor();
572
- connectedCallback(): void;
573
- render(): lit.TemplateResult<1>;
574
- }
575
- declare global {
576
- interface HTMLElementTagNameMap {
577
- 'test-paging-buttons-stamp': TestPagingButtonsStamp;
578
- }
579
- }
580
-
581
584
  /**
582
585
  * `<test-container>` is a custom element designed for hosting the qti-assessment-item.
583
586
  * The `qti-assessment-test` will be placed inside the shadow DOM of this element.
@@ -617,385 +620,19 @@ declare global {
617
620
  }
618
621
  }
619
622
 
620
- declare class TestPrintVariables extends LitElement {
621
- computedContext?: ComputedContext;
622
- static styles: lit.CSSResult;
623
- render(): lit.TemplateResult<1>;
624
- }
625
- declare global {
626
- interface HTMLElementTagNameMap {
627
- 'test-print-item-variables': TestPrintVariables;
628
- }
629
- }
630
-
631
623
  /**
632
- * @deprecated test-section-buttons-stamp is deprecated and will be removed in the future.
624
+ * Scores the test: on click the test resets its outcomes to their declared defaults, runs its
625
+ * outcome processing and dispatches `qc-test-submitted`, after which the host reads the outcomes.
626
+ * The host decides where it sits, for example on the last item or in a review view.
633
627
  */
634
- declare class TestSectionButtonsStamp extends LitElement {
635
- #private;
636
- private computedContext;
637
- myTemplate: TemplateFunction;
638
- protected createRenderRoot(): HTMLElement | DocumentFragment;
639
- constructor();
640
- connectedCallback(): void;
641
- render(): lit.TemplateResult<1>;
642
- }
643
- declare global {
644
- interface HTMLElementTagNameMap {
645
- 'test-section-buttons-stamp': TestSectionButtonsStamp;
646
- }
647
- }
648
-
649
- declare class TestSectionLink extends LitElement {
650
- #private;
628
+ declare class TestSubmit extends LitElement {
651
629
  static styles: lit.CSSResult;
652
- private sectionId;
653
630
  constructor();
654
631
  render(): lit.TemplateResult<1>;
655
632
  }
656
633
  declare global {
657
634
  interface HTMLElementTagNameMap {
658
- 'test-section-link': TestSectionLink;
659
- }
660
- }
661
-
662
- declare class TestPrintContext extends LitElement {
663
- computedContext?: ComputedContext;
664
- render(): lit.TemplateResult<1>;
665
- }
666
- declare global {
667
- interface HTMLElementTagNameMap {
668
- 'test-print-context': TestPrintContext;
669
- }
670
- }
671
-
672
- /**
673
- * A custom web component that renders a test stamp using the Lit framework.
674
- * This component is deprecated and will be removed in the future.
675
- * @customElement
676
- * @extends {LitElement}
677
- */
678
- declare class TestStamp extends LitElement {
679
- /**
680
- * Indicates whether the component is in debug mode.
681
- * When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.
682
- */
683
- debug: boolean;
684
- private computedContext;
685
- private stampContext;
686
- myTemplate: TemplateFunction;
687
- protected createRenderRoot(): HTMLElement | DocumentFragment;
688
- connectedCallback(): void;
689
- protected willUpdate(_changedProperties: PropertyValues): void;
690
- render(): lit.TemplateResult<1>;
691
- }
692
- declare global {
693
- interface HTMLElementTagNameMap {
694
- 'test-stamp': TestStamp;
695
- }
696
- }
697
-
698
- declare class TestScoringButtons extends LitElement {
699
- #private;
700
- view: string;
701
- disabled: boolean;
702
- myTemplate: TemplateFunction | null;
703
- protected createRenderRoot(): HTMLElement | DocumentFragment;
704
- connectedCallback(): void;
705
- protected computedContext?: ComputedContext;
706
- render(): lit.TemplateResult<1> | typeof nothing;
707
- constructor();
708
- }
709
- declare global {
710
- interface HTMLElementTagNameMap {
711
- 'test-scoring-buttons': TestScoringButtons;
712
- }
713
- }
714
-
715
- declare class TestViewToggle extends LitElement {
716
- myTemplate: any;
717
- protected createRenderRoot(): HTMLElement | DocumentFragment;
718
- private sessionContext;
719
- connectedCallback(): void;
720
- _switchView(view: string): void;
721
- protected firstUpdated(_changedProperties: PropertyValues): void;
722
- render(): lit.TemplateResult<1>;
723
- }
724
- declare global {
725
- interface HTMLElementTagNameMap {
726
- 'test-view-toggle': TestViewToggle;
727
- }
728
- }
729
-
730
- declare class TestScoringFeedback extends LitElement {
731
- protected computedContext?: ComputedContext;
732
- view: View;
733
- render(): lit.TemplateResult<1>;
734
- }
735
- declare global {
736
- interface HTMLElementTagNameMap {
737
- 'test-scoring-feedback': TestScoringFeedback;
738
- }
739
- }
740
-
741
- declare class TestCheckItem extends LitElement {
742
- protected testHost?: TestHost;
743
- static styles: lit.CSSResult;
744
- constructor();
745
- render(): lit.TemplateResult<1>;
746
- }
747
- declare global {
748
- interface HTMLElementTagNameMap {
749
- 'test-check-item': TestCheckItem;
750
- }
751
- }
752
-
753
- type SpeechState = 'idle' | 'playing' | 'paused';
754
- interface TtsContext {
755
- state: SpeechState;
756
- /** True while every reading element is highlighted and a click on one starts reading there. */
757
- picking: boolean;
758
- /** Index of the currently highlighted reading element (0-based). */
759
- currentElementIndex: number;
760
- /** Total number of navigable reading elements in the current item. */
761
- elementCount: number;
762
- play(): void;
763
- pause(): void;
764
- resume(): void;
765
- stop(): void;
766
- prevElement(): void;
767
- nextElement(): void;
768
- /** Toggle pick mode: highlight all reading elements, then read from the one that is clicked. */
769
- togglePick(): void;
770
- }
771
-
772
- declare const ttsContext: {
773
- __context__: TtsContext;
774
- };
775
- /**
776
- * Base class shared by all TTS control elements. Consumes `ttsContext` and
777
- * mirrors the current speech state onto CSS custom states so each child can
778
- * be styled with `:state(playing)`, `:state(paused)`, `:state(idle)`.
779
- */
780
- declare abstract class TtsButtonBase extends LitElement {
781
- #private;
782
- static styles: lit.CSSResult;
783
- /**
784
- * Accessible name of the button. Without it the default icon carries an English name, and
785
- * slotted content names the button by its text; set it when you slot an icon of your own,
786
- * which has no text to be named by.
787
- */
788
- label?: string;
789
- protected _tts?: TtsContext;
790
- updated(_changed: PropertyValues): void;
791
- }
792
- /**
793
- * `<test-item-to-speech>` is the controller and context provider. It manages
794
- * speech synthesis, word highlighting, and item element lookup. Compose your
795
- * own player by placing control elements as children.
796
- *
797
- * @example
798
- * ```html
799
- * <test-item-to-speech language="nl-NL">
800
- * <test-tts-play></test-tts-play>
801
- * <test-tts-prev></test-tts-prev>
802
- * <test-tts-next></test-tts-next>
803
- * <test-tts-stop></test-tts-stop>
804
- * </test-item-to-speech>
805
- * ```
806
- *
807
- * The controller lays its controls out as a wrapping row; each control draws an icon button,
808
- * and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a
809
- * 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
810
- * defaults as fallbacks) and can be sized with `--test-button-size` and `--test-tts-icon-size`.
811
- *
812
- * ### Language resolution
813
- *
814
- * Each reading element is spoken in the language of the nearest `lang` attribute:
815
- *
816
- * 1. `lang` (or `xml:lang`) on the element itself
817
- * 2. `lang` on the closest ancestor — including `<qti-assessment-item xml:lang>` and, across
818
- * shadow roots, anything wrapping the test
819
- * 3. `lang` on the document's `<html>` element
820
- * 4. the `language` attribute on `<test-item-to-speech>`
821
- *
822
- * The transformer copies `xml:lang` over as a plain `lang` attribute, so QTI authored with
823
- * `xml:lang="en-GB"` on a `<p>` or on the item root is honoured without further work.
824
- *
825
- * ### What is read
826
- *
827
- * Decided once per connect, by where the player is placed. The first rule that matches wins:
828
- *
829
- * 1. **Next to a stimulus placeholder** — the player shares its parent with a
830
- * `[data-stimulus-idref]` element, e.g. in a reading-text panel beside the questions: the
831
- * player reads that stimulus (its `qti-stimulus-body`), and only that. Not inside the
832
- * placeholder: loading a stimulus replaces the placeholder's content. Items and navigation
833
- * are ignored; when the stimulus is (re)loaded or the placeholder swapped, the player starts
834
- * over on the new content.
835
- * 2. **Next to `[data-tts-content]`** — the player shares its parent with an element marked
836
- * `data-tts-content`: any HTML, not QTI, e.g. a start screen rendered by React. The marker goes
837
- * on one container; the player reads the readable elements inside it. Navigation is ignored.
838
- * The reading list is rebuilt when the player starts from the top, and when an element in it
839
- * has left the page — so a re-render of the content never interrupts speech.
840
- * 3. **Inside a `qti-assessment-item-ref`** — e.g. in a `<template item-ref>` on `<qti-test>`,
841
- * so every item gets a player of its own: the player reads that item, and only that item.
842
- * The navigation cursor is ignored; speech stops when the player leaves the page with its item.
843
- * 4. **Anywhere else** — a toolbar in the page chrome: the player follows the navigation cursor
844
- * and reads the item `navItemRefId` (session context) points at, found in any
845
- * `test-container` reachable from the player. Navigating stops speech and starts the next
846
- * item from the top.
847
- *
848
- * ```html
849
- * <!-- 1. a player for the shared reading text -->
850
- * <aside>
851
- * <test-item-to-speech>…</test-item-to-speech>
852
- * <div data-stimulus-idref="Stimulus1"></div>
853
- * </aside>
854
- *
855
- * <!-- 2. a player for any other HTML -->
856
- * <div>
857
- * <test-item-to-speech>…</test-item-to-speech>
858
- * <section data-tts-content lang="nl-NL">…</section>
859
- * </div>
860
- *
861
- * <!-- 3. one player per item -->
862
- * <qti-test>
863
- * <template item-ref>
864
- * <test-item-to-speech>…</test-item-to-speech>
865
- * {{ xmlDoc }}
866
- * </template>
867
- * …
868
- * </qti-test>
869
- *
870
- * <!-- 4. one player in the toolbar, following navigation -->
871
- * <test-navigation>
872
- * <header><test-item-to-speech>…</test-item-to-speech></header>
873
- * <test-container test-url="…"></test-container>
874
- * </test-navigation>
875
- * ```
876
- *
877
- * In modes 3 and 4 the item re-rendering (navigating to the item already shown) restarts the
878
- * player on the fresh content. An item player reads the item body as rendered: a stimulus
879
- * placed inside the item is read with it, one placed outside (mode 1) is not. Only one player
880
- * can speak at a time; starting one stops any other.
881
- *
882
- * Read are `p`, `h1`–`h6`, `li`, `dt`, `dd`, `th`, `td`, `caption`, `blockquote`, `figcaption`,
883
- * `qti-prompt` and `qti-simple-choice` — the innermost match only — unless hidden (`display: none`)
884
- * or inside `aria-hidden="true"`.
885
- *
886
- * ### Starting somewhere in the middle
887
- *
888
- * `<test-tts-pick>` switches the player into pick mode: every reading element gets the blue
889
- * cursor highlight, and the first click on one of them leaves pick mode and starts reading
890
- * from that element. Pressing the button again leaves pick mode without reading.
891
- *
892
- * @cssstate idle - No speech active
893
- * @cssstate picking - Pick mode: all reading elements highlighted, waiting for a click
894
- * @cssstate playing - Speech is playing
895
- * @cssstate paused - Speech is paused
896
- */
897
- declare class TestItemToSpeech extends LitElement {
898
- #private;
899
- static styles: lit.CSSResult;
900
- /** Fallback language when neither the item content nor the document declares one. */
901
- language: string;
902
- protected _sessionContext?: SessionContext;
903
- /** The `qti-test` this player is in, across shadow roots. */
904
- protected testHost?: TestHost;
905
- _ttsContext: TtsContext;
906
- constructor();
907
- willUpdate(changed: PropertyValues): void;
908
- connectedCallback(): void;
909
- disconnectedCallback(): void;
910
- render(): lit.TemplateResult<1>;
911
- }
912
- /**
913
- * Play/pause/resume toggle button — always enabled, cycles through states.
914
- * Use named slots `play` and `pause` to customise the icons/labels independently; `label` and
915
- * `pause-label` name the button in each state (set them when the slotted content is an icon).
916
- *
917
- * @example
918
- * ```html
919
- * <test-tts-play>
920
- * <span slot="play">Voorlezen</span>
921
- * <span slot="pause">Pauzeren</span>
922
- * </test-tts-play>
923
- * ```
924
- *
925
- * @cssstate idle / playing / paused
926
- * @csspart button
927
- */
928
- declare class TestTtsPlay extends TtsButtonBase {
929
- #private;
930
- /** Accessible name of the button while speech is playing; see `label`. */
931
- pauseLabel?: string;
932
- render(): lit.TemplateResult<1>;
933
- }
934
- /**
935
- * Pause button — enabled only when playing.
936
- * @cssstate idle / playing / paused
937
- * @csspart button
938
- */
939
- declare class TestTtsPause extends TtsButtonBase {
940
- render(): lit.TemplateResult<1>;
941
- }
942
- /**
943
- * Resume button — enabled only when paused.
944
- * @cssstate idle / playing / paused
945
- * @csspart button
946
- */
947
- declare class TestTtsResume extends TtsButtonBase {
948
- render(): lit.TemplateResult<1>;
949
- }
950
- /**
951
- * Stop button — enabled when playing, paused, or in pick mode (where it leaves pick mode).
952
- * @cssstate idle / playing / paused
953
- * @csspart button
954
- */
955
- declare class TestTtsStop extends TtsButtonBase {
956
- render(): lit.TemplateResult<1>;
957
- }
958
- /**
959
- * Prev-element button — moves cursor to the previous reading element and pauses.
960
- * Disabled at the first element. Reading elements are collected lazily, so an element count
961
- * of 0 means "not looked yet" rather than "nothing to read": the button stays enabled and the
962
- * first click collects them.
963
- * @cssstate idle / playing / paused
964
- * @csspart button
965
- */
966
- declare class TestTtsPrev extends TtsButtonBase {
967
- render(): lit.TemplateResult<1>;
968
- }
969
- /**
970
- * Next-element button — moves cursor to the next reading element and pauses.
971
- * Disabled at the last element; enabled while the elements have not been collected yet
972
- * (see `TestTtsPrev`).
973
- * @cssstate idle / playing / paused
974
- * @csspart button
975
- */
976
- declare class TestTtsNext extends TtsButtonBase {
977
- render(): lit.TemplateResult<1>;
978
- }
979
- /**
980
- * Pick button — toggles pick mode on the controller: every reading element is highlighted and
981
- * a click on one of them starts reading from there. Reflects the mode as `:state(picking)`.
982
- * @cssstate idle / playing / paused
983
- * @cssstate picking
984
- * @csspart button
985
- */
986
- declare class TestTtsPick extends TtsButtonBase {
987
- render(): lit.TemplateResult<1>;
988
- }
989
- declare global {
990
- interface HTMLElementTagNameMap {
991
- 'test-item-to-speech': TestItemToSpeech;
992
- 'test-tts-play': TestTtsPlay;
993
- 'test-tts-pause': TestTtsPause;
994
- 'test-tts-resume': TestTtsResume;
995
- 'test-tts-stop': TestTtsStop;
996
- 'test-tts-prev': TestTtsPrev;
997
- 'test-tts-next': TestTtsNext;
998
- 'test-tts-pick': TestTtsPick;
635
+ 'test-submit': TestSubmit;
999
636
  }
1000
637
  }
1001
638
 
@@ -1006,6 +643,8 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
1006
643
  getOutcome(identifier: string): Readonly<OutcomeVariable>;
1007
644
  getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
1008
645
  outcomeProcessing(): boolean;
646
+ submit(): boolean;
647
+ getTestFeedback(access?: "atEnd" | "during"): QtiTestFeedback[];
1009
648
  }) & (abstract new (...args: any[]) => ITestStateMixin) & (abstract new (...args: any[]) => TestBaseInterface) & typeof LitElement;
1010
649
  /**
1011
650
  * `<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.
@@ -1054,8 +693,8 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
1054
693
  * You can use normal class names to style the elements.
1055
694
  * And you can use the `test-prev` and `test-next` elements to navigate through the test.
1056
695
  *
1057
- * @event qti-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
1058
- * @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.
696
+ * @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
697
+ * @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.
1059
698
  */
1060
699
  declare class QtiTest extends QtiTest_base {
1061
700
  constructor();
@@ -1084,4 +723,4 @@ declare global {
1084
723
  }
1085
724
  }
1086
725
 
1087
- export { TestScoringFeedback as A, TestSectionButtonsStamp as B, TestSectionLink as C, TestStamp as D, TestTtsNext as E, TestTtsPause as F, TestTtsPick as G, TestTtsPlay as H, type ITestNavigationMixin as I, TestTtsPrev as J, TestTtsResume as K, TestTtsStop as L, TestView as M, TestViewToggle as N, type TtsContext as O, ttsContext as P, QtiAssessmentItemRef as Q, type ItemVariableValue as R, type SpeechState as S, TestCheckItem as T, type ITestStateMixin as a, type ItemRefTemplateModel as b, QtiAssessmentSection as c, QtiAssessmentTest as d, QtiBranchRule as e, QtiItemSessionControl as f, QtiNumberSelected as g, QtiOutcomeProcessing as h, QtiOutcomeProcessingProcessor as i, QtiPreCondition as j, QtiTest as k, QtiTestFeedback as l, QtiTestPart as m, QtiTestVariables as n, QtiTestVariablesExpression as o, TestContainer as p, TestEndAttempt as q, TestItemLink as r, TestItemToSpeech as s, TestNavigation as t, TestNext as u, TestPagingButtonsStamp as v, TestPrev as w, TestPrintContext as x, TestPrintVariables as y, TestScoringButtons as z };
726
+ 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 };