@qti-components/test 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.d.ts +4 -0
  2. package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js +10 -23
  3. package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js.map +1 -1
  4. package/dist/components/qti-test/qti-test.d.ts +16 -2
  5. package/dist/components/qti-test/qti-test.js +33 -6
  6. package/dist/components/qti-test/qti-test.js.map +1 -1
  7. package/dist/components/test-check-item/test-check-item.d.ts +2 -0
  8. package/dist/components/test-check-item/test-check-item.js +14 -2
  9. package/dist/components/test-check-item/test-check-item.js.map +1 -1
  10. package/dist/components/test-container/test-container.d.ts +3 -0
  11. package/dist/components/test-container/test-container.js +5 -1
  12. package/dist/components/test-container/test-container.js.map +1 -1
  13. package/dist/components/test-item-to-speech/test-item-to-speech.d.ts +61 -15
  14. package/dist/components/test-item-to-speech/test-item-to-speech.js +285 -103
  15. package/dist/components/test-item-to-speech/test-item-to-speech.js.map +1 -1
  16. package/dist/components/test-navigation/test-navigation.d.ts +9 -1
  17. package/dist/components/test-navigation/test-navigation.js +62 -17
  18. package/dist/components/test-navigation/test-navigation.js.map +1 -1
  19. package/dist/components/test-scoring-buttons/test-scoring-buttons.d.ts +1 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +1 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/internal/test-host.context.d.ts +24 -0
  24. package/dist/internal/test-host.context.js +3 -0
  25. package/dist/internal/test-host.context.js.map +1 -0
  26. package/dist/mixins/index.d.ts +1 -0
  27. package/dist/mixins/index.js +1 -0
  28. package/dist/mixins/index.js.map +1 -1
  29. package/dist/mixins/test-base.d.ts +7 -2
  30. package/dist/mixins/test-base.js +53 -19
  31. package/dist/mixins/test-base.js.map +1 -1
  32. package/dist/mixins/test-navigation.mixin.d.ts +3 -4
  33. package/dist/mixins/test-navigation.mixin.js +11 -12
  34. package/dist/mixins/test-navigation.mixin.js.map +1 -1
  35. package/dist/mixins/test-processing.mixin.js +3 -1
  36. package/dist/mixins/test-processing.mixin.js.map +1 -1
  37. package/dist/mixins/test-state.mixin.d.ts +33 -0
  38. package/dist/mixins/test-state.mixin.js +130 -0
  39. package/dist/mixins/test-state.mixin.js.map +1 -0
  40. package/dist/types/iqti-test.d.ts +8 -5
  41. package/dist/types/iqti-test.js.map +1 -1
  42. package/dist/types/qti-test-state.d.ts +45 -0
  43. package/dist/types/qti-test-state.js +2 -0
  44. package/dist/types/qti-test-state.js.map +1 -0
  45. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"test-navigation.js","sourceRoot":"","sources":["../../../src/components/test-navigation/test-navigation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAChD,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,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAiClD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAkC5C,YAAY,CAAoB;IAEhC;;;;;;OAMG;IACH,WAAW,CAAqC;IAEhD;QACE,KAAK,EAAE,CAAC;QA7CkB,eAAU,GAAuB,SAAS,CAAC;QAGhE,gBAAW,GAAiD,EAAE,CAAC;QAI/D,eAAU,GAAe;YAC9B,WAAW,EAAE;gBACX,cAAc,EAAE,EAAE;gB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W,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;AAIjC;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 { 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 { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\nimport { qtiContext } from '@qti-components/base';\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 { QtiAssessmentSection } from '../qti-assessment-section/qti-assessment-section';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { QtiTestPart } from '../qti-test-part/qti-test-part';\nimport type { QtiItemSessionControl } from '../qti-item-session-control/qti-item-session-control';\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';\nimport type { ResponseVariable } from '@qti-components/base';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\n/**\n * Whether an item's ended attempt reached the best achievable outcome:\n * 'optimal' (nothing to improve), 'suboptimal' (a better attempt is possible),\n * or 'unscored' (no machine-judgeable optimal value — see #assessOptimality).\n */\ntype ItemOptimality = 'optimal' | 'suboptimal' | 'unscored';\n\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier: string | undefined = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\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 @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 @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 constructor() {\n super();\n this.addEventListener('qti-assessment-test-connected', this.#handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));\n\n this.addEventListener('qti-interaction-changed', this.#handleInteractionChanged.bind(this));\n this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n this.addEventListener('test-end-attempt', this.#handleTestEndAttempt.bind(this));\n this.addEventListener('test-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));\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 const optimality = this.#assessOptimality(itemContext);\n this.#optimality.set(itemContext.identifier, optimality);\n\n const computedItem = this.computedItemFor(itemContext.identifier);\n const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts)\n );\n }\n\n /**\n * Extension point for presentation packages reacting to an ended attempt.\n * `done` is settled here — from the freshly latched optimality and the\n * session-control cascade — because the computed context only catches up on\n * the next update, after this event has finished bubbling.\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\n ?.flatMap(part => part.sections)\n .flatMap(section => section.items)\n .find(i => i.identifier === 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=\"${identifier}\"]`\n );\n return itemRef?.assessmentItem ?? undefined;\n }\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 * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n #handleTestEndAttempt(_event: CustomEvent) {\n const qtiAssessmentItemEl = 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 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 this.myTemplate ? this.myTemplate(this.stampContext) : nothing;\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.\n this.#optimality.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.qtiContext = {\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.qtiContext = {\n QTI_CONTEXT: {\n ...defaultValues, // Default values first\n ...this.qtiContext.QTI_CONTEXT // Runtime values override defaults\n }\n };\n }\n });\n\n const testPartElements = Array.from(this.#testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this.#testElement.identifier,\n title: this.#testElement.title,\n view: this._sessionContext?.view,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n const testPartSessionControl = testPart.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const partAllowSkipping = testPartSessionControl ? testPartSessionControl.allowSkipping : true;\n const partMaxAttempts = testPartSessionControl ? testPartSessionControl.maxAttempts : 1;\n const partShowFeedback = testPartSessionControl ? testPartSessionControl.showFeedback : false;\n const partShowSolution = testPartSessionControl ? testPartSessionControl.showSolution : false;\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\n allowSkipping: partAllowSkipping,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n const sectionSessionControl = section.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const sectionAllowSkipping = sectionSessionControl\n ? sectionSessionControl.allowSkipping\n : partAllowSkipping;\n const sectionMaxAttempts = sectionSessionControl ? sectionSessionControl.maxAttempts : partMaxAttempts;\n const sectionShowFeedback = sectionSessionControl ? sectionSessionControl.showFeedback : partShowFeedback;\n const sectionShowSolution = sectionSessionControl ? sectionSessionControl.showSolution : partShowSolution;\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n navigationMode: section.navigationMode,\n submissionMode: section.submissionMode,\n allowSkipping: sectionAllowSkipping,\n items: itemElements.map(item => {\n const itemSessionControl = item.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const itemAllowSkipping = itemSessionControl ? itemSessionControl.allowSkipping : sectionAllowSkipping;\n const itemMaxAttempts = itemSessionControl ? itemSessionControl.maxAttempts : sectionMaxAttempts;\n const itemShowFeedback = itemSessionControl ? itemSessionControl.showFeedback : sectionShowFeedback;\n const itemShowSolution = itemSessionControl ? itemSessionControl.showSolution : sectionShowSolution;\n return {\n ...this.initContext?.find(i => i.identifier === item.identifier),\n active: false,\n identifier: item.identifier,\n categories: item.category ? item.category?.split(' ') : [],\n href: item.href,\n variables: [] as OutcomeVariable[],\n allowSkipping: itemAllowSkipping,\n maxAttempts: itemMaxAttempts,\n showFeedback: itemShowFeedback,\n showSolution: itemShowSolution\n };\n })\n };\n })\n };\n })\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 /* PK: on item connected we can add item only properties in the xml */\n #handleItemConnected(event: CustomEvent) {\n const itemElement = event.detail as QtiAssessmentItem;\n\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n items: section.items.map(item => {\n if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n\n const scoreOutcome = itemElement.querySelector<HTMLElement>(\n \"qti-outcome-declaration[identifier='SCORE']\"\n );\n // const scoreOutcome = item.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n const externalScored = scoreOutcome?.getAttribute('externalScored');\n\n const responseDeclarations = itemElement.querySelectorAll<HTMLElement>('qti-response-declaration');\n const containsCorrectResponse = Array.from(responseDeclarations).some((r: HTMLElement) =>\n r.querySelector('qti-correct-response')\n );\n // check if every responseDeclaration has a correctResponse\n const containsMapping = Array.from(responseDeclarations).some((r: HTMLElement) => {\n const mapping = r.querySelector('qti-mapping');\n const areaMapping = r.querySelector('qti-area-mapping');\n return mapping?.querySelector('qti-map-entry') || areaMapping?.querySelector('qti-area-map-entry');\n });\n\n const hasCorrectResponse = containsCorrectResponse || containsMapping;\n\n const hasResponseProcessing = itemElement.querySelector('qti-response-processing') ? true : false;\n\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n externalScored,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: itemElement.variables,\n hasCorrectResponse,\n hasResponseProcessing\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n view: this._sessionContext?.view,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n active: this._sessionContext?.navPartId === testPart.identifier || false,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n active: this._sessionContext?.navSectionId === section.identifier || false,\n completed: section.items.every(\n item =>\n this._testContext.items\n .find(i => i.identifier === item.identifier)\n ?.variables.find(v => v.identifier === 'completionStatus').value === 'completed'\n ),\n\n items: section.items.map(item => {\n const itemContext = this._testContext?.items.find(i => i.identifier === item.identifier);\n const computedItem = {\n ...item,\n ...itemContext,\n ...this.initContext?.find(i => i.identifier === item.identifier)\n };\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n\n const score = rawscore === undefined || rawscore === null ? null : parseFloat(rawscore?.toString());\n\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')\n ?.value as string;\n\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n const numAttempts =\n Number(computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n\n const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;\n\n const valid = this.#assessmentItemFor(computedItem.identifier)?.validate(false) ?? true;\n\n const responseVars = itemContext?.variables?.filter(v => v.type === 'response') || [];\n\n const isDefaultResponse = responseVars.every(v => {\n if (v.value === undefined || v.value === null) {\n return true;\n }\n let fallbackValue: string;\n switch (v.baseType) {\n case 'integer':\n case 'float':\n case 'duration':\n fallbackValue = '0';\n break;\n case 'boolean':\n fallbackValue = 'false';\n break;\n case 'string':\n case 'directedPair':\n case 'identifier':\n case 'pair':\n case 'record':\n default:\n fallbackValue = '';\n break;\n }\n\n const defaultValue = v.defaultValue ?? fallbackValue;\n\n if (Array.isArray(v.value)) {\n const dv = Array.isArray(defaultValue) ? defaultValue : [defaultValue];\n return v.value.length === dv.length && v.value.every((val, i) => val === dv[i]);\n }\n\n return v.value === defaultValue;\n });\n\n // Computed and opiniated\n // const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';\n // const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;\n // const incorrect = (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false;\n // const completed = completionStatus === 'completed';\n\n const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;\n const maxScore =\n rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());\n\n // Optimality comes from the last *ended attempt* (#optimality),\n // latched in #handleItemContextUpdated — never from a live\n // mid-attempt selection. On a restored session no attempt is ended\n // this run, so seed it once from the persisted context, which still\n // holds the submitted response.\n let optimality = this.#optimality.get(computedItem.identifier);\n if (optimality === undefined) {\n optimality = itemContext ? this.#assessOptimality(itemContext) : 'unscored';\n if (numAttempts > 0) this.#optimality.set(computedItem.identifier, optimality);\n }\n\n const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);\n\n return {\n ...computedItem,\n completionStatus,\n numAttempts,\n score,\n response,\n index,\n active,\n valid,\n isDefaultResponse,\n maxScore,\n done,\n // Reflects the last *ended* attempt only. Read the latch directly\n // (not the `optimality` local) — the latch is written solely on\n // responseProcessed / restore-seed (line above, guarded by\n // numAttempts > 0), so a freshly-picked mid-attempt selection\n // computed live is never stored and never counts as optimal.\n optimal: this.#optimality.get(computedItem.identifier) === 'optimal'\n // type,\n // correct,\n // incorrect,\n // completed\n };\n })\n };\n })\n };\n })\n };\n\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n\n /**\n * Decide whether an item should be treated as \"the candidate is done with it\"\n * for the purpose of gating forward navigation and further attempts.\n *\n * - The candidate must have actually ended an attempt (numAttempts > 0).\n * - Once attempted, the item is done if they reached the optimal outcome\n * ('optimal'), or there's nothing to improve on ('unscored'). It is only *not*\n * done while a better attempt is still possible ('suboptimal') and attempts\n * remain — see #assessOptimality for how \"optimal\" is determined.\n *\n * `optimality` reflects the last *ended attempt* (see #optimality), not the\n * live selection — so a freshly-picked optimal answer doesn't count as done\n * until test-end-attempt evaluates it.\n */\n #isItemDone(numAttempts: number, optimality: ItemOptimality, maxAttempts: number | undefined): boolean {\n if (numAttempts === 0) return false;\n if (optimality !== 'suboptimal') return true;\n const max = maxAttempts ?? 1;\n return max > 0 && numAttempts >= max;\n }\n\n /**\n * Decide whether an item's submission is as good as it can get — i.e. the\n * candidate reached the *optimal* outcome, so there's no reason to make them\n * try again. 'optimal' means best achievable, 'suboptimal' means a better\n * attempt is still possible, 'unscored' means there's nothing to judge against.\n * (\"optimal\" is the spec's own word — a qti-correct-response is defined as\n * \"the (or an) optimal value\".)\n *\n * Two signals, in order of authority:\n * 1. The scored outcome: optimal ⟺ SCORE has reached its maximum (MAXSCORE).\n * This correctly handles partial-credit / qti-mapping items, where an exact\n * response match would under- or over-judge.\n * 2. The declared qti-correct-response, for items that aren't scored (no\n * SCORE/MAXSCORE) — an exact match is the best available proxy. Bookkeeping\n * variables like numAttempts can be typed 'response' but never declare a\n * correctResponse, so we filter on a declared correctResponse.\n *\n * Items with neither a comparable score nor a correctResponse (essays, info\n * items, etc.) are 'unscored' — there's no optimal value to require, so one\n * attempt is enough.\n */\n #assessOptimality(item: ItemContext): ItemOptimality {\n const variables = item.variables ?? [];\n\n const score = this.#numericVariable(variables, 'SCORE');\n const maxScore = this.#numericVariable(variables, 'MAXSCORE');\n if (score !== null && maxScore !== null) {\n return score >= maxScore ? 'optimal' : 'suboptimal';\n }\n\n const responseVars = variables.filter(\n (v): v is ResponseVariable =>\n v.type === 'response' &&\n (v as ResponseVariable).correctResponse !== undefined &&\n (v as ResponseVariable).correctResponse !== null\n );\n if (responseVars.length === 0) return 'unscored';\n const allMatch = responseVars.every(v => {\n const expected = v.correctResponse;\n const actual = v.value;\n if (actual === undefined || actual === null) return false;\n if (Array.isArray(expected) && Array.isArray(actual)) {\n return expected.length === actual.length && expected.every(e => actual.includes(e));\n }\n if (Array.isArray(expected) || Array.isArray(actual)) return false;\n return expected === actual;\n });\n return allMatch ? 'optimal' : 'suboptimal';\n }\n\n /** Read a single numeric outcome value, or null when absent / non-numeric. */\n #numericVariable(variables: ItemContext['variables'], identifier: string): number | null {\n const raw = variables?.find(v => v.identifier === identifier)?.value;\n if (raw === undefined || raw === null || Array.isArray(raw)) return null;\n const parsed = parseFloat(raw.toString());\n return Number.isNaN(parsed) ? null : parsed;\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,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAiCnE,iGAAiG;AACjG,MAAM,aAAa,GAAG,GAAe,EAAE,CAAC,CAAC;IACvC,WAAW,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,qBAAqB,EAAE,SAAS,EAAE;CAC/F,CAAC,CAAC;AAEH,MAAM,OAAO,cAAe,SAAQ,UAAU;IAM5C;;;;;;OAMG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,IAAI,CAAC,IAAI,CAAC,kBAAkB,KAAK,aAAa,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,IAAW,UAAU,CAAC,KA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AAE,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 { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\n\nimport { testHostContext } from '../../internal/test-host.context';\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 { QtiAssessmentSection } from '../qti-assessment-section/qti-assessment-section';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { QtiTestPart } from '../qti-test-part/qti-test-part';\nimport type { QtiItemSessionControl } from '../qti-item-session-control/qti-item-session-control';\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';\nimport type { ResponseVariable } from '@qti-components/base';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\n/**\n * Whether an item's ended attempt reached the best achievable outcome:\n * 'optimal' (nothing to improve), 'suboptimal' (a better attempt is possible),\n * or 'unscored' (no machine-judgeable optimal value — see #assessOptimality).\n */\ntype ItemOptimality = 'optimal' | 'suboptimal' | 'unscored';\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 @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 }\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 @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 constructor() {\n super();\n this.addEventListener('qti-assessment-test-connected', this.#handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));\n\n this.addEventListener('qti-interaction-changed', this.#handleInteractionChanged.bind(this));\n this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n this.addEventListener('test-end-attempt', this.#handleTestEndAttempt.bind(this));\n this.addEventListener('test-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));\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 const optimality = this.#assessOptimality(itemContext);\n this.#optimality.set(itemContext.identifier, optimality);\n\n const computedItem = this.computedItemFor(itemContext.identifier);\n const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts)\n );\n }\n\n /**\n * Extension point for presentation packages reacting to an ended attempt.\n * `done` is settled here — from the freshly latched optimality and the\n * session-control cascade — because the computed context only catches up on\n * the next update, after this event has finished bubbling.\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\n ?.flatMap(part => part.sections)\n .flatMap(section => section.items)\n .find(i => i.identifier === 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=\"${identifier}\"]`\n );\n return itemRef?.assessmentItem ?? undefined;\n }\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 * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n #handleTestEndAttempt(_event: CustomEvent) {\n const qtiAssessmentItemEl = 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 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 this.myTemplate ? this.myTemplate(this.stampContext) : nothing;\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.\n this.#optimality.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 const testPartElements = Array.from(this.#testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this.#testElement.identifier,\n title: this.#testElement.title,\n view: this._sessionContext?.view,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n const testPartSessionControl = testPart.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const partAllowSkipping = testPartSessionControl ? testPartSessionControl.allowSkipping : true;\n const partMaxAttempts = testPartSessionControl ? testPartSessionControl.maxAttempts : 1;\n const partShowFeedback = testPartSessionControl ? testPartSessionControl.showFeedback : false;\n const partShowSolution = testPartSessionControl ? testPartSessionControl.showSolution : false;\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\n allowSkipping: partAllowSkipping,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n const sectionSessionControl = section.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const sectionAllowSkipping = sectionSessionControl\n ? sectionSessionControl.allowSkipping\n : partAllowSkipping;\n const sectionMaxAttempts = sectionSessionControl ? sectionSessionControl.maxAttempts : partMaxAttempts;\n const sectionShowFeedback = sectionSessionControl ? sectionSessionControl.showFeedback : partShowFeedback;\n const sectionShowSolution = sectionSessionControl ? sectionSessionControl.showSolution : partShowSolution;\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n navigationMode: section.navigationMode,\n submissionMode: section.submissionMode,\n allowSkipping: sectionAllowSkipping,\n items: itemElements.map(item => {\n const itemSessionControl = item.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const itemAllowSkipping = itemSessionControl ? itemSessionControl.allowSkipping : sectionAllowSkipping;\n const itemMaxAttempts = itemSessionControl ? itemSessionControl.maxAttempts : sectionMaxAttempts;\n const itemShowFeedback = itemSessionControl ? itemSessionControl.showFeedback : sectionShowFeedback;\n const itemShowSolution = itemSessionControl ? itemSessionControl.showSolution : sectionShowSolution;\n return {\n ...this.initContext?.find(i => i.identifier === item.identifier),\n active: false,\n identifier: item.identifier,\n categories: item.category ? item.category?.split(' ') : [],\n href: item.href,\n variables: [] as OutcomeVariable[],\n allowSkipping: itemAllowSkipping,\n maxAttempts: itemMaxAttempts,\n showFeedback: itemShowFeedback,\n showSolution: itemShowSolution\n };\n })\n };\n })\n };\n })\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 /* PK: on item connected we can add item only properties in the xml */\n #handleItemConnected(event: CustomEvent) {\n const itemElement = event.detail as QtiAssessmentItem;\n\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n items: section.items.map(item => {\n if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n\n const scoreOutcome = itemElement.querySelector<HTMLElement>(\n \"qti-outcome-declaration[identifier='SCORE']\"\n );\n // const scoreOutcome = item.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n const externalScored = scoreOutcome?.getAttribute('externalScored');\n\n const responseDeclarations = itemElement.querySelectorAll<HTMLElement>('qti-response-declaration');\n const containsCorrectResponse = Array.from(responseDeclarations).some((r: HTMLElement) =>\n r.querySelector('qti-correct-response')\n );\n // check if every responseDeclaration has a correctResponse\n const containsMapping = Array.from(responseDeclarations).some((r: HTMLElement) => {\n const mapping = r.querySelector('qti-mapping');\n const areaMapping = r.querySelector('qti-area-mapping');\n return mapping?.querySelector('qti-map-entry') || areaMapping?.querySelector('qti-area-map-entry');\n });\n\n const hasCorrectResponse = containsCorrectResponse || containsMapping;\n\n const hasResponseProcessing = itemElement.querySelector('qti-response-processing') ? true : false;\n\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n externalScored,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: itemElement.variables,\n hasCorrectResponse,\n hasResponseProcessing\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n view: this._sessionContext?.view,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n active: this._sessionContext?.navPartId === testPart.identifier || false,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n active: this._sessionContext?.navSectionId === section.identifier || false,\n completed: section.items.every(\n item =>\n this._testContext.items\n .find(i => i.identifier === item.identifier)\n ?.variables.find(v => v.identifier === 'completionStatus').value === 'completed'\n ),\n\n items: section.items.map(item => {\n const itemContext = this._testContext?.items.find(i => i.identifier === item.identifier);\n const computedItem = {\n ...item,\n ...itemContext,\n ...this.initContext?.find(i => i.identifier === item.identifier)\n };\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n\n const score = rawscore === undefined || rawscore === null ? null : parseFloat(rawscore?.toString());\n\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')\n ?.value as string;\n\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n const numAttempts =\n Number(computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n\n const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;\n\n // Published by the item. One that is not on screen has nothing to be invalid.\n const valid = itemContext?.valid ?? true;\n\n const responseVars = itemContext?.variables?.filter(v => v.type === 'response') || [];\n\n const isDefaultResponse = responseVars.every(v => {\n if (v.value === undefined || v.value === null) {\n return true;\n }\n let fallbackValue: string;\n switch (v.baseType) {\n case 'integer':\n case 'float':\n case 'duration':\n fallbackValue = '0';\n break;\n case 'boolean':\n fallbackValue = 'false';\n break;\n case 'string':\n case 'directedPair':\n case 'identifier':\n case 'pair':\n case 'record':\n default:\n fallbackValue = '';\n break;\n }\n\n const defaultValue = v.defaultValue ?? fallbackValue;\n\n if (Array.isArray(v.value)) {\n const dv = Array.isArray(defaultValue) ? defaultValue : [defaultValue];\n return v.value.length === dv.length && v.value.every((val, i) => val === dv[i]);\n }\n\n return v.value === defaultValue;\n });\n\n // Computed and opiniated\n // const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';\n // const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;\n // const incorrect = (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false;\n // const completed = completionStatus === 'completed';\n\n const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;\n const maxScore =\n rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());\n\n // Optimality comes from the last *ended attempt* (#optimality),\n // latched in #handleItemContextUpdated — never from a live\n // mid-attempt selection. On a restored session no attempt is ended\n // this run, so seed it once from the persisted context, which still\n // holds the submitted response.\n let optimality = this.#optimality.get(computedItem.identifier);\n if (optimality === undefined) {\n optimality = itemContext ? this.#assessOptimality(itemContext) : 'unscored';\n if (numAttempts > 0) this.#optimality.set(computedItem.identifier, optimality);\n }\n\n const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);\n\n return {\n ...computedItem,\n completionStatus,\n numAttempts,\n score,\n response,\n index,\n active,\n valid,\n isDefaultResponse,\n maxScore,\n done,\n // Reflects the last *ended* attempt only. Read the latch directly\n // (not the `optimality` local) — the latch is written solely on\n // responseProcessed / restore-seed (line above, guarded by\n // numAttempts > 0), so a freshly-picked mid-attempt selection\n // computed live is never stored and never counts as optimal.\n optimal: this.#optimality.get(computedItem.identifier) === 'optimal'\n // type,\n // correct,\n // incorrect,\n // completed\n };\n })\n };\n })\n };\n })\n };\n\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n\n /**\n * Decide whether an item should be treated as \"the candidate is done with it\"\n * for the purpose of gating forward navigation and further attempts.\n *\n * - The candidate must have actually ended an attempt (numAttempts > 0).\n * - Once attempted, the item is done if they reached the optimal outcome\n * ('optimal'), or there's nothing to improve on ('unscored'). It is only *not*\n * done while a better attempt is still possible ('suboptimal') and attempts\n * remain — see #assessOptimality for how \"optimal\" is determined.\n *\n * `optimality` reflects the last *ended attempt* (see #optimality), not the\n * live selection — so a freshly-picked optimal answer doesn't count as done\n * until test-end-attempt evaluates it.\n */\n #isItemDone(numAttempts: number, optimality: ItemOptimality, maxAttempts: number | undefined): boolean {\n if (numAttempts === 0) return false;\n if (optimality !== 'suboptimal') return true;\n const max = maxAttempts ?? 1;\n return max > 0 && numAttempts >= max;\n }\n\n /**\n * Decide whether an item's submission is as good as it can get — i.e. the\n * candidate reached the *optimal* outcome, so there's no reason to make them\n * try again. 'optimal' means best achievable, 'suboptimal' means a better\n * attempt is still possible, 'unscored' means there's nothing to judge against.\n * (\"optimal\" is the spec's own word — a qti-correct-response is defined as\n * \"the (or an) optimal value\".)\n *\n * Two signals, in order of authority:\n * 1. The scored outcome: optimal ⟺ SCORE has reached its maximum (MAXSCORE).\n * This correctly handles partial-credit / qti-mapping items, where an exact\n * response match would under- or over-judge.\n * 2. The declared qti-correct-response, for items that aren't scored (no\n * SCORE/MAXSCORE) — an exact match is the best available proxy. Bookkeeping\n * variables like numAttempts can be typed 'response' but never declare a\n * correctResponse, so we filter on a declared correctResponse.\n *\n * Items with neither a comparable score nor a correctResponse (essays, info\n * items, etc.) are 'unscored' — there's no optimal value to require, so one\n * attempt is enough.\n */\n #assessOptimality(item: ItemContext): ItemOptimality {\n const variables = item.variables ?? [];\n\n const score = this.#numericVariable(variables, 'SCORE');\n const maxScore = this.#numericVariable(variables, 'MAXSCORE');\n if (score !== null && maxScore !== null) {\n return score >= maxScore ? 'optimal' : 'suboptimal';\n }\n\n const responseVars = variables.filter(\n (v): v is ResponseVariable =>\n v.type === 'response' &&\n (v as ResponseVariable).correctResponse !== undefined &&\n (v as ResponseVariable).correctResponse !== null\n );\n if (responseVars.length === 0) return 'unscored';\n const allMatch = responseVars.every(v => {\n const expected = v.correctResponse;\n const actual = v.value;\n if (actual === undefined || actual === null) return false;\n if (Array.isArray(expected) && Array.isArray(actual)) {\n return expected.length === actual.length && expected.every(e => actual.includes(e));\n }\n if (Array.isArray(expected) || Array.isArray(actual)) return false;\n return expected === actual;\n });\n return allMatch ? 'optimal' : 'suboptimal';\n }\n\n /** Read a single numeric outcome value, or null when absent / non-numeric. */\n #numericVariable(variables: ItemContext['variables'], identifier: string): number | null {\n const raw = variables?.find(v => v.identifier === identifier)?.value;\n if (raw === undefined || raw === null || Array.isArray(raw)) return null;\n const parsed = parseFloat(raw.toString());\n return Number.isNaN(parsed) ? null : parsed;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-navigation': TestNavigation;\n }\n}\n"]}
