@qti-components/test 2.0.0-next.33 → 2.0.0-next.34

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.
@@ -59,6 +59,7 @@ declare const QtiTest_base: (abstract new (...args: any[]) => import("../..").IT
59
59
  * And you can use the `test-prev` and `test-next` elements to navigate through the test.
60
60
  *
61
61
  * @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
62
+ * @event qc-test-part-submitted - A test part with simultaneous submission was submitted by `submit()`: each item the candidate opened has its one attempt and a closed session. `detail` is `{ testPart, items }` (the item-refs whose attempt ended). Sent before the test's outcome processing.
62
63
  * @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.
63
64
  * @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.
64
65
  */
@@ -61,6 +61,7 @@ import { TestStateMixin } from '../../mixins/test-state.mixin';
61
61
  * And you can use the `test-prev` and `test-next` elements to navigate through the test.
62
62
  *
63
63
  * @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
64
+ * @event qc-test-part-submitted - A test part with simultaneous submission was submitted by `submit()`: each item the candidate opened has its one attempt and a closed session. `detail` is `{ testPart, items }` (the item-refs whose attempt ended). Sent before the test's outcome processing.
64
65
  * @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.
65
66
  * @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.
66
67
  */
@@ -1 +1 @@
1
- {"version":3,"file":"qti-test.js","sourceRoot":"","sources":["../../../src/components/qti-test/qti-test.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eA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CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,4FAA4F;QAC5F,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IA0BD;;;OAGG;IACM,KAAK,CAAC,iBAAiB;QAC9B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,IAAI,CAAC,cAAc,CAAC;QAC1B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF;AA7CQ;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACM;AAU1B;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;8CACK;AAclC;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;2CAO/B","sourcesContent":["import { ContextProvider, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { configContext, qtiContext } from '@qti-components/base';\n\nimport { testHostContext } from '../../internal/test-host.context';\nimport { TestNavigationMixin, TestViewMixin } from '../../mixins';\nimport { TestBaseMixin } from '../../mixins/test-base';\nimport { TestProcessingMixin } from '../../mixins/test-processing.mixin';\nimport { TestStateMixin } from '../../mixins/test-state.mixin';\n\nimport type { PropertyValues } from 'lit';\nimport type { ConfigContext, QtiContext } from '@qti-components/base';\nimport type { IQtiTest } from '../../types/iqti-test';\n\n/**\n * `<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.\n *\n * This component leverages several mixins to provide functionality for loading, navigating, processing, and displaying QTI test assessments.\n *\n * ### Example Usage\n *\n * Minimal example including navigation:\n *\n * ```html\n * <qti-test src=\"./path/to/assessment.xml\" navigate=\"item\">\n * <test-navigation>\n * <test-container></test-container>\n * <nav class=\"flex\">\n * <test-prev></test-prev>\n * <test-next></test-next>\n * </nav>\n * </test-navigation>\n * </qti-test>\n * ```\n *\n * Use the following file structure\n * A qti-test loads a QTI3.0 assessmenttest.xml file from a package folder.\n *\n * ```plaintext\n * Root/\n * ├── index.html\n * └── /assets/api/examples/\n * ├── assessmenttest.xml\n * └── imsmanifest.xml\n *\n * ```\n *\n * ### Test components\n *\n * Use test components inside the qti-test component for added functionality.\n * ### Test next\n * `<test-next> | TestNext`\n *\n * ### Test prev\n *\n * `<test-prev> | TestPrev`\n * ### Test components\n *\n * You can use normal class names to style the elements.\n * And you can use the `test-prev` and `test-next` elements to navigate through the test.\n *\n * @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.\n * @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.\n * @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.\n */\n\nexport class QtiTest extends TestNavigationMixin(\n TestViewMixin(TestProcessingMixin(TestStateMixin(TestBaseMixin(LitElement))))\n) {\n // TODO: Properly implement IQtiTest interface\n // export class QtiTest extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestBase))) {\n\n /** Tells the components inside that something they read from the test changed (see `src`). */\n #hostProvider: ContextProvider<typeof testHostContext>;\n\n constructor() {\n super();\n // The components inside find their test through this, across shadow roots (see TestHost).\n this.#hostProvider = new ContextProvider(this, { context: testHostContext, initialValue: this });\n }\n\n /**\n * URL of the `assessmentTest` XML. Changing it loads another test into the `test-container`\n * inside. Relative URLs resolve against the page, and the items' `href`s against the test.\n *\n * `test-url` on `test-container` is the deprecated name for this, kept until 11; when both are\n * set, `src` wins.\n */\n @property({ type: String })\n public src: string | null = null;\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n // The provided value is this element, whose identity never changes: force the notification.\n if (changed.has('src')) this.#hostProvider.setValue(this, true);\n }\n\n @state()\n @provide({ context: configContext })\n public configContext: ConfigContext = {};\n\n /**\n * Who is taking which test, and the optional shuffle `seed`. Provided here, at the test, so\n * everything inside reads one value: the test-container shuffling the item order, the test\n * shuffling interactions as it navigates, and the expressions that read `QTI_CONTEXT`.\n *\n * Pass the same `seed` when resuming a session, or the order comes back different. Replace the\n * object, do not mutate it: an in-place change does not notify the components inside.\n *\n * `test-navigation.qtiContext` is an alias of this.\n */\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n /**\n * Renders the component's template.\n * Provides a default `<slot>` for content projection.\n */\n override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n await this.updateComplete;\n this.dispatchEvent(new CustomEvent('qti-test-connected', { detail: this }));\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-test': QtiTest;\n }\n}\n"]}
1
+ {"version":3,"file":"qti-test.js","sourceRoot":"","sources":["../../../src/components/qti-test/qti-test.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAA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AoB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF;AA7CQ;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACM;AAU1B;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;8CACK;AAclC;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;2CAO/B","sourcesContent":["import { ContextProvider, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { configContext, qtiContext } from '@qti-components/base';\n\nimport { testHostContext } from '../../internal/test-host.context';\nimport { TestNavigationMixin, TestViewMixin } from '../../mixins';\nimport { TestBaseMixin } from '../../mixins/test-base';\nimport { TestProcessingMixin } from '../../mixins/test-processing.mixin';\nimport { TestStateMixin } from '../../mixins/test-state.mixin';\n\nimport type { PropertyValues } from 'lit';\nimport type { ConfigContext, QtiContext } from '@qti-components/base';\nimport type { IQtiTest } from '../../types/iqti-test';\n\n/**\n * `<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.\n *\n * This component leverages several mixins to provide functionality for loading, navigating, processing, and displaying QTI test assessments.\n *\n * ### Example Usage\n *\n * Minimal example including navigation:\n *\n * ```html\n * <qti-test src=\"./path/to/assessment.xml\" navigate=\"item\">\n * <test-navigation>\n * <test-container></test-container>\n * <nav class=\"flex\">\n * <test-prev></test-prev>\n * <test-next></test-next>\n * </nav>\n * </test-navigation>\n * </qti-test>\n * ```\n *\n * Use the following file structure\n * A qti-test loads a QTI3.0 assessmenttest.xml file from a package folder.\n *\n * ```plaintext\n * Root/\n * ├── index.html\n * └── /assets/api/examples/\n * ├── assessmenttest.xml\n * └── imsmanifest.xml\n *\n * ```\n *\n * ### Test components\n *\n * Use test components inside the qti-test component for added functionality.\n * ### Test next\n * `<test-next> | TestNext`\n *\n * ### Test prev\n *\n * `<test-prev> | TestPrev`\n * ### Test components\n *\n * You can use normal class names to style the elements.\n * And you can use the `test-prev` and `test-next` elements to navigate through the test.\n *\n * @event qc-test-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.\n * @event qc-test-part-submitted - A test part with simultaneous submission was submitted by `submit()`: each item the candidate opened has its one attempt and a closed session. `detail` is `{ testPart, items }` (the item-refs whose attempt ended). Sent before the test's outcome processing.\n * @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.\n * @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.\n */\n\nexport class QtiTest extends TestNavigationMixin(\n TestViewMixin(TestProcessingMixin(TestStateMixin(TestBaseMixin(LitElement))))\n) {\n // TODO: Properly implement IQtiTest interface\n // export class QtiTest extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestBase))) {\n\n /** Tells the components inside that something they read from the test changed (see `src`). */\n #hostProvider: ContextProvider<typeof testHostContext>;\n\n constructor() {\n super();\n // The components inside find their test through this, across shadow roots (see TestHost).\n this.#hostProvider = new ContextProvider(this, { context: testHostContext, initialValue: this });\n }\n\n /**\n * URL of the `assessmentTest` XML. Changing it loads another test into the `test-container`\n * inside. Relative URLs resolve against the page, and the items' `href`s against the test.\n *\n * `test-url` on `test-container` is the deprecated name for this, kept until 11; when both are\n * set, `src` wins.\n */\n @property({ type: String })\n public src: string | null = null;\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n // The provided value is this element, whose identity never changes: force the notification.\n if (changed.has('src')) this.#hostProvider.setValue(this, true);\n }\n\n @state()\n @provide({ context: configContext })\n public configContext: ConfigContext = {};\n\n /**\n * Who is taking which test, and the optional shuffle `seed`. Provided here, at the test, so\n * everything inside reads one value: the test-container shuffling the item order, the test\n * shuffling interactions as it navigates, and the expressions that read `QTI_CONTEXT`.\n *\n * Pass the same `seed` when resuming a session, or the order comes back different. Replace the\n * object, do not mutate it: an in-place change does not notify the components inside.\n *\n * `test-navigation.qtiContext` is an alias of this.\n */\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n /**\n * Renders the component's template.\n * Provides a default `<slot>` for content projection.\n */\n override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n await this.updateComplete;\n this.dispatchEvent(new CustomEvent('qti-test-connected', { detail: this }));\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-test': QtiTest;\n }\n}\n"]}
@@ -15,8 +15,8 @@ import type { ComputedContext } from '@qti-components/base';
15
15
  * interacting (its attempts used, a completed adaptive item, or passed in a linear part), when no
16
16
  * attempt is left, or while its responses may not be submitted (`allow-skipping="false"` with no
17
17
  * answer, `validate-responses` with an invalid one). The score never disables it: a right answer
18
- * leaves the attempts `max-attempts` gives (decided 2026-11-27). In a simultaneous part it ends the
19
- * item's attempt as before, until part submission processes the responses (roadmap 1, T6).
18
+ * leaves the attempts `max-attempts` gives (decided 2026-11-27). In a part with simultaneous
19
+ * submission it is always disabled: `submit()` ends every attempt of the part at once (roadmap 1, T6).
20
20
  *
21
21
  * @slot - The label.
22
22
  * @attr require-answer - Also disabled while the response is invalid or still the default, whatever the item's session control says.
@@ -35,8 +35,8 @@ const itemRefOf = (element) => {
35
35
  * interacting (its attempts used, a completed adaptive item, or passed in a linear part), when no
36
36
  * attempt is left, or while its responses may not be submitted (`allow-skipping="false"` with no
37
37
  * answer, `validate-responses` with an invalid one). The score never disables it: a right answer
38
- * leaves the attempts `max-attempts` gives (decided 2026-11-27). In a simultaneous part it ends the
39
- * item's attempt as before, until part submission processes the responses (roadmap 1, T6).
38
+ * leaves the attempts `max-attempts` gives (decided 2026-11-27). In a part with simultaneous
39
+ * submission it is always disabled: `submit()` ends every attempt of the part at once (roadmap 1, T6).
40
40
  *
41
41
  * @slot - The label.
42
42
  * @attr require-answer - Also disabled while the response is invalid or still the default, whatever the item's session control says.
@@ -87,9 +87,16 @@ export class TestEndAttempt extends LitElement {
87
87
  this._internalDisabled = false;
88
88
  return;
89
89
  }
90
+ // A part with simultaneous submission ends every attempt when the part is submitted (QTI 3 info
91
+ // model §2.8.2; decided 2026-12-01): nothing ends one before.
92
+ const part = testParts.find(tp => itemsInOrder(tp).includes(activeItem));
93
+ if (part?.submissionMode === 'simultaneous') {
94
+ this._internalDisabled = true;
95
+ return;
96
+ }
90
97
  const rules = activeItem.rules;
91
98
  // `interactive && attemptsLeft` is `mayEndAttempt` in a part with individual submission; it also
92
- // covers a simultaneous part, kept until T6, and `auto-score-items`, whose sessions stay open.
99
+ // covers `auto-score-items`, whose sessions stay open.
93
100
  const mayEnd = rules ? rules.interactive && rules.attemptsLeft && rules.maySubmit : fromSessionControl(activeItem);
94
101
  const answered = activeItem.valid !== false && !activeItem.isDefaultResponse;
95
102
  this._internalDisabled = !mayEnd || (this.requireAnswer && !answered);
@@ -1 +1 @@
1
- {"version":3,"file":"test-end-attempt.js","sourceRoot":"","sources":["../../../src/components/test-end-attempt/test-end-attempt.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAA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;AACjF,CAAC","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\n\nimport * as styles from '../styles';\nimport { dispatchPublic } from '../../public-events';\nimport { activeTestPart, itemsInOrder } from '../../computed-tree';\n\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\n\n/** The identifier of the item-ref an element is stamped into (`<template item-ref>`), looking out through shadow roots. */\nconst itemRefOf = (element: Element): string | undefined => {\n const itemRef = element.closest('qti-assessment-item-ref');\n if (itemRef) return itemRef.getAttribute('identifier') ?? undefined;\n const root = element.getRootNode();\n return root instanceof ShadowRoot ? itemRefOf(root.host) : undefined;\n};\n\n/**\n * A button that ends the attempt of an item: its response is processed, `numAttempts` goes up and\n * feedback is shown as the item's session control allows. It dispatches `qc-test-end-attempt`,\n * which `<test-navigation>` handles.\n *\n * Put it inside `<test-navigation>`, either in the toolbar, where it ends the attempt of the item on\n * screen, or in the `<template item-ref>`, where each item gets its own and it ends the attempt of\n * that item: with `<qti-test navigate=\"section\">` every item of the section is on screen, each with\n * its own button. Give it an `item` (an item-ref identifier) to end the attempt of that item instead,\n * wherever the button sits.\n *\n * It is `disabled` by its item's session (`computedContext` item `rules`): when the item is not\n * interacting (its attempts used, a completed adaptive item, or passed in a linear part), when no\n * attempt is left, or while its responses may not be submitted (`allow-skipping=\"false\"` with no\n * answer, `validate-responses` with an invalid one). The score never disables it: a right answer\n * leaves the attempts `max-attempts` gives (decided 2026-11-27). In a simultaneous part it ends the\n * item's attempt as before, until part submission processes the responses (roadmap 1, T6).\n *\n * @slot - The label.\n * @attr require-answer - Also disabled while the response is invalid or still the default, whatever the item's session control says.\n * @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.\n * @attr disabled - Reflected: the item's attempt cannot be ended.\n */\nexport class TestEndAttempt extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n @property({ attribute: false })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, reflect: true, attribute: 'disabled' })\n public _internalDisabled = false;\n\n @property({ reflect: true }) item?: string;\n\n /** Ends no attempt until the response is valid and not the default, whatever the item's `allow-skipping` says. */\n @property({ type: Boolean, reflect: true, attribute: 'require-answer' }) requireAnswer = false;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.requestUpdate();\n }\n }\n\n static override styles = styles.button;\n\n constructor() {\n super();\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this._internalDisabled) {\n // An item of its own goes along, so the navigation ends that item's attempt and not the\n // one on screen; without one, the navigation takes the item on screen, as before.\n const itemId = this.#ownItem;\n dispatchPublic(this, 'qc-test-end-attempt', itemId ? { itemId } : {});\n }\n });\n }\n\n /** The item named by `item`, or else the item-ref it is stamped into. */\n get #ownItem(): string | undefined {\n return this.item || itemRefOf(this);\n }\n\n override willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n this.checkDisabled();\n }\n\n checkDisabled() {\n const testParts = this.computedContext?.testParts;\n const ownItem = this.#ownItem;\n const testPart = activeTestPart(this.computedContext);\n if (!testParts || (!ownItem && !testPart)) return;\n // Its own item (an instance: a clone is `item-3#2`) wherever it is in the test, or else the item\n // on screen in the active part.\n const activeItem = ownItem\n ? testParts.flatMap(itemsInOrder).find(i => i.instance === ownItem)\n : itemsInOrder(testPart).find(item => item.active);\n\n if (!activeItem) {\n this._internalDisabled = false;\n return;\n }\n\n const rules = activeItem.rules;\n // `interactive && attemptsLeft` is `mayEndAttempt` in a part with individual submission; it also\n // covers a simultaneous part, kept until T6, and `auto-score-items`, whose sessions stay open.\n const mayEnd = rules ? rules.interactive && rules.attemptsLeft && rules.maySubmit : fromSessionControl(activeItem);\n const answered = activeItem.valid !== false && !activeItem.isDefaultResponse;\n this._internalDisabled = !mayEnd || (this.requireAnswer && !answered);\n }\n\n override render() {\n return styles.control;\n }\n}\n\n/**\n * For a computed item without `rules` (a context a host built): the same QTI rules from its session\n * control, attempts and responses (`qti-item-session-control`, info model §7.19).\n */\nfunction fromSessionControl(item: ComputedItem): boolean {\n const { maxAttempts = 1, allowSkipping = true, validateResponses = false } = item.sessionControl ?? {};\n const numAttempts = item.numAttempts || 0;\n const attemptsLeft = item.adaptive\n ? item.completionStatus !== 'completed'\n : maxAttempts === 0 || numAttempts < maxAttempts;\n const maySkip = allowSkipping || !item.isDefaultResponse;\n return attemptsLeft && maySkip && (!validateResponses || item.valid !== false);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-end-attempt': TestEndAttempt;\n }\n}\n"]}
1
+ {"version":3,"file":"test-end-attempt.js","sourceRoot":"","sources":["../../../src/components/test-end-attempt/test-end-attempt.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInE,2HAA2H;AAC3H,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAsB,EAAE;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC3D,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC;IACpE,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACnC,OAAO,IAAI,YAAY,UAAU,CAAC,CAAC,CAAC,SAAS,CAA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port { computedContext } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\n\nimport * as styles from '../styles';\nimport { dispatchPublic } from '../../public-events';\nimport { activeTestPart, itemsInOrder } from '../../computed-tree';\n\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\n\n/** The identifier of the item-ref an element is stamped into (`<template item-ref>`), looking out through shadow roots. */\nconst itemRefOf = (element: Element): string | undefined => {\n const itemRef = element.closest('qti-assessment-item-ref');\n if (itemRef) return itemRef.getAttribute('identifier') ?? undefined;\n const root = element.getRootNode();\n return root instanceof ShadowRoot ? itemRefOf(root.host) : undefined;\n};\n\n/**\n * A button that ends the attempt of an item: its response is processed, `numAttempts` goes up and\n * feedback is shown as the item's session control allows. It dispatches `qc-test-end-attempt`,\n * which `<test-navigation>` handles.\n *\n * Put it inside `<test-navigation>`, either in the toolbar, where it ends the attempt of the item on\n * screen, or in the `<template item-ref>`, where each item gets its own and it ends the attempt of\n * that item: with `<qti-test navigate=\"section\">` every item of the section is on screen, each with\n * its own button. Give it an `item` (an item-ref identifier) to end the attempt of that item instead,\n * wherever the button sits.\n *\n * It is `disabled` by its item's session (`computedContext` item `rules`): when the item is not\n * interacting (its attempts used, a completed adaptive item, or passed in a linear part), when no\n * attempt is left, or while its responses may not be submitted (`allow-skipping=\"false\"` with no\n * answer, `validate-responses` with an invalid one). The score never disables it: a right answer\n * leaves the attempts `max-attempts` gives (decided 2026-11-27). In a part with simultaneous\n * submission it is always disabled: `submit()` ends every attempt of the part at once (roadmap 1, T6).\n *\n * @slot - The label.\n * @attr require-answer - Also disabled while the response is invalid or still the default, whatever the item's session control says.\n * @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.\n * @attr disabled - Reflected: the item's attempt cannot be ended.\n */\nexport class TestEndAttempt extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n @property({ attribute: false })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, reflect: true, attribute: 'disabled' })\n public _internalDisabled = false;\n\n @property({ reflect: true }) item?: string;\n\n /** Ends no attempt until the response is valid and not the default, whatever the item's `allow-skipping` says. */\n @property({ type: Boolean, reflect: true, attribute: 'require-answer' }) requireAnswer = false;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.requestUpdate();\n }\n }\n\n static override styles = styles.button;\n\n constructor() {\n super();\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this._internalDisabled) {\n // An item of its own goes along, so the navigation ends that item's attempt and not the\n // one on screen; without one, the navigation takes the item on screen, as before.\n const itemId = this.#ownItem;\n dispatchPublic(this, 'qc-test-end-attempt', itemId ? { itemId } : {});\n }\n });\n }\n\n /** The item named by `item`, or else the item-ref it is stamped into. */\n get #ownItem(): string | undefined {\n return this.item || itemRefOf(this);\n }\n\n override willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n this.checkDisabled();\n }\n\n checkDisabled() {\n const testParts = this.computedContext?.testParts;\n const ownItem = this.#ownItem;\n const testPart = activeTestPart(this.computedContext);\n if (!testParts || (!ownItem && !testPart)) return;\n // Its own item (an instance: a clone is `item-3#2`) wherever it is in the test, or else the item\n // on screen in the active part.\n const activeItem = ownItem\n ? testParts.flatMap(itemsInOrder).find(i => i.instance === ownItem)\n : itemsInOrder(testPart).find(item => item.active);\n\n if (!activeItem) {\n this._internalDisabled = false;\n return;\n }\n\n // A part with simultaneous submission ends every attempt when the part is submitted (QTI 3 info\n // model §2.8.2; decided 2026-12-01): nothing ends one before.\n const part = testParts.find(tp => itemsInOrder(tp).includes(activeItem));\n if (part?.submissionMode === 'simultaneous') {\n this._internalDisabled = true;\n return;\n }\n const rules = activeItem.rules;\n // `interactive && attemptsLeft` is `mayEndAttempt` in a part with individual submission; it also\n // covers `auto-score-items`, whose sessions stay open.\n const mayEnd = rules ? rules.interactive && rules.attemptsLeft && rules.maySubmit : fromSessionControl(activeItem);\n const answered = activeItem.valid !== false && !activeItem.isDefaultResponse;\n this._internalDisabled = !mayEnd || (this.requireAnswer && !answered);\n }\n\n override render() {\n return styles.control;\n }\n}\n\n/**\n * For a computed item without `rules` (a context a host built): the same QTI rules from its session\n * control, attempts and responses (`qti-item-session-control`, info model §7.19).\n */\nfunction fromSessionControl(item: ComputedItem): boolean {\n const { maxAttempts = 1, allowSkipping = true, validateResponses = false } = item.sessionControl ?? {};\n const numAttempts = item.numAttempts || 0;\n const attemptsLeft = item.adaptive\n ? item.completionStatus !== 'completed'\n : maxAttempts === 0 || numAttempts < maxAttempts;\n const maySkip = allowSkipping || !item.isDefaultResponse;\n return attemptsLeft && maySkip && (!validateResponses || item.valid !== false);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-end-attempt': TestEndAttempt;\n }\n}\n"]}
@@ -8,7 +8,7 @@ import { ContextConsumer, consume, provide } from '@lit/context';
8
8
  import { html, LitElement } from 'lit';
9
9
  import { property, state } from 'lit/decorators.js';
10
10
  import { computedContext } from '@qti-components/base';
11
- import { buildTestModel, endItemAttempt, followItemSession, itemRefsInOrder, readItemFacts, seedItemLifecycle } from '@qti-components/delivery';
11
+ import { buildTestModel, endItemAttempt, followItemSession, itemRefsInOrder, readItemFacts, seedItemLifecycle, submitTestPart } from '@qti-components/delivery';
12
12
  import { configContext } from '@qti-components/base';
13
13
  import { testContext } from '@qti-components/base';
14
14
  import { sessionContext } from '@qti-components/base';
@@ -18,7 +18,7 @@ import { itemFactsContext } from '../../internal/item-facts.context';
18
18
  import { attemptsOf, itemSessionFacts } from '../../internal/item-session-facts';
19
19
  import { renderedMarkup } from '../../internal/rendered-markup';
20
20
  import { testHostContext } from '../../internal/test-host.context';
21
- import { listenPublic } from '../../public-events';
21
+ import { dispatchPublic, listenPublic } from '../../public-events';
22
22
  import { itemsInOrder } from '../../computed-tree';
23
23
  /** A new object each time: a host that mutates the one it read must not change anyone else's. */
24
24
  const newQtiContext = () => ({
@@ -61,21 +61,43 @@ export class TestNavigation extends LitElement {
61
61
  /** The `qti-test` this navigation answers Next for in a linear part. */
62
62
  #linearNextHost;
63
63
  #registerLinearNext(host) {
64
- if (this.#linearNextHost && this.#linearNextHost !== host)
64
+ if (this.#linearNextHost && this.#linearNextHost !== host) {
65
65
  this.#linearNextHost.beforeLinearNext = null;
66
+ this.#linearNextHost.submitTestParts = null;
67
+ }
66
68
  this.#linearNextHost = host;
67
69
  host.beforeLinearNext = this.#beforeLinearNext;
70
+ host.submitTestParts = this.#submitTestParts;
68
71
  }
69
72
  connectedCallback() {
70
73
  super.connectedCallback();
71
- if (this.#linearNextHost)
74
+ if (this.#linearNextHost) {
72
75
  this.#linearNextHost.beforeLinearNext = this.#beforeLinearNext;
76
+ this.#linearNextHost.submitTestParts = this.#submitTestParts;
77
+ }
73
78
  }
74
79
  disconnectedCallback() {
75
80
  super.disconnectedCallback();
76
81
  if (this.#linearNextHost?.beforeLinearNext === this.#beforeLinearNext)
77
82
  this.#linearNextHost.beforeLinearNext = null;
83
+ if (this.#linearNextHost?.submitTestParts === this.#submitTestParts)
84
+ this.#linearNextHost.submitTestParts = null;
85
+ }
86
+ /** The `submission-mode` of the test part that holds the item-ref; undefined before the model is known. */
87
+ #submissionModeOf(itemRefId) {
88
+ if (!itemRefId)
89
+ return undefined;
90
+ return this.#model?.testParts.find(testPart => itemRefsInOrder(testPart.sections).some(item => item.identifier === itemRefId))?.submissionMode;
78
91
  }
92
+ /**
93
+ * Submits every test part with simultaneous submission that is not submitted yet, as a paper exam
94
+ * is handed in (QTI 3 info model §2.8.2; decided 2026-12-01, `plans/host-api.md`): each item the
95
+ * candidate opened gets its one attempt (`numAttempts` 1) and, when it is not adaptive,
96
+ * `completionStatus` `completed`; every session closes (`submitTestPart`). The responses were
97
+ * scored in the background as they changed, so nothing is processed again here. The caller runs
98
+ * the test's outcome processing after it (`submit()`). Sends `qc-test-part-submitted` per part.
99
+ */
100
+ #submitTestParts;
79
101
  /**
80
102
  * Next in a linear individual part leaves the item for good (implementation guide §4.1), so it
81
103
  * submits what the candidate gave (decided 2026-11-27): refused while the session control refuses
@@ -139,6 +161,49 @@ export class TestNavigation extends LitElement {
139
161
  this.#registerLinearNext(host);
140
162
  }
141
163
  });
164
+ /**
165
+ * Submits every test part with simultaneous submission that is not submitted yet, as a paper exam
166
+ * is handed in (QTI 3 info model §2.8.2; decided 2026-12-01, `plans/host-api.md`): each item the
167
+ * candidate opened gets its one attempt (`numAttempts` 1) and, when it is not adaptive,
168
+ * `completionStatus` `completed`; every session closes (`submitTestPart`). The responses were
169
+ * scored in the background as they changed, so nothing is processed again here. The caller runs
170
+ * the test's outcome processing after it (`submit()`). Sends `qc-test-part-submitted` per part.
171
+ */
172
+ this.#submitTestParts = () => {
173
+ const host = this.#testHost.value;
174
+ if (!this.#model || !host)
175
+ return;
176
+ const facts = this.#sessionFacts();
177
+ for (const testPart of this.#model.testParts) {
178
+ if (testPart.submissionMode !== 'simultaneous')
179
+ continue;
180
+ const items = itemRefsInOrder(testPart.sections).flatMap(({ identifier }) => {
181
+ const itemFacts = facts.get(identifier);
182
+ return itemFacts
183
+ ? [{ item: identifier, previous: this.#sessions.get(identifier) ?? null, facts: itemFacts }]
184
+ : [];
185
+ });
186
+ const submission = submitTestPart(items);
187
+ if (!submission)
188
+ continue;
189
+ const submitted = [];
190
+ for (const { item, session } of submission.sessions) {
191
+ const before = facts.get(item);
192
+ this.#sessions.set(item, session);
193
+ if (session.numAttempts === before.numAttempts)
194
+ continue;
195
+ submitted.push(item);
196
+ host.updateItemVariables(item, [
197
+ { identifier: 'numAttempts', value: String(session.numAttempts) },
198
+ ...(session.adaptive ? [] : [{ identifier: 'completionStatus', value: 'completed' }])
199
+ ]);
200
+ }
201
+ if (submitted.length === 0)
202
+ continue;
203
+ dispatchPublic(host, 'qc-test-part-submitted', { testPart: testPart.identifier, items: submitted });
204
+ }
205
+ this.requestUpdate();
206
+ };
142
207
  /**
143
208
  * Next in a linear individual part leaves the item for good (implementation guide §4.1), so it
144
209
  * submits what the candidate gave (decided 2026-11-27): refused while the session control refuses
@@ -183,6 +248,8 @@ export class TestNavigation extends LitElement {
183
248
  this.#sessions = new Map();
184
249
  /** `computedContext.itemElement`: one function for the life of this element, carried along by every update. */
185
250
  this.#itemElement = (identifier) => this.#assessmentItemFor(identifier) ?? null;
251
+ /** The rendered items already scored on arrival, so each is scored once per rendering. */
252
+ this.#scoredOnArrival = new WeakSet();
186
253
  /** The items this navigation disabled because their attempts are used, so it releases only those. */
187
254
  this.#lockedItems = new WeakSet();
188
255
  listenPublic(this, 'qc-test-loaded', this.#handleTestConnected.bind(this));
@@ -332,6 +399,11 @@ export class TestNavigation extends LitElement {
332
399
  const qtiAssessmentItemEl = itemId ? this.#assessmentItemFor(itemId) : this.activeAssessmentItem;
333
400
  if (!qtiAssessmentItemEl)
334
401
  return;
402
+ const itemRefId = itemId ?? this._sessionContext?.navItemRefId ?? undefined;
403
+ if (this.#submissionModeOf(itemRefId) === 'simultaneous') {
404
+ console.warn(`[qti-test] Ignoring an end attempt for "${itemRefId}": its test part has simultaneous submission, so its attempt ends when the part is submitted.`);
405
+ return;
406
+ }
335
407
  const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
336
408
  qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
337
409
  }
@@ -345,6 +417,17 @@ export class TestNavigation extends LitElement {
345
417
  const itemRefId = this.#itemRefIdOf(_event.composedPath()[0]);
346
418
  if (itemRefId)
347
419
  this.#changed.add(itemRefId);
420
+ // A part with simultaneous submission is a paper exam (decided 2026-12-01): every change is
421
+ // scored in the background, without ending the attempt, so a saved state always holds the
422
+ // scores. `auto-score-items` adds nothing there. An item whose `SCORE` is `external-scored` is
423
+ // left alone, as `auto-score-items` left it: a run would reset the score a scorer gave.
424
+ if (this.#submissionModeOf(itemRefId) === 'simultaneous') {
425
+ const computedItem = this.computedItemFor(itemRefId);
426
+ if (computedItem?.rules?.done || computedItem?.externalScored)
427
+ return;
428
+ this.#assessmentItemFor(itemRefId)?.scoreResponse();
429
+ return;
430
+ }
348
431
  if (this.autoScoreItems) {
349
432
  const assessmentItem = _event.composedPath()[0].closest('qti-assessment-item');
350
433
  // Autoscoring resolves the item from the event's own path, so a change
@@ -487,6 +570,32 @@ export class TestNavigation extends LitElement {
487
570
  updated(changedProperties) {
488
571
  super.updated(changedProperties);
489
572
  this.#lockUsedItems();
573
+ this.#scoreOnFirstPresentation();
574
+ }
575
+ /** The rendered items already scored on arrival, so each is scored once per rendering. */
576
+ #scoredOnArrival;
577
+ /**
578
+ * In a part with simultaneous submission, scores every item once in the background when it is
579
+ * first shown (decided 2026-12-03). An item the candidate opens and leaves blank gets the outcomes
580
+ * its response processing gives no answer, as it would on paper, not only their defaults; a
581
+ * restored item is scored again from its restored responses, which gives the same scores. Skipped,
582
+ * like every background score, for a closed item and one whose `SCORE` is `external-scored`.
583
+ */
584
+ #scoreOnFirstPresentation() {
585
+ if (!this.#testElement || !this.computedContext)
586
+ return;
587
+ for (const itemRef of this.#testElement.querySelectorAll('qti-assessment-item-ref')) {
588
+ const element = itemRef.assessmentItem;
589
+ if (!element || this.#scoredOnArrival.has(element))
590
+ continue;
591
+ if (this.#submissionModeOf(itemRef.identifier) !== 'simultaneous')
592
+ continue;
593
+ const computedItem = this.computedItemFor(itemRef.identifier);
594
+ if (!computedItem || computedItem.rules?.done || computedItem.externalScored)
595
+ continue;
596
+ if (element.scoreResponse())
597
+ this.#scoredOnArrival.add(element);
598
+ }
490
599
  }
491
600
  /** The items this navigation disabled because their attempts are used, so it releases only those. */
492
601
  #lockedItems;
@@ -495,7 +604,8 @@ export class TestNavigation extends LitElement {
495
604
  * a completed adaptive item), so the candidate cannot change the answer once the last attempt is
496
605
  * ended (QTI info model §2.2.1). Runs after every update: an item rendered later (another item, a
497
606
  * section on screen, a restored state) is locked as it arrives, and one whose attempts are back to
498
- * zero (a new state) is released.
607
+ * zero (a new state) is released. In a part with simultaneous submission every session closes
608
+ * when the part is submitted, so its items lock then.
499
609
  *
500
610
  * Only `disabled = true` is ever set here, and only on an item that was not disabled already; a
501
611
  * host or view that disables or makes an item read-only itself keeps it so.
@@ -503,16 +613,20 @@ export class TestNavigation extends LitElement {
503
613
  #lockUsedItems() {
504
614
  if (!this.#testElement || !this.computedContext)
505
615
  return;
506
- // In a simultaneous part every item has one attempt, processed when the part ends (QTI info model
507
- // §2.8.2), so the candidate may change the answer until then: TAO keeps such an item open too.
508
- const items = new Map(this.computedContext.testParts.flatMap(part => part.submissionMode === 'simultaneous' ? [] : itemsInOrder(part).map(item => [item.instance, item])));
616
+ const items = new Map(this.computedContext.testParts.flatMap(part => itemsInOrder(part).map(item => [item.instance, { item, simultaneous: part.submissionMode === 'simultaneous' }])));
509
617
  for (const itemRef of this.#testElement.querySelectorAll('qti-assessment-item-ref')) {
510
618
  const element = itemRef.assessmentItem;
511
619
  if (!element)
512
620
  continue;
621
+ const entry = items.get(itemRef.identifier);
622
+ // A simultaneous part ends attempts only when it is submitted, so its end-attempt
623
+ // interactions are off (decided 2026-12-01).
624
+ if (entry?.simultaneous)
625
+ this.#disableEndAttemptInteractions(element);
513
626
  // The session is over (closed, or in review or solution). With `auto-score-items` every change
514
- // is scored as an attempt, so the count is not the candidate's and locks nothing.
515
- const used = !this.autoScoreItems && items.get(itemRef.identifier)?.rules?.done === true;
627
+ // is scored as an attempt, so the count is not the candidate's and locks nothing; in a
628
+ // simultaneous part it is built in and never counts, so the session decides.
629
+ const used = (entry?.simultaneous || !this.autoScoreItems) && entry?.item.rules?.done === true;
516
630
  if (used && !element.disabled) {
517
631
  element.disabled = true;
518
632
  this.#lockedItems.add(element);
@@ -523,6 +637,12 @@ export class TestNavigation extends LitElement {
523
637
  }
524
638
  }
525
639
  }
640
+ #disableEndAttemptInteractions(element) {
641
+ for (const interaction of element.querySelectorAll('qti-end-attempt-interaction')) {
642
+ if (!interaction.disabled)
643
+ interaction.disabled = true;
644
+ }
645
+ }
526
646
  }
527
647
  __decorate([
528
648
  property({ type: String })
@@ -1 +1 @@
1
- {"version":3,"file":"test-navigation.js","sourceRoot":"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;mDAC8D;AAiH/D;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;qDACZ;AAI/B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oDACd;AAI3B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDACX;AAKjC;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;kDAClB;AAI5B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;uDACK;AAEiB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;sDAAwB","sourcesContent":["import { ContextConsumer, consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\nimport {\n buildTestModel,\n endItemAttempt,\n followItemSession,\n itemRefsInOrder,\n readItemFacts,\n seedItemLifecycle\n} from '@qti-components/delivery';\nimport { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\nimport { listenPublic as listenItemPublic } from '@qti-components/elements/public-events';\n\nimport { assessOptimality, deriveComputedContext } from '../../internal/derive-computed-context';\nimport { itemFactsContext } from '../../internal/item-facts.context';\nimport { attemptsOf, itemSessionFacts } from '../../internal/item-session-facts';\nimport { renderedMarkup } from '../../internal/rendered-markup';\nimport { testHostContext } from '../../internal/test-host.context';\nimport { listenPublic } from '../../public-events';\nimport { itemsInOrder } from '../../computed-tree';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiContext } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef } from '../qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { ItemSession, ItemSessionFacts, TestModel } from '@qti-components/delivery';\nimport type { ItemOptimality } from '../../internal/derive-computed-context';\nimport type { ItemFactsByRef } from '../../internal/item-facts.context';\nimport type { LinearNextRefusal, TestHost } from '../../internal/test-host.context';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\n/** A new object each time: a host that mutates the one it read must not change anyone else's. */\nconst newQtiContext = (): QtiContext => ({\n QTI_CONTEXT: { testIdentifier: '', candidateIdentifier: '', environmentIdentifier: 'default' }\n});\n\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier: string | undefined = undefined;\n\n /**\n * Your own per-item fields, by item-ref `identifier`: each `computedContext` item carries them as\n * given under `data`, without the identifier, and so does every view of it a plugin derives. They\n * never replace a field the test, the item or the candidate's state gives, whatever its name; a\n * template reads `activeItem.data.<field>`. To mark an item as scored by hand, set\n * `external-scored` on its `SCORE` declaration in `postLoadTransformCallback`.\n */\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n /**\n * @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the\n * enclosing test's: reading returns it, writing replaces it, so a host that has always set the\n * shuffle seed here keeps working. Removed in the next major.\n *\n * Written before the navigation is inside a test, it waits and is handed over on connect.\n */\n public get qtiContext(): QtiContext {\n return this.#owner()?.qtiContext ?? (this.#pendingQtiContext ??= newQtiContext());\n }\n\n public set qtiContext(value: QtiContext) {\n if (!this.#warnedQtiContext) {\n this.#warnedQtiContext = true;\n console.warn(\n '[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major ' +\n 'release. Set `qtiContext` on `<qti-test>` instead; it is the same value.'\n );\n }\n this.#writeQtiContext(value);\n }\n\n #pendingQtiContext?: QtiContext;\n #warnedQtiContext = false;\n\n /** The write the library itself makes. Not the deprecated setter, so it never warns about itself. */\n #writeQtiContext(value: QtiContext): void {\n const owner = this.#owner();\n if (owner) owner.qtiContext = value;\n else this.#pendingQtiContext = value;\n }\n\n /**\n * The `qti-test` this navigation is in, found through context so it works across shadow roots.\n * A write made before it is known waits in `#pendingQtiContext` and is handed over on arrival.\n */\n #testHost = new ContextConsumer(this, {\n context: testHostContext,\n subscribe: true,\n callback: host => {\n if (host && this.#pendingQtiContext) {\n host.qtiContext = this.#pendingQtiContext;\n this.#pendingQtiContext = undefined;\n }\n if (host) this.#registerLinearNext(host);\n }\n });\n\n /** The `qti-test` this navigation answers Next for in a linear part. */\n #linearNextHost?: TestHost;\n\n #registerLinearNext(host: TestHost): void {\n if (this.#linearNextHost && this.#linearNextHost !== host) this.#linearNextHost.beforeLinearNext = null;\n this.#linearNextHost = host;\n host.beforeLinearNext = this.#beforeLinearNext;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.#linearNextHost) this.#linearNextHost.beforeLinearNext = this.#beforeLinearNext;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.#linearNextHost?.beforeLinearNext === this.#beforeLinearNext) this.#linearNextHost.beforeLinearNext = null;\n }\n\n /**\n * Next in a linear individual part leaves the item for good (implementation guide §4.1), so it\n * submits what the candidate gave (decided 2026-11-27): refused while the session control refuses\n * those responses (`rules.maySubmit`), else the attempt is ended when one is open: none ended yet,\n * or the responses changed since the last. Called by the navigation mixin while the item is still\n * rendered; the item is closed when the navigation moves past it.\n */\n #beforeLinearNext = (itemRefId: string): LinearNextRefusal | null => {\n const part = this.#model?.testParts.find(testPart =>\n itemRefsInOrder(testPart.sections).some(item => item.identifier === itemRefId)\n );\n if (part?.navigationMode !== 'linear' || part.submissionMode !== 'individual') return null;\n const session = this.#sessions.get(itemRefId);\n const rules = this.computedItemFor(itemRefId)?.rules;\n if (session?.state !== 'interacting' || !rules) return null;\n if (!rules.maySubmit) {\n return { reason: rules.maySkip ? 'validate-responses' : 'allow-skipping', itemId: itemRefId };\n }\n if (session.numAttempts === 0 || this.#changed.has(itemRefId)) {\n this.#assessmentItemFor(itemRefId)?.processResponse(\n true,\n this.configContext?.reportValidityAfterScoring === true\n );\n }\n return null;\n };\n\n /** The item-refs whose responses changed since their last ended attempt. */\n #changed = new Set<string>();\n\n #itemRefIdOf(element: EventTarget | undefined): string | undefined {\n const item = (element as HTMLElement | undefined)?.closest?.('qti-assessment-item');\n if (!item) return undefined;\n return [...(this.#testElement?.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref') ?? [])].find(\n itemRef => itemRef.assessmentItem === item\n )?.identifier;\n }\n\n #owner(): { qtiContext: QtiContext } | null {\n return this.#testHost.value ?? null;\n }\n\n @state()\n @consume({ context: configContext, subscribe: true })\n public configContext: ConfigContext = {};\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n /** Read from each item's XML when `qti-test` fetches it; see `itemFactsContext`. */\n @state()\n @consume({ context: itemFactsContext, subscribe: true })\n protected _itemFacts?: ItemFactsByRef;\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n #testElement: QtiAssessmentTest;\n\n /**\n * Whether each item's last *ended attempt* reached the optimal outcome, keyed\n * by item-ref id. Written from #handleItemContextUpdated when processResponse\n * ends an attempt — never on a plain selection. Mirrors how inline feedback\n * only re-evaluates when an attempt is processed, so a freshly-picked answer\n * doesn't flip `done` until the candidate ends the attempt.\n */\n #optimality = new Map<string, ItemOptimality>();\n\n /**\n * Each item session's lifecycle state, by item-ref identifier, changed only through the lifecycle\n * table (`followItemSession` as the candidate moves, `endItemAttempt` when an attempt ends). It\n * lives here until `DeliveryState` holds it (roadmap 1, T3d); a session whose attempts change\n * outside an ended attempt (a restored or assigned state) is seeded again.\n */\n #sessions = new Map<string, ItemSession>();\n\n constructor() {\n super();\n listenPublic(this, 'qc-test-loaded', this.#handleTestConnected.bind(this));\n\n listenItemPublic(this, 'qc-item-response-changed', this.#handleInteractionChanged.bind(this));\n this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n listenPublic(this, 'qc-test-end-attempt', this.#handleTestEndAttempt.bind(this));\n listenPublic(this, 'qc-test-update-outcome', this.#handleTestUpdateOutcomeVariable.bind(this));\n listenPublic(this, 'qc-test-update-comment', this.#handleUpdateComment.bind(this));\n }\n\n /**\n * Sets the candidate's comment on an item when its session allows it (`rules.mayComment`:\n * `allow-comment`, while interacting; decided 2026-11-27, carried, not rendered).\n */\n #handleUpdateComment(event: CustomEvent<{ itemId: string; comment: string | null }>) {\n const { itemId, comment = null } = event.detail ?? ({} as { itemId?: string; comment?: string | null });\n const host = this.#testHost.value;\n if (!itemId || !host) return;\n if (comment !== null && typeof comment !== 'string') {\n console.warn(`[qti-test] Ignoring a comment for \"${itemId}\" that is not a string.`);\n return;\n }\n if (!this.computedItemFor(itemId)?.rules?.mayComment) {\n console.warn(\n `[qti-test] Ignoring a comment for \"${itemId}\": its allow-comment is false, or it is not interacting.`\n );\n return;\n }\n host.updateItemComment(itemId, comment);\n }\n\n /**\n * Latch whether an item reached its optimal outcome whenever it has just ended\n * an attempt. processResponse — fired by test-end-attempt, autoscore, or an\n * in-item end-attempt interaction — flags its context update with\n * `responseProcessed`; a plain selection updates the context without it, so\n * `done` can't flip until the candidate actually ends the attempt.\n */\n #handleItemContextUpdated(event: CustomEvent<{ itemContext: ItemContext; responseProcessed?: boolean }>) {\n if (!event.detail?.responseProcessed) return;\n const itemContext = event.detail.itemContext;\n if (!itemContext?.identifier) return;\n this.#optimality.set(itemContext.identifier, assessOptimality(itemContext));\n this.#changed.delete(itemContext.identifier);\n this.#endAttempt(itemContext);\n\n const computedItem = this.computedItemFor(itemContext.identifier);\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#doneAfterAttempt(itemContext, computedItem)\n );\n }\n\n /**\n * Moves the item's session on for its ended attempt. With `auto-score-items` every change is\n * scored as an attempt, so the count is not the candidate's: it is taken, and the state stays.\n */\n #endAttempt(itemContext: ItemContext): void {\n const facts = this.#sessionFacts().get(itemContext.identifier);\n if (!facts) return;\n const ended: ItemSessionFacts = { ...facts, ...attemptsOf(itemContext) };\n const previous = this.#sessions.get(itemContext.identifier);\n this.#sessions.set(\n itemContext.identifier,\n this.autoScoreItems\n ? {\n state: previous?.state ?? followItemSession(undefined, ended).state,\n numAttempts: ended.numAttempts,\n adaptive: ended.adaptive\n }\n : endItemAttempt(previous, ended)\n );\n }\n\n /**\n * Whether the item session is over after the attempt that just ended: its new state, or, before\n * the test model is known, the state an item on screen with these attempts is in.\n */\n #doneAfterAttempt(itemContext: ItemContext, computedItem: ComputedItem | undefined): boolean {\n const state =\n this.#sessions.get(itemContext.identifier)?.state ??\n (computedItem?.sessionControl\n ? seedItemLifecycle({\n sessionControl: computedItem.sessionControl,\n adaptive: computedItem.adaptive ?? false,\n ...attemptsOf(itemContext),\n presented: true,\n passed: false\n })\n : 'interacting');\n return state === 'closed' || state === 'review' || state === 'solution';\n }\n\n /** The facts of every item session now: the model, the item facts, the contexts and the items on screen. */\n #sessionFacts(): Map<string, ItemSessionFacts> {\n if (!this.#model) return new Map();\n const presented = new Set(\n [...(this.#testElement?.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref') ?? [])]\n .filter(itemRef => itemRef.assessmentItem)\n .map(itemRef => itemRef.identifier)\n );\n return itemSessionFacts(this.#model, this.#itemFacts(), this._testContext?.items, {\n current: this._sessionContext?.navItemRefId,\n presented\n });\n }\n\n /**\n * The item facts `qti-test` read from each fetched item, and, for an item rendered without them\n * (handed to its ref directly), the facts read from the rendered item.\n */\n #itemFacts(): ItemFactsByRef | undefined {\n const missing = [\n ...(this.#testElement?.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref') ?? [])\n ].filter(\n itemRef =>\n itemRef.assessmentItem?.localName === 'qti-assessment-item' && !this._itemFacts?.has(itemRef.identifier)\n );\n if (!missing.length) return this._itemFacts;\n const facts = new Map(this._itemFacts ?? []);\n for (const itemRef of missing) facts.set(itemRef.identifier, readItemFacts(renderedMarkup(itemRef.assessmentItem)));\n return facts;\n }\n\n /** Moves every item session on for where the candidate is now. */\n #followSessions(): void {\n for (const [identifier, facts] of this.#sessionFacts()) {\n this.#sessions.set(identifier, followItemSession(this.#sessions.get(identifier), facts));\n }\n }\n\n /**\n * Extension point for presentation packages reacting to an ended attempt. `done` is the item\n * session's after this attempt (closed: its attempts used, whatever the score), settled here\n * because the computed context only catches up on the next update.\n */\n protected afterAttemptEnded(\n _assessmentItem: QtiAssessmentItem | undefined,\n _computedItem: ComputedItem | undefined,\n _done: boolean\n ): void {}\n\n /** The computed-context entry for an item, from the session-control cascade. */\n protected computedItemFor(identifier: string): ComputedItem | undefined {\n return this.computedContext?.testParts.flatMap(itemsInOrder).find(i => i.instance === identifier);\n }\n\n /** The assessment item for an item-ref id, if it has been rendered. */\n #assessmentItemFor(identifier: string | undefined): QtiAssessmentItem | undefined {\n if (!identifier) return undefined;\n const itemRef = this.#testElement?.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${CSS.escape(identifier)}\"]`\n );\n return itemRef?.assessmentItem ?? undefined;\n }\n\n /** `computedContext.itemElement`: one function for the life of this element, carried along by every update. */\n #itemElement = (identifier: string): HTMLElement | null => this.#assessmentItemFor(identifier) ?? null;\n\n /** The currently active assessment item, exposed for optional presentation extensions. */\n protected get activeAssessmentItem(): QtiAssessmentItem | undefined {\n if (!this.#testElement || !this._sessionContext?.navItemRefId) return undefined;\n return this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n )?.assessmentItem;\n }\n\n /**\n * Ends an attempt: the item named by `detail.itemId` (a `test-end-attempt` stamped into an item, or\n * given an `item`), or else the item on screen.\n */\n #handleTestEndAttempt(event: CustomEvent<{ itemId?: string } | undefined>) {\n const itemId = event.detail?.itemId;\n const qtiAssessmentItemEl = itemId ? this.#assessmentItemFor(itemId) : this.activeAssessmentItem;\n if (!qtiAssessmentItemEl) return;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n #handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiAssessmentItemEl = this.#assessmentItemFor(event.detail?.assessmentItemRefId);\n if (!qtiAssessmentItemEl) return;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n #handleInteractionChanged(_event: CustomEvent) {\n const itemRefId = this.#itemRefIdOf(_event.composedPath()[0]);\n if (itemRefId) this.#changed.add(itemRefId);\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest<QtiAssessmentItem>(\n 'qti-assessment-item'\n );\n // Autoscoring resolves the item from the event's own path, so a change\n // raised outside an assessment item has nothing to score.\n if (!assessmentItem) return;\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n assessmentItem.processResponse(true, reportValidityAfterScoring);\n }\n }\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n /* PK: on test connected we can build the computed context */\n #handleTestConnected(event: CustomEvent) {\n this.#testElement = event.detail as QtiAssessmentTest;\n // A fresh test invalidates the per-test optimality latches and item sessions.\n this.#optimality.clear();\n this.#sessions.clear();\n this.#changed.clear();\n // Set the testIdentifier in qtiContext if not already set\n if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {\n const currentContext = this.qtiContext.QTI_CONTEXT || {\n testIdentifier: '',\n candidateIdentifier: 'not set',\n environmentIdentifier: 'default'\n };\n this.#writeQtiContext({\n QTI_CONTEXT: {\n ...currentContext,\n testIdentifier: this.#testElement.identifier,\n environmentIdentifier: currentContext.environmentIdentifier || 'default'\n }\n });\n }\n\n // Process qti-context-declaration elements to get default values\n const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier=\"QTI_CONTEXT\"]');\n\n contextDeclarations.forEach(declaration => {\n const defaultValues = this.#extractDefaultValues(declaration);\n if (Object.keys(defaultValues).length > 0) {\n // Merge default values with current context, but don't override existing runtime values\n this.#writeQtiContext({\n QTI_CONTEXT: {\n ...defaultValues, // Default values first\n ...this.qtiContext.QTI_CONTEXT // Runtime values override defaults\n }\n });\n }\n });\n\n // The structure and the session-control cascade come from the test's markup, not from upgraded\n // properties, so they do not depend on registration or render timing.\n this.#model = buildTestModel(renderedMarkup(this.#testElement));\n this.computedContext = this.#derive();\n }\n\n /** The test's structure and resolved session control, read from its markup when it is connected. */\n #model?: TestModel;\n\n /** `computedContext`, derived anew from its inputs (`deriveComputedContext`), never from the previous one. */\n #derive(): ComputedContext {\n this.#seedOptimality();\n this.#followSessions();\n return deriveComputedContext({\n model: this.#model,\n itemFacts: this.#itemFacts(),\n testContext: this._testContext,\n sessionContext: this._sessionContext,\n infoItemCategory: this.configContext?.infoItemCategory,\n itemData: this.initContext,\n optimality: this.#optimality,\n lifecycle: new Map([...this.#sessions].map(([identifier, session]) => [identifier, session.state])),\n itemElement: this.#itemElement\n });\n }\n\n /**\n * On a restored session no attempt is ended this run, so the latch is seeded once from the\n * persisted context, which still holds the submitted response. A later change of the answer\n * leaves the seeded value alone.\n */\n #seedOptimality(): void {\n for (const itemContext of this._testContext?.items ?? []) {\n if (!itemContext.identifier || this.#optimality.has(itemContext.identifier)) continue;\n const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n if (numAttempts > 0) this.#optimality.set(itemContext.identifier, assessOptimality(itemContext));\n }\n }\n\n /**\n * Extract default values from a qti-context-declaration element\n */\n #extractDefaultValues(declaration: Element): Record<string, any> {\n const defaultValues: Record<string, any> = {};\n\n const defaultValueElement = declaration.querySelector('qti-default-value');\n if (!defaultValueElement) {\n return defaultValues;\n }\n\n const valueElements = defaultValueElement.querySelectorAll('qti-value[field-identifier]');\n valueElements.forEach(valueElement => {\n const fieldIdentifier = valueElement.getAttribute('field-identifier');\n const baseType = valueElement.getAttribute('base-type') || 'string';\n const textContent = valueElement.textContent?.trim() || '';\n\n if (fieldIdentifier) {\n // Convert value based on base-type\n let value: any = textContent;\n switch (baseType) {\n case 'integer':\n value = parseInt(textContent, 10);\n break;\n case 'float':\n case 'duration':\n value = parseFloat(textContent);\n break;\n case 'boolean':\n value = textContent.toLowerCase() === 'true';\n break;\n case 'string':\n default:\n value = textContent;\n break;\n }\n\n defaultValues[fieldIdentifier] = value;\n }\n });\n\n return defaultValues;\n }\n\n /* On every change of the candidate's state, the context is derived again. */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.#model) return;\n this.computedContext = this.#derive();\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n\n protected override updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n this.#lockUsedItems();\n }\n\n /** The items this navigation disabled because their attempts are used, so it releases only those. */\n #lockedItems = new WeakSet<QtiAssessmentItem>();\n\n /**\n * Disables every rendered item whose session is over (`rules.done`: closed, its attempts used or\n * a completed adaptive item), so the candidate cannot change the answer once the last attempt is\n * ended (QTI info model §2.2.1). Runs after every update: an item rendered later (another item, a\n * section on screen, a restored state) is locked as it arrives, and one whose attempts are back to\n * zero (a new state) is released.\n *\n * Only `disabled = true` is ever set here, and only on an item that was not disabled already; a\n * host or view that disables or makes an item read-only itself keeps it so.\n */\n #lockUsedItems(): void {\n if (!this.#testElement || !this.computedContext) return;\n // In a simultaneous part every item has one attempt, processed when the part ends (QTI info model\n // §2.8.2), so the candidate may change the answer until then: TAO keeps such an item open too.\n const items = new Map(\n this.computedContext.testParts.flatMap(part =>\n part.submissionMode === 'simultaneous' ? [] : itemsInOrder(part).map(item => [item.instance, item] as const)\n )\n );\n for (const itemRef of this.#testElement.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref')) {\n const element = itemRef.assessmentItem;\n if (!element) continue;\n // The session is over (closed, or in review or solution). With `auto-score-items` every change\n // is scored as an attempt, so the count is not the candidate's and locks nothing.\n const used = !this.autoScoreItems && items.get(itemRef.identifier)?.rules?.done === true;\n if (used && !element.disabled) {\n element.disabled = true;\n this.#lockedItems.add(element);\n } else if (!used && this.#lockedItems.has(element)) {\n this.#lockedItems.delete(element);\n element.disabled = false;\n }\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-navigation': TestNavigation;\n }\n}\n"]}
1
+ {"version":3,"file":"test-navigation.js","sourceRoot":"","sources":["../../../src/components/test-navigation/test-navigation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAA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,IAAI,OAAO,CAAC,gBAAgB,CAChD,6BAA6B,CAC9B,EAAE,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,QAAQ;gBAAE,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzD,CAAC;IACH,CAAC;CACF;AAtpB6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA4C;AAUhE;IADN,KAAK,EAAE;mDAC8D;AAwK/D;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;qDACZ;AAI/B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oDACd;AAI3B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDACX;AAKjC;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;kDAClB;AAI5B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;uDACK;AAEiB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;sDAAwB","sourcesContent":["import { ContextConsumer, consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\nimport {\n buildTestModel,\n endItemAttempt,\n followItemSession,\n itemRefsInOrder,\n readItemFacts,\n seedItemLifecycle,\n submitTestPart\n} from '@qti-components/delivery';\nimport { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\nimport { listenPublic as listenItemPublic } from '@qti-components/elements/public-events';\n\nimport { assessOptimality, deriveComputedContext } from '../../internal/derive-computed-context';\nimport { itemFactsContext } from '../../internal/item-facts.context';\nimport { attemptsOf, itemSessionFacts } from '../../internal/item-session-facts';\nimport { renderedMarkup } from '../../internal/rendered-markup';\nimport { testHostContext } from '../../internal/test-host.context';\nimport { dispatchPublic, listenPublic } from '../../public-events';\nimport { itemsInOrder } from '../../computed-tree';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiContext } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef } from '../qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { ItemSession, ItemSessionFacts, TestModel } from '@qti-components/delivery';\nimport type { ItemOptimality } from '../../internal/derive-computed-context';\nimport type { ItemFactsByRef } from '../../internal/item-facts.context';\nimport type { LinearNextRefusal, TestHost } from '../../internal/test-host.context';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\n/** A new object each time: a host that mutates the one it read must not change anyone else's. */\nconst newQtiContext = (): QtiContext => ({\n QTI_CONTEXT: { testIdentifier: '', candidateIdentifier: '', environmentIdentifier: 'default' }\n});\n\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier: string | undefined = undefined;\n\n /**\n * Your own per-item fields, by item-ref `identifier`: each `computedContext` item carries them as\n * given under `data`, without the identifier, and so does every view of it a plugin derives. They\n * never replace a field the test, the item or the candidate's state gives, whatever its name; a\n * template reads `activeItem.data.<field>`. To mark an item as scored by hand, set\n * `external-scored` on its `SCORE` declaration in `postLoadTransformCallback`.\n */\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n /**\n * @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the\n * enclosing test's: reading returns it, writing replaces it, so a host that has always set the\n * shuffle seed here keeps working. Removed in the next major.\n *\n * Written before the navigation is inside a test, it waits and is handed over on connect.\n */\n public get qtiContext(): QtiContext {\n return this.#owner()?.qtiContext ?? (this.#pendingQtiContext ??= newQtiContext());\n }\n\n public set qtiContext(value: QtiContext) {\n if (!this.#warnedQtiContext) {\n this.#warnedQtiContext = true;\n console.warn(\n '[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major ' +\n 'release. Set `qtiContext` on `<qti-test>` instead; it is the same value.'\n );\n }\n this.#writeQtiContext(value);\n }\n\n #pendingQtiContext?: QtiContext;\n #warnedQtiContext = false;\n\n /** The write the library itself makes. Not the deprecated setter, so it never warns about itself. */\n #writeQtiContext(value: QtiContext): void {\n const owner = this.#owner();\n if (owner) owner.qtiContext = value;\n else this.#pendingQtiContext = value;\n }\n\n /**\n * The `qti-test` this navigation is in, found through context so it works across shadow roots.\n * A write made before it is known waits in `#pendingQtiContext` and is handed over on arrival.\n */\n #testHost = new ContextConsumer(this, {\n context: testHostContext,\n subscribe: true,\n callback: host => {\n if (host && this.#pendingQtiContext) {\n host.qtiContext = this.#pendingQtiContext;\n this.#pendingQtiContext = undefined;\n }\n if (host) this.#registerLinearNext(host);\n }\n });\n\n /** The `qti-test` this navigation answers Next for in a linear part. */\n #linearNextHost?: TestHost;\n\n #registerLinearNext(host: TestHost): void {\n if (this.#linearNextHost && this.#linearNextHost !== host) {\n this.#linearNextHost.beforeLinearNext = null;\n this.#linearNextHost.submitTestParts = null;\n }\n this.#linearNextHost = host;\n host.beforeLinearNext = this.#beforeLinearNext;\n host.submitTestParts = this.#submitTestParts;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.#linearNextHost) {\n this.#linearNextHost.beforeLinearNext = this.#beforeLinearNext;\n this.#linearNextHost.submitTestParts = this.#submitTestParts;\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.#linearNextHost?.beforeLinearNext === this.#beforeLinearNext) this.#linearNextHost.beforeLinearNext = null;\n if (this.#linearNextHost?.submitTestParts === this.#submitTestParts) this.#linearNextHost.submitTestParts = null;\n }\n\n /** The `submission-mode` of the test part that holds the item-ref; undefined before the model is known. */\n #submissionModeOf(itemRefId: string | undefined): 'individual' | 'simultaneous' | undefined {\n if (!itemRefId) return undefined;\n return this.#model?.testParts.find(testPart =>\n itemRefsInOrder(testPart.sections).some(item => item.identifier === itemRefId)\n )?.submissionMode;\n }\n\n /**\n * Submits every test part with simultaneous submission that is not submitted yet, as a paper exam\n * is handed in (QTI 3 info model §2.8.2; decided 2026-12-01, `plans/host-api.md`): each item the\n * candidate opened gets its one attempt (`numAttempts` 1) and, when it is not adaptive,\n * `completionStatus` `completed`; every session closes (`submitTestPart`). The responses were\n * scored in the background as they changed, so nothing is processed again here. The caller runs\n * the test's outcome processing after it (`submit()`). Sends `qc-test-part-submitted` per part.\n */\n #submitTestParts = (): void => {\n const host = this.#testHost.value;\n if (!this.#model || !host) return;\n const facts = this.#sessionFacts();\n for (const testPart of this.#model.testParts) {\n if (testPart.submissionMode !== 'simultaneous') continue;\n const items = itemRefsInOrder(testPart.sections).flatMap(({ identifier }) => {\n const itemFacts = facts.get(identifier);\n return itemFacts\n ? [{ item: identifier, previous: this.#sessions.get(identifier) ?? null, facts: itemFacts }]\n : [];\n });\n const submission = submitTestPart(items);\n if (!submission) continue;\n const submitted: string[] = [];\n for (const { item, session } of submission.sessions) {\n const before = facts.get(item)!;\n this.#sessions.set(item, session);\n if (session.numAttempts === before.numAttempts) continue;\n submitted.push(item);\n host.updateItemVariables(item, [\n { identifier: 'numAttempts', value: String(session.numAttempts) },\n ...(session.adaptive ? [] : [{ identifier: 'completionStatus', value: 'completed' }])\n ]);\n }\n if (submitted.length === 0) continue;\n dispatchPublic(host, 'qc-test-part-submitted', { testPart: testPart.identifier, items: submitted });\n }\n this.requestUpdate();\n };\n\n /**\n * Next in a linear individual part leaves the item for good (implementation guide §4.1), so it\n * submits what the candidate gave (decided 2026-11-27): refused while the session control refuses\n * those responses (`rules.maySubmit`), else the attempt is ended when one is open: none ended yet,\n * or the responses changed since the last. Called by the navigation mixin while the item is still\n * rendered; the item is closed when the navigation moves past it.\n */\n #beforeLinearNext = (itemRefId: string): LinearNextRefusal | null => {\n const part = this.#model?.testParts.find(testPart =>\n itemRefsInOrder(testPart.sections).some(item => item.identifier === itemRefId)\n );\n if (part?.navigationMode !== 'linear' || part.submissionMode !== 'individual') return null;\n const session = this.#sessions.get(itemRefId);\n const rules = this.computedItemFor(itemRefId)?.rules;\n if (session?.state !== 'interacting' || !rules) return null;\n if (!rules.maySubmit) {\n return { reason: rules.maySkip ? 'validate-responses' : 'allow-skipping', itemId: itemRefId };\n }\n if (session.numAttempts === 0 || this.#changed.has(itemRefId)) {\n this.#assessmentItemFor(itemRefId)?.processResponse(\n true,\n this.configContext?.reportValidityAfterScoring === true\n );\n }\n return null;\n };\n\n /** The item-refs whose responses changed since their last ended attempt. */\n #changed = new Set<string>();\n\n #itemRefIdOf(element: EventTarget | undefined): string | undefined {\n const item = (element as HTMLElement | undefined)?.closest?.('qti-assessment-item');\n if (!item) return undefined;\n return [...(this.#testElement?.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref') ?? [])].find(\n itemRef => itemRef.assessmentItem === item\n )?.identifier;\n }\n\n #owner(): { qtiContext: QtiContext } | null {\n return this.#testHost.value ?? null;\n }\n\n @state()\n @consume({ context: configContext, subscribe: true })\n public configContext: ConfigContext = {};\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n /** Read from each item's XML when `qti-test` fetches it; see `itemFactsContext`. */\n @state()\n @consume({ context: itemFactsContext, subscribe: true })\n protected _itemFacts?: ItemFactsByRef;\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n #testElement: QtiAssessmentTest;\n\n /**\n * Whether each item's last *ended attempt* reached the optimal outcome, keyed\n * by item-ref id. Written from #handleItemContextUpdated when processResponse\n * ends an attempt — never on a plain selection. Mirrors how inline feedback\n * only re-evaluates when an attempt is processed, so a freshly-picked answer\n * doesn't flip `done` until the candidate ends the attempt.\n */\n #optimality = new Map<string, ItemOptimality>();\n\n /**\n * Each item session's lifecycle state, by item-ref identifier, changed only through the lifecycle\n * table (`followItemSession` as the candidate moves, `endItemAttempt` when an attempt ends). It\n * lives here until `DeliveryState` holds it (roadmap 1, T3d); a session whose attempts change\n * outside an ended attempt (a restored or assigned state) is seeded again.\n */\n #sessions = new Map<string, ItemSession>();\n\n constructor() {\n super();\n listenPublic(this, 'qc-test-loaded', this.#handleTestConnected.bind(this));\n\n listenItemPublic(this, 'qc-item-response-changed', this.#handleInteractionChanged.bind(this));\n this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n listenPublic(this, 'qc-test-end-attempt', this.#handleTestEndAttempt.bind(this));\n listenPublic(this, 'qc-test-update-outcome', this.#handleTestUpdateOutcomeVariable.bind(this));\n listenPublic(this, 'qc-test-update-comment', this.#handleUpdateComment.bind(this));\n }\n\n /**\n * Sets the candidate's comment on an item when its session allows it (`rules.mayComment`:\n * `allow-comment`, while interacting; decided 2026-11-27, carried, not rendered).\n */\n #handleUpdateComment(event: CustomEvent<{ itemId: string; comment: string | null }>) {\n const { itemId, comment = null } = event.detail ?? ({} as { itemId?: string; comment?: string | null });\n const host = this.#testHost.value;\n if (!itemId || !host) return;\n if (comment !== null && typeof comment !== 'string') {\n console.warn(`[qti-test] Ignoring a comment for \"${itemId}\" that is not a string.`);\n return;\n }\n if (!this.computedItemFor(itemId)?.rules?.mayComment) {\n console.warn(\n `[qti-test] Ignoring a comment for \"${itemId}\": its allow-comment is false, or it is not interacting.`\n );\n return;\n }\n host.updateItemComment(itemId, comment);\n }\n\n /**\n * Latch whether an item reached its optimal outcome whenever it has just ended\n * an attempt. processResponse — fired by test-end-attempt, autoscore, or an\n * in-item end-attempt interaction — flags its context update with\n * `responseProcessed`; a plain selection updates the context without it, so\n * `done` can't flip until the candidate actually ends the attempt.\n */\n #handleItemContextUpdated(event: CustomEvent<{ itemContext: ItemContext; responseProcessed?: boolean }>) {\n if (!event.detail?.responseProcessed) return;\n const itemContext = event.detail.itemContext;\n if (!itemContext?.identifier) return;\n this.#optimality.set(itemContext.identifier, assessOptimality(itemContext));\n this.#changed.delete(itemContext.identifier);\n this.#endAttempt(itemContext);\n\n const computedItem = this.computedItemFor(itemContext.identifier);\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#doneAfterAttempt(itemContext, computedItem)\n );\n }\n\n /**\n * Moves the item's session on for its ended attempt. With `auto-score-items` every change is\n * scored as an attempt, so the count is not the candidate's: it is taken, and the state stays.\n */\n #endAttempt(itemContext: ItemContext): void {\n const facts = this.#sessionFacts().get(itemContext.identifier);\n if (!facts) return;\n const ended: ItemSessionFacts = { ...facts, ...attemptsOf(itemContext) };\n const previous = this.#sessions.get(itemContext.identifier);\n this.#sessions.set(\n itemContext.identifier,\n this.autoScoreItems\n ? {\n state: previous?.state ?? followItemSession(undefined, ended).state,\n numAttempts: ended.numAttempts,\n adaptive: ended.adaptive\n }\n : endItemAttempt(previous, ended)\n );\n }\n\n /**\n * Whether the item session is over after the attempt that just ended: its new state, or, before\n * the test model is known, the state an item on screen with these attempts is in.\n */\n #doneAfterAttempt(itemContext: ItemContext, computedItem: ComputedItem | undefined): boolean {\n const state =\n this.#sessions.get(itemContext.identifier)?.state ??\n (computedItem?.sessionControl\n ? seedItemLifecycle({\n sessionControl: computedItem.sessionControl,\n adaptive: computedItem.adaptive ?? false,\n ...attemptsOf(itemContext),\n presented: true,\n passed: false\n })\n : 'interacting');\n return state === 'closed' || state === 'review' || state === 'solution';\n }\n\n /** The facts of every item session now: the model, the item facts, the contexts and the items on screen. */\n #sessionFacts(): Map<string, ItemSessionFacts> {\n if (!this.#model) return new Map();\n const presented = new Set(\n [...(this.#testElement?.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref') ?? [])]\n .filter(itemRef => itemRef.assessmentItem)\n .map(itemRef => itemRef.identifier)\n );\n return itemSessionFacts(this.#model, this.#itemFacts(), this._testContext?.items, {\n current: this._sessionContext?.navItemRefId,\n presented\n });\n }\n\n /**\n * The item facts `qti-test` read from each fetched item, and, for an item rendered without them\n * (handed to its ref directly), the facts read from the rendered item.\n */\n #itemFacts(): ItemFactsByRef | undefined {\n const missing = [\n ...(this.#testElement?.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref') ?? [])\n ].filter(\n itemRef =>\n itemRef.assessmentItem?.localName === 'qti-assessment-item' && !this._itemFacts?.has(itemRef.identifier)\n );\n if (!missing.length) return this._itemFacts;\n const facts = new Map(this._itemFacts ?? []);\n for (const itemRef of missing) facts.set(itemRef.identifier, readItemFacts(renderedMarkup(itemRef.assessmentItem)));\n return facts;\n }\n\n /** Moves every item session on for where the candidate is now. */\n #followSessions(): void {\n for (const [identifier, facts] of this.#sessionFacts()) {\n this.#sessions.set(identifier, followItemSession(this.#sessions.get(identifier), facts));\n }\n }\n\n /**\n * Extension point for presentation packages reacting to an ended attempt. `done` is the item\n * session's after this attempt (closed: its attempts used, whatever the score), settled here\n * because the computed context only catches up on the next update.\n */\n protected afterAttemptEnded(\n _assessmentItem: QtiAssessmentItem | undefined,\n _computedItem: ComputedItem | undefined,\n _done: boolean\n ): void {}\n\n /** The computed-context entry for an item, from the session-control cascade. */\n protected computedItemFor(identifier: string): ComputedItem | undefined {\n return this.computedContext?.testParts.flatMap(itemsInOrder).find(i => i.instance === identifier);\n }\n\n /** The assessment item for an item-ref id, if it has been rendered. */\n #assessmentItemFor(identifier: string | undefined): QtiAssessmentItem | undefined {\n if (!identifier) return undefined;\n const itemRef = this.#testElement?.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${CSS.escape(identifier)}\"]`\n );\n return itemRef?.assessmentItem ?? undefined;\n }\n\n /** `computedContext.itemElement`: one function for the life of this element, carried along by every update. */\n #itemElement = (identifier: string): HTMLElement | null => this.#assessmentItemFor(identifier) ?? null;\n\n /** The currently active assessment item, exposed for optional presentation extensions. */\n protected get activeAssessmentItem(): QtiAssessmentItem | undefined {\n if (!this.#testElement || !this._sessionContext?.navItemRefId) return undefined;\n return this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n )?.assessmentItem;\n }\n\n /**\n * Ends an attempt: the item named by `detail.itemId` (a `test-end-attempt` stamped into an item, or\n * given an `item`), or else the item on screen.\n */\n #handleTestEndAttempt(event: CustomEvent<{ itemId?: string } | undefined>) {\n const itemId = event.detail?.itemId;\n const qtiAssessmentItemEl = itemId ? this.#assessmentItemFor(itemId) : this.activeAssessmentItem;\n if (!qtiAssessmentItemEl) return;\n const itemRefId = itemId ?? this._sessionContext?.navItemRefId ?? undefined;\n if (this.#submissionModeOf(itemRefId) === 'simultaneous') {\n console.warn(\n `[qti-test] Ignoring an end attempt for \"${itemRefId}\": its test part has simultaneous submission, so its attempt ends when the part is submitted.`\n );\n return;\n }\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n #handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiAssessmentItemEl = this.#assessmentItemFor(event.detail?.assessmentItemRefId);\n if (!qtiAssessmentItemEl) return;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n #handleInteractionChanged(_event: CustomEvent) {\n const itemRefId = this.#itemRefIdOf(_event.composedPath()[0]);\n if (itemRefId) this.#changed.add(itemRefId);\n // A part with simultaneous submission is a paper exam (decided 2026-12-01): every change is\n // scored in the background, without ending the attempt, so a saved state always holds the\n // scores. `auto-score-items` adds nothing there. An item whose `SCORE` is `external-scored` is\n // left alone, as `auto-score-items` left it: a run would reset the score a scorer gave.\n if (this.#submissionModeOf(itemRefId) === 'simultaneous') {\n const computedItem = this.computedItemFor(itemRefId!);\n if (computedItem?.rules?.done || computedItem?.externalScored) return;\n this.#assessmentItemFor(itemRefId)?.scoreResponse();\n return;\n }\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest<QtiAssessmentItem>(\n 'qti-assessment-item'\n );\n // Autoscoring resolves the item from the event's own path, so a change\n // raised outside an assessment item has nothing to score.\n if (!assessmentItem) return;\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n assessmentItem.processResponse(true, reportValidityAfterScoring);\n }\n }\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n /* PK: on test connected we can build the computed context */\n #handleTestConnected(event: CustomEvent) {\n this.#testElement = event.detail as QtiAssessmentTest;\n // A fresh test invalidates the per-test optimality latches and item sessions.\n this.#optimality.clear();\n this.#sessions.clear();\n this.#changed.clear();\n // Set the testIdentifier in qtiContext if not already set\n if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {\n const currentContext = this.qtiContext.QTI_CONTEXT || {\n testIdentifier: '',\n candidateIdentifier: 'not set',\n environmentIdentifier: 'default'\n };\n this.#writeQtiContext({\n QTI_CONTEXT: {\n ...currentContext,\n testIdentifier: this.#testElement.identifier,\n environmentIdentifier: currentContext.environmentIdentifier || 'default'\n }\n });\n }\n\n // Process qti-context-declaration elements to get default values\n const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier=\"QTI_CONTEXT\"]');\n\n contextDeclarations.forEach(declaration => {\n const defaultValues = this.#extractDefaultValues(declaration);\n if (Object.keys(defaultValues).length > 0) {\n // Merge default values with current context, but don't override existing runtime values\n this.#writeQtiContext({\n QTI_CONTEXT: {\n ...defaultValues, // Default values first\n ...this.qtiContext.QTI_CONTEXT // Runtime values override defaults\n }\n });\n }\n });\n\n // The structure and the session-control cascade come from the test's markup, not from upgraded\n // properties, so they do not depend on registration or render timing.\n this.#model = buildTestModel(renderedMarkup(this.#testElement));\n this.computedContext = this.#derive();\n }\n\n /** The test's structure and resolved session control, read from its markup when it is connected. */\n #model?: TestModel;\n\n /** `computedContext`, derived anew from its inputs (`deriveComputedContext`), never from the previous one. */\n #derive(): ComputedContext {\n this.#seedOptimality();\n this.#followSessions();\n return deriveComputedContext({\n model: this.#model,\n itemFacts: this.#itemFacts(),\n testContext: this._testContext,\n sessionContext: this._sessionContext,\n infoItemCategory: this.configContext?.infoItemCategory,\n itemData: this.initContext,\n optimality: this.#optimality,\n lifecycle: new Map([...this.#sessions].map(([identifier, session]) => [identifier, session.state])),\n itemElement: this.#itemElement\n });\n }\n\n /**\n * On a restored session no attempt is ended this run, so the latch is seeded once from the\n * persisted context, which still holds the submitted response. A later change of the answer\n * leaves the seeded value alone.\n */\n #seedOptimality(): void {\n for (const itemContext of this._testContext?.items ?? []) {\n if (!itemContext.identifier || this.#optimality.has(itemContext.identifier)) continue;\n const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n if (numAttempts > 0) this.#optimality.set(itemContext.identifier, assessOptimality(itemContext));\n }\n }\n\n /**\n * Extract default values from a qti-context-declaration element\n */\n #extractDefaultValues(declaration: Element): Record<string, any> {\n const defaultValues: Record<string, any> = {};\n\n const defaultValueElement = declaration.querySelector('qti-default-value');\n if (!defaultValueElement) {\n return defaultValues;\n }\n\n const valueElements = defaultValueElement.querySelectorAll('qti-value[field-identifier]');\n valueElements.forEach(valueElement => {\n const fieldIdentifier = valueElement.getAttribute('field-identifier');\n const baseType = valueElement.getAttribute('base-type') || 'string';\n const textContent = valueElement.textContent?.trim() || '';\n\n if (fieldIdentifier) {\n // Convert value based on base-type\n let value: any = textContent;\n switch (baseType) {\n case 'integer':\n value = parseInt(textContent, 10);\n break;\n case 'float':\n case 'duration':\n value = parseFloat(textContent);\n break;\n case 'boolean':\n value = textContent.toLowerCase() === 'true';\n break;\n case 'string':\n default:\n value = textContent;\n break;\n }\n\n defaultValues[fieldIdentifier] = value;\n }\n });\n\n return defaultValues;\n }\n\n /* On every change of the candidate's state, the context is derived again. */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.#model) return;\n this.computedContext = this.#derive();\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n\n protected override updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n this.#lockUsedItems();\n this.#scoreOnFirstPresentation();\n }\n\n /** The rendered items already scored on arrival, so each is scored once per rendering. */\n #scoredOnArrival = new WeakSet<QtiAssessmentItem>();\n\n /**\n * In a part with simultaneous submission, scores every item once in the background when it is\n * first shown (decided 2026-12-03). An item the candidate opens and leaves blank gets the outcomes\n * its response processing gives no answer, as it would on paper, not only their defaults; a\n * restored item is scored again from its restored responses, which gives the same scores. Skipped,\n * like every background score, for a closed item and one whose `SCORE` is `external-scored`.\n */\n #scoreOnFirstPresentation(): void {\n if (!this.#testElement || !this.computedContext) return;\n for (const itemRef of this.#testElement.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref')) {\n const element = itemRef.assessmentItem;\n if (!element || this.#scoredOnArrival.has(element)) continue;\n if (this.#submissionModeOf(itemRef.identifier) !== 'simultaneous') continue;\n const computedItem = this.computedItemFor(itemRef.identifier);\n if (!computedItem || computedItem.rules?.done || computedItem.externalScored) continue;\n if (element.scoreResponse()) this.#scoredOnArrival.add(element);\n }\n }\n\n /** The items this navigation disabled because their attempts are used, so it releases only those. */\n #lockedItems = new WeakSet<QtiAssessmentItem>();\n\n /**\n * Disables every rendered item whose session is over (`rules.done`: closed, its attempts used or\n * a completed adaptive item), so the candidate cannot change the answer once the last attempt is\n * ended (QTI info model §2.2.1). Runs after every update: an item rendered later (another item, a\n * section on screen, a restored state) is locked as it arrives, and one whose attempts are back to\n * zero (a new state) is released. In a part with simultaneous submission every session closes\n * when the part is submitted, so its items lock then.\n *\n * Only `disabled = true` is ever set here, and only on an item that was not disabled already; a\n * host or view that disables or makes an item read-only itself keeps it so.\n */\n #lockUsedItems(): void {\n if (!this.#testElement || !this.computedContext) return;\n const items = new Map(\n this.computedContext.testParts.flatMap(part =>\n itemsInOrder(part).map(\n item => [item.instance, { item, simultaneous: part.submissionMode === 'simultaneous' }] as const\n )\n )\n );\n for (const itemRef of this.#testElement.querySelectorAll<QtiAssessmentItemRef>('qti-assessment-item-ref')) {\n const element = itemRef.assessmentItem;\n if (!element) continue;\n const entry = items.get(itemRef.identifier);\n // A simultaneous part ends attempts only when it is submitted, so its end-attempt\n // interactions are off (decided 2026-12-01).\n if (entry?.simultaneous) this.#disableEndAttemptInteractions(element);\n // The session is over (closed, or in review or solution). With `auto-score-items` every change\n // is scored as an attempt, so the count is not the candidate's and locks nothing; in a\n // simultaneous part it is built in and never counts, so the session decides.\n const used = (entry?.simultaneous || !this.autoScoreItems) && entry?.item.rules?.done === true;\n if (used && !element.disabled) {\n element.disabled = true;\n this.#lockedItems.add(element);\n } else if (!used && this.#lockedItems.has(element)) {\n this.#lockedItems.delete(element);\n element.disabled = false;\n }\n }\n }\n\n #disableEndAttemptInteractions(element: QtiAssessmentItem): void {\n for (const interaction of element.querySelectorAll<HTMLElement & { disabled: boolean }>(\n 'qti-end-attempt-interaction'\n )) {\n if (!interaction.disabled) interaction.disabled = true;\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-navigation': TestNavigation;\n }\n}\n"]}
@@ -27,6 +27,17 @@ export interface TestHost extends HTMLElement {
27
27
  * be left yet.
28
28
  */
29
29
  beforeLinearNext?: ((itemRefId: string) => LinearNextRefusal | null) | null;
30
+ /**
31
+ * Set by `test-navigation`, which keeps the item sessions: asked by `submit()` before the test's
32
+ * outcome processing to submit every test part with simultaneous submission not yet submitted
33
+ * (roadmap 1, T6). T5 (a part's time limit) and T7 (leaving a part) submit through it too.
34
+ */
35
+ submitTestParts?: (() => void) | null;
36
+ /** Sets values on one item-ref, in the test context and on the item if it is on screen (`qti-test`'s method). */
37
+ updateItemVariables(itemRefId: string, values: readonly {
38
+ identifier: string;
39
+ value: string | string[] | null;
40
+ }[]): void;
30
41
  /** Sets the candidate's comment on an item-ref; null clears it. `test-navigation` checks `rules.mayComment` first. */
31
42
  updateItemComment(itemRefId: string, comment: string | null): void;
32
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"test-host.context.js","sourceRoot":"","sources":["../../src/internal/test-host.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA8C7C,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAW,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\n\nimport type { QtiContext } from '@qti-components/base';\nimport type { transformTestApi } from '@qti-components/transformers';\nimport type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';\n\n/**\n * Defined here, and re-exported by the navigation mixin under the same name, so this file imports\n * nothing from the mixin: the mixin imports the components that consume this context, and a type\n * import counts as a dependency for madge.\n */\nexport type PostLoadTestTransformCallback = (\n transformer: transformTestApi,\n testElement: QtiAssessmentTest\n) => transformTestApi | Promise<transformTestApi>;\n\n/**\n * What the components inside a test need from the `qti-test` that contains them: the things a host\n * put on it, and the element to query. Provided by `qti-test` about itself.\n *\n * It is context and not `closest('qti-test')` because a request crosses shadow roots and `closest`\n * stops at the first one, so a navigation or container a host renders inside its own component\n * would never find its test. Internal on purpose: not exported from the package, and not API.\n */\nexport interface TestHost extends HTMLElement {\n /** The test's URL; `test-container` loads it. The context is re-sent whenever it changes. */\n src: string | null;\n qtiContext: QtiContext;\n postLoadTestTransformCallback: PostLoadTestTransformCallback | null;\n /**\n * Set by `test-navigation`, which keeps the item sessions: asked by the navigation mixin before a\n * Next in a linear part leaves `itemRefId`, while that item is still rendered. It ends the item's\n * attempt when one is open (roadmap 1, T3b2b) and answers null, or answers why the item may not\n * be left yet.\n */\n beforeLinearNext?: ((itemRefId: string) => LinearNextRefusal | null) | null;\n /** Sets the candidate's comment on an item-ref; null clears it. `test-navigation` checks `rules.mayComment` first. */\n updateItemComment(itemRefId: string, comment: string | null): void;\n}\n\n/** Why Next may not leave an item yet: its responses are ones its session control refuses. */\nexport interface LinearNextRefusal {\n reason: 'allow-skipping' | 'validate-responses';\n itemId: string;\n}\n\nexport const testHostContext = createContext<TestHost>(Symbol('testHost'));\n"]}
1
+ {"version":3,"file":"test-host.context.js","sourceRoot":"","sources":["../../src/internal/test-host.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAyD7C,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAW,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\n\nimport type { QtiContext } from '@qti-components/base';\nimport type { transformTestApi } from '@qti-components/transformers';\nimport type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';\n\n/**\n * Defined here, and re-exported by the navigation mixin under the same name, so this file imports\n * nothing from the mixin: the mixin imports the components that consume this context, and a type\n * import counts as a dependency for madge.\n */\nexport type PostLoadTestTransformCallback = (\n transformer: transformTestApi,\n testElement: QtiAssessmentTest\n) => transformTestApi | Promise<transformTestApi>;\n\n/**\n * What the components inside a test need from the `qti-test` that contains them: the things a host\n * put on it, and the element to query. Provided by `qti-test` about itself.\n *\n * It is context and not `closest('qti-test')` because a request crosses shadow roots and `closest`\n * stops at the first one, so a navigation or container a host renders inside its own component\n * would never find its test. Internal on purpose: not exported from the package, and not API.\n */\nexport interface TestHost extends HTMLElement {\n /** The test's URL; `test-container` loads it. The context is re-sent whenever it changes. */\n src: string | null;\n qtiContext: QtiContext;\n postLoadTestTransformCallback: PostLoadTestTransformCallback | null;\n /**\n * Set by `test-navigation`, which keeps the item sessions: asked by the navigation mixin before a\n * Next in a linear part leaves `itemRefId`, while that item is still rendered. It ends the item's\n * attempt when one is open (roadmap 1, T3b2b) and answers null, or answers why the item may not\n * be left yet.\n */\n beforeLinearNext?: ((itemRefId: string) => LinearNextRefusal | null) | null;\n /**\n * Set by `test-navigation`, which keeps the item sessions: asked by `submit()` before the test's\n * outcome processing to submit every test part with simultaneous submission not yet submitted\n * (roadmap 1, T6). T5 (a part's time limit) and T7 (leaving a part) submit through it too.\n */\n submitTestParts?: (() => void) | null;\n /** Sets values on one item-ref, in the test context and on the item if it is on screen (`qti-test`'s method). */\n updateItemVariables(\n itemRefId: string,\n values: readonly { identifier: string; value: string | string[] | null }[]\n ): void;\n /** Sets the candidate's comment on an item-ref; null clears it. `test-navigation` checks `rules.mayComment` first. */\n updateItemComment(itemRefId: string, comment: string | null): void;\n}\n\n/** Why Next may not leave an item yet: its responses are ones its session control refuses. */\nexport interface LinearNextRefusal {\n reason: 'allow-skipping' | 'validate-responses';\n itemId: string;\n}\n\nexport const testHostContext = createContext<TestHost>(Symbol('testHost'));\n"]}
@@ -60,10 +60,13 @@ export const TestProcessingMixin = (superClass) => {
60
60
  return true;
61
61
  }
62
62
  /**
63
- * Ends the test for scoring: runs `outcomeProcessing()`, then tells the host with
64
- * `qc-test-submitted`. Returns false, and sends nothing, when the test has no outcome processing.
63
+ * Ends the test for scoring: submits every test part with simultaneous submission (each sends
64
+ * `qc-test-part-submitted`), runs `outcomeProcessing()`, then tells the host with
65
+ * `qc-test-submitted`. Returns false, and sends no `qc-test-submitted`, when the test has no
66
+ * outcome processing.
65
67
  */
66
68
  submit() {
69
+ this.submitTestParts?.();
67
70
  if (!this.outcomeProcessing())
68
71
  return false;
69
72
  dispatchPublic(this, 'qc-test-submitted', {});
@@ -1 +1 @@
1
- {"version":3,"file":"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,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAe,CAAC;qBACxF,CAAC;gBACJ,CAAC,CAAC;aACH,CAAC;QACJ,CAAC;QAEM,UAAU,CAAC,UAAkB;YAClC,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAoB,CAAC;QACzD,CAAC;QACM,WAAW,CAAC,UAAkB;YACnC,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,IAAI,IAAI,CAAC;QAC/F,CAAC;KAEF;IAED,OAAO,qBAAiE,CAAC;AAC3E,CAAC,CAAC","sourcesContent":["import { dispatchPublic, listenPublic } from '../public-events';\n\nimport type { QtiOutcomeProcessing } from '../components/qti-outcome-processing/qti-outcome-processing';\nimport type { QtiTestFeedback } from '../components/qti-test-feedback/qti-test-feedback';\nimport type { OutcomeVariable, VariableDeclaration } from '@qti-components/base';\nimport type { TestBaseInterface } from './test-base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\ndeclare class TestProcessingInterface {\n updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;\n getOutcome(identifier: string): Readonly<OutcomeVariable>;\n getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;\n outcomeProcessing(): boolean;\n submit(): boolean;\n getTestFeedback(access?: 'atEnd' | 'during'): QtiTestFeedback[];\n}\nexport const TestProcessingMixin = <T extends Constructor<TestBaseInterface>>(superClass: T) => {\n abstract class TestProcessingElement extends superClass implements TestProcessingInterface {\n constructor(...args: any[]) {\n super(...args);\n this.addEventListener('qti-register-variable', (e: CustomEvent<{ variable: any }>) => {\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: [...(this.testContext.testOutcomeVariables || []), e.detail.variable]\n };\n e.stopPropagation();\n });\n listenPublic(this, 'qc-test-submit', () => this.submit());\n // QTI 3 info model §2.9: the test's outcome processing runs each time the candidate submits an\n // item in an individual part, after the item's response processing, so branch rules and\n // pre-conditions read test outcomes that include it (impl. guide §4.5.3, step 1). Registered\n // after the base mixin's listener, so the test context already holds the item's new values.\n // A simultaneous part is processed when the part is submitted (roadmap 1, T6).\n this.addEventListener(\n 'qti-item-context-updated',\n (e: CustomEvent<{ itemContext: { identifier: string }; responseProcessed?: boolean }>) => {\n if (!e.detail?.responseProcessed) return;\n if (this.#submissionModeOf(e.detail.itemContext?.identifier) !== 'individual') return;\n this.outcomeProcessing();\n }\n );\n // wordt aangeroepen vanuit de processingtemplate\n this.addEventListener(\n 'qti-set-outcome-value',\n (e: CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>) => {\n const { outcomeIdentifier, value } = e.detail;\n this.updateOutcomeVariable(outcomeIdentifier, value);\n e.stopPropagation();\n }\n );\n }\n\n /** The `submission-mode` of the test part that holds this item-ref; null when it is not in the test. */\n #submissionModeOf(itemRefIdentifier: string | undefined): 'individual' | 'simultaneous' | null {\n if (!itemRefIdentifier || !this._testElement) return null;\n const part = this._testElement\n .querySelector(`qti-assessment-item-ref[identifier=\"${CSS.escape(itemRefIdentifier)}\"]`)\n ?.closest('qti-test-part');\n if (!part) return null;\n return part.getAttribute('submission-mode') === 'simultaneous' ? 'simultaneous' : 'individual';\n }\n\n outcomeProcessing(): boolean {\n // Inside the loaded test: `test-container` renders it into its own shadow root, which a\n // `querySelector` on this element does not reach. Without a loaded test, look in the light DOM.\n const outcomeProcessor = (this._testElement ?? this).querySelector(\n 'qti-outcome-processing'\n ) as unknown as QtiOutcomeProcessing;\n if (!outcomeProcessor) return false;\n // QTI starts every run of the test's outcome processing from the declared defaults, so an\n // accumulating rule (`SCORE_TOTAL = sum + SCORE_TOTAL`) gives the same total on every run.\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: this.testContext.testOutcomeVariables?.map(v => ({\n ...v,\n value: v.defaultValue ?? null\n }))\n };\n outcomeProcessor.process();\n return true;\n }\n\n /**\n * Ends the test for scoring: runs `outcomeProcessing()`, then tells the host with\n * `qc-test-submitted`. Returns false, and sends nothing, when the test has no outcome processing.\n */\n submit(): boolean {\n if (!this.outcomeProcessing()) return false;\n dispatchPublic(this, 'qc-test-submitted', {});\n return true;\n }\n\n /**\n * The `qti-test-feedback` elements that apply now, read from the test outcomes: run\n * `outcomeProcessing()` first. `access` narrows them to the end of the test (`atEnd`) or to\n * while it runs (`during`); without it, both.\n */\n getTestFeedback(access?: 'atEnd' | 'during'): QtiTestFeedback[] {\n const feedback = Array.from(\n (this._testElement ?? this).querySelectorAll<QtiTestFeedback>('qti-test-feedback') ?? []\n );\n return feedback.filter(\n fb => (!access || fb.access === access) && fb.matches(this.getOutcome(fb.outcomeIdentifier)?.value)\n );\n }\n\n /* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */\n\n public updateOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n const outcomeVariable = this.getOutcome(identifier);\n if (!outcomeVariable) {\n console.warn(`Can not set qti-outcome-identifier: ${identifier}, it is not available`);\n return;\n }\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: this.testContext.testOutcomeVariables?.map(v => {\n if (v.identifier !== identifier) {\n return v;\n }\n return {\n ...v,\n value: outcomeVariable.cardinality === 'single' ? value : [...v.value, value as string]\n };\n })\n };\n }\n\n public getOutcome(identifier: string): Readonly<OutcomeVariable> {\n return this.getVariable(identifier) as OutcomeVariable;\n }\n public getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>> {\n return this.testContext.testOutcomeVariables?.find(v => v.identifier === identifier) || null;\n }\n /* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */\n }\n\n return TestProcessingElement as Constructor<TestProcessingInterface> & T;\n};\n"]}
1
+ {"version":3,"file":"test-processing.mixin.js","sourceRoot":"","sources":["../../src/mixins/test-processing.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA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CAAC;aACH,CAAC;QACJ,CAAC;QAEM,UAAU,CAAC,UAAkB;YAClC,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAoB,CAAC;QACzD,CAAC;QACM,WAAW,CAAC,UAAkB;YACnC,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,IAAI,IAAI,CAAC;QAC/F,CAAC;KAEF;IAED,OAAO,qBAAiE,CAAC;AAC3E,CAAC,CAAC","sourcesContent":["import { dispatchPublic, listenPublic } from '../public-events';\n\nimport type { QtiOutcomeProcessing } from '../components/qti-outcome-processing/qti-outcome-processing';\nimport type { QtiTestFeedback } from '../components/qti-test-feedback/qti-test-feedback';\nimport type { OutcomeVariable, VariableDeclaration } from '@qti-components/base';\nimport type { TestBaseInterface } from './test-base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\ndeclare class TestProcessingInterface {\n updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;\n getOutcome(identifier: string): Readonly<OutcomeVariable>;\n getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;\n outcomeProcessing(): boolean;\n submit(): boolean;\n getTestFeedback(access?: 'atEnd' | 'during'): QtiTestFeedback[];\n}\nexport const TestProcessingMixin = <T extends Constructor<TestBaseInterface>>(superClass: T) => {\n abstract class TestProcessingElement extends superClass implements TestProcessingInterface {\n constructor(...args: any[]) {\n super(...args);\n this.addEventListener('qti-register-variable', (e: CustomEvent<{ variable: any }>) => {\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: [...(this.testContext.testOutcomeVariables || []), e.detail.variable]\n };\n e.stopPropagation();\n });\n listenPublic(this, 'qc-test-submit', () => this.submit());\n // QTI 3 info model §2.9: the test's outcome processing runs each time the candidate submits an\n // item in an individual part, after the item's response processing, so branch rules and\n // pre-conditions read test outcomes that include it (impl. guide §4.5.3, step 1). Registered\n // after the base mixin's listener, so the test context already holds the item's new values.\n // A simultaneous part is processed when the part is submitted (roadmap 1, T6).\n this.addEventListener(\n 'qti-item-context-updated',\n (e: CustomEvent<{ itemContext: { identifier: string }; responseProcessed?: boolean }>) => {\n if (!e.detail?.responseProcessed) return;\n if (this.#submissionModeOf(e.detail.itemContext?.identifier) !== 'individual') return;\n this.outcomeProcessing();\n }\n );\n // wordt aangeroepen vanuit de processingtemplate\n this.addEventListener(\n 'qti-set-outcome-value',\n (e: CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>) => {\n const { outcomeIdentifier, value } = e.detail;\n this.updateOutcomeVariable(outcomeIdentifier, value);\n e.stopPropagation();\n }\n );\n }\n\n /**\n * Set by `test-navigation` (`TestHost.submitTestParts`): submits every test part with\n * simultaneous submission that is not submitted yet. `submit()` calls it first.\n * @internal\n */\n declare submitTestParts?: (() => void) | null;\n\n /** The `submission-mode` of the test part that holds this item-ref; null when it is not in the test. */\n #submissionModeOf(itemRefIdentifier: string | undefined): 'individual' | 'simultaneous' | null {\n if (!itemRefIdentifier || !this._testElement) return null;\n const part = this._testElement\n .querySelector(`qti-assessment-item-ref[identifier=\"${CSS.escape(itemRefIdentifier)}\"]`)\n ?.closest('qti-test-part');\n if (!part) return null;\n return part.getAttribute('submission-mode') === 'simultaneous' ? 'simultaneous' : 'individual';\n }\n\n outcomeProcessing(): boolean {\n // Inside the loaded test: `test-container` renders it into its own shadow root, which a\n // `querySelector` on this element does not reach. Without a loaded test, look in the light DOM.\n const outcomeProcessor = (this._testElement ?? this).querySelector(\n 'qti-outcome-processing'\n ) as unknown as QtiOutcomeProcessing;\n if (!outcomeProcessor) return false;\n // QTI starts every run of the test's outcome processing from the declared defaults, so an\n // accumulating rule (`SCORE_TOTAL = sum + SCORE_TOTAL`) gives the same total on every run.\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: this.testContext.testOutcomeVariables?.map(v => ({\n ...v,\n value: v.defaultValue ?? null\n }))\n };\n outcomeProcessor.process();\n return true;\n }\n\n /**\n * Ends the test for scoring: submits every test part with simultaneous submission (each sends\n * `qc-test-part-submitted`), runs `outcomeProcessing()`, then tells the host with\n * `qc-test-submitted`. Returns false, and sends no `qc-test-submitted`, when the test has no\n * outcome processing.\n */\n submit(): boolean {\n this.submitTestParts?.();\n if (!this.outcomeProcessing()) return false;\n dispatchPublic(this, 'qc-test-submitted', {});\n return true;\n }\n\n /**\n * The `qti-test-feedback` elements that apply now, read from the test outcomes: run\n * `outcomeProcessing()` first. `access` narrows them to the end of the test (`atEnd`) or to\n * while it runs (`during`); without it, both.\n */\n getTestFeedback(access?: 'atEnd' | 'during'): QtiTestFeedback[] {\n const feedback = Array.from(\n (this._testElement ?? this).querySelectorAll<QtiTestFeedback>('qti-test-feedback') ?? []\n );\n return feedback.filter(\n fb => (!access || fb.access === access) && fb.matches(this.getOutcome(fb.outcomeIdentifier)?.value)\n );\n }\n\n /* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */\n\n public updateOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n const outcomeVariable = this.getOutcome(identifier);\n if (!outcomeVariable) {\n console.warn(`Can not set qti-outcome-identifier: ${identifier}, it is not available`);\n return;\n }\n this.testContext = {\n ...this.testContext,\n testOutcomeVariables: this.testContext.testOutcomeVariables?.map(v => {\n if (v.identifier !== identifier) {\n return v;\n }\n return {\n ...v,\n value: outcomeVariable.cardinality === 'single' ? value : [...v.value, value as string]\n };\n })\n };\n }\n\n public getOutcome(identifier: string): Readonly<OutcomeVariable> {\n return this.getVariable(identifier) as OutcomeVariable;\n }\n public getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>> {\n return this.testContext.testOutcomeVariables?.find(v => v.identifier === identifier) || null;\n }\n /* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */\n }\n\n return TestProcessingElement as Constructor<TestProcessingInterface> & T;\n};\n"]}
@@ -63,6 +63,15 @@ export interface PublicEventMap {
63
63
  }>;
64
64
  /** Outcome processing ran after a submit: read the test outcomes now. */
65
65
  'qc-test-submitted': CustomEvent<Record<string, never>>;
66
+ /**
67
+ * A test part with simultaneous submission was submitted (QTI 3 info model §2.8.2): each item the
68
+ * candidate opened has its one attempt ended and its session closed, with the outcomes its responses
69
+ * scored. Sent before the test's outcome processing; a server may score the part itself.
70
+ */
71
+ 'qc-test-part-submitted': CustomEvent<{
72
+ testPart: string;
73
+ items: string[];
74
+ }>;
66
75
  'qc-test-navigated': CustomEvent<NavigationTarget>;
67
76
  'qc-test-navigation-started': CustomEvent<NavigationTarget>;
68
77
  'qc-test-navigation-failed': CustomEvent<NavigationFailure>;
@@ -16,6 +16,7 @@ export const PUBLIC_EVENTS = {
16
16
  'qc-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-state-changed' },
17
17
  // New in 10.0, so it has no cito- name.
18
18
  'qc-test-state-refused': { kind: 'notification', scope: 'test' },
19
+ 'qc-test-part-submitted': { kind: 'notification', scope: 'test' },
19
20
  'qc-test-items-skipped': { kind: 'notification', scope: 'test', deprecated: 'cito-test-items-skipped' },
20
21
  'qc-test-end-reached': { kind: 'notification', scope: 'test', deprecated: 'cito-test-end-reached' },
21
22
  'qc-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'cito-item-ref-connected' }
@@ -1 +1 @@
1
- {"version":3,"file":"public-events.js","sourceRoot":"","sources":["../src/public-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AA+E1F,MAAM,CAAC,MAAM,aAAa,GAAoD;IAC5E,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE;IACxF,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE;IAC9F,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS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M,EAAE;IAChE,uBAAuB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE;IACvG,qBAAqB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE;IACnG,uBAAuB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB,EAAE;CACxG,CAAC;AAMF;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAmB,EACnB,IAAO,EACP,MAAkE;IAElE,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAmB,EACnB,IAAO,EACP,OAAuC;IAEvC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,OAA6B,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { dispatchDeclared, listenDeclared } from '@qti-components/elements/public-events';\n\nimport type { View } from '@qti-components/base';\nimport type { PublicEventDeclaration } from '@qti-components/elements/public-events';\nimport type { QtiTestState } from './types/qti-test-state';\n\n/**\n * The public events of the test. The name tells you it is public: everything here starts with\n * `qc-`; every other event is internal plumbing and may change in any release.\n *\n * Requests are verbs (a host or plugin dispatches them at the test), notifications are past tense\n * (the test dispatches them). All bubble and are composed.\n *\n * `deprecated` is the `cito-` name this event had in 9.x; an event new in 10.0 has none. One helper\n * (`dispatchPublic`, `listenPublic`) sends or handles both names until the next major, then the field\n * goes. The 7.x names (`qti-request-navigation`, `test-end-attempt`, `on-test-switch-view`, …) are no\n * longer sent or handled.\n */\nexport interface NavigationTarget {\n type: 'item' | 'section';\n id: string;\n}\n\nexport interface NavigationFailure {\n message: string;\n details?: unknown;\n itemId?: string;\n sectionId?: string;\n}\n\n/** The detail of `qc-test-state-refused`. */\nexport interface StateRefusal {\n /** Why the state was not read. */\n message: string;\n /** The value that was assigned to `state`, as given. */\n state: unknown;\n}\n\nexport interface PublicEventMap {\n 'qc-test-navigate': CustomEvent<NavigationTarget>;\n /**\n * Ends an attempt: processes the response of the item-ref `itemId`, or, without it, of the item on\n * screen. `<test-end-attempt>` sends the `itemId` of the item it is stamped into or names.\n */\n 'qc-test-end-attempt': CustomEvent<{ itemId?: string }>;\n /** Scores the test: resets its outcomes to their defaults, runs outcome processing, then `qc-test-submitted`. */\n 'qc-test-submit': CustomEvent<Record<string, never>>;\n 'qc-test-update-outcome': CustomEvent<{\n assessmentItemRefId: string;\n outcomeVariableId: string;\n value: number | string;\n }>;\n 'qc-test-switch-view': CustomEvent<View>;\n /** `value` is JSON; `null` or `undefined` removes the plugin's entry. */\n 'qc-test-update-plugin-state': CustomEvent<{ plugin: string; value: unknown }>;\n /**\n * Sets the candidate's comment on the item-ref `itemId` (`null` clears it), kept in the item's\n * state and in `QtiTestState`. Refused, with a warning, unless the item's `allow-comment` allows\n * it and its session is interacting (`rules.mayComment`). Send it from inside `<test-navigation>`.\n */\n 'qc-test-update-comment': CustomEvent<{ itemId: string; comment: string | null }>;\n /** Outcome processing ran after a submit: read the test outcomes now. */\n 'qc-test-submitted': CustomEvent<Record<string, never>>;\n 'qc-test-navigated': CustomEvent<NavigationTarget>;\n 'qc-test-navigation-started': CustomEvent<NavigationTarget>;\n 'qc-test-navigation-failed': CustomEvent<NavigationFailure>;\n 'qc-test-rendered': CustomEvent<{ identifier: string; element: Element }[]>;\n // `qc-test-loaded` (detail: the `QtiAssessmentTest`) is added by qti-assessment-test.ts, so this\n // module imports no element: that import would be a cycle.\n 'qc-test-state-changed': CustomEvent<QtiTestState>;\n /** A value assigned to `state` could not be read and was ignored: the test goes on without it. */\n 'qc-test-state-refused': CustomEvent<StateRefusal>;\n 'qc-test-items-skipped': CustomEvent<{ ids: string[] }>;\n 'qc-test-end-reached': CustomEvent<Record<string, never>>;\n 'qc-item-ref-connected': CustomEvent<{ identifier: string; href: string; category: string }>;\n}\n\nexport type PublicEventName = keyof PublicEventMap;\n\nexport const PUBLIC_EVENTS: Record<PublicEventName, PublicEventDeclaration> = {\n 'qc-test-navigate': { kind: 'request', scope: 'test', deprecated: 'cito-test-navigate' },\n 'qc-test-end-attempt': { kind: 'request', scope: 'test', deprecated: 'cito-test-end-attempt' },\n 'qc-test-submit': { kind: 'request', scope: 'test', deprecated: 'cito-test-submit' },\n 'qc-test-update-outcome': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-outcome' },\n 'qc-test-update-plugin-state': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-plugin-state' },\n 'qc-test-update-comment': { kind: 'request', scope: 'test' },\n 'qc-test-switch-view': { kind: 'request', scope: 'test', deprecated: 'cito-test-switch-view' },\n 'qc-test-submitted': { kind: 'notification', scope: 'test', deprecated: 'cito-test-submitted' },\n 'qc-test-navigated': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigated' },\n 'qc-test-navigation-started': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-started' },\n 'qc-test-navigation-failed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-failed' },\n 'qc-test-rendered': { kind: 'notification', scope: 'test', deprecated: 'cito-test-rendered' },\n 'qc-test-loaded': { kind: 'notification', scope: 'test', deprecated: 'cito-test-loaded' },\n 'qc-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-state-changed' },\n // New in 10.0, so it has no cito- name.\n 'qc-test-state-refused': { kind: 'notification', scope: 'test' },\n 'qc-test-items-skipped': { kind: 'notification', scope: 'test', deprecated: 'cito-test-items-skipped' },\n 'qc-test-end-reached': { kind: 'notification', scope: 'test', deprecated: 'cito-test-end-reached' },\n 'qc-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'cito-item-ref-connected' }\n};\n\ndeclare global {\n interface HTMLElementEventMap extends PublicEventMap {}\n}\n\n/**\n * Dispatch a public event, and its deprecated name with the same `detail` object. The detail is\n * always an object so `listenPublic` can tell the two apart from one dispatch.\n */\nexport function dispatchPublic<K extends PublicEventName>(\n target: EventTarget,\n name: K,\n detail: PublicEventMap[K] extends CustomEvent<infer D> ? D : never\n): void {\n dispatchDeclared(target, PUBLIC_EVENTS, name, detail);\n}\n\n/**\n * Listen for a public event and its deprecated name; the handler runs once for a sender that\n * dispatched both. See `listenDeclared`.\n */\nexport function listenPublic<K extends PublicEventName>(\n target: EventTarget,\n name: K,\n handler: (e: PublicEventMap[K]) => void\n): void {\n listenDeclared(target, PUBLIC_EVENTS, name, handler as (e: Event) => void);\n}\n"]}
1
+ {"version":3,"file":"public-events.js","sourceRoot":"","sources":["../src/public-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAqF1F,MAAM,CAAC,MAAM,aAAa,GAAoD;IAC5E,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE;IACxF,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE;IAC9F,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE;IACpF,wBAAwB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,0BAA0B,EAAE;IACpG,6BAA6B,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,+BAA+B,EAAE;IAC9G,wBAAwB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;IAC5D,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB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AAc,CAC5B,MAAmB,EACnB,IAAO,EACP,MAAkE;IAElE,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAmB,EACnB,IAAO,EACP,OAAuC;IAEvC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,OAA6B,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { dispatchDeclared, listenDeclared } from '@qti-components/elements/public-events';\n\nimport type { View } from '@qti-components/base';\nimport type { PublicEventDeclaration } from '@qti-components/elements/public-events';\nimport type { QtiTestState } from './types/qti-test-state';\n\n/**\n * The public events of the test. The name tells you it is public: everything here starts with\n * `qc-`; every other event is internal plumbing and may change in any release.\n *\n * Requests are verbs (a host or plugin dispatches them at the test), notifications are past tense\n * (the test dispatches them). All bubble and are composed.\n *\n * `deprecated` is the `cito-` name this event had in 9.x; an event new in 10.0 has none. One helper\n * (`dispatchPublic`, `listenPublic`) sends or handles both names until the next major, then the field\n * goes. The 7.x names (`qti-request-navigation`, `test-end-attempt`, `on-test-switch-view`, …) are no\n * longer sent or handled.\n */\nexport interface NavigationTarget {\n type: 'item' | 'section';\n id: string;\n}\n\nexport interface NavigationFailure {\n message: string;\n details?: unknown;\n itemId?: string;\n sectionId?: string;\n}\n\n/** The detail of `qc-test-state-refused`. */\nexport interface StateRefusal {\n /** Why the state was not read. */\n message: string;\n /** The value that was assigned to `state`, as given. */\n state: unknown;\n}\n\nexport interface PublicEventMap {\n 'qc-test-navigate': CustomEvent<NavigationTarget>;\n /**\n * Ends an attempt: processes the response of the item-ref `itemId`, or, without it, of the item on\n * screen. `<test-end-attempt>` sends the `itemId` of the item it is stamped into or names.\n */\n 'qc-test-end-attempt': CustomEvent<{ itemId?: string }>;\n /** Scores the test: resets its outcomes to their defaults, runs outcome processing, then `qc-test-submitted`. */\n 'qc-test-submit': CustomEvent<Record<string, never>>;\n 'qc-test-update-outcome': CustomEvent<{\n assessmentItemRefId: string;\n outcomeVariableId: string;\n value: number | string;\n }>;\n 'qc-test-switch-view': CustomEvent<View>;\n /** `value` is JSON; `null` or `undefined` removes the plugin's entry. */\n 'qc-test-update-plugin-state': CustomEvent<{ plugin: string; value: unknown }>;\n /**\n * Sets the candidate's comment on the item-ref `itemId` (`null` clears it), kept in the item's\n * state and in `QtiTestState`. Refused, with a warning, unless the item's `allow-comment` allows\n * it and its session is interacting (`rules.mayComment`). Send it from inside `<test-navigation>`.\n */\n 'qc-test-update-comment': CustomEvent<{ itemId: string; comment: string | null }>;\n /** Outcome processing ran after a submit: read the test outcomes now. */\n 'qc-test-submitted': CustomEvent<Record<string, never>>;\n /**\n * A test part with simultaneous submission was submitted (QTI 3 info model §2.8.2): each item the\n * candidate opened has its one attempt ended and its session closed, with the outcomes its responses\n * scored. Sent before the test's outcome processing; a server may score the part itself.\n */\n 'qc-test-part-submitted': CustomEvent<{ testPart: string; items: string[] }>;\n 'qc-test-navigated': CustomEvent<NavigationTarget>;\n 'qc-test-navigation-started': CustomEvent<NavigationTarget>;\n 'qc-test-navigation-failed': CustomEvent<NavigationFailure>;\n 'qc-test-rendered': CustomEvent<{ identifier: string; element: Element }[]>;\n // `qc-test-loaded` (detail: the `QtiAssessmentTest`) is added by qti-assessment-test.ts, so this\n // module imports no element: that import would be a cycle.\n 'qc-test-state-changed': CustomEvent<QtiTestState>;\n /** A value assigned to `state` could not be read and was ignored: the test goes on without it. */\n 'qc-test-state-refused': CustomEvent<StateRefusal>;\n 'qc-test-items-skipped': CustomEvent<{ ids: string[] }>;\n 'qc-test-end-reached': CustomEvent<Record<string, never>>;\n 'qc-item-ref-connected': CustomEvent<{ identifier: string; href: string; category: string }>;\n}\n\nexport type PublicEventName = keyof PublicEventMap;\n\nexport const PUBLIC_EVENTS: Record<PublicEventName, PublicEventDeclaration> = {\n 'qc-test-navigate': { kind: 'request', scope: 'test', deprecated: 'cito-test-navigate' },\n 'qc-test-end-attempt': { kind: 'request', scope: 'test', deprecated: 'cito-test-end-attempt' },\n 'qc-test-submit': { kind: 'request', scope: 'test', deprecated: 'cito-test-submit' },\n 'qc-test-update-outcome': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-outcome' },\n 'qc-test-update-plugin-state': { kind: 'request', scope: 'test', deprecated: 'cito-test-update-plugin-state' },\n 'qc-test-update-comment': { kind: 'request', scope: 'test' },\n 'qc-test-switch-view': { kind: 'request', scope: 'test', deprecated: 'cito-test-switch-view' },\n 'qc-test-submitted': { kind: 'notification', scope: 'test', deprecated: 'cito-test-submitted' },\n 'qc-test-navigated': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigated' },\n 'qc-test-navigation-started': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-started' },\n 'qc-test-navigation-failed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-navigation-failed' },\n 'qc-test-rendered': { kind: 'notification', scope: 'test', deprecated: 'cito-test-rendered' },\n 'qc-test-loaded': { kind: 'notification', scope: 'test', deprecated: 'cito-test-loaded' },\n 'qc-test-state-changed': { kind: 'notification', scope: 'test', deprecated: 'cito-test-state-changed' },\n // New in 10.0, so it has no cito- name.\n 'qc-test-state-refused': { kind: 'notification', scope: 'test' },\n 'qc-test-part-submitted': { kind: 'notification', scope: 'test' },\n 'qc-test-items-skipped': { kind: 'notification', scope: 'test', deprecated: 'cito-test-items-skipped' },\n 'qc-test-end-reached': { kind: 'notification', scope: 'test', deprecated: 'cito-test-end-reached' },\n 'qc-item-ref-connected': { kind: 'notification', scope: 'item', deprecated: 'cito-item-ref-connected' }\n};\n\ndeclare global {\n interface HTMLElementEventMap extends PublicEventMap {}\n}\n\n/**\n * Dispatch a public event, and its deprecated name with the same `detail` object. The detail is\n * always an object so `listenPublic` can tell the two apart from one dispatch.\n */\nexport function dispatchPublic<K extends PublicEventName>(\n target: EventTarget,\n name: K,\n detail: PublicEventMap[K] extends CustomEvent<infer D> ? D : never\n): void {\n dispatchDeclared(target, PUBLIC_EVENTS, name, detail);\n}\n\n/**\n * Listen for a public event and its deprecated name; the handler runs once for a sender that\n * dispatched both. See `listenDeclared`.\n */\nexport function listenPublic<K extends PublicEventName>(\n target: EventTarget,\n name: K,\n handler: (e: PublicEventMap[K]) => void\n): void {\n listenDeclared(target, PUBLIC_EVENTS, name, handler as (e: Event) => void);\n}\n"]}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@qti-components/test",
3
3
  "description": "QTI test utilities",
4
- "version": "2.0.0-next.33",
4
+ "version": "2.0.0-next.34",
5
5
  "author": "",
6
6
  "dependencies": {
7
7
  "@heximal/templates": "^0.1.5",
8
- "@qti-components/base": "^3.0.0-next.16",
9
- "@qti-components/delivery": "^0.1.0-next.12",
10
- "@qti-components/elements": "^2.0.0-next.8",
8
+ "@qti-components/base": "^3.0.0-next.17",
9
+ "@qti-components/delivery": "^0.1.0-next.13",
10
+ "@qti-components/elements": "^2.0.0-next.9",
11
11
  "@qti-components/interactions": "^1.10.5-next.8",
12
12
  "@qti-components/processing": "^1.6.1-next.5",
13
13
  "@qti-components/theme": "^3.0.0-next.7",