@qti-components/elements 1.7.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.
- package/dist/components/qti-assessment-item/qti-assessment-item.d.ts +15 -2
- package/dist/components/qti-assessment-item/qti-assessment-item.js +102 -48
- package/dist/components/qti-assessment-item/qti-assessment-item.js.map +1 -1
- package/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.d.ts +29 -0
- package/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.js +30 -0
- package/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.js.map +1 -0
- package/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.styles.d.ts +2 -0
- package/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.styles.js +11 -0
- package/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.styles.js.map +1 -0
- package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js +5 -3
- package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js.map +1 -1
- package/dist/components/qti-custom-operator/qti-custom-operator.d.ts +26 -7
- package/dist/components/qti-custom-operator/qti-custom-operator.js +49 -8
- package/dist/components/qti-custom-operator/qti-custom-operator.js.map +1 -1
- package/dist/components/qti-outcome-declaration/qti-outcome-declaration.d.ts +15 -1
- package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js +46 -14
- package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js.map +1 -1
- package/dist/components/qti-response-processing/qti-response-processing.js +12 -2
- package/dist/components/qti-response-processing/qti-response-processing.js.map +1 -1
- package/dist/elements.d.ts +5 -1
- package/dist/elements.js +3 -1
- package/dist/elements.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import type { PropertyValues } from 'lit';
|
|
2
3
|
import type { ResponseInteraction } from '@qti-components/base';
|
|
3
4
|
import type { RegisteredInteraction } from '@qti-components/base';
|
|
4
5
|
import type { VariableDeclaration, VariableValue } from '@qti-components/base';
|
|
@@ -21,10 +22,17 @@ export declare class QtiAssessmentItem extends LitElement {
|
|
|
21
22
|
timeDependent: 'true' | 'false' | null;
|
|
22
23
|
get title(): string;
|
|
23
24
|
set title(value: string);
|
|
25
|
+
/**
|
|
26
|
+
* Locks the item, for example once it is submitted. Published in the item context, which the
|
|
27
|
+
* interactions inside follow, so the item keeps no list of them to set it on.
|
|
28
|
+
*/
|
|
24
29
|
disabled: boolean;
|
|
25
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Shows the item for reading only. Published in the item context, which the interactions inside
|
|
32
|
+
* follow, so the item keeps no list of them to set it on.
|
|
33
|
+
*/
|
|
26
34
|
readonly: boolean;
|
|
27
|
-
protected
|
|
35
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
28
36
|
private _context;
|
|
29
37
|
/**
|
|
30
38
|
* Sets the identifier for the assessment item reference if this item is in a test.
|
|
@@ -33,6 +41,11 @@ export declare class QtiAssessmentItem extends LitElement {
|
|
|
33
41
|
*/
|
|
34
42
|
set assessmentItemRefId(identifier: string);
|
|
35
43
|
get assessmentItemRefId(): string;
|
|
44
|
+
/**
|
|
45
|
+
* The item's whole context, declarations included, for reading. `variables` is the trimmed view
|
|
46
|
+
* for hosts; the test needs the declarations too, and used to reach for the private field.
|
|
47
|
+
*/
|
|
48
|
+
get itemContext(): Readonly<ItemContext>;
|
|
36
49
|
get variables(): VariableValue<string | string[] | null>[];
|
|
37
50
|
set variables(value: VariableValue<string | string[] | null>[]);
|
|
38
51
|
get state(): ItemContext['state'];
|
|
@@ -8,7 +8,6 @@ import { provide } from '@lit/context';
|
|
|
8
8
|
import { LitElement, html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { itemContext, itemContextVariables } from '@qti-components/base';
|
|
11
|
-
import { watch } from '@qti-components/utilities';
|
|
12
11
|
/**
|
|
13
12
|
* @summary The qti-assessment-item element contains all the other QTI 3 item structures.
|
|
14
13
|
* @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj
|
|
@@ -25,33 +24,36 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
25
24
|
this.#templateProcessing = null;
|
|
26
25
|
this.identifier = '';
|
|
27
26
|
this.adaptive = 'false';
|
|
27
|
+
/*
|
|
28
|
+
* `attribute` spelled out: Lit derives `timedependent` from the property
|
|
29
|
+
* name, while QTI writes `time-dependent`. Without it the attribute never
|
|
30
|
+
* reached the property, so an item declaring `time-dependent="true"` still
|
|
31
|
+
* reported false to `test-navigation`, which reads this to build the computed
|
|
32
|
+
* item context.
|
|
33
|
+
*/
|
|
28
34
|
this.timeDependent = null;
|
|
29
|
-
this._handleDisabledChange = (_, disabled) => {
|
|
30
|
-
this.interactionElements.forEach(ch => (ch.disabled = disabled));
|
|
31
|
-
};
|
|
32
|
-
this._handleReadonlyChange = (_, readonly) => this.interactionElements.forEach(ch => (ch.readonly = readonly));
|
|
33
35
|
this._context = {
|
|
34
36
|
variables: itemContextVariables
|
|
35
37
|
};
|
|
36
38
|
this.#initialContext = { ...this._context, variables: this._context.variables };
|
|
37
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Template values handed in through `variables` — drawn in an earlier visit or session. Template
|
|
41
|
+
* processing keeps them instead of drawing again, so the candidate sees the question they
|
|
42
|
+
* answered, and still runs, so correct responses are derived from them.
|
|
43
|
+
*/
|
|
44
|
+
this.#restoredTemplateValues = new Map();
|
|
45
|
+
this.#templatesProcessed = false;
|
|
38
46
|
/** Registered candidate-input interactions. Correction packages may extend their presentation behavior. */
|
|
39
47
|
this.interactionElements = [];
|
|
40
48
|
this.#handleRegisterVariable = (e) => {
|
|
41
49
|
e.stopImmediatePropagation();
|
|
42
|
-
|
|
50
|
+
const { variable } = e.detail;
|
|
51
|
+
const restored = variable.type === 'template' ? this.#restoredTemplateValues.get(variable.identifier) : undefined;
|
|
52
|
+
const registered = restored !== undefined ? { ...variable, value: restored } : variable;
|
|
53
|
+
this._context = { ...this._context, variables: [...this._context.variables, registered] };
|
|
43
54
|
this.#initialContext = this._context;
|
|
44
55
|
e.stopPropagation();
|
|
45
56
|
};
|
|
46
|
-
this.#handleRegisterFeedback = (e) => {
|
|
47
|
-
e.stopImmediatePropagation();
|
|
48
|
-
const feedbackElement = e.detail;
|
|
49
|
-
this.#feedbackElements.push(feedbackElement);
|
|
50
|
-
const numAttempts = Number(this._context.variables.find(v => v.identifier === 'numAttempts')?.value) || 0;
|
|
51
|
-
if (numAttempts > 0) {
|
|
52
|
-
feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
57
|
this.#handleRegisterInteraction = (e) => {
|
|
56
58
|
e.stopImmediatePropagation();
|
|
57
59
|
this.interactionElements.push(e.detail.interactionElement);
|
|
@@ -72,7 +74,9 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
72
74
|
this.#handleSetTemplateValue = (e) => {
|
|
73
75
|
e.stopImmediatePropagation();
|
|
74
76
|
const { templateIdentifier, value } = e.detail;
|
|
75
|
-
this.
|
|
77
|
+
if (!this.#restoredTemplateValues.has(templateIdentifier)) {
|
|
78
|
+
this.updateTemplateVariable(templateIdentifier, value ?? undefined);
|
|
79
|
+
}
|
|
76
80
|
e.stopPropagation();
|
|
77
81
|
};
|
|
78
82
|
this.#handleSetCorrectResponse = (e) => {
|
|
@@ -94,6 +98,8 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
94
98
|
}
|
|
95
99
|
};
|
|
96
100
|
}
|
|
101
|
+
// The interaction has updated its own validity by now; publish the verdict with the answer.
|
|
102
|
+
this.validate(false);
|
|
97
103
|
this.dispatchEvent(new CustomEvent('qti-item-context-updated', {
|
|
98
104
|
bubbles: true,
|
|
99
105
|
composed: true,
|
|
@@ -111,6 +117,18 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
111
117
|
this.removeAttribute('title');
|
|
112
118
|
this.setAttribute('data-title', value);
|
|
113
119
|
}
|
|
120
|
+
willUpdate(changed) {
|
|
121
|
+
super.willUpdate(changed);
|
|
122
|
+
const readonlyChanged = changed.has('readonly') && (this.readonly ?? false) !== (this._context.readonly ?? false);
|
|
123
|
+
const disabledChanged = changed.has('disabled') && (this.disabled ?? false) !== (this._context.disabled ?? false);
|
|
124
|
+
if (readonlyChanged || disabledChanged) {
|
|
125
|
+
this._context = {
|
|
126
|
+
...this._context,
|
|
127
|
+
...(readonlyChanged ? { readonly: !!this.readonly } : {}),
|
|
128
|
+
...(disabledChanged ? { disabled: !!this.disabled } : {})
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
114
132
|
/**
|
|
115
133
|
* Sets the identifier for the assessment item reference if this item is in a test.
|
|
116
134
|
*
|
|
@@ -122,6 +140,13 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
122
140
|
get assessmentItemRefId() {
|
|
123
141
|
return this._context.identifier;
|
|
124
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* The item's whole context, declarations included, for reading. `variables` is the trimmed view
|
|
145
|
+
* for hosts; the test needs the declarations too, and used to reach for the private field.
|
|
146
|
+
*/
|
|
147
|
+
get itemContext() {
|
|
148
|
+
return this._context;
|
|
149
|
+
}
|
|
125
150
|
get variables() {
|
|
126
151
|
return this._context.variables.map(v => ({
|
|
127
152
|
identifier: v.identifier,
|
|
@@ -138,6 +163,16 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
138
163
|
console.warn('variables property should be an array of VariableDeclaration');
|
|
139
164
|
return;
|
|
140
165
|
}
|
|
166
|
+
const previous = this._context.variables;
|
|
167
|
+
// Recognised by their declaration, or by their own type: a template declaration registers after
|
|
168
|
+
// its first render, so a test restoring on connect can get here before it has.
|
|
169
|
+
const restoredTemplates = value.filter(v => v.value !== null &&
|
|
170
|
+
v.value !== undefined &&
|
|
171
|
+
(v.type === 'template' ||
|
|
172
|
+
previous.some(declared => declared.identifier === v.identifier && declared.type === 'template')));
|
|
173
|
+
restoredTemplates.forEach(v => this.#restoredTemplateValues.set(v.identifier, v.value));
|
|
174
|
+
const templatesChanged = restoredTemplates.some(v => JSON.stringify(previous.find(declared => declared.identifier === v.identifier)?.value) !==
|
|
175
|
+
JSON.stringify(v.value));
|
|
141
176
|
this._context = {
|
|
142
177
|
...this._context,
|
|
143
178
|
variables: this._context.variables.map(variable => {
|
|
@@ -146,25 +181,20 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
146
181
|
return {
|
|
147
182
|
...variable,
|
|
148
183
|
...matchingValue,
|
|
149
|
-
interpolationTable: variable.interpolationTable
|
|
184
|
+
interpolationTable: variable.interpolationTable,
|
|
185
|
+
matchTable: variable.matchTable
|
|
150
186
|
};
|
|
151
187
|
}
|
|
152
188
|
return variable;
|
|
153
189
|
})
|
|
154
190
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
});
|
|
163
|
-
this.variables.forEach(variable => {
|
|
164
|
-
if (variable.type === 'outcome') {
|
|
165
|
-
this.#feedbackElements.forEach(fe => fe.checkShowFeedback(variable.identifier));
|
|
166
|
-
}
|
|
167
|
-
});
|
|
191
|
+
// Restored after the first processing run: correct responses still follow the values it drew.
|
|
192
|
+
if (this.#templatesProcessed && templatesChanged) {
|
|
193
|
+
this.#runTemplateProcessing();
|
|
194
|
+
}
|
|
195
|
+
// The interactions take the answers over from the context, some of them a moment from now, and
|
|
196
|
+
// a different answer can mean a different verdict. Look once they have.
|
|
197
|
+
void this.updateComplete.then(() => this.#revalidate());
|
|
168
198
|
}
|
|
169
199
|
get state() {
|
|
170
200
|
return this._context.state;
|
|
@@ -176,7 +206,13 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
176
206
|
};
|
|
177
207
|
}
|
|
178
208
|
#initialContext;
|
|
179
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Template values handed in through `variables` — drawn in an earlier visit or session. Template
|
|
211
|
+
* processing keeps them instead of drawing again, so the candidate sees the question they
|
|
212
|
+
* answered, and still runs, so correct responses are derived from them.
|
|
213
|
+
*/
|
|
214
|
+
#restoredTemplateValues;
|
|
215
|
+
#templatesProcessed;
|
|
180
216
|
/** @deprecated use variables property instead */
|
|
181
217
|
set responses(myResponses) {
|
|
182
218
|
if (myResponses) {
|
|
@@ -199,6 +235,8 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
199
235
|
this.#attachEventListeners();
|
|
200
236
|
super.connectedCallback();
|
|
201
237
|
this.updateComplete.then(() => {
|
|
238
|
+
// The verdict goes in first, so whoever hears the item connect reads it with the rest.
|
|
239
|
+
this.validate(false);
|
|
202
240
|
this.dispatchEvent(new CustomEvent('qti-assessment-item-connected', {
|
|
203
241
|
bubbles: true,
|
|
204
242
|
composed: true,
|
|
@@ -213,7 +251,6 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
213
251
|
}
|
|
214
252
|
#attachEventListeners() {
|
|
215
253
|
this.addEventListener('qti-register-variable', this.#handleRegisterVariable);
|
|
216
|
-
this.addEventListener('qti-register-feedback', this.#handleRegisterFeedback);
|
|
217
254
|
this.addEventListener('qti-register-interaction', this.#handleRegisterInteraction);
|
|
218
255
|
this.addEventListener('end-attempt', this.#handleEndAttempt);
|
|
219
256
|
this.addEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);
|
|
@@ -223,7 +260,6 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
223
260
|
}
|
|
224
261
|
#removeEventListeners() {
|
|
225
262
|
this.removeEventListener('qti-register-variable', this.#handleRegisterVariable);
|
|
226
|
-
this.removeEventListener('qti-register-feedback', this.#handleRegisterFeedback);
|
|
227
263
|
this.removeEventListener('qti-register-interaction', this.#handleRegisterInteraction);
|
|
228
264
|
this.removeEventListener('end-attempt', this.#handleEndAttempt);
|
|
229
265
|
this.removeEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);
|
|
@@ -232,7 +268,6 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
232
268
|
this.removeEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);
|
|
233
269
|
}
|
|
234
270
|
#handleRegisterVariable;
|
|
235
|
-
#handleRegisterFeedback;
|
|
236
271
|
#handleRegisterInteraction;
|
|
237
272
|
#handleEndAttempt;
|
|
238
273
|
#handleSetOutcomeValue;
|
|
@@ -246,11 +281,15 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
246
281
|
await Promise.resolve();
|
|
247
282
|
}
|
|
248
283
|
this.#templateProcessing = this.querySelector('qti-template-processing');
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
284
|
+
this.#templatesProcessed = true;
|
|
285
|
+
// Run template processing before first presentation
|
|
286
|
+
this.#runTemplateProcessing();
|
|
287
|
+
}
|
|
288
|
+
#runTemplateProcessing() {
|
|
289
|
+
if (!this.#templateProcessing)
|
|
290
|
+
return;
|
|
291
|
+
this.#templateProcessing.process();
|
|
292
|
+
this.#initialContext = { ...this._context, variables: this._context.variables };
|
|
254
293
|
}
|
|
255
294
|
processResponse(countNumAttempts = true, reportValidityAfterScoring = true) {
|
|
256
295
|
this.validate(reportValidityAfterScoring);
|
|
@@ -428,7 +467,6 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
428
467
|
};
|
|
429
468
|
})
|
|
430
469
|
};
|
|
431
|
-
this.#feedbackElements.forEach(fe => fe.checkShowFeedback(identifier));
|
|
432
470
|
this.dispatchEvent(new CustomEvent('qti-outcome-changed', {
|
|
433
471
|
bubbles: true,
|
|
434
472
|
composed: true,
|
|
@@ -441,11 +479,33 @@ export class QtiAssessmentItem extends LitElement {
|
|
|
441
479
|
}
|
|
442
480
|
validate(reportValidity = true) {
|
|
443
481
|
const isValid = this.interactionElements.every(interactionElement => interactionElement.validate());
|
|
482
|
+
this.#publishValidity(isValid);
|
|
444
483
|
if (reportValidity) {
|
|
445
484
|
this.reportValidity();
|
|
446
485
|
}
|
|
447
486
|
return isValid;
|
|
448
487
|
}
|
|
488
|
+
/** Puts the verdict in the item context, where the test and anything else can read it. */
|
|
489
|
+
#publishValidity(valid) {
|
|
490
|
+
if (this._context.valid !== valid) {
|
|
491
|
+
this._context = { ...this._context, valid };
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Checks again after something the interactions' validity depends on changed without them saying
|
|
496
|
+
* so (an answer handed in through `variables`), and tells the test if the verdict moved.
|
|
497
|
+
*/
|
|
498
|
+
#revalidate() {
|
|
499
|
+
const before = this._context.valid;
|
|
500
|
+
this.validate(false);
|
|
501
|
+
if (this._context.valid !== before) {
|
|
502
|
+
this.dispatchEvent(new CustomEvent('qti-item-context-updated', {
|
|
503
|
+
bubbles: true,
|
|
504
|
+
composed: true,
|
|
505
|
+
detail: { itemContext: this._context }
|
|
506
|
+
}));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
449
509
|
reportValidity() {
|
|
450
510
|
for (const interactionElement of this.interactionElements) {
|
|
451
511
|
interactionElement.reportValidity();
|
|
@@ -488,7 +548,7 @@ __decorate([
|
|
|
488
548
|
property({ type: String })
|
|
489
549
|
], QtiAssessmentItem.prototype, "adaptive", void 0);
|
|
490
550
|
__decorate([
|
|
491
|
-
property({ type: String })
|
|
551
|
+
property({ type: String, attribute: 'time-dependent' })
|
|
492
552
|
], QtiAssessmentItem.prototype, "timeDependent", void 0);
|
|
493
553
|
__decorate([
|
|
494
554
|
property({ type: String })
|
|
@@ -496,15 +556,9 @@ __decorate([
|
|
|
496
556
|
__decorate([
|
|
497
557
|
property({ type: Boolean })
|
|
498
558
|
], QtiAssessmentItem.prototype, "disabled", void 0);
|
|
499
|
-
__decorate([
|
|
500
|
-
watch('disabled', { waitUntilFirstUpdate: true })
|
|
501
|
-
], QtiAssessmentItem.prototype, "_handleDisabledChange", void 0);
|
|
502
559
|
__decorate([
|
|
503
560
|
property({ type: Boolean })
|
|
504
561
|
], QtiAssessmentItem.prototype, "readonly", void 0);
|
|
505
|
-
__decorate([
|
|
506
|
-
watch('readonly', { waitUntilFirstUpdate: true })
|
|
507
|
-
], QtiAssessmentItem.prototype, "_handleReadonlyChange", void 0);
|
|
508
562
|
__decorate([
|
|
509
563
|
provide({ context: itemContext })
|
|
510
564
|
], QtiAssessmentItem.prototype, "_context", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-assessment-item.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-item/qti-assessment-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAYlD;;;;;;;;;GASG;AAEH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAAjD;;QAEE,wBAAmB,GAAiC,IAAI,CAAC;QAE7B,eAAU,GAAW,EAAE,CAAC;QACxB,aAAQ,GAAqB,OAAO,CAAC;QACrC,kBAAa,GAA4B,IAAI,CAAC;QAchE,0BAAqB,GAAG,CAAC,CAAU,EAAE,QAAiB,EAAE,EAAE;YAClE,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC;QAIQ,0BAAqB,GAAG,CAAC,CAAU,EAAE,QAAiB,EAAE,EAAE,CAClE,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;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KAAK,SAAS,CAAC;oBACvC,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,KAAK,OAAO,CAAC,EAClE,CAAC;oBACD,KAAK,GAAG,GAAG,CAAC;gBACd,CAAC;gBAED,OAAO;oBACL,GAAG,QAAQ;oBACX,KAAK;iBACN,CAAC;YACJ,CAAC,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AA1iB6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAsC;AACrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA+C;AAG1E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAG1B;AAO4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAmB;AAErC;IADT,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;gEAGhD;AAE2B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAmB;AAErC;IADT,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;gEAEiB;AAG3D;IADP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;mDAGhC","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { itemContext, itemContextVariables } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\n\nimport type { QtiTemplateProcessing } from '../qti-template-processing/qti-template-processing.js';\nimport type { InteractionChangedDetails, OutcomeChangedDetails } from '../../internal/event-types.ts';\nimport type { QtiFeedback, ResponseInteraction } from '@qti-components/base';\nimport type { RegisteredInteraction } from '@qti-components/base';\nimport type { VariableDeclaration, VariableValue } from '@qti-components/base';\nimport type { OutcomeVariable, ResponseVariable, TemplateVariable } from '@qti-components/base';\nimport type { QtiResponseProcessing } from '../qti-response-processing/qti-response-processing.ts';\nimport type QtiRegisterVariable from '../../internal/events/qti-register-variable.ts';\nimport type { ItemContext } from '@qti-components/base';\n\n/**\n * @summary The qti-assessment-item element contains all the other QTI 3 item structures.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj\n *\n * @dependency qti-feedback\n * @dependency qti-responseprocessing\n *\n * @event qti-item-context-updated - Emitted when through a user action the itemContext is updated,\n * typically on interaction with the interactions, or calling response processing.\n */\n\nexport class QtiAssessmentItem extends LitElement {\n #itemTitle: string | undefined;\n #templateProcessing: QtiTemplateProcessing | null = null;\n\n @property({ type: String }) identifier: string = '';\n @property({ type: String }) adaptive: 'true' | 'false' = 'false';\n @property({ type: String }) timeDependent: 'true' | 'false' | null = null;\n\n @property({ type: String })\n override get title(): string {\n return this.#itemTitle;\n }\n override set title(value: string) {\n this.#itemTitle = value;\n this.removeAttribute('title');\n this.setAttribute('data-title', value);\n }\n\n @property({ type: Boolean }) disabled: boolean;\n @watch('disabled', { waitUntilFirstUpdate: true })\n protected _handleDisabledChange = (_: boolean, disabled: boolean) => {\n this.interactionElements.forEach(ch => (ch.disabled = disabled));\n };\n\n @property({ type: Boolean }) readonly: boolean;\n @watch('readonly', { waitUntilFirstUpdate: true })\n protected _handleReadonlyChange = (_: boolean, readonly: boolean) =>\n this.interactionElements.forEach(ch => (ch.readonly = readonly));\n\n @provide({ context: itemContext })\n private _context: ItemContext = {\n variables: itemContextVariables\n };\n\n /**\n * Sets the identifier for the assessment item reference if this item is in a test.\n *\n * @param identifier - The identifier for the assessment item reference.\n */\n public set assessmentItemRefId(identifier: string) {\n this._context = { ...this._context, identifier };\n }\n\n public get assessmentItemRefId(): string {\n return this._context.identifier;\n }\n\n public get variables(): VariableValue<string | string[] | null>[] {\n return this._context.variables.map(v => ({\n identifier: v.identifier,\n value: v.value,\n type: v.type,\n // add externalscored, a fixed prop to the test, so the testcontext can read and decide how to score this item\n ...(v.type === 'outcome' && v.identifier === 'SCORE'\n ? { externalScored: (v as OutcomeVariable).externalScored }\n : {})\n }));\n }\n\n public set variables(value: VariableValue<string | string[] | null>[]) {\n if (!Array.isArray(value) || value.some(v => !('identifier' in v))) {\n console.warn('variables property should be an array of VariableDeclaration');\n return;\n }\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n const matchingValue = value.find(v => v.identifier === variable.identifier);\n if (matchingValue) {\n return {\n ...variable,\n ...matchingValue,\n interpolationTable: (variable as OutcomeVariable).interpolationTable\n };\n }\n return variable;\n })\n };\n\n this._context.variables.forEach(variable => {\n if (variable.type === 'response') {\n const interactionElement = this.interactionElements.find(\n (el: RegisteredInteraction) => el.responseIdentifier === variable.identifier\n );\n if (interactionElement) {\n interactionElement.response = variable.value as string | string[];\n }\n }\n });\n\n this.variables.forEach(variable => {\n if (variable.type === 'outcome') {\n this.#feedbackElements.forEach(fe => fe.checkShowFeedback(variable.identifier));\n }\n });\n }\n\n public get state(): ItemContext['state'] {\n return this._context.state;\n }\n\n public set state(value: ItemContext['state']) {\n this._context = {\n ...this._context,\n state: value ? { ...value } : undefined\n };\n }\n\n #initialContext: Readonly<ItemContext> = { ...this._context, variables: this._context.variables };\n #feedbackElements: QtiFeedback[] = [];\n /** Registered candidate-input interactions. Correction packages may extend their presentation behavior. */\n protected interactionElements: RegisteredInteraction[] = [];\n\n /** @deprecated use variables property instead */\n set responses(myResponses: ResponseInteraction[]) {\n if (myResponses) {\n for (const response of myResponses) {\n const responseVariable = this.getResponse(response.responseIdentifier);\n if (responseVariable) {\n this.updateResponseVariable(response.responseIdentifier, response.response);\n }\n\n const interaction: RegisteredInteraction | undefined = this.interactionElements.find(\n i => i.getAttribute('response-identifier') === response.responseIdentifier\n );\n if (interaction) {\n interaction.response = response.response;\n }\n }\n }\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n override connectedCallback(): void {\n this.#attachEventListeners();\n super.connectedCallback();\n this.updateComplete.then(() => {\n this.dispatchEvent(\n new CustomEvent<QtiAssessmentItem>('qti-assessment-item-connected', {\n bubbles: true,\n composed: true,\n detail: this\n })\n );\n this.#processTemplates();\n });\n }\n\n override disconnectedCallback(): void {\n this.#removeEventListeners();\n super.disconnectedCallback();\n }\n\n #attachEventListeners() {\n this.addEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.addEventListener('qti-register-feedback', this.#handleRegisterFeedback);\n this.addEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.addEventListener('end-attempt', this.#handleEndAttempt);\n this.addEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.addEventListener('qti-set-template-value', this.#handleSetTemplateValue);\n this.addEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);\n this.addEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #removeEventListeners() {\n this.removeEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.removeEventListener('qti-register-feedback', this.#handleRegisterFeedback);\n this.removeEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.removeEventListener('end-attempt', this.#handleEndAttempt);\n this.removeEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.removeEventListener('qti-set-template-value', this.#handleSetTemplateValue);\n this.removeEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);\n this.removeEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #handleRegisterVariable = (e: QtiRegisterVariable) => {\n e.stopImmediatePropagation();\n this._context = { ...this._context, variables: [...this._context.variables, e.detail.variable] };\n this.#initialContext = this._context;\n e.stopPropagation();\n };\n\n #handleRegisterFeedback = (e: CustomEvent<QtiFeedback>) => {\n e.stopImmediatePropagation();\n const feedbackElement = e.detail;\n this.#feedbackElements.push(feedbackElement);\n const numAttempts = Number(this._context.variables.find(v => v.identifier === 'numAttempts')?.value) || 0;\n if (numAttempts > 0) {\n feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);\n }\n };\n\n #handleRegisterInteraction = (e: CustomEvent<{ interaction: string; interactionElement: RegisteredInteraction }>) => {\n e.stopImmediatePropagation();\n this.interactionElements.push(e.detail.interactionElement);\n };\n\n #handleEndAttempt = (e: CustomEvent<{ responseIdentifier: string; countAttempt: boolean }>) => {\n e.stopImmediatePropagation();\n const { responseIdentifier, countAttempt } = e.detail;\n this.validate();\n this.updateResponseVariable(responseIdentifier, 'true');\n this.processResponse(countAttempt);\n };\n\n #handleSetOutcomeValue = (e: CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>) => {\n e.stopImmediatePropagation();\n const { outcomeIdentifier, value } = e.detail;\n this.updateOutcomeVariable(outcomeIdentifier, value);\n e.stopPropagation();\n };\n\n #handleSetTemplateValue = (e: CustomEvent<{ templateIdentifier: string; value: string | string[] | null }>) => {\n e.stopImmediatePropagation();\n const { templateIdentifier, value } = e.detail;\n this.updateTemplateVariable(templateIdentifier, value ?? undefined);\n e.stopPropagation();\n };\n\n #handleSetCorrectResponse = (e: CustomEvent<{ responseIdentifier: string; value: string | string[] | null }>) => {\n e.stopImmediatePropagation();\n const { responseIdentifier, value } = e.detail;\n this.updateCorrectResponse(responseIdentifier, value ?? undefined);\n e.stopPropagation();\n };\n\n #handleUpdateResponseVariable = (e: CustomEvent<ResponseInteraction>) => {\n e.stopImmediatePropagation();\n\n const { responseIdentifier, response, state } = e.detail;\n this.updateResponseVariable(responseIdentifier, response);\n if (state !== undefined) {\n this._context = {\n ...this._context,\n state: {\n ...(this._context.state || {}),\n [responseIdentifier]: state\n }\n };\n }\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n };\n\n async #processTemplates(): Promise<void> {\n const templateDeclarations = Array.from(this.querySelectorAll<LitElement>('qti-template-declaration'));\n if (templateDeclarations.length > 0) {\n await Promise.all(templateDeclarations.map(declaration => declaration.updateComplete));\n await Promise.resolve();\n }\n\n this.#templateProcessing = this.querySelector<QtiTemplateProcessing>('qti-template-processing');\n if (this.#templateProcessing) {\n // Run template processing before first presentation\n this.#templateProcessing.process();\n this.#initialContext = { ...this._context, variables: this._context.variables };\n }\n }\n\n public processResponse(countNumAttempts = true, reportValidityAfterScoring = true): boolean {\n this.validate(reportValidityAfterScoring);\n\n if (countNumAttempts) {\n this.updateOutcomeVariable(\n 'numAttempts',\n (+this._context.variables.find(v => v.identifier === 'numAttempts')?.value + 1).toString()\n );\n }\n\n if (this.adaptive === 'false') {\n this.#resetOutcomeVariablesBeforeResponseProcessing();\n }\n\n const responseProcessor = this.querySelector<QtiResponseProcessing>('qti-response-processing');\n const canProcess = !!(responseProcessor && typeof responseProcessor.process === 'function');\n if (canProcess) {\n responseProcessor.process();\n }\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n\n // `responseProcessed` marks this as the end of an attempt (vs. a plain\n // selection, which fires the same event without the flag). Lets listeners\n // react only when an attempt actually ends.\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext; responseProcessed: boolean }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context, responseProcessed: true }\n })\n );\n\n return canProcess;\n }\n\n public resetResponses() {\n this._context = this.#initialContext;\n }\n\n protected getResponse(identifier: string): Readonly<ResponseVariable> {\n return this.getVariable(identifier) as ResponseVariable;\n }\n\n public getOutcome(identifier: string): Readonly<OutcomeVariable> {\n return this.getVariable(identifier) as OutcomeVariable;\n }\n\n protected getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>> {\n return this._context.variables.find(v => v.identifier === identifier) || null;\n }\n\n /** Extension point for presentation packages reacting to a candidate response change. */\n protected afterResponseVariableUpdated(): void {}\n\n // saving privates here: ------------------------------------------------------------------------------\n\n /**\n * Updates the response variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateResponseVariable(identifier: string, value: string | string[] | undefined) {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => (v.identifier !== identifier ? v : { ...v, value: value }))\n };\n\n this.afterResponseVariableUpdated();\n\n this.dispatchEvent(\n new CustomEvent<InteractionChangedDetails>('qti-interaction-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n responseIdentifier: identifier,\n response: Array.isArray(value) ? [...value] : value\n }\n })\n );\n\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n }\n\n /**\n * Updates the template variable with the specified identifier to the given value.\n */\n public updateTemplateVariable(identifier: string, value: string | string[] | undefined) {\n const templateVariable = this._context.variables.find(v => v.identifier === identifier && v.type === 'template') as\n | TemplateVariable\n | undefined;\n\n if (!templateVariable) {\n console.warn(`Can not set qti-template-identifier: ${identifier}, it is not available`);\n return;\n }\n\n const normalizedValue =\n templateVariable.cardinality === 'single'\n ? Array.isArray(value)\n ? value[0]\n : (value ?? null)\n : value === undefined || value === null\n ? null\n : Array.isArray(value)\n ? value\n : [value];\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v =>\n v.identifier !== identifier\n ? v\n : {\n ...v,\n value: normalizedValue\n }\n )\n };\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n /**\n * Updates the correct response for the specified response variable.\n */\n public updateCorrectResponse(identifier: string, value: string | string[] | undefined) {\n const responseVariable = this.getResponse(identifier);\n\n if (!responseVariable) {\n console.warn(`Can not set correct response for identifier: ${identifier}, it is not available`);\n return;\n }\n\n const normalizedValue =\n responseVariable.cardinality === 'single'\n ? Array.isArray(value)\n ? value[0]\n : (value ?? null)\n : value === undefined || value === null\n ? null\n : Array.isArray(value)\n ? value\n : [value];\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v =>\n v.identifier !== identifier\n ? v\n : {\n ...v,\n correctResponse: normalizedValue\n }\n )\n };\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n public setOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n this.updateOutcomeVariable(identifier, value);\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n /**\n * Updates the outcome variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n const outcomeVariable = this.getOutcome(identifier);\n\n if (!outcomeVariable) {\n console.warn(`Can not set qti-outcome-identifier: ${identifier}, it is not available`);\n return;\n }\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => {\n if (v.identifier !== identifier) {\n return v;\n }\n return {\n ...v,\n value: outcomeVariable.cardinality === 'single' ? value : Array.isArray(value) ? value : [value]\n };\n })\n };\n this.#feedbackElements.forEach(fe => fe.checkShowFeedback(identifier));\n\n this.dispatchEvent(\n new CustomEvent<OutcomeChangedDetails>('qti-outcome-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n outcomeIdentifier: identifier,\n value: this._context.variables.find(v => v.identifier === identifier)?.value\n }\n })\n );\n }\n\n public validate(reportValidity = true): boolean {\n const isValid = this.interactionElements.every(interactionElement => interactionElement.validate());\n\n if (reportValidity) {\n this.reportValidity();\n }\n\n return isValid;\n }\n\n public reportValidity() {\n for (const interactionElement of this.interactionElements) {\n interactionElement.reportValidity();\n }\n }\n\n #getCompletionStatus(): 'completed' | 'incomplete' | 'not_attempted' | 'unknown' {\n const valid = this.validate(false);\n if (valid === true) return 'completed';\n if (valid === false) return 'incomplete';\n return 'not_attempted';\n }\n\n #resetOutcomeVariablesBeforeResponseProcessing(): void {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n if (variable.type !== 'outcome') {\n return variable;\n }\n\n const hasDefaultValue = 'defaultValue' in variable;\n const declaredDefault = hasDefaultValue ? variable.defaultValue : null;\n\n let value = declaredDefault ?? null;\n if (\n (value === null || value === undefined) &&\n (variable.baseType === 'integer' || variable.baseType === 'float')\n ) {\n value = '0';\n }\n\n return {\n ...variable,\n value\n };\n })\n };\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-item': QtiAssessmentItem;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"qti-assessment-item.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-item/qti-assessment-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAazE;;;;;;;;;GASG;AAEH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAAjD;;QAEE,wBAAmB,GAAiC,IAAI,CAAC;QAE7B,eAAU,GAAW,EAAE,CAAC;QACxB,aAAQ,GAAqB,OAAO,CAAC;QACjE;;;;;;WAMG;QACsD,kBAAa,GAA4B,IAAI,CAAC;QAsC/F,aAAQ,GAAgB;YAC9B,SAAS,EAAE,oBAAoB;SAChC,CAAC;QAgGF,oBAAe,GAA0B,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE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I,EAAE,OAAO,EAAE,CAAC;mDAAmB;AAMlB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAmB;AAgBvC;IADP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;mDAGhC","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { itemContext, itemContextVariables } from '@qti-components/base';\n\nimport type { PropertyValues } from 'lit';\nimport type { QtiTemplateProcessing } from '../qti-template-processing/qti-template-processing.js';\nimport type { InteractionChangedDetails, OutcomeChangedDetails } from '../../internal/event-types.ts';\nimport type { ResponseInteraction } from '@qti-components/base';\nimport type { RegisteredInteraction } from '@qti-components/base';\nimport type { VariableDeclaration, VariableValue } from '@qti-components/base';\nimport type { OutcomeVariable, ResponseVariable, TemplateVariable } from '@qti-components/base';\nimport type { QtiResponseProcessing } from '../qti-response-processing/qti-response-processing.ts';\nimport type QtiRegisterVariable from '../../internal/events/qti-register-variable.ts';\nimport type { ItemContext } from '@qti-components/base';\n\n/**\n * @summary The qti-assessment-item element contains all the other QTI 3 item structures.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj\n *\n * @dependency qti-feedback\n * @dependency qti-responseprocessing\n *\n * @event qti-item-context-updated - Emitted when through a user action the itemContext is updated,\n * typically on interaction with the interactions, or calling response processing.\n */\n\nexport class QtiAssessmentItem extends LitElement {\n #itemTitle: string | undefined;\n #templateProcessing: QtiTemplateProcessing | null = null;\n\n @property({ type: String }) identifier: string = '';\n @property({ type: String }) adaptive: 'true' | 'false' = 'false';\n /*\n * `attribute` spelled out: Lit derives `timedependent` from the property\n * name, while QTI writes `time-dependent`. Without it the attribute never\n * reached the property, so an item declaring `time-dependent=\"true\"` still\n * reported false to `test-navigation`, which reads this to build the computed\n * item context.\n */\n @property({ type: String, attribute: 'time-dependent' }) timeDependent: 'true' | 'false' | null = null;\n\n @property({ type: String })\n override get title(): string {\n return this.#itemTitle;\n }\n override set title(value: string) {\n this.#itemTitle = value;\n this.removeAttribute('title');\n this.setAttribute('data-title', value);\n }\n\n /**\n * Locks the item, for example once it is submitted. Published in the item context, which the\n * interactions inside follow, so the item keeps no list of them to set it on.\n */\n @property({ type: Boolean }) disabled: boolean;\n\n /**\n * Shows the item for reading only. Published in the item context, which the interactions inside\n * follow, so the item keeps no list of them to set it on.\n */\n @property({ type: Boolean }) readonly: boolean;\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n const readonlyChanged = changed.has('readonly') && (this.readonly ?? false) !== (this._context.readonly ?? false);\n const disabledChanged = changed.has('disabled') && (this.disabled ?? false) !== (this._context.disabled ?? false);\n if (readonlyChanged || disabledChanged) {\n this._context = {\n ...this._context,\n ...(readonlyChanged ? { readonly: !!this.readonly } : {}),\n ...(disabledChanged ? { disabled: !!this.disabled } : {})\n };\n }\n }\n\n @provide({ context: itemContext })\n private _context: ItemContext = {\n variables: itemContextVariables\n };\n\n /**\n * Sets the identifier for the assessment item reference if this item is in a test.\n *\n * @param identifier - The identifier for the assessment item reference.\n */\n public set assessmentItemRefId(identifier: string) {\n this._context = { ...this._context, identifier };\n }\n\n public get assessmentItemRefId(): string {\n return this._context.identifier;\n }\n\n /**\n * The item's whole context, declarations included, for reading. `variables` is the trimmed view\n * for hosts; the test needs the declarations too, and used to reach for the private field.\n */\n public get itemContext(): Readonly<ItemContext> {\n return this._context;\n }\n\n public get variables(): VariableValue<string | string[] | null>[] {\n return this._context.variables.map(v => ({\n identifier: v.identifier,\n value: v.value,\n type: v.type,\n // add externalscored, a fixed prop to the test, so the testcontext can read and decide how to score this item\n ...(v.type === 'outcome' && v.identifier === 'SCORE'\n ? { externalScored: (v as OutcomeVariable).externalScored }\n : {})\n }));\n }\n\n public set variables(value: VariableValue<string | string[] | null>[]) {\n if (!Array.isArray(value) || value.some(v => !('identifier' in v))) {\n console.warn('variables property should be an array of VariableDeclaration');\n return;\n }\n const previous = this._context.variables;\n // Recognised by their declaration, or by their own type: a template declaration registers after\n // its first render, so a test restoring on connect can get here before it has.\n const restoredTemplates = value.filter(\n v =>\n v.value !== null &&\n v.value !== undefined &&\n (v.type === 'template' ||\n previous.some(declared => declared.identifier === v.identifier && declared.type === 'template'))\n );\n restoredTemplates.forEach(v =>\n this.#restoredTemplateValues.set(v.identifier, v.value as Readonly<string | string[]>)\n );\n const templatesChanged = restoredTemplates.some(\n v =>\n JSON.stringify(previous.find(declared => declared.identifier === v.identifier)?.value) !==\n JSON.stringify(v.value)\n );\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n const matchingValue = value.find(v => v.identifier === variable.identifier);\n if (matchingValue) {\n return {\n ...variable,\n ...matchingValue,\n interpolationTable: (variable as OutcomeVariable).interpolationTable,\n matchTable: (variable as OutcomeVariable).matchTable\n };\n }\n return variable;\n })\n };\n\n // Restored after the first processing run: correct responses still follow the values it drew.\n if (this.#templatesProcessed && templatesChanged) {\n this.#runTemplateProcessing();\n }\n\n // The interactions take the answers over from the context, some of them a moment from now, and\n // a different answer can mean a different verdict. Look once they have.\n void this.updateComplete.then(() => this.#revalidate());\n }\n\n public get state(): ItemContext['state'] {\n return this._context.state;\n }\n\n public set state(value: ItemContext['state']) {\n this._context = {\n ...this._context,\n state: value ? { ...value } : undefined\n };\n }\n\n #initialContext: Readonly<ItemContext> = { ...this._context, variables: this._context.variables };\n /**\n * Template values handed in through `variables` — drawn in an earlier visit or session. Template\n * processing keeps them instead of drawing again, so the candidate sees the question they\n * answered, and still runs, so correct responses are derived from them.\n */\n #restoredTemplateValues = new Map<string, Readonly<string | string[]>>();\n #templatesProcessed = false;\n /** Registered candidate-input interactions. Correction packages may extend their presentation behavior. */\n protected interactionElements: RegisteredInteraction[] = [];\n\n /** @deprecated use variables property instead */\n set responses(myResponses: ResponseInteraction[]) {\n if (myResponses) {\n for (const response of myResponses) {\n const responseVariable = this.getResponse(response.responseIdentifier);\n if (responseVariable) {\n this.updateResponseVariable(response.responseIdentifier, response.response);\n }\n\n const interaction: RegisteredInteraction | undefined = this.interactionElements.find(\n i => i.getAttribute('response-identifier') === response.responseIdentifier\n );\n if (interaction) {\n interaction.response = response.response;\n }\n }\n }\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n override connectedCallback(): void {\n this.#attachEventListeners();\n super.connectedCallback();\n this.updateComplete.then(() => {\n // The verdict goes in first, so whoever hears the item connect reads it with the rest.\n this.validate(false);\n this.dispatchEvent(\n new CustomEvent<QtiAssessmentItem>('qti-assessment-item-connected', {\n bubbles: true,\n composed: true,\n detail: this\n })\n );\n this.#processTemplates();\n });\n }\n\n override disconnectedCallback(): void {\n this.#removeEventListeners();\n super.disconnectedCallback();\n }\n\n #attachEventListeners() {\n this.addEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.addEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.addEventListener('end-attempt', this.#handleEndAttempt);\n this.addEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.addEventListener('qti-set-template-value', this.#handleSetTemplateValue);\n this.addEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);\n this.addEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #removeEventListeners() {\n this.removeEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.removeEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.removeEventListener('end-attempt', this.#handleEndAttempt);\n this.removeEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.removeEventListener('qti-set-template-value', this.#handleSetTemplateValue);\n this.removeEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);\n this.removeEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #handleRegisterVariable = (e: QtiRegisterVariable) => {\n e.stopImmediatePropagation();\n const { variable } = e.detail;\n const restored = variable.type === 'template' ? this.#restoredTemplateValues.get(variable.identifier) : undefined;\n const registered = restored !== undefined ? { ...variable, value: restored } : variable;\n this._context = { ...this._context, variables: [...this._context.variables, registered] };\n this.#initialContext = this._context;\n e.stopPropagation();\n };\n\n #handleRegisterInteraction = (e: CustomEvent<{ interaction: string; interactionElement: RegisteredInteraction }>) => {\n e.stopImmediatePropagation();\n this.interactionElements.push(e.detail.interactionElement);\n };\n\n #handleEndAttempt = (e: CustomEvent<{ responseIdentifier: string; countAttempt: boolean }>) => {\n e.stopImmediatePropagation();\n const { responseIdentifier, countAttempt } = e.detail;\n this.validate();\n this.updateResponseVariable(responseIdentifier, 'true');\n this.processResponse(countAttempt);\n };\n\n #handleSetOutcomeValue = (e: CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>) => {\n e.stopImmediatePropagation();\n const { outcomeIdentifier, value } = e.detail;\n this.updateOutcomeVariable(outcomeIdentifier, value);\n e.stopPropagation();\n };\n\n #handleSetTemplateValue = (e: CustomEvent<{ templateIdentifier: string; value: string | string[] | null }>) => {\n e.stopImmediatePropagation();\n const { templateIdentifier, value } = e.detail;\n if (!this.#restoredTemplateValues.has(templateIdentifier)) {\n this.updateTemplateVariable(templateIdentifier, value ?? undefined);\n }\n e.stopPropagation();\n };\n\n #handleSetCorrectResponse = (e: CustomEvent<{ responseIdentifier: string; value: string | string[] | null }>) => {\n e.stopImmediatePropagation();\n const { responseIdentifier, value } = e.detail;\n this.updateCorrectResponse(responseIdentifier, value ?? undefined);\n e.stopPropagation();\n };\n\n #handleUpdateResponseVariable = (e: CustomEvent<ResponseInteraction>) => {\n e.stopImmediatePropagation();\n\n const { responseIdentifier, response, state } = e.detail;\n this.updateResponseVariable(responseIdentifier, response);\n if (state !== undefined) {\n this._context = {\n ...this._context,\n state: {\n ...(this._context.state || {}),\n [responseIdentifier]: state\n }\n };\n }\n\n // The interaction has updated its own validity by now; publish the verdict with the answer.\n this.validate(false);\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n };\n\n async #processTemplates(): Promise<void> {\n const templateDeclarations = Array.from(this.querySelectorAll<LitElement>('qti-template-declaration'));\n if (templateDeclarations.length > 0) {\n await Promise.all(templateDeclarations.map(declaration => declaration.updateComplete));\n await Promise.resolve();\n }\n\n this.#templateProcessing = this.querySelector<QtiTemplateProcessing>('qti-template-processing');\n this.#templatesProcessed = true;\n // Run template processing before first presentation\n this.#runTemplateProcessing();\n }\n\n #runTemplateProcessing(): void {\n if (!this.#templateProcessing) return;\n this.#templateProcessing.process();\n this.#initialContext = { ...this._context, variables: this._context.variables };\n }\n\n public processResponse(countNumAttempts = true, reportValidityAfterScoring = true): boolean {\n this.validate(reportValidityAfterScoring);\n\n if (countNumAttempts) {\n this.updateOutcomeVariable(\n 'numAttempts',\n (+this._context.variables.find(v => v.identifier === 'numAttempts')?.value + 1).toString()\n );\n }\n\n if (this.adaptive === 'false') {\n this.#resetOutcomeVariablesBeforeResponseProcessing();\n }\n\n const responseProcessor = this.querySelector<QtiResponseProcessing>('qti-response-processing');\n const canProcess = !!(responseProcessor && typeof responseProcessor.process === 'function');\n if (canProcess) {\n responseProcessor.process();\n }\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n\n // `responseProcessed` marks this as the end of an attempt (vs. a plain\n // selection, which fires the same event without the flag). Lets listeners\n // react only when an attempt actually ends.\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext; responseProcessed: boolean }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context, responseProcessed: true }\n })\n );\n\n return canProcess;\n }\n\n public resetResponses() {\n this._context = this.#initialContext;\n }\n\n protected getResponse(identifier: string): Readonly<ResponseVariable> {\n return this.getVariable(identifier) as ResponseVariable;\n }\n\n public getOutcome(identifier: string): Readonly<OutcomeVariable> {\n return this.getVariable(identifier) as OutcomeVariable;\n }\n\n protected getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>> {\n return this._context.variables.find(v => v.identifier === identifier) || null;\n }\n\n /** Extension point for presentation packages reacting to a candidate response change. */\n protected afterResponseVariableUpdated(): void {}\n\n // saving privates here: ------------------------------------------------------------------------------\n\n /**\n * Updates the response variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateResponseVariable(identifier: string, value: string | string[] | undefined) {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => (v.identifier !== identifier ? v : { ...v, value: value }))\n };\n\n this.afterResponseVariableUpdated();\n\n this.dispatchEvent(\n new CustomEvent<InteractionChangedDetails>('qti-interaction-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n responseIdentifier: identifier,\n response: Array.isArray(value) ? [...value] : value\n }\n })\n );\n\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n }\n\n /**\n * Updates the template variable with the specified identifier to the given value.\n */\n public updateTemplateVariable(identifier: string, value: string | string[] | undefined) {\n const templateVariable = this._context.variables.find(v => v.identifier === identifier && v.type === 'template') as\n | TemplateVariable\n | undefined;\n\n if (!templateVariable) {\n console.warn(`Can not set qti-template-identifier: ${identifier}, it is not available`);\n return;\n }\n\n const normalizedValue =\n templateVariable.cardinality === 'single'\n ? Array.isArray(value)\n ? value[0]\n : (value ?? null)\n : value === undefined || value === null\n ? null\n : Array.isArray(value)\n ? value\n : [value];\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v =>\n v.identifier !== identifier\n ? v\n : {\n ...v,\n value: normalizedValue\n }\n )\n };\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n /**\n * Updates the correct response for the specified response variable.\n */\n public updateCorrectResponse(identifier: string, value: string | string[] | undefined) {\n const responseVariable = this.getResponse(identifier);\n\n if (!responseVariable) {\n console.warn(`Can not set correct response for identifier: ${identifier}, it is not available`);\n return;\n }\n\n const normalizedValue =\n responseVariable.cardinality === 'single'\n ? Array.isArray(value)\n ? value[0]\n : (value ?? null)\n : value === undefined || value === null\n ? null\n : Array.isArray(value)\n ? value\n : [value];\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v =>\n v.identifier !== identifier\n ? v\n : {\n ...v,\n correctResponse: normalizedValue\n }\n )\n };\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n public setOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n this.updateOutcomeVariable(identifier, value);\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n /**\n * Updates the outcome variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n const outcomeVariable = this.getOutcome(identifier);\n\n if (!outcomeVariable) {\n console.warn(`Can not set qti-outcome-identifier: ${identifier}, it is not available`);\n return;\n }\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => {\n if (v.identifier !== identifier) {\n return v;\n }\n return {\n ...v,\n value: outcomeVariable.cardinality === 'single' ? value : Array.isArray(value) ? value : [value]\n };\n })\n };\n\n this.dispatchEvent(\n new CustomEvent<OutcomeChangedDetails>('qti-outcome-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n outcomeIdentifier: identifier,\n value: this._context.variables.find(v => v.identifier === identifier)?.value\n }\n })\n );\n }\n\n public validate(reportValidity = true): boolean {\n const isValid = this.interactionElements.every(interactionElement => interactionElement.validate());\n this.#publishValidity(isValid);\n\n if (reportValidity) {\n this.reportValidity();\n }\n\n return isValid;\n }\n\n /** Puts the verdict in the item context, where the test and anything else can read it. */\n #publishValidity(valid: boolean): void {\n if (this._context.valid !== valid) {\n this._context = { ...this._context, valid };\n }\n }\n\n /**\n * Checks again after something the interactions' validity depends on changed without them saying\n * so (an answer handed in through `variables`), and tells the test if the verdict moved.\n */\n #revalidate(): void {\n const before = this._context.valid;\n this.validate(false);\n if (this._context.valid !== before) {\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n }\n\n public reportValidity() {\n for (const interactionElement of this.interactionElements) {\n interactionElement.reportValidity();\n }\n }\n\n #getCompletionStatus(): 'completed' | 'incomplete' | 'not_attempted' | 'unknown' {\n const valid = this.validate(false);\n if (valid === true) return 'completed';\n if (valid === false) return 'incomplete';\n return 'not_attempted';\n }\n\n #resetOutcomeVariablesBeforeResponseProcessing(): void {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n if (variable.type !== 'outcome') {\n return variable;\n }\n\n const hasDefaultValue = 'defaultValue' in variable;\n const declaredDefault = hasDefaultValue ? variable.defaultValue : null;\n\n let value = declaredDefault ?? null;\n if (\n (value === null || value === undefined) &&\n (variable.baseType === 'integer' || variable.baseType === 'float')\n ) {\n value = '0';\n }\n\n return {\n ...variable,\n value\n };\n })\n };\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-item': QtiAssessmentItem;\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { CSSResultGroup } from 'lit';
|
|
3
|
+
/**
|
|
4
|
+
* @summary Root of a shared stimulus, placed as a whole wherever the stimulus is rendered.
|
|
5
|
+
* @documentation https://www.imsglobal.org/spec/qti/v3p0/info#Root_AssessmentStimulus
|
|
6
|
+
* @status stable
|
|
7
|
+
* @since 4.0
|
|
8
|
+
*
|
|
9
|
+
* Generates no box of its own (`display: contents`), so the stimulus lays out as if only its
|
|
10
|
+
* `qti-stimulus-body` were placed. It is kept in the DOM because it carries the stimulus'
|
|
11
|
+
* `xml:lang` (transformed to `lang`): the content inherits its language from here, which is what
|
|
12
|
+
* text-to-speech and screen readers use to pick a voice.
|
|
13
|
+
*
|
|
14
|
+
* Its QTI `title` is removed on connect: it names the stimulus for authors browsing a repository,
|
|
15
|
+
* and as an HTML `title` it would show as a tooltip over the whole passage and be announced by
|
|
16
|
+
* screen readers.
|
|
17
|
+
*
|
|
18
|
+
* @slot - stimulus content: `qti-stylesheet`, `qti-stimulus-body` and `qti-catalog-info` (hidden).
|
|
19
|
+
*/
|
|
20
|
+
export declare class QtiAssessmentStimulus extends LitElement {
|
|
21
|
+
static styles: CSSResultGroup;
|
|
22
|
+
connectedCallback(): void;
|
|
23
|
+
render(): import("lit").TemplateResult<1>;
|
|
24
|
+
}
|
|
25
|
+
declare global {
|
|
26
|
+
interface HTMLElementTagNameMap {
|
|
27
|
+
'qti-assessment-stimulus': QtiAssessmentStimulus;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import styles from './qti-assessment-stimulus.styles';
|
|
3
|
+
/**
|
|
4
|
+
* @summary Root of a shared stimulus, placed as a whole wherever the stimulus is rendered.
|
|
5
|
+
* @documentation https://www.imsglobal.org/spec/qti/v3p0/info#Root_AssessmentStimulus
|
|
6
|
+
* @status stable
|
|
7
|
+
* @since 4.0
|
|
8
|
+
*
|
|
9
|
+
* Generates no box of its own (`display: contents`), so the stimulus lays out as if only its
|
|
10
|
+
* `qti-stimulus-body` were placed. It is kept in the DOM because it carries the stimulus'
|
|
11
|
+
* `xml:lang` (transformed to `lang`): the content inherits its language from here, which is what
|
|
12
|
+
* text-to-speech and screen readers use to pick a voice.
|
|
13
|
+
*
|
|
14
|
+
* Its QTI `title` is removed on connect: it names the stimulus for authors browsing a repository,
|
|
15
|
+
* and as an HTML `title` it would show as a tooltip over the whole passage and be announced by
|
|
16
|
+
* screen readers.
|
|
17
|
+
*
|
|
18
|
+
* @slot - stimulus content: `qti-stylesheet`, `qti-stimulus-body` and `qti-catalog-info` (hidden).
|
|
19
|
+
*/
|
|
20
|
+
export class QtiAssessmentStimulus extends LitElement {
|
|
21
|
+
static { this.styles = styles; }
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback();
|
|
24
|
+
this.removeAttribute('title');
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
return html `<slot></slot>`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=qti-assessment-stimulus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti-assessment-stimulus.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-stimulus/qti-assessment-stimulus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEvC,OAAO,MAAM,MAAM,kCAAkC,CAAC;AAItD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,qBAAsB,SAAQ,UAAU;aACnC,WAAM,GAAmB,MAAM,CAAC;IAEvC,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC","sourcesContent":["import { html, LitElement } from 'lit';\n\nimport styles from './qti-assessment-stimulus.styles';\n\nimport type { CSSResultGroup } from 'lit';\n\n/**\n * @summary Root of a shared stimulus, placed as a whole wherever the stimulus is rendered.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/info#Root_AssessmentStimulus\n * @status stable\n * @since 4.0\n *\n * Generates no box of its own (`display: contents`), so the stimulus lays out as if only its\n * `qti-stimulus-body` were placed. It is kept in the DOM because it carries the stimulus'\n * `xml:lang` (transformed to `lang`): the content inherits its language from here, which is what\n * text-to-speech and screen readers use to pick a voice.\n *\n * Its QTI `title` is removed on connect: it names the stimulus for authors browsing a repository,\n * and as an HTML `title` it would show as a tooltip over the whole passage and be announced by\n * screen readers.\n *\n * @slot - stimulus content: `qti-stylesheet`, `qti-stimulus-body` and `qti-catalog-info` (hidden).\n */\nexport class QtiAssessmentStimulus extends LitElement {\n static override styles: CSSResultGroup = styles;\n\n override connectedCallback() {\n super.connectedCallback();\n this.removeAttribute('title');\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-stimulus': QtiAssessmentStimulus;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti-assessment-stimulus.styles.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-stimulus/qti-assessment-stimulus.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;CAQjB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport default css`\n :host {\n display: contents;\n }\n\n ::slotted(qti-catalog-info) {\n display: none;\n }\n`;\n"]}
|
|
@@ -50,10 +50,12 @@ export class QtiAssessmentStimulusRef extends LitElement {
|
|
|
50
50
|
const stimulus = await qtiTransformItem()
|
|
51
51
|
.load(this.href)
|
|
52
52
|
.then(api => api.htmlDoc());
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
// Place the whole qti-assessment-stimulus, not just its body: its `lang` is what the stimulus
|
|
54
|
+
// content inherits its language from.
|
|
55
|
+
const root = stimulus?.querySelector('qti-assessment-stimulus');
|
|
56
|
+
if (root) {
|
|
55
57
|
stimulusRef.innerHTML = '';
|
|
56
|
-
stimulusRef.append(
|
|
58
|
+
stimulusRef.append(root);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-assessment-stimulus-ref.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhE,MAAM,OAAO,sCAAuC,SAAQ,KAAK;aACjD,cAAS,GAAG,uCAAuC,CAAC;IAClE,YACS,OAAiC,EACjC,IAAuB;QAE9B,KAAK,CAAC,sCAAsC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAHtG,YAAO,GAAP,OAAO,CAA0B;QACjC,SAAI,GAAJ,IAAI,CAAmB;IAGhC,CAAC;;AAGH;;GAEG;AAEH,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IAAxD;;QAC8B,eAAU,GAAG,EAAE,CAAC;QAChB,SAAI,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"qti-assessment-stimulus-ref.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhE,MAAM,OAAO,sCAAuC,SAAQ,KAAK;aACjD,cAAS,GAAG,uCAAuC,CAAC;IAClE,YACS,OAAiC,EACjC,IAAuB;QAE9B,KAAK,CAAC,sCAAsC,CAAC,SAAS,EAAE,EAA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YACT,WAAW,CAAC,SAAS,GAAG,EAAE,CAAC;YAC3B,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AAzC6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAW","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { qtiTransformItem } from '@qti-components/transformers';\n\nimport type { QtiAssessmentItem } from '../qti-assessment-item/qti-assessment-item';\n\nexport class QtiAssessmentStimulusRefConnectedEvent extends Event {\n public static eventName = 'qti-assessment-stimulus-ref-connected';\n constructor(\n public element: QtiAssessmentStimulusRef,\n public item: QtiAssessmentItem\n ) {\n super(QtiAssessmentStimulusRefConnectedEvent.eventName, { bubbles: true, composed: true, cancelable: true });\n }\n}\n\n/**\n * Represents a custom element for referencing an assessment stimulus.\n */\n\nexport class QtiAssessmentStimulusRef extends LitElement {\n @property({ type: String }) identifier = '';\n @property({ type: String }) href = '';\n\n /**\n * Lifecycle method called when the element is connected to the DOM.\n * First checks if there's a data-stimulus-idref element. If found, loads the stimulus directly.\n * If not found, delegates to the delivery platform via an event.\n */\n public override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n // VERY important to wait for updateComplete to ensure that the stimulusRef is connected after item\n // for the test-navigation to correctly process everything in order\n await this.updateComplete;\n\n const item = this.closest<QtiAssessmentItem>('qti-assessment-item');\n\n const event = new QtiAssessmentStimulusRefConnectedEvent(this, item);\n this.dispatchEvent(event);\n\n const stimulusRef = item?.querySelector(`[data-stimulus-idref=\"${this.identifier}\"]`);\n if (!event.defaultPrevented && stimulusRef) {\n await this.updateStimulusRef(stimulusRef);\n }\n }\n\n /**\n * Loads and appends the stimulus to the specified element.\n * @param stimulusRef - The element to which the stimulus will be appended.\n */\n public async updateStimulusRef(stimulusRef: Element) {\n const stimulus = await qtiTransformItem()\n .load(this.href)\n .then(api => api.htmlDoc());\n // Place the whole qti-assessment-stimulus, not just its body: its `lang` is what the stimulus\n // content inherits its language from.\n const root = stimulus?.querySelector('qti-assessment-stimulus');\n if (root) {\n stimulusRef.innerHTML = '';\n stimulusRef.append(root);\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-stimulus-ref': QtiAssessmentStimulusRef;\n }\n}\n"]}
|
|
@@ -2,14 +2,33 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import type { Calculate } from '@qti-components/base';
|
|
3
3
|
/**
|
|
4
4
|
* https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
|
|
5
|
+
*
|
|
6
|
+
* A custom operator is outside the QTI vocabulary, so what it does is supplied
|
|
7
|
+
* by the delivery engine rather than by the item. Two ways to supply it:
|
|
8
|
+
*
|
|
9
|
+
* `definition` names an operator the host registered with
|
|
10
|
+
* `registerCustomOperator`, or one of the built-ins (`Trim`, `ToAscii`,
|
|
11
|
+
* `ParseCommaDecimal` under the `depcp:`, `questify:` and `qade:` prefixes).
|
|
12
|
+
* The operator is handed the calculated values of the child expressions:
|
|
13
|
+
*
|
|
14
|
+
* ```xml
|
|
15
|
+
* <qti-custom-operator definition="depcp:Trim">
|
|
16
|
+
* <qti-variable identifier="RESPONSE"/>
|
|
17
|
+
* </qti-custom-operator>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* `class="js.org"` instead runs inline JavaScript out of a CDATA section:
|
|
21
|
+
*
|
|
22
|
+
* ```xml
|
|
5
23
|
* <qti-custom-operator class="js.org">
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
24
|
+
* <qti-base-value base-type="string"><![CDATA[
|
|
25
|
+
* console.log(context.variables);
|
|
26
|
+
* return 'B'
|
|
27
|
+
* ]]></qti-base-value>
|
|
28
|
+
* </qti-custom-operator>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* `definition` is checked first; the two do not interact.
|
|
13
32
|
*/
|
|
14
33
|
export declare class QtiCustomOperator extends LitElement implements Calculate {
|
|
15
34
|
#private;
|
|
@@ -7,17 +7,36 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { consume } from '@lit/context';
|
|
8
8
|
import { LitElement, html } from 'lit';
|
|
9
9
|
import { state } from 'lit/decorators.js';
|
|
10
|
-
import { itemContext } from '@qti-components/base';
|
|
10
|
+
import { getCustomOperator, itemContext } from '@qti-components/base';
|
|
11
11
|
/**
|
|
12
12
|
* https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
|
|
13
|
+
*
|
|
14
|
+
* A custom operator is outside the QTI vocabulary, so what it does is supplied
|
|
15
|
+
* by the delivery engine rather than by the item. Two ways to supply it:
|
|
16
|
+
*
|
|
17
|
+
* `definition` names an operator the host registered with
|
|
18
|
+
* `registerCustomOperator`, or one of the built-ins (`Trim`, `ToAscii`,
|
|
19
|
+
* `ParseCommaDecimal` under the `depcp:`, `questify:` and `qade:` prefixes).
|
|
20
|
+
* The operator is handed the calculated values of the child expressions:
|
|
21
|
+
*
|
|
22
|
+
* ```xml
|
|
23
|
+
* <qti-custom-operator definition="depcp:Trim">
|
|
24
|
+
* <qti-variable identifier="RESPONSE"/>
|
|
25
|
+
* </qti-custom-operator>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* `class="js.org"` instead runs inline JavaScript out of a CDATA section:
|
|
29
|
+
*
|
|
30
|
+
* ```xml
|
|
13
31
|
* <qti-custom-operator class="js.org">
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
32
|
+
* <qti-base-value base-type="string"><![CDATA[
|
|
33
|
+
* console.log(context.variables);
|
|
34
|
+
* return 'B'
|
|
35
|
+
* ]]></qti-base-value>
|
|
36
|
+
* </qti-custom-operator>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* `definition` is checked first; the two do not interact.
|
|
21
40
|
*/
|
|
22
41
|
export class QtiCustomOperator extends LitElement {
|
|
23
42
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
@@ -36,6 +55,10 @@ export class QtiCustomOperator extends LitElement {
|
|
|
36
55
|
}
|
|
37
56
|
}
|
|
38
57
|
calculate() {
|
|
58
|
+
const definition = this.getAttribute('definition');
|
|
59
|
+
if (definition) {
|
|
60
|
+
return this.#applyDefinedOperator(definition);
|
|
61
|
+
}
|
|
39
62
|
const fn = {
|
|
40
63
|
variable: (responseIdentifier) => this._context?.variables.find(v => v.identifier === responseIdentifier)?.value ?? '',
|
|
41
64
|
correct: (responseIdentifier) => this._context?.variables.find(v => v.identifier === responseIdentifier)
|
|
@@ -66,6 +89,24 @@ export class QtiCustomOperator extends LitElement {
|
|
|
66
89
|
};
|
|
67
90
|
return this.#operatorFunction(this._context, fn, item);
|
|
68
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* An operator the host registered, or a built-in. An unknown `definition` is
|
|
94
|
+
* NULL rather than an error: the item names an operator this engine does not
|
|
95
|
+
* provide, which the surrounding expression can still test with
|
|
96
|
+
* `qti-is-null`.
|
|
97
|
+
*/
|
|
98
|
+
#applyDefinedOperator(definition) {
|
|
99
|
+
const operator = getCustomOperator(definition);
|
|
100
|
+
if (!operator) {
|
|
101
|
+
console.warn(`qti-custom-operator: no operator registered for definition "${definition}"`);
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const values = Array.from(this.children).map(child => {
|
|
105
|
+
const calculate = child.calculate;
|
|
106
|
+
return typeof calculate === 'function' ? calculate.call(child) : null;
|
|
107
|
+
});
|
|
108
|
+
return operator(values);
|
|
109
|
+
}
|
|
69
110
|
}
|
|
70
111
|
__decorate([
|
|
71
112
|
consume({ context: itemContext, subscribe: true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-custom-operator.js","sourceRoot":"","sources":["../../../src/components/qti-custom-operator/qti-custom-operator.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"qti-custom-operator.js","sourceRoot":"","sources":["../../../src/components/qti-custom-operator/qti-custom-operator.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAC/C,sEAAsE;IACtE,iBAAiB,CAAW;IAMnB,MAAM;QACb,OAAO,IAAI,CAAA,qBAAqB,IAAI,CAAC,gBAAgB,UAAU,CAAC;IAClE,CAAC;IAED,gBAAgB;QACd,gGAAgG;QAChG,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAC3E,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,CAC5C,CAAC;QACF,IAAI,CAAC;YACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;QACj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AAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAA8D,0BAA0B,EAAE;oBACvG,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,IAAI;oBACd,MAAM,EAAE;wBACN,kBAAkB;wBAClB,QAAQ;qBACT;iBACF,CAAC,CACH,CAAC;YACJ,CAAC;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CAAC,UAAkB;QACtC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,+DAA+D,UAAU,GAAG,CAAC,CAAC;YAC3F,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACnD,MAAM,SAAS,GAAI,KAA4B,CAAC,SAAS,CAAC;YAC1D,OAAO,OAAO,SAAS,KAAK,UAAU,CAAC,CAAC,CAAE,SAAS,CAAC,IAAI,CAAC,KAAK,CAAyB,CAAC,CAAC,CAAC,IAAI,CAAC;QACjG,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACF;AAnFS;IAFP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;mDACuB","sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { state } from 'lit/decorators.js';\n\nimport { getCustomOperator, itemContext } from '@qti-components/base';\n\nimport type { CustomOperatorValue, ResponseVariable } from '@qti-components/base';\nimport type { Calculate } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\n/**\n * https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw\n *\n * A custom operator is outside the QTI vocabulary, so what it does is supplied\n * by the delivery engine rather than by the item. Two ways to supply it:\n *\n * `definition` names an operator the host registered with\n * `registerCustomOperator`, or one of the built-ins (`Trim`, `ToAscii`,\n * `ParseCommaDecimal` under the `depcp:`, `questify:` and `qade:` prefixes).\n * The operator is handed the calculated values of the child expressions:\n *\n * ```xml\n * <qti-custom-operator definition=\"depcp:Trim\">\n * <qti-variable identifier=\"RESPONSE\"/>\n * </qti-custom-operator>\n * ```\n *\n * `class=\"js.org\"` instead runs inline JavaScript out of a CDATA section:\n *\n * ```xml\n * <qti-custom-operator class=\"js.org\">\n * <qti-base-value base-type=\"string\"><![CDATA[\n * console.log(context.variables);\n * return 'B'\n * ]]></qti-base-value>\n * </qti-custom-operator>\n * ```\n *\n * `definition` is checked first; the two do not interact.\n */\n\nexport class QtiCustomOperator extends LitElement implements Calculate {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n #operatorFunction: Function;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n private _context?: ItemContext;\n\n override render() {\n return html`<slot @slotchange=${this.handleSlotChange}></slot>`;\n }\n\n handleSlotChange() {\n // expecting <[!CDATA[ ... ]]> is converted into <!-- ... --> with qti-transform: cDataToComment\n const commentNode = Array.from(this.firstElementChild?.childNodes ?? []).find(\n node => node.nodeType === Node.COMMENT_NODE\n );\n try {\n this.#operatorFunction = new Function('context', 'fn', 'item', commentNode?.textContent ?? '');\n } catch (e) {\n console.error('custom-operator contains invalid javascript code', e);\n }\n }\n\n public calculate() {\n const definition = this.getAttribute('definition');\n if (definition) {\n return this.#applyDefinedOperator(definition);\n }\n\n const fn = {\n variable: (responseIdentifier: string) =>\n this._context?.variables.find(v => v.identifier === responseIdentifier)?.value ?? '',\n correct: (responseIdentifier: string) =>\n (this._context?.variables.find(v => v.identifier === responseIdentifier) as ResponseVariable)\n ?.correctResponse ?? ''\n };\n const item = {\n getVariable: (variableIdentifier: string) =>\n this._context?.variables.find(v => v.identifier === variableIdentifier),\n updateOutcomeVariable: (outcomeIdentifier: string, value: string | string[]) => {\n this.dispatchEvent(\n new CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>('qti-set-outcome-value', {\n bubbles: true,\n composed: true,\n detail: {\n outcomeIdentifier,\n value\n }\n })\n );\n },\n updateResponseVariable: (responseIdentifier: string, response: string | string[]) => {\n this.dispatchEvent(\n new CustomEvent<{ responseIdentifier: string; response: string | string[] }>('qti-interaction-response', {\n bubbles: true,\n composed: true,\n detail: {\n responseIdentifier,\n response\n }\n })\n );\n }\n };\n\n return this.#operatorFunction(this._context, fn, item);\n }\n\n /**\n * An operator the host registered, or a built-in. An unknown `definition` is\n * NULL rather than an error: the item names an operator this engine does not\n * provide, which the surrounding expression can still test with\n * `qti-is-null`.\n */\n #applyDefinedOperator(definition: string) {\n const operator = getCustomOperator(definition);\n if (!operator) {\n console.warn(`qti-custom-operator: no operator registered for definition \"${definition}\"`);\n return null;\n }\n\n const values = Array.from(this.children).map(child => {\n const calculate = (child as Partial<Calculate>).calculate;\n return typeof calculate === 'function' ? (calculate.call(child) as CustomOperatorValue) : null;\n });\n\n return operator(values);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-custom-operator': QtiCustomOperator;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { QtiVariableDeclaration } from '@qti-components/base';
|
|
2
2
|
import type { BaseType, Cardinality } from '@qti-components/base';
|
|
3
|
+
import type { InterpolationTableEntry } from '@qti-components/base';
|
|
3
4
|
import type { ItemContext } from '@qti-components/base';
|
|
4
5
|
export declare class QtiOutcomeDeclaration extends QtiVariableDeclaration {
|
|
5
6
|
baseType: BaseType;
|
|
@@ -9,7 +10,20 @@ export declare class QtiOutcomeDeclaration extends QtiVariableDeclaration {
|
|
|
9
10
|
itemContext?: ItemContext;
|
|
10
11
|
static styles: import("lit").CSSResult[];
|
|
11
12
|
render(): import("lit").TemplateResult<1>;
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The entries of a `qti-interpolation-table`, in document order.
|
|
15
|
+
*
|
|
16
|
+
* Order is load-bearing: each entry's `source-value` is the lower bound of a
|
|
17
|
+
* range, and the lookup takes the first entry whose bound the source value
|
|
18
|
+
* clears. A Map keyed by source value cannot express that.
|
|
19
|
+
*/
|
|
20
|
+
get interpolationTable(): InterpolationTableEntry[] | null;
|
|
21
|
+
/**
|
|
22
|
+
* A qti-match-table maps a source value onto a target exactly, with no
|
|
23
|
+
* boundaries and no interpolation. Targets keep their authored spelling
|
|
24
|
+
* because a match table is not restricted to numeric outcomes.
|
|
25
|
+
*/
|
|
26
|
+
get matchTable(): Map<number, string> | null;
|
|
13
27
|
connectedCallback(): void;
|
|
14
28
|
}
|
|
15
29
|
declare global {
|
|
@@ -25,24 +25,55 @@ export class QtiOutcomeDeclaration extends QtiVariableDeclaration {
|
|
|
25
25
|
const value = this.itemContext?.variables.find(v => v.identifier === this.identifier)?.value;
|
|
26
26
|
return html `${JSON.stringify(value, null, 2)}`;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The entries of a `qti-interpolation-table`, in document order.
|
|
30
|
+
*
|
|
31
|
+
* Order is load-bearing: each entry's `source-value` is the lower bound of a
|
|
32
|
+
* range, and the lookup takes the first entry whose bound the source value
|
|
33
|
+
* clears. A Map keyed by source value cannot express that.
|
|
34
|
+
*/
|
|
28
35
|
get interpolationTable() {
|
|
29
36
|
const table = this.querySelector('qti-interpolation-table');
|
|
30
|
-
if (table)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
console.error('source-value or target-value is not a number in qti-interpolation-table-entry');
|
|
40
|
-
}
|
|
41
|
-
entries.set(sourceValue, targetValue);
|
|
37
|
+
if (!table)
|
|
38
|
+
return null;
|
|
39
|
+
const entries = [];
|
|
40
|
+
for (const entry of table.querySelectorAll('qti-interpolation-table-entry')) {
|
|
41
|
+
const sourceValue = parseFloat(entry.getAttribute('source-value'));
|
|
42
|
+
const targetValue = parseFloat(entry.getAttribute('target-value'));
|
|
43
|
+
if (Number.isNaN(sourceValue) || Number.isNaN(targetValue)) {
|
|
44
|
+
console.error('source-value or target-value is missing or not a number in qti-interpolation-table-entry');
|
|
45
|
+
continue;
|
|
42
46
|
}
|
|
43
|
-
|
|
47
|
+
entries.push({
|
|
48
|
+
sourceValue,
|
|
49
|
+
targetValue,
|
|
50
|
+
// The spec's default is true: the bound itself is in range unless the
|
|
51
|
+
// entry says otherwise.
|
|
52
|
+
includeBoundary: entry.getAttribute('include-boundary') !== 'false'
|
|
53
|
+
});
|
|
44
54
|
}
|
|
45
|
-
return
|
|
55
|
+
return entries;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A qti-match-table maps a source value onto a target exactly, with no
|
|
59
|
+
* boundaries and no interpolation. Targets keep their authored spelling
|
|
60
|
+
* because a match table is not restricted to numeric outcomes.
|
|
61
|
+
*/
|
|
62
|
+
get matchTable() {
|
|
63
|
+
const table = this.querySelector('qti-match-table');
|
|
64
|
+
if (!table)
|
|
65
|
+
return null;
|
|
66
|
+
const entries = new Map();
|
|
67
|
+
for (const entry of table.querySelectorAll('qti-match-table-entry')) {
|
|
68
|
+
const sourceValue = parseFloat(entry.getAttribute('source-value'));
|
|
69
|
+
const targetValue = entry.getAttribute('target-value');
|
|
70
|
+
if (Number.isNaN(sourceValue) || targetValue === null) {
|
|
71
|
+
console.error('source-value or target-value is missing or invalid in qti-match-table-entry');
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
entries.set(sourceValue, targetValue);
|
|
75
|
+
}
|
|
76
|
+
return entries;
|
|
46
77
|
}
|
|
47
78
|
connectedCallback() {
|
|
48
79
|
super.connectedCallback();
|
|
@@ -55,6 +86,7 @@ export class QtiOutcomeDeclaration extends QtiVariableDeclaration {
|
|
|
55
86
|
type: 'outcome',
|
|
56
87
|
value: null,
|
|
57
88
|
interpolationTable: this.interpolationTable,
|
|
89
|
+
matchTable: this.matchTable,
|
|
58
90
|
externalScored: this.externalScored
|
|
59
91
|
};
|
|
60
92
|
// At runtime, outcome variables are instantiated as part of an item session.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-outcome-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-outcome-declaration/qti-outcome-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAM9D,MAAM,OAAO,qBAAsB,SAAQ,sBAAsB;IAAjE;;QAE4D,mBAAc,GAAuC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"qti-outcome-declaration.js","sourceRoot":"","sources":["../../../src/components/qti-outcome-declaration/qti-outcome-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAM9D,MAAM,OAAO,qBAAsB,SAAQ,sBAAsB;IAAjE;;QAE4D,mBAAc,GAAuC,IAAI,CAAC;IA2GtH,CAAC;aAnGiB,WAAM,GAAG;QACvB,GAAG,CAAA;;;;KAIF;KACF,AAN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KAAK,IAAI,SAAS,CAAC;YACtE,CAAC,eAAe,CAAC,QAAQ,KAAK,SAAS,IAAI,eAAe,CAAC,QAAQ,KAAK,OAAO,CAAC,EAChF,CAAC;YACD,eAAe,CAAC,KAAK,GAAG,GAAG,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,uBAAuB,EAAE;YACvC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE;SACtC,CAAC,CACH,CAAC;IACJ,CAAC;;AA3GmD;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;uDAAoB;AACb;IAAzD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;6DAA2D;AACxF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA0B;AAI9C;IAFN,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;0DACyB","sourcesContent":["import { consume } from '@lit/context';\nimport { css, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { itemContext } from '@qti-components/base';\nimport { QtiVariableDeclaration } from '@qti-components/base';\n\nimport type { BaseType, Cardinality } from '@qti-components/base';\nimport type { InterpolationTableEntry, OutcomeVariable } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\n\nexport class QtiOutcomeDeclaration extends QtiVariableDeclaration {\n @property({ type: String, attribute: 'base-type' }) baseType: BaseType;\n @property({ type: String, attribute: 'external-scored' }) externalScored: 'human' | 'externalMachine' | null = null;\n @property({ type: String }) identifier: string;\n @property({ type: String }) cardinality: Cardinality;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n public itemContext?: ItemContext;\n\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n override render() {\n const value = this.itemContext?.variables.find(v => v.identifier === this.identifier)?.value;\n return html`${JSON.stringify(value, null, 2)}`;\n }\n\n /**\n * The entries of a `qti-interpolation-table`, in document order.\n *\n * Order is load-bearing: each entry's `source-value` is the lower bound of a\n * range, and the lookup takes the first entry whose bound the source value\n * clears. A Map keyed by source value cannot express that.\n */\n get interpolationTable(): InterpolationTableEntry[] | null {\n const table = this.querySelector('qti-interpolation-table');\n if (!table) return null;\n\n const entries: InterpolationTableEntry[] = [];\n for (const entry of table.querySelectorAll('qti-interpolation-table-entry')) {\n const sourceValue = parseFloat(entry.getAttribute('source-value'));\n const targetValue = parseFloat(entry.getAttribute('target-value'));\n if (Number.isNaN(sourceValue) || Number.isNaN(targetValue)) {\n console.error('source-value or target-value is missing or not a number in qti-interpolation-table-entry');\n continue;\n }\n entries.push({\n sourceValue,\n targetValue,\n // The spec's default is true: the bound itself is in range unless the\n // entry says otherwise.\n includeBoundary: entry.getAttribute('include-boundary') !== 'false'\n });\n }\n return entries;\n }\n\n /**\n * A qti-match-table maps a source value onto a target exactly, with no\n * boundaries and no interpolation. Targets keep their authored spelling\n * because a match table is not restricted to numeric outcomes.\n */\n get matchTable(): Map<number, string> | null {\n const table = this.querySelector('qti-match-table');\n if (!table) return null;\n\n const entries = new Map<number, string>();\n for (const entry of table.querySelectorAll('qti-match-table-entry')) {\n const sourceValue = parseFloat(entry.getAttribute('source-value'));\n const targetValue = entry.getAttribute('target-value');\n if (Number.isNaN(sourceValue) || targetValue === null) {\n console.error('source-value or target-value is missing or invalid in qti-match-table-entry');\n continue;\n }\n entries.set(sourceValue, targetValue);\n }\n return entries;\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n\n const defaultValue = this.defaultValues(this.cardinality);\n\n const outcomeVariable: OutcomeVariable = {\n identifier: this.identifier,\n cardinality: this.cardinality,\n baseType: this.baseType,\n defaultValue: defaultValue,\n type: 'outcome',\n value: null,\n interpolationTable: this.interpolationTable,\n matchTable: this.matchTable,\n externalScored: this.externalScored\n };\n // At runtime, outcome variables are instantiated as part of an item session.\n // Their values may be initialized with a default value and/or set during response processing.\n // If no default value is given in the declaration then the outcome variable is initialized to NULL unless the outcome is of a numeric type (integer or float) in which case it is initialized to 0.\n outcomeVariable.value = defaultValue;\n if (\n (outcomeVariable.value === null || outcomeVariable.value == undefined) &&\n (outcomeVariable.baseType === 'integer' || outcomeVariable.baseType === 'float')\n ) {\n outcomeVariable.value = '0';\n }\n this.dispatchEvent(\n new CustomEvent('qti-register-variable', {\n bubbles: true,\n composed: true,\n detail: { variable: outcomeVariable }\n })\n );\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-outcome-declaration': QtiOutcomeDeclaration;\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit';
|
|
2
|
+
import { QtiExitResponseSignal } from '@qti-components/base';
|
|
2
3
|
import { mapResponse, mapResponsePoint, matchCorrect } from '../../internal/template-strings';
|
|
3
4
|
/** The response processing templates we substitute for, keyed by the file name in `template`. */
|
|
4
5
|
const responseProcessingTemplates = {
|
|
@@ -22,8 +23,17 @@ export class QtiResponseProcessing extends LitElement {
|
|
|
22
23
|
if (!assessmentItem)
|
|
23
24
|
return;
|
|
24
25
|
const rules = [...this.children];
|
|
25
|
-
|
|
26
|
-
rule
|
|
26
|
+
try {
|
|
27
|
+
for (const rule of rules) {
|
|
28
|
+
rule.process();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
// `qti-exit-response` ends the attempt's processing from wherever it
|
|
33
|
+
// sits, however deeply nested. Reaching here is the rule doing its job,
|
|
34
|
+
// so the run simply stops; anything else is a real failure and rethrows.
|
|
35
|
+
if (!(error instanceof QtiExitResponseSignal))
|
|
36
|
+
throw error;
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
firstUpdated(_changedProperties) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-response-processing.js","sourceRoot":"","sources":["../../../src/components/qti-response-processing/qti-response-processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"qti-response-processing.js","sourceRoot":"","sources":["../../../src/components/qti-response-processing/qti-response-processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAoB,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI9F,iGAAiG;AACjG,MAAM,2BAA2B,GAA2B;IAC1D,YAAY,EAAE,WAAW;IACzB,kBAAkB,EAAE,gBAAgB;IACpC,aAAa,EAAE,YAAY;CAC5B,CAAC;AAEF,MAAM,OAAO,qBAAsB,SAAQ,UAAU;aACnC,WAAM,GAAG;QACvB,GAAG,CAAA;;;;KAIF;KACF,CAAC;IAEO,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;IAEM,OAAO;QACZ,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC3D,IAAI,CAAC,cAAc;YAAE,OAAO;QAC5B,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAA6B,CAAC;QAC7D,IAAI,CAAC;YACH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,qEAAqE;YACrE,wEAAwE;YACxE,yEAAyE;YACzE,IAAI,CAAC,CAAC,KAAK,YAAY,qBAAqB,CAAC;gBAAE,MAAM,KAAK,CAAC;QAC7D,CAAC;IACH,CAAC;IAEe,YAAY,CAAC,kBAAqE;QAChG,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,2BAA2B,CAAC,YAAY,CAAC,CAAC;QACxD,uFAAuF;QACvF,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,+FAA+F;QAC/F,yFAAyF;QACzF,8FAA8F;QAC9F,6FAA6F;QAC7F,4EAA4E;QAC5E,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC","sourcesContent":["import { css, html, LitElement } from 'lit';\n\nimport { QtiExitResponseSignal, type QtiRuleBase } from '@qti-components/base';\n\nimport { mapResponse, mapResponsePoint, matchCorrect } from '../../internal/template-strings';\n\nimport type { PropertyValueMap } from 'lit';\n\n/** The response processing templates we substitute for, keyed by the file name in `template`. */\nconst responseProcessingTemplates: Record<string, string> = {\n map_response: mapResponse,\n map_response_point: mapResponsePoint,\n match_correct: matchCorrect\n};\n\nexport class QtiResponseProcessing extends LitElement {\n static override styles = [\n css`\n :host {\n display: none;\n }\n `\n ];\n\n override render() {\n return html`<slot></slot>`;\n }\n\n public process() {\n const assessmentItem = this.closest('qti-assessment-item');\n if (!assessmentItem) return;\n const rules = [...this.children] as unknown as QtiRuleBase[];\n try {\n for (const rule of rules) {\n rule.process();\n }\n } catch (error) {\n // `qti-exit-response` ends the attempt's processing from wherever it\n // sits, however deeply nested. Reaching here is the rule doing its job,\n // so the run simply stops; anything else is a real failure and rethrows.\n if (!(error instanceof QtiExitResponseSignal)) throw error;\n }\n }\n\n public override firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n const template = this.getAttribute('template');\n if (!template) return;\n\n const templateName = template.split('/').pop()!.replace('.xml', '');\n const rules = responseProcessingTemplates[templateName];\n // Leave an unknown template's authored children alone; there is nothing to substitute.\n if (!rules) return;\n\n // Parsed through this element's own `innerHTML` rather than a fragment created off `document`:\n // the HTML fragment parsing algorithm takes its custom element registry from the context\n // element, so the rules are upgraded with the registry this element lives in. A fragment from\n // `document.createRange()` is parsed against the global registry, which leaves every rule an\n // unupgraded HTMLElement when the item was rendered into a scoped registry.\n this.innerHTML = rules;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-response-processing': QtiResponseProcessing;\n }\n}\n"]}
|
package/dist/elements.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { QtiAssessmentItem } from './components/qti-assessment-item/qti-assessment-item';
|
|
2
|
+
import { QtiAssessmentStimulus } from './components/qti-assessment-stimulus/qti-assessment-stimulus';
|
|
2
3
|
import { QtiAssessmentStimulusRef } from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';
|
|
3
4
|
import { QtiCompanionMaterialsInfo } from './components/qti-companion-materials-info/qti-companion-materials-info';
|
|
4
5
|
import { QtiContentBody } from './components/qti-content-body/qti-content-body';
|
|
@@ -16,10 +17,13 @@ import { QtiStylesheet } from './components/qti-stylesheet/qti-stylesheet';
|
|
|
16
17
|
import { QtiTemplateConstraint } from './components/qti-template-constraint/qti-template-constraint';
|
|
17
18
|
import { QtiTemplateDeclaration } from './components/qti-template-declaration/qti-template-declaration';
|
|
18
19
|
import { QtiTemplateProcessing } from './components/qti-template-processing/qti-template-processing';
|
|
19
|
-
export { QtiAssessmentItem, QtiAssessmentStimulusRef, QtiCompanionMaterialsInfo, QtiContentBody, QtiContextDeclaration, QtiCustomOperator, QtiFeedbackBlock, QtiFeedbackInline, QtiItemBody, QtiModalFeedback, QtiOutcomeDeclaration, QtiResponseDeclaration, QtiResponseProcessing, QtiRubricBlock, QtiStylesheet, QtiTemplateConstraint, QtiTemplateDeclaration, QtiTemplateProcessing };
|
|
20
|
+
export { QtiAssessmentItem, QtiAssessmentStimulus, QtiAssessmentStimulusRef, QtiCompanionMaterialsInfo, QtiContentBody, QtiContextDeclaration, QtiCustomOperator, QtiFeedbackBlock, QtiFeedbackInline, QtiItemBody, QtiModalFeedback, QtiOutcomeDeclaration, QtiResponseDeclaration, QtiResponseProcessing, QtiRubricBlock, QtiStylesheet, QtiTemplateConstraint, QtiTemplateDeclaration, QtiTemplateProcessing };
|
|
20
21
|
export declare const qtiContentElements: readonly [{
|
|
21
22
|
readonly tag: "qti-assessment-item";
|
|
22
23
|
readonly ctor: typeof QtiAssessmentItem;
|
|
24
|
+
}, {
|
|
25
|
+
readonly tag: "qti-assessment-stimulus";
|
|
26
|
+
readonly ctor: typeof QtiAssessmentStimulus;
|
|
23
27
|
}, {
|
|
24
28
|
readonly tag: "qti-assessment-stimulus-ref";
|
|
25
29
|
readonly ctor: typeof QtiAssessmentStimulusRef;
|
package/dist/elements.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { QtiAssessmentItem } from './components/qti-assessment-item/qti-assessment-item';
|
|
2
|
+
import { QtiAssessmentStimulus } from './components/qti-assessment-stimulus/qti-assessment-stimulus';
|
|
2
3
|
import { QtiAssessmentStimulusRef } from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';
|
|
3
4
|
import { QtiCompanionMaterialsInfo } from './components/qti-companion-materials-info/qti-companion-materials-info';
|
|
4
5
|
import { QtiContentBody } from './components/qti-content-body/qti-content-body';
|
|
@@ -16,9 +17,10 @@ import { QtiStylesheet } from './components/qti-stylesheet/qti-stylesheet';
|
|
|
16
17
|
import { QtiTemplateConstraint } from './components/qti-template-constraint/qti-template-constraint';
|
|
17
18
|
import { QtiTemplateDeclaration } from './components/qti-template-declaration/qti-template-declaration';
|
|
18
19
|
import { QtiTemplateProcessing } from './components/qti-template-processing/qti-template-processing';
|
|
19
|
-
export { QtiAssessmentItem, QtiAssessmentStimulusRef, QtiCompanionMaterialsInfo, QtiContentBody, QtiContextDeclaration, QtiCustomOperator, QtiFeedbackBlock, QtiFeedbackInline, QtiItemBody, QtiModalFeedback, QtiOutcomeDeclaration, QtiResponseDeclaration, QtiResponseProcessing, QtiRubricBlock, QtiStylesheet, QtiTemplateConstraint, QtiTemplateDeclaration, QtiTemplateProcessing };
|
|
20
|
+
export { QtiAssessmentItem, QtiAssessmentStimulus, QtiAssessmentStimulusRef, QtiCompanionMaterialsInfo, QtiContentBody, QtiContextDeclaration, QtiCustomOperator, QtiFeedbackBlock, QtiFeedbackInline, QtiItemBody, QtiModalFeedback, QtiOutcomeDeclaration, QtiResponseDeclaration, QtiResponseProcessing, QtiRubricBlock, QtiStylesheet, QtiTemplateConstraint, QtiTemplateDeclaration, QtiTemplateProcessing };
|
|
20
21
|
export const qtiContentElements = [
|
|
21
22
|
{ tag: 'qti-assessment-item', ctor: QtiAssessmentItem },
|
|
23
|
+
{ tag: 'qti-assessment-stimulus', ctor: QtiAssessmentStimulus },
|
|
22
24
|
{ tag: 'qti-assessment-stimulus-ref', ctor: QtiAssessmentStimulusRef },
|
|
23
25
|
{ tag: 'qti-companion-materials-info', ctor: QtiCompanionMaterialsInfo },
|
|
24
26
|
{ tag: 'qti-content-body', ctor: QtiContentBody },
|
package/dist/elements.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sEAAsE,CAAC;AAChH,OAAO,EAAE,yBAAyB,EAAE,MAAM,wEAAwE,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,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I,EAAE,cAAc,EAAE;IACjD,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC/D,EAAE,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACvD,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,gBAAgB,EAAE;IACrD,EAAE,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACvD,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,gBAAgB,EAAE;IACrD,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC/D,EAAE,GAAG,EAAE,0BAA0B,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACjE,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC/D,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;IACjD,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC9C,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC/D,EAAE,GAAG,EAAE,0BAA0B,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACjE,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;CACvD,CAAC","sourcesContent":["import { QtiAssessmentItem } from './components/qti-assessment-item/qti-assessment-item';\nimport { QtiAssessmentStimulusRef } from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';\nimport { QtiCompanionMaterialsInfo } from './components/qti-companion-materials-info/qti-companion-materials-info';\nimport { QtiContentBody } from './components/qti-content-body/qti-content-body';\nimport { QtiContextDeclaration } from './components/qti-context-declaration/qti-context-declaration';\nimport { QtiCustomOperator } from './components/qti-custom-operator/qti-custom-operator';\nimport { QtiFeedbackBlock } from './components/qti-feedback-block/qti-feedback-block';\nimport { QtiFeedbackInline } from './components/qti-feedback-inline/qti-feedback-inline';\nimport { QtiItemBody } from './components/qti-item-body/qti-item-body';\nimport { QtiModalFeedback } from './components/qti-modal-feedback/qti-modal-feedback';\nimport { QtiOutcomeDeclaration } from './components/qti-outcome-declaration/qti-outcome-declaration';\nimport { QtiResponseDeclaration } from './components/qti-response-declaration/qti-response-declaration';\nimport { QtiResponseProcessing } from './components/qti-response-processing/qti-response-processing';\nimport { QtiRubricBlock } from './components/qti-rubric-block/qti-rubric-block';\nimport { QtiStylesheet } from './components/qti-stylesheet/qti-stylesheet';\nimport { QtiTemplateConstraint } from './components/qti-template-constraint/qti-template-constraint';\nimport { QtiTemplateDeclaration } from './components/qti-template-declaration/qti-template-declaration';\nimport { QtiTemplateProcessing } from './components/qti-template-processing/qti-template-processing';\n\nexport {\n QtiAssessmentItem,\n QtiAssessmentStimulusRef,\n QtiCompanionMaterialsInfo,\n QtiContentBody,\n QtiContextDeclaration,\n QtiCustomOperator,\n QtiFeedbackBlock,\n QtiFeedbackInline,\n QtiItemBody,\n QtiModalFeedback,\n QtiOutcomeDeclaration,\n QtiResponseDeclaration,\n QtiResponseProcessing,\n QtiRubricBlock,\n QtiStylesheet,\n QtiTemplateConstraint,\n QtiTemplateDeclaration,\n QtiTemplateProcessing\n};\n\nexport const qtiContentElements = [\n { tag: 'qti-assessment-item', ctor: QtiAssessmentItem },\n { tag: 'qti-assessment-stimulus-ref', ctor: QtiAssessmentStimulusRef },\n { tag: 'qti-companion-materials-info', ctor: QtiCompanionMaterialsInfo },\n { tag: 'qti-content-body', ctor: QtiContentBody },\n { tag: 'qti-context-declaration', ctor: QtiContextDeclaration },\n { tag: 'qti-custom-operator', ctor: QtiCustomOperator },\n { tag: 'qti-feedback-block', ctor: QtiFeedbackBlock },\n { tag: 'qti-feedback-inline', ctor: QtiFeedbackInline },\n { tag: 'qti-item-body', ctor: QtiItemBody },\n { tag: 'qti-modal-feedback', ctor: QtiModalFeedback },\n { tag: 'qti-outcome-declaration', ctor: QtiOutcomeDeclaration },\n { tag: 'qti-response-declaration', ctor: QtiResponseDeclaration },\n { tag: 'qti-response-processing', ctor: QtiResponseProcessing },\n { tag: 'qti-rubric-block', ctor: QtiRubricBlock },\n { tag: 'qti-stylesheet', ctor: QtiStylesheet },\n { tag: 'qti-template-constraint', ctor: QtiTemplateConstraint },\n { tag: 'qti-template-declaration', ctor: QtiTemplateDeclaration },\n { tag: 'qti-template-processing', ctor: QtiTemplateProcessing }\n] as const;\n"]}
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAE,wBAAwB,EAAE,MAAM,sEAAsE,CAAC;AAChH,OAAO,EAAE,yBAAyB,EAAE,MAAM,wEAAwE,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACh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,EAAE;IACrD,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC/D,EAAE,GAAG,EAAE,0BAA0B,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACjE,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC/D,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;IACjD,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC9C,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC/D,EAAE,GAAG,EAAE,0BAA0B,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACjE,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,qBAAqB,EAAE;CACvD,CAAC","sourcesContent":["import { QtiAssessmentItem } from './components/qti-assessment-item/qti-assessment-item';\nimport { QtiAssessmentStimulus } from './components/qti-assessment-stimulus/qti-assessment-stimulus';\nimport { QtiAssessmentStimulusRef } from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';\nimport { QtiCompanionMaterialsInfo } from './components/qti-companion-materials-info/qti-companion-materials-info';\nimport { QtiContentBody } from './components/qti-content-body/qti-content-body';\nimport { QtiContextDeclaration } from './components/qti-context-declaration/qti-context-declaration';\nimport { QtiCustomOperator } from './components/qti-custom-operator/qti-custom-operator';\nimport { QtiFeedbackBlock } from './components/qti-feedback-block/qti-feedback-block';\nimport { QtiFeedbackInline } from './components/qti-feedback-inline/qti-feedback-inline';\nimport { QtiItemBody } from './components/qti-item-body/qti-item-body';\nimport { QtiModalFeedback } from './components/qti-modal-feedback/qti-modal-feedback';\nimport { QtiOutcomeDeclaration } from './components/qti-outcome-declaration/qti-outcome-declaration';\nimport { QtiResponseDeclaration } from './components/qti-response-declaration/qti-response-declaration';\nimport { QtiResponseProcessing } from './components/qti-response-processing/qti-response-processing';\nimport { QtiRubricBlock } from './components/qti-rubric-block/qti-rubric-block';\nimport { QtiStylesheet } from './components/qti-stylesheet/qti-stylesheet';\nimport { QtiTemplateConstraint } from './components/qti-template-constraint/qti-template-constraint';\nimport { QtiTemplateDeclaration } from './components/qti-template-declaration/qti-template-declaration';\nimport { QtiTemplateProcessing } from './components/qti-template-processing/qti-template-processing';\n\nexport {\n QtiAssessmentItem,\n QtiAssessmentStimulus,\n QtiAssessmentStimulusRef,\n QtiCompanionMaterialsInfo,\n QtiContentBody,\n QtiContextDeclaration,\n QtiCustomOperator,\n QtiFeedbackBlock,\n QtiFeedbackInline,\n QtiItemBody,\n QtiModalFeedback,\n QtiOutcomeDeclaration,\n QtiResponseDeclaration,\n QtiResponseProcessing,\n QtiRubricBlock,\n QtiStylesheet,\n QtiTemplateConstraint,\n QtiTemplateDeclaration,\n QtiTemplateProcessing\n};\n\nexport const qtiContentElements = [\n { tag: 'qti-assessment-item', ctor: QtiAssessmentItem },\n { tag: 'qti-assessment-stimulus', ctor: QtiAssessmentStimulus },\n { tag: 'qti-assessment-stimulus-ref', ctor: QtiAssessmentStimulusRef },\n { tag: 'qti-companion-materials-info', ctor: QtiCompanionMaterialsInfo },\n { tag: 'qti-content-body', ctor: QtiContentBody },\n { tag: 'qti-context-declaration', ctor: QtiContextDeclaration },\n { tag: 'qti-custom-operator', ctor: QtiCustomOperator },\n { tag: 'qti-feedback-block', ctor: QtiFeedbackBlock },\n { tag: 'qti-feedback-inline', ctor: QtiFeedbackInline },\n { tag: 'qti-item-body', ctor: QtiItemBody },\n { tag: 'qti-modal-feedback', ctor: QtiModalFeedback },\n { tag: 'qti-outcome-declaration', ctor: QtiOutcomeDeclaration },\n { tag: 'qti-response-declaration', ctor: QtiResponseDeclaration },\n { tag: 'qti-response-processing', ctor: QtiResponseProcessing },\n { tag: 'qti-rubric-block', ctor: QtiRubricBlock },\n { tag: 'qti-stylesheet', ctor: QtiStylesheet },\n { tag: 'qti-template-constraint', ctor: QtiTemplateConstraint },\n { tag: 'qti-template-declaration', ctor: QtiTemplateDeclaration },\n { tag: 'qti-template-processing', ctor: QtiTemplateProcessing }\n] as const;\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './register';
|
|
2
2
|
export * from './components/qti-assessment-item/qti-assessment-item';
|
|
3
|
+
export * from './components/qti-assessment-stimulus/qti-assessment-stimulus';
|
|
3
4
|
export * from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';
|
|
4
5
|
export * from './components/qti-companion-materials-info/qti-companion-materials-info';
|
|
5
6
|
export * from './components/qti-custom-operator/qti-custom-operator';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './register';
|
|
2
2
|
export * from './components/qti-assessment-item/qti-assessment-item';
|
|
3
|
+
export * from './components/qti-assessment-stimulus/qti-assessment-stimulus';
|
|
3
4
|
export * from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';
|
|
4
5
|
export * from './components/qti-companion-materials-info/qti-companion-materials-info';
|
|
5
6
|
export * from './components/qti-custom-operator/qti-custom-operator';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AAEpB,cAAc,sDAAsD,CAAC;AACrE,cAAc,sEAAsE,CAAC;AACrF,cAAc,wEAAwE,CAAC;AACvF,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC","sourcesContent":["import './register';\n\nexport * from './components/qti-assessment-item/qti-assessment-item';\nexport * from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';\nexport * from './components/qti-companion-materials-info/qti-companion-materials-info';\nexport * from './components/qti-custom-operator/qti-custom-operator';\nexport * from './components/qti-feedback-block/qti-feedback-block';\nexport * from './components/qti-feedback-inline/qti-feedback-inline';\nexport * from './components/qti-modal-feedback/qti-modal-feedback';\nexport * from './components/qti-item-body/qti-item-body';\nexport * from './components/qti-content-body/qti-content-body';\nexport * from './components/qti-rubric-block/qti-rubric-block';\nexport * from './components/qti-stylesheet/qti-stylesheet';\nexport * from './components/qti-response-declaration/qti-response-declaration';\nexport * from './components/qti-outcome-declaration/qti-outcome-declaration';\nexport * from './components/qti-response-processing/qti-response-processing';\nexport * from './components/qti-template-declaration/qti-template-declaration';\nexport * from './components/qti-template-processing/qti-template-processing';\nexport * from './components/qti-template-constraint/qti-template-constraint';\nexport * from './components/qti-context-declaration/qti-context-declaration';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AAEpB,cAAc,sDAAsD,CAAC;AACrE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,sEAAsE,CAAC;AACrF,cAAc,wEAAwE,CAAC;AACvF,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,8DAA8D,CAAC","sourcesContent":["import './register';\n\nexport * from './components/qti-assessment-item/qti-assessment-item';\nexport * from './components/qti-assessment-stimulus/qti-assessment-stimulus';\nexport * from './components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref';\nexport * from './components/qti-companion-materials-info/qti-companion-materials-info';\nexport * from './components/qti-custom-operator/qti-custom-operator';\nexport * from './components/qti-feedback-block/qti-feedback-block';\nexport * from './components/qti-feedback-inline/qti-feedback-inline';\nexport * from './components/qti-modal-feedback/qti-modal-feedback';\nexport * from './components/qti-item-body/qti-item-body';\nexport * from './components/qti-content-body/qti-content-body';\nexport * from './components/qti-rubric-block/qti-rubric-block';\nexport * from './components/qti-stylesheet/qti-stylesheet';\nexport * from './components/qti-response-declaration/qti-response-declaration';\nexport * from './components/qti-outcome-declaration/qti-outcome-declaration';\nexport * from './components/qti-response-processing/qti-response-processing';\nexport * from './components/qti-template-declaration/qti-template-declaration';\nexport * from './components/qti-template-processing/qti-template-processing';\nexport * from './components/qti-template-constraint/qti-template-constraint';\nexport * from './components/qti-context-declaration/qti-context-declaration';\n"]}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qti-components/elements",
|
|
3
3
|
"description": "QTI elements utilities",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.9.0",
|
|
5
5
|
"author": "",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@qti-components/base": "^2.
|
|
8
|
-
"@qti-components/transformers": "^1.7.
|
|
7
|
+
"@qti-components/base": "^2.4.0",
|
|
8
|
+
"@qti-components/transformers": "^1.7.3",
|
|
9
9
|
"@qti-components/utilities": "^1.3.3"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@lit/context": "^1.1.6",
|
|
13
|
-
"lit": "^3.3.
|
|
13
|
+
"lit": "^3.3.1"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"elements",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"attw": "attw --profile esm-only --pack",
|
|
56
|
-
"build": "tsc --paths null",
|
|
56
|
+
"build": "pnpm run clean && tsc --paths null",
|
|
57
57
|
"clean": "rm -rf dist",
|
|
58
58
|
"yalc": "yalc publish",
|
|
59
59
|
"yalc:push": "yalc push"
|