@@ -9,7 +9,7 @@ export declare class TestScoringButtons extends LitElement {
9
9
  protected createRenderRoot(): HTMLElement | DocumentFragment;
10
10
  connectedCallback(): void;
11
11
  protected computedContext?: ComputedContext;
12
- render(): typeof nothing | import("lit").TemplateResult<1>;
12
+ render(): import("lit").TemplateResult<1> | typeof nothing;
13
13
  constructor();
14
14
  }
15
15
  declare global {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import './register.js';
2
2
  export * from './components/index.js';
3
3
  export * from './types/iqti-test.js';
4
+ export * from './types/qti-test-state.js';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import './register.js';
2
2
  export * from './components/index.js';
3
3
  export * from './types/iqti-test.js';
4
+ export * from './types/qti-test-state.js';
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC","sourcesContent":["import './register.js';\n\nexport * from './components/index.js';\nexport * from './types/iqti-test.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC","sourcesContent":["import './register.js';\n\nexport * from './components/index.js';\nexport * from './types/iqti-test.js';\nexport * from './types/qti-test-state.js';\n"]}
@@ -0,0 +1,24 @@
1
+ import type { QtiContext } from '@qti-components/base';
2
+ import type { transformTestApi } from '@qti-components/transformers';
3
+ import type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';
4
+ /**
5
+ * Defined here, and re-exported by the navigation mixin under the same name, so this file imports
6
+ * nothing from the mixin: the mixin imports the components that consume this context, and a type
7
+ * import counts as a dependency for madge.
8
+ */
9
+ export type PostLoadTestTransformCallback = (transformer: transformTestApi, testElement: QtiAssessmentTest) => transformTestApi | Promise<transformTestApi>;
10
+ /**
11
+ * What the components inside a test need from the `qti-test` that contains them: the things a host
12
+ * put on it, and the element to query. Provided by `qti-test` about itself.
13
+ *
14
+ * It is context and not `closest('qti-test')` because a request crosses shadow roots and `closest`
15
+ * stops at the first one, so a navigation or container a host renders inside its own component
16
+ * would never find its test. Internal on purpose: not exported from the package, and not API.
17
+ */
18
+ export interface TestHost extends HTMLElement {
19
+ qtiContext: QtiContext;
20
+ postLoadTestTransformCallback: PostLoadTestTransformCallback | null;
21
+ }
22
+ export declare const testHostContext: {
23
+ __context__: TestHost;
24
+ };
@@ -0,0 +1,3 @@
1
+ import { createContext } from '@lit/context';
2
+ export const testHostContext = createContext(Symbol('testHost'));
3
+ //# sourceMappingURL=test-host.context.js.map
@@ -0,0 +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;AA6B7C,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 qtiContext: QtiContext;\n postLoadTestTransformCallback: PostLoadTestTransformCallback | null;\n}\n\nexport const testHostContext = createContext<TestHost>(Symbol('testHost'));\n"]}
@@ -1,3 +1,4 @@
1
1
  export * from './test-navigation.mixin';
