@qti-components/test 2.0.0-next.4 → 2.0.0-next.5
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.
- package/dist/components/index.d.ts +0 -11
- package/dist/components/index.js +0 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/test-bookmark/test-bookmark.d.ts +48 -0
- package/dist/components/test-bookmark/test-bookmark.js +144 -0
- package/dist/components/test-bookmark/test-bookmark.js.map +1 -0
- package/dist/components/test-navigation/test-navigation.js +8 -2
- package/dist/components/test-navigation/test-navigation.js.map +1 -1
- package/dist/components/test-stamp/test-stamp.js +6 -2
- package/dist/components/test-stamp/test-stamp.js.map +1 -1
- package/dist/elements.d.ts +31 -44
- package/dist/elements.js +4 -30
- package/dist/elements.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mixins/test-state.mixin.js +25 -1
- package/dist/mixins/test-state.mixin.js.map +1 -1
- package/dist/plugin-state.d.ts +8 -0
- package/dist/plugin-state.js +7 -0
- package/dist/plugin-state.js.map +1 -0
- package/dist/plugins/elements.d.ts +71 -0
- package/dist/plugins/elements.js +33 -0
- package/dist/plugins/elements.js.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/public-events.d.ts +5 -0
- package/dist/public-events.js +1 -0
- package/dist/public-events.js.map +1 -1
- package/dist/tts/elements.d.ts +28 -0
- package/dist/tts/elements.js +14 -0
- package/dist/tts/elements.js.map +1 -0
- package/dist/{components/test-item-to-speech → tts}/test-item-to-speech.d.ts +9 -9
- package/dist/{components/test-item-to-speech → tts}/test-item-to-speech.js +59 -85
- package/dist/tts/test-item-to-speech.js.map +1 -0
- package/dist/types/qti-test-state.d.ts +12 -1
- package/dist/types/qti-test-state.js.map +1 -1
- package/package.json +10 -6
- package/dist/components/test-item-to-speech/test-item-to-speech.js.map +0 -1
- package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.d.ts +0 -19
- package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js +0 -39
- package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js.map +0 -1
- package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.d.ts +0 -19
- package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js +0 -39
- package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js.map +0 -1
|
@@ -14,18 +14,7 @@ export * from '../components/qti-item-session-control/qti-item-session-control';
|
|
|
14
14
|
export * from './test-navigation/test-navigation';
|
|
15
15
|
export * from './test-next/test-next';
|
|
16
16
|
export * from './test-prev/test-prev';
|
|
17
|
-
export * from './test-view-toggle/test-view';
|
|
18
17
|
export * from './test-item-link/test-item-link';
|
|
19
18
|
export * from './test-end-attempt/test-end-attempt';
|
|
20
|
-
export * from './test-paging-buttons-stamp/test-paging-buttons-stamp';
|
|
21
19
|
export * from './test-container/test-container';
|
|
22
|
-
export * from './test-print-item-variables/test-print-item-variables';
|
|
23
|
-
export * from './test-section-buttons-stamp/test-section-buttons-stamp';
|
|
24
20
|
export * from './test-section-link/test-section-link';
|
|
25
|
-
export * from './test-print-context/test-print-context';
|
|
26
|
-
export * from './test-stamp/test-stamp';
|
|
27
|
-
export * from './test-scoring-buttons/test-scoring-buttons';
|
|
28
|
-
export * from './test-view-toggle/test-view-toggle';
|
|
29
|
-
export * from './test-scoring-feedback/test-scoring-feedback';
|
|
30
|
-
export * from './test-check-item/test-check-item';
|
|
31
|
-
export * from './test-item-to-speech/test-item-to-speech';
|
package/dist/components/index.js
CHANGED
|
@@ -15,19 +15,8 @@ export * from '../components/qti-item-session-control/qti-item-session-control';
|
|
|
15
15
|
export * from './test-navigation/test-navigation';
|
|
16
16
|
export * from './test-next/test-next';
|
|
17
17
|
export * from './test-prev/test-prev';
|
|
18
|
-
export * from './test-view-toggle/test-view';
|
|
19
18
|
export * from './test-item-link/test-item-link';
|
|
20
19
|
export * from './test-end-attempt/test-end-attempt';
|
|
21
|
-
export * from './test-paging-buttons-stamp/test-paging-buttons-stamp';
|
|
22
20
|
export * from './test-container/test-container';
|
|
23
|
-
export * from './test-print-item-variables/test-print-item-variables';
|
|
24
|
-
export * from './test-section-buttons-stamp/test-section-buttons-stamp';
|
|
25
21
|
export * from './test-section-link/test-section-link';
|
|
26
|
-
export * from './test-print-context/test-print-context';
|
|
27
|
-
export * from './test-stamp/test-stamp';
|
|
28
|
-
export * from './test-scoring-buttons/test-scoring-buttons';
|
|
29
|
-
export * from './test-view-toggle/test-view-toggle';
|
|
30
|
-
export * from './test-scoring-feedback/test-scoring-feedback';
|
|
31
|
-
export * from './test-check-item/test-check-item';
|
|
32
|
-
export * from './test-item-to-speech/test-item-to-speech';
|
|
33
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,cAAc,iCAAiC,CAAC;AAChD,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;AAClE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,qDAAqD,CAAC;AACpE,cAAc,uDAAuD,CAAC;AACtE,cAAc,yDAAyD,CAAC;AACxE,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iEAAiE,CAAC;AAEhF,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,cAAc,iCAAiC,CAAC;AAChD,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;AAClE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,qDAAqD,CAAC;AACpE,cAAc,uDAAuD,CAAC;AACtE,cAAc,yDAAyD,CAAC;AACxE,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iEAAiE,CAAC;AAEhF,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC","sourcesContent":["/* test functionality webcomponents which are tested and can be used in your project */\nexport * from '../components/qti-test/qti-test';\nexport * from '../components/qti-assessment-item-ref/qti-assessment-item-ref';\nexport * from '../components/qti-assessment-section/qti-assessment-section';\nexport * from '../components/qti-assessment-test/qti-assessment-test';\nexport * from '../components/qti-test-part/qti-test-part';\nexport * from '../components/qti-test-feedback/qti-test-feedback';\nexport * from '../components/qti-outcome-processing/qti-outcome-processing';\nexport * from '../components/qti-test-variables/qti-test-variables';\nexport * from '../components/qti-number-selected/qti-number-selected';\nexport * from '../components/qti-number-presented/qti-number-presented';\nexport * from '../components/qti-pre-condition/qti-pre-condition';\nexport * from '../components/qti-branch-rule/qti-branch-rule';\nexport * from '../components/qti-item-session-control/qti-item-session-control';\n\nexport * from './test-navigation/test-navigation';\nexport * from './test-next/test-next';\nexport * from './test-prev/test-prev';\nexport * from './test-item-link/test-item-link';\nexport * from './test-end-attempt/test-end-attempt';\nexport * from './test-container/test-container';\nexport * from './test-section-link/test-section-link';\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { ComputedContext } from '@qti-components/base';
|
|
3
|
+
declare module '../../types/qti-test-state' {
|
|
4
|
+
interface QtiTestPluginState {
|
|
5
|
+
/** Item-ref identifiers the candidate marked to come back to, in the order they were marked. */
|
|
6
|
+
bookmarks: string[];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** The item-ref identifiers bookmarked so far. For a host's own navigation: mark these. */
|
|
10
|
+
export declare const bookmarkedItems: (context: Pick<ComputedContext, "plugins"> | undefined) => string[];
|
|
11
|
+
/**
|
|
12
|
+
* A toggle that marks the item on screen to come back to. The marks live in the test's state under
|
|
13
|
+
* `bookmarks` (`session.plugins.bookmarks`), so a host that stores `state` stores them, and a
|
|
14
|
+
* reloaded test shows them again.
|
|
15
|
+
*
|
|
16
|
+
* Put it inside `<test-navigation>`, either in the toolbar, where it marks the item on screen, or in
|
|
17
|
+
* the `<template item-ref>`, where each item gets its own and it marks that item. It is a button
|
|
18
|
+
* (`role="button"`, `aria-pressed`) and reflects `bookmarked` on the host for styling; its content is
|
|
19
|
+
* the label. In the toolbar it is `disabled` while no item is on screen. A host's own navigation reads
|
|
20
|
+
* the marks with `bookmarkedItems(computedContext)`.
|
|
21
|
+
*
|
|
22
|
+
* Give it an `item` (an item-ref identifier) to mark that item instead, wherever the button sits: in a
|
|
23
|
+
* stamp template that lists the items of a section, `<test-bookmark item="{{ item.identifier }}">`
|
|
24
|
+
* puts a button next to each one.
|
|
25
|
+
*
|
|
26
|
+
* @slot - The label.
|
|
27
|
+
* @attr item - The item-ref identifier this button marks; without it, the item it is stamped into, or else the one on screen.
|
|
28
|
+
* @attr bookmarked - Reflected: the item on screen is bookmarked.
|
|
29
|
+
* @attr disabled - Reflected: there is no item on screen.
|
|
30
|
+
*/
|
|
31
|
+
export declare class TestBookmark extends LitElement {
|
|
32
|
+
#private;
|
|
33
|
+
protected computedContext?: ComputedContext;
|
|
34
|
+
item?: string;
|
|
35
|
+
bookmarked: boolean;
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
static styles: import("lit").CSSResult;
|
|
38
|
+
constructor();
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
protected willUpdate(): void;
|
|
41
|
+
protected updated(): void;
|
|
42
|
+
render(): import("lit").TemplateResult<1>;
|
|
43
|
+
}
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
'test-bookmark': TestBookmark;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { consume } from '@lit/context';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { computedContext } from '@qti-components/base';
|
|
11
|
+
import * as styles from '../styles';
|
|
12
|
+
import { dispatchPublic } from '../../public-events';
|
|
13
|
+
import { pluginState } from '../../plugin-state';
|
|
14
|
+
/** The item-ref identifiers bookmarked so far. For a host's own navigation: mark these. */
|
|
15
|
+
export const bookmarkedItems = (context) => pluginState(context, 'bookmarks') ?? [];
|
|
16
|
+
/** The identifier of the item-ref an element is stamped into (`<template item-ref>`), looking out through shadow roots. */
|
|
17
|
+
const itemRefOf = (element) => {
|
|
18
|
+
const itemRef = element.closest('qti-assessment-item-ref');
|
|
19
|
+
if (itemRef)
|
|
20
|
+
return itemRef.getAttribute('identifier') ?? undefined;
|
|
21
|
+
const root = element.getRootNode();
|
|
22
|
+
return root instanceof ShadowRoot ? itemRefOf(root.host) : undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A toggle that marks the item on screen to come back to. The marks live in the test's state under
|
|
26
|
+
* `bookmarks` (`session.plugins.bookmarks`), so a host that stores `state` stores them, and a
|
|
27
|
+
* reloaded test shows them again.
|
|
28
|
+
*
|
|
29
|
+
* Put it inside `<test-navigation>`, either in the toolbar, where it marks the item on screen, or in
|
|
30
|
+
* the `<template item-ref>`, where each item gets its own and it marks that item. It is a button
|
|
31
|
+
* (`role="button"`, `aria-pressed`) and reflects `bookmarked` on the host for styling; its content is
|
|
32
|
+
* the label. In the toolbar it is `disabled` while no item is on screen. A host's own navigation reads
|
|
33
|
+
* the marks with `bookmarkedItems(computedContext)`.
|
|
34
|
+
*
|
|
35
|
+
* Give it an `item` (an item-ref identifier) to mark that item instead, wherever the button sits: in a
|
|
36
|
+
* stamp template that lists the items of a section, `<test-bookmark item="{{ item.identifier }}">`
|
|
37
|
+
* puts a button next to each one.
|
|
38
|
+
*
|
|
39
|
+
* @slot - The label.
|
|
40
|
+
* @attr item - The item-ref identifier this button marks; without it, the item it is stamped into, or else the one on screen.
|
|
41
|
+
* @attr bookmarked - Reflected: the item on screen is bookmarked.
|
|
42
|
+
* @attr disabled - Reflected: there is no item on screen.
|
|
43
|
+
*/
|
|
44
|
+
export class TestBookmark extends LitElement {
|
|
45
|
+
static { this.styles = css `
|
|
46
|
+
:host {
|
|
47
|
+
${styles.btn};
|
|
48
|
+
}
|
|
49
|
+
:host(:hover:not([disabled])) {
|
|
50
|
+
${styles.btnInteractive};
|
|
51
|
+
}
|
|
52
|
+
:host {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 0.4em;
|
|
56
|
+
}
|
|
57
|
+
svg {
|
|
58
|
+
width: 1.1em;
|
|
59
|
+
height: 1.1em;
|
|
60
|
+
flex: none;
|
|
61
|
+
fill: none;
|
|
62
|
+
stroke: currentColor;
|
|
63
|
+
stroke-width: 2;
|
|
64
|
+
stroke-linejoin: round;
|
|
65
|
+
}
|
|
66
|
+
:host([bookmarked]) {
|
|
67
|
+
color: var(--qti-bookmark-color, #b45309);
|
|
68
|
+
}
|
|
69
|
+
:host([bookmarked]) svg {
|
|
70
|
+
fill: currentColor;
|
|
71
|
+
}
|
|
72
|
+
:host(:focus-visible) {
|
|
73
|
+
${styles.focusRing};
|
|
74
|
+
}
|
|
75
|
+
:host([disabled]) {
|
|
76
|
+
${styles.dis};
|
|
77
|
+
}
|
|
78
|
+
`; }
|
|
79
|
+
constructor() {
|
|
80
|
+
super();
|
|
81
|
+
this.bookmarked = false;
|
|
82
|
+
this.disabled = false;
|
|
83
|
+
this.addEventListener('click', () => this.#toggle());
|
|
84
|
+
this.addEventListener('keydown', event => {
|
|
85
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
86
|
+
return;
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
this.#toggle();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
connectedCallback() {
|
|
92
|
+
super.connectedCallback();
|
|
93
|
+
if (!this.hasAttribute('role'))
|
|
94
|
+
this.setAttribute('role', 'button');
|
|
95
|
+
if (!this.hasAttribute('tabindex'))
|
|
96
|
+
this.setAttribute('tabindex', '0');
|
|
97
|
+
}
|
|
98
|
+
/** The item this button marks: its own, or else the one on screen. */
|
|
99
|
+
get #activeItem() {
|
|
100
|
+
return (this.item ||
|
|
101
|
+
(itemRefOf(this) ??
|
|
102
|
+
this.computedContext?.testParts
|
|
103
|
+
?.flatMap(part => part.sections.flatMap(section => section.items))
|
|
104
|
+
.find(item => item.active)?.identifier));
|
|
105
|
+
}
|
|
106
|
+
willUpdate() {
|
|
107
|
+
const active = this.#activeItem;
|
|
108
|
+
this.disabled = !active;
|
|
109
|
+
this.bookmarked = !!active && bookmarkedItems(this.computedContext).includes(active);
|
|
110
|
+
}
|
|
111
|
+
updated() {
|
|
112
|
+
this.setAttribute('aria-pressed', String(this.bookmarked));
|
|
113
|
+
this.setAttribute('aria-disabled', String(this.disabled));
|
|
114
|
+
}
|
|
115
|
+
#toggle() {
|
|
116
|
+
const active = this.#activeItem;
|
|
117
|
+
if (!active)
|
|
118
|
+
return;
|
|
119
|
+
const marked = bookmarkedItems(this.computedContext);
|
|
120
|
+
const next = marked.includes(active) ? marked.filter(id => id !== active) : [...marked, active];
|
|
121
|
+
// An empty list removes the entry, so a test nobody bookmarked keeps no trace in the state.
|
|
122
|
+
dispatchPublic(this, 'cito-test-update-plugin-state', {
|
|
123
|
+
plugin: 'bookmarks',
|
|
124
|
+
value: next.length > 0 ? next : null
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
render() {
|
|
128
|
+
return html `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h12v18l-6-4.5L6 21z" /></svg><slot></slot>`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
__decorate([
|
|
132
|
+
consume({ context: computedContext, subscribe: true }),
|
|
133
|
+
property({ attribute: false })
|
|
134
|
+
], TestBookmark.prototype, "computedContext", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
property({ reflect: true })
|
|
137
|
+
], TestBookmark.prototype, "item", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
property({ type: Boolean, reflect: true })
|
|
140
|
+
], TestBookmark.prototype, "bookmarked", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
property({ type: Boolean, reflect: true })
|
|
143
|
+
], TestBookmark.prototype, "disabled", void 0);
|
|
144
|
+
//# sourceMappingURL=test-bookmark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-bookmark.js","sourceRoot":"","sources":["../../../src/components/test-bookmark/test-bookmark.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAA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\nimport { property } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\nimport { dispatchPublic } from '../../public-events';\nimport { pluginState } from '../../plugin-state';\n\nimport type { ComputedContext } from '@qti-components/base';\n\ndeclare module '../../types/qti-test-state' {\n interface QtiTestPluginState {\n /** Item-ref identifiers the candidate marked to come back to, in the order they were marked. */\n bookmarks: string[];\n }\n}\n\n/** The item-ref identifiers bookmarked so far. For a host's own navigation: mark these. */\nexport const bookmarkedItems = (context: Pick<ComputedContext, 'plugins'> | undefined): string[] =>\n pluginState(context, 'bookmarks') ?? [];\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 toggle that marks the item on screen to come back to. The marks live in the test's state under\n * `bookmarks` (`session.plugins.bookmarks`), so a host that stores `state` stores them, and a\n * reloaded test shows them again.\n *\n * Put it inside `<test-navigation>`, either in the toolbar, where it marks the item on screen, or in\n * the `<template item-ref>`, where each item gets its own and it marks that item. It is a button\n * (`role=\"button\"`, `aria-pressed`) and reflects `bookmarked` on the host for styling; its content is\n * the label. In the toolbar it is `disabled` while no item is on screen. A host's own navigation reads\n * the marks with `bookmarkedItems(computedContext)`.\n *\n * Give it an `item` (an item-ref identifier) to mark that item instead, wherever the button sits: in a\n * stamp template that lists the items of a section, `<test-bookmark item=\"{{ item.identifier }}\">`\n * puts a button next to each one.\n *\n * @slot - The label.\n * @attr item - The item-ref identifier this button marks; without it, the item it is stamped into, or else the one on screen.\n * @attr bookmarked - Reflected: the item on screen is bookmarked.\n * @attr disabled - Reflected: there is no item on screen.\n */\nexport class TestBookmark extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n @property({ attribute: false })\n protected computedContext?: ComputedContext;\n\n @property({ reflect: true }) item?: string;\n\n @property({ type: Boolean, reflect: true }) bookmarked = false;\n\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n static override styles = css`\n :host {\n ${styles.btn};\n }\n :host(:hover:not([disabled])) {\n ${styles.btnInteractive};\n }\n :host {\n display: inline-flex;\n align-items: center;\n gap: 0.4em;\n }\n svg {\n width: 1.1em;\n height: 1.1em;\n flex: none;\n fill: none;\n stroke: currentColor;\n stroke-width: 2;\n stroke-linejoin: round;\n }\n :host([bookmarked]) {\n color: var(--qti-bookmark-color, #b45309);\n }\n :host([bookmarked]) svg {\n fill: currentColor;\n }\n :host(:focus-visible) {\n ${styles.focusRing};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n constructor() {\n super();\n this.addEventListener('click', () => this.#toggle());\n this.addEventListener('keydown', event => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n this.#toggle();\n });\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute('role')) this.setAttribute('role', 'button');\n if (!this.hasAttribute('tabindex')) this.setAttribute('tabindex', '0');\n }\n\n /** The item this button marks: its own, or else the one on screen. */\n get #activeItem(): string | undefined {\n return (\n this.item ||\n (itemRefOf(this) ??\n this.computedContext?.testParts\n ?.flatMap(part => part.sections.flatMap(section => section.items))\n .find(item => item.active)?.identifier)\n );\n }\n\n protected override willUpdate(): void {\n const active = this.#activeItem;\n this.disabled = !active;\n this.bookmarked = !!active && bookmarkedItems(this.computedContext).includes(active);\n }\n\n protected override updated(): void {\n this.setAttribute('aria-pressed', String(this.bookmarked));\n this.setAttribute('aria-disabled', String(this.disabled));\n }\n\n #toggle(): void {\n const active = this.#activeItem;\n if (!active) return;\n const marked = bookmarkedItems(this.computedContext);\n const next = marked.includes(active) ? marked.filter(id => id !== active) : [...marked, active];\n // An empty list removes the entry, so a test nobody bookmarked keeps no trace in the state.\n dispatchPublic(this, 'cito-test-update-plugin-state', {\n plugin: 'bookmarks',\n value: next.length > 0 ? next : null\n });\n }\n\n override render() {\n return html`<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M6 3h12v18l-6-4.5L6 21z\" /></svg><slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-bookmark': TestBookmark;\n }\n}\n"]}
|
|
@@ -93,6 +93,8 @@ export class TestNavigation extends LitElement {
|
|
|
93
93
|
* doesn't flip `done` until the candidate ends the attempt.
|
|
94
94
|
*/
|
|
95
95
|
this.#optimality = new Map();
|
|
96
|
+
/** `computedContext.itemElement`: one function for the life of this element, carried along by every update. */
|
|
97
|
+
this.#itemElement = (identifier) => this.#assessmentItemFor(identifier) ?? null;
|
|
96
98
|
listenPublic(this, 'cito-test-loaded', this.#handleTestConnected.bind(this));
|
|
97
99
|
this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));
|
|
98
100
|
listenItemPublic(this, 'cito-item-response-changed', this.#handleInteractionChanged.bind(this));
|
|
@@ -138,9 +140,11 @@ export class TestNavigation extends LitElement {
|
|
|
138
140
|
#assessmentItemFor(identifier) {
|
|
139
141
|
if (!identifier)
|
|
140
142
|
return undefined;
|
|
141
|
-
const itemRef = this.#testElement?.querySelector(`qti-assessment-item-ref[identifier="${identifier}"]`);
|
|
143
|
+
const itemRef = this.#testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(identifier)}"]`);
|
|
142
144
|
return itemRef?.assessmentItem ?? undefined;
|
|
143
145
|
}
|
|
146
|
+
/** `computedContext.itemElement`: one function for the life of this element, carried along by every update. */
|
|
147
|
+
#itemElement;
|
|
144
148
|
/** The currently active assessment item, exposed for optional presentation extensions. */
|
|
145
149
|
get activeAssessmentItem() {
|
|
146
150
|
if (!this.#testElement || !this._sessionContext?.navItemRefId)
|
|
@@ -183,7 +187,6 @@ export class TestNavigation extends LitElement {
|
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
189
|
render() {
|
|
186
|
-
// return this.myTemplate ? this.myTemplate(this.stampContext) : nothing;
|
|
187
190
|
return html `<slot></slot>`;
|
|
188
191
|
}
|
|
189
192
|
/* PK: on test connected we can build the computed context */
|
|
@@ -222,9 +225,11 @@ export class TestNavigation extends LitElement {
|
|
|
222
225
|
});
|
|
223
226
|
const testPartElements = Array.from(this.#testElement?.querySelectorAll(`qti-test-part`) || []);
|
|
224
227
|
this.computedContext = {
|
|
228
|
+
itemElement: this.#itemElement,
|
|
225
229
|
identifier: this.#testElement.identifier,
|
|
226
230
|
title: this.#testElement.title,
|
|
227
231
|
view: this._sessionContext?.view,
|
|
232
|
+
plugins: this._sessionContext?.plugins ?? {},
|
|
228
233
|
testParts: testPartElements.map(testPart => {
|
|
229
234
|
const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
|
|
230
235
|
const testPartSessionControl = testPart.querySelector(':scope > qti-item-session-control');
|
|
@@ -372,6 +377,7 @@ export class TestNavigation extends LitElement {
|
|
|
372
377
|
this.computedContext = {
|
|
373
378
|
...this.computedContext,
|
|
374
379
|
view: this._sessionContext?.view,
|
|
380
|
+
plugins: this._sessionContext?.plugins ?? {},
|
|
375
381
|
testParts: this.computedContext.testParts.map(testPart => {
|
|
376
382
|
return {
|
|
377
383
|
...testPart,
|
|
@@ -1 +1 @@
|
|
|
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;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C,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,EAAE,KAAK,CAAC;QACrE,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACzE,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9C,CAAC;CACF;AAxoB6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA4C;AAGhE;IADN,KAAK,EAAE;mDAC8D;AAuD/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;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 { 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';\nimport { listenPublic as listenItemPublic } from '@qti-components/elements/public-events';\n\nimport { testHostContext } from '../../internal/test-host.context';\nimport { listenPublic } from '../../public-events';\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\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 listenPublic(this, 'cito-test-loaded', this.#handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));\n\n listenItemPublic(this, 'cito-item-response-changed', this.#handleInteractionChanged.bind(this));\n this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n listenPublic(this, 'cito-test-end-attempt', this.#handleTestEndAttempt.bind(this));\n listenPublic(this, 'cito-test-update-outcome', 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 const completionStatus = itemContext.variables?.find(v => v.identifier === 'completionStatus')?.value as string;\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts, computedItem?.adaptive, completionStatus)\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(\n numAttempts,\n optimality,\n computedItem.maxAttempts,\n computedItem.adaptive,\n completionStatus\n );\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 * Adaptive items decide this themselves: max-attempts does not apply to them\n * (QTI 3, itemSessionControl), and a wrong attempt may be the step that leads\n * on to the next part of the item. They are done once their response\n * processing sets completionStatus to 'completed'.\n */\n #isItemDone(\n numAttempts: number,\n optimality: ItemOptimality,\n maxAttempts: number | undefined,\n adaptive?: boolean,\n completionStatus?: string\n ): boolean {\n if (numAttempts === 0) return false;\n if (adaptive) return completionStatus === 'completed';\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,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,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 { 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';\nimport { listenPublic as listenItemPublic } from '@qti-components/elements/public-events';\n\nimport { testHostContext } from '../../internal/test-host.context';\nimport { listenPublic } from '../../public-events';\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\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 listenPublic(this, 'cito-test-loaded', this.#handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));\n\n listenItemPublic(this, 'cito-item-response-changed', this.#handleInteractionChanged.bind(this));\n this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n listenPublic(this, 'cito-test-end-attempt', this.#handleTestEndAttempt.bind(this));\n listenPublic(this, 'cito-test-update-outcome', 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 const completionStatus = itemContext.variables?.find(v => v.identifier === 'completionStatus')?.value as string;\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts, computedItem?.adaptive, completionStatus)\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=\"${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 * 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 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 itemElement: this.#itemElement,\n identifier: this.#testElement.identifier,\n title: this.#testElement.title,\n view: this._sessionContext?.view,\n plugins: this._sessionContext?.plugins ?? {},\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 plugins: this._sessionContext?.plugins ?? {},\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(\n numAttempts,\n optimality,\n computedItem.maxAttempts,\n computedItem.adaptive,\n completionStatus\n );\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 * Adaptive items decide this themselves: max-attempts does not apply to them\n * (QTI 3, itemSessionControl), and a wrong attempt may be the step that leads\n * on to the next part of the item. They are done once their response\n * processing sets completionStatus to 'completed'.\n */\n #isItemDone(\n numAttempts: number,\n optimality: ItemOptimality,\n maxAttempts: number | undefined,\n adaptive?: boolean,\n completionStatus?: string\n ): boolean {\n if (numAttempts === 0) return false;\n if (adaptive) return completionStatus === 'completed';\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"]}
|
|
@@ -55,8 +55,9 @@ export class TestStamp extends LitElement {
|
|
|
55
55
|
const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);
|
|
56
56
|
const activeSection = activeTestPart?.sections.find(section => section.active);
|
|
57
57
|
const activeItem = activeSection?.items.find(item => item.active);
|
|
58
|
+
// In `navigate="section"` the test shows a section, not one item, so there may be no active item.
|
|
58
59
|
const { variables, ...augmentedItem } = activeItem || {};
|
|
59
|
-
if (!activeTestPart
|
|
60
|
+
if (!activeTestPart) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
const augmentedTestPart = {
|
|
@@ -67,7 +68,10 @@ export class TestStamp extends LitElement {
|
|
|
67
68
|
items: section.items.map(({ variables, ...rest }) => rest)
|
|
68
69
|
}))
|
|
69
70
|
};
|
|
70
|
-
const augmentedSection = {
|
|
71
|
+
const augmentedSection = {
|
|
72
|
+
...activeSection,
|
|
73
|
+
items: (activeSection?.items ?? []).map(({ variables, ...rest }) => rest)
|
|
74
|
+
};
|
|
71
75
|
const { testParts, ...activeTest } = this.computedContext;
|
|
72
76
|
this.stampContext = {
|
|
73
77
|
view: this.computedContext.view,
|