2
2
  export * from './test-view.mixin';
3
3
  export * from './test-base';
4
+ export * from './test-state.mixin';
@@ -1,4 +1,5 @@
1
1
  export * from './test-navigation.mixin';
2
2
  export * from './test-view.mixin';
3
3
  export * from './test-base';
4
+ export * from './test-state.mixin';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mixins/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC","sourcesContent":["export * from './test-navigation.mixin';\nexport * from './test-view.mixin';\nexport * from './test-base';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mixins/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './test-navigation.mixin';\nexport * from './test-view.mixin';\nexport * from './test-base';\nexport * from './test-state.mixin';\n"]}
@@ -1,7 +1,8 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { type SessionContext } from '@qti-components/base';
3
3
  import type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';
4
- import type { ConfigContext } from '@qti-components/base';
4
+ import type { ConfigContext, QtiContext } from '@qti-components/base';
5
+ import type { ItemContext } from '@qti-components/base';
5
6
  import type { TestContext } from '@qti-components/base';
6
7
  import type { VariableValue } from '@qti-components/base';
7
8
  type Constructor<T = {}> = abstract new (...args: any[]) => T;
@@ -9,9 +10,13 @@ export interface TestBaseInterface extends LitElement {
9
10
  testContext: Readonly<TestContext>;
10
11
  sessionContext: Readonly<SessionContext>;
11
12
  configContext?: Readonly<ConfigContext>;
13
+ /** Provided by `qti-test`. */
14
+ qtiContext?: Readonly<QtiContext>;
12
15
  _testElement: QtiAssessmentTest;
13
- updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;
16
+ updateItemVariables(itemRefID: string, variables: readonly ItemVariableValue[], state?: ItemContext['state']): void;
14
17
  }
18
+ /** A value to set on an item; `type` is only needed for a variable the item does not declare. */
19
+ export type ItemVariableValue = Pick<VariableValue<string | string[] | null>, 'identifier' | 'value'> & Partial<Pick<VariableValue<string | string[] | null>, 'type'>>;
15
20
  export declare const TestBaseMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<TestBaseInterface> & T;
16
21
  declare const TestBase_base: Constructor<TestBaseInterface> & typeof LitElement;
17
22
  export declare abstract class TestBase extends TestBase_base {
@@ -25,7 +25,7 @@ export const TestBaseMixin = (superClass) => {
25
25
  * @param assessmentItem - The assessment item to update.
26
26
  */
27
27
  this._updateItemInTestContext = (assessmentItem) => {
28
- const context = assessmentItem._context;
28
+ const context = assessmentItem.itemContext;
29
29
  const identifier = context.identifier;
30
30
  const fullVariables = context.variables;
31
31
  // Find the corresponding item in the test context by identifier
@@ -37,7 +37,7 @@ export const TestBaseMixin = (superClass) => {
37
37
  // Update variables in the test context or sync them to the assessment item
38
38
  if (itemContext.variables?.length === 1) {
39
39
  // The loaded qti-assessment-item itself has variables which are not in test context yet.
40
- this._updateItemVariablesInTestContext(identifier, fullVariables);
40
+ this._updateItemVariablesInTestContext(identifier, fullVariables, undefined, context.valid);
41
41
  }
42
42
  else {
43
43
  const newVariables = [...assessmentItem.variables];
@@ -52,24 +52,56 @@ export const TestBaseMixin = (superClass) => {
52
52
  }
53
53
  }
54
54
  assessmentItem.variables = newVariables;
55
+ // Opaque interaction state (a PCI's getState()) is read from the item context when the
56
+ // interaction initializes, so it has to be in place now, before that happens.
57
+ if (itemContext.state) {
58
+ assessmentItem.state = itemContext.state;
59
+ }
55
60
  }
56
61
  };
57
62
  this._initializeEventListeners();
58
63
  }
59
- updateItemVariables(itemRefID, variables) {
60
- // Update variables in the testContext for the specified itemRefID
61
- const itemContext = this.testContext.items.find(item => item.identifier === itemRefID);
62
- if (itemContext) {
63
- itemContext.variables = itemContext.variables.map(variable => {
64
- const updatedVariable = variables.find(v => v.identifier === variable.identifier);
65
- return updatedVariable ? { ...variable, ...updatedVariable } : variable;
66
- });
67
- }
68
- // if the qti-assessment-item-ref has a qti-assessment-item, then update this item as well
69
- const itemRef = this._testElement.querySelector(`qti-assessment-item-ref[identifier="${itemRefID}"]`);
70
- if (itemRef && itemRef.assessmentItem) {
71
- itemRef.assessmentItem.variables = variables;
72
- }
64
+ /**
65
+ * Sets values on one item from outside the candidate's session, e.g. a score from manual
66
+ * scoring. Values are merged into the item's entry in the test context, and into the item
67
+ * itself if it is on screen; a value the item has not seen yet is added, so this also works
68
+ * before the item has loaded. To restore a whole session, assign `state` instead.
69
+ *
70
+ * The test context is replaced rather than changed in place, so its consumers update and
71
+ * `qti-state-changed` fires.
72
+ *
73
+ * @param itemRefID The `qti-assessment-item-ref` identifier, not the item's own identifier.
74
+ * @param state Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`.
75
+ */
76
+ updateItemVariables(itemRefID, values, state) {
77
+ this.testContext = {
78
+ ...this.testContext,
79
+ items: this.testContext.items.map(item => {
80
+ if (item.identifier !== itemRefID)
81
+ return item;
82
+ const variables = [...(item.variables ?? [])];
83
+ for (const { identifier, type, value } of values) {
84
+ const index = variables.findIndex(v => v.identifier === identifier);
85
+ const updated = {
86
+ ...(index >= 0 ? variables[index] : {}),
87
+ identifier,
88
+ ...(type ? { type } : {}),
89
+ value: Array.isArray(value) ? [...value] : value
90
+ };
91
+ if (index >= 0)
92
+ variables[index] = updated;
93
+ else
94
+ variables.push(updated);
95
+ }
96
+ return { ...item, variables, ...(state ? { state: { ...state } } : {}) };
97
+ })
98
+ };
99
+ const assessmentItem = this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(itemRefID)}"]`)?.assessmentItem;
100
+ if (!assessmentItem)
101
+ return;
102
+ assessmentItem.variables = [...(this.testContext.items.find(i => i.identifier === itemRefID)?.variables ?? [])];
103
+ if (state)
104
+ assessmentItem.state = state;
73
105
  }
74
106
  _initializeEventListeners() {
75
107
  /**
@@ -119,10 +151,10 @@ export const TestBaseMixin = (superClass) => {
119
151
  });
120
152
  this.addEventListener('qti-item-context-updated', (e) => {
121
153
  // const assessmentitem = e.composedPath()[0] as QtiAssessmentItem;
122
- this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables, e.detail.itemContext.state);
154
+ this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables, e.detail.itemContext.state, e.detail.itemContext.valid);
123
155
  });
124
156
  }
125
- _updateItemVariablesInTestContext(identifier, variables, state) {
157
+ _updateItemVariablesInTestContext(identifier, variables, state, valid) {
126
158
  // Update the test context with modified variables for the specified item
127
159
  this.testContext = {
128
160
  ...this.testContext, // Spread existing test context properties
@@ -140,10 +172,12 @@ export const TestBaseMixin = (superClass) => {
140
172
  // Merge matching variable with the new one, or use the new variable if no match
141
173
  return matchingVariable ? { ...matchingVariable, ...variable } : variable;
142
174
  }),
143
- ...(state !== undefined ? { state: state ? { ...state } : undefined } : {})
175
+ ...(state !== undefined ? { state: state ? { ...state } : undefined } : {}),
176
+ ...(valid !== undefined ? { valid } : {})
144
177
  };
145
178
  })
146
179
  };
180
+ // Deprecated for hosts, see `@event` on `qti-test`; kept until the next major.
147
181
  this.dispatchEvent(new CustomEvent('qti-test-context-updated', { detail: this.testContext, bubbles: false, composed: false }));
148
182
  }
149
183
  }
@@ -1 +1 @@
1
- {"version":3,"file":"test-base.js","sourceRoot":"","sources":["../../src/mixins/test-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAuB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAoBpG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAoC,UAAa,EAAE,EAAE;IAChF,MAA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AAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAC3G,CAAC;QACJ,CAAC;KA0CF;IAnKQ;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;sDAC+B;IAI1D;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;yDACqC;IAiK5E,OAAO,aAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,OAAgB,QAAS,SAAQ,aAAa,CAAC,UAAU,CAAC;CAAG","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { INITIAL_TEST_CONTEXT, testContext } from '@qti-components/base';\nimport { INITIAL_SESSION_CONTEXT, type SessionContext, sessionContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiAssessmentItemRef } from '../components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { OutcomeVariable, VariableDeclaration, VariableValue } from '@qti-components/base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\nexport interface TestBaseInterface extends LitElement {\n testContext: Readonly<TestContext>;\n sessionContext: Readonly<SessionContext>;\n configContext?: Readonly<ConfigContext>;\n _testElement: QtiAssessmentTest;\n updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;\n}\n\nexport const TestBaseMixin = <T extends Constructor<LitElement>>(superClass: T) => {\n abstract class TestBaseClass extends superClass implements TestBaseInterface {\n @property({ attribute: false, type: Object })\n @provide({ context: testContext })\n public testContext: Readonly<TestContext> = INITIAL_TEST_CONTEXT;\n\n @property({ attribute: false, type: Object })\n @provide({ context: sessionContext })\n public sessionContext: Readonly<SessionContext> = INITIAL_SESSION_CONTEXT;\n\n public _testElement: QtiAssessmentTest;\n\n constructor(...args: any[]) {\n super(...args);\n this._initializeEventListeners();\n }\n\n updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void {\n // Update variables in the testContext for the specified itemRefID\n const itemContext = this.testContext.items.find(item => item.identifier === itemRefID);\n if (itemContext) {\n itemContext.variables = itemContext.variables.map(variable => {\n const updatedVariable = variables.find(v => v.identifier === variable.identifier);\n return updatedVariable ? { ...variable, ...updatedVariable } : variable;\n });\n }\n // if the qti-assessment-item-ref has a qti-assessment-item, then update this item as well\n const itemRef = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${itemRefID}\"]`\n );\n if (itemRef && itemRef.assessmentItem) {\n itemRef.assessmentItem.variables = variables;\n }\n }\n\n private _initializeEventListeners(): void {\n /**\n * A new test document means a new test and session context.\n *\n * This resets on the document being loaded rather than on\n * `qti-assessment-test-connected`, because the new document's children —\n * test-level `qti-outcome-declaration` among them — connect and register\n * themselves into the context *before* the test element announces itself.\n * Resetting on that announcement discarded every one of those\n * registrations, so no test-level outcome could be read or set.\n */\n this.addEventListener('qti-testdoc-loaded', () => {\n this.testContext = INITIAL_TEST_CONTEXT;\n this.sessionContext = INITIAL_SESSION_CONTEXT;\n });\n\n /**\n * When the test is connected, its item-refs are added to the test context.\n * Registrations from the document's children are already present on the\n * context reset above, so this must preserve what is there.\n */\n this.addEventListener('qti-assessment-test-connected', (e: CustomEvent<QtiAssessmentTest>) => {\n this._testElement = e.detail;\n const items = Array.from(this._testElement.querySelectorAll('qti-assessment-item-ref')).map(itemRef => {\n return {\n href: itemRef.href,\n identifier: itemRef.identifier,\n category: itemRef.category,\n variables: [\n {\n identifier: 'completionStatus',\n value: 'not_attempted',\n type: 'outcome'\n } as OutcomeVariable\n ]\n };\n });\n this.testContext = { ...this.testContext, items };\n });\n\n this.addEventListener('qti-assessment-item-connected', (e: CustomEvent<QtiAssessmentItem>) => {\n const assessmentItem = e.detail as QtiAssessmentItem;\n const assessmentRefId = assessmentItem.closest('qti-assessment-item-ref')?.identifier;\n if (assessmentRefId) {\n assessmentItem.assessmentItemRefId = assessmentRefId;\n }\n this._updateItemInTestContext(e.detail);\n });\n\n this.addEventListener('qti-item-context-updated', (e: CustomEvent<{ itemContext: ItemContext }>) => {\n // const assessmentitem = e.composedPath()[0] as QtiAssessmentItem;\n this._updateItemVariablesInTestContext(\n e.detail.itemContext.identifier,\n e.detail.itemContext.variables,\n e.detail.itemContext.state\n );\n });\n }\n\n private _updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[],\n state?: ItemContext['state']\n ): void {\n // Update the test context with modified variables for the specified item\n this.testContext = {\n ...this.testContext, // Spread existing test context properties\n items: this.testContext.items.map(itemContext => {\n // If the item identifier doesn't match, keep it unchanged\n if (itemContext.identifier !== identifier) {\n return itemContext;\n }\n\n // Update the matching item with new variables\n return {\n ...itemContext, // Keep other properties of the item context\n variables: variables.map(variable => {\n // Find a matching variable in the current item context\n const matchingVariable = itemContext.variables.find(v => v.identifier === variable.identifier);\n\n // Merge matching variable with the new one, or use the new variable if no match\n return matchingVariable ? { ...matchingVariable, ...variable } : variable;\n }),\n ...(state !== undefined ? { state: state ? { ...state } : undefined } : {})\n };\n })\n };\n this.dispatchEvent(\n new CustomEvent('qti-test-context-updated', { detail: this.testContext, bubbles: false, composed: false })\n );\n }\n\n /**\n * Updates the variables of an assessment item in the test context.\n * - Matches the assessment item with the corresponding test context item.\n * - If the item is not found, logs a warning.\n * - Updates variables in the test context if exactly one variable exists.\n * - Otherwise, syncs the assessment item's variables with the test context.\n *\n * @param assessmentItem - The assessment item to update.\n */\n private _updateItemInTestContext = (assessmentItem: QtiAssessmentItem): void => {\n const context = (assessmentItem as any)._context;\n const identifier = context.identifier;\n const fullVariables = context.variables;\n\n // Find the corresponding item in the test context by identifier\n const itemContext = this.testContext.items.find(i => i?.identifier === identifier);\n\n if (!itemContext) {\n console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);\n return;\n }\n\n // Update variables in the test context or sync them to the assessment item\n if (itemContext.variables?.length === 1) {\n // The loaded qti-assessment-item itself has variables which are not in test context yet.\n this._updateItemVariablesInTestContext(identifier, fullVariables);\n } else {\n const newVariables = [...assessmentItem.variables];\n // Sync the assessment item's variables with the test context\n for (const variable of itemContext.variables) {\n const currentVariable = newVariables.find(v => v.identifier === variable.identifier);\n if (currentVariable) {\n currentVariable.value = variable.value;\n } else {\n newVariables.push(variable);\n }\n }\n assessmentItem.variables = newVariables;\n }\n };\n }\n\n return TestBaseClass as Constructor<TestBaseInterface> & T;\n};\n\n// Keep the old abstract class for backwards compatibility during migration\nexport abstract class TestBase extends TestBaseMixin(LitElement) {}\n"]}
1
+ {"version":3,"file":"test-base.js","sourceRoot":"","sources":["../../src/mixins/test-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAuB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA0BpG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAoC,UAAa,EAAE,EAAE;IAChF,MAAe,aAAc,SAAQ,UAAU;QAW7C,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YATV,gBAAW,GAA0B,oBAAoB,C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E,QAAQ,EAAE,KAAK,EAAE,CAAC,CAC3G,CAAC;QACJ,CAAC;KA+CF;IApMQ;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;sDAC+B;IAI1D;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;yDACqC;IAkM5E,OAAO,aAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,OAAgB,QAAS,SAAQ,aAAa,CAAC,UAAU,CAAC;CAAG","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { INITIAL_TEST_CONTEXT, testContext } from '@qti-components/base';\nimport { INITIAL_SESSION_CONTEXT, type SessionContext, sessionContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiAssessmentItemRef } from '../components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';\nimport type { ConfigContext, QtiContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { OutcomeVariable, VariableDeclaration, VariableValue } from '@qti-components/base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\nexport interface TestBaseInterface extends LitElement {\n testContext: Readonly<TestContext>;\n sessionContext: Readonly<SessionContext>;\n configContext?: Readonly<ConfigContext>;\n /** Provided by `qti-test`. */\n qtiContext?: Readonly<QtiContext>;\n _testElement: QtiAssessmentTest;\n updateItemVariables(itemRefID: string, variables: readonly ItemVariableValue[], state?: ItemContext['state']): void;\n}\n\n/** A value to set on an item; `type` is only needed for a variable the item does not declare. */\nexport type ItemVariableValue = Pick<VariableValue<string | string[] | null>, 'identifier' | 'value'> &\n Partial<Pick<VariableValue<string | string[] | null>, 'type'>>;\n\nexport const TestBaseMixin = <T extends Constructor<LitElement>>(superClass: T) => {\n abstract class TestBaseClass extends superClass implements TestBaseInterface {\n @property({ attribute: false, type: Object })\n @provide({ context: testContext })\n public testContext: Readonly<TestContext> = INITIAL_TEST_CONTEXT;\n\n @property({ attribute: false, type: Object })\n @provide({ context: sessionContext })\n public sessionContext: Readonly<SessionContext> = INITIAL_SESSION_CONTEXT;\n\n public _testElement: QtiAssessmentTest;\n\n constructor(...args: any[]) {\n super(...args);\n this._initializeEventListeners();\n }\n\n /**\n * Sets values on one item from outside the candidate's session, e.g. a score from manual\n * scoring. Values are merged into the item's entry in the test context, and into the item\n * itself if it is on screen; a value the item has not seen yet is added, so this also works\n * before the item has loaded. To restore a whole session, assign `state` instead.\n *\n * The test context is replaced rather than changed in place, so its consumers update and\n * `qti-state-changed` fires.\n *\n * @param itemRefID The `qti-assessment-item-ref` identifier, not the item's own identifier.\n * @param state Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`.\n */\n updateItemVariables(itemRefID: string, values: readonly ItemVariableValue[], state?: ItemContext['state']): void {\n this.testContext = {\n ...this.testContext,\n items: this.testContext.items.map(item => {\n if (item.identifier !== itemRefID) return item;\n\n const variables = [...(item.variables ?? [])];\n for (const { identifier, type, value } of values) {\n const index = variables.findIndex(v => v.identifier === identifier);\n const updated = {\n ...(index >= 0 ? variables[index] : {}),\n identifier,\n ...(type ? { type } : {}),\n value: Array.isArray(value) ? [...value] : value\n } as VariableDeclaration<string | string[] | null>;\n if (index >= 0) variables[index] = updated;\n else variables.push(updated);\n }\n return { ...item, variables, ...(state ? { state: { ...state } } : {}) };\n })\n };\n\n const assessmentItem = this._testElement?.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${CSS.escape(itemRefID)}\"]`\n )?.assessmentItem;\n if (!assessmentItem) return;\n assessmentItem.variables = [...(this.testContext.items.find(i => i.identifier === itemRefID)?.variables ?? [])];\n if (state) assessmentItem.state = state;\n }\n\n private _initializeEventListeners(): void {\n /**\n * A new test document means a new test and session context.\n *\n * This resets on the document being loaded rather than on\n * `qti-assessment-test-connected`, because the new document's children —\n * test-level `qti-outcome-declaration` among them — connect and register\n * themselves into the context *before* the test element announces itself.\n * Resetting on that announcement discarded every one of those\n * registrations, so no test-level outcome could be read or set.\n */\n this.addEventListener('qti-testdoc-loaded', () => {\n this.testContext = INITIAL_TEST_CONTEXT;\n this.sessionContext = INITIAL_SESSION_CONTEXT;\n });\n\n /**\n * When the test is connected, its item-refs are added to the test context.\n * Registrations from the document's children are already present on the\n * context reset above, so this must preserve what is there.\n */\n this.addEventListener('qti-assessment-test-connected', (e: CustomEvent<QtiAssessmentTest>) => {\n this._testElement = e.detail;\n const items = Array.from(this._testElement.querySelectorAll('qti-assessment-item-ref')).map(itemRef => {\n return {\n href: itemRef.href,\n identifier: itemRef.identifier,\n category: itemRef.category,\n variables: [\n {\n identifier: 'completionStatus',\n value: 'not_attempted',\n type: 'outcome'\n } as OutcomeVariable\n ]\n };\n });\n this.testContext = { ...this.testContext, items };\n });\n\n this.addEventListener('qti-assessment-item-connected', (e: CustomEvent<QtiAssessmentItem>) => {\n const assessmentItem = e.detail as QtiAssessmentItem;\n const assessmentRefId = assessmentItem.closest('qti-assessment-item-ref')?.identifier;\n if (assessmentRefId) {\n assessmentItem.assessmentItemRefId = assessmentRefId;\n }\n this._updateItemInTestContext(e.detail);\n });\n\n this.addEventListener('qti-item-context-updated', (e: CustomEvent<{ itemContext: ItemContext }>) => {\n // const assessmentitem = e.composedPath()[0] as QtiAssessmentItem;\n this._updateItemVariablesInTestContext(\n e.detail.itemContext.identifier,\n e.detail.itemContext.variables,\n e.detail.itemContext.state,\n e.detail.itemContext.valid\n );\n });\n }\n\n private _updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[],\n state?: ItemContext['state'],\n valid?: boolean\n ): void {\n // Update the test context with modified variables for the specified item\n this.testContext = {\n ...this.testContext, // Spread existing test context properties\n items: this.testContext.items.map(itemContext => {\n // If the item identifier doesn't match, keep it unchanged\n if (itemContext.identifier !== identifier) {\n return itemContext;\n }\n\n // Update the matching item with new variables\n return {\n ...itemContext, // Keep other properties of the item context\n variables: variables.map(variable => {\n // Find a matching variable in the current item context\n const matchingVariable = itemContext.variables.find(v => v.identifier === variable.identifier);\n\n // Merge matching variable with the new one, or use the new variable if no match\n return matchingVariable ? { ...matchingVariable, ...variable } : variable;\n }),\n ...(state !== undefined ? { state: state ? { ...state } : undefined } : {}),\n ...(valid !== undefined ? { valid } : {})\n };\n })\n };\n // Deprecated for hosts, see `@event` on `qti-test`; kept until the next major.\n this.dispatchEvent(\n new CustomEvent('qti-test-context-updated', { detail: this.testContext, bubbles: false, composed: false })\n );\n }\n\n /**\n * Updates the variables of an assessment item in the test context.\n * - Matches the assessment item with the corresponding test context item.\n * - If the item is not found, logs a warning.\n * - Updates variables in the test context if exactly one variable exists.\n * - Otherwise, syncs the assessment item's variables with the test context.\n *\n * @param assessmentItem - The assessment item to update.\n */\n private _updateItemInTestContext = (assessmentItem: QtiAssessmentItem): void => {\n const context = assessmentItem.itemContext;\n const identifier = context.identifier;\n const fullVariables = context.variables;\n\n // Find the corresponding item in the test context by identifier\n const itemContext = this.testContext.items.find(i => i?.identifier === identifier);\n\n if (!itemContext) {\n console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);\n return;\n }\n\n // Update variables in the test context or sync them to the assessment item\n if (itemContext.variables?.length === 1) {\n // The loaded qti-assessment-item itself has variables which are not in test context yet.\n this._updateItemVariablesInTestContext(identifier, fullVariables, undefined, context.valid);\n } else {\n const newVariables = [...assessmentItem.variables];\n // Sync the assessment item's variables with the test context\n for (const variable of itemContext.variables) {\n const currentVariable = newVariables.find(v => v.identifier === variable.identifier);\n if (currentVariable) {\n currentVariable.value = variable.value;\n } else {\n newVariables.push(variable);\n }\n }\n assessmentItem.variables = newVariables;\n // Opaque interaction state (a PCI's getState()) is read from the item context when the\n // interaction initializes, so it has to be in place now, before that happens.\n if (itemContext.state) {\n assessmentItem.state = itemContext.state;\n }\n }\n };\n }\n\n return TestBaseClass as Constructor<TestBaseInterface> & T;\n};\n\n// Keep the old abstract class for backwards compatibility during migration\nexport abstract class TestBase extends TestBaseMixin(LitElement) {}\n"]}
@@ -1,10 +1,10 @@
1
- import type { transformItemApi, transformTestApi } from '@qti-components/transformers';
1
+ import type { transformItemApi } from '@qti-components/transformers';
2
2
  import type { QtiAssessmentItemRef } from '../components/qti-assessment-item-ref/qti-assessment-item-ref';
3
- import type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';
3
+ import type { PostLoadTestTransformCallback } from '../internal/test-host.context';
4
4
  import type { TestBaseInterface } from './test-base';
5
5
  type Constructor<T = {}> = abstract new (...args: any[]) => T;
6
6
  export type PostLoadTransformCallback = (transformer: transformItemApi, itemRef: QtiAssessmentItemRef) => transformItemApi | Promise<transformItemApi>;
7
- export type PostLoadTestTransformCallback = (transformer: transformTestApi, testElement: QtiAssessmentTest) => transformTestApi | Promise<transformTestApi>;
7
+ export type { PostLoadTestTransformCallback };
8
8
  export interface NavigationError {
9
9
  message: string;
10
10
  details?: any;
@@ -50,4 +50,3 @@ export interface ITestNavigationMixin {
50
50
  * - Error handling and edge case coverage
51
51
  */
52
52
  export declare const TestNavigationMixin: <T extends Constructor<TestBaseInterface>>(superClass: T) => Constructor<ITestNavigationMixin> & T;
53
- export {};